diff --git a/inc/functions.php b/inc/functions.php
index 0c45591e..2ac3b3c8 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -57,7 +57,7 @@ function loadConfig() {
require_once('tmp/cache/cache_config.php');
}
- if (isset($config['cache_config']) &&
+ if (isset($config['cache_config']) &&
$config['cache_config'] &&
$config = Cache::get('config_' . $boardsuffix ) ) {
$events = Cache::get('events_' . $boardsuffix );
@@ -76,7 +76,7 @@ function loadConfig() {
else {
$config = array();
- reset_events();
+ reset_events();
$arrays = array(
'db',
@@ -309,7 +309,7 @@ function loadConfig() {
else if (is_callable($config['anonymous'])){
$config['anonymous'] = $config['anonymous']($boardsuffix);
}
-
+
if ($config['debug']) {
if (!isset($debug)) {
$debug = array(
@@ -350,7 +350,7 @@ function define_groups() {
define($group_name, $group_value);
}
}
-
+
ksort($config['mod']['groups']);
}
@@ -388,7 +388,7 @@ function rebuildThemes($action, $boardname = false) {
$config = $_config;
$board = $_board;
- // Reload the locale
+ // Reload the locale
if ($config['locale'] != $current_locale) {
$current_locale = $config['locale'];
init_locale($config['locale']);
@@ -409,7 +409,7 @@ function rebuildThemes($action, $boardname = false) {
$config = $_config;
$board = $_board;
- // Reload the locale
+ // Reload the locale
if ($config['locale'] != $current_locale) {
$current_locale = $config['locale'];
init_locale($config['locale']);
@@ -561,7 +561,7 @@ function purge($uri) {
global $config, $debug;
// Fix for Unicode
- $uri = rawurlencode($uri);
+ $uri = rawurlencode($uri);
$noescape = "/!~*()+:";
$noescape = preg_split('//', $noescape);
@@ -757,7 +757,7 @@ function listBoards($just_uri = false) {
$boards[] = $board;
}
}
-
+
if ($config['cache']['enabled'])
cache::set($cache_name, $boards);
@@ -823,10 +823,10 @@ function displayBan($ban) {
$post = new Thread($ban['post'], null, false, false);
}
}
-
+
$denied_appeals = array();
$pending_appeal = false;
-
+
if ($config['ban_appeals']) {
$query = query("SELECT `time`, `denied` FROM ``ban_appeals`` WHERE `ban_id` = " . (int)$ban['id']) or error(db_error());
while ($ban_appeal = $query->fetch(PDO::FETCH_ASSOC)) {
@@ -837,7 +837,7 @@ function displayBan($ban) {
}
}
}
-
+
// Show banned page and exit
die(
Element('page.html', array(
@@ -862,7 +862,7 @@ function checkBan($board = false) {
if (!isset($_SERVER['REMOTE_ADDR'])) {
// Server misconfiguration
return;
- }
+ }
if (event('check-ban', $board))
return true;
@@ -877,7 +877,7 @@ function checkBan($board = false) {
foreach ($ips as $ip) {
$bans = Bans::find($_SERVER['REMOTE_ADDR'], $board, $config['show_modname']);
-
+
foreach ($bans as &$ban) {
if ($ban['expires'] && $ban['expires'] < time()) {
Bans::delete($ban['id']);
@@ -906,9 +906,9 @@ function checkBan($board = false) {
if (time() - $last_time_purged < $config['purge_bans'] )
return;
}
-
+
Bans::purge();
-
+
if ($config['cache']['enabled'])
cache::set('purged_bans_last', time());
}
@@ -965,7 +965,7 @@ function threadExists($id) {
function insertFloodPost(array $post) {
global $board;
-
+
$query = prepare("INSERT INTO ``flood`` VALUES (NULL, :ip, :board, :time, :posthash, :filehash, :isreply)");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':board', $board['uri']);
@@ -1006,7 +1006,7 @@ function post(array $post) {
$query->bindValue(':body', $post['body']);
$query->bindValue(':body_nomarkup', $post['body_nomarkup']);
$query->bindValue(':time', isset($post['time']) ? $post['time'] : time(), PDO::PARAM_INT);
- $query->bindValue(':password', $post['password']);
+ $query->bindValue(':password', $post['password']);
$query->bindValue(':ip', isset($post['ip']) ? $post['ip'] : $_SERVER['REMOTE_ADDR']);
if ($post['op'] && $post['mod'] && isset($post['sticky']) && $post['sticky']) {
@@ -1186,7 +1186,7 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) {
// Delete posts and maybe replies
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
event('delete', $post);
-
+
$thread_id = $post['thread'];
if (!$post['thread']) {
// Delete thread HTML page
@@ -1287,7 +1287,7 @@ function clean($pid = false) {
$query = prepare(sprintf("SELECT `id` AS `thread_id`, (SELECT COUNT(`id`) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset, 9001", $board['uri'], $board['uri']));
$query->bindValue(':offset', $offset, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
-
+
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
if ($post['reply_count'] < $config['early_404_replies']) {
deletePost($post['thread_id'], false, false);
@@ -1326,7 +1326,7 @@ function index($page, $mod=false, $brief = false) {
return false;
$threads = array();
-
+
while ($th = $query->fetch(PDO::FETCH_ASSOC)) {
$thread = new Thread($th, $mod ? '?/' : $config['root'], $mod);
@@ -1377,7 +1377,7 @@ function index($page, $mod=false, $brief = false) {
$thread->omitted = $omitted['post_count'] - ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']);
$thread->omitted_images = $omitted['image_count'] - $num_images;
}
-
+
$threads[] = $thread;
if (!$brief) {
@@ -1594,7 +1594,7 @@ function checkMute() {
// Not expired yet
error(sprintf($config['error']['youaremuted'], $mute['time'] + $mutetime - time()));
} else {
- // Already expired
+ // Already expired
return;
}
}
@@ -1883,8 +1883,8 @@ function wordfilters(&$body) {
foreach ($config['wordfilters'] as $filter) {
if (isset($filter[3]) && $filter[3]) {
- $refilter = $filter[0];
- if (strncmp($filter[0], "/", 1) !== 0)
+ $refilter = $filter[0];
+ if (strncmp($filter[0], "/", 1) !== 0)
{
$refilter = "/.*" . $filter[0] . "/";
}
@@ -1895,8 +1895,8 @@ function wordfilters(&$body) {
return $match;
} else {
if (isset($filter[2]) && $filter[2]) {
- $refilter = $filter[0];
- if (strncmp($filter[0], "/", 1) !== 0)
+ $refilter = $filter[0];
+ if (strncmp($filter[0], "/", 1) !== 0)
{
$refilter = "/.*" . $filter[0] . "/";
}
@@ -1912,7 +1912,7 @@ function wordfilters(&$body) {
}
}
, $body);
- } else {
+ } else {
if (isset($filter[2]) && $filter[2]) {
if (is_callable($filter[1]))
$body = preg_replace_callback($filter[0], $filter[1], $body);
@@ -1958,7 +1958,7 @@ function markup_url($matches) {
'rel' => 'nofollow',
'target' => '_blank',
);
-
+
event('markup-url', $link);
$link = (array)$link;
@@ -1993,7 +1993,7 @@ function newline_to_full_stop($body) {
function extract_modifiers($body) {
$modifiers = array();
-
+
if (preg_match_all('@
".str_replace(array("\n","\t"), array(" "," "), htmlspecialchars($code, ENT_COMPAT, "UTF-8", false)).""; - + $body = str_replace("
", $code, $body);
}
}
@@ -2323,7 +2323,7 @@ function utf8tohtml($utf8) {
}
function ordutf8($string, &$offset) {
- $code = ord(substr($string, $offset,1));
+ $code = ord(substr($string, $offset,1));
if ($code >= 128) { // otherwise 0xxxxxxx
if ($code < 224)
$bytesnumber = 2; // 110xxxxx
@@ -2387,7 +2387,7 @@ function buildThread($id, $return = false, $mod = false) {
// Check if any posts were found
if (!isset($thread))
error($config['error']['nonexistant']);
-
+
$hasnoko50 = $thread->postCount() >= $config['noko50_min'];
$antibot = $mod || $return ? false : create_antibot($board['uri'], $id);
@@ -2438,16 +2438,16 @@ function buildThread($id, $return = false, $mod = false) {
function buildThread50($id, $return = false, $mod = false, $thread = null, $antibot = false) {
global $board, $config, $build_pages;
$id = round($id);
-
+
if ($antibot)
$antibot->reset();
-
+
if (!$thread) {
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id` DESC LIMIT :limit", $board['uri']));
$query->bindValue(':id', $id, PDO::PARAM_INT);
$query->bindValue(':limit', $config['noko50_count']+1, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
-
+
$num_images = 0;
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
if (!isset($thread)) {
@@ -2455,7 +2455,7 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
} else {
if ($post['files'])
$num_images += $post['num_files'];
-
+
$thread->add(new Post($post, $mod ? '?/' : $config['root'], $mod));
}
}
@@ -2470,10 +2470,10 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
SELECT SUM(`num_files`) FROM ``posts_%s`` WHERE `files` IS NOT NULL AND `thread` = :thread", $board['uri'], $board['uri']));
$count->bindValue(':thread', $id, PDO::PARAM_INT);
$count->execute() or error(db_error($count));
-
+
$c = $count->fetch();
$thread->omitted = $c['num'] - $config['noko50_count'];
-
+
$c = $count->fetch();
$thread->omitted_images = $c['num'] - $num_images;
}
@@ -2486,13 +2486,13 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
$thread->omitted += count($allPosts) - count($thread->posts);
foreach ($allPosts as $index => $post) {
if ($index == count($allPosts)-count($thread->posts))
- break;
+ break;
if ($post->files)
$thread->omitted_images += $post->num_files;
}
}
- $hasnoko50 = $thread->postCount() >= $config['noko50_min'];
+ $hasnoko50 = $thread->postCount() >= $config['noko50_min'];
$body = Element('thread.html', array(
'board' => $board,
@@ -2506,7 +2506,7 @@ function buildThread50($id, $return = false, $mod = false, $thread = null, $anti
'antibot' => $mod ? false : ($antibot ? $antibot : create_antibot($board['uri'], $id)),
'boardlist' => createBoardlist($mod),
'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index'])
- ));
+ ));
if ($return) {
return $body;
@@ -2585,7 +2585,7 @@ function hcf($a, $b){
$b = $a-$b;
$a = $a-$b;
}
- if ($b==(round($b/$a))*$a)
+ if ($b==(round($b/$a))*$a)
$gcd=$a;
else {
for ($i=round($a/2);$i;$i--) {
@@ -2880,7 +2880,7 @@ function process_filenames($file, $board_dir, $multiple, $i){
if ($multiple)
$file['file_id'] .= "-$i";
-
+
$file['file'] = $board_dir . $config['dir']['img'] . $file['file_id'] . '.' . $file['extension'];
$file['thumb'] = $board_dir . $config['dir']['thumb'] . $file['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension']);
return $file;