From 96a4c4518693f56a282949220fb9c49c009bf21b Mon Sep 17 00:00:00 2001 From: Graham Cole <chckens@sucs.org> Date: Sun, 27 Jan 2008 00:23:31 +0000 Subject: [PATCH] merge SUCS punbb customisations --- lib/punbb/admin_index.php | 2 +- lib/punbb/admin_maintenance.php | 2 +- lib/punbb/extern.php | 10 +-- lib/punbb/footer.php | 4 +- lib/punbb/header.php | 2 +- lib/punbb/include/cache.php | 2 +- lib/punbb/include/common.php | 9 ++- lib/punbb/include/dblayer/pgsql.php | 2 +- lib/punbb/include/email.php | 2 +- lib/punbb/include/functions.php | 93 +++++++++++++++++++--- lib/punbb/include/parser.php | 2 +- lib/punbb/include/search_idx.php | 2 +- lib/punbb/include/template/admin.tpl | 12 --- lib/punbb/include/template/help.tpl | 12 --- lib/punbb/include/template/main.tpl | 11 --- lib/punbb/include/template/maintenance.tpl | 12 --- lib/punbb/include/template/redirect.tpl | 12 --- lib/punbb/install.php | 8 +- lib/punbb/login.php | 2 +- lib/punbb/profile.php | 2 +- lib/punbb/register.php | 2 +- lib/punbb/search.php | 2 +- lib/punbb/viewforum.php | 2 +- lib/punbb/viewtopic.php | 4 +- 24 files changed, 114 insertions(+), 99 deletions(-) diff --git a/lib/punbb/admin_index.php b/lib/punbb/admin_index.php index b5f8f16..e3df4de 100644 --- a/lib/punbb/admin_index.php +++ b/lib/punbb/admin_index.php @@ -71,7 +71,7 @@ else if ($action == 'phpinfo' && $pun_user['g_id'] == PUN_ADMIN) message('The PHP function phpinfo() has been disabled on this server.'); phpinfo(); - exit; + pun_exit(); } diff --git a/lib/punbb/admin_maintenance.php b/lib/punbb/admin_maintenance.php index 033928f..34e4353 100644 --- a/lib/punbb/admin_maintenance.php +++ b/lib/punbb/admin_maintenance.php @@ -125,7 +125,7 @@ Rebuilding index … This might be a good time to put on some coffee :-)<br $db->end_transaction(); $db->close(); - exit('<script type="text/javascript">window.location="admin_maintenance.php'.$query_str.'"</script><br />JavaScript redirect unsuccessful. Click <a href="admin_maintenance.php'.$query_str.'">here</a> to continue.'); + pun_exit('<script type="text/javascript">window.location="admin_maintenance.php'.$query_str.'"</script><br />JavaScript redirect unsuccessful. Click <a href="admin_maintenance.php'.$query_str.'">here</a> to continue.'); } diff --git a/lib/punbb/extern.php b/lib/punbb/extern.php index 212b752..908dea2 100644 --- a/lib/punbb/extern.php +++ b/lib/punbb/extern.php @@ -113,7 +113,7 @@ define('PUN_ROOT', './'); // If PUN isn't defined, config.php is missing or corrupt if (!defined('PUN')) - exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.'); + pun_exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run install.php to install PunBB first.'); // Make sure PHP reports all errors except E_NOTICE @@ -141,20 +141,20 @@ if (!defined('PUN_CONFIG_LOADED')) // Make sure we (guests) have permission to read the forums $result = $db->query('SELECT g_read_board FROM '.$db->prefix.'groups WHERE g_id=3') or error('Unable to fetch group info', __FILE__, __LINE__, $db->error()); if ($db->result($result) == '0') - exit('No permission'); + pun_exit('No permission'); // Attempt to load the common language file @include PUN_ROOT.'lang/'.$pun_config['o_default_lang'].'/common.php'; if (!isset($lang_common)) - exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.'); + pun_exit('There is no valid language pack \''.$pun_config['o_default_lang'].'\' installed. Please reinstall a language of that name.'); // Check if we are to display a maintenance message if ($pun_config['o_maintenance'] && !defined('PUN_TURN_OFF_MAINT')) maintenance_message(); if (!isset($_GET['action'])) - exit('No parameters supplied. See extern.php for instructions.'); + pun_exit('No parameters supplied. See extern.php for instructions.'); // @@ -327,4 +327,4 @@ else if ($_GET['action'] == 'stats') else - exit('Bad request'); + pun_exit('Bad request'); diff --git a/lib/punbb/footer.php b/lib/punbb/footer.php index 858dd18..d1d8a52 100644 --- a/lib/punbb/footer.php +++ b/lib/punbb/footer.php @@ -25,7 +25,7 @@ // Make sure no one attempts to run this script "directly" if (!defined('PUN')) - exit; + pun_exit(); $tpl_temp = trim(ob_get_contents()); $tpl_main = str_replace('<pun_main>', $tpl_temp, $tpl_main); @@ -143,4 +143,4 @@ ob_end_clean(); $db->close(); // Spit out the page -exit($tpl_main); +pun_exit($tpl_main); diff --git a/lib/punbb/header.php b/lib/punbb/header.php index e8225c8..add4cd0 100644 --- a/lib/punbb/header.php +++ b/lib/punbb/header.php @@ -25,7 +25,7 @@ // Make sure no one attempts to run this script "directly" if (!defined('PUN')) - exit; + pun_exit(); // Send no-cache headers header('Expires: Thu, 21 Jul 1977 07:30:00 GMT'); // When yours truly first set eyes on this world! :) diff --git a/lib/punbb/include/cache.php b/lib/punbb/include/cache.php index e8114a8..12bb1c1 100644 --- a/lib/punbb/include/cache.php +++ b/lib/punbb/include/cache.php @@ -25,7 +25,7 @@ // Make sure no one attempts to run this script "directly" if (!defined('PUN')) - exit; + pun_exit(); // diff --git a/lib/punbb/include/common.php b/lib/punbb/include/common.php index 8d0a5eb..1a1292f 100644 --- a/lib/punbb/include/common.php +++ b/lib/punbb/include/common.php @@ -30,7 +30,7 @@ //define('PUN_SHOW_QUERIES', 1); if (!defined('PUN_ROOT')) - exit('The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.'); + pun_exit('The constant PUN_ROOT must be defined and point to a valid PunBB installation root directory.'); // Load the functions script @@ -44,7 +44,7 @@ unregister_globals(); // If PUN isn't defined, config.php is missing or corrupt if (!defined('PUN')) - exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run <a href="install.php">install.php</a> to install PunBB first.'); + pun_exit('The file \'config.php\' doesn\'t exist or is corrupt. Please run <a href="install.php">install.php</a> to install PunBB first.'); // Record the start time (will be used to calculate the generation time for the page) @@ -117,12 +117,13 @@ if (!defined('PUN_DISABLE_BUFFERING')) // Check/update/set cookie and fetch user info $pun_user = array(); -check_cookie($pun_user); +//check_cookie($pun_user); +auth_user($pun_user); // Attempt to load the common language file @include PUN_ROOT.'lang/'.$pun_user['language'].'/common.php'; if (!isset($lang_common)) - exit('There is no valid language pack \''.pun_htmlspecialchars($pun_user['language']).'\' installed. Please reinstall a language of that name.'); + pun_exit('There is no valid language pack \''.pun_htmlspecialchars($pun_user['language']).'\' installed. Please reinstall a language of that name.'); // Check if we are to display a maintenance message if ($pun_config['o_maintenance'] && $pun_user['g_id'] > PUN_ADMIN && !defined('PUN_TURN_OFF_MAINT')) diff --git a/lib/punbb/include/dblayer/pgsql.php b/lib/punbb/include/dblayer/pgsql.php index cd1c1a9..90783a2 100644 --- a/lib/punbb/include/dblayer/pgsql.php +++ b/lib/punbb/include/dblayer/pgsql.php @@ -25,7 +25,7 @@ // Make sure we have built in support for PostgreSQL if (!function_exists('pg_connect')) - exit('This PHP environment doesn\'t have PostgreSQL support built in. PostgreSQL support is required if you want to use a PostgreSQL database to run this forum. Consult the PHP documentation for further assistance.'); + pun_exit('This PHP environment doesn\'t have PostgreSQL support built in. PostgreSQL support is required if you want to use a PostgreSQL database to run this forum. Consult the PHP documentation for further assistance.'); class DBLayer diff --git a/lib/punbb/include/email.php b/lib/punbb/include/email.php index 425956e..a8586d7 100644 --- a/lib/punbb/include/email.php +++ b/lib/punbb/include/email.php @@ -25,7 +25,7 @@ // Make sure no one attempts to run this script "directly" if (!defined('PUN')) - exit; + pun_exit(); // diff --git a/lib/punbb/include/functions.php b/lib/punbb/include/functions.php index fd6cd01..7f402e6 100644 --- a/lib/punbb/include/functions.php +++ b/lib/punbb/include/functions.php @@ -22,6 +22,79 @@ ************************************************************************/ +// +// SUCS specific functions +// + +// because killing off PHP is a little inconsiderate +function pun_exit($spew="") +{ + echo $spew; + throw new Exception("pun_exit"); +} + +function auth_user(&$pun_user) +{ + global $db, $pun_config, $session; + + if ($session->loggedin) { + $query = 'SELECT u.*, g.*, o.logged, o.idle FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.user_id=u.id WHERE u.username=\''.$session->username.'\''; + + $result = $db->query($query) or error('Unable to fetch user information', __FILE__, __LINE__, $db->error()); + $pun_user = $db->fetch_assoc($result); + $now = time(); + + if (!isset($pun_user['id'])) { + //Logged in, first-time visitor + $initial_group_id = $pun_config['o_default_user_group']; + $password_hash = pun_hash(random_pass($len)); + $email1 = $session->username."@sucs.org"; + // default to hide e-mail address, allow form e-mail + $email_setting = "1"; + $save_pass = "0"; + $timezone = "0"; + $language = $pun_config['o_default_lang']; + + $db->query('INSERT INTO '.$db->prefix.'users (username, group_id, password, email, email_setting, save_pass, timezone, language, style, registered, registration_ip, last_visit) VALUES (\''.$session->username.'\', '.$initial_group_id.', \''.$password_hash.'\', \''.$email1.'\', '.$email_setting.', '.$save_pass.', '.$timezone.' , \''.$db->escape($language).'\', \''.$pun_config['o_default_style'].'\', '.$now.', \''.get_remote_address().'\', '.$now.')') or error('Unable to create user', __FILE__, __LINE__, $db->error()); + + // fetch newly-inserted details + $result = $db->query($query) or error('Unable to fetch user information', __FILE__, __LINE__, $db->error()); + $pun_user = $db->fetch_assoc($result); + } + + // either the data was there all along, or it should be there now, so let's say we're logged in + $pun_user['is_guest'] = false; + if (!$pun_user['disp_topics']) + $pun_user['disp_topics'] = $pun_config['o_disp_topics_default']; + if (!$pun_user['disp_posts']) + $pun_user['disp_posts'] = $pun_config['o_disp_posts_default']; + + // Define this if you want this visit to affect the online list and the users last visit data + if (!defined('PUN_QUIET_VISIT')) + { + // Update the online list + if (!$pun_user['logged']) + $db->query('INSERT INTO '.$db->prefix.'online (user_id, ident, logged) VALUES('.$pun_user['id'].', \''.$db->escape($pun_user['username']).'\', '.$now.')') or error('Unable to insert into online list', __FILE__, __LINE__, $db->error()); + else + { + // Special case: We've timed out, but no other user has browsed the forums since we timed out + if ($pun_user['logged'] < ($now-$pun_config['o_timeout_visit'])) + { + $db->query('UPDATE '.$db->prefix.'users SET last_visit='.$pun_user['logged'].' WHERE id='.$pun_user['id']) or error('Unable to update user visit data', __FILE__, __LINE__, $db->error()); + $pun_user['last_visit'] = $pun_user['logged']; + } + + $idle_sql = ($pun_user['idle'] == '1') ? ', idle=0' : ''; + $db->query('UPDATE '.$db->prefix.'online SET logged='.$now.$idle_sql.' WHERE user_id='.$pun_user['id']) or error('Unable to update online list', __FILE__, __LINE__, $db->error()); + } + } + + } else { + //Not logged in + set_default_user(); + } +} + // // Cookie stuff! // @@ -124,7 +197,7 @@ function set_default_user() // Fetch guest user $result = $db->query('SELECT u.*, g.*, o.logged FROM '.$db->prefix.'users AS u INNER JOIN '.$db->prefix.'groups AS g ON u.group_id=g.g_id LEFT JOIN '.$db->prefix.'online AS o ON o.ident=\''.$remote_addr.'\' WHERE u.id=1') or error('Unable to fetch guest information', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) - exit('Unable to fetch guest information. The table \''.$db->prefix.'users\' must contain an entry with id = 1 that represents anonymous users.'); + pun_exit('Unable to fetch guest information. The table \''.$db->prefix.'users\' must contain an entry with id = 1 that represents anonymous users.'); $pun_user = $db->fetch_assoc($result); @@ -282,8 +355,8 @@ function generate_navlinks() if ($pun_user['g_search'] == '1') $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; - $links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>'; - $links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>'; +// $links[] = '<li id="navregister"><a href="register.php">'.$lang_common['Register'].'</a>'; +// $links[] = '<li id="navlogin"><a href="login.php">'.$lang_common['Login'].'</a>'; $info = $lang_common['Not logged in']; } @@ -295,14 +368,14 @@ function generate_navlinks() $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>'; - $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; +// $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; } else { $links[] = '<li id="navsearch"><a href="search.php">'.$lang_common['Search'].'</a>'; $links[] = '<li id="navprofile"><a href="profile.php?id='.$pun_user['id'].'">'.$lang_common['Profile'].'</a>'; $links[] = '<li id="navadmin"><a href="admin_index.php">'.$lang_common['Admin'].'</a>'; - $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; +// $links[] = '<li id="navlogout"><a href="login.php?action=out&id='.$pun_user['id'].'">'.$lang_common['Logout'].'</a>'; } } @@ -838,7 +911,7 @@ function maintenance_message() // Close the db connection (and free up any result data) $db->close(); - exit($tpl_maint); + pun_exit($tpl_maint); } @@ -935,7 +1008,7 @@ function redirect($destination_url, $message) // Close the db connection (and free up any result data) $db->close(); - exit($tpl_redir); + pun_exit($tpl_redir); } @@ -1006,7 +1079,7 @@ H2 {MARGIN: 0; COLOR: #FFFFFF; BACKGROUND-COLOR: #B84623; FONT-SIZE: 1.1em; PADD if ($db_error) $GLOBALS['db']->close(); - exit; + pun_exit(); } // DEBUG FUNCTIONS BELOW @@ -1076,7 +1149,7 @@ function unregister_globals() // Prevent script.php?GLOBALS[foo]=bar if (isset($_REQUEST['GLOBALS']) || isset($_FILES['GLOBALS'])) - exit('I\'ll have a steak sandwich and... a steak sandwich.'); + pun_exit('I\'ll have a steak sandwich and... a steak sandwich.'); // Variables that shouldn't be unset $no_unset = array('GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES'); @@ -1110,5 +1183,5 @@ function dump() } echo '</pre>'; - exit; + pun_exit(); } diff --git a/lib/punbb/include/parser.php b/lib/punbb/include/parser.php index 4c4a778..7b8d524 100644 --- a/lib/punbb/include/parser.php +++ b/lib/punbb/include/parser.php @@ -24,7 +24,7 @@ // Make sure no one attempts to run this script "directly" if (!defined('PUN')) - exit; + pun_exit(); // Here you can add additional smilies if you like (please note that you must escape singlequote and backslash) diff --git a/lib/punbb/include/search_idx.php b/lib/punbb/include/search_idx.php index 34c279d..5b12cda 100644 --- a/lib/punbb/include/search_idx.php +++ b/lib/punbb/include/search_idx.php @@ -29,7 +29,7 @@ // Make sure no one attempts to run this script "directly" if (!defined('PUN')) - exit; + pun_exit(); // diff --git a/lib/punbb/include/template/admin.tpl b/lib/punbb/include/template/admin.tpl index 7423342..0af20ea 100644 --- a/lib/punbb/include/template/admin.tpl +++ b/lib/punbb/include/template/admin.tpl @@ -1,12 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" /> -<pun_head> -</head> -<body> - <div id="punwrap"> <div id="punadmin" class="pun"> @@ -29,6 +20,3 @@ </div> </div> - -</body> -</html> diff --git a/lib/punbb/include/template/help.tpl b/lib/punbb/include/template/help.tpl index 03f3c26..92a13bd 100644 --- a/lib/punbb/include/template/help.tpl +++ b/lib/punbb/include/template/help.tpl @@ -1,12 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" /> -<pun_head> -</head> -<body> - <div id="punwrap"> <div id="helpfile" class="pun"> @@ -14,6 +5,3 @@ </div> </div> - -</body> -</html> diff --git a/lib/punbb/include/template/main.tpl b/lib/punbb/include/template/main.tpl index 380b4a4..a848a83 100644 --- a/lib/punbb/include/template/main.tpl +++ b/lib/punbb/include/template/main.tpl @@ -1,12 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" /> -<pun_head> -</head> -<body> - <div id="punwrap"> <div id="pun<pun_page>" class="pun"> @@ -30,5 +21,3 @@ </div> </div> -</body> -</html> diff --git a/lib/punbb/include/template/maintenance.tpl b/lib/punbb/include/template/maintenance.tpl index d40f903..8d9ddf4 100644 --- a/lib/punbb/include/template/maintenance.tpl +++ b/lib/punbb/include/template/maintenance.tpl @@ -1,12 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" /> -<pun_head> -</head> -<body> - <div id="punwrap"> <div id="punmaint" class="pun"> @@ -21,6 +12,3 @@ </div> </div> - -</body> -</html> diff --git a/lib/punbb/include/template/redirect.tpl b/lib/punbb/include/template/redirect.tpl index f599529..45fa58f 100644 --- a/lib/punbb/include/template/redirect.tpl +++ b/lib/punbb/include/template/redirect.tpl @@ -1,12 +1,3 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - -<html xmlns="http://www.w3.org/1999/xhtml" dir="<pun_content_direction>"> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" /> -<pun_head> -</head> -<body> - <div id="punwrap"> <div id="punredirect" class="pun"> @@ -23,6 +14,3 @@ </div> </div> - -</body> -</html> diff --git a/lib/punbb/install.php b/lib/punbb/install.php index c13df9a..277a79c 100644 --- a/lib/punbb/install.php +++ b/lib/punbb/install.php @@ -29,12 +29,12 @@ $punbb_version = '1.2.16'; define('PUN_ROOT', './'); if (file_exists(PUN_ROOT.'config.php')) - exit('The file \'config.php\' already exists which would mean that PunBB is already installed. You should go <a href="index.php">here</a> instead.'); + pun_exit('The file \'config.php\' already exists which would mean that PunBB is already installed. You should go <a href="index.php">here</a> instead.'); // Make sure we are running at least PHP 4.1.0 if (intval(str_replace('.', '', phpversion())) < 410) - exit('You are running PHP version '.PHP_VERSION.'. PunBB requires at least PHP 4.1.0 to run properly. You must upgrade your PHP installation before you can continue.'); + pun_exit('You are running PHP version '.PHP_VERSION.'. PunBB requires at least PHP 4.1.0 to run properly. You must upgrade your PHP installation before you can continue.'); // Disable error reporting for uninitialized variables error_reporting(E_ALL); @@ -63,7 +63,7 @@ if (!isset($_POST['form_sent'])) $db_extensions[] = array('pgsql', 'PostgreSQL'); if (empty($db_extensions)) - exit('This PHP environment does not have support for any of the databases that PunBB supports. PHP needs to have support for either MySQL, PostgreSQL or SQLite in order for PunBB to be installed.'); + pun_exit('This PHP environment does not have support for any of the databases that PunBB supports. PHP needs to have support for either MySQL, PostgreSQL or SQLite in order for PunBB to be installed.'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> @@ -287,7 +287,7 @@ else if ($db_error !== false) echo '<strong>Database reported:</strong> '.htmlspecialchars($db_error['error_msg']).(($db_error['error_no']) ? ' (Errno: '.$db_error['error_no'].')' : ''); - exit; + pun_exit(); } diff --git a/lib/punbb/login.php b/lib/punbb/login.php index 88ca638..cc6fc8a 100644 --- a/lib/punbb/login.php +++ b/lib/punbb/login.php @@ -87,7 +87,7 @@ else if ($action == 'out') if ($pun_user['is_guest'] || !isset($_GET['id']) || $_GET['id'] != $pun_user['id']) { header('Location: index.php'); - exit; + pun_exit(); } // Remove user from "users online" list. diff --git a/lib/punbb/profile.php b/lib/punbb/profile.php index e578364..3e8c568 100644 --- a/lib/punbb/profile.php +++ b/lib/punbb/profile.php @@ -51,7 +51,7 @@ if ($action == 'change_pass') if (!$pun_user['is_guest']) { header('Location: index.php'); - exit; + pun_exit(); } $key = $_GET['key']; diff --git a/lib/punbb/register.php b/lib/punbb/register.php index 24c0bca..82fa300 100644 --- a/lib/punbb/register.php +++ b/lib/punbb/register.php @@ -31,7 +31,7 @@ require PUN_ROOT.'include/common.php'; if (!$pun_user['is_guest']) { header('Location: index.php'); - exit; + pun_exit(); } // Load the register.php language file diff --git a/lib/punbb/search.php b/lib/punbb/search.php index 13f1ddd..bcba0df 100644 --- a/lib/punbb/search.php +++ b/lib/punbb/search.php @@ -422,7 +422,7 @@ if (isset($_GET['action']) || isset($_GET['search_id'])) // Redirect the user to the cached result page header('Location: search.php?search_id='.$search_id); - exit; + pun_exit(); } } diff --git a/lib/punbb/viewforum.php b/lib/punbb/viewforum.php index f8d6bed..eb8fe34 100644 --- a/lib/punbb/viewforum.php +++ b/lib/punbb/viewforum.php @@ -49,7 +49,7 @@ $cur_forum = $db->fetch_assoc($result); if ($cur_forum['redirect_url'] != '') { header('Location: '.$cur_forum['redirect_url']); - exit; + pun_exit(); } // Sort out who the moderators are and if we are currently a moderator (or an admin) diff --git a/lib/punbb/viewtopic.php b/lib/punbb/viewtopic.php index 2f96808..cf0fcc4 100644 --- a/lib/punbb/viewtopic.php +++ b/lib/punbb/viewtopic.php @@ -76,7 +76,7 @@ else if ($action == 'new' && !$pun_user['is_guest']) else // If there is no new post, we go to the last post header('Location: viewtopic.php?id='.$id.'&action=last'); - exit; + pun_exit(); } // If action=last, we redirect to the last post @@ -88,7 +88,7 @@ else if ($action == 'last') if ($last_post_id) { header('Location: viewtopic.php?pid='.$last_post_id.'#p'.$last_post_id); - exit; + pun_exit(); } } -- GitLab