Webboard

Pełna wersja: Usunięcie thead z kodu
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
wersja skryptu MyBB: 1.6.8
adres forum: http://cstiger.pl
na czym polega problem (screen, opis, komunikaty, nazwa stylu/theme/szablonu):
Proszę o usunięcie z kodu te 2 theady wszystko zaznczone na sreneenie nr.1, oraz proszę o podanie kodu do tego co zaznaczyłem na screenie nr.2. Następną rzeczą jest dodanie avka tak jak na screenie nr.3

Kod:
<?php
/**
* Side Boxes!
* Copyright TECHEX - The Site
* http://www.thetechex.net
*/

// Disallow direct access to this file for security reasons
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("index_start", "sideboxes_start");
$plugins->add_hook("forumdisplay_start", "sideboxes_start");

function sideboxes_info()
{
    return array(
        "name"            => "Side Boxes!",
        "description"    => "Additional boxes on the right side of your pages.",
        "website"        => "http://www.thetechex.net",
        "author"        => "Zaher1988",
        "authorsite"    => "http://www.thetechex.net",
        "version"        => "2.1",
    );
}

function sideboxes_activate()
{
    global $db;
    
    $sideboxes_group = array(
        "gid"            => "NULL",
        "title"            => "Side Boxses!",
        "name"            => "sideboxes",
        "description"    => "Side Boxes settings.",
        "disporder"        => "3",
        "isdefault"        => "no",
    );
    
    $db->insert_query("settinggroups", $sideboxes_group);
    $gid = $db->insert_id();
    
    
    $sideboxes_setting_1 = array(
        "sid"            => "NULL",
        "name"            => "sb_welcome",
        "title"            => "Include welcome box",
        "description"    => "Would you like include the welcome box?",
        "optionscode"    => "yesno",
        "value"            => '1',
        "disporder"        => '1',
        "gid"            => intval($gid),
    );
    $sideboxes_setting_2 = array(
        "sid"            => "NULL",
        "name"            => "sb_stats",
        "title"            => "Include statistics box",
        "description"    => "Would you like include the stats box?",
        "optionscode"    => "yesno",
        "value"            => '1',
        "disporder"        => '2',
        "gid"            => intval($gid),
    );
    $sideboxes_setting_3 = array(
        "sid"            => "NULL",
        "name"            => "sb_search",
        "title"            => "Include search box",
        "description"    => "Would you like include the search box?",
        "optionscode"    => "yesno",
        "value"            => '1',
        "disporder"        => '3',
        "gid"            => intval($gid),
    );
    $sideboxes_setting_4 = array(
        "sid"            => "NULL",
        "name"            => "sb_latest",
        "title"            => "Include latest threads box",
        "description"    => "Would you like include the latest threads box?",
        "optionscode"    => "yesno",
        "value"            => '1',
        "disporder"        => '4',
        "gid"            => intval($gid),
    );

    $sideboxes_setting_5 = array(
    "sid"            => "NULL",
    "name"            => "sb_additional",
    "title"            => "Additional custom boxes",
    "description"    => "Create an additional box(s) by entering the html code.",
    "optionscode"    => "textarea",
    "value"            => $db->escape_string('<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead1"><strong>My Additional box</strong></td>
</tr>
<tr>
<td class="trow1">This is my first additional box using SideBoxes!.</td>
</tr>
</table>
<br />'),
    "disporder"        => '5',
    "gid"            => intval($gid),
    );

    $db->insert_query("settings", $sideboxes_setting_1);
    $db->insert_query("settings", $sideboxes_setting_2);
    $db->insert_query("settings", $sideboxes_setting_3);
    $db->insert_query("settings", $sideboxes_setting_4);
    $db->insert_query("settings", $sideboxes_setting_5);
    rebuild_settings();

    require MYBB_ROOT.'/inc/adminfunctions_templates.php';
    find_replace_templatesets("index", '#'.preg_quote('{$forums}').'#', '<table width="100%"  border="0">
  <tr>
    <td width="75%" valign="top">{$forums}</td>
    <td width="25%" valign="top">{$sb_welcome}{$sb_search}{$sb_stats}{$sb_latestthreads}{$sb_additional}</td>
  </tr>
</table>');

    find_replace_templatesets("forumdisplay", '#'.preg_quote('{$subforums}').'#', '');
    find_replace_templatesets("forumdisplay", '#'.preg_quote('{$threadslist}').'#', '<table width="100%"  border="0">
  <tr>
    <td width="75%" valign="top">{$subforums}
{$threadslist}</td>
    <td width="25%" valign="top">{$sb_welcome}{$sb_search}{$sb_stats}{$sb_latestthreads}{$sb_additional}</td>
  </tr>
</table>');

}

function sideboxes_deactivate()
{
    global $db;

    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb_welcome'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb_stats'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb_additional'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb_search'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE name='sb_latest'");
    $db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='sideboxes'");
    rebuild_settings();

    require MYBB_ROOT.'/inc/adminfunctions_templates.php';
    find_replace_templatesets("index", '#'.preg_quote('<table width="100%"  border="0">
  <tr>
    <td width="75%" valign="top">{$forums}</td>').'#', '{$forums}',0);

    find_replace_templatesets("index", '#'.preg_quote('    <td width="25%" valign="top">{$sb_welcome}{$sb_search}{$sb_stats}{$sb_latestthreads}{$sb_additional}</td>
  </tr>
</table>').'#', '',0);

find_replace_templatesets("forumdisplay", '#'.preg_quote('<table width="100%"  border="0">
  <tr>
    <td width="75%" valign="top">{$subforums}
{$threadslist}</td>').'#', '{$subforums}
{$threadslist}',0);

    find_replace_templatesets("forumdisplay", '#'.preg_quote('    <td width="25%" valign="top">{$sb_welcome}{$sb_search}{$sb_stats}{$sb_latestthreads}{$sb_additional}</td>
  </tr>
</table>').'#', '',0);

}

function sideboxes_start()
{
    global $db, $mybb, $settings, $templates, $lang, $cache;
    global $sb_search, $sb_welcome, $sb_stats, $sb_latestthreads, $sb_additional, $pms, $welcometext;
    global $gobutton, $theme, $lastvisit;

    $lang->load("portal");

    if($mybb->settings['sb_welcome'] == 1)
    {
        if($mybb->user['uid'] != 0)
        {
            if($mybb->user['receivepms'] != "no" && $mybb->usergroup['canusepms'] != "no" && $mybb->settings['portal_showpms'] != "no" && $mybb->settings['enablepms'] != "no")
            {
                $query = $db->simple_select("privatemessages", "COUNT(*) AS pms_total, SUM(IF(dateline>'".$mybb->user['lastvisit']."' AND folder='1','1','0')) AS pms_new, SUM(IF(status='0' AND folder='1','1','0')) AS pms_unread", "uid='".$mybb->user['uid']."'");
                $messages = $db->fetch_array($query);
                if(!$messages['pms_new'])
                {
                    $messages['pms_new'] = 0;
                }
                // the SUM() thing returns "" instead of 0
                if($messages['pms_unread'] == "")
                {
                    $messages['pms_unread'] = 0;
                }
                $lang->pms_received_new = $lang->sprintf($lang->pms_received_new, $mybb->user['username'], $messages['pms_new']);
                eval("\$pms = \"".$templates->get("portal_pms")."\";");
            }    
    
            //get number of new posts, threads, announcements
            $query = $db->simple_select("posts", "COUNT(pid) AS newposts", "dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
            $newposts = $db->fetch_field($query, "newposts");
            if($newposts)
            { // if there aren't any new posts, there is no point in wasting two more queries
                $query = $db->simple_select("threads", "COUNT(tid) AS newthreads", "dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
                $newthreads = $db->fetch_field($query, "newthreads");
                $query = $db->simple_select("threads", "COUNT(tid) AS newann", "dateline>'".$mybb->user['lastvisit']."' AND fid IN (".$mybb->settings['portal_announcementsfid'].") $unviewwhere");
                $newann = $db->fetch_field($query, "newann");
                if(!$newthreads)
                {
                    $newthreads = 0;
                }
                if(!$newann)
                {
                    $newann = 0;
                }
            }
            else
            {
                $newposts = 0;
                $newthreads = 0;
                $newann = 0;
            }
    
            // Make the text
            if($newann == 1)
            {
                $lang->new_announcements = $lang->new_announcement;
            }
            else
            {
                $lang->new_announcements = $lang->sprintf($lang->new_announcements, $newann);
            }
            if($newthreads == 1)
            {
                $lang->new_threads = $lang->new_thread;
            }
            else
            {
                $lang->new_threads = $lang->sprintf($lang->new_threads, $newthreads);
            }
            if($newposts == 1)
            {
                $lang->new_posts = $lang->new_post;
            }
            else
            {
                $lang->new_posts = $lang->sprintf($lang->new_posts, $newposts);
            }
            
            if(isset($mybb->user['lastvisit'])) {
                $lastvisit = my_date($mybb->settings['dateformat'], $mybb->user['lastvisit']) . ', ' . my_date($mybb->settings['timeformat'], $mybb->user['lastvisit']);
            }
            else
            {
                $lastvisit = "Never";
            }
            eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");
        }
        else
        {
            $lang->guest_welcome_registration = $lang->sprintf($lang->guest_welcome_registration, $mybb->settings['bburl'] . '/member.php?action=register');
            $mybb->user['username'] = $lang->guest;
            $portal_url = get_current_location();
            eval("\$welcometext = \"".$templates->get("portal_welcome_guesttext")."\";");
        }
        $lang->welcome = $lang->sprintf($lang->welcome, $mybb->user['username']);
        
        eval("\$sb_welcome = \"".$templates->get("portal_welcome")."\";");
        if($mybb->user['uid'] == 0)
        {
            $mybb->user['username'] = "";
        }
    }

    //Start statistics
    if($mybb->settings['sb_stats'] == 1)
    {
        $stats = $cache->read("stats");
        $threadsnum = $stats['numthreads'];
        $postsnum = $stats['numposts'];
        $membersnum = $stats['numusers'];
        if(!$stats['lastusername'])
        {
            $newestmember = "<b>" . $lang->no_one . "</b>";
        }
        else
        {
            $newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
        }
        eval("\$sb_stats = \"".$templates->get("portal_stats")."\";");
    }

global $total_posts, $total_threads, $total_users, $total_posts_today, $total_posts_lasthour;
    global $newestmember, $total_online, $users_count, $guest_count, $today_online;
    
//Start who is online
$timesearch = time() - $mybb->settings['wolcutoffmins']*60;
$query = $db->query("SELECT uid FROM ".TABLE_PREFIX."sessions WHERE time>'$timesearch' ORDER BY time DESC");
$users_count = 0;
$guest_count = 0;
while($on_line = $db->fetch_array($query))
{
    if($on_line['uid'] == 0)
    {
        $guest_count++;
    }
    else
    {
        $users_count++;
    }    
}
    $total_online = $users_count + $guest_count;
    $oneday_timesearch = time() - (60*60*24);
    $query = $db->query("SELECT sid FROM ".TABLE_PREFIX."sessions WHERE time>'$oneday_timesearch'");
    $today_online = $db->num_rows($query);
    //Forum stats
    $stats = $cache->read("stats");


    if(!$stats['lastusername'])
    {
        $newestmember = "no-one";
    }
    else
    {
        $newestmember = build_profile_link($stats['lastusername'], $stats['lastuid']);
    }
    
    
    $total_posts = my_number_format($stats['numposts']);
    $total_threads = my_number_format($stats['numthreads']);
    $total_users =  my_number_format($stats['numusers']);
    
    //Posts today
    $total_posts_today = $db->num_rows($db->query("SELECT * FROM ".TABLE_PREFIX."posts WHERE dateline>'$oneday_timesearch'"));
    $onehour_timesearch = time() - (60*60);
    $total_posts_lasthour = $db->num_rows($db->query("SELECT * FROM ".TABLE_PREFIX."posts WHERE dateline>'$onehour_timesearch'"));
    
    
    //Search Box
    if($mybb->settings['sb_search'] == 1)
    {
        eval("\$sb_search = \"".$templates->get("portal_search")."\";");
    }

    //Get latest threads
    if($mybb->settings['sb_latest'] == 1)
    {
        $altbg = alt_trow();
        $threadlist = '';
        $query = $db->query("
            SELECT t.*, u.username
            FROM ".TABLE_PREFIX."threads t
            LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
            WHERE 1=1 $unviewwhere AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
            ORDER BY t.lastpost DESC
            LIMIT 0, ".$mybb->settings['portal_showdiscussionsnum']
        );
        while($thread = $db->fetch_array($query))
        {
            $lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
            $lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
            // Don't link to guest's profiles (they have no profile).
            if($thread['lastposteruid'] == 0)
            {
                $lastposterlink = $thread['lastposter'];
            }
            else
            {
                $lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
            }
            if(my_strlen($thread['subject']) > 25)
            {
                $thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
            }
            $thread['subject'] = htmlspecialchars_uni($thread['subject']);
            $thread['threadlink'] = get_thread_link($thread['tid']);
            eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread")."\";");
            $altbg = alt_trow();
        }
        if($threadlist)
        { // show the table only if there are threads
            eval("\$sb_latestthreads = \"".$templates->get("portal_latestthreads")."\";");
        }
    }

    //Workout additional cutom boxes
    eval("\$sb_additional = \"".$db->escape_string($mybb->settings['sb_additional'])."\";");

    if($mybb->input['action'] == "do_login" && $mybb->request_method == "post")
    {
        require_once MYBB_ROOT."inc/functions_user.php";

        // Checks to make sure the user can login; they haven't had too many tries at logging in.
        // Is a fatal call if user has had too many tries
        $logins = login_attempt_check();
        $login_text = '';
    
        if(!username_exists($mybb->input['username']))
        {
            error($lang->error_invalidpworusername.$login_text);
        }
        $user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
        if(!$user['uid'])
        {
            my_setcookie('loginattempts', $logins + 1);
            $db->write_query("UPDATE ".TABLE_PREFIX."users SET loginattempts=loginattempts+1 WHERE username = '".$db->escape_string($mybb->input['username'])."'");
            if($mybb->settings['failedlogintext'] == 1)
            {
                $login_text = $lang->sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
            }
            error($lang->error_invalidpassword.$login_text);
        }
    
        my_setcookie('loginattempts', 1);
        $db->delete_query("sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
        $newsession = array(
            "uid" => $user['uid'],
        );
        $db->update_query("sessions", $newsession, "sid='".$session->sid."'");
        
        $db->update_query("users", array("loginattempts" => 1), "uid='{$mybb->user['uid']}'");
    
        // Temporarily set the cookie remember option for the login cookies
        $mybb->user['remember'] = $user['remember'];
    
        my_setcookie("mybbuser", $user['uid']."_".$user['loginkey'], null, true);
        my_setcookie("sid", $session->sid, -1, true);
    
        if(function_exists("loggedIn"))
        {
            loggedIn($user['uid']);
        }
    
        redirect("index.php", $lang->redirect_loggedin);
    }
}
//Function to rebuilt all settings
if(!function_exists("rebuild_settings"))
{
    function rebuild_settings()
{
    global $db, $mybb;

    if(!file_exists(MYBB_ROOT."inc/settings.php"))
    {
        $mode = "x";
    }
    else
    {
        $mode = "w";
    }
    $options = array(
        "order_by" => "title",
        "order_dir" => "ASC"
    );
    $query = $db->simple_select("settings", "value, name", "", $options);

    while($setting = $db->fetch_array($query))
    {
        $setting['value'] = str_replace("\"", "\\\"", $setting['value']);
        $settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
        $mybb->settings[$setting['name']] = $setting['value'];
    }
    $settings = "<"."?php\n/*********************************\ \n  DO NOT EDIT THIS FILE, PLEASE USE\n  THE SETTINGS EDITOR\n\*********************************/\n\n$settings\n?".">";
    $file = @fopen(MYBB_ROOT."inc/settings.php", $mode);
    @fwrite($file, $settings);
    @fclose($file);
    $GLOBALS['settings'] = &$mybb->settings;
    }

}
?>
Proszę was bardzo o pomoc :)