|
@ -379,26 +379,21 @@ function create_antibot($board, $thread = null) { |
|
|
|
|
|
|
|
|
function rebuildThemes($action, $boardname = false) { |
|
|
function rebuildThemes($action, $boardname = false) { |
|
|
global $config, $board, $current_locale; |
|
|
global $config, $board, $current_locale; |
|
|
print_err("rebuildThemes"); |
|
|
|
|
|
|
|
|
|
|
|
// Save the global variables |
|
|
// Save the global variables |
|
|
$_config = $config; |
|
|
$_config = $config; |
|
|
$_board = $board; |
|
|
$_board = $board; |
|
|
|
|
|
|
|
|
print_err("list themes"); |
|
|
|
|
|
// List themes |
|
|
// List themes |
|
|
if ($themes = Cache::get("themes")) { |
|
|
if ($themes = Cache::get("themes")) { |
|
|
// OK, we already have themes loaded |
|
|
// OK, we already have themes loaded |
|
|
print_err("themes loaded from cache"); |
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
print_err("querying db for themes"); |
|
|
|
|
|
$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()); |
|
|
|
|
|
|
|
|
$themes = array(); |
|
|
$themes = array(); |
|
|
|
|
|
|
|
|
while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { |
|
|
while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { |
|
|
print_err("theme found in db"); |
|
|
|
|
|
$themes[] = $theme; |
|
|
$themes[] = $theme; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -454,7 +449,6 @@ function loadThemeConfig($_theme) { |
|
|
function rebuildTheme($theme, $action, $board = false) { |
|
|
function rebuildTheme($theme, $action, $board = false) { |
|
|
global $config, $_theme; |
|
|
global $config, $_theme; |
|
|
$_theme = $theme; |
|
|
$_theme = $theme; |
|
|
print_err("rebuildTheme with \$theme as " . $theme); |
|
|
|
|
|
|
|
|
|
|
|
$theme = loadThemeConfig($_theme); |
|
|
$theme = loadThemeConfig($_theme); |
|
|
|
|
|
|
|
@ -1004,7 +998,6 @@ function insertFloodPost(array $post) { |
|
|
|
|
|
|
|
|
function post(array $post) { |
|
|
function post(array $post) { |
|
|
global $pdo, $board,$config; |
|
|
global $pdo, $board,$config; |
|
|
print_err("Post function START"); |
|
|
|
|
|
$query = prepare(sprintf("INSERT INTO ``posts_%s`` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :files, :num_files, :filehash, :password, :ip, :sticky, :locked, :cycle, 0, :embed, :slug)", $board['uri'])); |
|
|
$query = prepare(sprintf("INSERT INTO ``posts_%s`` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :files, :num_files, :filehash, :password, :ip, :sticky, :locked, :cycle, 0, :embed, :slug)", $board['uri'])); |
|
|
|
|
|
|
|
|
// Basic stuff |
|
|
// Basic stuff |
|
@ -1093,13 +1086,10 @@ function post(array $post) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (!$query->execute()) { |
|
|
if (!$query->execute()) { |
|
|
print_err("Post DB ERROR " . print_r($query, true)); |
|
|
|
|
|
undoImage($post); |
|
|
undoImage($post); |
|
|
error(db_error($query)); |
|
|
error(db_error($query)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
print_err("Post function DONE"); |
|
|
|
|
|
|
|
|
|
|
|
return $pdo->lastInsertId(); |
|
|
return $pdo->lastInsertId(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1945,8 +1935,6 @@ function remove_modifiers($body) { |
|
|
function markup(&$body, $track_cites = false, $op = false) { |
|
|
function markup(&$body, $track_cites = false, $op = false) { |
|
|
global $board, $config, $markup_urls; |
|
|
global $board, $config, $markup_urls; |
|
|
|
|
|
|
|
|
print_err("Markup BEGIN"); |
|
|
|
|
|
|
|
|
|
|
|
$modifiers = extract_modifiers($body); |
|
|
$modifiers = extract_modifiers($body); |
|
|
|
|
|
|
|
|
$body = preg_replace('@<tinyboard (?!escape )([\w\s]+)>(.+?)</tinyboard>@us', '', $body); |
|
|
$body = preg_replace('@<tinyboard (?!escape )([\w\s]+)>(.+?)</tinyboard>@us', '', $body); |
|
@ -1956,13 +1944,9 @@ function markup(&$body, $track_cites = false, $op = false) { |
|
|
return array(); |
|
|
return array(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
print_err("Markup utf start"); |
|
|
|
|
|
|
|
|
|
|
|
$body = str_replace("\r", '', $body); |
|
|
$body = str_replace("\r", '', $body); |
|
|
$body = utf8tohtml($body); |
|
|
$body = utf8tohtml($body); |
|
|
|
|
|
|
|
|
print_err("Markup utf OK"); |
|
|
|
|
|
|
|
|
|
|
|
if (mysql_version() < 50503) |
|
|
if (mysql_version() < 50503) |
|
|
$body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); |
|
|
$body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); |
|
|
|
|
|
|
|
@ -1994,7 +1978,6 @@ function markup(&$body, $track_cites = false, $op = false) { |
|
|
$num_links); |
|
|
$num_links); |
|
|
|
|
|
|
|
|
if ($num_links > $config['max_links']) { |
|
|
if ($num_links > $config['max_links']) { |
|
|
print_err("Error too many links"); |
|
|
|
|
|
error($config['error']['toomanylinks']); |
|
|
error($config['error']['toomanylinks']); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -2014,8 +1997,6 @@ function markup(&$body, $track_cites = false, $op = false) { |
|
|
|
|
|
|
|
|
$tracked_cites = array(); |
|
|
$tracked_cites = array(); |
|
|
|
|
|
|
|
|
print_err("Cites BEGIN"); |
|
|
|
|
|
|
|
|
|
|
|
// Cites |
|
|
// Cites |
|
|
if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)((?=[\s,.)?!])|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { |
|
|
if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)((?=[\s,.)?!])|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { |
|
|
if (count($cites[0]) > $config['max_cites']) { |
|
|
if (count($cites[0]) > $config['max_cites']) { |
|
@ -2063,9 +2044,6 @@ function markup(&$body, $track_cites = false, $op = false) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
print_err("Cites END"); |
|
|
|
|
|
print_err("Cross board linking BEGIN"); |
|
|
|
|
|
|
|
|
|
|
|
// Cross-board linking |
|
|
// Cross-board linking |
|
|
if (preg_match_all('/(^|\s)>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?((?=[\s,.)?!])|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { |
|
|
if (preg_match_all('/(^|\s)>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?((?=[\s,.)?!])|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { |
|
|
if (count($cites[0]) > $config['max_cites']) { |
|
|
if (count($cites[0]) > $config['max_cites']) { |
|
@ -2201,8 +2179,6 @@ function markup(&$body, $track_cites = false, $op = false) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
print_err("Cross board linking End"); |
|
|
|
|
|
|
|
|
|
|
|
$tracked_cites = array_unique($tracked_cites, SORT_REGULAR); |
|
|
$tracked_cites = array_unique($tracked_cites, SORT_REGULAR); |
|
|
|
|
|
|
|
|
$body = preg_replace("/^\s*>.*$/m", '<span class="quote">$0</span>', $body); |
|
|
$body = preg_replace("/^\s*>.*$/m", '<span class="quote">$0</span>', $body); |
|
@ -2299,11 +2275,10 @@ function strip_combining_chars($str) { |
|
|
function buildThread($id, $return = false, $mod = false) { |
|
|
function buildThread($id, $return = false, $mod = false) { |
|
|
global $board, $config, $build_pages; |
|
|
global $board, $config, $build_pages; |
|
|
$id = round($id); |
|
|
$id = round($id); |
|
|
print_err("buildThread start"); |
|
|
|
|
|
|
|
|
|
|
|
if (event('build-thread', $id)) { |
|
|
if (event('build-thread', $id)) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($config['cache']['enabled'] && !$mod) { |
|
|
if ($config['cache']['enabled'] && !$mod) { |
|
|
// Clear cache |
|
|
// Clear cache |
|
|