مرجع پارسی MyBB

نسخه‌ی کامل: تغیر سرعت در این پلاگین
شما درحال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب‌بندی مناسب.
سلام این کد های پلاگین نوار اخبار متحرک هست خواستم ببینم چطور سرعتشو میشه کند کرد خیلی تند میره نیشه خوندش اصلاConfused
کد:
<?php

/*
A clear news bar plugin for MyBB

* v. 1.0
* Last edit: 5 August 2010
* Shows a clear news bar on your forum pages.
* Copyright (C) 2009 & 2010 Mateusz Grzesiukiewicz also known as Ajdija
* Website: http://www.ajdija.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 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

if(!defined('IN_MYBB'))
{
    die();
}

$plugins->add_hook('pre_output_page','aclearnewsbar');

function aclearnewsbar_info()
{
    return array
    (
        "name"=>"نوار اخبار متحرک",
        "description"=>"نمابش نوار اخبار متحرک از آخرین موصضوع ها <br><i> فارسی سازی شده توسط : <i><b><a href=\"http://www.mybbiran.com\"><font color=\"#FF0000\">MyBBIran.com</font></a></b></i>",
        "website"=>"http://www.ajdija.com",
        "author"=>"Mateusz Grzesiukiewicz",
        "authorsite"=> "http://www.ajdija.com",
        "version"=>"1.0",
        "guid"=>"7dc27e3041bfe6e412f1a9b2f7634db2",
        "compatibility"=>"16*"
    );
}

function aclearnewsbar($page)
{
    global $mybb,$theme, $db;
        if(THIS_SCRIPT!='portal.php') // do not show news bar on portal(news) page
        {
        $announcementsfids = explode(',', $mybb->settings['portal_announcementsfid']);
if(is_array($announcementsfids))
{
    foreach($announcementsfids as $fid)
    {
        $fid_array[] = intval($fid);
    }
    $announcementsfids = implode(',', $fid_array);
}
$query = $db->simple_select("forums", "*", "fid IN (".$announcementsfids.")");
while($forumrow = $db->fetch_array($query))
{
    $forum[$forumrow['fid']] = $forumrow;
}

$pids = '';
$tids = '';
$comma = '';
$query = $db->query("
    SELECT p.pid, p.message, p.tid
    FROM ".TABLE_PREFIX."posts p
    LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=p.tid)
    WHERE t.fid IN (".$announcementsfids.") AND t.visible='1' AND t.closed NOT LIKE 'moved|%' AND t.firstpost=p.pid
    ORDER BY t.dateline DESC
    LIMIT 0, ".$mybb->settings['portal_numannouncements']
);
while($getid = $db->fetch_array($query))
{
    $pids .= ",'{$getid['pid']}'";
    $tids .= ",'{$getid['tid']}'";
    $posts[$getid['tid']] = $getid;
}
$pids = "pid IN(0{$pids})";
$query = $db->simple_select("attachments", "*", $pids);
while($attachment = $db->fetch_array($query))
{
    $attachcache[$attachment['pid']][$attachment['aid']] = $attachment;
}

if(is_array($forum))
{
    foreach($forum as $fid => $forumrow)
    {
        $forumpermissions[$fid] = forum_permissions($fid);
    }
}

$announcements = '';
$query = $db->query("
    SELECT t.*, t.username AS threadusername, u.username, u.avatar
    FROM ".TABLE_PREFIX."threads t
    LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid = t.uid)
    WHERE t.fid IN (".$announcementsfids.") AND t.tid IN (0{$tids}) AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
    ORDER BY t.dateline DESC
    LIMIT 0, ".$mybb->settings['portal_numannouncements']
);

$news = '--- ';
while($announcement = $db->fetch_array($query))
{
    $announcement['threadlink'] = get_thread_link($announcement['tid']);
    $announcement['subject'] = htmlspecialchars_uni($announcement['subject']);
    $news = $news.'<a href="'.htmlspecialchars_uni($announcement['threadlink']).'">'.htmlspecialchars_uni(        $announcement['subject']).'</a> --- ';
}
        
            $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">
    <thead>
        <tr>
            <td class="thead" width="100" align="center"><strong>مهمترین '.
            /* Use below code and set ^^(width) higher if you want board name to be said:
            $mybb->settings['bbname']
            */
            'اخبار: </strong></td><td class="thead"><strong><marquee direction="right"onmouseover="this.stop();" onmouseout="this.start();"
scrollamount="5">'.$news.'</marquee></strong></td>
        </tr>
    </thead>
</table>',$page);
        return $page;
        }
    }

?>
کسی نیست به ما کمک کنهConfused