I was searching for this mod about week and just know find it
it is the hard mod i ever see .. to install it conf me i dont no what line i should edit or add ..
could u please add for me this mod
PHP Code:
// pre-cache templates used by specific actions
$actiontemplates = array();
// ####################### PRE-BACK-END ACTIONS ##########################
function exec_postvar_call_back()
{
global $_REQUEST;
if ($_REQUEST['goto'] == 'lastpost' OR $_REQUEST['goto'] == 'newpost' OR $_REQUEST['goto'] == 'postid')
{
global $noheader;
$noheader = 1;
}
}
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once('./includes/functions_bigthree.php');
require_once('./includes/functions_showthread.php');
require_once('./includes/functions_warning.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
globalize($_REQUEST, array(
'perpage' => INT,
'pagenumber' => INT,
'highlight' => STR,
'posted' => INT,
'goto'
));
$hierarchical=$warn_opts['hierarchical'];
$viewoption=$warn_opts['viewoption'];
$buttons=$warn_opts['textbutoption'];
// *********************************************************************************
// set $threadedmode (continued from sessions.php)
if ($vboptions['allowthreadedmode'])
{
if (!isset($threadedmode))
{
DEVDEBUG('$threadedmode is empty');
if ($bbuserinfo['threadedmode'] == 3)
{
$threadedmode = 0;
}
else
{
$threadedmode = $bbuserinfo['threadedmode'];
}
}
switch ($threadedmode)
{
case 1:
$show['threadedmode'] = true;
$show['hybridmode'] = false;
$show['linearmode'] = false;
break;
case 2:
$show['threadedmode'] = false;
$show['hybridmode'] = true;
$show['linearmode'] = false;
break;
default:
$show['threadedmode'] = false;
$show['hybridmode'] = false;
$show['linearmode'] = true;
break;
}
}
else
{
DEVDEBUG('Threadedmode disabled by admin');
$threadedmode = 0;
$show['threadedmode'] = false;
$show['linearmode'] = true;
$show['hybridmode'] = false;
}
// make an alternate class for the selected threadedmode
$modeclass = array();
for ($i = 0; $i < 3; $i++)
{
$modeclass["$i"] = iif($i == $threadedmode, 'alt2', 'alt1');
}
// prepare highlight words
if (!empty($_GET['highlight']))
{
$highlightwords = iif($goto, '&', '&') . 'highlight=' . urlencode($_GET['highlight']);
}
else
{
$highlightwords = '';
}
// ##############################################################################
// ####################### HANDLE HEADER() CALLS ################################
// ##############################################################################
switch($goto)
{
// *********************************************************************************
// go to next newest
case 'nextnewest':
$thread = verify_id('thread', $threadid, 1, 1);
if ($getnextnewest = $DB_site->query_first("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = thread.threadid AND type = 'thread')
WHERE forumid = $thread[forumid] AND lastpost > $thread[lastpost] AND visible = 1 AND open <> 10
AND deletionlog.primaryid IS NULL
ORDER BY lastpost
LIMIT 1
"))
{
$threadid = $getnextnewest['threadid'];
unset ($thread);
}
else
{
eval(print_standard_error('error_nonextnewest'));
}
break;
// *********************************************************************************
// go to next oldest
case 'nextoldest':
$thread = verify_id('thread', $threadid, 1, 1);
if ($getnextoldest = $DB_site->query_first("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = thread.threadid AND type = 'thread')
WHERE forumid = $thread[forumid] AND lastpost < $thread[lastpost] AND visible = 1 AND open <> 10
AND deletionlog.primaryid IS NULL
ORDER BY lastpost DESC
LIMIT 1
"))
{
$threadid = $getnextoldest['threadid'];
unset($thread);
}
else
{
eval(print_standard_error('error_nonextoldest'));
}
break;
// *********************************************************************************
// goto last post
case 'lastpost':
$threadid = intval($_REQUEST['threadid']);
if (!empty($_REQUEST['forumid']))
{ // this one needs to stay AS $_REQUEST!
$forumid = verify_id('forum', $forumid, 1, 0);
$thread = $DB_site->query_first("
SELECT threadid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = thread.threadid AND type = 'thread')
WHERE forumid IN ($foruminfo[childlist]) AND visible = 1 AND (sticky = 1 OR sticky = 0)
AND lastpost >= " . ($foruminfo['lastpost'] - 30) . " AND open <> 10 AND deletionlog.primaryid IS NULL
ORDER BY lastpost DESC
LIMIT 1
");
$threadid = $thread['threadid'];
}
if (!empty($threadid))
{
if ($getlastpost = $DB_site->query_first("
SELECT MAX(postid) AS postid
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND type = 'post')
WHERE threadid = " . intval($threadid) . " AND visible = 1 AND deletionlog.primaryid IS NULL
LIMIT 1
"))
{
if ($threadedmode != 1) // if linear or hybrid
{
exec_header_redirect("showthread.php?$session[sessionurl_js]p=$getlastpost[postid]$highlightwords#post$getlastpost[postid]");
}
else // if threaded
{
$postid = $getlastpost['postid'];
}
}
}
break;
// *********************************************************************************
// goto newest unread post
case 'newpost':
$threadinfo = verify_id('thread', $threadid, 1, 1);
if (($tview = fetch_bbarray_cookie('thread_lastview', $threadid)) > $bbuserinfo['lastvisit'])
{
$bbuserinfo['lastvisit'] = $tview;
}
$posts = $DB_site->query_first("
SELECT MIN(postid) AS postid
FROM " . TABLE_PREFIX . "post
WHERE threadid = $threadinfo[threadid] AND visible = 1 AND dateline > $bbuserinfo[lastvisit]
LIMIT 1
");
if ($posts['postid'])
{
exec_header_redirect("showthread.php?$session[sessionurl_js]p=$posts[postid]$highlightwords#post$posts[postid]");
}
else
{
exec_header_redirect("showthread.php?$session[sessionurl_js]t=$threadinfo[threadid]&goto=lastpost$highlightwords");
}
break;
// *********************************************************************************
}
// end switch($goto)
// *********************************************************************************
// workaround for header redirect issue from forms with enctype in IE
// (use a scrollIntoView javascript call in the <body> onload event)
$onload = '';
// *********************************************************************************
// set $perpage
if (!$perpage)
{
$perpage = $bbuserinfo['maxposts'];
}
$checkmax = explode(',', $vboptions['usermaxposts'] . ',' . $vboptions['maxposts']);
if ($perpage < 1 OR $perpage > max($checkmax))
{
$perpage = $vboptions['maxposts'];
}
// *********************************************************************************
// set post order
if ($bbuserinfo['postorder'] == 0)
{
$postorder = '';
}
else
{
$postorder = 'DESC';
}
// *********************************************************************************
// get thread info
$thread = verify_id('thread', $threadid, 1, 1);
$threadinfo = &$thread;
// *********************************************************************************
// check for visible / deleted thread
if ((!$thread['visible'] OR $thread['isdeleted']) AND !can_moderate($thread['forumid']))
{
$idname = $vbphrase['thread'];
eval(print_standard_error('error_invalidid'));
}
// *********************************************************************************
// jump page if thread is actually a redirect
if ($thread['open'] == 10)
{
exec_header_redirect("showthread.php?$session[sessionurl_js]t=$thread[pollid]");
}
// *********************************************************************************
// Tachy goes to coventry
if (in_coventry($thread['postuserid']) AND !can_moderate($thread['forumid']))
{
$idname = $vbphrase['thread'];
eval(print_standard_error('error_invalidid'));
}
// *********************************************************************************
// do word wrapping for the thread title
if ($vboptions['wordwrap'] != 0)
{
$thread['title'] = fetch_word_wrapped_string($thread['title']);
}
// *********************************************************************************
// words to highlight from the search engine
if (!empty($highlight))
{
$highlight = preg_replace('#\*+#s', '*', $highlight);
if ($highlight != '*')
{
$regexfind = array('\*', '\<', '\>');
$regexreplace = array('[\w.:@*/?=]*?', '<', '>');
$highlight = preg_quote(strtolower($highlight), '#');
$highlight = explode(' ', $highlight);
$highlight = str_replace($regexfind, $regexreplace, $highlight);
foreach ($highlight AS $val)
{
if ($val = trim($val))
{
$replacewords[] = htmlspecialchars_uni($val);
}
}
}
}
// *********************************************************************************
// make the forum jump in order to fill the forum caches
$curforumid = $thread['forumid'];
construct_forum_jump();
// *********************************************************************************
// get forum info
$forum = fetch_foruminfo($thread['forumid']);
$foruminfo = &$forum;
// *********************************************************************************
// check forum permissions
$forumperms = fetch_permissions($thread['forumid']);
if (!($forumperms & CANVIEW))
{
print_no_permission();
}
if (!($forumperms & CANVIEWOTHERS) AND ($thread['postuserid'] != $bbuserinfo['userid'] OR $bbuserinfo['userid'] == 0))
{
print_no_permission();
}
// *********************************************************************************
// check if there is a forum password and if so, ensure the user has it set
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
// *********************************************************************************
// get ignored users
$ignore = array();
if (trim($bbuserinfo['ignorelist']))
{
$ignorelist = preg_split('/( )+/', trim($bbuserinfo['ignorelist']), -1, PREG_SPLIT_NO_EMPTY);
foreach ($ignorelist AS $ignoreuserid)
{
$ignore["$ignoreuserid"] = 1;
}
}
DEVDEBUG('ignored users: ' . implode(', ', array_keys($ignore)));
// *********************************************************************************
// filter out deletion notices if can't be seen
if (!($forumperms & CANSEEDELNOTICE) AND !can_moderate($threadinfo['forumid']))
{
$delthreadlimit = "AND deletionlog.primaryid IS NULL";
$deljoin = "LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(post.postid = deletionlog.primaryid AND type = 'post')";
$linkdeleted = false;
}
else
{
$delthreadlimit = '';
$deljoin = '';
$linkdeleted = true;
}
$show['viewpost'] = iif(can_moderate($thread['forumid']), true, false);
$show['managepost'] = iif(can_moderate($thread['forumid'], 'candeleteposts') OR can_moderate($thread['forumid'], 'canremoveposts'), true, false);
// *********************************************************************************
// find the page that we should be on to display this post
if (!empty($postid) AND $threadedmode == 0)
{
$postinfo = verify_id('post', $postid, 1, 1);
$threadid = $postinfo['threadid'];
$getpagenum = $DB_site->query_first("
SELECT COUNT(*) AS posts
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON(deletionlog.primaryid = post.postid AND type = 'post')
WHERE threadid = $threadid AND visible = 1 AND deletionlog.primaryid IS NULL
AND dateline " . iif(!$postorder, '<=', '>=') . " $postinfo[dateline]
");
$pagenumber = ceil($getpagenum['posts'] / $perpage);
}
// *********************************************************************************
// update views counter
if ($vboptions['threadviewslive'])
{
// doing it as they happen
$DB_site->shutdown_query("
UPDATE " . TABLE_PREFIX . "thread
SET views = views + 1
WHERE threadid = " . intval($threadinfo['threadid'])
);
}
else
{
// or doing it once an hour
$DB_site->shutdown_query("
INSERT INTO " . TABLE_PREFIX . "threadviews (threadid)
VALUES (" . intval($threadinfo['threadid']) . ')'
);
}
// ## <ucs>
if ($vboptions['uttpoints_enablesystem'] == '1')
{ // It's enabled! Yay!
if ($thread['postuserid'] != $bbuserinfo['userid'])
{ // Don't give points if the user viewing the thread is the one who created it.
if ($vboptions['uttpoints_perview'] != '0' && $forum['uttpoints_perview'] != '0')
{ // Both needed values are not 0... good.
$givethempoints = ($vboptions['uttpoints_perview'] * $forum['uttpoints_perview']);
}
}
if (isset($givethempoints))
{ // If they get money....
// Send the query and we're done.
$DB_site->shutdown_query("UPDATE ".TABLE_PREFIX . $vboptions[uttpoints_pointtable]." SET ".$vboptions[uttpoints_pointsfield]."=".$vboptions[uttpoints_pointsfield]."+".$givethempoints." WHERE userid='$thread[postuserid]'");
}
}
// ## </ucs>
// *********************************************************************************
// display ratings if enabled
$show['rating'] = false;
if ($forum['allowratings'] == 1)
{
if ($thread['votenum'] > 0)
{
$thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2);
$thread['rating'] = round($thread['votetotal'] / $thread['votenum']);
if ($thread['votenum'] >= $vboptions['showvotes'])
{
$show['rating'] = true;
}
}
devdebug("threadinfo[vote] = $threadinfo[vote]");
if ($threadinfo['vote'])
{
$voteselected["$threadinfo[vote]"] = HTML_SELECTED;
$votechecked["$threadinfo[vote]"] = HTML_CHECKED;
}
else
{
$voteselected[0] = HTML_SELECTED;
$votechecked[0] = HTML_CHECKED;
}
}
// *********************************************************************************
// get some vars from the referring page in order
// to put a nice back-to-forum link in the navbar
/*
unset($back);
if (strpos($_SERVER['HTTP_REFERER'], 'forumdisplay') !== false)
{
if ($vars = strchr($_SERVER['HTTP_REFERER'], '&'))
{
$pairs = explode('&', $vars);
foreach ($pairs AS $v)
{
$var = explode('=', $v);
if ($var[1] != '' and $var[0] != 'forumid')
{
$back["$var[0]"] = $var[1];
}
}
}
}
*/
// *********************************************************************************
// set page number
if ($pagenumber < 1)
{
$pagenumber = 1;
}
else if ($pagenumber > ceil(($thread['replycount'] + 1) / $perpage))
{
$pagenumber = ceil(($thread['replycount'] + 1) / $perpage);
}
// *********************************************************************************
// initialise some stuff...
$limitlower = ($pagenumber - 1) * $perpage;
$limitupper = ($pagenumber) * $perpage;
$counter = 0;
$threadview = fetch_bbarray_cookie('thread_lastview', $thread['threadid']);
$displayed_dateline = 0;
i really dont understand it .. and this mod is very importen .. i give u my showthread.php i have also modify it and i add a few mods so if u can help me to add it ..
thankyou :nervous:
|