PHP8: error.php working better...

This commit is contained in:
towards-a-new-leftypol 2023-08-02 18:18:12 -04:00
parent 1228b2f99d
commit 613fde283b
3 changed files with 25 additions and 14 deletions

View File

@ -49,17 +49,21 @@ function error($message, $priority = true, $debug_stuff = false) {
if ($config['debug']) { if ($config['debug']) {
$debug_stuff=array(); $debug_stuff=array();
if(isset($db_error)){
if (isset($db_error)){
$debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error); $debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error);
} }
$debug_stuff['backtrace'] = debug_backtrace(); $debug_stuff['backtrace'] = debug_backtrace();
$pw = $config['db']['password']; $pw = $config['db']['password'];
$debug_callback = function(&$item) use (&$debug_callback, $pw) {
if (is_array($item)) { $debug_callback = function ($item) use (&$debug_callback, $pw) {
return array_map($debug_callback, $item); if (is_array($item)) {
} return array_map($debug_callback, $item);
return ($item == $pw ? 'hunter2' : $item); }
}; return ($item == $pw ? 'hunter2' : $item);
};
$debug_stuff = array_map($debug_callback, $debug_stuff); $debug_stuff = array_map($debug_callback, $debug_stuff);
} }
} }

View File

@ -503,3 +503,4 @@ $config['filters'][] = array(
$config['global_message'] = '<p><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net" class="redtext"><span class="heading">Matrix</span></a></p><p><a href="ircs://irc.leftychan.net:6697/#leftychan" class="redtext"><span class="heading">IRC Chat</span></a></p><p><a href="mumble://leftychan.net" class="redtext"><span class="heading">Mumble</span></a></p><p><a href="https://t.me/+RegtyzzrE0M1NDMx" class="red text"><span class="heading">Telegram</a></span></p><p><a href="https://discord.gg/AcZeFKXPmZ" class="redtext"><span class="heading">Discord</a></span></p>'; $config['global_message'] = '<p><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net" class="redtext"><span class="heading">Matrix</span></a></p><p><a href="ircs://irc.leftychan.net:6697/#leftychan" class="redtext"><span class="heading">IRC Chat</span></a></p><p><a href="mumble://leftychan.net" class="redtext"><span class="heading">Mumble</span></a></p><p><a href="https://t.me/+RegtyzzrE0M1NDMx" class="red text"><span class="heading">Telegram</a></span></p><p><a href="https://discord.gg/AcZeFKXPmZ" class="redtext"><span class="heading">Discord</a></span></p>';
$config['spam_noticer']['website_name'] = "leftychan_dev"; $config['spam_noticer']['website_name'] = "leftychan_dev";
$config['debug'] = true;

View File

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