From 3796eb62b5a6a959d1a45697e08998adf7fd78a3 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Thu, 20 Nov 2008 22:43:21 -0500 Subject: Added commenting to Quotes module --- includes/footer.php | 33 ++++++++++++++++++++++++--------- pages/quotes.php | 2 ++ theme/footer.tpl | 2 +- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/includes/footer.php b/includes/footer.php index e4c88c8..09be74f 100755 --- a/includes/footer.php +++ b/includes/footer.php @@ -79,15 +79,11 @@ if (!isset($noRightbar)) $i++; } - $getcomments = "SELECT * FROM comments WHERE page_id LIKE \"updates-%\" ORDER BY id DESC LIMIT 0,5"; + $getcomments = "SELECT * FROM comments WHERE page_id LIKE \"updates-%\" OR page_id LIKE \"quote-%\" ORDER BY id DESC LIMIT 0,5"; $getcomments2 = mysql_query($getcomments); $i=0; while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) { - $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); - $getpost2 = mysql_query($getpost); - $getpost3 = mysql_fetch_array($getpost2); - $getuser = "SELECT * FROM users WHERE username = \"" . $getcomments3[$i]['username'] . "\""; $getuser2 = mysql_query($getuser); $getuser3 = mysql_fetch_array($getuser2); @@ -109,10 +105,29 @@ if (!isset($noRightbar)) } - $template->adds_block('COMMENTS', array( 'CODED' => $getpost3['slug'], - 'TITLE' => stripslashes($getpost3['title']), - 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); - $i++; + if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE) + { + $getpost = "SELECT * FROM updates WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); + $getpost2 = mysql_query($getpost); + $getpost3 = mysql_fetch_array($getpost2); + + $template->adds_block('COMMENTS', array( 'AREA' => 'blog', + 'CODED' => $getpost3['slug'], + 'ENDING' => '/', + 'TITLE' => stripslashes($getpost3['title']), + 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); + $i++; + } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) + { + $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); + + $template->adds_block('COMMENTS', array( 'AREA' => 'quotes', + 'CODED' => $num, + 'ENDING' => '.php', + 'TITLE' => 'Quote #' . $num, + 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); + $i++; + } } $getusers = "SELECT DISTINCT username FROM comments"; diff --git a/pages/quotes.php b/pages/quotes.php index e6eb9f6..f208f70 100755 --- a/pages/quotes.php +++ b/pages/quotes.php @@ -161,7 +161,9 @@ if (!isset($_GET['act'])) { $query = "SELECT id, quote, rating, flag FROM rash_quotes WHERE id = " . $_GET['act']; quote_generation($query, "#" . $_GET['act'], -1); + $page_id = 'quote-' . $_GET['act']; + include('includes/comments.php'); } else { generateError('404'); } diff --git a/theme/footer.tpl b/theme/footer.tpl index 220e0f7..fdf62ad 100755 --- a/theme/footer.tpl +++ b/theme/footer.tpl @@ -110,7 +110,7 @@

-- cgit 1.4.1