Loversama
06-28-2011, 01:10 PM
<?php
error_reporting(E_ALL & ~E_NOTICE);
define('THIS_SCRIPT', 'articles');
$phrasegroups = array('forumdisplay');
$specialtemplates = array('navbar'
);
$globaltemplates = array(
'af_articlebit',
'af_articles',
'af_catbit',
'af_center',
'af_right',
'af_left',
'shell_blank',
'af_articlesmallbit',
'af_authorsmallbit',
'af_letter',
);
$actiontemplates = array(
);
require_once('./global.php');
require_once(DIR . '/includes/functions.php');
require_once(DIR . '/includes/functions_forumdisplay.php');
$custom_global_css_reference = ',vbcms.css,postbit-lite.css,postlist.css,lightbox.css';
if ($vbulletin->options['af_parsebbcode'])
{
require_once(DIR . '/includes/class_bbcode.php');
}
//require_once(DIR . '/includes/functions_forumlist.php');
/*$navbits = construct_navbits(array(
'articles.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase[articles],
'' => construct_phrase('Error')
));
eval('$navbar = "' . fetch_template('navbar') . '";');*/
$sort = array($sortfield => 'selected="selected"');
$selectedletter =& $ltr;
$ltr = $vbulletin->input->clean_gpc('r', 'ltr', TYPE_NOHTML);
if ($ltr != '')
{
if ($ltr == '#')
{
$condition .= " AND thread.title NOT REGEXP(\"^[a-zA-Z]\")";
}
else
{
$ltr = chr(intval(ord($ltr)));
$condition .= " AND thread.title LIKE(\"" . $db->escape_string_like($ltr) . "%\")";
}
}
if ($vbulletin->options['af_letterbit'])
{
$currentletter = '#';
$linkletter = urlencode('#');
$show['selectedletter'] = $selectedletter == '#' ? true : false;
$templater = vB_Template::create('af_letter');
$templater->register('currentletter', $currentletter);
$templater->register('linkletter', $linkletter);
$templater->register('i', $i);
$templater->register('c', $c);
$templater->register('perpage', $perpage);
$templater->register('sortorder', $sortorder);
$templater->register('sortfield', $sortfield);
$templater->register('usergrouplink', $usergrouplink);
$templater->register('ltrurl', $ltrurl);
$letterbits .= $templater->render();
// now do alpha-characters
for ($i=65; $i < 91; $i++)
{
$currentletter = chr($i);
$linkletter =& $currentletter;
$show['selectedletter'] = $selectedletter == $currentletter ? true : false;
$templater = vB_Template::create('af_letter');
$templater->register('currentletter', $currentletter);
$templater->register('linkletter', $linkletter);
$templater->register('i', $i);
$templater->register('c', $c);
$templater->register('perpage', $perpage);
$templater->register('sortorder', $sortorder);
$templater->register('sortfield', $sortfield);
$templater->register('usergrouplink', $usergrouplink);
$templater->register('ltrurl', $ltrurl);
$letterbits .= $templater->render();
}
}
$threadscount = $db->query_first_slave("
SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > $lastread AND open <> 10, 1, 0)) AS newthread
FROM " . TABLE_PREFIX . "thread AS thread
WHERE forumid IN( $forumids )
$visiblethreads $authorids $condition
");
$totalthreads = $threadscount['threads'];
if ($totalthreads == 0)
{
$a_breaking .= $vbphrase['no_articles_found'];
if ($ltr || $c)
{
$a_breaking .= construct_phrase($vbphrase['try_expanding_article_search'], 'articles.php'.($c ? "?c=$c" : ""));
}
}
$newthreads = $threadscount['newthread'];
sanitize_pageresults($totalthreads, $pagenumber, $perpage, 200, $vbulletin->options['maxthreads']);
$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 (is_array($postforums) && !empty($postforums))
{
$f = array($c => 'selected="selected"');
foreach ($postforums as $pforumid => $pforumtitle)
{
if ($pforumid > 0 && $pforumtitle)
{
$depth = count(explode(",", $vbulletin->forumcache[$pforumid][parentlist])) - 3;
$i = 0;
$spacing = '';
while ($i < $depth)
{
$spacing .= " - ";
$i++;
}
$f_options .= '<option value="'.$pforumid.'" '.$f[$pforumid].'>'.$spacing . $pforumtitle.'</option>';
}
}
}
elseif ($foruminfo['allowposting'] && ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostnew']))
{
$f_options .= '<option value="'.$forumid.'" '.$f[$forumid].'>'.$spacing . $foruminfo[title_clean].'</option>';
}
$pagenav = construct_page_nav($pagenumber, $perpage, $totalthreads, 'articles.php?' . $vbulletin->session->vars['sessionurl'], ""
. (!empty($c) ? "&c=$c" : '')
. (!empty($vbulletin->GPC['perpage']) ? "&pp=$perpage" : '')
. (!empty($vbulletin->GPC['prefixid']) ? "&prefixid=" . $vbulletin->GPC['prefixid'] : '')
. (!empty($vbulletin->GPC['sortfield']) ? "&sort=$sortfield" : "")
. (!empty($vbulletin->GPC['sortorder']) ? "&order=" . $vbulletin->GPC['sortorder'] : '')
. (!empty($vbulletin->GPC['daysprune']) ? "&daysprune=$daysprune" : '')
. (!empty($vbulletin->GPC['aid']) ? "&aid=$authorid" : '')
. (!empty($ltr) ? "&ltr=".urlencode($ltr) : '')
);
$mostreadlink = 'articles.php?' . $vbulletin->session->vars['sessionurl']
. (!empty($c) ? "&c=$c" : '')
. (!empty($vbulletin->GPC['perpage']) ? "&pp=$perpage" : '')
. (!empty($vbulletin->GPC['prefixid']) ? "&prefixid=" . $vbulletin->GPC['prefixid'] : '')
. "&sort=views"
. (!empty($vbulletin->GPC['sortorder']) ? "&order=" . $vbulletin->GPC['sortorder'] : '')
. (!empty($vbulletin->GPC['daysprune']) ? "&daysprune=$daysprune" : '');
$mostcommentedlink = 'articles.php?' . $vbulletin->session->vars['sessionurl']
. (!empty($c) ? "&c=$c" : '')
. (!empty($vbulletin->GPC['perpage']) ? "&pp=$perpage" : '')
. (!empty($vbulletin->GPC['prefixid']) ? "&prefixid=" . $vbulletin->GPC['prefixid'] : '')
. "&sort=replycount"
. (!empty($vbulletin->GPC['sortorder']) ? "&order=" . $vbulletin->GPC['sortorder'] : '')
. (!empty($vbulletin->GPC['daysprune']) ? "&daysprune=$daysprune" : '');
if ($vbulletin->options['af_widththumb'])
{
$thumbdivstyle = "text-align: center; width: ".$vbulletin->options['attachthumbssize']."px;";
}
$threads = $db->query_read("
SELECT thread.*,thread.title AS threadtitle,thread.forumid AS forumid, post.dateline AS postdateline, post.pagetext AS preview, MIN(attachment.attachmentid) AS attachmentid, fd.extension AS extension, thread.prefixid
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post
ON (post.postid = thread.firstpostid)
LEFT JOIN " . TABLE_PREFIX . "attachment AS attachment
ON (attachment.contentid = thread.firstpostid AND attachment.contenttypeid = 1)
LEFT JOIN " . TABLE_PREFIX . "filedata AS fd ON (fd.filedataid = attachment.filedataid AND fd.extension IN('jpg', 'gif', 'png', 'jpeg', 'bmp'))
WHERE thread.forumid IN ($forumids)
$visiblethreads $authorids $condition
GROUP BY thread.threadid
ORDER BY $sqlsortfield $sqlsortorder
" . (!empty($sqlsortfield2) ? ", $sqlsortfield2 $sqlsortorder" : '') . "
LIMIT $limitlower, $perpage
");
$show['threads'] = true;
$row = 0;
$foruminfo['allowicons'] = 1;
while($thread = $db->fetch_array($threads))
{
if ($thread['prefixid'])
{
$thread['prefix_rich'] = $vbphrase["prefix_$thread[prefixid]_title_rich"];
}
$thread['pagetext'] = $thread['preview'];
$thread['altimage'] = false;
$row++;
$post[date] = vbdate($vbulletin->options['dateformat'],$thread['postdateline']) . " " . vbdate($vbulletin->options['timeformat'],$thread['postdateline']);
if (!($thread['attachmentid'] && $thread['extension']) && $vbulletin->options['af_altthumb'] && !$vbulletin->options[af_parsebbcode])
{
$thread['images'] = preg_match_all('#\[img\]\s*(https?://([^*\r\n]+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', $thread['preview'], $thread['matches']);
if ($thread['images'] !== false)
{
$thread['altimage'] = true;
}
$thread['image'] = $thread['matches'][1][0];
}
if (!$vbulletin->options['af_parsebbcode'])
{
if ($vbulletin->options['af_threadpreview'] == -1)
{
$vbulletin->options['af_threadpreview'] = $vbulletin->options['threadpreview'];
}
if ($vbulletin->options['threadmarking'] AND $vbulletin->userinfo['userid'])
{
$thisforuminfo['forumread'] = $vbulletin->forumcache["$thread[forumid]"]['forumread'];
$lastread = max($thisforuminfo['forumread'], TIMENOW - ($vbulletin->options['markinglimit'] * 86400));
}
else
{
$thisbbforumview = intval(fetch_bbarray_cookie('forum_view', $thread['forumid']));
$lastread = max($thisbbforumview, $vbulletin->userinfo['lastvisit']);
}
$thread['preview'] = preg_replace(array("/\[attach\](\d*)\[\/attach]/i", "/\[attach=(left|right)\](\d*)\[\/attach]/i"), "", $thread['preview']);
$thread['preview'] = preg_replace('#\[img\]\s*(https?://([^*\r\n]+|[a-z0-9/\\._\- !]+))\[/img\]#iUe', '', $thread['preview']);
$thread['preview'] = str_replace(' ',' ', $thread['preview']);
//$thread['preview'] = str_replace(array("\n", "\r"), " ", trim($thread['preview']));
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
if (strlen($thread['preview'])>$vbulletin->options['af_threadpreview'])
{
$thread['preview'] = trim(substr($thread['preview'], 0, $vbulletin->options['af_threadpreview']))."...";
}
//$thread['preview'] = nl2br($thread['preview']);
}
else
{
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
if ($vbulletin->options['af_threadpreview'] > -1 && strlen($thread['pagetext'])>$vbulletin->options['af_threadpreview'])
{
$thread['pagetext'] = substr($thread['pagetext'], 0, $vbulletin->options['af_threadpreview'])."...";
}
elseif (strlen($thread['pagetext'])>$vbulletin->options['threadpreview'])
{
$thread['pagetext'] = substr($thread['pagetext'], 0, $vbulletin->options['threadpreview'])."...";
}
$thread['preview'] = $bbcode_parser->parse($thread['pagetext']);
}
$templater = vB_Template::create('af_articlebit');
$templater->register('post', $post);
$templater->register('thread', $thread);
$templater->register('row', $row);
$templater->register('foruminfo', $foruminfo);
$templater->register('thumbdivstyle', $thumbdivstyle);
$a_breaking .= $templater->render();
}
if ($totalthreads > 0 || $row > 0)
{
$limitlower++;
}
$daysprunesel = iif($daysprune == -1, 'all', $daysprune);
$daysprunesel = array($daysprunesel => 'selected="selected"');
if (in_array('mostread', $af_modules))
{
$row = 0;
$af_mrpp = $vbulletin->options[af_mrpp];
$threads = $db->query_read("
SELECT thread.threadid,thread.title AS threadtitle
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post
ON (post.postid = thread.firstpostid)
WHERE thread.forumid IN ($forumids)
$visiblethreads $authorids $condition
ORDER BY views DESC
LIMIT 0, $af_mrpp");
while($thread = $db->fetch_array($threads))
{
$row++;
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
$thread[threadtitle] = substr($thread[threadtitle], 0, $vbulletin->options[af_maxtitle]);
$templater = vB_Template::create('af_articlesmallbit');
$templater->register('row', $row);
$templater->register('thread', $thread);
$templater->register('foruminfo', $foruminfo);
$a_most_read .= $templater->render();
}
}
if (in_array('mostcommented', $af_modules))
{
$row = 0;
$af_mcpp = $vbulletin->options[af_mcpp];
$threads = $db->query_read("
SELECT thread.threadid,thread.title AS threadtitle
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "post AS post
ON (post.postid = thread.firstpostid)
WHERE thread.forumid IN ($forumids)
$visiblethreads $authorids $condition
ORDER BY replycount DESC
LIMIT 0, $af_mcpp");
while($thread = $db->fetch_array($threads))
{
$row++;
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
$thread[threadtitle] = substr($thread[threadtitle], 0, $vbulletin->options[af_maxtitle]);
$templater = vB_Template::create('af_articlesmallbit');
$templater->register('row', $row);
$templater->register('thread', $thread);
$templater->register('foruminfo', $foruminfo);
$a_most_commented .= $templater->render();
}
}
if (in_array('topauthors', $af_modules))
{
$af_tapp = $vbulletin->options[af_tapp];
$threads = $db->query_read("
SELECT COUNT(*) AS threads, postusername AS username, postuserid AS userid
FROM " . TABLE_PREFIX . "thread AS thread
WHERE thread.forumid IN ($forumids)
$visiblethreads $condition
GROUP BY postuserid
ORDER BY threads DESC
LIMIT 0, $af_tapp");
while($thread = $db->fetch_array($threads))
{
$row++;
$thread[username] = substr($thread[username], 0, 25);
$templater = vB_Template::create('af_authorsmallbit');
$templater->register('row', $row);
$templater->register('thread', $thread);
$templater->register('foruminfo', $foruminfo);
$a_top_authors .= $templater->render();
}
}
$templater = vB_Template::create("af_left");
$templater->register('foruminfo', $foruminfo);
$templater->register('a_cats', $a_cats);
$templater->register('af_search', $af_search);
$templater->register('gobutton', $gobutton);
$templater->register('c', $c);
$templater->register('sort', $sort);
$templater->register('order', $order);
$templater->register('daysprunesel', $daysprunesel);
$templater->register('limitlower', $limitlower);
$templater->register('limitupper', $limitupper);
$templater->register('totalthreads', $totalthreads);
$templater->register('af_displayoptions', $af_displayoptions);
$templater->register('f_options', $f_options);
$templater->register('af_modules', $af_modules);
$templater->register('c_count', $c_count);
$templater->register('prefix_options', $prefix_options);
$a_left = $templater->render();
$templater = vB_Template::create("af_center");
$templater->register('foruminfo', $foruminfo);
$templater->register('a_breaking', $a_breaking);
$templater->register('pagenav', $pagenav);
$a_center = $templater->render();
$templater = vB_Template::create("af_right");
$templater->register('foruminfo', $foruminfo);
$templater->register('a_most_read', $a_most_read);
$templater->register('a_most_commented', $a_most_commented);
$templater->register('mostreadlink', $mostreadlink);
$templater->register('mostcommentedlink', $mostcommentedlink);
$templater->register('a_top_authors', $a_top_authors);
$a_right = $templater->render();
$templater = vB_Template::create("af_articles");
$templater->register('a_left', $a_left);
$templater->register('a_center', $a_center);
$templater->register('a_right', $a_right);
$templater->register('letterbits', $letterbits);
$templater->register('a_most_read', $a_most_read);
$templater->register('a_most_commented', $a_most_commented);
$templater->register('a_top_authors', $a_top_authors);
$templater->register('foruminfo', $foruminfo);
$templater->register('title', $title);
$templater->register('sort', $sort);
$templater->register('ltr', $ltr);
$templater->register('perpage', $perpage);
$templater->register('pagenumber', $page);
$templater->register('order', $order);
$templater->register('daysprunesel', $daysprunesel);
$templater->register('totalthreads', $totalthreads);
$templater->register('prefix_options', $prefix_options);
$templater->register('pagenav', $pagenav);
$html = $templater->render();
if ($vbulletin->options['storecssasfile'])
{
$vbcsspath = 'clientscript/vbulletin_css/style' . str_pad($style['styleid'], 5, '0', STR_PAD_LEFT) . $vbulletin->stylevars['textdirection']['string'][0] . '/';
}
else
{
// textdirection var added to prevent cache if admin modified language text_direction. See bug #32640
$vbcsspath = 'css.php?styleid=' . $style['styleid'] . '&langid=' . LANGUAGEID . '&d=' . $style['dateline'] . '&td=' . $vbulletin->stylevars['textdirection']['string'] . '&sheet=';
}
$headinclude .= '<link rel="stylesheet" type="text/css" href="css.php?styleid='.$vbulletin->userinfo['styleid'].'&langid='.$vbulletin->userinfo['langid'].'&d='.$vbulletin->userinfo['dateline'].'&td='.$vbulletin->userinfo['td'].'&sheet=vbcms.css,postbit-lite.css,postlist.css,lightbox.css" />';
$navbits = array();
if (!$c)
{
$c = $vbulletin->options['af_forumids'];
}
/*if ($c)
{*/
$cforuminfo = $vbulletin->forumcache["$c"];
$cparentlist = array_reverse(explode(',', substr($cforuminfo['parentlist'], 0, -3)));
foreach ($cparentlist AS $cforumID)
{
if ($vbulletin->options['af_forumids'] == $cforumID)
{
$navbits['articles.php' . $vbulletin->session->vars['sessionurl_q']] = $vbphrase['articles'];
continue;
}
if ($c == $cforumID)
{
continue;
}
$cforumTitle = $vbulletin->forumcache["$cforumID"]['title'];
//$navbits[fetch_seo_url('articles', array('cforumid' => $cforumID, 'title' => $cforumTitle))] = $cforumTitle;
if (in_array($vbulletin->options['af_forumids'], explode(',', $vbulletin->forumcache["$cforumID"]['parentlist'])))
{
$navbits['articles.php?' . $vbulletin->session->vars['sessionurl'] . 'c=' . $cforumID] = $cforumTitle;
}
else
{//forumdisplay.php
$s = fetch_seo_url('forum', $vbulletin->forumcache["$cforumID"]);
$navbits["$s"] = $cforumTitle;
}
}
//$navbits[''] = construct_phrase($title);
if ($c != $vbulletin->options['af_forumids'])
{
$navbits[''] = $thread['prefix_rich'] . ' ' . $title;
}
/*}
else
{
$navbits[''] = construct_phrase($vbphrase['articles']);
}*/
$headinclude .= "\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\"css.php?d=" . TIMENOW . "&td=" . vB_Template_Runtime::fetchStyleVar('textdirection' ) . "&styleid=" . $vbulletin->userinfo['styleid'] . "&sheet=memberlist.css\" />";
$navbits = construct_navbits($navbits);
if ($vbulletin->options['storecssasfile'])
{
$headinclude .= "\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\"css.php?d=" . TIMENOW . "&td=" . vB_Template_Runtime::fetchStyleVar('textdirection' ) . "&styleid=" . $vbulletin->userinfo['styleid'] . "&sheet=forumdisplay-rollup.css\" />";
}
else
{
$headinclude .= "\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\"css.php?d=" . TIMENOW . "&td=" . vB_Template_Runtime::fetchStyleVar('textdirection' ) . "&styleid=" . $vbulletin->userinfo['styleid'] . "&sheet=toolsmenu.css,forumbits.css,forumdisplay.cs s,threadlist.css,options.css\" />";
}
$templater = vB_Template::create('shell_blank');
$templater->register_page_templates();
$templater->register('navbar', $navbar);
$templater->register('headinclude', $headinclude);
$templater->register('pagetitle', "SinfulShadows Gaming Community");
$templater->register('html', $html);
$templater->register('sidebarext', $sidebarext);
$templater->register('sidebaropen', $sidebaropen);
print_output($templater->render());
}
?>
I added Notices on the bottom, I have also tried to include Everywhere sidebar and wasn't able to, my website is www.SinfulShadows.com I am using the Articles plugin, and and trying to include things like notices and other things (as I am using the articles.php as the homepage for my website.
P.S the script was to big to quote al, so I cut some out..
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.