/***************************************************************************
Jupiter Content System @ Jupiterportal.com
Copyright (C) 2005 Cosmin Flavius (highstrike@gmail.com)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
More Info About The Licence At http://www.gnu.org/copyleft/gpl.html
****************************************************************************/
//-----------------------------------------------------------------
// If user is guest and restriction is turned on
//-----------------------------------------------------------------
if($config['forum_guest_see'] == "0" && isset($is_guest))
{ header("location: $PHP_SELF?i=2"); exit; }
//-----------------------------------------------------------------
// Start Navigation
//-----------------------------------------------------------------
switch($a)
{
//-----------------------------------------------------------------
// Show Forum
//-----------------------------------------------------------------
case 1:
//-----------------------------------------------------------------
// Load MYSQL Table + Breadcrumbs
//-----------------------------------------------------------------
$forum_cat = $db->getLine("SELECT id, name FROM forum_cat",$d);
if(!$forum_cat) header("location: $PHP_SELF?i=error");
echo "
{$config['forum_name']} » {$forum_cat['name']} |
= $forum_cat['name'] ?> |
= $language['Forum view forum desc'] ?> | = $language['Forum view forum desc2'] ?> | = $language['Forum view forum desc3'] ?> | = $language['Forum view forum desc4'] ?> |
//-----------------------------------------------------------------
// Get subcats
//-----------------------------------------------------------------
$results = $db->getTable("SELECT s.id AS sid, s.name, s.succession, s.type, s.description, s.topics, s.replies, s.lastpost_date, s.lastpost_email, s.lastpost_user, s.lastpost_id, s.lastpost_location, s.lastpost_reg, u.id AS uid FROM forum_subcat AS s LEFT JOIN users AS u ON s.lastpost_id=u.id WHERE s.cat = '$d' ORDER BY s.succession ASC");
//-----------------------------------------------------------------
// Start the foreach
//-----------------------------------------------------------------
foreach($results as $idx=>$result)
{
//-----------------------------------------------------------------
// Check see what indicator fits
//-----------------------------------------------------------------
if($result['type'] == "5") $forum_indicator = "";
else
{
if(@in_array(array("{$result['sid']}","{$result['lastpost_date']}"),$_SESSION['subcat']) && !@in_array(array("{$result['sid']}","{$result['lastpost_date']}"),$_SESSION['subcat_read']))
{
if($result['type'] == "1") $forum_indicator = "";
if($result['type'] == "2") $forum_indicator = "";
if($result['type'] == "3") $forum_indicator = "";
if($result['type'] == "4") $forum_indicator = "";
}
else
{
if($result['type'] == "1") $forum_indicator = "";
if($result['type'] == "2") $forum_indicator = "";
if($result['type'] == "3") $forum_indicator = "";
if($result['type'] == "4") $forum_indicator = "";
}
}
//-----------------------------------------------------------------
// Do some HTML
//-----------------------------------------------------------------
echo "$forum_indicator | ";
echo "{$result['name']} {$result['description']} | ";
echo ""; if($result['type'] == "5") echo "--"; else echo $result['topics']; echo " | ";
echo ""; if($result['type'] == "5") echo "--"; else echo $result['replies']; echo " | ";
echo "";
if(!isset($result['redirect_hits'])) $result['redirect_hits'] = "0";
if($result['type'] == "5") echo "{$language['Forum view forum desc7']} {$result['redirect_hits']}";
else
{
if(!isset($result['lastpost_date'])) echo "--";
else
{
echo " ".today_yesterday($result['lastpost_date'])." {$language['Forum view forum desc6']} ";
if(isset($result['uid'])) echo "{$result['lastpost_user']}";
else echo "{$result['lastpost_user']}";
echo " ";
}
echo " |
";
}
}
//-----------------------------------------------------------------
// Show Indicators
//-----------------------------------------------------------------
?>
|
| = $language['Forum indicator desc'] ?> |
|
| = $language['Forum indicator desc2'] ?> |
|
| = $language['Forum indicator desc3'] ?> |
|
| = $language['Forum indicator desc4'] ?> |
|
| = $language['Forum indicator desc5'] ?> |
|
| = $language['Forum indicator desc6'] ?> |
|
| = $language['Forum indicator desc7'] ?> |
|
| = $language['Forum indicator desc8'] ?> |
|
| = $language['Forum indicator desc9'] ?> |
|
break;
//-----------------------------------------------------------------
// Show Topics
//-----------------------------------------------------------------
case 2:
//-----------------------------------------------------------------
// Breadcrumbs + Check for existance
//-----------------------------------------------------------------
$forum_cat = $db->getLine("SELECT id, name FROM forum_cat",$d);
if(!$forum_cat) header("location: $PHP_SELF?i=error");
$forum_subcat = $db->getLine("SELECT id, name, type, redirect_hits, redirect_location, lastpost_date FROM forum_subcat",$o);
if(!$forum_subcat) header("location: $PHP_SELF?i=error");
echo "";
//-----------------------------------------------------------------
// Start Restictions + Redirections
//-----------------------------------------------------------------
if($forum_subcat['type'] == "3" && isset($is_guest) || $forum_subcat['type'] == "3" && isset($is_user)){ header("location: $PHP_SELF?i=2"); exit; }
if($forum_subcat['type'] == "5")
{
$redirect_plus_plus = $forum_subcat['redirect_hits'] + 1;
$db->updateRow("forum_subcat",array('redirect_hits' => ''.$redirect_plus_plus.''),"id = '$o'");
header("location: http://{$forum_subcat['redirect_location']}");
}
//-----------------------------------------------------------------
// Navigation Stuff
//-----------------------------------------------------------------
$rows_per_page = $config['nav_topics'];
$numrows = $db->getInfo_countRows("forum_topics","cat = '$d' AND subcat = '$o' AND mode != '1'");
$lastpage = ceil($numrows/$rows_per_page);
$p = (int)$p;
if ($p < 1) $p = 1;
elseif ($p > $lastpage) $p = $lastpage;
if($numrows != FALSE) $limit = 'LIMIT ' .($p - 1) * $rows_per_page .',' .$rows_per_page;
else $limit = NULL;
//-----------------------------------------------------------------
// Load MYSQL Table
//-----------------------------------------------------------------
if($numrows != "0") $forum_topics = $db->getTable("SELECT t.*, ua.id AS uaid, COUNT(r.id) AS replies, ul.id AS ulid FROM forum_topics AS t LEFT JOIN users AS ua ON t.author_id=ua.id LEFT JOIN forum_replies AS r ON r.topic=t.id LEFT JOIN users AS ul ON t.lastpost_id=ul.id WHERE t.cat = '$d' AND t.subcat = '$o' AND t.mode != '1' GROUP BY t.id ORDER by mode ASC, 'lastpost_date' DESC $limit");
else $forum_topics = NULL;
//-----------------------------------------------------------------
// Navigation Code
//-----------------------------------------------------------------
if(!$forum_topics) $nav_prev = NULL;
elseif($p == 1) $nav_prev = NULL;
else
{
$prevpage = $p-1;
$nav_prev = " = $forum_subcat['name'] ?> |
= $language['Forum view topics desc'] ?> | = $language['Forum view topics desc2'] ?> | = $language['Forum view topics desc3'] ?> | = $language['Forum view topics desc4'] ?> | = $language['Forum view topics desc5'] ?> |
//-----------------------------------------------------------------
// Check for Announcement Topic
//-----------------------------------------------------------------
$forum_announcement = $db->getLine("SELECT t.*, ua.id AS uaid, COUNT(r.id) AS replies, ul.id AS ulid FROM forum_topics AS t LEFT JOIN users AS ua ON t.author_id=ua.id LEFT JOIN forum_replies AS r ON r.topic=t.id LEFT JOIN users AS ul ON t.lastpost_id=ul.id WHERE t.cat = '$d' AND t.subcat = '$o' AND t.mode = '1' GROUP BY t.id");
//-----------------------------------------------------------------
// If Announcement Topic exists then show it
//-----------------------------------------------------------------
if($forum_announcement != FALSE)
{
//-----------------------------------------------------------------
// Do the HTML
//-----------------------------------------------------------------
echo " | ";
echo "".cuttext($forum_announcement['name'],30)." | ";
echo "".($forum_announcement['replies'] - 1)." | ";
if(isset($forum_announcement['uaid'])) echo "{$forum_announcement['author_user']} | ";
else echo "{$forum_announcement['author_user']} | ";
echo "{$forum_announcement['views']} | ";
//-----------------------------------------------------------------
// Do more HTML
//-----------------------------------------------------------------
if($forum_announcement['type'] == 3) echo "{$language['Forum view forum desc5']} {$forum_announcement['redirect_hits']} |
";
else
{
echo " ".today_yesterday($forum_announcement['lastpost_date'])." {$language['Forum view topics desc7']} ";
if(isset($forum_announcement['ulid'])) echo "{$forum_announcement['lastpost_user']}";
else echo "{$forum_announcement['lastpost_user']}";
echo " | ";
}
}
//-----------------------------------------------------------------
// Check see if topics or announcement exists, else message
//-----------------------------------------------------------------
if(!$forum_topics && !$forum_announcement) echo "{$language['Forum view topics desc9']} |
";
elseif(isset($forum_topics))
{
//-----------------------------------------------------------------
// Start the foreach if topics exist
//-----------------------------------------------------------------
foreach($forum_topics as $idx=>$result)
{
//-----------------------------------------------------------------
// Check see what indicator fits
//-----------------------------------------------------------------
if($result['mode'] == "2") $forum_indicator = "";
if($result['mode'] == "3")
{
if(@in_array(array("{$result['id']}","{$result['subcat']}","{$result['lastpost_date']}"),$_SESSION['topic']) && !@in_array(array("{$result['id']}","{$result['subcat']}","{$result['lastpost_date']}"),$_SESSION['topic_read']))
{
if($result['type'] == "1")
{
if(($result['replies'] - 1) >= $config['forum_hot']) $forum_indicator = "";
else $forum_indicator = "";
}
if($result['type'] == "2") $forum_indicator = "";
}
else
{
if($result['type'] == "1")
{
if(($result['replies'] - 1) >= $config['forum_hot']) $forum_indicator = "";
else $forum_indicator = "";
}
if($result['type'] == "2") $forum_indicator = "";
}
if($result['type'] == "3") $forum_indicator = "";
}
//-----------------------------------------------------------------
// Count the replies
//-----------------------------------------------------------------
$page = ceil($result['replies']/$config['nav_replies']);
if($page > 1) $inner_pag = "[ ".paginate($page, 0, "$PHP_SELF?n=modules/forum&a=3&d={$forum_cat['id']}&o={$forum_subcat['id']}&q={$result['id']}")." ]";
else $inner_pag = NULL;
//-----------------------------------------------------------------
// Do some HTML
//-----------------------------------------------------------------
echo "$forum_indicator | ";
echo "".cuttext($result['name'],30)." $inner_pag | ";
if($result['type'] == 3) echo "-- | "; else echo "".($result['replies'] - 1)." | ";
if(isset($result['uaid'])) echo "{$result['author_user']} | ";
else echo "{$result['author_user']} | ";
if($result['type'] == 3) echo "-- | "; else echo "{$result['views']} | ";
if($result['type'] == 3) echo "{$language['Forum view topics desc8']} {$result['redirect_hits']} |
";
else
{
echo " ".today_yesterday($result['lastpost_date'])." {$language['Forum view topics desc7']} ";
if(isset($result['ulid'])) echo "{$result['lastpost_user']}";
else echo "{$result['lastpost_user']}";
echo " | ";
}
}
}
//-----------------------------------------------------------------
// Show Indicators
//-----------------------------------------------------------------
?>
|
| = $language['Forum indicator desc10'] ?> |
|
| = $language['Forum indicator desc11'] ?> |
|
| = $language['Forum indicator desc12'] ?> |
|
| = $language['Forum indicator desc13'] ?> |
|
| = $language['Forum indicator desc14'] ?> |
|
| = $language['Forum indicator desc15'] ?> |
|
| = $language['Forum indicator desc16'] ?> |
|
| = $language['Forum indicator desc17'] ?> |
|
| = $language['Forum indicator desc18'] ?> |
|
break;
//-----------------------------------------------------------------
// Show Replies
//-----------------------------------------------------------------
case 3:
//-----------------------------------------------------------------
// Breadcrumbs + Check for existance
//-----------------------------------------------------------------
$forum_cat = $db->getLine("SELECT * FROM forum_cat",$d);
if(!$forum_cat) header("location: $PHP_SELF?i=error");
$forum_subcat = $db->getLine("SELECT * FROM forum_subcat",$o);
if(!$forum_subcat) header("location: $PHP_SELF?i=error");
$forum_topic = $db->getLine("SELECT * FROM forum_topics",$q);
if(!$forum_topic) header("location: $PHP_SELF?i=error");
echo " = $forum_topic['name'] ?> |
//-----------------------------------------------------------------
// Get Ranks and first min post
//-----------------------------------------------------------------
$ranks_db = $db->getTable("SELECT * FROM forum_ranks");
$first_rank = $db->getLine("SELECT * FROM forum_ranks ORDER BY posts LIMIT 1");
//-----------------------------------------------------------------
// Start foreach
//-----------------------------------------------------------------
foreach($results as $idx=>$result)
{
//-----------------------------------------------------------------
// Get correct post count
//-----------------------------------------------------------------
$correct_post_count = $idx + (($p - 1) * $rows_per_page + 1);
//-----------------------------------------------------------------
// Choose either member or guest
//-----------------------------------------------------------------
if(isset($result['uid']))
{
//-----------------------------------------------------------------
// Check see if user is online
//-----------------------------------------------------------------
if(isset($result['oid'])) $result['online'] = " | ";
else $result['online'] = " | ";
//-----------------------------------------------------------------
// Check and get the extra buttons from user's profile
//-----------------------------------------------------------------
if($result['hideemail'] != "1") $result_email = " | | "; else $result_email = NULL;
if(isset($result['url'])) $result_website = " | | "; else $result_website = NULL;
if(isset($result['msn'])) $result_msn = " | | "; else $result_msn = NULL;
if(isset($result['yahoo'])) $result_yahoo = " | | "; else $result_yahoo = NULL;
if(isset($result['icq'])) $result_icq = " | | "; else $result_icq = NULL;
if(isset($result['aim'])) $result_aim = " | | "; else $result_aim = NULL;
if(isset($result['skype'])) $result_skype = " | | "; else $result_skype = NULL;
if(isset($result['signature'])) $user_signature = "
{$language['Forum view replies desc7']}
".parse_message($result['signature']); else $user_signature = NULL;
//-----------------------------------------------------------------
// Get the specific rank
//-----------------------------------------------------------------
if($ranks_db != FALSE)
{
if($result['authorization'] != 1) $rank = find_authorization($result['authorization']);
else
{
if($result['status'] == "banned") $rank = find_status($result['status']);
else
{
if ($result['forumposts'] < $first_rank['posts']) $rank = find_authorization($result['authorization']);
foreach($ranks_db as $idx=>$cur_rank) if ($result['forumposts'] >= $cur_rank['posts']) $rank = $cur_rank['name'];
}
}
}
else $rank = find_authorization($result['authorization']);
//-----------------------------------------------------------------
// Do the HTML
//-----------------------------------------------------------------
echo "{$result['user_user']} | ".today_yesterday($result['date'])." | #$correct_post_count |
|
";
echo "".find_avatar($result['avatar'])." | $rank
{$language['Forum view replies desc']} ".date("d-M y",$result['registered'])." "; if(find_flag($result['flag'],$result['location'], true, true)) echo "{$language['Forum view replies desc1']} ".find_flag($result['flag'],$result['location'], true, true)." "; echo "{$language['Forum view replies desc2']} {$result['forumposts']}";
if(isset($is_administrator) || isset($is_webmaster)) echo "
{$language['Forum view replies desc3']} {$result['ip']} | ";
else echo "";
echo "".parse_message($result['message'])."$user_signature | ";
//-----------------------------------------------------------------
// Do the Admin buttons
//-----------------------------------------------------------------
if(isset($is_administrator) && $result['authorization'] != "4" || isset($is_webmaster) || isset($is_moderator) && $result['authorization'] < "3" || $result['user_id'] == @$_SESSION['id'])
{
if($forum_topic['mode'] == "1" && isset($is_guest) || $forum_topic['mode'] == "1" && isset($is_user) || $forum_topic['mode'] == "1" && isset($is_moderator))
echo " | ";
else
{
echo "";
if($correct_post_count == 1)
{
if(isset($is_administrator) || isset($is_webmaster) || isset($is_moderator)) if($forum_topic['mode'] != "1") echo "";
echo "";
}
else echo "";
echo " | ";
}
}
else echo " | ";
//-----------------------------------------------------------------
// Do more HTML
//-----------------------------------------------------------------
echo "
{$result['online']} | |
| $result_email$result_website$result_msn$result_yahoo$result_icq$result_aim$result_skype |
|
";
echo " |
";
}
else
{
//-----------------------------------------------------------------
// Do the HTML
//-----------------------------------------------------------------
echo "{$result['user_user']} | ".today_yesterday($result['date'])." | #$correct_post_count |
|
";
echo "{$language['Forum view replies desc5']}";
if(isset($is_administrator) || isset($is_webmaster)) echo "
{$language['Forum view replies desc3']} {$result['ip']} | ";
else echo "";
echo "".parse_message($result['message'])." | ";
//-----------------------------------------------------------------
// Do the Admin buttons
//-----------------------------------------------------------------
if(isset($is_administrator) || isset($is_webmaster) || isset($is_moderator) || $result['ip'] == find_ip() && !isset($is_user))
{
echo "";
if($correct_post_count == 1)
{
if(isset($is_administrator) || isset($is_webmaster) || isset($is_moderator)) echo "";
echo "";
}
else echo "";
echo " | ";
}
else echo " | ";
//-----------------------------------------------------------------
// Do more HTML
//-----------------------------------------------------------------
echo "
| |
";
echo " |
";
}
}
?>
= $language['Forum add reply desc9'] ?> |
= $layout ?>
break;
}
break;
//-----------------------------------------------------------------
// Find Last reply
//-----------------------------------------------------------------
case 6:
//-----------------------------------------------------------------
// Get Current Reply
//-----------------------------------------------------------------
$forum_reply = $db->getLine("SELECT cat, subcat, topic FROM forum_replies",$d);
//-----------------------------------------------------------------
// Calculate the Page
//-----------------------------------------------------------------
$numposts = $db->getInfo_countRows("forum_replies","cat = '{$forum_reply['cat']}' AND subcat = '{$forum_reply['subcat']}'");
$p = ceil($numposts/$config['nav_replies']);
//-----------------------------------------------------------------
// Redirect when finished
//-----------------------------------------------------------------
header("location: $PHP_SELF?n=modules/forum&a=3&d={$forum_reply['cat']}&o={$forum_reply['subcat']}&q={$forum_reply['topic']}&p=$p#$d");
break;
//-----------------------------------------------------------------
// Moderate Topics
//-----------------------------------------------------------------
case 7:
//-----------------------------------------------------------------
// Filter Acces Rightes
//-----------------------------------------------------------------
if(isset($is_guest) || isset($is_user))
{ header("location: $PHP_SELF?i=2"); exit; }
//-----------------------------------------------------------------
// Start secondary switch
//-----------------------------------------------------------------
switch($c)
{
//-----------------------------------------------------------------
// Open/Lock/Move the topic
//-----------------------------------------------------------------
case 1:
//-----------------------------------------------------------------
// Get Original
//-----------------------------------------------------------------
$forum_topic = $db->getLine("SELECT * FROM forum_topics",$q);
//-----------------------------------------------------------------
// Write in database
//-----------------------------------------------------------------
$db->updateRow("forum_topics",array('type' => ''.$topic_type.''),"id = '$q'");
//-----------------------------------------------------------------
// Write Log
//-----------------------------------------------------------------
if($topic_type == 1) $topic_type_name = "Open";
else $topic_type_name = "Locked";
if($forum_topic['type'] != $topic_type)
$db->insertRow("log",array('user_id' => ''.$_SESSION['id'].'','user_user' => ''.$_SESSION['username'].'','log' => ''.$language['Logs desc2'].' {$result['cname']} |
";
echo "{$language['Forum view forums desc']} | {$language['Forum view forums desc2']} | {$language['Forum view forums desc3']} | {$language['Forum view forums desc4']} |
";
$cur_category = $result['cid'];
}
//-----------------------------------------------------------------
// Show categories if any
//-----------------------------------------------------------------
if($result['sid'] != FALSE)
{
//-----------------------------------------------------------------
// Check see what indicator fits
//-----------------------------------------------------------------
if($result['type'] == "5") $forum_indicator = "";
else
{
if(@in_array(array("{$result['sid']}","{$result['lastpost_date']}"),$_SESSION['subcat']) && !@in_array(array("{$result['sid']}","{$result['lastpost_date']}"),$_SESSION['subcat_read']))
{
if($result['type'] == "1") $forum_indicator = "";
if($result['type'] == "2") $forum_indicator = "";
if($result['type'] == "3") $forum_indicator = "";
if($result['type'] == "4") $forum_indicator = "";
}
else
{
if($result['type'] == "1") $forum_indicator = "";
if($result['type'] == "2") $forum_indicator = "";
if($result['type'] == "3") $forum_indicator = "";
if($result['type'] == "4") $forum_indicator = "";
}
}
//-----------------------------------------------------------------
// Do some HTML
//-----------------------------------------------------------------
echo "$forum_indicator | ";
echo "{$result['name']} {$result['description']} | ";
echo ""; if($result['type'] == "5") echo "--"; else echo $result['topics']; echo " | ";
echo ""; if($result['type'] == "5") echo "--"; else echo $result['replies']; echo " | ";
echo "";
if(!isset($result['redirect_hits'])) $result['redirect_hits'] = "0";
if($result['type'] == "5") echo "{$language['Forum view forums desc7']} {$result['redirect_hits']}";
else
{
if(!isset($result['lastpost_date'])) echo "--";
else
{
echo " ".today_yesterday($result['lastpost_date'])." {$language['Forum view forums desc6']} ";
if(isset($result['uid'])) echo "{$result['lastpost_user']}";
else echo "{$result['lastpost_user']}";
echo " ";
}
echo " |
";
}
}
}
if($cur_category > 0) echo " |
{$language['Forum view forums desc8']} |
";
else
{
//-----------------------------------------------------------------
// Show Indicators
//-----------------------------------------------------------------
?>
| = $language['Forum indicator desc'] ?> |
|
| = $language['Forum indicator desc2'] ?> |
|
| = $language['Forum indicator desc3'] ?> |
|
| = $language['Forum indicator desc4'] ?> |
|
| = $language['Forum indicator desc5'] ?> |
|
| = $language['Forum indicator desc6'] ?> |
|
| = $language['Forum indicator desc7'] ?> |
|
| = $language['Forum indicator desc8'] ?> |
|
| = $language['Forum indicator desc9'] ?> |
|
}
break;
}
?>