punbb/include/common_admin.php
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
child 3 c0c445d4a13e
--- a/punbb/include/common_admin.php	Wed Jul 11 21:28:39 2007 -0400
+++ b/punbb/include/common_admin.php	Thu Jul 12 01:04:01 2007 -0400
@@ -109,7 +109,7 @@
 //
 function prune($forum_id, $prune_sticky, $prune_date)
 {
-	global $db;
+	global $pun_db;
 
 	$extra_sql = ($prune_date != -1) ? ' AND last_post<'.$prune_date : '';
 
@@ -117,29 +117,29 @@
 		$extra_sql .= ' AND sticky=\'0\'';
 
 	// Fetch topics to prune
-	$result = $db->query('SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.$extra_sql, true) or error('Unable to fetch topics', __FILE__, __LINE__, $db->error());
+	$result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'topics WHERE forum_id='.$forum_id.$extra_sql, true) or error('Unable to fetch topics', __FILE__, __LINE__, $pun_db->error());
 
 	$topic_ids = '';
-	while ($row = $db->fetch_row($result))
+	while ($row = $pun_db->fetch_row($result))
 		$topic_ids .= (($topic_ids != '') ? ',' : '').$row[0];
 
 	if ($topic_ids != '')
 	{
 		// Fetch posts to prune
-		$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id IN('.$topic_ids.')', true) or error('Unable to fetch posts', __FILE__, __LINE__, $db->error());
+		$result = $pun_db->query('SELECT id FROM '.$pun_db->prefix.'posts WHERE topic_id IN('.$topic_ids.')', true) or error('Unable to fetch posts', __FILE__, __LINE__, $pun_db->error());
 
 		$post_ids = '';
-		while ($row = $db->fetch_row($result))
+		while ($row = $pun_db->fetch_row($result))
 			$post_ids .= (($post_ids != '') ? ',' : '').$row[0];
 
 		if ($post_ids != '')
 		{
 			// Delete topics
-			$db->query('DELETE FROM '.$db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $db->error());
+			$pun_db->query('DELETE FROM '.$pun_db->prefix.'topics WHERE id IN('.$topic_ids.')') or error('Unable to prune topics', __FILE__, __LINE__, $pun_db->error());
 			// Delete subscriptions
-			$db->query('DELETE FROM '.$db->prefix.'subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $db->error());
+			$pun_db->query('DELETE FROM '.$pun_db->prefix.'subscriptions WHERE topic_id IN('.$topic_ids.')') or error('Unable to prune subscriptions', __FILE__, __LINE__, $pun_db->error());
 			// Delete posts
-			$db->query('DELETE FROM '.$db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $db->error());
+			$pun_db->query('DELETE FROM '.$pun_db->prefix.'posts WHERE id IN('.$post_ids.')') or error('Unable to prune posts', __FILE__, __LINE__, $pun_db->error());
 
 			// We removed a bunch of posts, so now we have to update the search index
 			require_once PUN_ROOT.'include/search_idx.php';