Dołącz do zespołu ekspertów! Backend lub Frontend Developer?

Sprawdź najnowsze oferty pracy naszego partnera - 8lines.io!

Jak dać na dół statystykę

Założony przez  menmon.

wersja skryptu MyBB: 1.6.8
adres forum:fy24.pl
na czym polega problem (screen, opis, komunikaty):
Mam prośbę. Jak dać tą statystykę na dół? Jest to najlepsza 10. Spolszczyłem sobie,lecz nie wiem jak dać ją na dół do statystyk :/
<?php
/*********************************************************************************************
+ Top X Stats v0.1 : A Plugin for MyBB 1.4 and 1.6
+ Free to Use
+ Free to Edit
+ But Not Allowed to distribute
**********************************************************************************************
*/
if(!defined("IN_MYBB")){
    die(
"Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function 
top5stats_info(){
    return array(        
"name"            => "Najlepsza 10",        "description"    => "Top stats of your community with extended permissions on the top of your forums.",        "website"        => "http://yaldaram.com",        "author"        => "Yaldaram",        "authorsite"    => "http://yaldaram.com",        "version"        => "0.1",        "compatibility" => "14*,16*",        "guid" => "27c97e51eab01165090aa3e7a063a069"    );
}
function 
top5stats_activate(){
    global 
$db$mybb;
    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
    
$template = array(
        
"title"        => "top5stats_index",
        
"template"    => '
<table width="50%" cellpadding="6" cellspacing="1" border="0" class="tborder">
<tbody>
<tr>
<td class="thead" colspan="4">
<div class="expcolimage">
  <img src="images/collapse_collapsed.gif" id="newbox_img" class="expander" alt="[-]" title="[-]" /></div>
<strong>Top {$mybb->settings[\\\'top5stats_postnum\\\']} Stats</strong>
</td>
</tr>
</tbody>
<tbody style="{$collapsed[\\\'newbox_e\\\']}" id="newbox_e">
<tr>
<td class="tcat" align="center"><span class="smalltext"><strong>Najnowsze posty</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Najnowsze tematy</strong></span></td>
<td class="tcat" align="center"><span class="smalltext"><strong>Najlepsi posterzy</strong></span></td>
</tr>
<tr>
<td class="trow1" valign="top">
{$scrolling}{$lpp}</marquee>
</td>
<td class="trow2" valign="top">
{$ntt}
</td>
<td class="trow1" valign="top">
{$tpp}
</td>
<td class="trow2" valign="top">
{$nc}
</td>
</tr>
</tbody>
</table><div align="right"><font size="1">Brought to you by <i>Yaldaram</i> of <a href="http://yaldaram.com">Yaldaram.com</a></font></div><br />'
,
        
"sid"        => -1
    
);
    
$db->insert_query("templates"$template);
    
$template = array(
        
"title"        => "Ostatnie posty",
        
"template"    => '
<div class="smalltext"><a href="{$postlink}" title="{$lp[\\\'subject\\\']}">{$lpsubject}</a></<div> --- 
<div class="float_right smalltext"><a href="{$profilelink}">{$lpusername}</a></div>'
,
        
"sid"        => -1
    
);
    
$db->insert_query("templates"$template);
    
$template = array(
        
"title"        => "Najnowsze tematy.",
        
"template"    => '
<div class="smalltext"><a href="{$threadlink}" title="{$nt[\\\'subject\\\']}">{$ntsubject}</a>
--- <a href="{$profilelink}">{$ntusername}</a>{$who_posted}'
,
        
"sid"        => -1
    
);
    
$db->insert_query("templates"$template);
    
$template = array(
        
"title"        => "Najlepsi posterzy",
        
"template"    => '
<div class="smalltext"><a href="{$profilelink}">{$tpusername}</a>
--- <a href="search.php?action=finduser&amp;uid=$uid">{$tppostnum}</a></div>'
,
        
"sid"        => -1
    
);
    
$db->insert_query("templates"$template);
    
$template = array(
        
"title"        => "newcomers",
        
"template"    => '
<div class="smalltext"><a href="{$profilelink}">{$ncusername}</a>
--- <a href="search.php?action=finduser&amp;uid={$uid}">{$ncpostnum}</a></div>'
,
        
"sid"        => -1
    
);
    
$db->insert_query("templates"$template);
find_replace_templatesets("index""#".preg_quote('{$forums}')."#i"'{\$top5index}{\$forums}');
    
$top5stats_group = array(        "gid"            => "NULL",        "name"            => "top5stats_set",        "title"         => "Top X Stats",        "description"    => "Settings for the plugin.",        "disporder"        => "1",        "isdefault"        => "no",    );
    
$db->insert_query("settinggroups"$top5stats_group);
    
$gid $db->insert_id();
    
$top5stats_setting_1 = array(        "sid"            => "NULL",        "name"            => "top5stats_power",        "title"            => "Power",        "description"    => "Click ON if you want to run this plugin.",        "optionscode"    => "onoff",        "value"            => "1",        "disporder"        => "1",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_1);
    
$top5stats_setting_4 = array(        "sid"            => "NULL",        "name"            => "top5stats_postnum",        "title"            => "How_Much_Latest_Posts ?",        "description"    => "How much Latest Posts do you want to show ?",        "optionscode"    => "text",        "value"            => "5",        "disporder"        => "4",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_4);
    
$top5stats_setting_5 = array(        "sid"            => "NULL",        "name"            => "top5stats_scroll",        "title"            => "Scrolling ?",        "description"    => "Do you want to scroll Latest Posts ?",        "optionscode"    => "yesno",        "value"            => "0",        "disporder"        => "5",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_5);
    
$top5stats_setting_6 = array(        "sid"            => "NULL",        "name"            => "top5stats_direction",        "title"            => "Scroll_Direction ?",        "description"    => "Select scroll direction.",
        
"optionscode"    => "select
up=Up
down=Down
right=Right
left=Left"
,
        
"value"            => "up",        "disporder"        => "6",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_6);
    
$top5stats_setting_7 = array(        "sid"            => "NULL",        "name"            => "top5stats_stop",        "title"            => "Scrolling_Stop ?",        "description"    => "Do you want to stop scrolling when mouse comes over to link ?",        "optionscode"    => "yesno",        "value"            => "0",        "disporder"        => "7",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_7);
    
$top5stats_setting_8 = array(        "sid"            => "NULL",        "name"            => "top5stats_who_posted",        "title"            => "Who_Posted ?",        "description"    => "Do you want to show Who Posted in Newest Threads ? <font size=1><i>(These are the number of replies in the corresponding threads)</i></font>",        "optionscode"    => "yesno",        "value"            => "1",        "disporder"        => "8",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_8);
    
$top5stats_setting_9 = array(        "sid"            => "NULL",        "name"            => "top5stats_num",        "title"            => "How_Much_Other_Things ?",        "description"    => "How much Other Things do you want to show ?",        "optionscode"    => "text",        "value"            => "5",        "disporder"        => "9",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_9);
    
$top5stats_setting_10 = array(        "sid"            => "NULL",        "name"            => "top5stats_guests",        "title"            => "Guests_Allow ?",        "description"    => "Do you want Guests to see Top 5 Stats ? (Add guest\'s usergroup ID in the field below aswell)",        "optionscode"    => "yesno",        "value"            => "0",        "disporder"        => "10",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_10);
    
$top5stats_setting_11 = array(        "sid"            => "NULL",        "name"            => "top5stats_group",        "title"            => "Allowed_Groups ?",        "description"    => "Specify usergroups who can see this Top X Box. Separate with , if more then one.",        "optionscode"    => "text",        "value"            => "3,4,6,8",        "disporder"        => "11",        "gid"            => intval($gid),    );
    
$db->insert_query("settings"$top5stats_setting_11);
    
rebuild_settings();
}
function 
top5stats_deactivate(){
    global 
$db$mybb;
    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index""#".preg_quote('{$top5index}')."#i"''0);
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='top5stats_index'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='latestposts'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='newthreads'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='topposters'");
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='newcomers'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='top5stats_set'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_power'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_postnum'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_scroll'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_direction'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_stop'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_who_posted'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_num'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_guests'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='top5stats_group'");
    
rebuild_settings();
}
function 
topstats($subject$length){
    if (
$length != "0"){
        if (
strlen($subject) > $length){
        
$subject substr($subject,0,$length) . "...";
        }
    }
    return 
$subject;
}
function 
get_unviewable(){
    
$unviewwhere "";
    
$unviewable get_unviewable_forums();
    if(
$unviewable){
        
$unviewwhere "AND fid NOT IN (".$unviewable.")";
    }
    return 
$unviewwhere;
}
$plugins->add_hook("index_start""top5stats_index");
function 
top5stats_index(){
    global 
$db$mybb$templates$theme$top5index;
    
$power $mybb->settings['top5stats_power'];
    
$guests $mybb->settings['top5stats_guests'];
    if (
$power != "0"){
// For Newest Users
$nc "";
$newcomers $db->query("
        SELECT username,postnum,uid,usergroup,displaygroup 
        FROM "
.TABLE_PREFIX."users 
        ORDER BY uid DESC 
        LIMIT 0,"
.$mybb->settings['top5stats_num']."");
        while (
$user $db->fetch_array($newcomers)){
            
$uid $user['uid'];
            
$ncusername build_profile_link(format_name($user['username'],$user['usergroup'],$user['displaygroup']), $user['uid']);
            
$ncusername++;
            
$ncpostnum $user['postnum'];
        eval(
"\$nc .= \"".$templates->get("newcomers")."\";");
        }
// For Top Posters
$tp "";
$topposters $db->query ("
        SELECT username,postnum,uid,usergroup,displaygroup 
        FROM "
.TABLE_PREFIX."users 
        ORDER BY postnum DESC 
        LIMIT 0,"
.$mybb->settings['top5stats_num']."");
        while (
$tp $db->fetch_array($topposters)){
            
$uid $tp['uid'];
            
$tpusername build_profile_link(format_name($tp['username'],$tp['usergroup'],$tp['displaygroup']), $tp['uid']);
            
$tppostnum $tp['postnum'];
            
$tpusername++;
        eval(
"\$tpp .= \"".$templates->get("topposters")."\";");
        }
// For Newest Threads
$nt "";
$newthreads $db->query ("
        SELECT subject,username,uid,tid,replies
        FROM "
.TABLE_PREFIX."threads 
        WHERE visible='1' "
.get_unviewable()."
        AND closed NOT LIKE 'moved|%'
        ORDER BY dateline DESC 
        LIMIT 0,"
.$mybb->settings['top5stats_num']."");
        while (
$nt $db->fetch_array($newthreads)){
            
$tid $nt['tid'];
            
$uid $nt['uid'];
            
$ntfullsubject $nt['subject'];
            
$ntsubject htmlspecialchars_uni(topstats($nt['subject'], 13));
            
$user get_user($uid);
            
$username format_name($user['username'],$user['usergroup'],$user['displaygroup']);
            
$ntusername build_profile_link($username$nt['uid']);
            
$ntreplies $nt['replies'];
            
$threadlink "showthread.php?tid=".$tid;
        if (
$mybb->settings['top5stats_who_posted'] != "0"){
            
$who_posted ' --- <a href="javascript:MyBB.whoPosted('.$tid.');">'.$ntreplies.'</a>';
        }
        else{
            
$who_posted "";
        }
        eval(
"\$ntt .= \"".$templates->get("newthreads")."\";");
        }
// For Latest Posts
$lp "";
$latestposts $db->query ("
        SELECT subject,username,uid,pid,tid 
        FROM "
.TABLE_PREFIX."posts 
        WHERE visible='1' "
.get_unviewable()."
        ORDER BY dateline DESC 
        LIMIT 0,"
.$mybb->settings['top5stats_postnum']."");
        while (
$lp $db->fetch_array($latestposts)){
            
$pid $lp['pid'];
            
$tid $lp['tid'];
            
$uid $lp['uid'];
            
$user get_user($uid);
            
$username format_name($user['username'],$user['usergroup'],$user['displaygroup']);
            
$lpfullsubject $lp['subject'];
            
$lpsubject htmlspecialchars_uni(topstats($lp['subject'], 13));
            
$lpusername build_profile_link($username$lp['uid']);
            
$postlink "showthread.php?tid=".$tid."&amp;pid=".$pid."#pid".$pid;
            
$profilelink .= "member.php?action=profile&amp;uid=".$uid;
            
$postlink++;
            if (
$mybb->settings['top5stats_scroll'] != "0"){
                
$direction $mybb->settings['top5stats_direction'];
                if (
$mybb->settings['top5stats_num'] > 15){
                    
$height 'height="39"';
                }
                else{
                    
$height "";
                }
                if (
$mybb->settings['top5stats_stop'] == "1"){
                    
$stop 'onmouseover="this.stop();" onmouseout="this.start();"';
                }
                else{
                    
$stop '';
                }
                
$scrolling '<marquee '.$stop.' direction="'.$direction.'" scrollamount="2" scrolldelay="10" '.$height.' width="185">';
            }
        eval(
"\$lpp .= \"".$templates->get("latestposts")."\";");
        }
        
$group $mybb->user['usergroup'];
        
$groups explode(",",$mybb->settings['top5stats_group']);
        if (
in_array($group,$groups)){
            eval(
"\$top5index = \"".$templates->get("top5stats_index")."\";");
        }
        if (
$guests == "0" && $mybb->user['uid'] == "0"){
            
$top5index "";
        }
    }
}
?>
RadnoK napisał 20.09.2012, 17:31:
Co ma z tym wspólnego poprawka do skryptu forum? Problem dotyczy szablonu pluginu. Przenoszę do odpowiedniego działu.
[Obrazek: modnotice_howto.png]
Instalujesz plugin, który powinien sam dodać zmienną do szablonów. Jeśli nie dodaje (rzadko spotykane) odwiedź stronę/wątek twórców. Znajdziesz tam instrukcję.
Zmienna powinna dodać się w szablony >> strona główna >> index. Jeżeli doda się w złym miejscu to ją przenieś.
Hmm nie rozumiem... Jak ten plugin się nazywa? Jaśniej proszę ponieważ jestem zielony :(
Bosz... Skąd masz ten plik co podałeś w pierwszym poście?
Tak to jest plugin, tylko nie wiem czy kompletny. Spolszczyłeś nawet nazwę i teraz prosisz, żeby podać... Poszukaj kompletnego pluginu. wrzuć na FTP zachowując strukturę katalogów.



Użytkownicy przeglądający ten wątek:

2 gości