From 9cb1fcba82027daa21eb457f1b2912ee02e5c7eb Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 14 Dec 2008 09:39:10 -0500 Subject: Major design and code overhaul I don't know, a lot of stuffses happened that I don't quite remember anymore. Goodness, that's not good. --- includes/bbcode.php | 5 ++-- includes/db.php | 9 ++++++ includes/footer.php | 57 +++++++++++++++++++------------------ includes/functions.php | 25 +++++++++++++++++ includes/header.php | 3 ++ pages/blog.php | 49 +++++--------------------------- pages/login.php | 2 +- pages/poll.php | 60 +++++++++++++++++++++++++++++++++------ pages/quotes.php | 4 --- theme/archive.tpl | 33 ++-------------------- theme/css/blog.php | 13 +++++++++ theme/css/bubbles.css | 9 +++--- theme/css/website.css | 74 +++++++++++++++++++++++++++++++++++++++---------- theme/footer.tpl | 43 +++++----------------------- theme/header.tpl | 46 +++++++++++++++++++++++++++++- theme/pollIndex.tpl | 17 ++++++++++-- theme/post.tpl | 2 +- theme/quotes/browse.tpl | 18 +++++++----- theme/quotes/header.tpl | 47 ------------------------------- 19 files changed, 287 insertions(+), 229 deletions(-) delete mode 100644 theme/quotes/header.tpl diff --git a/includes/bbcode.php b/includes/bbcode.php index 40533a3..42ff8d0 100755 --- a/includes/bbcode.php +++ b/includes/bbcode.php @@ -32,6 +32,7 @@ class BBCode { $this->bbcodes['b'] = '{CONTENT}'; $this->bbcodes['i'] = '{CONTENT}'; + $this->bbcodes['u'] = '{CONTENT}'; $this->bbcodes['url'] = '{CONTENT}'; $this->bbcodes2['url'] = '{CONTENT}'; $this->bbcodes['img'] = ''; @@ -46,8 +47,8 @@ class BBCode $this->bbcodes2['blog'] = '{CONTENT}'; $this->bbcodes['ins'] = '{CONTENT}'; $this->bbcodes['del'] = '{CONTENT}'; - $this->bbcodes['bquote'] = '

{CONTENT}
Anonymous
'; - $this->bbcodes2['bquote'] = '

{CONTENT}
{PARAM}
'; + $this->bbcodes['bquote'] = '

{CONTENT}
Anonymous
'; + $this->bbcodes2['bquote'] = '

{CONTENT}
{PARAM}
'; $this->bbcodes2['abbr'] = '{CONTENT}'; $this->bbcodes['hidden'] = '
{CONTENT}
'; diff --git a/includes/db.php b/includes/db.php index 8cc5449..8f305e7 100755 --- a/includes/db.php +++ b/includes/db.php @@ -46,4 +46,13 @@ function db_multi_select($query, $callback) } } +function db_count($query) +{ + $cntitem = $query; + $cntitem2 = mysql_query($cntitem) or die($cntitem); + $cntitem3 = mysql_fetch_array($cntitem2); + + return $cntitem3['COUNT(*)']; +} + ?> diff --git a/includes/footer.php b/includes/footer.php index be8dd1b..4daf35e 100755 --- a/includes/footer.php +++ b/includes/footer.php @@ -37,32 +37,38 @@ if (!isset($noRightbar)) if (!isset($noHatNav)) { - $template->adds_block('USEHATNAV', array('exi'=>1)); - if (!isset($genHatNav)) + $cnthatnav = "SELECT COUNT(*) FROM hatnav WHERE category = \"" . $pageCategory . "\""; + $cnthatnav2 = mysql_query($cnthatnav); + $cnthatnav3 = mysql_fetch_array($cnthatnav2); + + if ($cnthatnav3['COUNT(*)'] > 0) { - $gethnis = 'SELECT * FROM hatnav WHERE category = "' . - $pageCategory . '"'; - $gethnis2 = mysql_query($gethnis); - $i=0; - while ($gethnis3[$i] = mysql_fetch_array($gethnis2)) + $template->adds_block('USEHATNAV', array('exi'=>1)); + if (!isset($genHatNav)) { - $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) - { - $template->adds_block('HATNAV', array( 'AID' => 'post', - 'HREF' => $genHatNav[$i]['href'], - 'IMAGE' => '/theme/images/blue.PNG', - 'TEXT' => $genHatNav[$i]['text'], - 'NEW' => '')); - $i++; + $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) + { + $template->adds_block('HATNAV', array( 'AID' => 'post', + 'HREF' => $genHatNav[$i]['href'], + 'IMAGE' => '/theme/images/blue.PNG', + 'TEXT' => $genHatNav[$i]['text'], + 'NEW' => '')); + $i++; + } } } } @@ -235,9 +241,6 @@ if (!isset($noRightbar)) } } -$template->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); -$template->add('LOGDATA',echoLogData()); - $template->display(); ?> diff --git a/includes/functions.php b/includes/functions.php index 7f85f96..1caef59 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -282,4 +282,29 @@ if (!function_exists('unique_id')) } } +function displayRelated($title, $avoid = 0) +{ + $getrelated = "SELECT *, MATCH (title, text) AGAINST (\"" . addslashes($title) . "\") AS score FROM updates WHERE MATCH (title, text) AGAINST (\"" . addslashes($title) . "\") AND id <> " . $avoid . " LIMIT 0,5"; + $getrelated2 = mysql_query($getrelated); + $i=0; + while ($getrelated3[$i] = mysql_fetch_array($getrelated2)) + { + if ($i==0) + { + $template = new FITemplate('related'); + } + + $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], + 'CODED' => $getrelated3[$i]['slug'], + 'AUTHOR' => $getrelated3[$i]['author'], + 'DATE' => date('F d<\S\U\P>S Y',strtotime($getrelated3[$i]['pubDate'])))); + $i++; + } + + if ($i > 0) + { + $template->display(); + } +} + ?> diff --git a/includes/header.php b/includes/header.php index e9f31f6..6018179 100755 --- a/includes/header.php +++ b/includes/header.php @@ -44,6 +44,9 @@ $headerTemp->add('BODYTAGS',(isset($bodyTags)) ? $bodyTags : ''); $headerTemp->add('HEADTAGS',isset($headtags) ? $headtags : ''); $headerTemp->add('EXTRATITLE',isset($title) ? ($title . ' - ') : ''); $headerTemp->add('PAGEID',(isset($pageID)) ? $pageID : 'none'); +$headerTemp->add(strtoupper($pageCategory) . 'ACTIVE', ' CLASS="active"'); +$headerTemp->add('REDIRPAGE',rawurlencode($_SERVER['REQUEST_URI'])); +$headerTemp->add('LOGDATA',echoLogData()); if (isset($_POST['message'])) { diff --git a/pages/blog.php b/pages/blog.php index f99ad17..d55f9a4 100755 --- a/pages/blog.php +++ b/pages/blog.php @@ -106,27 +106,7 @@ if (isset($_GET['post'])) $page_id = 'updates-' . $getpost3['id']; include('includes/comments.php'); - $getrelated = "SELECT *, MATCH (title, text) AGAINST (\"" . addslashes($getpost3['title']) . "\") AS score FROM updates WHERE MATCH (title, text) AGAINST (\"" . addslashes($getpost3['title']) . "\") AND id <> " . $getpost3['id'] . " LIMIT 0,5"; - $getrelated2 = mysql_query($getrelated); - $i=0; - while ($getrelated3[$i] = mysql_fetch_array($getrelated2)) - { - if ($i==0) - { - $template = new FITemplate('related'); - } - - $template->adds_block('POST', array( 'TITLE' => $getrelated3[$i]['title'], - 'CODED' => $getrelated3[$i]['slug'], - 'AUTHOR' => $getrelated3[$i]['author'], - 'DATE' => date('F d<\S\U\P>S Y',strtotime($getrelated3[$i]['pubDate'])))); - $i++; - } - - if ($i > 0) - { - $template->display(); - } + displayRelated($getpost3['title'], $getpost3['id']); } else { generateError('404'); } @@ -135,6 +115,7 @@ if (isset($_GET['post'])) if (isset($_GET['author'])) { $title = 'Author: ' . $_GET['author'] . ' - Blog Archive'; + $template->add('HEADER', 'Posts by ' . $_GET['author']); $getposts = "SELECT * FROM updates AS u WHERE author = \"" . $_GET['author'] . "\" ORDER BY id DESC"; $getbio = "SELECT * FROM bio WHERE username = \"" . $_GET['author'] . "\""; $getbio2 = mysql_query($getbio); @@ -148,9 +129,11 @@ if (isset($_GET['post'])) } elseif (isset($_GET['tag'])) { $title = 'Tag: ' . $_GET['tag'] . ' - Blog Archive'; + $template->add('HEADER', 'Posts tagged with ' . $_GET['tag']); $getposts = "SELECT * FROM updates AS u, tags AS t WHERE u.id = t.post_id AND t.post_type = \"published\" AND t.tag = \"" . $_GET['tag'] . "\" ORDER BY u.id DESC"; } else { $title = 'Blog Archive'; + $template->add('HEADER', 'Blog Archive'); $getposts = "SELECT * FROM updates AS u ORDER BY id DESC"; } $getposts2 = mysql_query($getposts); @@ -166,10 +149,6 @@ if (isset($_GET['post'])) $curID++; } $template->add_ref($curID, 'MONTH', array('TITLE' => date('F Y',strtotime($getposts3[$i]['pubDate'])))); - if ($curID == 0) - { - $template->adds_ref_sub($curID, 'BIGEND',array('exi'=>1)); - } $lastmonth = date('m-Y',strtotime($getposts3[$i]['pubDate'])); } @@ -195,23 +174,9 @@ if (isset($_GET['post'])) $comText = $total_post . ' Comments'; } - if ($curID == 0) - { - $template->adds_ref_sub($curID, 'BIG',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), - 'CODED' => $getposts3[$i]['slug'], - 'TITLE' => $getposts3[$i]['title'], - 'ID' => $getposts3[$i]['id'], - 'YEARID' => ((date('Y',strtotime($getposts3[$i]['pubDate']))-2006) % 4), - 'MONTH' => date('M',strtotime($getposts3[$i]['pubDate'])), - 'DAY' => date('d',strtotime($getposts3[$i]['pubDate'])), - 'AUTHOR' => $getposts3[$i]['author'], - 'PLURALCOMMENT' => (isset($plural) ? $plural : ''), - 'COMMENTS' => $comText)); - } else { - $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), - 'CODED' => $getposts3[$i]['slug'], - 'TITLE' => $getposts3[$i]['title'])); - } + $template->adds_ref_sub($curID, 'SMALL',array( 'DATE' => date('m-d-Y',strtotime($getposts3[$i]['pubDate'])), + 'CODED' => $getposts3[$i]['slug'], + 'TITLE' => $getposts3[$i]['title'])); $i++; } if ($i==0) diff --git a/pages/login.php b/pages/login.php index 690a0e8..a787729 100755 --- a/pages/login.php +++ b/pages/login.php @@ -22,7 +22,7 @@ if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);} require('headerproc.php'); -$noMembers=1; +$pageCategory = 'log'; if (!isset($_GET['submit'])) { diff --git a/pages/poll.php b/pages/poll.php index d871a7d..2dee559 100755 --- a/pages/poll.php +++ b/pages/poll.php @@ -26,12 +26,12 @@ $pageCategory = 'poll'; if (isset($_GET['submit'])) { - $setip = "INSERT INTO didpollalready SET ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; - $setip2 = mysql_query($setip); - $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; - $getpoll2 = mysql_query($getpoll); - $getpoll3 = mysql_fetch_array($getpoll2); - $setpoll = "UPDATE polloftheweek SET clicks" . $_POST['options'] . " = " . ($getpoll3['clicks' . $_POST['options']]+1) . " WHERE id = " . $getpoll3['id']; + $setip = "INSERT INTO didpollalready SET ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; + $setip2 = mysql_query($setip); + $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; + $getpoll2 = mysql_query($getpoll); + $getpoll3 = mysql_fetch_array($getpoll2); + $setpoll = "UPDATE polloftheweek SET clicks" . $_POST['options'] . " = " . ($getpoll3['clicks' . $_POST['options']]+1) . " WHERE id = " . $getpoll3['id']; $setpoll2 = mysql_query($setpoll); $template = new FITemplate('msg'); @@ -43,17 +43,57 @@ if (isset($_GET['submit'])) { $template = new FITemplate('pollIndex'); - $getpolls = "SELECT * FROM polloftheweek ORDER BY id DESC"; + if (isset($_GET['start'])) + { + $start = $_GET['start'] * 10; + } else { + $start = 0; + } + + $getpolls = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT " . $start . ",10"; $getpolls2 = mysql_query($getpolls); $i=0; while ($getpolls3[$i] = mysql_fetch_array($getpolls2)) { + $question = strip_tags($getpolls3[$i]['question']); + if (strlen($question) > 50) + { + $question = substr($question, 0, 50); + while (substr($question, strlen($question)-1) != ' ') + { + $question = substr($question, 0, strlen($question)-1); + } + + $question = substr($question, 0, strlen($question)-1); + $question .= '....'; + } $template->adds_block('POLL', array( 'ID' => $getpolls3[$i]['id'], - 'QUESTION' => $getpolls3[$i]['question'], - 'WEEK' => date('F jS Y', strtotime($getpolls3[$i]['week'])))); + 'QUESTION' => $question, + 'WEEK' => date('F jS Y', strtotime($getpolls3[$i]['week'])), + 'EVEN' => (($i % 2 == 1) ? ' CLASS="even"' : ''))); $i++; } + if ($i==0) + { + generateError('404'); + exit; + } + + $start /= 10; + if ($start > 0) + { + $template->adds_block('PREVIOUS', array('ID' => ($start-1))); + } + + $cntpolls = "SELECT COUNT(*) FROM polloftheweek"; + $cntpolls2 = mysql_query($cntpolls); + $cntpolls3 = mysql_fetch_array($cntpolls2); + if ($start < floor($cntpolls3['COUNT(*)'] / 10)) + { + $template->adds_block('NEXT', array('ID' => ($start+1))); + } + include('pages/polloftheweek.php'); $template->display(); @@ -95,6 +135,8 @@ if (isset($_GET['submit'])) $page_id = 'polloftheweek-' . $getpoll3['id']; include('includes/comments.php'); + + displayRelated($getpoll3['question']); } ?> diff --git a/pages/quotes.php b/pages/quotes.php index b02875e..8aaa5db 100755 --- a/pages/quotes.php +++ b/pages/quotes.php @@ -25,10 +25,6 @@ require('headerproc.php'); include('includes/functions_quotes.php'); $pageCategory = 'quotes'; -$headtags = ''; - -$template = new FITemplate('quotes/header'); -$template->display(); if (isset($_GET['id'])) { diff --git a/theme/archive.tpl b/theme/archive.tpl index b06aad9..1a73af2 100755 --- a/theme/archive.tpl +++ b/theme/archive.tpl @@ -1,37 +1,8 @@ +

+

- -
- - -
-

- - - -

- - - - - - -  » - -
-
- - |
- - -


- diff --git a/theme/css/blog.php b/theme/css/blog.php index b4b80d0..bef21dd 100644 --- a/theme/css/blog.php +++ b/theme/css/blog.php @@ -91,6 +91,13 @@ div.entry { font: 75%/150% Arial, "Trebuchet MS", Tahoma; } +div.entry ol, +div.entry ul, +a[name|="comment"]+div.bubble ol, +a[name|="comment"]+div.bubble ul { + margin-left: 3em; +} + +

+ -
+
+ +
+
+
+
+ +
+
+
+
diff --git a/theme/pollIndex.tpl b/theme/pollIndex.tpl index 18b3c43..ced43cf 100755 --- a/theme/pollIndex.tpl +++ b/theme/pollIndex.tpl @@ -17,8 +17,19 @@ Welcome to the Poll of the Week! Feel free to vote on these! You can review old ones and also comment on them if you're logged in using the links below!

-

    + + -
  • - Week of
  • + > - +
    QuestionWeek
    + +

    + + Previous + + + + Next + +

    diff --git a/theme/post.tpl b/theme/post.tpl index 3314d4e..a2342be 100755 --- a/theme/post.tpl +++ b/theme/post.tpl @@ -55,7 +55,7 @@
on - + diff --git a/theme/quotes/browse.tpl b/theme/quotes/browse.tpl index 7b4312a..2880dfb 100755 --- a/theme/quotes/browse.tpl +++ b/theme/quotes/browse.tpl @@ -2,16 +2,20 @@ -

+

-# -+ -() -- -[X] +

+ # + + + () + - + [X] -

+
+ + +

diff --git a/theme/quotes/header.tpl b/theme/quotes/header.tpl deleted file mode 100644 index 620a4d0..0000000 --- a/theme/quotes/header.tpl +++ /dev/null @@ -1,47 +0,0 @@ - -- cgit 1.4.1