Compare commits

...

1 Commits

Author SHA1 Message Date
zeke 4776b08fec Upgrade dependencies 4 months ago
  1. 5
      composer.json
  2. 55
      composer.lock
  3. 2
      inc/error.php
  4. 44
      inc/lib/twig/extensions/Extension/I18n.php
  5. 137
      inc/lib/twig/extensions/Extension/Tinyboard.php
  6. 133
      inc/lib/twig/extensions/Node/Trans.php
  7. 80
      inc/lib/twig/extensions/TokenParser/Trans.php
  8. 7
      inc/mod/auth.php
  9. 2
      inc/mod/pages.php
  10. 170
      inc/template.php
  11. 2
      install.php
  12. 4
      templates/generic_page.html
  13. 4
      templates/header.html
  14. 4
      templates/index.html
  15. 54
      templates/main.js
  16. 4
      templates/page.html
  17. 4
      templates/post_form.html
  18. 4
      templates/themes/basic/index.html
  19. 4
      templates/themes/calendar/calendar.html
  20. 4
      templates/themes/catalog/catalog.html
  21. 4
      templates/themes/donate/donate.html
  22. 4
      templates/themes/faq/index.html
  23. 4
      templates/themes/irc/irc.html
  24. 4
      templates/themes/radio/radio.html
  25. 4
      templates/themes/rules/rules.html
  26. 4
      templates/themes/staffapplication/staffapplication.html
  27. 4
      templates/themes/stream/stream.html
  28. 4
      templates/thread.html
  29. 4
      templates/thread2_old.html
  30. 3
      tools/rebuild.php
  31. 2
      tools/rebuild2.php

5
composer.json

@ -3,9 +3,10 @@
"description": "leftypol imageboard",
"type": "project",
"require": {
"twig/twig": "^1.44.2",
"twig/twig": "^2.9",
"phpmyadmin/twig-i18n-extension": "^4.0",
"lifo/ip": "^1.0",
"gettext/gettext": "^1.0",
"gettext/gettext": "^5.5",
"mrclay/minify": "^2.1.6"
},
"autoload": {

55
composer.lock

@ -25,12 +25,12 @@
},
"type": "library",
"autoload": {
"psr-0": {
"Gettext": ""
},
"files": [
"Gettext/translator_functions.php"
]
],
"psr-0": {
"Gettext": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -61,16 +61,16 @@
},
{
"name": "lifo/ip",
"version": "v1.1",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/lifo101/ip.git",
"reference": "b6a36dab288d7aea155698808bfc6649799fe413"
"reference": "4c4cf5b554884be93f1d0422eaec8d6426993229"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/lifo101/ip/zipball/b6a36dab288d7aea155698808bfc6649799fe413",
"reference": "b6a36dab288d7aea155698808bfc6649799fe413",
"url": "https://api.github.com/repos/lifo101/ip/zipball/4c4cf5b554884be93f1d0422eaec8d6426993229",
"reference": "4c4cf5b554884be93f1d0422eaec8d6426993229",
"shasum": ""
},
"require": {
@ -102,9 +102,9 @@
],
"support": {
"issues": "https://github.com/lifo101/ip/issues",
"source": "https://github.com/lifo101/ip/tree/master"
"source": "https://github.com/lifo101/ip/tree/v1.1.1"
},
"time": "2020-04-02T11:09:10+00:00"
"time": "2022-07-12T15:45:54+00:00"
},
{
"name": "mrclay/minify",
@ -159,16 +159,16 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.24.0",
"version": "v1.29.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "30885182c981ab175d4d034db0f6f469898070ab"
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab",
"reference": "30885182c981ab175d4d034db0f6f469898070ab",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4",
"reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4",
"shasum": ""
},
"require": {
@ -182,21 +182,18 @@
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -221,7 +218,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0"
},
"funding": [
{
@ -237,20 +234,20 @@
"type": "tidelift"
}
],
"time": "2021-10-20T20:35:02+00:00"
"time": "2024-01-29T20:11:03+00:00"
},
{
"name": "twig/twig",
"version": "v1.44.6",
"version": "v1.44.7",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "ae39480f010ef88adc7938503c9b02d3baf2f3b3"
"reference": "0887422319889e442458e48e2f3d9add1a172ad5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/ae39480f010ef88adc7938503c9b02d3baf2f3b3",
"reference": "ae39480f010ef88adc7938503c9b02d3baf2f3b3",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/0887422319889e442458e48e2f3d9add1a172ad5",
"reference": "0887422319889e442458e48e2f3d9add1a172ad5",
"shasum": ""
},
"require": {
@ -303,7 +300,7 @@
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v1.44.6"
"source": "https://github.com/twigphp/Twig/tree/v1.44.7"
},
"funding": [
{
@ -315,7 +312,7 @@
"type": "tidelift"
}
],
"time": "2021-11-25T13:31:46+00:00"
"time": "2022-09-28T08:38:36+00:00"
}
],
"packages-dev": [],

2
inc/error.php

@ -1,6 +1,6 @@
<?php
function error_handler($errno,$errstr,$errfile, $errline, $errcontext){
function error_handler($errno,$errstr,$errfile, $errline, $errcontext = null){
if(error_reporting() & $errno){
$config['debug']=true;
error($errstr . ' in ' . $errfile . ' at line ' . $errline);

44
inc/lib/twig/extensions/Extension/I18n.php

@ -1,44 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Extensions_Extension_I18n extends Twig_Extension
{
/**
* Returns the token parser instances to add to the existing list.
*
* @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances
*/
public function getTokenParsers()
{
return array(new Twig_Extensions_TokenParser_Trans());
}
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
*/
public function getFilters()
{
return array(
new Twig_SimpleFilter('trans', 'gettext'),
);
}
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName()
{
return 'i18n';
}
}

137
inc/lib/twig/extensions/Extension/Tinyboard.php

@ -1,137 +0,0 @@
<?php
class Twig_Extensions_Extension_Tinyboard extends Twig_Extension
{
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
*/
public function getFilters()
{
return array(
new Twig_SimpleFilter('filesize', 'format_bytes'),
new Twig_SimpleFilter('truncate', 'twig_truncate_filter'),
new Twig_SimpleFilter('truncate_body', 'truncate'),
new Twig_SimpleFilter('truncate_filename', 'twig_filename_truncate_filter'),
new Twig_SimpleFilter('extension', 'twig_extension_filter'),
new Twig_SimpleFilter('sprintf', 'sprintf'),
new Twig_SimpleFilter('capcode', 'capcode'),
new Twig_SimpleFilter('remove_modifiers', 'remove_modifiers'),
new Twig_SimpleFilter('remove_markup', 'remove_markup'),
new Twig_SimpleFilter('newline_to_full_stop', 'newline_to_full_stop'),
new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'),
new Twig_SimpleFilter('date', 'twig_date_filter'),
new Twig_SimpleFilter('poster_id', 'poster_id'),
new Twig_SimpleFilter('remove_whitespace', 'twig_remove_whitespace_filter'),
new Twig_SimpleFilter('count', 'count'),
new Twig_SimpleFilter('ago', 'ago'),
new Twig_SimpleFilter('until', 'until'),
new Twig_SimpleFilter('push', 'twig_push_filter'),
new Twig_SimpleFilter('bidi_cleanup', 'bidi_cleanup'),
new Twig_SimpleFilter('addslashes', 'addslashes'),
);
}
/**
* Returns a list of functions to add to the existing list.
*
* @return array An array of filters
*/
public function getFunctions()
{
return array(
new Twig_SimpleFunction('time', 'time'),
new Twig_SimpleFunction('floor', 'floor'),
new Twig_SimpleFunction('timezone', 'twig_timezone_function'),
new Twig_SimpleFunction('hiddenInputs', 'hiddenInputs'),
new Twig_SimpleFunction('hiddenInputsHash', 'hiddenInputsHash'),
new Twig_SimpleFunction('ratio', 'twig_ratio_function'),
new Twig_SimpleFunction('secure_link_confirm', 'twig_secure_link_confirm'),
new Twig_SimpleFunction('secure_link', 'twig_secure_link'),
new Twig_SimpleFunction('link_for', 'link_for')
);
}
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName()
{
return 'tinyboard';
}
}
function twig_timezone_function() {
return 'Z';
}
function twig_push_filter($array, $value) {
array_push($array, $value);
return $array;
}
function twig_remove_whitespace_filter($data) {
return preg_replace('/[\t\r\n]/', '', $data);
}
function twig_date_filter($date, $format) {
return gmstrftime($format, $date);
}
function twig_hasPermission_filter($mod, $permission, $board = null) {
return hasPermission($permission, $board, $mod);
}
function twig_extension_filter($value, $case_insensitive = true) {
$ext = mb_substr($value, mb_strrpos($value, '.') + 1);
if($case_insensitive)
$ext = mb_strtolower($ext);
return $ext;
}
function twig_sprintf_filter( $value, $var) {
return sprintf($value, $var);
}
function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '…') {
if (mb_strlen($value) > $length) {
if ($preserve) {
if (false !== ($breakpoint = mb_strpos($value, ' ', $length))) {
$length = $breakpoint;
}
}
return mb_substr($value, 0, $length) . $separator;
}
return $value;
}
function twig_filename_truncate_filter($value, $length = 30, $separator = '…') {
if (mb_strlen($value) > $length) {
$value = strrev($value);
$array = array_reverse(explode(".", $value, 2));
$array = array_map("strrev", $array);
$filename = &$array[0];
$extension = isset($array[1]) ? $array[1] : false;
$filename = mb_substr($filename, 0, $length - ($extension ? mb_strlen($extension) + 1 : 0)) . $separator;
return implode(".", $array);
}
return $value;
}
function twig_ratio_function($w, $h) {
return fraction($w, $h, ':');
}
function twig_secure_link_confirm($text, $title, $confirm_message, $href) {
global $config;
return '<a onclick="if (event.which==2) return true;if (confirm(\'' . htmlentities(addslashes($confirm_message)) . '\')) document.location=\'?/' . htmlspecialchars(addslashes($href . '/' . make_secure_link_token($href))) . '\';return false;" title="' . htmlentities($title) . '" href="?/' . $href . '">' . $text . '</a>';
}
function twig_secure_link($href) {
return $href . '/' . make_secure_link_token($href);
}

133
inc/lib/twig/extensions/Node/Trans.php

@ -1,133 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Represents a trans node.
*
* @package twig
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class Twig_Extensions_Node_Trans extends Twig_Node
{
public function __construct(Twig_NodeInterface $body, Twig_NodeInterface $plural = null, Twig_Node_Expression $count = null, $lineno, $tag = null)
{
parent::__construct(array('count' => $count, 'body' => $body, 'plural' => $plural), array(), $lineno, $tag);
}
/**
* Compiles the node to PHP.
*
* @param Twig_Compiler A Twig_Compiler instance
*/
public function compile(Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
list($msg, $vars) = $this->compileString($this->getNode('body'));
if (null !== $this->getNode('plural')) {
list($msg1, $vars1) = $this->compileString($this->getNode('plural'));
$vars = array_merge($vars, $vars1);
}
$function = null === $this->getNode('plural') ? 'gettext' : 'ngettext';
if ($vars) {
$compiler
->write('echo strtr('.$function.'(')
->subcompile($msg)
;
if (null !== $this->getNode('plural')) {
$compiler
->raw(', ')
->subcompile($msg1)
->raw(', abs(')
->subcompile($this->getNode('count'))
->raw(')')
;
}
$compiler->raw('), array(');
foreach ($vars as $var) {
if ('count' === $var->getAttribute('name')) {
$compiler
->string('%count%')
->raw(' => abs(')
->subcompile($this->getNode('count'))
->raw('), ')
;
} else {
$compiler
->string('%'.$var->getAttribute('name').'%')
->raw(' => ')
->subcompile($var)
->raw(', ')
;
}
}
$compiler->raw("));\n");
} else {
$compiler
->write('echo '.$function.'(')
->subcompile($msg)
;
if (null !== $this->getNode('plural')) {
$compiler
->raw(', ')
->subcompile($msg1)
->raw(', abs(')
->subcompile($this->getNode('count'))
->raw(')')
;
}
$compiler->raw(");\n");
}
}
protected function compileString(Twig_NodeInterface $body)
{
if ($body instanceof Twig_Node_Expression_Name || $body instanceof Twig_Node_Expression_Constant || $body instanceof Twig_Node_Expression_TempName) {
return array($body, array());
}
$vars = array();
if (count($body)) {
$msg = '';
foreach ($body as $node) {
if (get_class($node) === 'Twig_Node' && $node->getNode(0) instanceof Twig_Node_SetTemp) {
$node = $node->getNode(1);
}
if ($node instanceof Twig_Node_Print) {
$n = $node->getNode('expr');
while ($n instanceof Twig_Node_Expression_Filter) {
$n = $n->getNode('node');
}
$msg .= sprintf('%%%s%%', $n->getAttribute('name'));
$vars[] = new Twig_Node_Expression_Name($n->getAttribute('name'), $n->getLine());
} else {
$msg .= $node->getAttribute('data');
}
}
} else {
$msg = $body->getAttribute('data');
}
return array(new Twig_Node(array(new Twig_Node_Expression_Constant(trim($msg), $body->getLine()))), $vars);
}
}

80
inc/lib/twig/extensions/TokenParser/Trans.php

@ -1,80 +0,0 @@
<?php
/*
* This file is part of Twig.
*
* (c) 2010 Fabien Potencier
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
class Twig_Extensions_TokenParser_Trans extends Twig_TokenParser
{
/**
* Parses a token and returns a node.
*
* @param Twig_Token $token A Twig_Token instance
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$count = null;
$plural = null;
if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) {
$body = $this->parser->getExpressionParser()->parseExpression();
} else {
$stream->expect(Twig_Token::BLOCK_END_TYPE);
$body = $this->parser->subparse(array($this, 'decideForFork'));
if ('plural' === $stream->next()->getValue()) {
$count = $this->parser->getExpressionParser()->parseExpression();
$stream->expect(Twig_Token::BLOCK_END_TYPE);
$plural = $this->parser->subparse(array($this, 'decideForEnd'), true);
}
}
$stream->expect(Twig_Token::BLOCK_END_TYPE);
$this->checkTransString($body, $lineno);
return new Twig_Extensions_Node_Trans($body, $plural, $count, $lineno, $this->getTag());
}
public function decideForFork(Twig_Token $token)
{
return $token->test(array('plural', 'endtrans'));
}
public function decideForEnd(Twig_Token $token)
{
return $token->test('endtrans');
}
/**
* Gets the tag name associated with this token parser.
*
* @param string The tag name
*/
public function getTag()
{
return 'trans';
}
protected function checkTransString(Twig_NodeInterface $body, $lineno)
{
foreach ($body as $i => $node) {
if (
$node instanceof Twig_Node_Text
||
($node instanceof Twig_Node_Print && $node->getNode('expr') instanceof Twig_Node_Expression_Name)
) {
continue;
}
throw new Twig_Error_Syntax(sprintf('The text to be translated with "trans" can only contain references to simple variables'), $lineno);
}
}
}

7
inc/mod/auth.php

@ -117,13 +117,18 @@ function setCookies() {
if (!$mod)
error('setCookies() was called for a non-moderator!');
$headers = apache_request_headers();
$domain = null;
if(key_exists("Host", $headers))
$domain = $headers['Host'];
setcookie($config['cookies']['mod'],
$mod['username'] . // username
':' .
$mod['hash'][0] . // password
':' .
$mod['hash'][1], // salt
time() + $config['cookies']['expire'], $config['cookies']['jail'] ? $config['cookies']['path'] : '/', null, !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off', $config['cookies']['httponly']);
time() + $config['cookies']['expire'], $config['cookies']['jail'] ? $config['cookies']['path'] : '/', $domain, !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off', $config['cookies']['httponly']);
}
function destroyCookies() {

2
inc/mod/pages.php

@ -2723,7 +2723,7 @@ function mod_rebuild() {
$log[] = 'Clearing template cache';
load_twig();
$twig->clearCacheFiles();
$twig->getCache()->clear();
}
if (isset($_POST['rebuild_themes'])) {

170
inc/template.php

@ -13,16 +13,17 @@ $twig = false;
function load_twig() {
global $twig, $config;
$loader = new Twig_Loader_Filesystem($config['dir']['template']);
$loader = new Twig\Loader\FilesystemLoader($config['dir']['template']);
$loader->setPaths($config['dir']['template']);
$twig = new Twig_Environment($loader, array(
'autoescape' => false,
'cache' => is_writable('templates') || (is_dir('templates/cache') && is_writable('templates/cache')) ?
"{$config['dir']['template']}/cache" : false,
new Twig_Cache_TinyboardFilesystem("{$config['dir']['template']}/cache") : false,
'debug' => $config['debug']
));
$twig->addExtension(new Twig_Extensions_Extension_Tinyboard());
$twig->addExtension(new Twig_Extensions_Extension_I18n());
$twig->addExtension(new PhpMyAdmin\Twig\Extensions\I18nExtension());
}
function Element($templateFile, array $options) {
@ -70,3 +71,166 @@ function Element($templateFile, array $options) {
}
}
class Twig_Extensions_Extension_Tinyboard extends Twig_Extension
{
/**
* Returns a list of filters to add to the existing list.
*
* @return array An array of filters
*/
public function getFilters()
{
return array(
new Twig_SimpleFilter('filesize', 'format_bytes'),
new Twig_SimpleFilter('truncate', 'twig_truncate_filter'),
new Twig_SimpleFilter('truncate_body', 'truncate'),
new Twig_SimpleFilter('truncate_filename', 'twig_filename_truncate_filter'),
new Twig_SimpleFilter('extension', 'twig_extension_filter'),
new Twig_SimpleFilter('sprintf', 'sprintf'),
new Twig_SimpleFilter('capcode', 'capcode'),
new Twig_SimpleFilter('remove_modifiers', 'remove_modifiers'),
new Twig_SimpleFilter('remove_markup', 'remove_markup'),
new Twig_SimpleFilter('newline_to_full_stop', 'newline_to_full_stop'),
new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'),
new Twig_SimpleFilter('date', 'twig_date_filter'),
new Twig_SimpleFilter('poster_id', 'poster_id'),
new Twig_SimpleFilter('remove_whitespace', 'twig_remove_whitespace_filter'),
new Twig_SimpleFilter('count', 'count'),
new Twig_SimpleFilter('ago', 'ago'),
new Twig_SimpleFilter('until', 'until'),
new Twig_SimpleFilter('push', 'twig_push_filter'),
new Twig_SimpleFilter('bidi_cleanup', 'bidi_cleanup'),
new Twig_SimpleFilter('addslashes', 'addslashes'),
);
}
/**
* Returns a list of functions to add to the existing list.
*
* @return array An array of filters
*/
public function getFunctions()
{
return array(
new Twig_SimpleFunction('time', 'time'),
new Twig_SimpleFunction('floor', 'floor'),
new Twig_SimpleFunction('timezone', 'twig_timezone_function'),
new Twig_SimpleFunction('hiddenInputs', 'hiddenInputs'),
new Twig_SimpleFunction('hiddenInputsHash', 'hiddenInputsHash'),
new Twig_SimpleFunction('ratio', 'twig_ratio_function'),
new Twig_SimpleFunction('secure_link_confirm', 'twig_secure_link_confirm'),
new Twig_SimpleFunction('secure_link', 'twig_secure_link'),
new Twig_SimpleFunction('link_for', 'link_for')
);
}
/**
* Returns the name of the extension.
*
* @return string The extension name
*/
public function getName()
{
return 'tinyboard';
}
}
function twig_timezone_function() {
return 'Z';
}
function twig_push_filter($array, $value) {
array_push($array, $value);
return $array;
}
function twig_remove_whitespace_filter($data) {
return preg_replace('/[\t\r\n]/', '', $data);
}
function twig_date_filter($date, $format) {
return gmstrftime($format, $date);
}
function twig_hasPermission_filter($mod, $permission, $board = null) {
return hasPermission($permission, $board, $mod);
}
function twig_extension_filter($value, $case_insensitive = true) {
$ext = mb_substr($value, mb_strrpos($value, '.') + 1);
if($case_insensitive)
$ext = mb_strtolower($ext);
return $ext;
}
function twig_sprintf_filter( $value, $var) {
return sprintf($value, $var);
}
function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '…') {
if (mb_strlen($value) > $length) {
if ($preserve) {
if (false !== ($breakpoint = mb_strpos($value, ' ', $length))) {
$length = $breakpoint;
}
}
return mb_substr($value, 0, $length) . $separator;
}
return $value;
}
function twig_filename_truncate_filter($value, $length = 30, $separator = '…') {
if (mb_strlen($value) > $length) {
$value = strrev($value);
$array = array_reverse(explode(".", $value, 2));
$array = array_map("strrev", $array);
$filename = &$array[0];
$extension = isset($array[1]) ? $array[1] : false;
$filename = mb_substr($filename, 0, $length - ($extension ? mb_strlen($extension) + 1 : 0)) . $separator;
return implode(".", $array);
}
return $value;
}
function twig_ratio_function($w, $h) {
return fraction($w, $h, ':');
}
function twig_secure_link_confirm($text, $title, $confirm_message, $href) {
global $config;
return '<a onclick="if (event.which==2) return true;if (confirm(\'' . htmlentities(addslashes($confirm_message)) . '\')) document.location=\'?/' . htmlspecialchars(addslashes($href . '/' . make_secure_link_token($href))) . '\';return false;" title="' . htmlentities($title) . '" href="?/' . $href . '">' . $text . '</a>';
}
function twig_secure_link($href) {
return $href . '/' . make_secure_link_token($href);
}
class Twig_Cache_TinyboardFilesystem extends Twig\Cache\FilesystemCache
{
private $directory;
private $options;
/**
* {@inheritdoc}
*/
public function __construct($directory, $options = 0)
{
parent::__construct($directory, $options);
$this->directory = $directory;
}
/**
* This function was removed in Twig 2.x due to developer views on the Twig library. Who says we can't keep it for ourselves though?
*/
public function clear()
{
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($this->directory), RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
if ($file->isFile()) {
@unlink($file->getPathname());
}
}
}
}

2
install.php

@ -542,7 +542,7 @@ if (file_exists($config['has_installed'])) {
}
case '4.4.98-pre':
if (!$twig) load_twig();
$twig->clearCacheFiles();
$twig->getCache()->clear();
case '4.4.98':
case '4.5.0':
case '4.5.1':

4
templates/generic_page.html

@ -49,8 +49,8 @@
{% for footer in config.footer %}<p class="unimportant" style="text-align:center;">{{ footer }}</p>{% endfor %}
</footer>
</div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>

4
templates/header.html

@ -30,7 +30,7 @@
{% endif %}
{% if config.recaptcha %}
<script src="//www.google.com/recaptcha/api.js"></script>
<style type="text/css">{% raw %}
<style type="text/css">{% verbatim %}
#recaptcha_area {
float: none !important;
padding: 0 !important;
@ -58,4 +58,4 @@
.recaptchatable, #recaptcha_area tr, #recaptcha_area td, #recaptcha_area th {
padding: 0 !important;
}
{% endraw %}</style>{% endif %}
{% endverbatim %}</style>{% endif %}

4
templates/index.html

@ -132,9 +132,9 @@
</div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>

54
templates/main.js

@ -1,4 +1,4 @@
{% raw %}
{% verbatim %}
/* gettext-compatible _ function, example of usage:
*
@ -109,16 +109,16 @@ function alert(a, do_confirm, confirm_ok_action, confirm_cancel_action) {
var saved = {};
var selectedstyle = '{% endraw %}{{ config.default_stylesheet.0|addslashes }}{% raw %}';
var selectedstyle = '{% endverbatim %}{{ config.default_stylesheet.0|addslashes }}{% verbatim %}';
var styles = {
{% endraw %}
{% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
{% endraw %}{% endfor %}{% raw %}
{% endverbatim %}
{% for stylesheet in stylesheets %}{% verbatim %}'{% endverbatim %}{{ stylesheet.name|addslashes }}{% verbatim %}' : '{% endverbatim %}{{ stylesheet.uri|addslashes }}{% verbatim %}',
{% endverbatim %}{% endfor %}{% verbatim %}
};
var codestyles = {
{% endraw %}
{% for stylesheet in code_stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}',
{% endraw %}{% endfor %}{% raw %}
{% endverbatim %}
{% for stylesheet in code_stylesheets %}{% verbatim %}'{% endverbatim %}{{ stylesheet.name|addslashes }}{% verbatim %}' : '{% endverbatim %}{{ stylesheet.uri|addslashes }}{% verbatim %}',
{% endverbatim %}{% endfor %}{% verbatim %}
};
if (typeof board_name === 'undefined') {
@ -126,16 +126,16 @@ if (typeof board_name === 'undefined') {
}
function changeStyle(styleName, link) {
{% endraw %}
{% if config.stylesheets_board %}{% raw %}
{% endverbatim %}
{% if config.stylesheets_board %}{% verbatim %}
if (board_name) {
stylesheet_choices[board_name] = styleName;
localStorage.board_stylesheets = JSON.stringify(stylesheet_choices);
}
{% endraw %}{% else %}
{% endverbatim %}{% else %}
localStorage.stylesheet = styleName;
{% endif %}
{% raw %}
{% verbatim %}
// Main stylesheet
if (!document.getElementById('stylesheet')) {
@ -178,9 +178,9 @@ function changeStyle(styleName, link) {
}
{% endraw %}
{% endverbatim %}
{% if config.stylesheets_board %}
{% raw %}
{% verbatim %}
if (!localStorage.board_stylesheets) {
localStorage.board_stylesheets = '{}';
@ -195,9 +195,9 @@ function changeStyle(styleName, link) {
}
}
}
{% endraw%}
{% endverbatim%}
{% else %}
{% raw %}
{% verbatim %}
if (localStorage.stylesheet) {
for (var styleName in styles) {
if (styleName == localStorage.stylesheet) {
@ -206,9 +206,9 @@ function changeStyle(styleName, link) {
}
}
}
{% endraw %}
{% endverbatim %}
{% endif %}
{% raw %}
{% verbatim %}
function init_stylechooser() {
var newElement = document.createElement('div');
@ -261,7 +261,7 @@ function highlightReply(id) {
function generatePassword() {
var pass = '';
var chars = '{% endraw %}{{ config.genpassword_chars }}{% raw %}';
var chars = '{% endverbatim %}{{ config.genpassword_chars }}{% verbatim %}';
for (var i = 0; i < 8; i++) {
var rnd = Math.floor(Math.random() * chars.length);
pass += chars.substring(rnd, rnd + 1);
@ -355,15 +355,15 @@ function rememberStuff() {
if (sessionStorage.body) {
var saved = JSON.parse(sessionStorage.body);
if (get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')) {
if (get_cookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}')) {
// Remove successful posts
var successful = JSON.parse(get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}'));
var successful = JSON.parse(get_cookie('{% endverbatim %}{{ config.cookies.js }}{% verbatim %}'));
for (var url in successful) {
saved[url] = null;
}
sessionStorage.body = JSON.stringify(saved);
document.cookie = '{% endraw %}{{ config.cookies.js }}{% raw %}={};expires=0;path=/;';
document.cookie = '{% endverbatim %}{{ config.cookies.js }}{% verbatim %}={};expires=0;path=/;';
}
if (saved[document.location]) {
document.forms.post.body.value = saved[document.location];
@ -391,13 +391,13 @@ var script_settings = function(script_name) {
function init() {
init_stylechooser();
{% endraw %}
{% endverbatim %}
{% if config.allow_delete %}
if (document.forms.postcontrols) {
document.forms.postcontrols.password.value = localStorage.password;
}
{% endif %}
{% raw %}
{% verbatim %}
if (window.location.hash.indexOf('q') != 1 && window.location.hash.substring(1))
highlightReply(window.location.hash.substring(1));
@ -418,16 +418,16 @@ function ready() {
}
}
{% endraw %}
{% endverbatim %}
var post_date = "{{ config.post_date }}";
var max_images = {{ config.max_images }};
onready(init);
{% if config.google_analytics %}{% raw %}
{% if config.google_analytics %}{% verbatim %}
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %}
var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endverbatim %}{{ config.google_analytics }}{% verbatim %}']);{% endverbatim %}{% if config.google_analytics_domain %}{% verbatim %}_gaq.push(['_setDomainName', '{% endverbatim %}{{ config.google_analytics_domain }}{% verbatim %}']){% endverbatim %}{% endif %}{% if not config.google_analytics_domain %}{% verbatim %}_gaq.push(['_setDomainName', 'none']){% endverbatim %}{% endif %}{% verbatim %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endverbatim %}{% endif %}
{% if config.statcounter_project and config.statcounter_security %}
var sc = document.createElement('script');

4
templates/page.html

@ -35,8 +35,8 @@
</footer>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>

4
templates/post_form.html

@ -220,6 +220,6 @@
{% if 'js/upload-selection.js' in config.additional_javascript %}
<script type="text/javascript">if (typeof init_upload_selection !== 'undefined') init_upload_selection();</script>
{% endif %}
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
rememberStuff();
{% endraw %}</script>
{% endverbatim %}</script>

4
templates/themes/basic/index.html

@ -49,9 +49,9 @@
<br><a href="https://engine.vichan.net/">vichan</a> Copyright &copy; 2012-2016 vichan-devel</p>
</footer>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>
{% endfilter %}

4
templates/themes/calendar/calendar.html

@ -185,8 +185,8 @@
});
</script>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>

4
templates/themes/catalog/catalog.html

@ -107,9 +107,9 @@
</footer>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>
{% endfilter %}

4
templates/themes/donate/donate.html

@ -52,9 +52,9 @@
</div>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>

4
templates/themes/faq/index.html

@ -139,9 +139,9 @@
<br>vichan Copyright &copy; 2012-2016 vichan-devel</p>
</footer>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>
{% endfilter %}

4
templates/themes/irc/irc.html

@ -27,9 +27,9 @@
<iframe src="https://kiwiirc.com/nextclient/#irc://{{ settings.server }}:+{{ settings.port }}/#{{ settings.channel }}" width="800px" height="100%" scrolling="no"></iframe>
</div>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>
{% endfilter %}

4
templates/themes/radio/radio.html

@ -127,8 +127,8 @@ $(document).ready(function(){
<p style="text-align:center;"> To upload a voice-over / bump to radio click <a href="{{ settings.httpprefix ~ 'bump.html'}}" >here </a> </p>
</div>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>

4
templates/themes/rules/rules.html

@ -26,9 +26,9 @@
{% include 'rules.html' %}
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>
{% endfilter %}

4
templates/themes/staffapplication/staffapplication.html

@ -72,9 +72,9 @@
<br><a href="https://github.com/lainchan/lainchan">lainchan</a> Copyright &copy; 2014-2017 lainchan Administration</p>
</footer>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>
{% endfilter %}

4
templates/themes/stream/stream.html

@ -174,8 +174,8 @@ function change_format(e) {
<br><a href="https://github.com/lainchan/lainchan">lainchan</a> Copyright &copy; 2014-2017 lainchan Administration</p>
</footer>
<div class="pages"></div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
</body>
</html>

4
templates/thread.html

@ -113,9 +113,9 @@
</div>
<div class=pages></div>
</div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
<a href="#" id="bottom"></a>
</body>
</html>

4
templates/thread2_old.html

@ -111,9 +111,9 @@
</div>
<div class=pages></div>
</div>
<script type="text/javascript">{% raw %}
<script type="text/javascript">{% verbatim %}
ready();
{% endraw %}</script>
{% endverbatim %}</script>
<a href="#" id="bottom"></a>
</body>
</html>

3
tools/rebuild.php

@ -42,7 +42,8 @@ if(!$options['quiet'])
echo "Clearing template cache...\n";
load_twig();
$twig->clearCacheFiles();
die($twig->getCache());
$twig->getCache()->clear();
if(!$options['quiet'])
echo "Regenerating theme files...\n";

2
tools/rebuild2.php

@ -44,7 +44,7 @@ echo "== Tinyboard + vichan {$config['version']} ==\n";
if ($options['cache']) {
echo "Clearing template cache...\n";
load_twig();
$twig->clearCacheFiles();
$twig->getCache()->clear();
}
if($options['themes']) {

Loading…
Cancel
Save