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 +++ 5 files changed, 70 insertions(+), 29 deletions(-) (limited to 'includes') 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'])) { -- cgit 1.4.1