From d526decc4884710ae7fafe7aa5171e7f59b24292 Mon Sep 17 00:00:00 2001 From: jhunkeler Date: Sun, 27 Dec 2009 15:44:57 +0000 Subject: MySQL -> MySQLi Fixed memory leaks after Fetching arrays Removed all while loops that interfaced with $db->Fetch() Rewrote RSS module Fixed syntax error in donations module Fixed link structure for news module Reverting to old page display method git-svn-id: http://svn.3rd-infantry-division.org/testing/branches/Bayonet CMS v2@402 c5b2fb0a-d05d-0410-98c8-828840a80ff6 --- modules/page/index.php | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'modules/page/index.php') diff --git a/modules/page/index.php b/modules/page/index.php index abf559f..1f72925 100644 --- a/modules/page/index.php +++ b/modules/page/index.php @@ -35,12 +35,8 @@ if(isset($_GET['list'])) { if($_GET['list'] == "true") { - $result = $db->Query("SELECT title, page_id FROM bayonet_articles"); - while(($row = $db->Fetch($result)) !== false) - { - $pages[] = $row; - } - mysql_free_result($result); + $results = $db->Query("SELECT title, page_id FROM bayonet_articles"); + $pages = $db->Fetch($results); OpenContent(); echo "
Page Map
"; @@ -68,28 +64,29 @@ if(!isset($_GET['id'])) $id = $_GET['id']; } +// {{{ XXX: FIXME -- Needs to be re-written + $result = $db->Query("SELECT u.username AS author, p.page_created, p.title, p.text FROM `bayonet_pages` AS p LEFT OUTER JOIN `bayonet_users` AS u ON u.user_id = p.author_id WHERE p.page_id = '$id'"); -$proceed = mysql_num_rows($result); +$proceed = $db->Rows($result); if($proceed > 0) { - while(($row = $db->Fetch($result))!==false) - { - $page = $row; + $pages = $db->Fetch($result); OpenContent(); echo "
"; - $aresult = $db->Query("SELECT * FROM `bayonet_articles` WHERE `page_id` = $id ORDER BY `weight` ASC"); - while(($article = $db->Fetch($aresult))!==false) - { - $articleTitle = $article['title']; - echo '

'.$articleTitle.'

'; + //$aresult = $db->Query("SELECT * FROM `bayonet_page` WHERE `page_id` = $id ORDER BY `weight` ASC"); + //$article = $db->Fetch($aresult); + foreach($pages as $page) + { + echo '

'.$page['title'].'

'; //echo "

".$article['title']."

"; - echo bbcode_format($article['text']); - } - echo "
"; + echo bbcode_format($page['text']); + echo ""; + } + CloseContent(); - } + ?> @@ -100,4 +97,4 @@ else ReportError("Page does not exist.
\n"); } -?> \ No newline at end of file +?> -- cgit