ارجو مساعدتكم قسم المجلس العام وقسم ركن سيدات الاعمال وقسم المشاكل الاجتماعية وقسم مشاكل وحلول الحاسب
اذا حاولت افتحها يطلع الكلام اللي تحت
<?php
/*======================================================================*\
|| #################################################################### ||
|| # vBulletin 3.0.10 - Licence Number 6453270a
|| # ---------------------------------------------------------------- # ||
|| # Copyright ©2000–2005 Jelsoft Enterprises Ltd. All Rights Reserved. ||
|| # This file may not be redistributed in whole or significant part. # ||
|| # ---------------- VBULLETIN IS NOT FREE SOFTWARE ---------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html # ||
|| #################################################################### ||
\*======================================================================*/
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'forumdisplay');
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('forumdisplay');
// get special data templates from the datastore
$specialtemplates = array(
'iconcache',
'mailqueue'
);
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array(
'none' => array(
'FORUMDISPLAY',
'threadbit',
'threadbit_deleted',
'forumdisplay_announcement',
'forumhome_lastpostby',
'forumhome_forumbit_level1_post',
'forumhome_forumbit_level2_post',
'forumhome_forumbit_level1_nopost',
'forumhome_forumbit_level2_nopost',
'forumhome_subforumbit_nopost',
'forumhome_subforumseparator_nopost',
'forumdisplay_loggedinuser',
'forumhome_moderator',
'forumdisplay_moderator',
'forumdisplay_sortarrow',
'forumhome_subforumbit_post',
'forumhome_subforumseparator_post',
'forumrules'
)
);
// ####################### PRE-BACK-END ACTIONS ##########################
function exec_postvar_call_back()
{
global $_REQUEST, $session, $vboptions;
// jump from forumjump
switch ($_REQUEST)
{
case 'search': $goto = 'search'; break;
case 'pm': $goto = 'private'; break;
case 'wol': $goto = 'online'; break;
case 'cp': $goto = 'usercp'; break;
case 'subs': $goto = 'subscription'; break;
case 'home':
case '-1': $goto = $vboptions; break;
}
if ($goto != '')
{
require_once('./includes/functions.php');
exec_header_redirect("$goto.php?$session");
}
// end forumjump redirects
}
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once('./includes/functions_forumlist.php');
require_once('./includes/functions_bigthree.php');
require_once('./includes/functions_forumdisplay.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
// ############################### start mark forums read ###############################
if ($_REQUEST == 'markread')
{
$forumid = intval($_REQUEST);
if (!$forumid)
{
if ($bbuserinfo)
{
$DB_site->query("UPDATE " . TABLE_PREFIX . "user SET lastactivity = " . TIMENOW . ", lastvisit=" . (TIMENOW - 1) . " WHERE userid=$bbuserinfo");
}
else
{
vbsetcookie('lastvisit', TIMENOW);
}
$url = "$vboptions.php?$session";
eval(print_standard_redirect('markread'));
}
else
{
// temp work around code, I need to find another way to mass set some values to the cookie
$bb_cache_forum_view = unserialize(convert_bbarray_cookie($_COOKIE));
require_once('./includes/functions_misc.php');
$childforums = fetch_child_forums($forumid, 'ARRAY');
foreach ($childforums AS $val)
{ // mark the forum and all child forums read
$bb_cache_forum_view = TIMENOW;
}
set_bbarray_cookie('forum_view', $forumid, TIMENOW);
if ($foruminfo == -1)
{
$url = "$vboptions.php?$session";
}
else
{
$url = "forumdisplay.php?$sessionf=$foruminfo";
}
eval(print_standard_redirect('markread_single'));
}
}
// ############################### start enter password ###############################
if ($_REQUEST == 'doenterpwd')
{
globalize($_REQUEST, array('forumid' => INT, 'newforumpwd' => STR, 'url' => STR, 'postvars'));
$foruminfo = verify_id('forum', $forumid, 1, 1);
if ($foruminfo == $newforumpwd)
{
// set a temp cookie for guests
if (!$bbuserinfo)
{
set_bbarray_cookie('forumpwd', $forumid, md5($bbuserinfo . $newforumpwd));
}
else
{
set_bbarray_cookie('forumpwd', $forumid, md5($bbuserinfo . $newforumpwd), 1);
}
if ($url == "$vboptions.php")
{
$url = "forumdisplay.php?$sessionf=$forumid";
}
else if ($url != '' AND $url != 'forumdisplay.php')
{
$url = str_replace('"', '', $url);
}
else
{
$url = "forumdisplay.php?$sessionf=$forumid";
}
// Allow POST based redirection...
if ($postvars)
{
$temp = unserialize($postvars);
if ($temp != 'doenterpwd')
{ // ...but prevent an infinite loop
$postvars = construct_hidden_var_fields($postvars);
$formfile = $url;
}
else
{
$postvars = '';
}
}
eval(print_standard_redirect('forumpasswordcorrect'));
}
else
{
$postvars = construct_post_vars_html();
eval(print_standard_error('forumpasswordincorrect'));
}
}
// ###### END SPECIAL PATHS
globalize($_REQUEST, array('perpage' => INT, 'pagenumber' => INT, 'daysprune' => INT));
// needs this to show error if forum does not exist
$foruminfo = verify_id('forum', $forumid, 1, 1);
// get permission to view forum
$_permsgetter_ = 'forumdisplay';
$forumperms = fetch_permissions($forumid);
if (!($forumperms & CANVIEW))
{
print_no_permission();
}
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo, $foruminfo);
$show = iif($foruminfo, true, false);
$show = iif ($foruminfo, true, false);
$show = iif ($foruminfo, true, false);
// get iforumcache - for use by makeforumjump and forums list
// fetch the forum even if they are invisible since its needed
// for the title but we'll unset that further down
cache_ordered_forums(1, 1);
if (!$daysprune)
{
if ($bbuserinfo != 0)
{
$daysprune = $bbuserinfo;
}
else
{
$daysprune = iif($foruminfo, $foruminfo, 30);
}
}
// ### GET FORUMS, PERMISSIONS, MODERATOR iCACHES ########################
cache_moderators();
// draw nav bar
$navbits = array();
$parentlist = array_reverse(explode(',', substr($foruminfo, 0, -3)));
foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache;
$navbitsf=$forumID"] = $forumTitle;
}
// pop the last element off the end of the $nav array so that we can show it without a link
array_pop($navbits);
$navbits = $foruminfo;
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
$moderatorslist = '';
$listexploded = explode(',', $foruminfo);
$showmods = array();
$show = false;
$totalmods = 0;
foreach ($listexploded AS $parentforumid)
{
if (!$imodcache)
{
continue;
}
foreach ($imodcache AS $moderator)
{
if ($showmods"] === true)
{
continue;
}
$showmods"] = true;
if ($moderatorslist == '')
{
$show = true;
eval('$moderatorslist = "' . fetch_template('forumdisplay_moderator') . '";');
}
else
{
eval('$moderatorslist .= ", ' . fetch_template('forumdisplay_moderator') . '";');
}
$totalmods++;
}
}
// ### BUILD FORUMS LIST #################################################
$comma = '';
// get an array of child forum ids for this forum
$foruminfo = explode(',', $foruminfo);
// define max depth for forums display based on $vboptions
define('MAXFORUMDEPTH', $vboptions);
if ($vboptions)
{
$datecut = TIMENOW - $vboptions;
$forumusers = $DB_site->query("
SELECT user.username, (user.options & $_USEROPTIONS) AS invisible, user.usergroupid, session.userid, session.inforum, session.lastactivity,
IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid
FROM " . TABLE_PREFIX . "session AS session
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = session.userid)
WHERE session.lastactivity > $datecut
ORDER BY" . iif($vboptions == 1, " username ASC,") . " lastactivity DESC
");
$numberregistered = 0;
$doneuser = array();
if ($bbuserinfo)
{
// fakes the user being in this forum
$bbuserinfo = iif($bbuserinfo, $bbuserinfo, $bbuserinfo);
$loggedin = array(
'userid' => $bbuserinfo,
'username' => $bbuserinfo,
'invisible' => $bbuserinfo,
'invisiblemark' => $bbuserinfo,
'inforum' => $foruminfo,
'lastactivity' => TIMENOW,
'musername' => fetch_musername($bbuserinfo, 'joingroupid')
);
$numberregistered = 1;
fetch_online_status($loggedin);
eval('$activeusers = "' . fetch_template('forumdisplay_loggedinuser') . '";');
$doneuser"] = 1;
$comma = ', ';
}
$inforum = array();
$numberguest = 0;
// this require the query to have lastactivity ordered by DESC so that the latest location will be the first encountered.
while ($loggedin = $DB_site->fetch_array($forumusers))
{
if (empty($doneuser"]))
{
if (in_array($loggedin, $foruminfo) AND $loggedin != -1)
{
if (!$loggedin)
{
// this is a guest
$numberguest++;
$inforum"]++;
}
else
{
$numberregistered++;
$inforum"]++;
if (fetch_online_status($loggedin))
{
$loggedin = fetch_musername($loggedin);
eval('$activeusers .= "' . $comma . fetch_template('forumdisplay_loggedinuser') . '";');
$comma = ', ';
}
}
}
if ($loggedin)
{
$doneuser"] = 1;
}
}
}
$totalonline = $numberregistered + $numberguest;
unset($joingroupid, $key, $datecut , $comma, $invisibleuser, $userinfo, $userid, $loggedin, $index, $value, $forumusers, $parentarray );
$show = iif ($activeusers != '', true, false);
}
else
{
$show = false;
}
// #############################################################################
// get read status for this forum and children
$unreadchildforums = 0;
foreach ($foruminfo AS $val)
{
if ($val == -1 OR $val == $foruminfo)
{
continue;
}
if ($forumcache >= intval(fetch_bbarray_cookie('forum_view', $val)) AND $forumcache >= $bbuserinfo)
{
$unreadchildforums = 1;
}
}
$forumbits = construct_forum_bit($forumid);
if (can_moderate($forumid))
{
$show = true;
}
else
{
$show = false;
}
if ($permissions & CANCONTROLPANEL)
{
$show = true;
}
else
{
$show = false;
}
$curforumid = $forumid;
construct_forum_jump();
/////////////////////////////////
if ($foruminfo)
{
/////////////////////////////////
$bbforumview = intval(fetch_bbarray_cookie('forum_view', $foruminfo));
if ($bbforumview > $bbuserinfo)
{
$lastread = $bbforumview;
}
else
{
$lastread = $bbuserinfo;
}
// get announcements
$announcebits = '';
$announcements = $DB_site->query("
SELECT
announcementid, startdate, title, announcement.views,
user.username, user.userid, user.usertitle, user.customtitle
FROM " . TABLE_PREFIX . "announcement AS announcement
LEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = announcement.userid)
WHERE startdate <= " . (TIMENOW - $vboptions) . "
AND enddate >= " . (TIMENOW - $vboptions) . "
AND " . fetch_forum_clause_sql($foruminfo, 'forumid') . "
ORDER BY startdate DESC
" . iif($vboptions, "LIMIT 1"));
while ($announcement = $DB_site->fetch_array($announcements))
{
if ($announcement == 2)
{
$announcement = htmlspecialchars_uni($announcement);
}
$announcement = vbdate($vboptions, $announcement, false, true, false);
if ($announcement > $lastread)
{
$announcement = 'new';
}
else
{
$announcement = 'old';
}
$announcement = vb_number_format($announcement);
$announcementidlink = iif(!$vboptions , "&announcementid=$announcement");
eval('$announcebits .= "' . fetch_template('forumdisplay_announcement') . '";');
}
// display threads
if (!($forumperms & CANVIEWOTHERS))
{
$limitothers = "AND postuserid = $bbuserinfo AND $bbuserinfo <> 0";
}
else
{
$limitothers = '';
}
// filter out deletion notices if can't be seen
if (!($forumperms & CANSEEDELNOTICE) AND !can_moderate($forumid))
{
$delthreadlimit = "AND deletionlog.primaryid IS NULL";
$deljoin = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')";
}
else
{
$delthreadlimit = '';
$deljoin = '';
}
// remove threads from users on the global ignore list if user is not a moderator
if ($Coventry = fetch_coventry('string') AND !can_moderate($forumid))
{
$globalignore = "AND postuserid NOT IN ($Coventry) ";
}
else
{
$globalignore = '';
}
// look at thread limiting options
$stickyids = '';
$stickycount = 0;
if ($daysprune != -1)
{
$datecut = "AND lastpost >= " . (TIMENOW - ($daysprune * 86400));
$show = false;
}
else
{
$datecut = '';
$show = true;
}
// complete form fields on page
$daysprunesel = iif($daysprune == -1, 'all', $daysprune);
$daysprunesel = array($daysprunesel => HTML_SELECTED);
globalize($_REQUEST , array('sortfield', 'sortorder' => STR_NOHTML));
// look at sorting options:
if ($sortorder != 'asc')
{
$sqlsortorder = 'DESC';
$order = array('desc' => HTML_SELECTED);
}
else
{
$sqlsortorder = '';
$order = array('asc' => HTML_SELECTED);
}
switch ($sortfield)
{
case 'title':
$sqlsortfield = 'thread.title';
break;
case 'lastpost':
case 'replycount':
case 'views':
case 'postusername':
$sqlsortfield = $sortfield;
break;
case 'voteavg':
if ($foruminfo)
{
$sqlsortfield = 'voteavg';
break;
} // else, use last post
default:
$sqlsortfield = 'lastpost';
$sortfield = 'lastpost';
}
$sort = array($sortfield => HTML_SELECTED);
$threadscount = $DB_site->query_first("
SELECT COUNT(*) AS threads,
SUM(IF(lastpost>=$lastread AND open<>10,1,0)) AS newthread
FROM " . TABLE_PREFIX . "thread AS thread
$deljoin
WHERE forumid = $foruminfo
AND sticky = 0
AND visible = 1
$globalignore
$datecut
$limitothers
$delthreadlimit
");
$totalthreads = $threadscount;
$newthreads = $threadscount;
// set defaults
sanitize_pageresults($totalthreads, $pagenumber, $perpage, 200, $vboptions);
// get number of sticky threads for the first page
// on the first page there will be the sticky threads PLUS the $perpage other normal threads
// not quite a bug, but a deliberate feature!
if ($pagenumber == 1 OR $vboptions)
{
$stickies = $DB_site->query("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
$deljoin
WHERE forumid = $foruminfo
AND visible = 1
AND sticky = 1
$limitothers
$globalignore
$delthreadlimit
");
while ($thissticky = $DB_site->fetch_array($stickies))
{
$stickycount++;
$stickyids .= ",$thissticky";
}
$DB_site->free_result($stickies);
unset($thissticky, $stickies);
}
$limitlower = ($pagenumber - 1) * $perpage;
$limitupper = ($pagenumber) * $perpage;
if ($limitupper > $totalthreads)
{
$limitupper = $totalthreads;
if ($limitlower > $totalthreads)
{
$limitlower = ($totalthreads - $perpage) - 1;
}
}
if ($limitlower < 0)
{
$limitlower = 0;
}
if ($foruminfo)
{
$vboptions = intval($vboptions);
$votequery = "
IF(votenum >= $vboptions, votenum, 0) AS votenum,
IF(votenum >= $vboptions AND votenum > 0, votetotal / votenum, 0) AS voteavg,
";
}
else
{
$votequery = '';
}
if ($vboptions > 0)
{
$previewfield = "post.pagetext AS preview,";
$previewjoin = "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)";
}
else
{
$previewfield = '';
$previewjoin = '';
}
$getthreadids = $DB_site->query("
SELECT " . iif($sortfield == 'voteavg', $votequery) . " threadid
FROM " . TABLE_PREFIX . "thread AS thread
$deljoin
WHERE forumid = $foruminfo
AND sticky = 0
AND visible = 1
$globalignore
$datecut
$limitothers
$delthreadlimit
ORDER BY sticky DESC, $sqlsortfield $sqlsortorder
LIMIT $limitlower, $perpage
");
$ids = '';
while ($thread = $DB_site->fetch_array($getthreadids))
{
$ids .= ',' . $thread;
}
$ids .= $stickyids;
$DB_site->free_result($getthreadids);
unset ($thread, $getthreadids);
$threads = $DB_site->query("
SELECT $votequery $previewfield
thread.threadid, thread.title AS threadtitle, lastpost, thread.forumid, pollid, open, replycount, postusername, postuserid, thread.iconid AS threadiconid,
lastposter, thread.dateline, IF(views<=replycount, replycount+1, views) AS views, notes, thread.visible, sticky, votetotal, thread.attach
" . iif($vboptions AND $bbuserinfo, ", NOT ISNULL(subscribethread.subscribethreadid) AS issubscribed") . "
" . iif(!$deljoin, ", NOT ISNULL(deletionlog.primaryid) AS isdeleted, deletionlog.userid AS del_userid,
deletionlog.username AS del_username, deletionlog.reason AS del_reason") . "
FROM " . TABLE_PREFIX . "thread AS thread
" . iif(!$deljoin, " LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')") . "
" . iif($vboptions AND $bbuserinfo, " LEFT JOIN " . TABLE_PREFIX . "subscribethread AS subscribethread ON(subscribethread.threadid = thread.threadid AND subscribethread.userid = $bbuserinfo)") . "
$previewjoin
WHERE thread.threadid IN (0$ids)
ORDER BY sticky DESC, $sqlsortfield $sqlsortorder
");
unset($limitothers, $delthreadlimit, $deljoin,$datecut, $votequery, $sqlsortfield, $sqlsortorder, $threadids);
// Get Dot Threads
$dotthreads = fetch_dot_threads_array($ids);
if ($vboptions AND $bbuserinfo)
{
$show = true;
}
else
{
$show = false;
}
unset($ids);
// prepare sort things for column header row:
$sorturl = "forumdisplay.php?$sessionf=$forumid&daysprune=$daysprune";
$oppositesort = iif($sortorder == 'asc', 'desc', 'asc');
if ($totalthreads > 0 OR $stickyids)
{
if ($totalthreads > 0)
{
$limitlower++;
}
// check to see if there are any threads to display. If there are, do so, otherwise, show message
if ($bbuserinfo != -1 AND $bbuserinfo)
{
$vboptions = $bbuserinfo;
}
// get the icon cache
$iconcache = unserialize($datastore);
if ($vboptions > 0)
{
// Get Buddy List
$buddy = array();
if (trim($bbuserinfo))
{
$buddylist = preg_split('/( )+/', trim($bbuserinfo), -1, PREG_SPLIT_NO_EMPTY);
foreach ($buddylist AS $buddyuserid)
{
$buddy = 1;
}
}
DEVDEBUG('buddies: ' . implode(', ', array_keys($buddy)));
// Get Ignore Users
$ignore = array();
if (trim($bbuserinfo))
{
$ignorelist = preg_split('/( )+/', trim($bbuserinfo), -1, PREG_SPLIT_NO_EMPTY);
foreach ($ignorelist AS $ignoreuserid)
{
if (!$buddy)
{
$ignore = 1;
}
}
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
}
$show = true;
$threadbits = '';
$threadbits_sticky = '';
$counter = 0;
$toread = 0;
while ($thread = $DB_site->fetch_array($threads))
{ // AND $counter++<$perpage)
// build thread data
$thread = process_thread_array($thread, $lastread, $foruminfo);
if ($thread)
{
$threadbit = &$threadbits_sticky;
}
else
{
$threadbit = &$threadbits;
}
if ($thread)
{
$show = iif (can_moderate($forumid) OR ($bbuserinfo != 0 AND $bbuserinfo == $thread), true, false);
$show = iif ($thread != '', true, false);
$show = iif (can_moderate($forumid), true, false);
$show = iif (can_moderate($forumid, 'candeleteposts') OR can_moderate($forumid, 'canremoveposts') OR can_moderate($forumid, 'canmanagethreads'), true, false);
eval('$threadbit .= "' . fetch_template('threadbit_deleted') . '";');
}
else
{
eval('$threadbit .= "' . fetch_template('threadbit') . '";');
}
}
$DB_site->free_result($threads);
unset($thread, $counter);
$pagenav = construct_page_nav($totalthreads, "forumdisplay.php?$sessionf=$forumid", "&sort=$sortfield&order=$sortorder&pp=$perpage&daysprune=$daysprune");
eval('$sortarrow = "' . fetch_template('forumdisplay_sortarrow') . '";');
}
unset($threads, $dotthreads);
// get colspan for bottom bar
$foruminfo = 6;
if ($foruminfo)
{
$foruminfo++;
}
if ($foruminfo)
{
$foruminfo++;
}
$show = true;
/////////////////////////////////
} // end forum can contain threads
else
{
$show = false;
}
/////////////////////////////////
if ($newthreads < 1 AND $unreadchildforums < 1)
{
// mark a single forum as read as it appears all threads are read
set_bbarray_cookie('forum_view', $foruminfo, TIMENOW);
}
construct_forum_rules($foruminfo, $forumperms);
//remove html to stop the breaking of the meta description
$foruminfo = strip_tags($foruminfo);
$show = iif ($foruminfo != '', true, false);
$show = iif ($forumperms & CANSEARCH AND $vboptions, true, false);
$show = iif ($forumshown, true, false);
$show = iif ($threadbits_sticky != '', true, false);
eval('print_output("' . fetch_template('FORUMDISPLAY') . '");');
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 00:21, Sun Nov 20th 2005
|| # CVS: $RCSfile: forumdisplay.php,v $ - $Revision: 1.228.2.8 $
|| ####################################################################
\*======================================================================*/
?>
ارجو المساعدة
:icon33: :icon33: :icon33: :icon33: :icon33: :icon33:
lama23 @lama23
عضوة
يلزم عليك تسجيل الدخول أولًا لكتابة تعليق.
خليك أول من تشارك برأيها 💁🏻♀️