2018-09-06, 03:28 PM
hello .. i use the plugin named "A CLEAR NEWS BAR"
https://mods.mybb.com/view/a-clear-news-bar
it dosn't work with mybb 1.8.18, so i made some modification (i am not specialist in php)...now it work perfectly...but i dont know if its safe for my forum or it vulnerable.
here is the modified code :
my forum here : sciences.unaux.com
https://mods.mybb.com/view/a-clear-news-bar
it dosn't work with mybb 1.8.18, so i made some modification (i am not specialist in php)...now it work perfectly...but i dont know if its safe for my forum or it vulnerable.
here is the modified code :
<?php
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
$plugins->add_hook('pre_output_page','aclearnewsbar');
function aclearnewsbar_info()
{
return array
(
"name"=>"A clear news bar",
"description"=>"Shows a clear bar with latest news from your portal page.",
"website"=>"http://www.ajdija.com",
"author"=>"Mateusz Grzesiukiewicz",
"authorsite"=> "http://www.ajdija.com",
"version"=>"1.0",
"guid"=>"7dc27e3041bfe6e412f1a9b2f7634db2",
"compatibility"=>"18*"
);
}
function aclearnewsbar($page)
{
global $mybb,$theme, $db;
$announcements = '';
$query = $db->query("
SELECT t.*, t.username AS threadusername, tp.prefix AS THREADPREFIX, tp.displaystyle AS D_STYLE
FROM ".TABLE_PREFIX."threads t
LEFT JOIN " .TABLE_PREFIX. "threadprefixes tp ON (t.prefix = tp.pid)
WHERE t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.dateline DESC
LIMIT 0,10 "
);
$news = '';
while($announcement = $db->fetch_array($query))
{
$announcement['threadlink'] = get_thread_link($announcement['tid']);
$announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
$announcement['threadusername'] = htmlspecialchars_uni($announcement['threadusername']);
$announcement['threadprefix'] = htmlspecialchars_uni($announcement['THREADPREFIX']);
//$announcement['D_STYLE'] = htmlspecialchars_uni($announcement['D_STYLE']);
$news = $news.' '.$announcement['D_STYLE'].' '.'<strong><a href="'.htmlspecialchars_uni($announcement['threadlink']).'">'.htmlspecialchars_uni($announcement['subject']).'</a> </strong>['.htmlspecialchars_uni($announcement['threadusername']).'] <i class="fa fa-quote-left" aria-hidden="true"></i>
';
}
$page=preg_replace('#<div class="navigation">(.*)</div>#Usi','<div class="navigation">$1</div><br />
<table border="0" cellspacing="'.$theme["borderwidth"].'" cellpadding="'.$theme["tablespace"].'" class="tborder" style="border-radius: 6px 6px 0 0;">
<thead>
<tr>
<td class="thead" width="100" align="center" style="color: aquamarine; border-radius: 0 6px 0 0"><strong>آخر '.
/* Use below code and set ^^(width) higher if you want board name to be said:
$mybb->settings['bbname']
*/
'المواضيع : </strong></td><td class="thead" style="color: aqua;border-radius: 6px 0 0 0;text-shadow:none;"><marquee direction="right" scrollamount="6" onmouseover="this.stop();" onmouseout="this.start();">'.$news.'</marquee></td>
</tr>
</thead>
</table>',$page);
return $page;
}
?>
my forum here : sciences.unaux.com