diff -urN punbb-1.2.16/upload/admin_forums.php punbb-1.2.17/upload/admin_forums.php --- punbb-1.2.16/upload/admin_forums.php 2007-04-10 23:37:34.000000000 +0200 +++ punbb-1.2.17/upload/admin_forums.php 2008-01-15 00:23:25.000000000 +0100 @@ -385,8 +385,13 @@ query('SELECT id, cat_name FROM '.$db->prefix.'categories ORDER BY disp_position') or error('Unable to fetch category list', __FILE__, __LINE__, $db->error()); - while ($cur_cat = $db->fetch_assoc($result)) - echo "\t\t\t\t\t\t\t\t\t".''."\n"; + if ($db->num_rows($result) > 0) + { + while ($cur_cat = $db->fetch_assoc($result)) + echo "\t\t\t\t\t\t\t\t\t".''."\n"; + } + else + echo "\t\t\t\t\t\t\t\t\t".''."\n"; ?> @@ -399,7 +404,15 @@ +query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.disp_position FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); + +if ($db->num_rows($result) > 0) +{ + +?>

Edit forums

@@ -408,9 +421,6 @@ $tabindex_count = 4; -// Display all the categories and forums -$result = $db->query('SELECT c.id AS cid, c.cat_name, f.id AS fid, f.forum_name, f.disp_position FROM '.$db->prefix.'categories AS c INNER JOIN '.$db->prefix.'forums AS f ON c.id=f.cat_id ORDER BY c.disp_position, c.id, f.disp_position') or error('Unable to fetch category/forum list', __FILE__, __LINE__, $db->error()); - $cur_category = 0; while ($cur_forum = $db->fetch_assoc($result)) { @@ -449,6 +459,11 @@

+
diff -urN punbb-1.2.16/upload/admin_maintenance.php punbb-1.2.17/upload/admin_maintenance.php --- punbb-1.2.16/upload/admin_maintenance.php 2007-01-30 23:31:43.000000000 +0100 +++ punbb-1.2.17/upload/admin_maintenance.php 2008-01-19 16:16:24.000000000 +0100 @@ -69,8 +69,6 @@ } } - $end_at = $start_at + $per_page; - ?> @@ -95,7 +93,7 @@ require PUN_ROOT.'include/search_idx.php'; // Fetch posts to process - $result = $db->query('SELECT DISTINCT t.id, p.id, p.message FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.id>='.$start_at.' AND t.id<'.$end_at.' ORDER BY t.id') or error('Unable to fetch topic/post info', __FILE__, __LINE__, $db->error()); + $result = $db->query('SELECT DISTINCT t.id, p.id, p.message FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.id>='.$start_at.' ORDER BY t.id LIMIT '.$per_page) or error('Unable to fetch topic/post info', __FILE__, __LINE__, $db->error()); $cur_topic = 0; while ($cur_post = $db->fetch_row($result)) @@ -118,9 +116,9 @@ } // Check if there is more work to do - $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE id>'.$end_at) or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); + $result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE id>'.$cur_topic.' ORDER BY id ASC LIMIT 1') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); - $query_str = ($db->num_rows($result)) ? '?i_per_page='.$per_page.'&i_start_at='.$end_at : ''; + $query_str = ($db->num_rows($result)) ? '?i_per_page='.$per_page.'&i_start_at='.$db->result($result) : ''; $db->end_transaction(); $db->close(); diff -urN punbb-1.2.16/upload/edit.php punbb-1.2.17/upload/edit.php --- punbb-1.2.16/upload/edit.php 2005-09-02 16:05:31.000000000 +0200 +++ punbb-1.2.17/upload/edit.php 2008-01-14 12:57:40.000000000 +0100 @@ -197,7 +197,7 @@ ?>
-

+

diff -urN punbb-1.2.16/upload/header.php punbb-1.2.17/upload/header.php --- punbb-1.2.16/upload/header.php 2007-04-10 18:19:24.000000000 +0200 +++ punbb-1.2.17/upload/header.php 2008-01-14 12:58:26.000000000 +0100 @@ -147,7 +147,7 @@ // START SUBST - $tpl_main = str_replace('', htmlspecialchars(basename($_SERVER['PHP_SELF'], '.php')), $tpl_main); -// END SUBST - +// END SUBST - // START SUBST - diff -urN punbb-1.2.16/upload/include/common.php punbb-1.2.17/upload/include/common.php --- punbb-1.2.16/upload/include/common.php 2007-04-09 16:15:20.000000000 +0200 +++ punbb-1.2.17/upload/include/common.php 2008-02-20 00:09:45.000000000 +0100 @@ -70,8 +70,9 @@ $_COOKIE = stripslashes_array($_COOKIE); } -// Seed the random number generator -mt_srand((double)microtime()*1000000); +// Seed the random number generator (PHP <4.2.0 only) +if (version_compare(PHP_VERSION, '4.2.0', '<')) + mt_srand((double)microtime()*1000000); // If a cookie name is not specified in config.php, we use the default (punbb_cookie) if (empty($cookie_name)) diff -urN punbb-1.2.16/upload/include/functions.php punbb-1.2.17/upload/include/functions.php --- punbb-1.2.16/upload/include/functions.php 2007-11-19 18:08:44.000000000 +0100 +++ punbb-1.2.17/upload/include/functions.php 2008-02-20 00:09:45.000000000 +0100 @@ -48,7 +48,7 @@ // If user authorisation failed if (!isset($pun_user['id']) || md5($cookie_seed.$pun_user['password']) !== $cookie['password_hash']) { - pun_setcookie(0, random_pass(8), $expire); + pun_setcookie(1, md5(uniqid(rand(), true)), $expire); set_default_user(); return; @@ -295,14 +295,14 @@ $links[] = '