From 361a5babef8760591d29d3c449b1d2831a9d424d Mon Sep 17 00:00:00 2001 From: towards-a-new-leftypol Date: Sun, 27 Dec 2020 15:14:34 -0500 Subject: [PATCH] Remove print statements - comment out print_err function behavior (something I was using for debugging before, but I'm keeping the function for future debugging) --- inc/anti-bot.php | 5 ++--- inc/functions.php | 31 +++---------------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/inc/anti-bot.php b/inc/anti-bot.php index ab321ccd..d2b6d467 100644 --- a/inc/anti-bot.php +++ b/inc/anti-bot.php @@ -12,9 +12,8 @@ $logfile = "/tmp/lainchan_err.out"; file_put_contents($logfile, "\n\nSTART\n\n", FILE_APPEND); function print_err($s) { - global $logfile; - - file_put_contents($logfile, $s . "\n", FILE_APPEND); + // global $logfile; + // file_put_contents($logfile, $s . "\n", FILE_APPEND); } function print_err2($s) { diff --git a/inc/functions.php b/inc/functions.php index 736b4892..e276ac3f 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -379,26 +379,21 @@ function create_antibot($board, $thread = null) { function rebuildThemes($action, $boardname = false) { global $config, $board, $current_locale; - print_err("rebuildThemes"); // Save the global variables $_config = $config; $_board = $board; - print_err("list themes"); // List themes if ($themes = Cache::get("themes")) { // OK, we already have themes loaded - print_err("themes loaded from cache"); } 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()); $themes = array(); while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { - print_err("theme found in db"); $themes[] = $theme; } @@ -454,7 +449,6 @@ function loadThemeConfig($_theme) { function rebuildTheme($theme, $action, $board = false) { global $config, $_theme; $_theme = $theme; - print_err("rebuildTheme with \$theme as " . $theme); $theme = loadThemeConfig($_theme); @@ -1004,7 +998,6 @@ function insertFloodPost(array $post) { function post(array $post) { 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'])); // Basic stuff @@ -1093,13 +1086,10 @@ function post(array $post) { } if (!$query->execute()) { - print_err("Post DB ERROR " . print_r($query, true)); undoImage($post); error(db_error($query)); } - print_err("Post function DONE"); - return $pdo->lastInsertId(); } @@ -1945,8 +1935,6 @@ function remove_modifiers($body) { function markup(&$body, $track_cites = false, $op = false) { global $board, $config, $markup_urls; - print_err("Markup BEGIN"); - $modifiers = extract_modifiers($body); $body = preg_replace('@(.+?)@us', '', $body); @@ -1956,13 +1944,9 @@ function markup(&$body, $track_cites = false, $op = false) { return array(); } - print_err("Markup utf start"); - $body = str_replace("\r", '', $body); $body = utf8tohtml($body); - print_err("Markup utf OK"); - if (mysql_version() < 50503) $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); if ($num_links > $config['max_links']) { - print_err("Error too many links"); error($config['error']['toomanylinks']); } } @@ -2014,8 +1997,6 @@ function markup(&$body, $track_cites = false, $op = false) { $tracked_cites = array(); - print_err("Cites BEGIN"); - // Cites 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']) { @@ -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 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']) { @@ -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); $body = preg_replace("/^\s*>.*$/m", '$0', $body); @@ -2299,11 +2275,10 @@ function strip_combining_chars($str) { function buildThread($id, $return = false, $mod = false) { global $board, $config, $build_pages; $id = round($id); - print_err("buildThread start"); - if (event('build-thread', $id)) { - return; - } + if (event('build-thread', $id)) { + return; + } if ($config['cache']['enabled'] && !$mod) { // Clear cache