mirror of
https://github.com/flextype/flextype.git
synced 2025-08-25 06:00:43 +02:00
Merge pull request #140 from flextype/scrutinizer-patch-3
Scrutinizer Auto-Fixes
This commit is contained in:
@@ -48,27 +48,27 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/index.html',
|
||||
[
|
||||
'entries_list' => $this->entries->fetchAll($this->getEntriesQuery($request->getQueryParams()['id']), 'date', 'DESC'),
|
||||
'id_current' => $this->getEntriesQuery($request->getQueryParams()['id']),
|
||||
'menu_item' => 'entries',
|
||||
'parts' => $id,
|
||||
'i' => count($id),
|
||||
'last' => Arr::last($id),
|
||||
'links' => [
|
||||
'entries_list' => $this->entries->fetchAll($this->getEntriesQuery($request->getQueryParams()['id']), 'date', 'DESC'),
|
||||
'id_current' => $this->getEntriesQuery($request->getQueryParams()['id']),
|
||||
'menu_item' => 'entries',
|
||||
'parts' => $id,
|
||||
'i' => count($id),
|
||||
'last' => Arr::last($id),
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
],
|
||||
'buttons' => [
|
||||
'create' => [
|
||||
'link' => $this->router->pathFor('admin.entries.add') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_create_new_entry'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'buttons' => [
|
||||
'create' => [
|
||||
'link' => $this->router->pathFor('admin.entries.add') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_create_new_entry'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -103,21 +103,21 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/add.html',
|
||||
[
|
||||
'entries_list' => $this->entries->fetchAll($this->getEntriesQuery($request->getQueryParams()['entry']), 'date', 'DESC'),
|
||||
'menu_item' => 'entries',
|
||||
'fieldsets' => $fieldsets,
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_add' => [
|
||||
'link' => $this->router->pathFor('admin.entries.add') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_create_new_entry'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
'entries_list' => $this->entries->fetchAll($this->getEntriesQuery($request->getQueryParams()['entry']), 'date', 'DESC'),
|
||||
'menu_item' => 'entries',
|
||||
'fieldsets' => $fieldsets,
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_add' => [
|
||||
'link' => $this->router->pathFor('admin.entries.add') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_create_new_entry'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -236,22 +236,22 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/type.html',
|
||||
[
|
||||
'fieldset' => $entry['fieldset'],
|
||||
'entry_name' => $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'fieldsets' => $fieldsets,
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_type' => [
|
||||
'link' => $this->router->pathFor('admin.entries.type') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_type'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
'fieldset' => $entry['fieldset'],
|
||||
'entry_name' => $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'fieldsets' => $fieldsets,
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_type' => [
|
||||
'link' => $this->router->pathFor('admin.entries.type') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_type'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -303,23 +303,23 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/move.html',
|
||||
[
|
||||
'entry_path_current' => $entry_name,
|
||||
'entries_list' => $entries_list,
|
||||
'name_current' => Arr::last(explode("/", $entry_name)),
|
||||
'entry_parent' => implode('/', array_slice(explode("/", $entry_name), 0, -1)),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_move' => [
|
||||
'link' => $this->router->pathFor('admin.entries.move'),
|
||||
'title' => __('admin_move'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
'entry_path_current' => $entry_name,
|
||||
'entries_list' => $entries_list,
|
||||
'name_current' => Arr::last(explode("/", $entry_name)),
|
||||
'entry_parent' => implode('/', array_slice(explode("/", $entry_name), 0, -1)),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_move' => [
|
||||
'link' => $this->router->pathFor('admin.entries.move'),
|
||||
'title' => __('admin_move'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -348,22 +348,22 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/rename.html',
|
||||
[
|
||||
'name_current' => Arr::last(explode("/", $this->getEntriesQuery($request->getQueryParams()['entry']))),
|
||||
'entry_path_current' => $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'entry_parent' => implode('/', array_slice(explode("/", $this->getEntriesQuery($request->getQueryParams()['entry'])), 0, -1)),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_type' => [
|
||||
'link' => $this->router->pathFor('admin.entries.rename') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_rename'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
'name_current' => Arr::last(explode("/", $this->getEntriesQuery($request->getQueryParams()['entry']))),
|
||||
'entry_path_current' => $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'entry_parent' => implode('/', array_slice(explode("/", $this->getEntriesQuery($request->getQueryParams()['entry'])), 0, -1)),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'entries' => [
|
||||
'link' => $this->router->pathFor('admin.entries.index'),
|
||||
'title' => __('admin_entries'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'entries_type' => [
|
||||
'link' => $this->router->pathFor('admin.entries.rename') . '?entry=' . $this->getEntriesQuery($request->getQueryParams()['entry']),
|
||||
'title' => __('admin_rename'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -431,14 +431,14 @@ class EntriesController extends Controller
|
||||
|
||||
$form = '';
|
||||
$form .= Form::open(null, ['id' => 'form']);
|
||||
$form .= '<input type="hidden" name="'.$this->csrf->getTokenNameKey().'" value="'.$this->csrf->getTokenName().'">'.
|
||||
$form .= '<input type="hidden" name="'.$this->csrf->getTokenValueKey().'" value="'.$this->csrf->getTokenValue().'">';
|
||||
$form .= '<input type="hidden" name="' . $this->csrf->getTokenNameKey() . '" value="' . $this->csrf->getTokenName() . '">' .
|
||||
$form .= '<input type="hidden" name="' . $this->csrf->getTokenValueKey() . '" value="' . $this->csrf->getTokenValue() . '">';
|
||||
$form .= Form::hidden('action', 'save-form');
|
||||
if (count($fieldset['sections']) > 0) {
|
||||
$form .= '<ul class="nav nav-pills nav-justified" id="pills-tab" role="tablist">';
|
||||
foreach ($fieldset['sections'] as $key => $section) {
|
||||
$form .= '<li class="nav-item">
|
||||
<a class="nav-link '.(($key == 'main') ? 'active' : '').'" id="pills-'.$key.'-tab" data-toggle="pill" href="#pills-'.$key.'" role="tab" aria-controls="pills-'.$key.'" aria-selected="true">'.$section['title'].'</a>
|
||||
$form .= '<li class="nav-item">
|
||||
<a class="nav-link '.(($key == 'main') ? 'active' : '') . '" id="pills-' . $key . '-tab" data-toggle="pill" href="#pills-' . $key . '" role="tab" aria-controls="pills-' . $key . '" aria-selected="true">' . $section['title'] . '</a>
|
||||
</li>';
|
||||
}
|
||||
$form .= '</ul>';
|
||||
@@ -551,37 +551,37 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/source.html',
|
||||
[
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
'id' => $id,
|
||||
'data' => JsonParser::encode($entry),
|
||||
'type' => $type,
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_entry' => [
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
'id' => $id,
|
||||
'data' => JsonParser::encode($entry),
|
||||
'type' => $type,
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_entry' => [
|
||||
'link' => 'javascript:;',
|
||||
'title' => __('admin_save'),
|
||||
'attributes' => ['class' => 'js-save-editor-form-submit float-right btn']
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
} elseif ($type == 'media') {
|
||||
@@ -589,38 +589,38 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/media.html',
|
||||
[
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
|
||||
'id' => $id,
|
||||
'files' => $this->getMediaList($id, true),
|
||||
'id' => $id,
|
||||
'files' => $this->getMediaList($id, true),
|
||||
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_entry' => [
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_entry' => [
|
||||
'link' => 'javascript:;',
|
||||
'title' => __('admin_save'),
|
||||
'attributes' => ['class' => 'js-save-editor-form-submit float-right btn']
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
} else {
|
||||
@@ -628,35 +628,35 @@ class EntriesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/content/entries/edit.html',
|
||||
[
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
'form' => $this->fetchForm($fieldsets, $entry, $request),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_entry' => [
|
||||
'parts' => $_id,
|
||||
'i' => count($_id),
|
||||
'last' => Arr::last($_id),
|
||||
'form' => $this->fetchForm($fieldsets, $entry, $request),
|
||||
'menu_item' => 'entries',
|
||||
'links' => [
|
||||
'edit_entry' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id,
|
||||
'title' => __('admin_content'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
'edit_entry_media' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=media',
|
||||
'title' => __('admin_media'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
'edit_entry_source' => [
|
||||
'link' => $this->router->pathFor('admin.entries.edit') . '?id=' . $id . '&type=source',
|
||||
'title' => __('admin_source'),
|
||||
'attributes' => ['class' => 'navbar-item']
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_entry' => [
|
||||
'link' => 'javascript:;',
|
||||
'title' => __('admin_save'),
|
||||
'attributes' => ['class' => 'js-save-editor-form-submit float-right btn']
|
||||
],
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -759,17 +759,17 @@ class EntriesController extends Controller
|
||||
$img = Image::make($file);
|
||||
// now you are able to resize the instance
|
||||
if ($this->registry->get('settings.entries.media.upload_images_width') > 0 && $this->registry->get('settings.entries.media.upload_images_height') > 0) {
|
||||
$img->resize($this->registry->get('settings.entries.media.upload_images_width'), $this->registry->get('settings.entries.media.upload_images_height'), function ($constraint) {
|
||||
$img->resize($this->registry->get('settings.entries.media.upload_images_width'), $this->registry->get('settings.entries.media.upload_images_height'), function($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
} elseif ($this->registry->get('settings.entries.media.upload_images_width') > 0) {
|
||||
$img->resize($this->registry->get('settings.entries.media.upload_images_width'), null, function ($constraint) {
|
||||
$img->resize($this->registry->get('settings.entries.media.upload_images_width'), null, function($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
} elseif ($this->registry->get('settings.entries.media.upload_images_height') > 0) {
|
||||
$img->resize(null, $this->registry->get('settings.entries.media.upload_images_height'), function ($constraint) {
|
||||
$img->resize(null, $this->registry->get('settings.entries.media.upload_images_height'), function($constraint) {
|
||||
$constraint->aspectRatio();
|
||||
$constraint->upsize();
|
||||
});
|
||||
|
@@ -14,9 +14,9 @@ class FieldsetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/fieldsets/index.html',
|
||||
[
|
||||
'menu_item' => 'fieldsets',
|
||||
'fieldsets_list' => $this->fieldsets->fetchAll(),
|
||||
'links' => [
|
||||
'menu_item' => 'fieldsets',
|
||||
'fieldsets_list' => $this->fieldsets->fetchAll(),
|
||||
'links' => [
|
||||
'fieldsets' => [
|
||||
'link' => $this->router->pathFor('admin.fieldsets.index'),
|
||||
'title' => __('admin_fieldsets'),
|
||||
@@ -29,9 +29,9 @@ class FieldsetsController extends Controller
|
||||
'title' => __('admin_create_new_fieldset'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function add($request, $response)
|
||||
@@ -40,9 +40,9 @@ class FieldsetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/fieldsets/add.html',
|
||||
[
|
||||
'menu_item' => 'fieldsets',
|
||||
'fieldsets_list' => $this->fieldsets->fetchAll(),
|
||||
'links' => [
|
||||
'menu_item' => 'fieldsets',
|
||||
'fieldsets_list' => $this->fieldsets->fetchAll(),
|
||||
'links' => [
|
||||
'fieldsets' => [
|
||||
'link' => $this->router->pathFor('admin.fieldsets.index'),
|
||||
'title' => __('admin_fieldsets'),
|
||||
@@ -55,9 +55,9 @@ class FieldsetsController extends Controller
|
||||
'title' => __('admin_create_new_fieldset'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function addProcess($request, $response)
|
||||
@@ -85,10 +85,10 @@ class FieldsetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/fieldsets/edit.html',
|
||||
[
|
||||
'menu_item' => 'fieldsets',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => JsonParser::encode($this->fieldsets->fetch($request->getQueryParams()['id'])),
|
||||
'links' => [
|
||||
'menu_item' => 'fieldsets',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => JsonParser::encode($this->fieldsets->fetch($request->getQueryParams()['id'])),
|
||||
'links' => [
|
||||
'fieldsets' => [
|
||||
'link' => $this->router->pathFor('admin.fieldsets.edit') . '?id=' . $request->getQueryParams()['id'],
|
||||
'title' => __('admin_fieldsets'),
|
||||
@@ -102,8 +102,8 @@ class FieldsetsController extends Controller
|
||||
'attributes' => ['class' => 'js-save-form-submit float-right btn']
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function editProcess($request, $response)
|
||||
@@ -123,9 +123,9 @@ class FieldsetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/fieldsets/rename.html',
|
||||
[
|
||||
'menu_item' => 'fieldsets',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'links' => [
|
||||
'menu_item' => 'fieldsets',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'links' => [
|
||||
'fieldsets' => [
|
||||
'link' => $this->router->pathFor('admin.fieldsets.index'),
|
||||
'title' => __('admin_fieldsets'),
|
||||
@@ -137,8 +137,8 @@ class FieldsetsController extends Controller
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function renameProcess($request, $response)
|
||||
|
@@ -22,19 +22,19 @@ class InformationController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/system/information/index.html',
|
||||
[
|
||||
'menu_item' => 'information',
|
||||
'php_uname' => php_uname(),
|
||||
'webserver' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : @getenv('SERVER_SOFTWARE'),
|
||||
'php_sapi_name' => php_sapi_name(),
|
||||
'apache_mod_rewrite_installed' => $apache_mod_rewrite_installed,
|
||||
'links' => [
|
||||
'menu_item' => 'information',
|
||||
'php_uname' => php_uname(),
|
||||
'webserver' => isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : @getenv('SERVER_SOFTWARE'),
|
||||
'php_sapi_name' => php_sapi_name(),
|
||||
'apache_mod_rewrite_installed' => $apache_mod_rewrite_installed,
|
||||
'links' => [
|
||||
'information' => [
|
||||
'link' => $this->router->pathFor('admin.information.index'),
|
||||
'title' => __('admin_information'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -34,48 +34,48 @@ class SettingsController extends Controller
|
||||
}
|
||||
|
||||
$cache_driver = ['auto' => 'Auto Detect',
|
||||
'file' => 'File',
|
||||
'apcu' => 'APCu',
|
||||
'wincache' => 'WinCache',
|
||||
'memcached' => 'Memcached',
|
||||
'redis' => 'Redis',
|
||||
'sqlite3' => 'SQLite3',
|
||||
'zend' => 'Zend',
|
||||
'array' => 'Array'];
|
||||
'file' => 'File',
|
||||
'apcu' => 'APCu',
|
||||
'wincache' => 'WinCache',
|
||||
'memcached' => 'Memcached',
|
||||
'redis' => 'Redis',
|
||||
'sqlite3' => 'SQLite3',
|
||||
'zend' => 'Zend',
|
||||
'array' => 'Array'];
|
||||
|
||||
return $this->view->render(
|
||||
$response,
|
||||
'plugins/admin/views/templates/system/settings/index.html',
|
||||
[
|
||||
'timezones' => Date::timezones(),
|
||||
'settings' => $this->registry->get('settings'),
|
||||
'cache_driver' => $cache_driver,
|
||||
'locales' => $locales,
|
||||
'entries' => $entries,
|
||||
'themes' => $themes,
|
||||
'links' => [
|
||||
'settings' => [
|
||||
'link' => $this->router->pathFor('admin.settings.index'),
|
||||
'title' => __('admin_settings'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
],
|
||||
'buttons' => [
|
||||
'save' => [
|
||||
'link' => 'javascript:;',
|
||||
'title' => __('admin_save'),
|
||||
'attributes' => ['class' => 'js-save-form-submit float-right btn']
|
||||
],
|
||||
'settings_clear_cache' => [
|
||||
'type' => 'action',
|
||||
'id' => 'clear-cache',
|
||||
'link' => $this->router->pathFor('admin.settings.clear-cache'),
|
||||
'title' => __('admin_clear_cache'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
'timezones' => Date::timezones(),
|
||||
'settings' => $this->registry->get('settings'),
|
||||
'cache_driver' => $cache_driver,
|
||||
'locales' => $locales,
|
||||
'entries' => $entries,
|
||||
'themes' => $themes,
|
||||
'links' => [
|
||||
'settings' => [
|
||||
'link' => $this->router->pathFor('admin.settings.index'),
|
||||
'title' => __('admin_settings'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
]
|
||||
],
|
||||
'buttons' => [
|
||||
'save' => [
|
||||
'link' => 'javascript:;',
|
||||
'title' => __('admin_save'),
|
||||
'attributes' => ['class' => 'js-save-form-submit float-right btn']
|
||||
],
|
||||
'settings_clear_cache' => [
|
||||
'type' => 'action',
|
||||
'id' => 'clear-cache',
|
||||
'link' => $this->router->pathFor('admin.settings.clear-cache'),
|
||||
'title' => __('admin_clear_cache'),
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function update($request, $response)
|
||||
|
@@ -14,9 +14,9 @@ class SnippetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/snippets/index.html',
|
||||
[
|
||||
'menu_item' => 'snippets',
|
||||
'snippets_list' => $this->snippets->fetchAll(),
|
||||
'links' => [
|
||||
'menu_item' => 'snippets',
|
||||
'snippets_list' => $this->snippets->fetchAll(),
|
||||
'links' => [
|
||||
'snippets' => [
|
||||
'link' => $this->router->pathFor('admin.snippets.index'),
|
||||
'title' => __('admin_snippets'),
|
||||
@@ -30,8 +30,8 @@ class SnippetsController extends Controller
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function add($request, $response)
|
||||
@@ -40,16 +40,16 @@ class SnippetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/snippets/add.html',
|
||||
[
|
||||
'menu_item' => 'snippets',
|
||||
'links' => [
|
||||
'menu_item' => 'snippets',
|
||||
'links' => [
|
||||
'snippets' => [
|
||||
'link' => $this->router->pathFor('admin.snippets.index'),
|
||||
'title' => __('admin_snippets'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function addProcess($request, $response)
|
||||
@@ -69,16 +69,16 @@ class SnippetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/snippets/edit.html',
|
||||
[
|
||||
'menu_item' => 'snippets',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => $this->snippets->fetch($request->getQueryParams()['id']),
|
||||
'links' => [
|
||||
'menu_item' => 'snippets',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => $this->snippets->fetch($request->getQueryParams()['id']),
|
||||
'links' => [
|
||||
'snippets' => [
|
||||
'link' => $this->router->pathFor('admin.snippets.index'),
|
||||
'title' => __('admin_snippets'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_snippet' => [
|
||||
'link' => 'javascript:;',
|
||||
@@ -86,8 +86,8 @@ class SnippetsController extends Controller
|
||||
'attributes' => ['class' => 'js-save-form-submit float-right btn']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function editProcess($request, $response)
|
||||
@@ -107,17 +107,17 @@ class SnippetsController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/snippets/rename.html',
|
||||
[
|
||||
'menu_item' => 'snippets',
|
||||
'id_current' => $request->getQueryParams()['id'],
|
||||
'links' => [
|
||||
'menu_item' => 'snippets',
|
||||
'id_current' => $request->getQueryParams()['id'],
|
||||
'links' => [
|
||||
'templates' => [
|
||||
'link' => $this->router->pathFor('admin.snippets.index'),
|
||||
'title' => __('admin_templates'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function renameProcess($request, $response)
|
||||
@@ -125,8 +125,8 @@ class SnippetsController extends Controller
|
||||
if ($this->snippets->rename(
|
||||
$request->getParsedBody()['id_current'],
|
||||
$request->getParsedBody()['id']
|
||||
)
|
||||
) {
|
||||
)
|
||||
) {
|
||||
$this->flash->addMessage('success', __('admin_message_snippets_renamed'));
|
||||
} else {
|
||||
$this->flash->addMessage('error', __('admin_message_snippets_was_not_renamed'));
|
||||
|
@@ -14,10 +14,10 @@ class TemplatesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/templates/index.html',
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'templates_list' => $this->themes->getTemplates(),
|
||||
'partials_list' => $this->themes->getPartials(),
|
||||
'links' => [
|
||||
'menu_item' => 'templates',
|
||||
'templates_list' => $this->themes->getTemplates(),
|
||||
'partials_list' => $this->themes->getPartials(),
|
||||
'links' => [
|
||||
'templates' => [
|
||||
'link' => $this->router->pathFor('admin.templates.index'),
|
||||
'title' => __('admin_templates'),
|
||||
@@ -31,8 +31,8 @@ class TemplatesController extends Controller
|
||||
'attributes' => ['class' => 'float-right btn']
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function add($request, $response)
|
||||
@@ -41,16 +41,16 @@ class TemplatesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/templates/add.html',
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'links' => [
|
||||
'menu_item' => 'templates',
|
||||
'links' => [
|
||||
'templates' => [
|
||||
'link' => $this->router->pathFor('admin.templates.index'),
|
||||
'title' => __('admin_templates'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function addProcess($request, $response)
|
||||
@@ -65,7 +65,7 @@ class TemplatesController extends Controller
|
||||
if (Filesystem::write(
|
||||
$file,
|
||||
""
|
||||
)) {
|
||||
)) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_created'));
|
||||
} else {
|
||||
$this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_created'));
|
||||
@@ -85,17 +85,17 @@ class TemplatesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/templates/edit.html',
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => Filesystem::read(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'),
|
||||
'type' => (($request->getQueryParams()['type'] && $request->getQueryParams()['type'] == 'partial') ? 'partial' : 'template'),
|
||||
'links' => [
|
||||
'menu_item' => 'templates',
|
||||
'id' => $request->getQueryParams()['id'],
|
||||
'data' => Filesystem::read(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'),
|
||||
'type' => (($request->getQueryParams()['type'] && $request->getQueryParams()['type'] == 'partial') ? 'partial' : 'template'),
|
||||
'links' => [
|
||||
'templates' => [
|
||||
'link' => $this->router->pathFor('admin.templates.index'),
|
||||
'title' => __('admin_templates'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
],
|
||||
],
|
||||
'buttons' => [
|
||||
'save_template' => [
|
||||
'link' => 'javascript:;',
|
||||
@@ -103,8 +103,8 @@ class TemplatesController extends Controller
|
||||
'attributes' => ['class' => 'js-save-form-submit float-right btn']
|
||||
]
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function editProcess($request, $response)
|
||||
@@ -112,9 +112,9 @@ class TemplatesController extends Controller
|
||||
$type = $request->getParsedBody()['type_current'];
|
||||
|
||||
if (Filesystem::write(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_saved'));
|
||||
$this->flash->addMessage('success', __('admin_message_' . $type . '_saved'));
|
||||
} else {
|
||||
$this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_saved'));
|
||||
$this->flash->addMessage('error', __('admin_message_' . $type . '_was_not_saved'));
|
||||
}
|
||||
|
||||
return $response->withRedirect($this->container->get('router')->pathFor('admin.fieldsets.index'));
|
||||
@@ -126,19 +126,19 @@ class TemplatesController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/extends/templates/rename.html',
|
||||
[
|
||||
'menu_item' => 'templates',
|
||||
'types' => ['partial' => __('admin_partial'), 'template' => __('admin_template')],
|
||||
'id_current' => $request->getQueryParams()['id'],
|
||||
'type_current' => (($request->getQueryParams()['type'] && $request->getQueryParams()['type'] == 'partial') ? 'partial' : 'template'),
|
||||
'links' => [
|
||||
'menu_item' => 'templates',
|
||||
'types' => ['partial' => __('admin_partial'), 'template' => __('admin_template')],
|
||||
'id_current' => $request->getQueryParams()['id'],
|
||||
'type_current' => (($request->getQueryParams()['type'] && $request->getQueryParams()['type'] == 'partial') ? 'partial' : 'template'),
|
||||
'links' => [
|
||||
'templates' => [
|
||||
'link' => $this->router->pathFor('admin.templates.index'),
|
||||
'title' => __('admin_templates'),
|
||||
'attributes' => ['class' => 'navbar-item active']
|
||||
],
|
||||
]
|
||||
]
|
||||
);
|
||||
]
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
public function renameProcess($request, $response)
|
||||
@@ -149,8 +149,8 @@ class TemplatesController extends Controller
|
||||
if (Filesystem::rename(
|
||||
PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html',
|
||||
PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html'
|
||||
)
|
||||
) {
|
||||
)
|
||||
) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_renamed'));
|
||||
} else {
|
||||
$this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_renamed'));
|
||||
@@ -166,12 +166,12 @@ class TemplatesController extends Controller
|
||||
{
|
||||
$type = $request->getParsedBody()['type'];
|
||||
|
||||
$file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html';
|
||||
$file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()[$type . '-id'] . '.html';
|
||||
|
||||
if (Filesystem::delete($file_path)) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_deleted'));
|
||||
$this->flash->addMessage('success', __('admin_message_' . $type . '_deleted'));
|
||||
} else {
|
||||
$this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_deleted'));
|
||||
$this->flash->addMessage('error', __('admin_message_' . $type . '_was_not_deleted'));
|
||||
}
|
||||
|
||||
return $response->withRedirect($this->container->get('router')->pathFor('admin.templates.index'));
|
||||
@@ -181,13 +181,13 @@ class TemplatesController extends Controller
|
||||
{
|
||||
$type = $request->getParsedBody()['type'];
|
||||
|
||||
$file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html';
|
||||
$file_path_new = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '-duplicate-' . date("Ymd_His") . '.html';
|
||||
$file_path = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()[$type . '-id'] . '.html';
|
||||
$file_path_new = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()[$type . '-id'] . '-duplicate-' . date("Ymd_His") . '.html';
|
||||
|
||||
if (Filesystem::copy($file_path, $file_path_new)) {
|
||||
$this->flash->addMessage('success', __('admin_message_'.$type.'_duplicated'));
|
||||
$this->flash->addMessage('success', __('admin_message_' . $type . '_duplicated'));
|
||||
} else {
|
||||
$this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_duplicated'));
|
||||
$this->flash->addMessage('error', __('admin_message_' . $type . '_was_not_duplicated'));
|
||||
}
|
||||
|
||||
return $response->withRedirect($this->container->get('router')->pathFor('admin.templates.index'));
|
||||
|
@@ -16,7 +16,7 @@ class UsersController extends Controller
|
||||
return $this->container->get('view')->render(
|
||||
$response,
|
||||
'plugins/admin/views/templates/users/profile.html'
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
public function login($request, $response)
|
||||
@@ -26,9 +26,9 @@ class UsersController extends Controller
|
||||
$response,
|
||||
'plugins/admin/views/templates/users/login.html',
|
||||
[
|
||||
'user_is_logged' => Users::isLoggedIn()
|
||||
]
|
||||
);
|
||||
'user_is_logged' => Users::isLoggedIn()
|
||||
]
|
||||
);
|
||||
} else {
|
||||
return $response->withRedirect($this->container->get('router')->pathFor('admin.users.registration'));
|
||||
}
|
||||
@@ -76,10 +76,10 @@ class UsersController extends Controller
|
||||
if (Filesystem::write(
|
||||
PATH['site'] . '/accounts/' . $data['username'] . '.json',
|
||||
JsonParser::encode(['username' => Text::safeString($data['username']),
|
||||
'hashed_password' => password_hash($data['password'], PASSWORD_BCRYPT),
|
||||
'email' => $data['email'],
|
||||
'role' => 'admin',
|
||||
'state' => 'enabled'])
|
||||
'hashed_password' => password_hash($data['password'], PASSWORD_BCRYPT),
|
||||
'email' => $data['email'],
|
||||
'role' => 'admin',
|
||||
'state' => 'enabled'])
|
||||
)) {
|
||||
return $response->withRedirect($this->container->get('router')->pathFor('admin.users.login'));
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user