mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-12-18 02:16:03 +01:00
large cleanup
This commit is contained in:
parent
88092e4f9e
commit
c9423a2c34
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
|
// You cannot request this file directly.
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
class Cache {
|
class Cache {
|
||||||
private static $cache;
|
private static $cache;
|
||||||
public static function init() {
|
public static function init() {
|
||||||
|
101
inc/config.php
101
inc/config.php
@ -19,6 +19,8 @@
|
|||||||
*
|
*
|
||||||
* More information: http://tinyboard.org/docs/?p=Config
|
* More information: http://tinyboard.org/docs/?p=Config
|
||||||
*
|
*
|
||||||
|
* Tinyboard documentation: http://tinyboard.org/docs/
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -100,8 +102,8 @@
|
|||||||
$config['cache']['prefix'] = '';
|
$config['cache']['prefix'] = '';
|
||||||
|
|
||||||
// Memcached servers to use - http://www.php.net/manual/en/memcached.addservers.php
|
// Memcached servers to use - http://www.php.net/manual/en/memcached.addservers.php
|
||||||
$config['cache']['memcached'] = Array(
|
$config['cache']['memcached'] = array(
|
||||||
Array('localhost', 11211)
|
array('localhost', 11211)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -144,13 +146,13 @@
|
|||||||
// DNS blacklists (DNSBL) http://tinyboard.org/docs/?p=Config/DNSBL
|
// DNS blacklists (DNSBL) http://tinyboard.org/docs/?p=Config/DNSBL
|
||||||
|
|
||||||
// http://www.sectoor.de/tor.php
|
// http://www.sectoor.de/tor.php
|
||||||
$config['dnsbl'][] = Array('tor.dnsbl.sectoor.de', 1); // Tor exit servers
|
$config['dnsbl'][] = array('tor.dnsbl.sectoor.de', 1); // Tor exit servers
|
||||||
|
|
||||||
// http://www.sorbs.net/using.shtml
|
// http://www.sorbs.net/using.shtml
|
||||||
// $config['dnsbl'][] = Array('dnsbl.sorbs.net', Array(2, 3, 4, 5, 6, 7, 8, 9));
|
// $config['dnsbl'][] = array('dnsbl.sorbs.net', array(2, 3, 4, 5, 6, 7, 8, 9));
|
||||||
|
|
||||||
// http://www.projecthoneypot.org/httpbl.php
|
// http://www.projecthoneypot.org/httpbl.php
|
||||||
// $config['dnsbl'][] = Array('<your access key>.%.dnsbl.httpbl.org', function($ip) {
|
// $config['dnsbl'][] = array('<your access key>.%.dnsbl.httpbl.org', function($ip) {
|
||||||
// $octets = explode('.', $ip);
|
// $octets = explode('.', $ip);
|
||||||
//
|
//
|
||||||
// // days since last activity
|
// // days since last activity
|
||||||
@ -172,7 +174,7 @@
|
|||||||
$config['spam']['hidden_inputs_min'] = 4;
|
$config['spam']['hidden_inputs_min'] = 4;
|
||||||
$config['spam']['hidden_inputs_max'] = 12;
|
$config['spam']['hidden_inputs_max'] = 12;
|
||||||
// These are fields used to confuse the bots. Make sure they aren't actually used by Tinyboard, or it won't work.
|
// These are fields used to confuse the bots. Make sure they aren't actually used by Tinyboard, or it won't work.
|
||||||
$config['spam']['hidden_input_names'] = Array(
|
$config['spam']['hidden_input_names'] = array(
|
||||||
'user',
|
'user',
|
||||||
'username',
|
'username',
|
||||||
'login',
|
'login',
|
||||||
@ -185,7 +187,7 @@
|
|||||||
'message'
|
'message'
|
||||||
);
|
);
|
||||||
// Always update this when adding new valid fields to the post form, or EVERYTHING WILL BE DETECTED AS SPAM!
|
// Always update this when adding new valid fields to the post form, or EVERYTHING WILL BE DETECTED AS SPAM!
|
||||||
$config['spam']['valid_inputs'] = Array(
|
$config['spam']['valid_inputs'] = array(
|
||||||
'hash',
|
'hash',
|
||||||
'board',
|
'board',
|
||||||
'thread',
|
'thread',
|
||||||
@ -208,10 +210,10 @@
|
|||||||
|
|
||||||
// Custom flood filters. Detect flood attacks and reject new posts if there's a positive match.
|
// Custom flood filters. Detect flood attacks and reject new posts if there's a positive match.
|
||||||
// See http://tinyboard.org/wiki/index.php?title=Flood_filters for more information.
|
// See http://tinyboard.org/wiki/index.php?title=Flood_filters for more information.
|
||||||
//$config['flood_filters'][] = Array(
|
//$config['flood_filters'][] = array(
|
||||||
// 'condition' => Array(
|
// 'condition' => array(
|
||||||
// // 100 posts in the past 5 minutes (~20 p/m)
|
// // 100 posts in the past 5 minutes (~20 p/m)
|
||||||
// 'posts_in_past_x_minutes' => Array(100, 5)
|
// 'posts_in_past_x_minutes' => array(100, 5)
|
||||||
// ),
|
// ),
|
||||||
// // Don't allow the user to post
|
// // Don't allow the user to post
|
||||||
// 'action' => 'reject',
|
// 'action' => 'reject',
|
||||||
@ -220,10 +222,10 @@
|
|||||||
//);
|
//);
|
||||||
|
|
||||||
// Another filter
|
// Another filter
|
||||||
//$config['flood_filters'][] = Array(
|
//$config['flood_filters'][] = array(
|
||||||
// 'condition' => Array(
|
// 'condition' => array(
|
||||||
// // 10 new empty threads in the past 2 minutes
|
// // 10 new empty threads in the past 2 minutes
|
||||||
// 'threads_with_no_replies_in_past_x_minutes' => Array(10, 2),
|
// 'threads_with_no_replies_in_past_x_minutes' => array(10, 2),
|
||||||
// // Allow replies, but not new threads (ie. reject topics only).
|
// // Allow replies, but not new threads (ie. reject topics only).
|
||||||
// 'OP' => true
|
// 'OP' => true
|
||||||
// ),
|
// ),
|
||||||
@ -300,10 +302,10 @@
|
|||||||
|
|
||||||
// Wordfilters are used to automatically replace certain words/phrases with something else.
|
// Wordfilters are used to automatically replace certain words/phrases with something else.
|
||||||
// For a normal string replacement:
|
// For a normal string replacement:
|
||||||
// $config['wordfilters'][] = Array('cat', 'dog');
|
// $config['wordfilters'][] = array('cat', 'dog');
|
||||||
|
|
||||||
// Advanced raplcement (regular expressions):
|
// Advanced raplcement (regular expressions):
|
||||||
// $config['wordfilters'][] = Array('/cat/', 'dog', true); // 'true' means it's a regular expression
|
// $config['wordfilters'][] = array('/cat/', 'dog', true); // 'true' means it's a regular expression
|
||||||
|
|
||||||
// Always act as if they had typed "noko" in the email field no mattter what
|
// Always act as if they had typed "noko" in the email field no mattter what
|
||||||
$config['always_noko'] = false;
|
$config['always_noko'] = false;
|
||||||
@ -333,13 +335,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// "Wiki" markup syntax ($config['wiki_markup'] in pervious versions):
|
// "Wiki" markup syntax ($config['wiki_markup'] in pervious versions):
|
||||||
$config['markup'][] = Array("/'''(.+?)'''/", "<strong>\$1</strong>");
|
$config['markup'][] = array("/'''(.+?)'''/", "<strong>\$1</strong>");
|
||||||
$config['markup'][] = Array("/''(.+?)''/", "<em>\$1</em>");
|
$config['markup'][] = array("/''(.+?)''/", "<em>\$1</em>");
|
||||||
$config['markup'][] = Array("/\*\*(.+?)\*\*/", "<span class=\"spoiler\">\$1</span>");
|
$config['markup'][] = array("/\*\*(.+?)\*\*/", "<span class=\"spoiler\">\$1</span>");
|
||||||
$config['markup'][] = Array("/^\s*==(.+?)==\s*$/m", "<span class=\"heading\">\$1</span>");
|
$config['markup'][] = array("/^\s*==(.+?)==\s*$/m", "<span class=\"heading\">\$1</span>");
|
||||||
|
|
||||||
// Highlight PHP code wrapped in <code> tags (PHP 5.3.0+)
|
// Highlight PHP code wrapped in <code> tags (PHP 5.3.0+)
|
||||||
// $config['markup'][] = Array(
|
// $config['markup'][] = array(
|
||||||
// '/^<code>(.+)<\/code>/ms',
|
// '/^<code>(.+)<\/code>/ms',
|
||||||
// function($matches) {
|
// function($matches) {
|
||||||
// return highlight_string(html_entity_decode($matches[1]), true);
|
// return highlight_string(html_entity_decode($matches[1]), true);
|
||||||
@ -507,29 +509,29 @@
|
|||||||
// $config['uri_stylesheets'] = 'http://static.example.org/stylesheets/';
|
// $config['uri_stylesheets'] = 'http://static.example.org/stylesheets/';
|
||||||
|
|
||||||
// The default stylesheet to use
|
// The default stylesheet to use
|
||||||
$config['default_stylesheet'] = Array('Yotsuba B', $config['stylesheets']['Yotsuba B']);
|
$config['default_stylesheet'] = array('Yotsuba B', $config['stylesheets']['Yotsuba B']);
|
||||||
|
|
||||||
// Boardlinks
|
// Boardlinks
|
||||||
// You can group, order and place the boardlist at the top of every page, using the following template.
|
// You can group, order and place the boardlist at the top of every page, using the following template.
|
||||||
//$config['boards'] = Array(
|
//$config['boards'] = array(
|
||||||
// Array('a', 'b'),
|
// array('a', 'b'),
|
||||||
// Array('c', 'd', 'e', 'f', 'g'),
|
// array('c', 'd', 'e', 'f', 'g'),
|
||||||
// Array('h', 'i', 'j'),
|
// array('h', 'i', 'j'),
|
||||||
// Array('k', Array('l', 'm')),
|
// array('k', array('l', 'm')),
|
||||||
// Array('status' => 'http://status.example.org/')
|
// array('status' => 'http://status.example.org/')
|
||||||
//);
|
//);
|
||||||
|
|
||||||
// Categories
|
// Categories
|
||||||
// Required for the Categories theme.
|
// Required for the Categories theme.
|
||||||
//$config['categories'] = Array(
|
//$config['categories'] = array(
|
||||||
// 'Group Name' => Array('a', 'b', 'c'),
|
// 'Group Name' => array('a', 'b', 'c'),
|
||||||
// 'Another Group' => Array('d')
|
// 'Another Group' => array('d')
|
||||||
//);
|
//);
|
||||||
|
|
||||||
// Custom_categories
|
// Custom_categories
|
||||||
// Optional for the Categories theme. Array of name => (title, url) groups for categories with non-board links.
|
// Optional for the Categories theme. array of name => (title, url) groups for categories with non-board links.
|
||||||
//$config['custom_categories'] = Array(
|
//$config['custom_categories'] = array(
|
||||||
// 'Links' => Array(
|
// 'Links' => array(
|
||||||
// 'Tinyboard' => 'http://tinyboard.org',
|
// 'Tinyboard' => 'http://tinyboard.org',
|
||||||
// 'Donate' => 'donate.html'
|
// 'Donate' => 'donate.html'
|
||||||
// )
|
// )
|
||||||
@ -576,24 +578,24 @@
|
|||||||
|
|
||||||
// Custom embedding (YouTube, vimeo, etc.)
|
// Custom embedding (YouTube, vimeo, etc.)
|
||||||
// It's very important that you match the full string (with ^ and $) or things will not work correctly.
|
// It's very important that you match the full string (with ^ and $) or things will not work correctly.
|
||||||
$config['embedding'] = Array(
|
$config['embedding'] = array(
|
||||||
Array(
|
array(
|
||||||
'/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
|
'/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i',
|
||||||
'<object style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%"><param name="movie" value="http://www.youtube.com/v/$2?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$2?fs=1&hl=en_US" type="application/x-shockwave-flash" width="%%tb_width%%" height="%%tb_height%%" allowscriptaccess="always" allowfullscreen="true"></embed></object>'
|
'<object style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%"><param name="movie" value="http://www.youtube.com/v/$2?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/$2?fs=1&hl=en_US" type="application/x-shockwave-flash" width="%%tb_width%%" height="%%tb_height%%" allowscriptaccess="always" allowfullscreen="true"></embed></object>'
|
||||||
),
|
),
|
||||||
Array(
|
array(
|
||||||
'/^https?:\/\/(\w+\.)?vimeo\.com\/(\d{2,10})(\?.+)?$/i',
|
'/^https?:\/\/(\w+\.)?vimeo\.com\/(\d{2,10})(\?.+)?$/i',
|
||||||
'<object style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="%%tb_width%%" height="%%tb_height%%"></embed></object>'
|
'<object style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=$2&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00adef&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="%%tb_width%%" height="%%tb_height%%"></embed></object>'
|
||||||
),
|
),
|
||||||
Array(
|
array(
|
||||||
'/^https?:\/\/(\w+\.)?dailymotion\.com\/video\/([a-zA-Z0-9]{2,10})(_.+)?$/i',
|
'/^https?:\/\/(\w+\.)?dailymotion\.com\/video\/([a-zA-Z0-9]{2,10})(_.+)?$/i',
|
||||||
'<object style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%"><param name="movie" value="http://www.dailymotion.com/swf/video/$2"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/$2" width="%%tb_width%%" height="%%tb_height%%" wmode="transparent" allowfullscreen="true" allowscriptaccess="always"></embed></object>'
|
'<object style="float: left;margin: 10px 20px;" width="%%tb_width%%" height="%%tb_height%%"><param name="movie" value="http://www.dailymotion.com/swf/video/$2"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/$2" width="%%tb_width%%" height="%%tb_height%%" wmode="transparent" allowfullscreen="true" allowscriptaccess="always"></embed></object>'
|
||||||
),
|
),
|
||||||
Array(
|
array(
|
||||||
'/^https?:\/\/(\w+\.)?metacafe\.com\/watch\/(\d+)\/([a-zA-Z0-9_\-.]+)\/(\?.+)?$/i',
|
'/^https?:\/\/(\w+\.)?metacafe\.com\/watch\/(\d+)\/([a-zA-Z0-9_\-.]+)\/(\?.+)?$/i',
|
||||||
'<div style="float:left;margin:10px 20px;width:%%tb_width%%px;height:%%tb_height%%px"><embed flashVars="playerVars=showStats=no|autoPlay=no" src="http://www.metacafe.com/fplayer/$2/$3.swf" width="%%tb_width%%" height="%%tb_height%%" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_$2" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></div>'
|
'<div style="float:left;margin:10px 20px;width:%%tb_width%%px;height:%%tb_height%%px"><embed flashVars="playerVars=showStats=no|autoPlay=no" src="http://www.metacafe.com/fplayer/$2/$3.swf" width="%%tb_width%%" height="%%tb_height%%" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_$2" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></div>'
|
||||||
),
|
),
|
||||||
Array(
|
array(
|
||||||
'/^https?:\/\/video\.google\.com\/videoplay\?docid=(\d+)([&#](.+)?)?$/i',
|
'/^https?:\/\/video\.google\.com\/videoplay\?docid=(\d+)([&#](.+)?)?$/i',
|
||||||
'<embed src="http://video.google.com/googleplayer.swf?docid=$1&hl=en&fs=true" style="width:%%tb_width%%px;height:%%tb_height%%px;float:left;margin:10px 20px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>'
|
'<embed src="http://video.google.com/googleplayer.swf?docid=$1&hl=en&fs=true" style="width:%%tb_width%%px;height:%%tb_height%%px;float:left;margin:10px 20px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"></embed>'
|
||||||
)
|
)
|
||||||
@ -767,14 +769,14 @@
|
|||||||
//$config['custom_capcode']['Custom'] ='<a class="capcode" style="color:lightgreen;font-style:italic;font-weight:bold"> ## %s</a>';
|
//$config['custom_capcode']['Custom'] ='<a class="capcode" style="color:lightgreen;font-style:italic;font-weight:bold"> ## %s</a>';
|
||||||
|
|
||||||
// "## Mod" makes everything purple, including the name and tripcode
|
// "## Mod" makes everything purple, including the name and tripcode
|
||||||
//$config['custom_capcode']['Mod'] = Array(
|
//$config['custom_capcode']['Mod'] = array(
|
||||||
// '<a class="capcode" style="color:purple"> ## %s</a>',
|
// '<a class="capcode" style="color:purple"> ## %s</a>',
|
||||||
// 'color:purple', // Change name style; optional
|
// 'color:purple', // Change name style; optional
|
||||||
// 'color:purple' // Change tripcode style; optional
|
// 'color:purple' // Change tripcode style; optional
|
||||||
//);
|
//);
|
||||||
|
|
||||||
// "## Admin" makes everything red and bold, including the name and tripcode
|
// "## Admin" makes everything red and bold, including the name and tripcode
|
||||||
//$config['custom_capcode']['Admin'] = Array(
|
//$config['custom_capcode']['Admin'] = array(
|
||||||
// '<a class="capcode" style="color:red;font-weight:bold"> ## %s</a>',
|
// '<a class="capcode" style="color:red;font-weight:bold"> ## %s</a>',
|
||||||
// 'color:red;font-weight:bold', // Change name style; optional
|
// 'color:red;font-weight:bold', // Change name style; optional
|
||||||
// 'color:red;font-weight:bold' // Change tripcode style; optional
|
// 'color:red;font-weight:bold' // Change tripcode style; optional
|
||||||
@ -996,18 +998,18 @@
|
|||||||
|
|
||||||
// If you use Varnish, Squid, or any similar caching reverse-proxy in front of Tinyboard,
|
// If you use Varnish, Squid, or any similar caching reverse-proxy in front of Tinyboard,
|
||||||
// you can configure Tinyboard to PURGE files when they're written to
|
// you can configure Tinyboard to PURGE files when they're written to
|
||||||
//$config['purge'] = Array(
|
//$config['purge'] = array(
|
||||||
// Array('127.0.0.1', 80)
|
// array('127.0.0.1', 80)
|
||||||
// Array('127.0.0.1', 80, 'example.org')
|
// array('127.0.0.1', 80, 'example.org')
|
||||||
//);
|
//);
|
||||||
// Connection timeout, in seconds
|
// Connection timeout, in seconds
|
||||||
$config['purge_timeout'] = 3;
|
$config['purge_timeout'] = 3;
|
||||||
|
|
||||||
// Remote servers
|
// Remote servers
|
||||||
// http://tinyboard.org/wiki/index.php?title=Multiple_Servers
|
// http://tinyboard.org/wiki/index.php?title=Multiple_Servers
|
||||||
//$config['remote']['static'] = Array(
|
//$config['remote']['static'] = array(
|
||||||
// 'host' => 'static.example.org',
|
// 'host' => 'static.example.org',
|
||||||
// 'auth' => Array(
|
// 'auth' => array(
|
||||||
// 'method' => 'plain',
|
// 'method' => 'plain',
|
||||||
// 'username' => 'username',
|
// 'username' => 'username',
|
||||||
// 'password' => 'password!123'
|
// 'password' => 'password!123'
|
||||||
@ -1020,10 +1022,3 @@
|
|||||||
// INSANE regular expression for IPv6 addresses
|
// INSANE regular expression for IPv6 addresses
|
||||||
$config['ipv6_regex'] = '((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?';
|
$config['ipv6_regex'] = '((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?';
|
||||||
|
|
||||||
|
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
// You cannot request this file directly.
|
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
// You cannot request this file directly.
|
// You cannot request this file directly.
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -21,7 +25,7 @@
|
|||||||
$start = microtime(true);
|
$start = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = call_user_func_array(Array($this->query, $function), $args);
|
$return = call_user_func_array(array($this->query, $function), $args);
|
||||||
|
|
||||||
if($config['debug'] && $function == 'execute') {
|
if($config['debug'] && $function == 'execute') {
|
||||||
$time = round((microtime(true) - $start) * 1000, 2) . 'ms';
|
$time = round((microtime(true) - $start) * 1000, 2) . 'ms';
|
||||||
@ -104,4 +108,4 @@
|
|||||||
return $err[2];
|
return $err[2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
// You cannot request this file directly.
|
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Stuff to help with the display.
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
|
// You cannot request this file directly.
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
joaoptm78@gmail.com
|
joaoptm78@gmail.com
|
||||||
@ -20,11 +19,6 @@
|
|||||||
return round($size, 2).$units[$i];
|
return round($size, 2).$units[$i];
|
||||||
}
|
}
|
||||||
|
|
||||||
function commaize($n) {
|
|
||||||
$n = strval($n);
|
|
||||||
return (intval($n) < 1000) ? $n : commaize(substr($n, 0, -3)) . ',' . substr($n, -3);
|
|
||||||
}
|
|
||||||
|
|
||||||
function doBoardListPart($list, $root) {
|
function doBoardListPart($list, $root) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -222,7 +216,8 @@
|
|||||||
class Post {
|
class Post {
|
||||||
public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $embed, $root=null, $mod=false) {
|
public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $embed, $root=null, $mod=false) {
|
||||||
global $config;
|
global $config;
|
||||||
if(!isset($root)) $root = &$config['root'];
|
if(!isset($root))
|
||||||
|
$root = &$config['root'];
|
||||||
|
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->thread = $thread;
|
$this->thread = $thread;
|
||||||
@ -311,7 +306,8 @@
|
|||||||
class Thread {
|
class Thread {
|
||||||
public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $bumplocked, $embed, $root=null, $mod=false, $hr=true) {
|
public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $bumplocked, $embed, $root=null, $mod=false, $hr=true) {
|
||||||
global $config;
|
global $config;
|
||||||
if(!isset($root)) $root = &$config['root'];
|
if(!isset($root))
|
||||||
|
$root = &$config['root'];
|
||||||
|
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->subject = utf8tohtml($subject);
|
$this->subject = utf8tohtml($subject);
|
||||||
@ -442,4 +438,4 @@
|
|||||||
return 'thread_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id;
|
return 'thread_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
?>
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
|
// You cannot request this file directly.
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
function event() {
|
function event() {
|
||||||
global $events;
|
global $events;
|
||||||
|
|
||||||
|
@ -1,5 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
|
// You cannot request this file directly.
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
class Filter {
|
class Filter {
|
||||||
private $condition;
|
private $condition;
|
||||||
|
|
||||||
|
@ -1,12 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
// You cannot request this file directly.
|
// You cannot request this file directly.
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
require 'inc/events.php';
|
require_once 'inc/display.php';
|
||||||
require 'lib/gettext/gettext.inc';
|
require_once 'inc/template.php';
|
||||||
|
require_once 'inc/database.php';
|
||||||
|
require_once 'inc/events.php';
|
||||||
|
require_once 'inc/lib/gettext/gettext.inc';
|
||||||
|
|
||||||
|
// the user is not currently logged in as a moderator
|
||||||
|
$mod = false;
|
||||||
|
|
||||||
register_shutdown_function('fatal_error_handler');
|
register_shutdown_function('fatal_error_handler');
|
||||||
mb_internal_encoding('UTF-8');
|
mb_internal_encoding('UTF-8');
|
||||||
@ -22,11 +32,11 @@
|
|||||||
if(!isset($_SERVER['REMOTE_ADDR']))
|
if(!isset($_SERVER['REMOTE_ADDR']))
|
||||||
$_SERVER['REMOTE_ADDR'] = '0.0.0.0';
|
$_SERVER['REMOTE_ADDR'] = '0.0.0.0';
|
||||||
|
|
||||||
$arrays = Array('db', 'cache', 'cookies', 'error', 'dir', 'mod', 'spam', 'flood_filters', 'wordfilters', 'custom_capcode', 'custom_tripcode', 'dnsbl', 'dnsbl_exceptions', 'remote', 'allowed_ext', 'allowed_ext_files', 'file_icons', 'footer', 'stylesheets', 'additional_javascript', 'markup');
|
$arrays = array('db', 'cache', 'cookies', 'error', 'dir', 'mod', 'spam', 'flood_filters', 'wordfilters', 'custom_capcode', 'custom_tripcode', 'dnsbl', 'dnsbl_exceptions', 'remote', 'allowed_ext', 'allowed_ext_files', 'file_icons', 'footer', 'stylesheets', 'additional_javascript', 'markup');
|
||||||
|
|
||||||
$config = Array();
|
$config = array();
|
||||||
foreach($arrays as $key) {
|
foreach($arrays as $key) {
|
||||||
$config[$key] = Array();
|
$config[$key] = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
require 'inc/config.php';
|
require 'inc/config.php';
|
||||||
@ -45,7 +55,7 @@
|
|||||||
|
|
||||||
if($config['debug']) {
|
if($config['debug']) {
|
||||||
if(!isset($debug)) {
|
if(!isset($debug)) {
|
||||||
$debug = Array('sql' => Array(), 'purge' => Array(), 'cached' => Array());
|
$debug = array('sql' => array(), 'purge' => array(), 'cached' => array());
|
||||||
$debug['start'] = microtime(true);
|
$debug['start'] = microtime(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,7 +250,7 @@
|
|||||||
$query->bindValue(':theme', $theme);
|
$query->bindValue(':theme', $theme);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
$settings = Array();
|
$settings = array();
|
||||||
while($s = $query->fetch()) {
|
while($s = $query->fetch()) {
|
||||||
$settings[$s['name']] = $s['value'];
|
$settings[$s['name']] = $s['value'];
|
||||||
}
|
}
|
||||||
@ -260,7 +270,7 @@
|
|||||||
function setupBoard($array) {
|
function setupBoard($array) {
|
||||||
global $board, $config;
|
global $board, $config;
|
||||||
|
|
||||||
$board = Array(
|
$board = array(
|
||||||
'id' => $array['id'],
|
'id' => $array['id'],
|
||||||
'uri' => $array['uri'],
|
'uri' => $array['uri'],
|
||||||
'name' => $array['title'],
|
'name' => $array['title'],
|
||||||
@ -404,7 +414,7 @@
|
|||||||
|
|
||||||
if($config['debug']) {
|
if($config['debug']) {
|
||||||
if(!isset($debug['unlink']))
|
if(!isset($debug['unlink']))
|
||||||
$debug['unlink'] = Array();
|
$debug['unlink'] = array();
|
||||||
$debug['unlink'][] = $path;
|
$debug['unlink'][] = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,10 +540,10 @@
|
|||||||
|
|
||||||
// Show banned page and exit
|
// Show banned page and exit
|
||||||
die(
|
die(
|
||||||
Element('page.html', Array(
|
Element('page.html', array(
|
||||||
'title' => 'Banned!',
|
'title' => 'Banned!',
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'body' => Element('banned.html', Array(
|
'body' => Element('banned.html', array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'ban' => $ban
|
'ban' => $ban
|
||||||
)
|
)
|
||||||
@ -641,7 +651,7 @@
|
|||||||
} else return false;
|
} else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function post($post) {
|
function post(array $post) {
|
||||||
global $pdo, $board;
|
global $pdo, $board;
|
||||||
$query = prepare(sprintf("INSERT INTO `posts_%s` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri']));
|
$query = prepare(sprintf("INSERT INTO `posts_%s` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri']));
|
||||||
|
|
||||||
@ -731,7 +741,10 @@
|
|||||||
$query->bindValue(':filehash', null, PDO::PARAM_NULL);
|
$query->bindValue(':filehash', null, PDO::PARAM_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$query->execute() or error(db_error($query));
|
if(!$query->execute()) {
|
||||||
|
undoImage($post);
|
||||||
|
error(db_error($query));
|
||||||
|
}
|
||||||
|
|
||||||
return $pdo->lastInsertId();
|
return $pdo->lastInsertId();
|
||||||
}
|
}
|
||||||
@ -909,7 +922,8 @@
|
|||||||
$query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT);
|
$query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
if($query->rowcount() < 1 && $page > 1) return false;
|
if($query->rowcount() < 1 && $page > 1)
|
||||||
|
return false;
|
||||||
while($th = $query->fetch()) {
|
while($th = $query->fetch()) {
|
||||||
if(!$mod && $config['cache']['enabled']) {
|
if(!$mod && $config['cache']['enabled']) {
|
||||||
if($built = cache::get("thread_index_{$board['uri']}_{$th['id']}")) {
|
if($built = cache::get("thread_index_{$board['uri']}_{$th['id']}")) {
|
||||||
@ -918,7 +932,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$thread = new Thread($th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], $th['sticky'], $th['locked'], $th['sage'], $th['embed'], $mod ? '?/' : $config['root'], $mod);
|
$thread = new Thread(
|
||||||
|
$th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'],
|
||||||
|
$th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'],
|
||||||
|
$th['sticky'], $th['locked'], $th['sage'], $th['embed'], $mod ? '?/' : $config['root'], $mod
|
||||||
|
);
|
||||||
|
|
||||||
$posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri']));
|
$posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri']));
|
||||||
$posts->bindValue(':id', $th['id']);
|
$posts->bindValue(':id', $th['id']);
|
||||||
@ -930,7 +948,11 @@
|
|||||||
if($po['file'])
|
if($po['file'])
|
||||||
$num_images++;
|
$num_images++;
|
||||||
|
|
||||||
$thread->add(new Post($po['id'], $th['id'], $po['subject'], $po['email'], $po['name'], $po['trip'], $po['capcode'], $po['body'], $po['time'], $po['thumb'], $po['thumbwidth'], $po['thumbheight'], $po['file'], $po['filewidth'], $po['fileheight'], $po['filesize'], $po['filename'], $po['ip'], $po['embed'], $mod ? '?/' : $config['root'], $mod));
|
$thread->add(new Post(
|
||||||
|
$po['id'], $th['id'], $po['subject'], $po['email'], $po['name'], $po['trip'], $po['capcode'], $po['body'], $po['time'],
|
||||||
|
$po['thumb'], $po['thumbwidth'], $po['thumbheight'], $po['file'], $po['filewidth'], $po['fileheight'], $po['filesize'],
|
||||||
|
$po['filename'], $po['ip'], $po['embed'], $mod ? '?/' : $config['root'], $mod)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($posts->rowCount() == ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
|
if($posts->rowCount() == ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
|
||||||
@ -950,7 +972,7 @@
|
|||||||
$body .= $thread->build(true);
|
$body .= $thread->build(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array(
|
return array(
|
||||||
'board'=>$board,
|
'board'=>$board,
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
'post_url' => $config['post_url'],
|
'post_url' => $config['post_url'],
|
||||||
@ -962,7 +984,7 @@
|
|||||||
function getPageButtons($pages, $mod=false) {
|
function getPageButtons($pages, $mod=false) {
|
||||||
global $config, $board;
|
global $config, $board;
|
||||||
|
|
||||||
$btn = Array();
|
$btn = array();
|
||||||
$root = ($mod ? '?/' : $config['root']) . $board['dir'];
|
$root = ($mod ? '?/' : $config['root']) . $board['dir'];
|
||||||
|
|
||||||
foreach($pages as $num => $page) {
|
foreach($pages as $num => $page) {
|
||||||
@ -1017,9 +1039,9 @@
|
|||||||
|
|
||||||
if($count < 1) $count = 1;
|
if($count < 1) $count = 1;
|
||||||
|
|
||||||
$pages = Array();
|
$pages = array();
|
||||||
for($x=0;$x<$count && $x<$config['max_pages'];$x++) {
|
for($x=0;$x<$count && $x<$config['max_pages'];$x++) {
|
||||||
$pages[] = Array(
|
$pages[] = array(
|
||||||
'num' => $x+1,
|
'num' => $x+1,
|
||||||
'link' => $x==0 ? ($mod ? '?/' : $config['root']) . $board['dir'] . $config['file_index'] : ($mod ? '?/' : $config['root']) . $board['dir'] . sprintf($config['file_page'], $x+1)
|
'link' => $x==0 ? ($mod ? '?/' : $config['root']) . $board['dir'] . $config['file_index'] : ($mod ? '?/' : $config['root']) . $board['dir'] . sprintf($config['file_page'], $x+1)
|
||||||
);
|
);
|
||||||
@ -1138,7 +1160,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createHiddenInputs($extra_salt = Array()) {
|
function createHiddenInputs($extra_salt = array()) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if(!empty($extra_salt)) {
|
if(!empty($extra_salt)) {
|
||||||
@ -1148,7 +1170,7 @@
|
|||||||
$extra_salt = '';
|
$extra_salt = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$inputs = Array();
|
$inputs = array();
|
||||||
|
|
||||||
shuffle($config['spam']['hidden_input_names']);
|
shuffle($config['spam']['hidden_input_names']);
|
||||||
$hidden_input_names_x = 0;
|
$hidden_input_names_x = 0;
|
||||||
@ -1184,37 +1206,48 @@
|
|||||||
|
|
||||||
switch($display_type) {
|
switch($display_type) {
|
||||||
case 0:
|
case 0:
|
||||||
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />';
|
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' .
|
||||||
|
htmlspecialchars($value) . '" />';
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$content .= '<input style="display:none" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />';
|
$content .= '<input style="display:none" name="' . htmlspecialchars($name) . '" value="' .
|
||||||
|
htmlspecialchars($value) . '" />';
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$content .= '<input type="hidden" value="' . htmlspecialchars($value) . '" name="' . htmlspecialchars($name) . '" />';
|
$content .= '<input type="hidden" value="' . htmlspecialchars($value) . '" name="' .
|
||||||
|
htmlspecialchars($name) . '" />';
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />';
|
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' .
|
||||||
|
htmlspecialchars($value) . '" />';
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
$content .= '<span style="display:none"><input type="text" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" /></span>';
|
$content .= '<span style="display:none"><input type="text" name="' . htmlspecialchars($name) . '" value="' .
|
||||||
|
htmlspecialchars($value) .'" /></span>';
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
$content .= '<div style="display:none"><input type="text" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" /></div>';
|
$content .= '<div style="display:none"><input type="text" name="' . htmlspecialchars($name) . '" value="' .
|
||||||
|
htmlspecialchars($value) . '" /></div>';
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
if(!empty($value))
|
if(!empty($value))
|
||||||
$content .= '<textarea style="display:none" name="' . htmlspecialchars($name) . '">' . htmlspecialchars($value) . '</textarea>';
|
$content .= '<textarea style="display:none" name="' . htmlspecialchars($name) . '">' .
|
||||||
|
htmlspecialchars($value) . '</textarea>';
|
||||||
else
|
else
|
||||||
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />';
|
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' .
|
||||||
|
htmlspecialchars($value) . '" />';
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if(!empty($value))
|
if(!empty($value))
|
||||||
$content .= '<textarea name="' . htmlspecialchars($name) . '" style="display:none">' . htmlspecialchars($value) . '</textarea>';
|
$content .= '<textarea name="' . htmlspecialchars($name) . '" style="display:none">' .
|
||||||
|
htmlspecialchars($value) . '</textarea>';
|
||||||
else
|
else
|
||||||
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($value) . '" />';
|
$content .= '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' .
|
||||||
|
htmlspecialchars($value) . '" />';
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
$content .= '<div style="display:none"><textarea name="' . htmlspecialchars($name) . '" style="display:none">' . htmlspecialchars($value) . '</textarea></div>';
|
$content .= '<div style="display:none"><textarea name="' . htmlspecialchars($name) . '" style="display:none">' .
|
||||||
|
htmlspecialchars($value) . '</textarea></div>';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1244,7 +1277,7 @@
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkSpam($extra_salt = Array()) {
|
function checkSpam($extra_salt = array()) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
if(!isset($_POST['hash']))
|
if(!isset($_POST['hash']))
|
||||||
@ -1260,7 +1293,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reconsturct the $inputs array
|
// Reconsturct the $inputs array
|
||||||
$inputs = Array();
|
$inputs = array();
|
||||||
|
|
||||||
foreach($_POST as $name => $value) {
|
foreach($_POST as $name => $value) {
|
||||||
if(in_array($name, $config['spam']['valid_inputs']))
|
if(in_array($name, $config['spam']['valid_inputs']))
|
||||||
@ -1319,14 +1352,14 @@
|
|||||||
function buildJavascript() {
|
function buildJavascript() {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$stylesheets = Array();
|
$stylesheets = array();
|
||||||
foreach($config['stylesheets'] as $name => $uri) {
|
foreach($config['stylesheets'] as $name => $uri) {
|
||||||
$stylesheets[] = Array(
|
$stylesheets[] = array(
|
||||||
'name' => addslashes($name),
|
'name' => addslashes($name),
|
||||||
'uri' => addslashes((!empty($uri) ? $config['uri_stylesheets'] : '') . $uri));
|
'uri' => addslashes((!empty($uri) ? $config['uri_stylesheets'] : '') . $uri));
|
||||||
}
|
}
|
||||||
|
|
||||||
$script = Element('main.js', Array(
|
$script = Element('main.js', array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'stylesheets' => $stylesheets
|
'stylesheets' => $stylesheets
|
||||||
));
|
));
|
||||||
@ -1361,7 +1394,7 @@
|
|||||||
|
|
||||||
foreach($config['dnsbl'] as $blacklist) {
|
foreach($config['dnsbl'] as $blacklist) {
|
||||||
if(!is_array($blacklist) == 1)
|
if(!is_array($blacklist) == 1)
|
||||||
$blacklist = Array($blacklist);
|
$blacklist = array($blacklist);
|
||||||
|
|
||||||
if(($lookup = str_replace('%', $ip, $blacklist[0])) == $blacklist[0])
|
if(($lookup = str_replace('%', $ip, $blacklist[0])) == $blacklist[0])
|
||||||
$lookup = $ip . '.' . $blacklist[0];
|
$lookup = $ip . '.' . $blacklist[0];
|
||||||
@ -1394,8 +1427,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ReverseIPOctets($ip) {
|
function ReverseIPOctets($ip) {
|
||||||
$ipoc = explode('.', $ip);
|
return implode('.', array_reverse(explode('.', $ip)));
|
||||||
return $ipoc[3] . '.' . $ipoc[2] . '.' . $ipoc[1] . '.' . $ipoc[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function wordfilters(&$body) {
|
function wordfilters(&$body) {
|
||||||
@ -1467,7 +1499,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($config['markup_urls']) {
|
if($config['markup_urls']) {
|
||||||
$markup_urls = Array();
|
$markup_urls = array();
|
||||||
|
|
||||||
$body = preg_replace_callback(
|
$body = preg_replace_callback(
|
||||||
'/((?:https?:\/\/|ftp:\/\/|irc:\/\/)[^\s<>()"]+?(?:\([^\s<>()"]*?\)[^\s<>()"]*?)*)((?:\s|<|>|"|\.||\]|!|\?|,|,|")*(?:[\s<>()"]|$))/',
|
'/((?:https?:\/\/|ftp:\/\/|irc:\/\/)[^\s<>()"]+?(?:\([^\s<>()"]*?\)[^\s<>()"]*?)*)((?:\s|<|>|"|\.||\]|!|\?|,|,|")*(?:[\s<>()"]|$))/',
|
||||||
@ -1491,7 +1523,7 @@
|
|||||||
// replace tabs with 8 spaces
|
// replace tabs with 8 spaces
|
||||||
$body = str_replace("\t", ' ', $body);
|
$body = str_replace("\t", ' ', $body);
|
||||||
|
|
||||||
$tracked_cites = Array();
|
$tracked_cites = array();
|
||||||
|
|
||||||
// Cites
|
// Cites
|
||||||
if(isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites)) {
|
if(isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites)) {
|
||||||
@ -1513,7 +1545,7 @@
|
|||||||
$body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[3][$index], $body);
|
$body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[3][$index], $body);
|
||||||
|
|
||||||
if($track_cites && $config['track_cites'])
|
if($track_cites && $config['track_cites'])
|
||||||
$tracked_cites[] = Array($board['uri'], $post['id']);
|
$tracked_cites[] = array($board['uri'], $post['id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1546,7 +1578,7 @@
|
|||||||
$body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[4][$index], $body);
|
$body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[4][$index], $body);
|
||||||
|
|
||||||
if($track_cites && $config['track_cites'])
|
if($track_cites && $config['track_cites'])
|
||||||
$tracked_cites[] = Array($board['uri'], $post['id']);
|
$tracked_cites[] = array($board['uri'], $post['id']);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$replacement = '<a href="' .
|
$replacement = '<a href="' .
|
||||||
@ -1573,7 +1605,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function utf8tohtml($utf8) {
|
function utf8tohtml($utf8) {
|
||||||
return mb_encode_numericentity(htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'), Array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
|
return mb_encode_numericentity(htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'), array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildThread($id, $return=false, $mod=false) {
|
function buildThread($id, $return=false, $mod=false) {
|
||||||
@ -1595,16 +1627,25 @@
|
|||||||
|
|
||||||
while($post = $query->fetch()) {
|
while($post = $query->fetch()) {
|
||||||
if(!isset($thread)) {
|
if(!isset($thread)) {
|
||||||
$thread = new Thread($post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], $mod ? '?/' : $config['root'], $mod);
|
$thread = new Thread(
|
||||||
|
$post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'],
|
||||||
|
$post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'],
|
||||||
|
$post['filename'], $post['ip'], $post['sticky'], $post['locked'], $post['sage'], $post['embed'], $mod ? '?/' : $config['root'], $mod
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$thread->add(new Post($post['id'], $thread->id, $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'], $post['filesize'], $post['filename'], $post['ip'], $post['embed'], $mod ? '?/' : $config['root'], $mod));
|
$thread->add(new Post(
|
||||||
|
$post['id'], $thread->id, $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'],
|
||||||
|
$post['time'], $post['thumb'], $post['thumbwidth'], $post['thumbheight'], $post['file'], $post['filewidth'], $post['fileheight'],
|
||||||
|
$post['filesize'], $post['filename'], $post['ip'], $post['embed'], $mod ? '?/' : $config['root'], $mod)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if any posts were found
|
// Check if any posts were found
|
||||||
if(!isset($thread)) error($config['error']['nonexistant']);
|
if(!isset($thread))
|
||||||
|
error($config['error']['nonexistant']);
|
||||||
|
|
||||||
$body = Element('thread.html', Array(
|
$body = Element('thread.html', array(
|
||||||
'board'=>$board,
|
'board'=>$board,
|
||||||
'body'=>$thread->build(),
|
'body'=>$thread->build(),
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
@ -1653,7 +1694,7 @@
|
|||||||
return $trip;
|
return $trip;
|
||||||
|
|
||||||
if(!preg_match('/^([^#]+)?(##|#)(.+)$/', $name, $match))
|
if(!preg_match('/^([^#]+)?(##|#)(.+)$/', $name, $match))
|
||||||
return Array($name);
|
return array($name);
|
||||||
|
|
||||||
$name = $match[1];
|
$name = $match[1];
|
||||||
$secure = $match[2] == '##';
|
$secure = $match[2] == '##';
|
||||||
@ -1679,7 +1720,7 @@
|
|||||||
$trip = '!' . substr(crypt($trip, $salt), -10);
|
$trip = '!' . substr(crypt($trip, $salt), -10);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Array($name, $trip);
|
return array($name, $trip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Highest common factor
|
// Highest common factor
|
||||||
@ -1726,14 +1767,15 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function undoImage($post) {
|
function undoImage(array $post) {
|
||||||
if($post['has_file']) {
|
if(!$post['has_file'])
|
||||||
if(isset($post['thumb']))
|
return;
|
||||||
|
|
||||||
|
if(isset($post['file']))
|
||||||
file_unlink($post['file']);
|
file_unlink($post['file']);
|
||||||
if(isset($post['thumb']))
|
if(isset($post['thumb']))
|
||||||
file_unlink($post['thumb']);
|
file_unlink($post['thumb']);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function rDNS($ip_addr) {
|
function rDNS($ip_addr) {
|
||||||
global $config;
|
global $config;
|
||||||
@ -1783,4 +1825,3 @@
|
|||||||
return $ip_addr;
|
return $ip_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
// You cannot request this file directly.
|
// You cannot request this file directly.
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,4 +489,3 @@
|
|||||||
return chr($n & 255).chr(($n >> 8) & 255);
|
return chr($n & 255).chr(($n >> 8) & 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
// You cannot request this file directly.
|
// You cannot request this file directly.
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
|
// You cannot request this file directly.
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
class Remote {
|
class Remote {
|
||||||
public function __construct($config) {
|
public function __construct($config) {
|
||||||
foreach($config as $name => $value) {
|
foreach($config as $name => $value) {
|
||||||
@ -54,4 +64,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
?>
|
|
||||||
|
@ -1,10 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
|
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) {
|
||||||
// You cannot request this file directly.
|
// You cannot request this file directly.
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$twig = false;
|
||||||
|
|
||||||
|
function load_twig() {
|
||||||
|
global $twig, $config;
|
||||||
|
|
||||||
require 'lib/Twig/Autoloader.php';
|
require 'lib/Twig/Autoloader.php';
|
||||||
Twig_Autoloader::register();
|
Twig_Autoloader::register();
|
||||||
|
|
||||||
@ -14,9 +23,21 @@
|
|||||||
Twig_Autoloader::autoload('Twig_Extensions_Extension_Tinyboard');
|
Twig_Autoloader::autoload('Twig_Extensions_Extension_Tinyboard');
|
||||||
|
|
||||||
$loader = new Twig_Loader_Filesystem($config['dir']['template']);
|
$loader = new Twig_Loader_Filesystem($config['dir']['template']);
|
||||||
|
$loader->setPaths($config['dir']['template']);
|
||||||
|
$twig = new Twig_Environment($loader, Array(
|
||||||
|
'autoescape' => false,
|
||||||
|
'cache' => "{$config['dir']['template']}/cache",
|
||||||
|
'debug' => ($config['debug'] ? true : false),
|
||||||
|
));
|
||||||
|
$twig->addExtension(new Twig_Extensions_Extension_Tinyboard());
|
||||||
|
$twig->addExtension(new Twig_Extensions_Extension_I18n());
|
||||||
|
}
|
||||||
|
|
||||||
function Element($templateFile, array $options) {
|
function Element($templateFile, array $options) {
|
||||||
global $config, $debug, $loader;
|
global $config, $debug, $twig;
|
||||||
|
|
||||||
|
if(!$twig)
|
||||||
|
load_twig();
|
||||||
|
|
||||||
if(function_exists('create_pm_header') && ((isset($options['mod']) && $options['mod']) || isset($options['__mod']))) {
|
if(function_exists('create_pm_header') && ((isset($options['mod']) && $options['mod']) || isset($options['__mod']))) {
|
||||||
$options['pm'] = create_pm_header();
|
$options['pm'] = create_pm_header();
|
||||||
@ -26,21 +47,15 @@
|
|||||||
if(isset($debug['start'])) {
|
if(isset($debug['start'])) {
|
||||||
$debug['time'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms';
|
$debug['time'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms';
|
||||||
unset($debug['start']);
|
unset($debug['start']);
|
||||||
|
|
||||||
}
|
}
|
||||||
$options['body'] .= '<h3>Debug</h3><pre style="white-space: pre-wrap;font-size: 10px;">' . str_replace("\n", '<br/>', utf8tohtml(print_r($debug, true))) . '</pre>';
|
$debug['included'] = get_included_files();
|
||||||
|
$debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB';
|
||||||
|
$options['body'] .=
|
||||||
|
'<h3>Debug</h3><pre style="white-space: pre-wrap;font-size: 10px;">' .
|
||||||
|
str_replace("\n", '<br/>', utf8tohtml(print_r($debug, true))) .
|
||||||
|
'</pre>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$loader->setPaths($config['dir']['template']);
|
|
||||||
|
|
||||||
$twig = new Twig_Environment($loader, Array(
|
|
||||||
'autoescape' => false,
|
|
||||||
'cache' => "{$config['dir']['template']}/cache",
|
|
||||||
'debug' => ($config['debug'] ? true : false),
|
|
||||||
));
|
|
||||||
$twig->addExtension(new Twig_Extensions_Extension_Tinyboard());
|
|
||||||
$twig->addExtension(new Twig_Extensions_Extension_I18n());
|
|
||||||
|
|
||||||
// Read the template file
|
// Read the template file
|
||||||
if(@file_get_contents("{$config['dir']['template']}/${templateFile}")) {
|
if(@file_get_contents("{$config['dir']['template']}/${templateFile}")) {
|
||||||
$body = $twig->render($templateFile, $options);
|
$body = $twig->render($templateFile, $options);
|
||||||
@ -54,4 +69,4 @@
|
|||||||
throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!");
|
throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
10
inc/user.php
10
inc/user.php
@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) {
|
|
||||||
// You cannot request this file directly.
|
|
||||||
header('Location: ../', true, 302);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 'false' means that the user is not logged in as a moderator
|
|
||||||
$mod = false;
|
|
||||||
|
|
@ -1,12 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// Installation/upgrade file
|
// Installation/upgrade file
|
||||||
define('VERSION', 'v0.9.6-dev-1');
|
define('VERSION', 'v0.9.6-dev-1');
|
||||||
|
|
||||||
require 'inc/functions.php';
|
require 'inc/functions.php';
|
||||||
require 'inc/display.php';
|
|
||||||
require 'inc/template.php';
|
|
||||||
require 'inc/database.php';
|
|
||||||
require 'inc/user.php';
|
|
||||||
$step = isset($_GET['step']) ? round($_GET['step']) : 0;
|
$step = isset($_GET['step']) ? round($_GET['step']) : 0;
|
||||||
$page = Array(
|
$page = Array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
@ -519,4 +517,4 @@
|
|||||||
|
|
||||||
echo Element('page.html', $page);
|
echo Element('page.html', $page);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
128
mod.php
128
mod.php
@ -1,9 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
require 'inc/functions.php';
|
require 'inc/functions.php';
|
||||||
require 'inc/display.php';
|
|
||||||
require 'inc/template.php';
|
|
||||||
require 'inc/database.php';
|
|
||||||
require 'inc/user.php';
|
|
||||||
require 'inc/mod.php';
|
require 'inc/mod.php';
|
||||||
|
|
||||||
if (get_magic_quotes_gpc()) {
|
if (get_magic_quotes_gpc()) {
|
||||||
@ -57,7 +58,7 @@
|
|||||||
|
|
||||||
// A sort of "cache"
|
// A sort of "cache"
|
||||||
// Stops calling preg_quote and str_replace when not needed; only does it once
|
// Stops calling preg_quote and str_replace when not needed; only does it once
|
||||||
$regex = Array(
|
$regex = array(
|
||||||
'board' => str_replace('%s', '(\w{1,8})', preg_quote($config['board_path'], '/')),
|
'board' => str_replace('%s', '(\w{1,8})', preg_quote($config['board_path'], '/')),
|
||||||
'page' => str_replace('%d', '(\d+)', preg_quote($config['file_page'], '/')),
|
'page' => str_replace('%d', '(\d+)', preg_quote($config['file_page'], '/')),
|
||||||
'img' => preg_quote($config['dir']['img'], '/'),
|
'img' => preg_quote($config['dir']['img'], '/'),
|
||||||
@ -68,7 +69,7 @@
|
|||||||
|
|
||||||
if(preg_match('/^\/?$/', $query)) {
|
if(preg_match('/^\/?$/', $query)) {
|
||||||
// Dashboard
|
// Dashboard
|
||||||
$fieldset = Array(
|
$fieldset = array(
|
||||||
'Boards' => '',
|
'Boards' => '',
|
||||||
'Noticeboard' => '',
|
'Noticeboard' => '',
|
||||||
'Administration' => '',
|
'Administration' => '',
|
||||||
@ -187,7 +188,7 @@
|
|||||||
if($code = @file_get_contents('http://tinyboard.org/version.txt', 0, $ctx)) {
|
if($code = @file_get_contents('http://tinyboard.org/version.txt', 0, $ctx)) {
|
||||||
eval($code);
|
eval($code);
|
||||||
if(preg_match('/v(\d+)\.(\d)\.(\d+)(-dev.+)?$/', $config['version'], $m)) {
|
if(preg_match('/v(\d+)\.(\d)\.(\d+)(-dev.+)?$/', $config['version'], $m)) {
|
||||||
$current = Array(
|
$current = array(
|
||||||
'massive' => (int)$m[1],
|
'massive' => (int)$m[1],
|
||||||
'major' => (int)$m[2],
|
'major' => (int)$m[2],
|
||||||
'minor' => (int)$m[3]
|
'minor' => (int)$m[3]
|
||||||
@ -236,7 +237,7 @@
|
|||||||
$body .= '<fieldset><legend>' . _($title) . '</legend><ul>' . $data . '</ul></fieldset>';
|
$body .= '<fieldset><legend>' . _($title) . '</legend><ul>' . $data . '</ul></fieldset>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Dashboard'),
|
'title'=>_('Dashboard'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -257,7 +258,7 @@
|
|||||||
'</p>' .
|
'</p>' .
|
||||||
'<p style="text-align:center"><a style="margin:block;font-size:150%;font-weight:bold" href="?/' . utf8tohtml($uri) . '">Confirm</a></p>';
|
'<p style="text-align:center"><a style="margin:block;font-size:150%;font-weight:bold" href="?/' . utf8tohtml($uri) . '">Confirm</a></p>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Confirm',
|
'title'=>'Confirm',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -274,7 +275,7 @@
|
|||||||
$body = '<div class="ban"><h2>git pull</h2>';
|
$body = '<div class="ban"><h2>git pull</h2>';
|
||||||
$body .= '<p>' . str_replace("\n", '<br/>', shell_exec('git pull')) . '</p>';
|
$body .= '<p>' . str_replace("\n", '<br/>', shell_exec('git pull')) . '</p>';
|
||||||
$body .= '</div>';
|
$body .= '</div>';
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'title' => 'Upgraded',
|
'title' => 'Upgraded',
|
||||||
'body' => $body
|
'body' => $body
|
||||||
@ -332,7 +333,7 @@
|
|||||||
|
|
||||||
$version = preg_replace('/^savetheinternet-Tinyboard-(\w+)\//', '$1', $dir = $zip->getNameIndex(0));
|
$version = preg_replace('/^savetheinternet-Tinyboard-(\w+)\//', '$1', $dir = $zip->getNameIndex(0));
|
||||||
|
|
||||||
$errors = Array();
|
$errors = array();
|
||||||
for($i = 1; $i < $zip->numFiles; $i++) {
|
for($i = 1; $i < $zip->numFiles; $i++) {
|
||||||
$filename = str_replace($dir, '', $zip->getNameIndex($i));
|
$filename = str_replace($dir, '', $zip->getNameIndex($i));
|
||||||
|
|
||||||
@ -357,7 +358,7 @@
|
|||||||
|
|
||||||
unlink($temp);
|
unlink($temp);
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'title' => 'Error(s) upgrading',
|
'title' => 'Error(s) upgrading',
|
||||||
'body' => $body
|
'body' => $body
|
||||||
@ -371,7 +372,7 @@
|
|||||||
|
|
||||||
unlink($temp);
|
unlink($temp);
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'title' => 'Upgraded',
|
'title' => 'Upgraded',
|
||||||
'body' => '<p style="text-align:center">Upgrading seems to have gone okay. You are now at revision <strong>' . $version . '</strong>.</p>'
|
'body' => '<p style="text-align:center">Upgrading seems to have gone okay. You are now at revision <strong>' . $version . '</strong>.</p>'
|
||||||
@ -381,7 +382,7 @@
|
|||||||
|
|
||||||
$page = isset($match[2]) ? $match[2] : 1;
|
$page = isset($match[2]) ? $match[2] : 1;
|
||||||
|
|
||||||
$boards = Array();
|
$boards = array();
|
||||||
$_boards = listBoards();
|
$_boards = listBoards();
|
||||||
foreach($_boards as &$_b) {
|
foreach($_boards as &$_b) {
|
||||||
$boards[$_b['id']] = $_b['uri'];
|
$boards[$_b['id']] = $_b['uri'];
|
||||||
@ -470,7 +471,7 @@
|
|||||||
$body .= '</p>';
|
$body .= '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Moderation log'),
|
'title'=>_('Moderation log'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -483,7 +484,7 @@
|
|||||||
// Clearsettings
|
// Clearsettings
|
||||||
query("TRUNCATE TABLE `theme_settings`") or error(db_error());
|
query("TRUNCATE TABLE `theme_settings`") or error(db_error());
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'No theme',
|
'title'=>'No theme',
|
||||||
'body'=>'<p style="text-align:center">Successfully uninstalled all themes.</p>' .
|
'body'=>'<p style="text-align:center">Successfully uninstalled all themes.</p>' .
|
||||||
@ -496,7 +497,7 @@
|
|||||||
|
|
||||||
rebuildTheme($match[1], 'all');
|
rebuildTheme($match[1], 'all');
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Rebuilt',
|
'title'=>'Rebuilt',
|
||||||
'body'=>'<p style="text-align:center">Successfully rebuilt the <strong>' . $match[1] . '</strong> theme.</p>' .
|
'body'=>'<p style="text-align:center">Successfully rebuilt the <strong>' . $match[1] . '</strong> theme.</p>' .
|
||||||
@ -511,7 +512,7 @@
|
|||||||
$query->bindValue(':theme', $match[1]);
|
$query->bindValue(':theme', $match[1]);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Uninstalled',
|
'title'=>'Uninstalled',
|
||||||
'body'=>'<p style="text-align:center">Successfully uninstalled the <strong>' . $match[1] . '</strong> theme.</p>' .
|
'body'=>'<p style="text-align:center">Successfully uninstalled the <strong>' . $match[1] . '</strong> theme.</p>' .
|
||||||
@ -585,7 +586,7 @@
|
|||||||
// Build themes
|
// Build themes
|
||||||
rebuildThemes('all');
|
rebuildThemes('all');
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>($result ? 'Installed "' . utf8tohtml($theme['name']) . '"' : 'Installation failed!'),
|
'title'=>($result ? 'Installed "' . utf8tohtml($theme['name']) . '"' : 'Installation failed!'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -626,7 +627,7 @@
|
|||||||
|
|
||||||
$body .= '<p style="text-align:center"><input name="install" type="submit" value="Install theme" /></p></form>';
|
$body .= '<p style="text-align:center"><input name="install" type="submit" value="Install theme" /></p></form>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Installing "' . utf8tohtml($theme['name']) . '"',
|
'title'=>'Installing "' . utf8tohtml($theme['name']) . '"',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -636,14 +637,14 @@
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$themes_in_use = Array();
|
$themes_in_use = array();
|
||||||
$query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error());
|
$query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error());
|
||||||
while($theme = $query->fetch()) {
|
while($theme = $query->fetch()) {
|
||||||
$themes_in_use[$theme['theme']] = true;
|
$themes_in_use[$theme['theme']] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan directory for themes
|
// Scan directory for themes
|
||||||
$themes = Array();
|
$themes = array();
|
||||||
while($file = readdir($dir)) {
|
while($file = readdir($dir)) {
|
||||||
if($file[0] != '.' && is_dir($config['dir']['themes'] . '/' . $file)) {
|
if($file[0] != '.' && is_dir($config['dir']['themes'] . '/' . $file)) {
|
||||||
$themes[] = $file;
|
$themes[] = $file;
|
||||||
@ -702,7 +703,7 @@
|
|||||||
if(!empty($themes_in_use))
|
if(!empty($themes_in_use))
|
||||||
$body .= '<p style="text-align:center"><a href="?/themes/none">' . _('Uninstall all themes.') . '</a></p>';
|
$body .= '<p style="text-align:center"><a href="?/themes/none">' . _('Uninstall all themes.') . '</a></p>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Manage themes'),
|
'title'=>_('Manage themes'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -785,7 +786,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Noticeboard'),
|
'title'=>_('Noticeboard'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -867,7 +868,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('News'),
|
'title'=>_('News'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -916,7 +917,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('PM Inbox') . ' (' . ($query->rowCount() == 0 ? _('empty') : $unread_pms . ' ' . _('unread')) . ')',
|
'title'=>_('PM Inbox') . ' (' . ($query->rowCount() == 0 ? _('empty') : $unread_pms . ' ' . _('unread')) . ')',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1002,7 +1003,7 @@
|
|||||||
|
|
||||||
'<p style="text-align:center"><a href="?/new_PM/' . $pm['sender'] . '/' . $pm['id'] . '">Reply with quote</a></p>';
|
'<p style="text-align:center"><a href="?/new_PM/' . $pm['sender'] . '/' . $pm['id'] . '">Reply with quote</a></p>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Private message',
|
'title'=>'Private message',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1042,7 +1043,7 @@
|
|||||||
|
|
||||||
modLog('Sent a PM to ' . $to['username']);
|
modLog('Sent a PM to ' . $to['username']);
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'PM sent',
|
'title'=>'PM sent',
|
||||||
'body'=>'<p style="text-align:center">Message sent successfully to ' . utf8tohtml($to['username']) . '.</p>',
|
'body'=>'<p style="text-align:center">Message sent successfully to ' . utf8tohtml($to['username']) . '.</p>',
|
||||||
@ -1084,7 +1085,7 @@
|
|||||||
|
|
||||||
'</form>';
|
'</form>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'New PM for ' . utf8tohtml($to['username']),
|
'title'=>'New PM for ' . utf8tohtml($to['username']),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1109,14 +1110,14 @@
|
|||||||
$phrase = &$_POST['search'];
|
$phrase = &$_POST['search'];
|
||||||
$_body = '';
|
$_body = '';
|
||||||
|
|
||||||
$filters = Array();
|
$filters = array();
|
||||||
|
|
||||||
function search_filters($m) {
|
function search_filters($m) {
|
||||||
global $filters;
|
global $filters;
|
||||||
$name = $m[2];
|
$name = $m[2];
|
||||||
$value = isset($m[4]) ? $m[4] : $m[3];
|
$value = isset($m[4]) ? $m[4] : $m[3];
|
||||||
|
|
||||||
if(!in_array($name, Array('id', 'thread', 'subject', 'email', 'name', 'trip', 'capcode', 'filename', 'filehash', 'ip'))) {
|
if(!in_array($name, array('id', 'thread', 'subject', 'email', 'name', 'trip', 'capcode', 'filename', 'filehash', 'ip'))) {
|
||||||
// unknown filter
|
// unknown filter
|
||||||
return $m[0];
|
return $m[0];
|
||||||
}
|
}
|
||||||
@ -1138,7 +1139,7 @@
|
|||||||
$phrase = str_replace('*', '%', $phrase);
|
$phrase = str_replace('*', '%', $phrase);
|
||||||
|
|
||||||
$like = '';
|
$like = '';
|
||||||
$match = Array();
|
$match = array();
|
||||||
|
|
||||||
// Find exact phrases
|
// Find exact phrases
|
||||||
if(preg_match_all('/"(.+?)"/', $phrase, $m)) {
|
if(preg_match_all('/"(.+?)"/', $phrase, $m)) {
|
||||||
@ -1204,7 +1205,7 @@
|
|||||||
$body .= '<p style="text-align:center" class="unimportant">(No results.)</p>';
|
$body .= '<p style="text-align:center" class="unimportant">(No results.)</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Search',
|
'title'=>'Search',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1279,7 +1280,7 @@
|
|||||||
|
|
||||||
$body .= '</form>';
|
$body .= '</form>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Manage users'),
|
'title'=>_('Manage users'),
|
||||||
'body'=>$body
|
'body'=>$body
|
||||||
@ -1307,7 +1308,7 @@
|
|||||||
error(sprintf($config['error']['modexists'], $_mod['id']));
|
error(sprintf($config['error']['modexists'], $_mod['id']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$boards = Array();
|
$boards = array();
|
||||||
foreach($_POST as $name => $null) {
|
foreach($_POST as $name => $null) {
|
||||||
if(preg_match('/^board_(.+)$/', $name, $m))
|
if(preg_match('/^board_(.+)$/', $name, $m))
|
||||||
$boards[] = $m[1];
|
$boards[] = $m[1];
|
||||||
@ -1327,7 +1328,7 @@
|
|||||||
|
|
||||||
$__boards = '<ul style="list-style:none;padding:2px 5px">';
|
$__boards = '<ul style="list-style:none;padding:2px 5px">';
|
||||||
$boards = array_merge(
|
$boards = array_merge(
|
||||||
Array(Array('uri' => '*', 'title' => 'All')
|
array(array('uri' => '*', 'title' => 'All')
|
||||||
), listBoards());
|
), listBoards());
|
||||||
foreach($boards as &$_board) {
|
foreach($boards as &$_board) {
|
||||||
$__boards .= '<li>' .
|
$__boards .= '<li>' .
|
||||||
@ -1365,7 +1366,7 @@
|
|||||||
// End form
|
// End form
|
||||||
'</form></fieldset>';
|
'</form></fieldset>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'New user',
|
'title'=>'New user',
|
||||||
'body'=>$body
|
'body'=>$body
|
||||||
@ -1419,7 +1420,7 @@
|
|||||||
|
|
||||||
if((isset($_POST['username']) && isset($_POST['password'])) || (isset($change_password_only) && isset($_POST['password']))) {
|
if((isset($_POST['username']) && isset($_POST['password'])) || (isset($change_password_only) && isset($_POST['password']))) {
|
||||||
if(!isset($change_password_only)) {
|
if(!isset($change_password_only)) {
|
||||||
$boards = Array();
|
$boards = array();
|
||||||
foreach($_POST as $name => $null) {
|
foreach($_POST as $name => $null) {
|
||||||
if(preg_match('/^board_(.+)$/', $name, $m))
|
if(preg_match('/^board_(.+)$/', $name, $m))
|
||||||
$boards[] = $m[1];
|
$boards[] = $m[1];
|
||||||
@ -1469,7 +1470,7 @@
|
|||||||
|
|
||||||
$__boards = '<ul style="list-style:none;padding:2px 5px">';
|
$__boards = '<ul style="list-style:none;padding:2px 5px">';
|
||||||
$boards = array_merge(
|
$boards = array_merge(
|
||||||
Array(Array('uri' => '*', 'title' => 'All')
|
array(array('uri' => '*', 'title' => 'All')
|
||||||
), listBoards());
|
), listBoards());
|
||||||
|
|
||||||
$_mod['boards'] = explode(',', $_mod['boards']);
|
$_mod['boards'] = explode(',', $_mod['boards']);
|
||||||
@ -1526,7 +1527,7 @@
|
|||||||
|
|
||||||
'</fieldset>';
|
'</fieldset>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Edit user',
|
'title'=>'Edit user',
|
||||||
'body'=>$body
|
'body'=>$body
|
||||||
@ -1605,7 +1606,7 @@
|
|||||||
$body .= '<p class="unimportant" style="text-align:center">Showing ' .
|
$body .= '<p class="unimportant" style="text-align:center">Showing ' .
|
||||||
($reports == $count['count'] ? 'all ' . $reports . ' reports' : $reports . ' of ' . $count['count'] . ' reports') . '.</p>';
|
($reports == $count['count'] ? 'all ' . $reports . ' reports' : $reports . ' of ' . $count['count'] . ' reports') . '.</p>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Report queue') . ' (' . $count['count'] . ')',
|
'title'=>_('Report queue') . ' (' . $count['count'] . ')',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1761,7 +1762,7 @@
|
|||||||
|
|
||||||
'</fieldset>';
|
'</fieldset>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Manage – ' . sprintf($config['board_abbreviation'], $board['uri']),
|
'title'=>'Manage – ' . sprintf($config['board_abbreviation'], $board['uri']),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1874,7 +1875,7 @@
|
|||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Ban list'),
|
'title'=>_('Ban list'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1892,7 +1893,7 @@
|
|||||||
$body = 'An error occured while trying to flush cache.';
|
$body = 'An error occured while trying to flush cache.';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Flushed',
|
'title'=>'Flushed',
|
||||||
'body'=>'<p style="text-align:center">' . $body . '</p>',
|
'body'=>'<p style="text-align:center">' . $body . '</p>',
|
||||||
@ -1906,7 +1907,7 @@
|
|||||||
$body = '<div class="ban"><h2>Rebuilding…</h2><p>';
|
$body = '<div class="ban"><h2>Rebuilding…</h2><p>';
|
||||||
|
|
||||||
$body .= 'Clearing template cache…<br/>';
|
$body .= 'Clearing template cache…<br/>';
|
||||||
$twig = new Twig_Environment($loader, Array(
|
$twig = new Twig_Environment($loader, array(
|
||||||
'cache' => "{$config['dir']['template']}/cache"
|
'cache' => "{$config['dir']['template']}/cache"
|
||||||
));
|
));
|
||||||
$twig->clearCacheFiles();
|
$twig->clearCacheFiles();
|
||||||
@ -1945,7 +1946,7 @@
|
|||||||
unset($board);
|
unset($board);
|
||||||
modLog('Rebuilt everything');
|
modLog('Rebuilt everything');
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Rebuilt',
|
'title'=>'Rebuilt',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -1962,8 +1963,8 @@
|
|||||||
|
|
||||||
$body = '<fieldset><legend>' . _('Configuration') . '</legend><form action="" method="post"><table style="width:100%">';
|
$body = '<fieldset><legend>' . _('Configuration') . '</legend><form action="" method="post"><table style="width:100%">';
|
||||||
|
|
||||||
$var_force_string = Array('blotter');
|
$var_force_string = array('blotter');
|
||||||
$var_system = Array('version');
|
$var_system = array('version');
|
||||||
|
|
||||||
if(isset($_POST['save_changes'])) {
|
if(isset($_POST['save_changes'])) {
|
||||||
$config_append = '';
|
$config_append = '';
|
||||||
@ -2009,7 +2010,7 @@
|
|||||||
|
|
||||||
if($config['minify_html'])
|
if($config['minify_html'])
|
||||||
$config_append = str_replace("\n", '
', $config_append);
|
$config_append = str_replace("\n", '
', $config_append);
|
||||||
$page = Array();
|
$page = array();
|
||||||
$page['title'] = 'Cannot write to file!';
|
$page['title'] = 'Cannot write to file!';
|
||||||
$page['config'] = $config;
|
$page['config'] = $config;
|
||||||
$page['body'] = '
|
$page['body'] = '
|
||||||
@ -2049,7 +2050,7 @@
|
|||||||
|
|
||||||
$body .= '</table><div style="text-align:center"><input name="save_changes" type="submit" value="Save changes"></div></form></fieldset>';
|
$body .= '</table><div style="text-align:center"><input name="save_changes" type="submit" value="Save changes"></div></form></fieldset>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Configuration'),
|
'title'=>_('Configuration'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -2104,7 +2105,7 @@
|
|||||||
'<a href="?/config/edit">[Edit using web editor]</a>' : '') .
|
'<a href="?/config/edit">[Edit using web editor]</a>' : '') .
|
||||||
'<fieldset><legend>' . _('Configuration') . '</legend><table>' . $data . '</table></fieldset>';
|
'<fieldset><legend>' . _('Configuration') . '</legend><table>' . $data . '</table></fieldset>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>_('Configuration'),
|
'title'=>_('Configuration'),
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -2124,7 +2125,7 @@
|
|||||||
!isset($_POST['subtitle'])
|
!isset($_POST['subtitle'])
|
||||||
) error($config['error']['missedafield']);
|
) error($config['error']['missedafield']);
|
||||||
|
|
||||||
$b = Array(
|
$b = array(
|
||||||
'uri' => $_POST['uri'],
|
'uri' => $_POST['uri'],
|
||||||
'title' => $_POST['title'],
|
'title' => $_POST['title'],
|
||||||
'subtitle' => $_POST['subtitle']
|
'subtitle' => $_POST['subtitle']
|
||||||
@ -2165,7 +2166,7 @@
|
|||||||
openBoard($b['uri']) or error(_("Couldn't open board after creation."));
|
openBoard($b['uri']) or error(_("Couldn't open board after creation."));
|
||||||
|
|
||||||
// Create the posts table
|
// Create the posts table
|
||||||
query(Element('posts.sql', Array('board' => $board['uri']))) or error(db_error());
|
query(Element('posts.sql', array('board' => $board['uri']))) or error(db_error());
|
||||||
|
|
||||||
if($config['cache']['enabled'])
|
if($config['cache']['enabled'])
|
||||||
cache::delete('all_boards');
|
cache::delete('all_boards');
|
||||||
@ -2182,7 +2183,7 @@
|
|||||||
|
|
||||||
// TODO: Statistics, etc, in the dashboard.
|
// TODO: Statistics, etc, in the dashboard.
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'New board',
|
'title'=>'New board',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -2316,7 +2317,7 @@
|
|||||||
'</table>' .
|
'</table>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'body' => $body,
|
'body' => $body,
|
||||||
'title' => 'Edit Post #' . $postID
|
'title' => 'Edit Post #' . $postID
|
||||||
@ -2493,7 +2494,7 @@
|
|||||||
if($global)
|
if($global)
|
||||||
$boards = listBoards();
|
$boards = listBoards();
|
||||||
else
|
else
|
||||||
$boards = Array(Array('uri' => $board['uri']));
|
$boards = array(array('uri' => $board['uri']));
|
||||||
|
|
||||||
$query = '';
|
$query = '';
|
||||||
foreach($boards as $_board) {
|
foreach($boards as $_board) {
|
||||||
@ -2508,7 +2509,7 @@
|
|||||||
if($query->rowCount() < 1)
|
if($query->rowCount() < 1)
|
||||||
error($config['error']['invalidpost']);
|
error($config['error']['invalidpost']);
|
||||||
|
|
||||||
$boards = Array();
|
$boards = array();
|
||||||
while($post = $query->fetch()) {
|
while($post = $query->fetch()) {
|
||||||
openBoard($post['board']);
|
openBoard($post['board']);
|
||||||
$boards[] = $post['board'];
|
$boards[] = $post['board'];
|
||||||
@ -2714,7 +2715,7 @@
|
|||||||
$query->bindValue(':id', $postID, PDO::PARAM_INT);
|
$query->bindValue(':id', $postID, PDO::PARAM_INT);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
$replies = Array();
|
$replies = array();
|
||||||
while($post = $query->fetch()) {
|
while($post = $query->fetch()) {
|
||||||
$post['mod'] = true;
|
$post['mod'] = true;
|
||||||
$post['thread'] = $newID;
|
$post['thread'] = $newID;
|
||||||
@ -2731,7 +2732,7 @@
|
|||||||
$replies[] = $post;
|
$replies[] = $post;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newIDs = Array($postID => $newID);
|
$newIDs = array($postID => $newID);
|
||||||
|
|
||||||
openBoard($targetBoard);
|
openBoard($targetBoard);
|
||||||
foreach($replies as &$post) {
|
foreach($replies as &$post) {
|
||||||
@ -2784,7 +2785,7 @@
|
|||||||
$query->bindValue(':id', $postID, PDO::PARAM_INT);
|
$query->bindValue(':id', $postID, PDO::PARAM_INT);
|
||||||
$query->execute() or error(db_error($query));
|
$query->execute() or error(db_error($query));
|
||||||
|
|
||||||
$post = Array(
|
$post = array(
|
||||||
'mod' => true,
|
'mod' => true,
|
||||||
'subject' => '',
|
'subject' => '',
|
||||||
'email' => '',
|
'email' => '',
|
||||||
@ -2861,7 +2862,7 @@
|
|||||||
'</table>' .
|
'</table>' .
|
||||||
'</form></fieldset>';
|
'</form></fieldset>';
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'Move #' . $postID,
|
'title'=>'Move #' . $postID,
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -2897,7 +2898,7 @@
|
|||||||
|
|
||||||
$body = form_newBan($post['ip'], null, '?/' . sprintf($config['board_path'], $board['uri']) . $config['file_index'], $post['id'], $boardName, !$delete);
|
$body = form_newBan($post['ip'], null, '?/' . sprintf($config['board_path'], $board['uri']) . $config['file_index'], $post['id'], $boardName, !$delete);
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'New ban',
|
'title'=>'New ban',
|
||||||
'body'=>$body,
|
'body'=>$body,
|
||||||
@ -3112,7 +3113,7 @@
|
|||||||
if(hasPermission($config['mod']['ip_banform']))
|
if(hasPermission($config['mod']['ip_banform']))
|
||||||
$body .= form_newBan($ip, null, '?/IP/' . $ip);
|
$body .= form_newBan($ip, null, '?/IP/' . $ip);
|
||||||
|
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=>'IP: ' . $ip,
|
'title'=>'IP: ' . $ip,
|
||||||
'subtitle' => $host,
|
'subtitle' => $host,
|
||||||
@ -3126,4 +3127,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
||||||
|
31
post.php
31
post.php
@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2012 Tinyboard Development Group
|
||||||
|
*/
|
||||||
|
|
||||||
require 'inc/functions.php';
|
require 'inc/functions.php';
|
||||||
require 'inc/display.php';
|
|
||||||
require 'inc/template.php';
|
|
||||||
require 'inc/database.php';
|
|
||||||
require 'inc/user.php';
|
|
||||||
require 'inc/filters.php';
|
|
||||||
|
|
||||||
// Fix for magic quotes
|
// Fix for magic quotes
|
||||||
if (get_magic_quotes_gpc()) {
|
if (get_magic_quotes_gpc()) {
|
||||||
@ -27,7 +27,7 @@
|
|||||||
if($password == '')
|
if($password == '')
|
||||||
error($config['error']['invalidpassword']);
|
error($config['error']['invalidpassword']);
|
||||||
|
|
||||||
$delete = Array();
|
$delete = array();
|
||||||
foreach($_POST as $post => $value) {
|
foreach($_POST as $post => $value) {
|
||||||
if(preg_match('/^delete_(\d+)$/', $post, $m)) {
|
if(preg_match('/^delete_(\d+)$/', $post, $m)) {
|
||||||
$delete[] = (int)$m[1];
|
$delete[] = (int)$m[1];
|
||||||
@ -84,7 +84,7 @@
|
|||||||
if(!isset($_POST['board'], $_POST['password'], $_POST['reason']))
|
if(!isset($_POST['board'], $_POST['password'], $_POST['reason']))
|
||||||
error($config['error']['bot']);
|
error($config['error']['bot']);
|
||||||
|
|
||||||
$report = Array();
|
$report = array();
|
||||||
foreach($_POST as $post => $value) {
|
foreach($_POST as $post => $value) {
|
||||||
if(preg_match('/^delete_(\d+)$/', $post, $m)) {
|
if(preg_match('/^delete_(\d+)$/', $post, $m)) {
|
||||||
$report[] = (int)$m[1];
|
$report[] = (int)$m[1];
|
||||||
@ -150,7 +150,7 @@
|
|||||||
if(!isset($_POST['password']))
|
if(!isset($_POST['password']))
|
||||||
$_POST['password'] = '';
|
$_POST['password'] = '';
|
||||||
|
|
||||||
$post = Array('board' => $_POST['board']);
|
$post = array('board' => $_POST['board']);
|
||||||
|
|
||||||
if(isset($_POST['thread'])) {
|
if(isset($_POST['thread'])) {
|
||||||
$post['op'] = false;
|
$post['op'] = false;
|
||||||
@ -192,7 +192,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(checkSpam(Array($board['uri'], isset($post['thread']) && !($config['quick_reply'] && isset($_POST['quick-reply'])) ? $post['thread'] : null)))
|
if(checkSpam(array($board['uri'], isset($post['thread']) && !($config['quick_reply'] && isset($_POST['quick-reply'])) ? $post['thread'] : null)))
|
||||||
error($config['error']['spam']);
|
error($config['error']['spam']);
|
||||||
|
|
||||||
if($config['robot_enable'] && $config['robot_mute']) {
|
if($config['robot_enable'] && $config['robot_mute']) {
|
||||||
@ -303,9 +303,10 @@
|
|||||||
$size = $_FILES['file']['size'];
|
$size = $_FILES['file']['size'];
|
||||||
if($size > $config['max_filesize'])
|
if($size > $config['max_filesize'])
|
||||||
error(sprintf3($config['error']['filesize'], array(
|
error(sprintf3($config['error']['filesize'], array(
|
||||||
'sz'=>commaize($size),
|
'sz' => number_format($size),
|
||||||
'filesz'=>commaize($size),
|
'filesz' => number_format($size),
|
||||||
'maxsz'=>commaize($config['max_filesize']))));
|
'maxsz' => number_format($config['max_filesize'])
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mod && $mod['type'] >= MOD && preg_match('/^((.+) )?## (.+)$/', $post['name'], $match)) {
|
if($mod && $mod['type'] >= MOD && preg_match('/^((.+) )?## (.+)$/', $post['name'], $match)) {
|
||||||
@ -361,6 +362,8 @@
|
|||||||
error($config['error']['flood']);
|
error($config['error']['flood']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require_once 'inc/filters.php';
|
||||||
|
|
||||||
do_filters($post);
|
do_filters($post);
|
||||||
|
|
||||||
if($post['has_file']) {
|
if($post['has_file']) {
|
||||||
@ -549,7 +552,7 @@
|
|||||||
if(isset($_COOKIE[$config['cookies']['js']]))
|
if(isset($_COOKIE[$config['cookies']['js']]))
|
||||||
$js = json_decode($_COOKIE[$config['cookies']['js']]);
|
$js = json_decode($_COOKIE[$config['cookies']['js']]);
|
||||||
else
|
else
|
||||||
$js = (object) Array();
|
$js = (object) array();
|
||||||
// Tell it to delete the cached post for referer
|
// Tell it to delete the cached post for referer
|
||||||
$js->{$_SERVER['HTTP_REFERER']} = true;
|
$js->{$_SERVER['HTTP_REFERER']} = true;
|
||||||
// Encode and set cookie
|
// Encode and set cookie
|
||||||
@ -580,4 +583,4 @@
|
|||||||
error($config['error']['nopost']);
|
error($config['error']['nopost']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user