Z zewnętrznej sieci widoczne sa notatki oznaczone jako publiczne. #61

Merged
krzysiej merged 1 commits from issue-59 into master 2018-09-19 20:05:48 +02:00
4 changed files with 31 additions and 19 deletions

View File

@@ -9,11 +9,8 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
set_time_limit(-1); set_time_limit(-1);
use App\Paper\Airly;
use App\Paper\Paper; use App\Paper\Paper;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\Printer;
use Intervention\Image\ImageManagerStatic as Image; use Intervention\Image\ImageManagerStatic as Image;
use Mike42\Escpos\EscposImage; use Mike42\Escpos\EscposImage;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@@ -219,11 +216,13 @@ class Main extends Controller
'text' => $this->templateReplace($request->input('text')), 'text' => $this->templateReplace($request->input('text')),
'icon' => $request->input('icon'), 'icon' => $request->input('icon'),
'type' => self::NOTE, 'type' => self::NOTE,
'private' => $request->input('private', 0),
'created_at' => time(), 'created_at' => time(),
'updated_at' => time() 'updated_at' => time()
]); ]);
$note = DB::table('note')->where('id', $id)->first(); $note = DB::table('note')->where('id', $id)->first();
} else { } else {
DB::table('note') DB::table('note')
->where('id', $note->id) ->where('id', $note->id)
->update([ ->update([
@@ -231,6 +230,7 @@ class Main extends Controller
'topic_slug' => str_slug($request->input('title'), '_'), 'topic_slug' => str_slug($request->input('title'), '_'),
'text' => $request->input('text'), 'text' => $request->input('text'),
'icon' => $request->input('icon'), 'icon' => $request->input('icon'),
'private' => $request->input('private',0),
'updated_at' => time(), 'updated_at' => time(),
]); ]);
} }
@@ -250,6 +250,7 @@ class Main extends Controller
'text' => $note->text, 'text' => $note->text,
'icon_selected' => $note->icon, 'icon_selected' => $note->icon,
'type' => $note->type, 'type' => $note->type,
'private' => $note->private,
'id' => $note->id, 'id' => $note->id,
'icons' => $this->paper->getIcons(), 'icons' => $this->paper->getIcons(),
'topic_slug' => $note->topic_slug, 'topic_slug' => $note->topic_slug,
@@ -273,6 +274,7 @@ class Main extends Controller
'text' => $request->input('text'), 'text' => $request->input('text'),
'icon' => $request->input('icon'), 'icon' => $request->input('icon'),
'type' => self::NOTE, 'type' => self::NOTE,
'private' => $request->input('private',0),
'created_at' => time(), 'created_at' => time(),
'updated_at' => time() 'updated_at' => time()
]); ]);
@@ -286,6 +288,7 @@ class Main extends Controller
'text' => $request->input('text'), 'text' => $request->input('text'),
'icon' => $request->input('icon'), 'icon' => $request->input('icon'),
'type' => self::TEMPLATE, 'type' => self::TEMPLATE,
'private' => $request->input('private',0),
'created_at' => time(), 'created_at' => time(),
'updated_at' => time() 'updated_at' => time()
]); ]);

View File

@@ -12,7 +12,7 @@ return [
| any other location as required by the application or its packages. | any other location as required by the application or its packages.
*/ */
'name' => 'Laravel', 'name' => 'Paper.Pi',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -64,7 +64,7 @@ return [
| |
*/ */
'timezone' => 'UTC', 'timezone' => 'Europe/Warsaw',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

View File

@@ -33,6 +33,11 @@
@if(isset($id)) @if(isset($id))
<button class="ui delete button js-delete red" type="submit" name="delete">Usuń</button> <button class="ui delete button js-delete red" type="submit" name="delete">Usuń</button>
@endif @endif
<div class="ui @if(isset($private) && $private == 1) checked @endif checkbox">
<input name="private" id="private" @if(isset($private) && $private == 1) checked="checked" @endif value="1" type="checkbox">
<label for="private">Prywatna notatka</label>
</div>
</form> </form>

View File

@@ -50,22 +50,26 @@
<h1 class="ui header"> @if(isset($filter)) <a href="/">Lista notatek</a> z ikonką <span <h1 class="ui header"> @if(isset($filter)) <a href="/">Lista notatek</a> z ikonką <span
class="icon {{ $filter }} display-inline-block"></span>@else Lista notatek @endif</h1> class="icon {{ $filter }} display-inline-block"></span>@else Lista notatek @endif</h1>
<div class="ui middle aligned divided list"> <div class="ui middle aligned divided list">
@foreach($notes as $note) @foreach($notes as $note)
<div class="item"> @if($note->private != 1 || $_SERVER['REMOTE_ADDR'] == '192.168.0.1')
<div class="left floated content"> <div class="item">
<a href="/filter/{{ $note->icon }}" class="left floated"><span <div class="left floated content">
class="icon @if($note->icon){{ $note->icon }} @else empty @endif " <a href="/filter/{{ $note->icon }}" class="left floated"><span
title="{{ $note->icon }}"></span></a><a class="note-title" class="icon @if($note->icon){{ $note->icon }} @else empty @endif "
href="/edit/{{ $note->id }}/{{ $note->topic_slug?$note->topic_slug:str_limit($note->text, 30, '...') }}">{{ $note->topic?$note->topic:str_limit($note->text, 30, '...') }} title="{{ $note->icon }}"></span></a><a class="note-title"
</a> href="/edit/{{ $note->id }}/{{ $note->topic_slug?$note->topic_slug:str_limit($note->text, 30, '...') }}">{{ $note->topic?$note->topic:str_limit($note->text, 30, '...') }}
</a>
</div>
<div class="right floated content">
<form method="post" action="/print/{{ $note->id }}">
{{ csrf_field() }}
<button type="primary" class="ui tiny button primary">Drukuj</button>
</form>
</div>
</div> </div>
<div class="right floated content"> @endif
<form method="post" action="/print/{{ $note->id }}">
{{ csrf_field() }}
<button type="primary" class="ui tiny button primary">Drukuj</button>
</form>
</div>
</div>
@endforeach @endforeach
</div> </div>
<h1 class="ui header">Szablony notatek</h1> <h1 class="ui header">Szablony notatek</h1>