Skip to content

Commit

Permalink
Merge branch '3.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
sampoyigi committed Sep 28, 2023
2 parents ef357a2 + 2682642 commit a2ecaa5
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 47 deletions.
2 changes: 1 addition & 1 deletion app/admin/assets/js/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/admin/assets/src/js/selectlist.js
Expand Up @@ -32,7 +32,7 @@
SelectList.DEFAULTS = {
maxValuesShown: 5,
showSearch: false,

allowDeselect: true
}

var old = $.fn.selectList
Expand Down
Expand Up @@ -29,7 +29,7 @@ public function up()
->value('value');

$widgets = collect(json_decode($widgets, true))->mapWithKeys(function ($properties, $alias) {
if ($options = array_get($this->widgetsMap, array_pull($properties, 'class'))) {
if ($options = array_get($this->widgetsMap, array_pull($properties, 'class', ''))) {
$properties['widget'] = $options[0];

$props = array_pull($properties, 'config');
Expand Down
9 changes: 8 additions & 1 deletion app/admin/formwidgets/MediaFinder.php
Expand Up @@ -238,7 +238,12 @@ public function onAddAttachment()
));
}

$items = post('items');
$items = $this->validate(request()->input(), [
'items' => ['required', 'array'],
'items.*.name' => ['required', 'string'],
'items.*.path' => ['required', 'string'],
]);

if (!is_array($items))
throw new ApplicationException(lang('main::lang.media_manager.alert_select_item_to_attach'));

Expand All @@ -248,6 +253,8 @@ public function onAddAttachment()

$manager = MediaLibrary::instance();
foreach ($items as &$item) {
$item['path'] = strip_tags($item['path']);

$media = $model->newMediaInstance();
$media->addFromRaw(
$manager->get(array_get($item, 'path'), true),
Expand Down
19 changes: 13 additions & 6 deletions app/admin/formwidgets/markdowneditor/assets/css/markdowneditor.css
@@ -1,17 +1,24 @@
.editor-toolbar {
border-color: var(--bs-gray-300);
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-color: var(--bs-gray-300);
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}

.editor-toolbar button.table {
width: 30px;
}

.editor-toolbar button.active,
.editor-toolbar button:hover {
border-color: var(--bs-gray-300);
border-color: var(--bs-gray-300);
}

.field-markdowneditor .CodeMirror {
border: 1px solid var(--bs-gray-300);
border: 1px solid var(--bs-gray-300);
}

.editor-toolbar.fullscreen,
.field-markdowneditor .CodeMirror-fullscreen,
.editor-preview-side {
z-index: 1040;
z-index: 1040;
}
Expand Up @@ -12,6 +12,6 @@ class="field-markdowneditor size-{{ $size }}"
rows="20"
class="form-control"
{!! $this->previewMode ? 'disabled="disabled"' : '' !!}
>{!! $value !!}</textarea>
>{{$value}}</textarea>
</div>
@endif
2 changes: 1 addition & 1 deletion app/admin/formwidgets/richeditor/richeditor.blade.php
Expand Up @@ -9,6 +9,6 @@ class="field-richeditor size-{{ $size }}"
name="{{ $name }}"
id="{{ $this->getId('textarea') }}"
class="form-control"
>{!! trim($value) !!}</textarea>
>{{trim($value)}}</textarea>
</div>
@endif
17 changes: 10 additions & 7 deletions app/admin/middleware/LogUserLastSeen.php
Expand Up @@ -2,7 +2,6 @@

namespace Admin\Middleware;

use Admin\Facades\AdminAuth;
use Carbon\Carbon;
use Closure;
use Illuminate\Support\Facades\App;
Expand All @@ -12,12 +11,16 @@ class LogUserLastSeen
{
public function handle($request, Closure $next)
{
if (App::hasDatabase() && AdminAuth::check()) {
$cacheKey = 'is-online-user-'.AdminAuth::getId();
$expireAt = Carbon::now()->addMinutes(2);
Cache::remember($cacheKey, $expireAt, function () {
return AdminAuth::user()->updateLastSeen(Carbon::now()->addMinutes(5));
});
if (App::hasDatabase()) {
foreach (['admin.auth', 'auth'] as $authService) {
if (App::hasDatabase() && resolve($authService)->check()) {
$cacheKey = 'is-online-'.str_replace('.', '-', $authService).'-user-'.resolve($authService)->getId();
$expireAt = Carbon::now()->addMinutes(2);
Cache::remember($cacheKey, $expireAt, function () use ($authService) {
return resolve($authService)->user()->updateLastSeen(Carbon::now());
});
}
}
}

return $next($request);
Expand Down
2 changes: 1 addition & 1 deletion app/admin/models/Reservations_model.php
Expand Up @@ -308,7 +308,7 @@ public static function findReservedTables($location, $dateTime)
});
$query->whereLocationId($location->getKey());
$query->whereBetweenDate($dateTime->toDateTimeString());
$query->whereNotIn('status_id', [0, setting('canceled_reservation_status')]);
$query->where('status_id', setting('confirmed_reservation_status'));
$result = $query->get();

return $result->pluck('tables')->flatten()->keyBy('table_id');
Expand Down
2 changes: 1 addition & 1 deletion app/admin/requests/Menu.php
Expand Up @@ -38,7 +38,7 @@ public function rules()
'order_restriction.*' => ['nullable', 'string'],
'menu_status' => ['boolean'],
'mealtime_id' => ['nullable', 'integer'],
'menu_priority' => ['nullable', 'integer'],
'menu_priority' => ['min:0', 'integer'],
];
}
}
6 changes: 4 additions & 2 deletions app/main/classes/MediaLibrary.php
Expand Up @@ -66,8 +66,7 @@ public function listFolderContents($fullPath, $methodName, $recursive = false)

if (array_has($cached, $cachedKey)) {
$folderContents = array_get($cached, $cachedKey);
}
else {
} else {
$folderContents = $this->scanFolderContents($fullPath, $methodName, $recursive);

$cached[$cacheSuffix][$methodName][$fullPath] = $folderContents;
Expand Down Expand Up @@ -236,6 +235,9 @@ public function validatePath($path, $stripTrailingSlash = false)

public function getMediaUrl($path)
{
if (starts_with($path, ['http://', 'https://', '//']))
return $path;

$path = $this->validatePath($path);

return $this->storagePath.$path;
Expand Down
8 changes: 2 additions & 6 deletions app/system/classes/MailManager.php
Expand Up @@ -71,8 +71,7 @@ public function addContentToMailer($message, $code, $data, $plainOnly = false)
{
if (isset($this->templateCache[$code])) {
$template = $this->templateCache[$code];
}
else {
} else {
$this->templateCache[$code] = $template = Mail_templates_model::findOrMakeTemplate($code);
}

Expand Down Expand Up @@ -100,9 +99,6 @@ public function applyMailerConfigValues()
$config->set('mail.from.address', $settings->get('sender_email'));

switch ($settings->get('protocol')) {
case 'sendmail':
$config->set('mail.mailers.sendmail.path', $settings->get('sendmail_path'));
break;
case 'smtp':
$config->set('mail.mailers.smtp.host', $settings->get('smtp_host'));
$config->set('mail.mailers.smtp.port', $settings->get('smtp_port'));
Expand Down Expand Up @@ -273,7 +269,7 @@ public function renderPartial()

$code = array_pop($this->partialStack);
if (!$partial = Mail_partials_model::findOrMakePartial($code))
return '<!-- Missing partial: '.$code.' -->';
return '<!-- Missing partial: ' . $code . ' -->';

$currentPartial = count($this->partialStack);
$params = $this->partialData[$currentPartial];
Expand Down
4 changes: 1 addition & 3 deletions app/system/language/en/lang.php
Expand Up @@ -472,7 +472,6 @@
'label_sender_name' => 'Sender Name',
'label_sender_email' => 'Sender Email',
'label_protocol' => 'Mail Protocol',
'label_sendmail_path' => 'Sendmail Path',
'label_smtp_host' => 'SMTP Host',
'label_smtp_port' => 'SMTP Port',
'label_smtp_user' => 'SMTP Username',
Expand Down Expand Up @@ -524,7 +523,7 @@
'help_invoice_prefix' => 'Set the invoice prefix (e.g. <b>INV-2015-00</b>1123). Leave blank to use no prefix. The following macros are available: {year} {month} {day} {hour} {minute} {second}',
'help_default_reservation_status' => 'Select the default reservation status when new reservation received',
'help_canceled_reservation_status' => 'Select the reservation status when a reservation is marked as canceled or suspected of fraudulent activity',
'help_confirmed_reservation_status' => 'Select the reservation status to mark a reservation as confirmed before table is reserved',
'help_confirmed_reservation_status' => 'Select the reservation status when a reservation is confirmed and table marked as reserved',
'help_delete_thumbs' => 'This will delete all created thumbs. Note thumbs are automatically created.',
'help_media_max_size' => 'The maximum size (in kilobytes) limit for file when uploading.',
'help_media_extensions' => 'The allowed file extensions for uploaded files. Multiple extensions can be separated by commas.',
Expand All @@ -534,7 +533,6 @@
'help_media_move' => 'Enable or disable moving file/folder',
'help_media_rename' => 'Enable or disable file/folder rename',
'help_media_delete' => 'Enable or disable deleting file/folder',
'help_sendmail_path' => 'Please specify the sendmail path.',
'help_mail_logo' => 'Upload logo to display in emails',
'help_allow_registration' => 'If this is disabled customers can only be created by administrators.',
'help_registration_email' => 'Send a confirmation mail to the customer and/or admin email after successfully account registration',
Expand Down
12 changes: 0 additions & 12 deletions app/system/models/config/mail_settings.php
Expand Up @@ -50,18 +50,6 @@
'comment' => 'lang:system::lang.settings.help_mail_logo',
],

'sendmail_path' => [
'label' => 'lang:system::lang.settings.label_sendmail_path',
'comment' => 'lang:system::lang.settings.help_sendmail_path',
'type' => 'text',
'default' => '/usr/sbin/sendmail -bs',
'trigger' => [
'action' => 'show',
'field' => 'protocol',
'condition' => 'value[sendmail]',
],
],

'smtp_host' => [
'label' => 'lang:system::lang.settings.label_smtp_host',
'type' => 'text',
Expand Down
2 changes: 0 additions & 2 deletions app/system/requests/MailSettings.php
Expand Up @@ -14,7 +14,6 @@ public function attributes()
'protocol' => lang('system::lang.settings.label_protocol'),

'mail_logo' => lang('system::lang.settings.label_mail_logo'),
'sendmail_path' => lang('system::lang.settings.label_sendmail_path'),

'smtp_host' => lang('system::lang.settings.label_smtp_host'),
'smtp_port' => lang('system::lang.settings.label_smtp_port'),
Expand All @@ -41,7 +40,6 @@ public function rules()
'protocol' => ['required'],

'mail_logo' => ['string'],
'sendmail_path' => ['required_if:protocol,sendmail', 'string'],

'smtp_host' => ['string'],
'smtp_port' => ['string'],
Expand Down
2 changes: 1 addition & 1 deletion config/system.php
Expand Up @@ -35,7 +35,7 @@
|
*/

'adminUri' => '/admin',
'adminUri' => env('IGNITER_ADMIN_URI', '/admin'),

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit a2ecaa5

Please sign in to comment.