Refactored scripts and stylesheets
Styles, scripts and page titles are no longer set from controllers level. Changed because it was breaking MVC pattern and led to spaghetti code. Also, optimized JS/CSS inclusions a bit.
This commit is contained in:
parent
d170e3b526
commit
35cdc0cf3a
35 changed files with 374 additions and 275 deletions
|
@ -7,19 +7,7 @@ class Bootstrap
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
$this->context->handleExceptions = false;
|
$this->context->handleExceptions = false;
|
||||||
$this->context->title = $this->config->main->title;
|
LayoutHelper::setTitle($this->config->main->title);
|
||||||
$this->context->stylesheets =
|
|
||||||
[
|
|
||||||
'../lib/jquery-ui/jquery-ui.css',
|
|
||||||
'core.css',
|
|
||||||
];
|
|
||||||
$this->context->scripts =
|
|
||||||
[
|
|
||||||
'../lib/jquery/jquery.min.js',
|
|
||||||
'../lib/jquery-ui/jquery-ui.min.js',
|
|
||||||
'../lib/mousetrap/mousetrap.min.js',
|
|
||||||
'core.js',
|
|
||||||
];
|
|
||||||
|
|
||||||
$this->context->json = isset($_GET['json']);
|
$this->context->json = isset($_GET['json']);
|
||||||
$this->context->layoutName = $this->context->json
|
$this->context->layoutName = $this->context->json
|
||||||
|
@ -39,7 +27,14 @@ class Bootstrap
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$workCallback();
|
if ($this->context->layoutName == 'layout-normal')
|
||||||
|
{
|
||||||
|
ob_start(['LayoutHelper', 'transformHtml']);
|
||||||
|
$workCallback();
|
||||||
|
ob_end_flush();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$workCallback();
|
||||||
}
|
}
|
||||||
catch (\Chibi\MissingViewFileException $e)
|
catch (\Chibi\MissingViewFileException $e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,8 +55,6 @@ class AuthController
|
||||||
public function loginAction()
|
public function loginAction()
|
||||||
{
|
{
|
||||||
$this->context->handleExceptions = true;
|
$this->context->handleExceptions = true;
|
||||||
$this->context->stylesheets []= 'auth.css';
|
|
||||||
$this->context->subTitle = 'authentication form';
|
|
||||||
|
|
||||||
//check if already logged in
|
//check if already logged in
|
||||||
if ($this->context->loggedIn)
|
if ($this->context->loggedIn)
|
||||||
|
|
|
@ -8,18 +8,8 @@ class CommentController
|
||||||
*/
|
*/
|
||||||
public function listAction($page)
|
public function listAction($page)
|
||||||
{
|
{
|
||||||
$this->context->stylesheets []= 'post-small.css';
|
|
||||||
$this->context->stylesheets []= 'comment-list.css';
|
|
||||||
$this->context->stylesheets []= 'comment-small.css';
|
|
||||||
$this->context->stylesheets []= 'comment-edit.css';
|
|
||||||
$this->context->stylesheets []= 'paginator.css';
|
|
||||||
if ($this->context->user->hasEnabledEndlessScrolling())
|
|
||||||
$this->context->scripts []= 'paginator-endless.js';
|
|
||||||
$this->context->scripts []= 'comment-edit.js';
|
|
||||||
|
|
||||||
$page = intval($page);
|
$page = intval($page);
|
||||||
$commentsPerPage = intval($this->config->comments->commentsPerPage);
|
$commentsPerPage = intval($this->config->comments->commentsPerPage);
|
||||||
$this->context->subTitle = 'comments';
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListComments);
|
PrivilegesHelper::confirmWithException(Privilege::ListComments);
|
||||||
|
|
||||||
$page = max(1, $page);
|
$page = max(1, $page);
|
||||||
|
|
|
@ -7,8 +7,6 @@ class IndexController
|
||||||
*/
|
*/
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
$this->context->subTitle = 'home';
|
|
||||||
$this->context->stylesheets []= 'index-index.css';
|
|
||||||
$this->context->transport->postCount = PostModel::getCount();
|
$this->context->transport->postCount = PostModel::getCount();
|
||||||
|
|
||||||
$featuredPost = $this->getFeaturedPost();
|
$featuredPost = $this->getFeaturedPost();
|
||||||
|
@ -17,7 +15,6 @@ class IndexController
|
||||||
$this->context->featuredPost = $featuredPost;
|
$this->context->featuredPost = $featuredPost;
|
||||||
$this->context->featuredPostDate = PropertyModel::get(PropertyModel::FeaturedPostDate);
|
$this->context->featuredPostDate = PropertyModel::get(PropertyModel::FeaturedPostDate);
|
||||||
$this->context->featuredPostUser = UserModel::findByNameOrEmail(PropertyModel::get(PropertyModel::FeaturedPostUserName), false);
|
$this->context->featuredPostUser = UserModel::findByNameOrEmail(PropertyModel::get(PropertyModel::FeaturedPostUserName), false);
|
||||||
$this->context->pageThumb = \Chibi\UrlHelper::route('post', 'thumb', ['name' => $featuredPost->name]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +30,6 @@ class IndexController
|
||||||
if (!isset($this->config->help->paths[$tab]))
|
if (!isset($this->config->help->paths[$tab]))
|
||||||
throw new SimpleException('Invalid tab');
|
throw new SimpleException('Invalid tab');
|
||||||
$this->context->path = TextHelper::absolutePath($this->config->help->paths[$tab]);
|
$this->context->path = TextHelper::absolutePath($this->config->help->paths[$tab]);
|
||||||
$this->context->stylesheets []= 'index-help.css';
|
|
||||||
$this->context->subTitle = 'help';
|
|
||||||
$this->context->tab = $tab;
|
$this->context->tab = $tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ class LogController
|
||||||
*/
|
*/
|
||||||
public function listAction()
|
public function listAction()
|
||||||
{
|
{
|
||||||
$this->context->subTitle = 'latest logs';
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListLogs);
|
PrivilegesHelper::confirmWithException(Privilege::ListLogs);
|
||||||
|
|
||||||
$path = TextHelper::absolutePath($this->config->main->logsPath);
|
$path = TextHelper::absolutePath($this->config->main->logsPath);
|
||||||
|
@ -49,12 +48,6 @@ class LogController
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->context->subTitle = 'logs (' . $name . ')';
|
|
||||||
$this->context->stylesheets []= 'logs.css';
|
|
||||||
$this->context->stylesheets []= 'paginator.css';
|
|
||||||
$this->context->scripts []= 'logs.js';
|
|
||||||
if ($this->context->user->hasEnabledEndlessScrolling())
|
|
||||||
$this->context->scripts []= 'paginator-endless.js';
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewLog);
|
PrivilegesHelper::confirmWithException(Privilege::ViewLog);
|
||||||
|
|
||||||
//parse input
|
//parse input
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class PostController
|
class PostController
|
||||||
{
|
{
|
||||||
public function workWrapper($callback)
|
|
||||||
{
|
|
||||||
$this->context->stylesheets []= '../lib/tagit/jquery.tagit.css';
|
|
||||||
$this->context->scripts []= '../lib/tagit/jquery.tagit.js';
|
|
||||||
$callback();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function handleUploadErrors($file)
|
private static function handleUploadErrors($file)
|
||||||
{
|
{
|
||||||
switch ($file['error'])
|
switch ($file['error'])
|
||||||
|
@ -52,12 +45,6 @@ class PostController
|
||||||
public function listAction($query = null, $page = 1, $source = 'posts', $additionalInfo = null)
|
public function listAction($query = null, $page = 1, $source = 'posts', $additionalInfo = null)
|
||||||
{
|
{
|
||||||
$this->context->viewName = 'post-list-wrapper';
|
$this->context->viewName = 'post-list-wrapper';
|
||||||
$this->context->stylesheets []= 'post-small.css';
|
|
||||||
$this->context->stylesheets []= 'post-list.css';
|
|
||||||
$this->context->stylesheets []= 'paginator.css';
|
|
||||||
$this->context->scripts []= 'post-list.js';
|
|
||||||
if ($this->context->user->hasEnabledEndlessScrolling())
|
|
||||||
$this->context->scripts []= 'paginator-endless.js';
|
|
||||||
$this->context->source = $source;
|
$this->context->source = $source;
|
||||||
$this->context->additionalInfo = $additionalInfo;
|
$this->context->additionalInfo = $additionalInfo;
|
||||||
|
|
||||||
|
@ -77,7 +64,6 @@ class PostController
|
||||||
$query = trim($query);
|
$query = trim($query);
|
||||||
$page = max(1, intval($page));
|
$page = max(1, intval($page));
|
||||||
$postsPerPage = intval($this->config->browsing->postsPerPage);
|
$postsPerPage = intval($this->config->browsing->postsPerPage);
|
||||||
$this->context->subTitle = 'posts';
|
|
||||||
$this->context->transport->searchQuery = $query;
|
$this->context->transport->searchQuery = $query;
|
||||||
$this->context->transport->lastSearchQuery = $query;
|
$this->context->transport->lastSearchQuery = $query;
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListPosts);
|
PrivilegesHelper::confirmWithException(Privilege::ListPosts);
|
||||||
|
@ -180,9 +166,6 @@ class PostController
|
||||||
*/
|
*/
|
||||||
public function uploadAction()
|
public function uploadAction()
|
||||||
{
|
{
|
||||||
$this->context->stylesheets []= 'post-upload.css';
|
|
||||||
$this->context->scripts []= 'post-upload.js';
|
|
||||||
$this->context->subTitle = 'upload';
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::UploadPost);
|
PrivilegesHelper::confirmWithException(Privilege::UploadPost);
|
||||||
if ($this->config->registration->needEmailForUploading)
|
if ($this->config->registration->needEmailForUploading)
|
||||||
PrivilegesHelper::confirmEmail($this->context->user);
|
PrivilegesHelper::confirmEmail($this->context->user);
|
||||||
|
@ -458,13 +441,6 @@ class PostController
|
||||||
$score = $this->context->user->getScore($post);
|
$score = $this->context->user->getScore($post);
|
||||||
$flagged = in_array(TextHelper::reprPost($post), SessionHelper::get('flagged', []));
|
$flagged = in_array(TextHelper::reprPost($post), SessionHelper::get('flagged', []));
|
||||||
|
|
||||||
$this->context->pageThumb = \Chibi\UrlHelper::route('post', 'thumb', ['name' => $post->name]);
|
|
||||||
$this->context->stylesheets []= 'post-view.css';
|
|
||||||
$this->context->stylesheets []= 'comment-small.css';
|
|
||||||
$this->context->stylesheets []= 'comment-edit.css';
|
|
||||||
$this->context->scripts []= 'post-view.js';
|
|
||||||
$this->context->scripts []= 'comment-edit.js';
|
|
||||||
$this->context->subTitle = 'showing ' . TextHelper::reprPost($post) . ' – ' . TextHelper::reprTags($post->getTags());
|
|
||||||
$this->context->favorite = $favorite;
|
$this->context->favorite = $favorite;
|
||||||
$this->context->score = $score;
|
$this->context->score = $score;
|
||||||
$this->context->flagged = $flagged;
|
$this->context->flagged = $flagged;
|
||||||
|
|
|
@ -8,8 +8,6 @@ class TagController
|
||||||
*/
|
*/
|
||||||
public function listAction($filter = null)
|
public function listAction($filter = null)
|
||||||
{
|
{
|
||||||
$this->context->stylesheets []= 'tag-list.css';
|
|
||||||
$this->context->subTitle = 'tags';
|
|
||||||
$this->context->viewName = 'tag-list-wrapper';
|
$this->context->viewName = 'tag-list-wrapper';
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListTags);
|
PrivilegesHelper::confirmWithException(Privilege::ListTags);
|
||||||
|
@ -32,8 +30,6 @@ class TagController
|
||||||
*/
|
*/
|
||||||
public function mergeAction()
|
public function mergeAction()
|
||||||
{
|
{
|
||||||
$this->context->stylesheets []= 'tag-list.css';
|
|
||||||
$this->context->subTitle = 'tags';
|
|
||||||
$this->context->viewName = 'tag-list-wrapper';
|
$this->context->viewName = 'tag-list-wrapper';
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
||||||
|
@ -60,8 +56,6 @@ class TagController
|
||||||
*/
|
*/
|
||||||
public function renameAction()
|
public function renameAction()
|
||||||
{
|
{
|
||||||
$this->context->stylesheets []= 'tag-list.css';
|
|
||||||
$this->context->subTitle = 'tags';
|
|
||||||
$this->context->viewName = 'tag-list-wrapper';
|
$this->context->viewName = 'tag-list-wrapper';
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
||||||
|
@ -88,8 +82,6 @@ class TagController
|
||||||
*/
|
*/
|
||||||
public function massTagRedirectAction()
|
public function massTagRedirectAction()
|
||||||
{
|
{
|
||||||
$this->context->stylesheets []= 'tag-list.css';
|
|
||||||
$this->context->subTitle = 'tags';
|
|
||||||
$this->context->viewName = 'tag-list-wrapper';
|
$this->context->viewName = 'tag-list-wrapper';
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::MassTag);
|
PrivilegesHelper::confirmWithException(Privilege::MassTag);
|
||||||
|
|
|
@ -8,8 +8,6 @@ class UserController
|
||||||
$this->context->transport->user = $user;
|
$this->context->transport->user = $user;
|
||||||
$this->context->handleExceptions = true;
|
$this->context->handleExceptions = true;
|
||||||
$this->context->viewName = 'user-view';
|
$this->context->viewName = 'user-view';
|
||||||
$this->context->stylesheets []= 'user-view.css';
|
|
||||||
$this->context->subTitle = $user->name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function sendTokenizedEmail(
|
private static function sendTokenizedEmail(
|
||||||
|
@ -109,11 +107,6 @@ class UserController
|
||||||
*/
|
*/
|
||||||
public function listAction($sortStyle, $page)
|
public function listAction($sortStyle, $page)
|
||||||
{
|
{
|
||||||
$this->context->stylesheets []= 'user-list.css';
|
|
||||||
$this->context->stylesheets []= 'paginator.css';
|
|
||||||
if ($this->context->user->hasEnabledEndlessScrolling())
|
|
||||||
$this->context->scripts []= 'paginator-endless.js';
|
|
||||||
|
|
||||||
if ($sortStyle == '' or $sortStyle == 'alpha')
|
if ($sortStyle == '' or $sortStyle == 'alpha')
|
||||||
$sortStyle = 'alpha,asc';
|
$sortStyle = 'alpha,asc';
|
||||||
if ($sortStyle == 'date')
|
if ($sortStyle == 'date')
|
||||||
|
@ -121,7 +114,6 @@ class UserController
|
||||||
|
|
||||||
$page = intval($page);
|
$page = intval($page);
|
||||||
$usersPerPage = intval($this->config->browsing->usersPerPage);
|
$usersPerPage = intval($this->config->browsing->usersPerPage);
|
||||||
$this->context->subTitle = 'users';
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListUsers);
|
PrivilegesHelper::confirmWithException(Privilege::ListUsers);
|
||||||
|
|
||||||
$page = max(1, $page);
|
$page = max(1, $page);
|
||||||
|
@ -422,12 +414,6 @@ class UserController
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
||||||
$this->loadUserView($user);
|
$this->loadUserView($user);
|
||||||
$this->context->stylesheets []= 'post-list.css';
|
|
||||||
$this->context->stylesheets []= 'post-small.css';
|
|
||||||
$this->context->stylesheets []= 'paginator.css';
|
|
||||||
$this->context->scripts []= 'post-list.js';
|
|
||||||
if ($this->context->user->hasEnabledEndlessScrolling())
|
|
||||||
$this->context->scripts []= 'paginator-endless.js';
|
|
||||||
|
|
||||||
$query = '';
|
$query = '';
|
||||||
if ($tab == 'uploads')
|
if ($tab == 'uploads')
|
||||||
|
@ -483,8 +469,6 @@ class UserController
|
||||||
public function registrationAction()
|
public function registrationAction()
|
||||||
{
|
{
|
||||||
$this->context->handleExceptions = true;
|
$this->context->handleExceptions = true;
|
||||||
$this->context->stylesheets []= 'auth.css';
|
|
||||||
$this->context->subTitle = 'registration form';
|
|
||||||
|
|
||||||
//check if already logged in
|
//check if already logged in
|
||||||
if ($this->context->loggedIn)
|
if ($this->context->loggedIn)
|
||||||
|
@ -570,8 +554,8 @@ class UserController
|
||||||
*/
|
*/
|
||||||
public function activationAction($token)
|
public function activationAction($token)
|
||||||
{
|
{
|
||||||
$this->context->subTitle = 'account activation';
|
|
||||||
$this->context->viewName = 'message';
|
$this->context->viewName = 'message';
|
||||||
|
LayoutHelper::setSubTitle('account activation');
|
||||||
|
|
||||||
$dbToken = TokenModel::findByToken($token);
|
$dbToken = TokenModel::findByToken($token);
|
||||||
TokenModel::checkValidity($dbToken);
|
TokenModel::checkValidity($dbToken);
|
||||||
|
@ -603,8 +587,8 @@ class UserController
|
||||||
*/
|
*/
|
||||||
public function passwordResetAction($token)
|
public function passwordResetAction($token)
|
||||||
{
|
{
|
||||||
$this->context->subTitle = 'password reset';
|
|
||||||
$this->context->viewName = 'message';
|
$this->context->viewName = 'message';
|
||||||
|
LayoutHelper::setSubTitle('password reset');
|
||||||
|
|
||||||
$dbToken = TokenModel::findByToken($token);
|
$dbToken = TokenModel::findByToken($token);
|
||||||
TokenModel::checkValidity($dbToken);
|
TokenModel::checkValidity($dbToken);
|
||||||
|
@ -637,9 +621,8 @@ class UserController
|
||||||
*/
|
*/
|
||||||
public function passwordResetProxyAction()
|
public function passwordResetProxyAction()
|
||||||
{
|
{
|
||||||
$this->context->subTtile = 'password reset';
|
|
||||||
$this->context->viewName = 'user-select';
|
$this->context->viewName = 'user-select';
|
||||||
$this->context->stylesheets []= 'auth.css';
|
LayoutHelper::setSubTitle('password reset');
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
@ -658,9 +641,8 @@ class UserController
|
||||||
*/
|
*/
|
||||||
public function activationProxyAction()
|
public function activationProxyAction()
|
||||||
{
|
{
|
||||||
$this->context->subTitle = 'account activation';
|
|
||||||
$this->context->viewName = 'user-select';
|
$this->context->viewName = 'user-select';
|
||||||
$this->context->stylesheets []= 'auth.css';
|
LayoutHelper::setSubTitle('account activation');
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
|
|
66
src/Helpers/LayoutHelper.php
Normal file
66
src/Helpers/LayoutHelper.php
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
class LayoutHelper
|
||||||
|
{
|
||||||
|
private static $stylesheets = [];
|
||||||
|
private static $scripts = [];
|
||||||
|
private static $title = null;
|
||||||
|
private static $pageThumb = null;
|
||||||
|
private static $subTitle = null;
|
||||||
|
|
||||||
|
public static function setTitle($text)
|
||||||
|
{
|
||||||
|
self::$title = $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setSubTitle($text)
|
||||||
|
{
|
||||||
|
self::$subTitle = $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setPageThumb($path)
|
||||||
|
{
|
||||||
|
self::$pageThumb = $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addStylesheet($css)
|
||||||
|
{
|
||||||
|
self::$stylesheets []= $css;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function addScript($js)
|
||||||
|
{
|
||||||
|
self::$scripts []= $js;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function transformHtml($html)
|
||||||
|
{
|
||||||
|
$bodySnippet = '';
|
||||||
|
$headSnippet = '';
|
||||||
|
|
||||||
|
$title = isset(self::$subTitle)
|
||||||
|
? sprintf('%s – %s', self::$title, self::$subTitle)
|
||||||
|
: self::$title;
|
||||||
|
$headSnippet .= '<title>' . $title . '</title>';
|
||||||
|
|
||||||
|
$headSnippet .= '<meta property="og:title" content="' . $title . '"/>';
|
||||||
|
$headSnippet .= '<meta property="og:url" content="' . \Chibi\UrlHelper::currentUrl() . '"/>';
|
||||||
|
if (!empty(self::$pageThumb))
|
||||||
|
$headSnippet .= '<meta property="og:image" content="' . self::$pageThumb . '"/>';
|
||||||
|
|
||||||
|
foreach (array_unique(self::$stylesheets) as $name)
|
||||||
|
$headSnippet .= '<link rel="stylesheet" type="text/css" href="' . \Chibi\UrlHelper::absoluteUrl('/media/css/' . $name) . '"/>';
|
||||||
|
|
||||||
|
foreach (array_unique(self::$scripts) as $name)
|
||||||
|
$bodySnippet .= '<script type="text/javascript" src="' . \Chibi\UrlHelper::absoluteUrl('/media/js/' . $name) . '"></script>';
|
||||||
|
|
||||||
|
$bodySnippet .= '<script type="text/javascript">';
|
||||||
|
$bodySnippet .= '$(function() {';
|
||||||
|
$bodySnippet .= '$(\'body\').trigger(\'dom-update\');';
|
||||||
|
$bodySnippet .= '});';
|
||||||
|
$bodySnippet .= '</script>';
|
||||||
|
|
||||||
|
$html = str_replace('</head>', $headSnippet . '</head>', $html);
|
||||||
|
$html = str_replace('</body>', $bodySnippet . '</body>', $html);
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,8 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('authentication form');
|
||||||
|
LayoutHelper::addStylesheet('auth.css');
|
||||||
|
?>
|
||||||
|
|
||||||
<form action="<?php echo \Chibi\UrlHelper::route('auth', 'login') ?>" class="auth aligned" method="post">
|
<form action="<?php echo \Chibi\UrlHelper::route('auth', 'login') ?>" class="auth aligned" method="post">
|
||||||
<div>
|
<div>
|
||||||
<p>If you don't have an account yet,<br/><a href="<?php echo \Chibi\UrlHelper::route('user', 'registration'); ?>">click here</a> to create a new one.</p>
|
<p>If you don't have an account yet,<br/><a href="<?php echo \Chibi\UrlHelper::route('user', 'registration'); ?>">click here</a> to create a new one.</p>
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('comment-edit.css');
|
||||||
|
LayoutHelper::addScript('comment-edit.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<form action="<?php echo \Chibi\UrlHelper::route('comment', 'add', ['postId' => $this->context->transport->post->id]) ?>" method="post" class="add-comment aligned">
|
<form action="<?php echo \Chibi\UrlHelper::route('comment', 'add', ['postId' => $this->context->transport->post->id]) ?>" method="post" class="add-comment aligned">
|
||||||
<h1>add comment</h1>
|
<h1>add comment</h1>
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('comment-edit.css');
|
||||||
|
LayoutHelper::addScript('comment-edit.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<form action="<?php echo \Chibi\UrlHelper::route('comment', 'edit', ['id' => $this->context->transport->comment->id]) ?>" method="post" class="edit-comment aligned">
|
<form action="<?php echo \Chibi\UrlHelper::route('comment', 'edit', ['id' => $this->context->transport->comment->id]) ?>" method="post" class="edit-comment aligned">
|
||||||
<h1>edit comment</h1>
|
<h1>edit comment</h1>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('comments');
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if (empty($this->context->transport->comments)): ?>
|
<?php if (empty($this->context->transport->comments)): ?>
|
||||||
<p class="alert alert-warning">No comments to show.</p>
|
<p class="alert alert-warning">No comments to show.</p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('comment-list.css');
|
||||||
|
LayoutHelper::addStylesheet('comment-small.css');
|
||||||
|
LayoutHelper::addStylesheet('comment-edit.css');
|
||||||
|
LayoutHelper::addScript('comment-edit.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="comments-wrapper">
|
<div class="comments-wrapper">
|
||||||
<div class="comments paginator-content">
|
<div class="comments paginator-content">
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('comment-small.css');
|
||||||
|
LayoutHelper::addStylesheet('comment-edit.css');
|
||||||
|
LayoutHelper::addScript('comment-edit.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="comment">
|
<div class="comment">
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<?php $commenter = $this->context->comment->getCommenter() ?>
|
<?php $commenter = $this->context->comment->getCommenter() ?>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
LayoutHelper::setSubtitle('help');
|
||||||
|
LayoutHelper::addStylesheet('index-help.css');
|
||||||
|
|
||||||
$tabs = $this->config->help->subTitles;
|
$tabs = $this->config->help->subTitles;
|
||||||
$firstTab = !empty($tabs) ? array_keys($tabs)[0] : null;
|
$firstTab = !empty($tabs) ? array_keys($tabs)[0] : null;
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubtitle('home');
|
||||||
|
LayoutHelper::addStylesheet('index-index.css');
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="welcome">
|
<div id="welcome">
|
||||||
<h1><?php echo $this->config->main->title ?></h1>
|
<h1><?php echo $this->config->main->title ?></h1>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
<?php \Chibi\HeadersHelper::set('Content-Type', 'application/json') ?>
|
<?php
|
||||||
<?php echo TextHelper::jsonEncode($this->context->transport, '/.*(email|confirm|pass|salt)/i') ?>
|
\Chibi\HeadersHelper::set('Content-Type', 'application/json');
|
||||||
|
echo TextHelper::jsonEncode($this->context->transport, '/.*(email|confirm|pass|salt)/i');
|
||||||
|
|
|
@ -1,23 +1,17 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('../lib/jquery-ui/jquery-ui.css');
|
||||||
|
LayoutHelper::addStylesheet('core.css');
|
||||||
|
LayoutHelper::addScript('../lib/jquery/jquery.min.js');
|
||||||
|
LayoutHelper::addScript('../lib/jquery-ui/jquery-ui.min.js');
|
||||||
|
LayoutHelper::addScript('../lib/mousetrap/mousetrap.min.js');
|
||||||
|
LayoutHelper::addScript('core.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<?php
|
|
||||||
$title = isset($this->context->subTitle)
|
|
||||||
? sprintf('%s – %s', $this->context->title, $this->context->subTitle)
|
|
||||||
: $this->context->title
|
|
||||||
?>
|
|
||||||
<title><?php echo $title ?></title>
|
|
||||||
<?php foreach (array_unique($this->context->stylesheets) as $name): ?>
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/css/' . $name) ?>"/>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"/>
|
||||||
|
|
||||||
<meta property="og:title" content="<?php echo $title ?>"/>
|
|
||||||
<meta property="og:url" content="<?php echo \Chibi\UrlHelper::currentUrl() ?>"/>
|
|
||||||
<?php if (!empty($this->context->pageThumb)): ?>
|
|
||||||
<meta property="og:image" content="<?php echo $this->context->pageThumb ?>"/>
|
|
||||||
<?php endif ?>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -64,16 +58,6 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<?php foreach (array_unique($this->context->scripts) as $name): ?>
|
|
||||||
<script type="text/javascript" src="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/js/' . $name) ?>"></script>
|
|
||||||
<?php endforeach ?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function()
|
|
||||||
{
|
|
||||||
$('body').trigger('dom-update');
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div id="small-screen"></div>
|
<div id="small-screen"></div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<?php
|
||||||
|
$this->context->subTitle = 'latest logs';
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if (empty($this->context->transport->logs)): ?>
|
<?php if (empty($this->context->transport->logs)): ?>
|
||||||
<p class="alert alert-warning">No logs to show.</p>
|
<p class="alert alert-warning">No logs to show.</p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('logs (' . $name . ')');
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if (empty($this->context->transport->lines)): ?>
|
<?php if (empty($this->context->transport->lines)): ?>
|
||||||
<p class="alert alert-warning">This log is empty. <a href="<?php echo \Chibi\UrlHelper::route('log', 'list') ?>">Go back</a></p>
|
<p class="alert alert-warning">This log is empty. <a href="<?php echo \Chibi\UrlHelper::route('log', 'list') ?>">Go back</a></p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('logs.css');
|
||||||
|
LayoutHelper::addScript('logs.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<form action="<?php echo \Chibi\UrlHelper::route('log', 'view', ['name' => $this->context->transport->name]) ?>" method="get">
|
<form action="<?php echo \Chibi\UrlHelper::route('log', 'view', ['name' => $this->context->transport->name]) ?>" method="get">
|
||||||
Keep only lines that contain:
|
Keep only lines that contain:
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,12 @@ if (!function_exists('pageUrl'))
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (!empty($pagesVisible)): ?>
|
<?php if (!empty($pagesVisible)): ?>
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('paginator.css');
|
||||||
|
if ($this->context->user->hasEnabledEndlessScrolling())
|
||||||
|
LayoutHelper::addScript('paginator-endless.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<nav class="paginator-wrapper">
|
<nav class="paginator-wrapper">
|
||||||
<ul class="paginator">
|
<ul class="paginator">
|
||||||
<?php if ($page > 1): ?>
|
<?php if ($page > 1): ?>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<?php LayoutHelper::setPageThumb(\Chibi\UrlHelper::route('post', 'thumb', ['name' => $this->context->transport->post->name])) ?>
|
||||||
<?php $post = $this->context->transport->post ?>
|
<?php $post = $this->context->transport->post ?>
|
||||||
|
|
||||||
<?php if ($post->type == PostType::Image): ?>
|
<?php if ($post->type == PostType::Image): ?>
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('posts');
|
||||||
|
|
||||||
$tabs = [];
|
$tabs = [];
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['All posts', \Chibi\UrlHelper::route('post', 'list')];
|
if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['All posts', \Chibi\UrlHelper::route('post', 'list')];
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['Random', \Chibi\UrlHelper::route('post', 'random')];
|
if (PrivilegesHelper::confirm(Privilege::ListPosts)) $tabs []= ['Random', \Chibi\UrlHelper::route('post', 'random')];
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('post-list.css');
|
||||||
|
LayoutHelper::addScript('post-list.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if (isset($this->context->source) and $this->context->source == 'mass-tag' and PrivilegesHelper::confirm(Privilege::MassTag)): ?>
|
<?php if (isset($this->context->source) and $this->context->source == 'mass-tag' and PrivilegesHelper::confirm(Privilege::MassTag)): ?>
|
||||||
<?php $this->renderFile('tag-mass-tag') ?>
|
<?php $this->renderFile('tag-mass-tag') ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
<?php $classNames = ['post', 'post-type-' . TextHelper::camelCaseToHumanCase(PostType::toString($this->context->post->type))] ?>
|
<?php
|
||||||
<?php $masstag = (isset($this->context->source) and $this->context->source == 'mass-tag' and !empty($this->context->additionalInfo)) ?>
|
LayoutHelper::addStylesheet('post-small.css');
|
||||||
<?php if ($masstag): ?>
|
|
||||||
<?php $classNames []= 'taggable' ?>
|
$classNames =
|
||||||
<?php if ($this->context->post->isTaggedWith($this->context->additionalInfo)): ?>
|
[
|
||||||
<?php $classNames []= 'tagged' ?>
|
'post',
|
||||||
<?php endif ?>
|
'post-type-' . TextHelper::camelCaseToHumanCase(PostType::toString($this->context->post->type))
|
||||||
<?php endif ?>
|
];
|
||||||
|
|
||||||
|
$masstag = (isset($this->context->source)
|
||||||
|
and $this->context->source == 'mass-tag'
|
||||||
|
and !empty($this->context->additionalInfo));
|
||||||
|
|
||||||
|
if ($masstag)
|
||||||
|
{
|
||||||
|
$classNames []= 'taggable';
|
||||||
|
if ($this->context->post->isTaggedWith($this->context->additionalInfo))
|
||||||
|
{
|
||||||
|
$classNames []= 'tagged';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<div class="<?php echo implode(' ', $classNames) ?>">
|
<div class="<?php echo implode(' ', $classNames) ?>">
|
||||||
<?php if ($masstag): ?>
|
<?php if ($masstag): ?>
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('upload');
|
||||||
|
LayoutHelper::addStylesheet('post-upload.css');
|
||||||
|
LayoutHelper::addScript('post-upload.js');
|
||||||
|
LayoutHelper::addStylesheet('../lib/tagit/jquery.tagit.css');
|
||||||
|
LayoutHelper::addScript('../lib/tagit/jquery.tagit.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div class="unit">
|
<div class="unit">
|
||||||
<h1>file upload</h1>
|
<h1>file upload</h1>
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('showing ' . TextHelper::reprPost($this->context->transport->post) . ' – ' . TextHelper::reprTags($this->context->transport->post->getTags()));
|
||||||
|
LayoutHelper::addStylesheet('post-view.css');
|
||||||
|
LayoutHelper::addScript('post-view.js');
|
||||||
|
LayoutHelper::addStylesheet('../lib/tagit/jquery.tagit.css');
|
||||||
|
LayoutHelper::addScript('../lib/tagit/jquery.tagit.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<nav id="around">
|
<nav id="around">
|
||||||
<div class="left">
|
<div class="left">
|
||||||
|
|
|
@ -6,37 +6,37 @@
|
||||||
<?php foreach ($this->context->options as $option): ?>
|
<?php foreach ($this->context->options as $option): ?>
|
||||||
<li class="<?php echo $option['class']; if (isset($option['inactive'])) echo ' inactive' ?>">
|
<li class="<?php echo $option['class']; if (isset($option['inactive'])) echo ' inactive' ?>">
|
||||||
<?php
|
<?php
|
||||||
$class = [];
|
$class = [];
|
||||||
|
|
||||||
$attrs = [];
|
$attrs = [];
|
||||||
if (!empty($option['link']))
|
if (!empty($option['link']))
|
||||||
|
{
|
||||||
|
$attrs['href'] = $option['link'];
|
||||||
|
}
|
||||||
|
elseif (!empty($option['simple-action']))
|
||||||
|
{
|
||||||
|
$attrs['href'] = $option['simple-action'];
|
||||||
|
$class []= 'simple-action';
|
||||||
|
|
||||||
|
if (isset($option['data-confirm-text']))
|
||||||
{
|
{
|
||||||
$attrs['href'] = $option['link'];
|
$attrs['data-confirm-text'] = $option['data-confirm-text'];
|
||||||
|
$class []= 'confirmable';
|
||||||
}
|
}
|
||||||
elseif (!empty($option['simple-action']))
|
|
||||||
{
|
|
||||||
$attrs['href'] = $option['simple-action'];
|
|
||||||
$class []= 'simple-action';
|
|
||||||
|
|
||||||
if (isset($option['data-confirm-text']))
|
if (isset($option['data-redirect-url']))
|
||||||
{
|
$attrs['data-redirect-url'] = $option['data-redirect-url'];
|
||||||
$attrs['data-confirm-text'] = $option['data-confirm-text'];
|
}
|
||||||
$class []= 'confirmable';
|
else
|
||||||
}
|
$attrs['href'] = '#';
|
||||||
|
|
||||||
if (isset($option['data-redirect-url']))
|
if (!empty($class))
|
||||||
$attrs['data-redirect-url'] = $option['data-redirect-url'];
|
$attrs['class'] = join(' ', $class);
|
||||||
}
|
|
||||||
else
|
|
||||||
$attrs['href'] = '#';
|
|
||||||
|
|
||||||
if (!empty($class))
|
echo TextHelper::htmlTag('a', TextHelper::HTML_OPEN, $attrs);
|
||||||
$attrs['class'] = join(' ', $class);
|
echo $option['text'];
|
||||||
|
echo TextHelper::htmlTag('a', TextHelper::HTML_CLOSE);
|
||||||
echo TextHelper::htmlTag('a', TextHelper::HTML_OPEN, $attrs);
|
?>
|
||||||
echo $option['text'];
|
|
||||||
echo TextHelper::htmlTag('a', TextHelper::HTML_CLOSE);
|
|
||||||
?>
|
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
<?php $tabs = [] ?>
|
<?php
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ListTags)) $tabs['list'] = 'List'; ?>
|
LayoutHelper::setSubTitle('tags');
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::RenameTags)) $tabs['rename'] = 'Rename'; ?>
|
LayoutHelper::addStylesheet('tag-list.css');
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::MergeTags)) $tabs['merge'] = 'Merge'; ?>
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = 'Mass tag'; ?>
|
$tabs = [];
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::ListTags)) $tabs['list'] = 'List';
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::RenameTags)) $tabs['rename'] = 'Rename';
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::MergeTags)) $tabs['merge'] = 'Merge';
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::MassTag)) $tabs['mass-tag-redirect'] = 'Mass tag';
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if (count(array_diff($tabs, ['list'])) > 1): ?>
|
<?php if (count(array_diff($tabs, ['list'])) > 1): ?>
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<nav class="sort-styles">
|
<nav class="sort-styles">
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
$sortStyles =
|
$sortStyles =
|
||||||
[
|
[
|
||||||
'order:alpha,asc' => 'Sort A→Z',
|
'order:alpha,asc' => 'Sort A→Z',
|
||||||
'order:alpha,desc' => 'Sort Z→A',
|
'order:alpha,desc' => 'Sort Z→A',
|
||||||
'order:popularity,desc' => 'Often used first',
|
'order:popularity,desc' => 'Often used first',
|
||||||
'order:popularity,asc' => 'Rarely used first',
|
'order:popularity,asc' => 'Rarely used first',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->config->registration->staffActivation)
|
if ($this->config->registration->staffActivation)
|
||||||
$sortStyles['pending'] = 'Pending staff review';
|
$sortStyles['pending'] = 'Pending staff review';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php foreach ($sortStyles as $key => $text): ?>
|
<?php foreach ($sortStyles as $key => $text): ?>
|
||||||
|
|
|
@ -1,112 +1,112 @@
|
||||||
<ul class="main-nav">
|
<ul class="main-nav">
|
||||||
<?php
|
<?php
|
||||||
$nav = [];
|
$nav = [];
|
||||||
|
|
||||||
if ($this->context->route)
|
if ($this->context->route)
|
||||||
{
|
{
|
||||||
$activeController = $this->context->route->simpleControllerName;
|
$activeController = $this->context->route->simpleControllerName;
|
||||||
$activeAction = $this->context->route->simpleActionName;
|
$activeAction = $this->context->route->simpleActionName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$activeController = null;
|
$activeController = null;
|
||||||
$activeAction = null;
|
$activeAction = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$registerNavItem = function ($text, $link, $active = false) use (&$nav)
|
$registerNavItem = function ($text, $link, $active = false) use (&$nav)
|
||||||
{
|
{
|
||||||
$nav []= [
|
$nav []= [
|
||||||
'text' => $text,
|
'text' => $text,
|
||||||
'link' => $link,
|
'link' => $link,
|
||||||
'active' => $active];
|
'active' => $active];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$registerNavItem(
|
||||||
|
'Home',
|
||||||
|
\Chibi\UrlHelper::route('index', 'index'),
|
||||||
|
$activeController == 'index' and $activeAction == 'index');
|
||||||
|
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
||||||
|
{
|
||||||
|
$registerNavItem(
|
||||||
|
'Browse',
|
||||||
|
\Chibi\UrlHelper::route('post', 'list'),
|
||||||
|
$activeController == 'post' and $activeAction != 'upload');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::UploadPost))
|
||||||
|
{
|
||||||
|
$registerNavItem(
|
||||||
|
'Upload',
|
||||||
|
\Chibi\UrlHelper::route('post', 'upload'),
|
||||||
|
$activeController == 'post' and $activeAction == 'upload');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::ListComments))
|
||||||
|
{
|
||||||
|
$registerNavItem(
|
||||||
|
'Comments',
|
||||||
|
\Chibi\UrlHelper::route('comment', 'list'),
|
||||||
|
$activeController == 'comment');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::ListTags))
|
||||||
|
{
|
||||||
|
$registerNavItem(
|
||||||
|
'Tags',
|
||||||
|
\Chibi\UrlHelper::route('tag', 'list'),
|
||||||
|
$activeController == 'tag');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PrivilegesHelper::confirm(Privilege::ListUsers))
|
||||||
|
{
|
||||||
|
$registerNavItem(
|
||||||
|
'Users',
|
||||||
|
\Chibi\UrlHelper::route('user', 'list'),
|
||||||
|
$activeController == 'user' and $activeAction != 'registration' and (!isset($this->context->route->arguments['name']) or $this->context->route->arguments['name'] != $this->context->user->name));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$this->context->loggedIn)
|
||||||
|
{
|
||||||
|
$registerNavItem(
|
||||||
|
'Log in',
|
||||||
|
\Chibi\UrlHelper::route('auth', 'login'),
|
||||||
|
$activeController == 'auth' and $activeAction == 'login');
|
||||||
|
|
||||||
$registerNavItem(
|
$registerNavItem(
|
||||||
'Home',
|
'Register',
|
||||||
\Chibi\UrlHelper::route('index', 'index'),
|
\Chibi\UrlHelper::route('user', 'registration'),
|
||||||
$activeController == 'index' and $activeAction == 'index');
|
$activeController == 'user' and $activeAction == 'registration');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$registerNavItem(
|
||||||
|
'My account',
|
||||||
|
\Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->user->name]),
|
||||||
|
$activeController == 'user' and isset($this->context->route->arguments['name']) and $this->context->route->arguments['name'] == $this->context->user->name);
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListPosts))
|
$registerNavItem(
|
||||||
{
|
'Log out',
|
||||||
$registerNavItem(
|
\Chibi\UrlHelper::route('auth', 'logout'));
|
||||||
'Browse',
|
}
|
||||||
\Chibi\UrlHelper::route('post', 'list'),
|
|
||||||
$activeController == 'post' and $activeAction != 'upload');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::UploadPost))
|
if (!empty($this->config->help->title))
|
||||||
{
|
{
|
||||||
$registerNavItem(
|
$registerNavItem(
|
||||||
'Upload',
|
$this->config->help->title,
|
||||||
\Chibi\UrlHelper::route('post', 'upload'),
|
\Chibi\UrlHelper::route('index', 'help'),
|
||||||
$activeController == 'post' and $activeAction == 'upload');
|
$activeController == 'index' and $activeAction == 'help');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListComments))
|
foreach ($nav as $navItem)
|
||||||
{
|
{
|
||||||
$registerNavItem(
|
extract($navItem);
|
||||||
'Comments',
|
echo TextHelper::htmlTag('li', TextHelper::HTML_OPEN, ['class' => rtrim('main-nav-item ' . ($active ? 'active' : ''))]);
|
||||||
\Chibi\UrlHelper::route('comment', 'list'),
|
echo TextHelper::htmlTag('a', TextHelper::HTML_OPEN, ['href' => $link]);
|
||||||
$activeController == 'comment');
|
echo $text;
|
||||||
}
|
echo TextHelper::htmlTag('a', textHelper::HTML_CLOSE);
|
||||||
|
echo TextHelper::htmlTag('li', textHelper::HTML_CLOSE);
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListTags))
|
}
|
||||||
{
|
|
||||||
$registerNavItem(
|
|
||||||
'Tags',
|
|
||||||
\Chibi\UrlHelper::route('tag', 'list'),
|
|
||||||
$activeController == 'tag');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PrivilegesHelper::confirm(Privilege::ListUsers))
|
|
||||||
{
|
|
||||||
$registerNavItem(
|
|
||||||
'Users',
|
|
||||||
\Chibi\UrlHelper::route('user', 'list'),
|
|
||||||
$activeController == 'user' and $activeAction != 'registration' and (!isset($this->context->route->arguments['name']) or $this->context->route->arguments['name'] != $this->context->user->name));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->context->loggedIn)
|
|
||||||
{
|
|
||||||
$registerNavItem(
|
|
||||||
'Log in',
|
|
||||||
\Chibi\UrlHelper::route('auth', 'login'),
|
|
||||||
$activeController == 'auth' and $activeAction == 'login');
|
|
||||||
|
|
||||||
$registerNavItem(
|
|
||||||
'Register',
|
|
||||||
\Chibi\UrlHelper::route('user', 'registration'),
|
|
||||||
$activeController == 'user' and $activeAction == 'registration');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$registerNavItem(
|
|
||||||
'My account',
|
|
||||||
\Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->user->name]),
|
|
||||||
$activeController == 'user' and isset($this->context->route->arguments['name']) and $this->context->route->arguments['name'] == $this->context->user->name);
|
|
||||||
|
|
||||||
$registerNavItem(
|
|
||||||
'Log out',
|
|
||||||
\Chibi\UrlHelper::route('auth', 'logout'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($this->config->help->title))
|
|
||||||
{
|
|
||||||
$registerNavItem(
|
|
||||||
$this->config->help->title,
|
|
||||||
\Chibi\UrlHelper::route('index', 'help'),
|
|
||||||
$activeController == 'index' and $activeAction == 'help');
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($nav as $navItem)
|
|
||||||
{
|
|
||||||
extract($navItem);
|
|
||||||
echo TextHelper::htmlTag('li', TextHelper::HTML_OPEN, ['class' => rtrim('main-nav-item ' . ($active ? 'active' : ''))]);
|
|
||||||
echo TextHelper::htmlTag('a', TextHelper::HTML_OPEN, ['href' => $link]);
|
|
||||||
echo $text;
|
|
||||||
echo TextHelper::htmlTag('a', textHelper::HTML_CLOSE);
|
|
||||||
echo TextHelper::htmlTag('li', textHelper::HTML_CLOSE);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->user))): ?>
|
<?php if (PrivilegesHelper::confirm(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($this->context->user))): ?>
|
||||||
|
|
|
@ -1,16 +1,24 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('users');
|
||||||
|
LayoutHelper::addStylesheet('user-list.css');
|
||||||
|
LayoutHelper::addStylesheet('paginator.css');
|
||||||
|
if ($this->context->user->hasEnabledEndlessScrolling())
|
||||||
|
LayoutHelper::addScript('paginator-endless.js');
|
||||||
|
?>
|
||||||
|
|
||||||
<nav class="sort-styles">
|
<nav class="sort-styles">
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
$sortStyles =
|
$sortStyles =
|
||||||
[
|
[
|
||||||
'alpha,asc' => 'Sort A→Z',
|
'alpha,asc' => 'Sort A→Z',
|
||||||
'alpha,desc' => 'Sort Z→A',
|
'alpha,desc' => 'Sort Z→A',
|
||||||
'date,asc' => 'Sort old→new',
|
'date,asc' => 'Sort old→new',
|
||||||
'date,desc' => 'Sort new→old',
|
'date,desc' => 'Sort new→old',
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($this->config->registration->staffActivation)
|
if ($this->config->registration->staffActivation)
|
||||||
$sortStyles['pending'] = 'Pending staff review';
|
$sortStyles['pending'] = 'Pending staff review';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php foreach ($sortStyles as $key => $text): ?>
|
<?php foreach ($sortStyles as $key => $text): ?>
|
||||||
|
|
|
@ -1,6 +1,14 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle('registration form');
|
||||||
|
?>
|
||||||
|
|
||||||
<?php if ($this->context->transport->success === true): ?>
|
<?php if ($this->context->transport->success === true): ?>
|
||||||
<?php $this->renderFile('message') ?>
|
<?php $this->renderFile('message') ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('auth.css');
|
||||||
|
?>
|
||||||
|
|
||||||
<form action="<?php echo \Chibi\UrlHelper::route('auth', 'register') ?>" class="auth aligned" method="post">
|
<form action="<?php echo \Chibi\UrlHelper::route('auth', 'register') ?>" class="auth aligned" method="post">
|
||||||
<div>
|
<div>
|
||||||
<p>Registered users can view more content,<br/>upload files and add posts to favorites.</p>
|
<p>Registered users can view more content,<br/>upload files and add posts to favorites.</p>
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<?php if ($this->context->transport->success === true): ?>
|
<?php if ($this->context->transport->success === true): ?>
|
||||||
<?php $this->renderFile('message') ?>
|
<?php $this->renderFile('message') ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<?php
|
||||||
|
LayoutHelper::addStylesheet('auth.css');
|
||||||
|
?>
|
||||||
|
|
||||||
<form action="<?php echo \Chibi\UrlHelper::route($this->context->route->simpleControllerName, $this->context->route->simpleActionName) ?>" method="post" class="auth aligned" autocomplete="off">
|
<form action="<?php echo \Chibi\UrlHelper::route($this->context->route->simpleControllerName, $this->context->route->simpleActionName) ?>" method="post" class="auth aligned" autocomplete="off">
|
||||||
<div>
|
<div>
|
||||||
<label class="left">User:</label>
|
<label class="left">User:</label>
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
<?php
|
||||||
|
LayoutHelper::setSubTitle($this->context->transport->user->name);
|
||||||
|
LayoutHelper::addStylesheet('user-view.css');
|
||||||
|
?>
|
||||||
|
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<div class="avatar-wrapper">
|
<div class="avatar-wrapper">
|
||||||
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name]) ?>">
|
<a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->transport->user->name]) ?>">
|
||||||
|
|
Loading…
Reference in a new issue