From 893957c41481a0cd5eb624096337762ffa54ff28 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 9 Aug 2009 09:14:58 -0400 Subject: Created layout 7 The following changes were also made in this revision: * All HTML was changed to XHTML and a !DOCTYPE was included to reflect this * Rewrote quotes tracking system to be much less complicated and actually working * Changed quotes rendering to look more like Chirpy than Rash * Fixed comment textarea bug * Rewrote a ton of CSS so it's not as bloated * Added a JavaScript confirmation when deleting a comment * AJAXified voting on the POTW * AJAXified voting and flagging quotes * AJAXified commenting * AJAXified voting on posts * Added DateFinder back after it was accidentally deleted in Layout 4.5 The following database changes must be performed as soon as possible: * Fix title of NO post (the < is missing the semicolon) * Restore post Frasty Tha Snaman from a backup * Reset "flag" field of all rows in "rash_quotes" to 0 * Remove the "vote" and "flag" columns of "rash_tracking" * Rename the "quote_id" column of "rash_tracking" to "vote" The following external code changes must also be performed as soon as possible: * Add the following line to the end of the // Four Island block in The Fourm's functions.php: require('/svr/www/hatkirby/fourisland/main/includes/specialdates.php'); --- includes/footer.php | 322 +++++++++++++++++++--------------------------------- 1 file changed, 117 insertions(+), 205 deletions(-) (limited to 'includes/footer.php') diff --git a/includes/footer.php b/includes/footer.php index 6713db0..19cc341 100755 --- a/includes/footer.php +++ b/includes/footer.php @@ -24,244 +24,156 @@ require('headerproc.php'); $template = new FITemplate('footer'); -if (isset($extraSidebars)) -{ - $template->adds_block('EXTRA', array('SIDEBARS' => $extraSidebars)); -} - if (isset($onFourm)) { $template->adds_block('ONFOURM',array('exi'=>1)); } -if (!isset($noRightbar)) +$getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; +$getcomments2 = mysql_query($getcomments); +$i=0; +while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) { - $template->adds_block('RIGHTBAR',array('exi'=>1)); - - if (!isset($noHatNav)) - { - $cnthatnav = "SELECT COUNT(*) FROM hatnav WHERE category = \"" . $pageCategory . "\""; - $cnthatnav2 = mysql_query($cnthatnav); - $cnthatnav3 = mysql_fetch_array($cnthatnav2); + if ($getcomments3[$i]['is_anon'] == 0) + { + $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id']; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); - if ($cnthatnav3['COUNT(*)'] > 0) + $username = $getuser3['username']; + $website = $getuser3['user_website']; + } else if ($getcomments3[$i]['is_anon'] == 1) { - $template->adds_block('USEHATNAV', array('exi'=>1)); - if (!isset($genHatNav)) - { - $gethnis = 'SELECT * FROM hatnav WHERE category = "' . $pageCategory . '"'; - $gethnis2 = mysql_query($gethnis); - $i=0; - while ($gethnis3[$i] = mysql_fetch_array($gethnis2)) - { - $template->adds_block('HATNAV', array( 'AID' => $gethnis3[$i]['AID'], - 'HREF' => $gethnis3[$i]['href'], - 'IMAGE' => '/theme/images/icons/' . $gethnis3[$i]['image'] . '.png', - 'TEXT' => $gethnis3[$i]['text'], - 'NEW' => dispIfNotOld($gethnis3[$i]['lastEdit']))); - $i++; - } - } else { - $i=0; - while ($i < $genHatNavNum) + $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id']; + $getanon2 = mysql_query($getanon); + $getanon3 = mysql_fetch_array($getanon2); + + if ($getanon3['id'] == $getcomments3[$i]['user_id']) { - $template->adds_block('HATNAV', array( 'AID' => 'post', - 'HREF' => $genHatNav[$i]['href'], - 'IMAGE' => '/theme/images/blue.PNG', - 'TEXT' => $genHatNav[$i]['text'], - 'NEW' => '')); - $i++; + $username = $getanon3['username'] . ' (Guest)'; + $website = $getanon3['website']; } - } } - } - include('pages/polloftheweek.php'); - - $getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; - $getpopular2 = mysql_query($getpopular); - $i=0; - while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) + if (strpos($getcomments3[$i]['page_id'], 'updates') !== FALSE) { - $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], - 'TITLE' => stripslashes($getpopular3[$i]['title']))); + $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( 'ID' => $getcomments3[$i]['id'], + 'AREA' => 'blog', + 'CODED' => $getpost3['slug'], + 'ENDING' => '/', + 'TITLE' => stripslashes($getpost3['title']), + 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); $i++; - } - - $getcomments = "SELECT * FROM comments ORDER BY id DESC LIMIT 0,5"; - $getcomments2 = mysql_query($getcomments); - $i=0; - while ($getcomments3[$i] = mysql_fetch_array($getcomments2)) + } else if (strpos($getcomments3[$i]['page_id'], 'quote') !== FALSE) { - if ($getcomments3[$i]['is_anon'] == 0) - { - $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getcomments3[$i]['user_id']; - $getuser2 = mysql_query($getuser); - $getuser3 = mysql_fetch_array($getuser2); - - $username = $getuser3['username']; - $website = $getuser3['user_website']; - } else if ($getcomments3[$i]['is_anon'] == 1) - { - $getanon = "SELECT * FROM anon_commenters WHERE id = " . $getcomments3[$i]['user_id']; - $getanon2 = mysql_query($getanon); - $getanon3 = mysql_fetch_array($getanon2); - - if ($getanon3['id'] == $getcomments3[$i]['user_id']) - { - $username = $getanon3['username'] . ' (Guest)'; - $website = $getanon3['website']; - } - } - - 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( 'ID' => $getcomments3[$i]['id'], - '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( 'ID' => $getcomments3[$i]['id'], - 'AREA' => 'quotes', - 'CODED' => $num, - 'ENDING' => '.php', - 'TITLE' => 'Quote #' . $num, - 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); - $i++; - } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE) - { - $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); - $getpotw2 = mysql_query($getpotw); - $getpotw3 = mysql_fetch_array($getpotw2); - - $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], - 'AREA' => 'poll', - 'CODED' => $getpotw3['id'], - 'ENDING' => '.php', - 'TITLE' => 'Poll "' . $getpotw3['question'] . '"', - 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); - $i++; - } - } - - $users = array(); - $getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0"; - $getusers2 = mysql_query($getusers); - $i=0; - while ($getusers3[$i] = mysql_fetch_array($getusers2)) + $num = substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); + + $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], + 'AREA' => 'quotes', + 'CODED' => $num, + 'ENDING' => '.php', + 'TITLE' => 'Quote #' . $num, + 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); + $i++; + } else if (strpos($getcomments3[$i]['page_id'], 'polloftheweek') !== FALSE) { - $getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id']; - $getcount2 = mysql_query($getcount); - $getcount3 = mysql_fetch_array($getcount2); - - $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; - $getuser2 = mysql_query($getuser); - $getuser3 = mysql_fetch_array($getuser2); - - $username = $getuser3['username']; - $website = $getuser3['user_website']; - - $name = (($website != '') ? '' . $username . '' : $username); - $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); - - $i++; + $getpotw = "SELECT * FROM polloftheweek WHERE id = " . substr($getcomments3[$i]['page_id'],strpos($getcomments3[$i]['page_id'],'-')+1); + $getpotw2 = mysql_query($getpotw); + $getpotw3 = mysql_fetch_array($getpotw2); + + $template->adds_block('COMMENTS', array( 'ID' => $getcomments3[$i]['id'], + 'AREA' => 'poll', + 'CODED' => $getpotw3['id'], + 'ENDING' => '.php', + 'TITLE' => 'Poll "' . $getpotw3['question'] . '"', + 'AUTHOR' => (($website != '') ? '' . $username . '' : $username))); + $i++; } +} - function count_sort($a, $b) - { - $a = $a['count']; - $b = $b['count']; +$users = array(); +$getusers = "SELECT DISTINCT user_id FROM comments WHERE is_anon = 0"; +$getusers2 = mysql_query($getusers); +$i=0; +while ($getusers3[$i] = mysql_fetch_array($getusers2)) +{ + $getcount = "SELECT COUNT(*) FROM comments WHERE user_id = " . $getusers3[$i]['user_id']; + $getcount2 = mysql_query($getcount); + $getcount3 = mysql_fetch_array($getcount2); - if ($a > $b) - { - return -1; - } else if ($a < $b) - { - return 1; - } else { - return 0; - } - } + $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getusers3[$i]['user_id']; + $getuser2 = mysql_query($getuser); + $getuser3 = mysql_fetch_array($getuser2); - usort($users, 'count_sort'); - $i=0; - foreach ($users as $value) - { - if ($i == 5) - { - break; - } + $username = $getuser3['username']; + $website = $getuser3['user_website']; - $template->adds_block('TOP', array( 'USERNAME' => $value['name'], - 'COUNT' => $value['count'])); - $i++; - } + $name = (($website != '') ? '' . $username . '' : $username); + $users[] = array('name' => $name, 'count' => $getcount3['COUNT(*)']); - $gethits = "SELECT * FROM config WHERE name = \"hits\""; - $gethits2 = mysql_query($gethits); - $gethits3 = mysql_fetch_array($gethits2); - $template->add('HITS', $gethits3['value']); + $i++; +} - $gethits = "SELECT * FROM config WHERE name = \"todayHits\""; - $gethits2 = mysql_query($gethits); - $gethits3 = mysql_fetch_array($gethits2); - $template->add('TODAY', $gethits3['value']); +function count_sort($a, $b) +{ + $a = $a['count']; + $b = $b['count']; - $getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; - $getpost2 = mysql_query($getpost) or die($getpost); - $i=0; - while ($getpost3[$i] = mysql_fetch_array($getpost2)) + if ($a > $b) { - $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; - $getuser2 = mysql_query($getuser) or die($getuser); - $getuser3 = mysql_fetch_array($getuser2); - - $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], - 'TOPIC' => $getpost3[$i]['topic_id'], - 'POST' => $getpost3[$i]['post_id'], - 'USERNAME' => $getuser3['username'])); + return -1; + } else if ($a < $b) + { + return 1; + } else { + return 0; } +} - $gettags = "SELECT DISTINCT tag FROM tags WHERE post_type = \"published\""; - $gettags2 = mysql_query($gettags); - $i=0; - while ($gettags3[$i] = mysql_fetch_array($gettags2)) +usort($users, 'count_sort'); +$i=0; +foreach ($users as $value) +{ + if ($i == 5) { - $cnttag = "SELECT COUNT(*) FROM tags WHERE tag = \"" . $gettags3[$i]['tag'] . "\" AND post_type = \"published\""; - $cnttag2 = mysql_query($cnttag); - $cnttag3 = mysql_fetch_array($cnttag2); + break; + } - $counts[$gettags3[$i]['tag']] = $cnttag3[0]; + $template->adds_block('TOP', array( 'USERNAME' => $value['name'], + 'COUNT' => $value['count'])); + $i++; +} - $i++; - } +$getpost = "SELECT * FROM phpbb_posts ORDER BY post_id DESC LIMIT 0,5"; +$getpost2 = mysql_query($getpost) or die($getpost); +$i=0; +while ($getpost3[$i] = mysql_fetch_array($getpost2)) +{ + $getuser = "SELECT * FROM phpbb_users WHERE user_id = " . $getpost3[$i]['poster_id']; + $getuser2 = mysql_query($getuser) or die($getuser); + $getuser3 = mysql_fetch_array($getuser2); + + $template->adds_block('FOURM', array( 'SUBJECT' => $getpost3[$i]['post_subject'], + 'TOPIC' => $getpost3[$i]['topic_id'], + 'POST' => $getpost3[$i]['post_id'], + 'USERNAME' => $getuser3['username'])); +} - $min_count = min($counts); - $spread = max($counts) - $min_count; - $spread = ($spread <= 0) ? 1 : $spread; - $font_step = 8 / $spread; - foreach ($counts as $tag => $count) - { - if ($count != $min_count) - { - $template->adds_block('TAGCLOUD', array( 'TAG' => $tag, - 'SIZE' => (8 + (($count - $min_count) * $font_step)), - 'COUNT' => $count)); - } - } +$getpopular = "SELECT * FROM updates ORDER BY popularity DESC LIMIT 0,5"; +$getpopular2 = mysql_query($getpopular); +$i=0; +while ($getpopular3[$i] = mysql_fetch_array($getpopular2)) +{ + $template->adds_block('POPULAR', array( 'CODED' => $getpopular3[$i]['slug'], + 'TITLE' => stripslashes($getpopular3[$i]['title']))); + $i++; } -$template->add('REVISION', exec('hg tip --template {rev}')); +$template->add('REVISION', exec('hg -R "' . $_SERVER['DOCUMENT_ROOT'] . '" tip --template {rev}')); $template->display(); -- cgit 1.4.1