# 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[] = ''.$lang_common['Index'].'';
- $links[] = ''.$lang_common['User list'].'';
+ $links[] = ''.$lang_common['Index'].'';
+ $links[] = ''.$lang_common['User list'].'';
if ($pun_config['o_rules'] == '1')
- $links[] = ''.$lang_common['Rules'].'';
+ $links[] = ''.$lang_common['Rules'].'';
if ( !$session->user_logged_in )
{
if ($pun_user['g_search'] == '1')
- $links[] = ''.$lang_common['Search'].'';
+ $links[] = ''.$lang_common['Search'].'';
- $links[] = ''.$lang_common['Register'].'';
- // $links[] = ''.$lang_common['Login'].'';
+ $links[] = ''.$lang_common['Register'].'';
+ // $links[] = ''.$lang_common['Login'].'';
$info = $lang_common['Not logged in'];
}
@@ -262,16 +262,16 @@
if ($pun_user['g_id'] < USER_LEVEL_ADMIN)
{
if ($pun_user['g_search'] == '1')
- $links[] = ''.$lang_common['Search'].'';
+ $links[] = ''.$lang_common['Search'].'';
- $links[] = ''.$lang_common['Profile'].'';
+ $links[] = ''.$lang_common['Profile'].'';
// $links[] = ''.$lang_common['Logout'].'';
}
else
{
- $links[] = ''.$lang_common['Search'].'';
- $links[] = ''.$lang_common['Profile'].'';
- $links[] = ''.$lang_common['Admin'].'';
+ $links[] = ''.$lang_common['Search'].'';
+ $links[] = ''.$lang_common['Profile'].'';
+ $links[] = ''.$lang_common['Admin'].'';
// $links[] = ''.$lang_common['Logout'].'';
}
}
@@ -305,13 +305,13 @@
- - >
- - >
- - >
- - >
- - >
- - >
- - >
+ - >
+ - >
+ - >
+ - >
+ - >
+ - >
+ - >
@@ -644,6 +644,9 @@
{
global $pun_config, $lang_common;
+ // This doesn't seem to work with Enano...
+ return true;
+
$script = preg_replace('/\.php$/i', '', $script);
if ( isset($_SERVER['HTTP_REFERER']) )
diff -r c0c445d4a13e -r eb9ed4c366d0 punbb/index.php
--- a/punbb/index.php Thu Jul 12 15:00:35 2007 -0400
+++ b/punbb/index.php Sun Sep 02 10:56:36 2007 -0400
@@ -97,7 +97,7 @@
}
else
{
- $forum_field = '';
+ $forum_field = '';
$num_topics = $cur_forum['num_topics'];
$num_posts = $cur_forum['num_posts'];
}
@@ -108,7 +108,7 @@
// If there is a last_post/last_poster.
if ($cur_forum['last_post'] != '')
- $last_post = ''.format_time($cur_forum['last_post']).' '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'';
+ $last_post = ''.format_time($cur_forum['last_post']).' '.$lang_common['by'].' '.pun_htmlspecialchars($cur_forum['last_poster']).'';
else
$last_post = ' ';
diff -r c0c445d4a13e -r eb9ed4c366d0 punbb/userlist.php
--- a/punbb/userlist.php Thu Jul 12 15:00:35 2007 -0400
+++ b/punbb/userlist.php Sun Sep 02 10:56:36 2007 -0400
@@ -157,7 +157,7 @@
query('SELECT u.id, eu.username, u.title, u.num_posts, u.registered, g.g_id, g.g_user_title FROM '.$pun_db->prefix.'users AS u LEFT JOIN '.table_prefix.'users AS eu ON eu.user_id=u.id LEFT JOIN '.$pun_db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '').' ORDER BY '.$sort_by.' '.$sort_dir.' LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $pun_db->error());
+$result = $pun_db->query('SELECT u.id, eu.username, u.title, u.num_posts, eu.reg_time AS registered, g.g_id, g.g_user_title FROM '.$pun_db->prefix.'users AS u LEFT JOIN '.table_prefix.'users AS eu ON eu.user_id=u.id LEFT JOIN '.$pun_db->prefix.'groups AS g ON g.g_id=u.group_id WHERE u.id>1'.(!empty($where_sql) ? ' AND '.implode(' AND ', $where_sql) : '').' ORDER BY '.$sort_by.' '.$sort_dir.' LIMIT '.$start_from.', 50') or error('Unable to fetch user list', __FILE__, __LINE__, $pun_db->error());
if ($pun_db->num_rows($result))
{
while ($user_data = $pun_db->fetch_assoc($result))