# HG changeset patch # User Dan # Date 1188744996 14400 # Node ID eb9ed4c366d0663ba1dd67244d3821489676c318 # Parent c0c445d4a13ee1b68f63400d8a59853f557c8cb0 Various bugfixes, mostly with URL generation (maintenance commit, may not be in a working state) diff -r c0c445d4a13e -r eb9ed4c366d0 plugins/PunBB.php --- a/plugins/PunBB.php Thu Jul 12 15:00:35 2007 -0400 +++ b/plugins/PunBB.php Sun Sep 02 10:56:36 2007 -0400 @@ -36,9 +36,9 @@ $plugins->attachHook('session_started', ' $pid = RenderMan::strToPageId($paths->get_pageid_from_url()); - if ( getConfig("punbb_installed") == "yes" && getConfig("punbb_version") == PUNANO_VERSION && $pid[0] == "Forum" && $pid[1] == "Special" ) + if ( getConfig("punbb_installed") == "yes" && getConfig("punbb_version") == PUNANO_VERSION && preg_match("#^Forum(/.*)?$#", $pid[0]) && $pid[1] == "Special" ) { - require( "punbb/include/common.php" ); + require( ENANO_ROOT . "/punbb/include/common.php" ); } '); @@ -204,7 +204,7 @@ function punano_upgrade() { global $db, $session, $paths, $template, $plugins; // Common objects - + die('Punano upgrade was requested but this isn\'t implemented yet.'); } function punano_main() @@ -261,6 +261,7 @@ if ( $session->auth_level < $need_level ) { + $need_level = ( $session->user_level > $need_level ) ? $session->user_level : $need_level; redirect( makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $need_level, false), 'Permission denied', 'You need to have permission level ' . $session->userlevel_to_string($need_level) . ' to use the PunBB administration console.', 2); } diff -r c0c445d4a13e -r eb9ed4c366d0 punbb/footer.php --- a/punbb/footer.php Thu Jul 12 15:00:35 2007 -0400 +++ b/punbb/footer.php Sun Sep 02 10:56:36 2007 -0400 @@ -112,10 +112,11 @@ // Display debug info (if enabled/defined) if (defined('PUN_DEBUG')) { + global $pun_start; // Calculate script generation time list($usec, $sec) = explode(' ', microtime()); $time_diff = sprintf('%.3f', ((float)$usec + (float)$sec) - $pun_start); - echo "\t\t\t".'

[ Generated in '.$time_diff.' seconds, '.$pun_db->get_num_queries().' queries executed ]

'."\n"; + echo "\t\t\t".'

[ PunBB time: '.$time_diff.' seconds, '.$pun_db->get_num_queries().' queries executed ]

'."\n"; } ?> diff -r c0c445d4a13e -r eb9ed4c366d0 punbb/include/common.php --- a/punbb/include/common.php Thu Jul 12 15:00:35 2007 -0400 +++ b/punbb/include/common.php Sun Sep 02 10:56:36 2007 -0400 @@ -23,11 +23,11 @@ ************************************************************************/ // Enable DEBUG mode by removing // from the following line -define('PUN_DEBUG', 1); +// define('PUN_DEBUG', 1); // This displays all executed queries in the page footer. // DO NOT enable this in a production environment! -define('PUN_SHOW_QUERIES', 1); +// 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.'); @@ -47,13 +47,14 @@ // Record the start time (will be used to calculate the generation time for the page) -function get_microtime() +function pun_microtime() { list($usec, $sec) = explode(' ', microtime()); return ((float)$usec + (float)$sec); } -$pun_start = get_microtime(); +$GLOBALS['pun_start'] = pun_microtime(); +$pun_start =& $GLOBALS['pun_start']; // Make sure PHP reports all errors except E_NOTICE. PunBB supports E_ALL, but a lot of scripts it may interact with, do not. error_reporting(E_ALL); diff -r c0c445d4a13e -r eb9ed4c366d0 punbb/include/common_admin.php --- a/punbb/include/common_admin.php Thu Jul 12 15:00:35 2007 -0400 +++ b/punbb/include/common_admin.php Sun Sep 02 10:56:36 2007 -0400 @@ -86,7 +86,7 @@ '.str_replace('_', ' ', $cur_plugin[0]).''."\n"; + echo "\t\t\t\t\t".''.str_replace('_', ' ', $cur_plugin[0]).''."\n"; ?> diff -r c0c445d4a13e -r eb9ed4c366d0 punbb/include/enano_dbal.php --- a/punbb/include/enano_dbal.php Thu Jul 12 15:00:35 2007 -0400 +++ b/punbb/include/enano_dbal.php Sun Sep 02 10:56:36 2007 -0400 @@ -61,7 +61,7 @@ { global $db; if (defined('PUN_SHOW_QUERIES')) - $q_start = get_microtime(); + $q_start = pun_microtime(); if ($unbuffered) $this->query_result = $db->sql_unbuffered_query($sql); @@ -71,7 +71,7 @@ if ($this->query_result) { if (defined('PUN_SHOW_QUERIES')) - $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start)); + $this->saved_queries[] = array($sql, sprintf('%.5f', pun_microtime() - $q_start)); ++$this->num_queries; diff -r c0c445d4a13e -r eb9ed4c366d0 punbb/include/functions.php --- a/punbb/include/functions.php Thu Jul 12 15:00:35 2007 -0400 +++ b/punbb/include/functions.php Sun Sep 02 10:56:36 2007 -0400 @@ -241,19 +241,19 @@ global $db, $session, $paths, $template, $plugins; // Common objects // Index and Userlist should always be displayed - $links[] = '