mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
aff68e88cf | |||
bf0e40683c | |||
17bd7a7572 | |||
a5d0a3f9ef | |||
5eb5e18b77 | |||
19a8b90ca2 | |||
e7ec8ea49f | |||
0286e11c30 | |||
7605177a6b | |||
52ceb8d962 |
2
init.php
2
init.php
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'src/core.php';
|
require_once 'src/core.php';
|
||||||
$config = configFactory();
|
$config = \Chibi\Registry::getConfig();
|
||||||
$fontsPath = $config->main->mediaPath . DS . 'fonts' . DS;
|
$fontsPath = $config->main->mediaPath . DS . 'fonts' . DS;
|
||||||
$libPath = $config->main->mediaPath . DS . 'lib' . DS;
|
$libPath = $config->main->mediaPath . DS . 'lib' . DS;
|
||||||
|
|
||||||
|
Submodule lib/chibi-core updated: bf824e781c...59f80280ba
@ -41,6 +41,7 @@ class IndexController
|
|||||||
$this->context->featuredPost = $featuredPost;
|
$this->context->featuredPost = $featuredPost;
|
||||||
$this->context->featuredPostUser = $featuredPostUser;
|
$this->context->featuredPostUser = $featuredPostUser;
|
||||||
$this->context->featuredPostDate = $featuredPostDate;
|
$this->context->featuredPostDate = $featuredPostDate;
|
||||||
|
$this->context->pageThumb = \Chibi\UrlHelper::route('post', 'thumb', ['name' => $featuredPost->name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,12 +80,12 @@ class PostController
|
|||||||
$this->context->transport->searchQuery = $formQuery;
|
$this->context->transport->searchQuery = $formQuery;
|
||||||
if (strpos($formQuery, '/') !== false)
|
if (strpos($formQuery, '/') !== false)
|
||||||
throw new SimpleException('Search query contains invalid characters');
|
throw new SimpleException('Search query contains invalid characters');
|
||||||
$url = \Chibi\UrlHelper::route('post', 'list', ['source' => $source, 'additionalInfo' => $additionalInfo, 'query' => urlencode($formQuery)]);
|
$url = \Chibi\UrlHelper::route('post', 'list', ['source' => $source, 'additionalInfo' => $additionalInfo, 'query' => $formQuery]);
|
||||||
\Chibi\UrlHelper::forward($url);
|
\Chibi\UrlHelper::forward($url);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = trim(urldecode($query));
|
$query = trim($query);
|
||||||
$page = intval($page);
|
$page = intval($page);
|
||||||
$postsPerPage = intval($this->config->browsing->postsPerPage);
|
$postsPerPage = intval($this->config->browsing->postsPerPage);
|
||||||
$this->context->subTitle = 'posts';
|
$this->context->subTitle = 'posts';
|
||||||
@ -552,6 +552,8 @@ class PostController
|
|||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
//remove stuff from auxiliary tables
|
//remove stuff from auxiliary tables
|
||||||
|
R::trashAll(R::find('postscore', 'post_id = ?', [$post->id]));
|
||||||
|
R::trashAll(R::find('crossref', 'post_id = ? OR post2_id = ?', [$post->id, $post->id]));
|
||||||
foreach ($post->ownComment as $comment)
|
foreach ($post->ownComment as $comment)
|
||||||
{
|
{
|
||||||
$comment->post = null;
|
$comment->post = null;
|
||||||
@ -731,6 +733,7 @@ class PostController
|
|||||||
|
|
||||||
$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 []= 'post-view.css';
|
||||||
$this->context->stylesheets []= 'comment-small.css';
|
$this->context->stylesheets []= 'comment-small.css';
|
||||||
$this->context->scripts []= 'post-view.js';
|
$this->context->scripts []= 'post-view.js';
|
||||||
@ -750,13 +753,18 @@ class PostController
|
|||||||
* Action that renders the thumbnail of the requested file and sends it to user.
|
* Action that renders the thumbnail of the requested file and sends it to user.
|
||||||
* @route /post/{name}/thumb
|
* @route /post/{name}/thumb
|
||||||
*/
|
*/
|
||||||
public function thumbAction($name)
|
public function thumbAction($name, $width = null, $height = null)
|
||||||
{
|
{
|
||||||
|
$dstWidth = $width === null ? $this->config->browsing->thumbWidth : $width;
|
||||||
|
$dstHeight = $height === null ? $this->config->browsing->thumbHeight : $height;
|
||||||
|
$dstWidth = min(1000, max(1, $dstWidth));
|
||||||
|
$dstHeight = min(1000, max(1, $dstHeight));
|
||||||
|
|
||||||
$this->context->layoutName = 'layout-file';
|
$this->context->layoutName = 'layout-file';
|
||||||
|
|
||||||
$path = $this->config->main->thumbsPath . DS . $name . '.custom';
|
$path = $this->config->main->thumbsPath . DS . $name . '.custom';
|
||||||
if (!file_exists($path))
|
if (!file_exists($path))
|
||||||
$path = $this->config->main->thumbsPath . DS . $name . '.default';
|
$path = $this->config->main->thumbsPath . DS . $name . '-' . $dstWidth . 'x' . $dstHeight . '.default';
|
||||||
if (!file_exists($path))
|
if (!file_exists($path))
|
||||||
{
|
{
|
||||||
$post = Model_Post::locate($name);
|
$post = Model_Post::locate($name);
|
||||||
@ -764,8 +772,6 @@ class PostController
|
|||||||
PrivilegesHelper::confirmWithException(Privilege::ListPosts);
|
PrivilegesHelper::confirmWithException(Privilege::ListPosts);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ListPosts, PostSafety::toString($post->safety));
|
PrivilegesHelper::confirmWithException(Privilege::ListPosts, PostSafety::toString($post->safety));
|
||||||
$srcPath = $this->config->main->filesPath . DS . $post->name;
|
$srcPath = $this->config->main->filesPath . DS . $post->name;
|
||||||
$dstWidth = $this->config->browsing->thumbWidth;
|
|
||||||
$dstHeight = $this->config->browsing->thumbHeight;
|
|
||||||
|
|
||||||
if ($post->type == PostType::Youtube)
|
if ($post->type == PostType::Youtube)
|
||||||
{
|
{
|
||||||
|
@ -126,7 +126,7 @@ class TagController
|
|||||||
$suppliedQuery = ' ';
|
$suppliedQuery = ' ';
|
||||||
$suppliedTag = InputHelper::get('tag');
|
$suppliedTag = InputHelper::get('tag');
|
||||||
$suppliedTag = Model_Tag::validateTag($suppliedTag);
|
$suppliedTag = Model_Tag::validateTag($suppliedTag);
|
||||||
\Chibi\UrlHelper::forward(\Chibi\UrlHelper::route('post', 'list', ['source' => 'mass-tag', 'query' => urlencode($suppliedQuery), 'additionalInfo' => $suppliedTag]));
|
\Chibi\UrlHelper::forward(\Chibi\UrlHelper::route('post', 'list', ['source' => 'mass-tag', 'query' => $suppliedQuery, 'additionalInfo' => $suppliedTag]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
class UserController
|
class UserController
|
||||||
{
|
{
|
||||||
|
private function loadUserView($user)
|
||||||
|
{
|
||||||
|
$flagged = in_array(TextHelper::reprUser($user), SessionHelper::get('flagged', []));
|
||||||
|
$this->context->flagged = $flagged;
|
||||||
|
$this->context->transport->user = $user;
|
||||||
|
$this->context->handleExceptions = true;
|
||||||
|
$this->context->viewName = 'user-view';
|
||||||
|
$this->context->stylesheets []= 'tabs.css';
|
||||||
|
$this->context->stylesheets []= 'user-view.css';
|
||||||
|
$this->context->subTitle = $user->name;
|
||||||
|
}
|
||||||
|
|
||||||
private static function sendTokenizedEmail(
|
private static function sendTokenizedEmail(
|
||||||
$user,
|
$user,
|
||||||
$body,
|
$body,
|
||||||
@ -8,7 +20,7 @@ class UserController
|
|||||||
$senderName,
|
$senderName,
|
||||||
$senderEmail,
|
$senderEmail,
|
||||||
$recipientEmail,
|
$recipientEmail,
|
||||||
$tokens)
|
$linkActionName)
|
||||||
{
|
{
|
||||||
//prepare unique user token
|
//prepare unique user token
|
||||||
do
|
do
|
||||||
@ -24,8 +36,11 @@ class UserController
|
|||||||
R::store($token);
|
R::store($token);
|
||||||
|
|
||||||
\Chibi\Registry::getContext()->mailSent = true;
|
\Chibi\Registry::getContext()->mailSent = true;
|
||||||
|
$tokens = [];
|
||||||
$tokens['host'] = $_SERVER['HTTP_HOST'];
|
$tokens['host'] = $_SERVER['HTTP_HOST'];
|
||||||
$tokens['token'] = $tokenText;
|
$tokens['token'] = $tokenText;
|
||||||
|
if ($linkActionName !== null)
|
||||||
|
$tokens['link'] = \Chibi\UrlHelper::route('user', $linkActionName, ['token' => $tokenText]);
|
||||||
|
|
||||||
$body = wordwrap(TextHelper::replaceTokens($body, $tokens), 70);
|
$body = wordwrap(TextHelper::replaceTokens($body, $tokens), 70);
|
||||||
$subject = TextHelper::replaceTokens($subject, $tokens);
|
$subject = TextHelper::replaceTokens($subject, $tokens);
|
||||||
@ -63,9 +78,6 @@ class UserController
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$tokens = [];
|
|
||||||
$tokens['link'] = \Chibi\UrlHelper::route('user', 'activation', ['token' => '{token}']);
|
|
||||||
|
|
||||||
return self::sendTokenizedEmail(
|
return self::sendTokenizedEmail(
|
||||||
$user,
|
$user,
|
||||||
$regConfig->confirmationEmailBody,
|
$regConfig->confirmationEmailBody,
|
||||||
@ -73,16 +85,13 @@ class UserController
|
|||||||
$regConfig->confirmationEmailSenderName,
|
$regConfig->confirmationEmailSenderName,
|
||||||
$regConfig->confirmationEmailSenderEmail,
|
$regConfig->confirmationEmailSenderEmail,
|
||||||
$user->email_unconfirmed,
|
$user->email_unconfirmed,
|
||||||
$tokens);
|
'activation');
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function sendPasswordResetConfirmation($user)
|
private static function sendPasswordResetConfirmation($user)
|
||||||
{
|
{
|
||||||
$regConfig = \Chibi\Registry::getConfig()->registration;
|
$regConfig = \Chibi\Registry::getConfig()->registration;
|
||||||
|
|
||||||
$tokens = [];
|
|
||||||
$tokens['link'] = \Chibi\UrlHelper::route('user', 'password-reset', ['token' => '{token}']);
|
|
||||||
|
|
||||||
return self::sendTokenizedEmail(
|
return self::sendTokenizedEmail(
|
||||||
$user,
|
$user,
|
||||||
$regConfig->passwordResetEmailBody,
|
$regConfig->passwordResetEmailBody,
|
||||||
@ -90,7 +99,7 @@ class UserController
|
|||||||
$regConfig->passwordResetEmailSenderName,
|
$regConfig->passwordResetEmailSenderName,
|
||||||
$regConfig->passwordResetEmailSenderEmail,
|
$regConfig->passwordResetEmailSenderEmail,
|
||||||
$user->email_confirmed,
|
$user->email_confirmed,
|
||||||
$tokens);
|
'password-reset');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,13 +243,8 @@ class UserController
|
|||||||
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
||||||
PrivilegesHelper::confirmWithException(Privilege::DeleteUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
PrivilegesHelper::confirmWithException(Privilege::DeleteUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
||||||
|
|
||||||
$this->context->handleExceptions = true;
|
$this->loadUserView($user);
|
||||||
$this->context->transport->user = $user;
|
|
||||||
$this->context->transport->tab = 'delete';
|
$this->context->transport->tab = 'delete';
|
||||||
$this->context->viewName = 'user-view';
|
|
||||||
$this->context->stylesheets []= 'tabs.css';
|
|
||||||
$this->context->stylesheets []= 'user-view.css';
|
|
||||||
$this->context->subTitle = $name;
|
|
||||||
|
|
||||||
$this->context->suppliedCurrentPassword = $suppliedCurrentPassword = InputHelper::get('current-password');
|
$this->context->suppliedCurrentPassword = $suppliedCurrentPassword = InputHelper::get('current-password');
|
||||||
|
|
||||||
@ -253,6 +257,7 @@ class UserController
|
|||||||
if ($suppliedPasswordHash != $user->pass_hash)
|
if ($suppliedPasswordHash != $user->pass_hash)
|
||||||
throw new SimpleException('Must supply valid password');
|
throw new SimpleException('Must supply valid password');
|
||||||
}
|
}
|
||||||
|
R::trashAll(R::find('postscore', 'user_id = ?', [$user->id]));
|
||||||
foreach ($user->alias('commenter')->ownComment as $comment)
|
foreach ($user->alias('commenter')->ownComment as $comment)
|
||||||
{
|
{
|
||||||
$comment->commenter = null;
|
$comment->commenter = null;
|
||||||
@ -287,13 +292,8 @@ class UserController
|
|||||||
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($user));
|
PrivilegesHelper::confirmWithException(Privilege::ChangeUserSettings, PrivilegesHelper::getIdentitySubPrivilege($user));
|
||||||
|
|
||||||
$this->context->handleExceptions = true;
|
$this->loadUserView($user);
|
||||||
$this->context->transport->user = $user;
|
|
||||||
$this->context->transport->tab = 'settings';
|
$this->context->transport->tab = 'settings';
|
||||||
$this->context->viewName = 'user-view';
|
|
||||||
$this->context->stylesheets []= 'tabs.css';
|
|
||||||
$this->context->stylesheets []= 'user-view.css';
|
|
||||||
$this->context->subTitle = $name;
|
|
||||||
|
|
||||||
if (InputHelper::get('submit'))
|
if (InputHelper::get('submit'))
|
||||||
{
|
{
|
||||||
@ -326,13 +326,8 @@ class UserController
|
|||||||
$user = Model_User::locate($name);
|
$user = Model_User::locate($name);
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
||||||
|
|
||||||
$this->context->handleExceptions = true;
|
$this->loadUserView($user);
|
||||||
$this->context->transport->user = $user;
|
|
||||||
$this->context->transport->tab = 'edit';
|
$this->context->transport->tab = 'edit';
|
||||||
$this->context->viewName = 'user-view';
|
|
||||||
$this->context->stylesheets []= 'tabs.css';
|
|
||||||
$this->context->stylesheets []= 'user-view.css';
|
|
||||||
$this->context->subTitle = $name;
|
|
||||||
|
|
||||||
$this->context->suppliedCurrentPassword = $suppliedCurrentPassword = InputHelper::get('current-password');
|
$this->context->suppliedCurrentPassword = $suppliedCurrentPassword = InputHelper::get('current-password');
|
||||||
$this->context->suppliedName = $suppliedName = InputHelper::get('name');
|
$this->context->suppliedName = $suppliedName = InputHelper::get('name');
|
||||||
@ -437,14 +432,12 @@ class UserController
|
|||||||
$page = 1;
|
$page = 1;
|
||||||
|
|
||||||
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
PrivilegesHelper::confirmWithException(Privilege::ViewUser, PrivilegesHelper::getIdentitySubPrivilege($user));
|
||||||
$this->context->stylesheets []= 'tabs.css';
|
$this->loadUserView($user);
|
||||||
$this->context->stylesheets []= 'user-view.css';
|
|
||||||
$this->context->stylesheets []= 'post-list.css';
|
$this->context->stylesheets []= 'post-list.css';
|
||||||
$this->context->stylesheets []= 'post-small.css';
|
$this->context->stylesheets []= 'post-small.css';
|
||||||
$this->context->stylesheets []= 'paginator.css';
|
$this->context->stylesheets []= 'paginator.css';
|
||||||
if ($this->context->user->hasEnabledEndlessScrolling())
|
if ($this->context->user->hasEnabledEndlessScrolling())
|
||||||
$this->context->scripts []= 'paginator-endless.js';
|
$this->context->scripts []= 'paginator-endless.js';
|
||||||
$this->context->subTitle = $name;
|
|
||||||
|
|
||||||
$query = '';
|
$query = '';
|
||||||
if ($tab == 'uploads')
|
if ($tab == 'uploads')
|
||||||
@ -459,10 +452,6 @@ class UserController
|
|||||||
$page = max(1, min($pageCount, $page));
|
$page = max(1, min($pageCount, $page));
|
||||||
$posts = Model_Post::getEntities($query, $postsPerPage, $page);
|
$posts = Model_Post::getEntities($query, $postsPerPage, $page);
|
||||||
|
|
||||||
$flagged = in_array(TextHelper::reprUser($user), SessionHelper::get('flagged', []));
|
|
||||||
|
|
||||||
$this->context->flagged = $flagged;
|
|
||||||
$this->context->transport->user = $user;
|
|
||||||
$this->context->transport->tab = $tab;
|
$this->context->transport->tab = $tab;
|
||||||
$this->context->transport->paginator = new StdClass;
|
$this->context->transport->paginator = new StdClass;
|
||||||
$this->context->transport->paginator->page = $page;
|
$this->context->transport->paginator->page = $page;
|
||||||
|
@ -5,6 +5,7 @@ class CustomMarkdown extends \Michelf\Markdown
|
|||||||
{
|
{
|
||||||
$this->no_markup = true;
|
$this->no_markup = true;
|
||||||
$this->span_gamut += ['doSpoilers' => 71];
|
$this->span_gamut += ['doSpoilers' => 71];
|
||||||
|
$this->span_gamut += ['doStrike' => 6];
|
||||||
$this->span_gamut += ['doUsers' => 7];
|
$this->span_gamut += ['doUsers' => 7];
|
||||||
$this->span_gamut += ['doPosts' => 8];
|
$this->span_gamut += ['doPosts' => 8];
|
||||||
$this->span_gamut += ['doTags' => 9];
|
$this->span_gamut += ['doTags' => 9];
|
||||||
@ -45,6 +46,14 @@ class CustomMarkdown extends \Michelf\Markdown
|
|||||||
return preg_replace_callback('/\n/', [&$this, '_doHardBreaks_callback'], $text);
|
return preg_replace_callback('/\n/', [&$this, '_doHardBreaks_callback'], $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function doStrike($text)
|
||||||
|
{
|
||||||
|
return preg_replace_callback('{(~~|---)([^~]+)\1}', function($x)
|
||||||
|
{
|
||||||
|
return $this->hashPart('<del>') . $x[2] . $this->hashPart('</del>');
|
||||||
|
}, $text);
|
||||||
|
}
|
||||||
|
|
||||||
protected function doSpoilers($text)
|
protected function doSpoilers($text)
|
||||||
{
|
{
|
||||||
if (is_array($text))
|
if (is_array($text))
|
||||||
|
3
src/Upgrades/Upgrade7.sql
Normal file
3
src/Upgrades/Upgrade7.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
CREATE UNIQUE INDEX idx_uq_postscore_post_id_user_id ON postscore(post_id, user_id);
|
||||||
|
CREATE UNIQUE INDEX idx_uq_crossref_post_id_post2_id ON crossref(post_id, post2_id);
|
||||||
|
|
@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<span class="left">
|
<div class="left">
|
||||||
Tags:
|
Tags:
|
||||||
<ul class="tags">
|
<ul class="tags">
|
||||||
<?php foreach ($this->context->featuredPost->sharedTag as $tag): ?>
|
<?php foreach ($this->context->featuredPost->sharedTag as $tag): ?>
|
||||||
@ -24,9 +24,9 @@
|
|||||||
</li>
|
</li>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
</span>
|
</div>
|
||||||
|
|
||||||
<span class="right">
|
<div class="right">
|
||||||
Featured 
|
Featured 
|
||||||
<?php if ($this->context->featuredPostUser): ?>
|
<?php if ($this->context->featuredPostUser): ?>
|
||||||
by <a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->featuredPostUser->name]) ?>"><?php echo $this->context->featuredPostUser->name ?></a>, 
|
by <a href="<?php echo \Chibi\UrlHelper::route('user', 'view', ['name' => $this->context->featuredPostUser->name]) ?>"><?php echo $this->context->featuredPostUser->name ?></a>, 
|
||||||
@ -39,7 +39,7 @@
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php printf('%d days ago', $x) ?>
|
<?php printf('%d days ago', $x) ?>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</span>
|
</div>
|
||||||
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,18 +2,25 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<?php if (isset($this->context->subTitle)): ?>
|
<?php
|
||||||
<title><?php printf('%s – %s', $this->context->title, $this->context->subTitle) ?></title>
|
$title = isset($this->context->subTitle)
|
||||||
<?php else: ?>
|
? sprintf('%s – %s', $this->context->title, $this->context->subTitle)
|
||||||
<title><?php echo $this->context->title ?></title>
|
: $this->context->title
|
||||||
<?php endif ?>
|
?>
|
||||||
|
<title><?php echo $title ?></title>
|
||||||
<?php foreach (array_unique($this->context->stylesheets) as $name): ?>
|
<?php foreach (array_unique($this->context->stylesheets) as $name): ?>
|
||||||
<link rel="stylesheet" type="text/css" href="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/css/' . $name) ?>"/>
|
<link rel="stylesheet" type="text/css" href="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/css/' . $name) ?>"/>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php foreach (array_unique($this->context->scripts) as $name): ?>
|
<?php foreach (array_unique($this->context->scripts) as $name): ?>
|
||||||
<script type="text/javascript" src="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/js/' . $name) ?>"></script>
|
<script type="text/javascript" src="<?php echo \Chibi\UrlHelper::absoluteUrl('/media/js/' . $name) ?>"></script>
|
||||||
<?php endforeach ?>
|
<?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>
|
||||||
@ -103,7 +110,7 @@
|
|||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<span><a href="<?php echo SZURU_LINK ?>">szurubooru v<?php echo SZURU_VERSION ?></a></span>
|
<span><a href="<?php echo SZURU_LINK ?>">szurubooru v<?php echo SZURU_VERSION ?></a></span>
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ListLogs)): ?>
|
<?php if (PrivilegesHelper::confirm(Privilege::ListLogs)): ?>
|
||||||
<span><a href="<?php echo \Chibi\UrlHelper::route('log', 'list') ?>">Logs</span>
|
<span><a href="<?php echo \Chibi\UrlHelper::route('log', 'list') ?>">Logs</a></span>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
@ -77,12 +77,12 @@
|
|||||||
|
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ScorePost)): ?>
|
<?php if (PrivilegesHelper::confirm(Privilege::ScorePost)): ?>
|
||||||
[
|
[
|
||||||
<?php $scoreLink = \Chibi\UrlHelper::route('post', 'score', ['id' => $this->context->transport->post->id, 'score' => '{score}']) ?>
|
<?php $scoreLink = function($score) { return \Chibi\UrlHelper::route('post', 'score', ['id' => $this->context->transport->post->id, 'score' => $score]); } ?>
|
||||||
|
|
||||||
<?php if ($this->context->score === 1): ?>
|
<?php if ($this->context->score === 1): ?>
|
||||||
<a class="simple-action selected" href="<?php echo TextHelper::replaceTokens($scoreLink, ['score' => 0]) ?>">
|
<a class="simple-action selected" href="<?php echo $scoreLink(0) ?>">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a class="simple-action" href="<?php echo TextHelper::replaceTokens($scoreLink, ['score' => 1]) ?>">
|
<a class="simple-action" href="<?php echo $scoreLink(1) ?>">
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
vote up
|
vote up
|
||||||
</a>
|
</a>
|
||||||
@ -90,9 +90,9 @@
|
|||||||
,
|
,
|
||||||
|
|
||||||
<?php if ($this->context->score === -1): ?>
|
<?php if ($this->context->score === -1): ?>
|
||||||
<a class="simple-action selected" href="<?php echo TextHelper::replaceTokens($scoreLink, ['score' => 0]) ?>">
|
<a class="simple-action selected" href="<?php echo $scoreLink(0) ?>">
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<a class="simple-action" href="<?php echo TextHelper::replaceTokens($scoreLink, ['score' => -1]) ?>">
|
<a class="simple-action" href="<?php echo $scoreLink(-1) ?>">
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
down
|
down
|
||||||
</a>]
|
</a>]
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
<?php $max = max([0]+array_map(function($x) { return $x['post_count']; }, $this->context->transport->tags)); ?>
|
<?php $max = max([0]+array_map(function($x) { return $x['post_count']; }, $this->context->transport->tags)); ?>
|
||||||
<?php $add = 0.25 ?>
|
<?php $add = 0.25 ?>
|
||||||
<?php $mul = 0.75 / max(1, log(max(1, $max))) ?>
|
<?php $mul = 0.75 / max(1, log(max(1, $max))) ?>
|
||||||
<?php $url = \Chibi\UrlHelper::route('post', 'list', ['query' => '{query}']) ?>
|
<?php $url = \Chibi\UrlHelper::route('post', 'list', ['query' => '_query_']) ?>
|
||||||
<div class="tags">
|
<div class="tags">
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($this->context->transport->tags as $tag): ?>
|
<?php foreach ($this->context->transport->tags as $tag): ?>
|
||||||
<?php $name = $tag['name'] ?>
|
<?php $name = $tag['name'] ?>
|
||||||
<?php $count = $tag['post_count'] ?>
|
<?php $count = $tag['post_count'] ?>
|
||||||
<li class="tag" title="<?php echo $name ?> (<?php echo $count ?>)">
|
<li class="tag" title="<?php echo $name ?> (<?php echo $count ?>)">
|
||||||
<a href="<?php echo TextHelper::replaceTokens($url, ['query' => $name]) ?>" style="opacity: <?php printf('%.02f', $add + $mul * log($count)) ?>">
|
<a href="<?php echo str_replace('_query_', $name, $url) ?>" style="opacity: <?php printf('%.02f', $add + $mul * log($count)) ?>">
|
||||||
<?php echo $name . ' (' . $count . ')' ?>
|
<?php echo $name . ' (' . $count . ')' ?>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<form action="<?php echo \Chibi\UrlHelper::route('user', 'settings', ['name' => $this->context->transport->user->name]) ?>" method="post" class="settings aligned">
|
<form action="<?php echo \Chibi\UrlHelper::route('user', 'settings', ['name' => $this->context->transport->user->name]) ?>" method="post" class="settings aligned">
|
||||||
<div class="safety">
|
<div class="safety">
|
||||||
<label class="left" for="name">Safety:</label>
|
<label class="left">Safety:</label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<?php foreach (PostSafety::getAll() as $safety): ?>
|
<?php foreach (PostSafety::getAll() as $safety): ?>
|
||||||
<?php if (PrivilegesHelper::confirm(Privilege::ListPosts, PostSafety::toString($safety))): ?>
|
<?php if (PrivilegesHelper::confirm(Privilege::ListPosts, PostSafety::toString($safety))): ?>
|
||||||
@ -12,10 +12,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="endless-scrolling">
|
<div class="endless-scrolling">
|
||||||
<label class="left" for="name">Endless scrolling:</label>
|
<label class="left" for="endless-scrolling">Endless scrolling:</label>
|
||||||
<div class="input-wrapper">
|
<div class="input-wrapper">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="endless-scrolling" <?php if ($this->context->transport->user->hasEnabledEndlessScrolling()) echo ' checked="checked"' ?>/>
|
<input type="checkbox" id="endless-scrolling" name="endless-scrolling" <?php if ($this->context->transport->user->hasEnabledEndlessScrolling()) echo ' checked="checked"' ?>/>
|
||||||
Enabled
|
Enabled
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
define('SZURU_VERSION', '0.4.0');
|
define('SZURU_VERSION', '0.4.1');
|
||||||
define('SZURU_LINK', 'http://github.com/rr-/szurubooru');
|
define('SZURU_LINK', 'http://github.com/rr-/szurubooru');
|
||||||
|
|
||||||
define('DS', DIRECTORY_SEPARATOR);
|
define('DS', DIRECTORY_SEPARATOR);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'src/core.php';
|
require_once 'src/core.php';
|
||||||
$config = configFactory();
|
$config = \Chibi\Registry::getConfig();
|
||||||
|
|
||||||
$dbVersion = Model_Property::get('db-version');
|
$dbVersion = Model_Property::get('db-version');
|
||||||
printf('DB version = %d' . PHP_EOL, $dbVersion);
|
printf('DB version = %d' . PHP_EOL, $dbVersion);
|
||||||
|
Reference in New Issue
Block a user