diff --git a/site/plugins/admin/app/Controllers/TemplatesController.php b/site/plugins/admin/app/Controllers/TemplatesController.php index 24d68d49..1a8f376d 100644 --- a/site/plugins/admin/app/Controllers/TemplatesController.php +++ b/site/plugins/admin/app/Controllers/TemplatesController.php @@ -59,7 +59,7 @@ class TemplatesController extends Controller $id = Text::safeString($request->getParsedBody()['id'], '-', true) . '.html'; - $file = PATH['site'] . '/' . $this->_type_location($type) . $id; + $file = PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $id; if (!Filesystem::has($file)) { if (Filesystem::write( @@ -87,7 +87,7 @@ class TemplatesController extends Controller [ 'menu_item' => 'templates', 'id' => $request->getQueryParams()['id'], - 'data' => Filesystem::read(PATH['site'] . '/' . $this->_type_location($type) . $request->getQueryParams()['id'] . '.html'), + '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' => [ @@ -111,7 +111,7 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type_current']; - if (Filesystem::write(PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html', $request->getParsedBody()['data'])) { + 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')); } else { $this->flash->addMessage('error', __('admin_message_'.$type.'_was_not_saved')); @@ -145,10 +145,10 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type_current']; - if (!Filesystem::has(PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) { + if (!Filesystem::has(PATH['themes'] . '/' . $this->registry->get('settings.theme') . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html')) { if (Filesystem::rename( - PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id_current'] . '.html', - PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()['id'] . '.html' + 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')); @@ -166,7 +166,7 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type']; - $file_path = PATH['site'] . '/' . $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')); @@ -181,8 +181,8 @@ class TemplatesController extends Controller { $type = $request->getParsedBody()['type']; - $file_path = PATH['site'] . '/' . $this->_type_location($type) . $request->getParsedBody()[$type.'-id'] . '.html'; - $file_path_new = PATH['site'] . '/' . $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'));