Beiträge: 55
Themen: 20
Registriert seit: 16.01.2008
Hallo,
leider erscheinen die Sideboxen nur auf der Indexseite.
Ich hätte die Boxen auch gerne auf den Forenseiten.
Wie bekomme ich das hin?
Und wenn ich den php-Inhalt der Shoutbox.php in eine Box einfüge, dann wird nichts angezeigt.
Hat jemand Tipps für mich?
1000 Dank.
Gruss
Carsten
Beiträge: 314
Themen: 41
Registriert seit: 10.12.2005
MyBB-Version: 1.2.13
yabexxl schrieb:Ich hätte die Boxen auch gerne auf den Forenseiten.
Wie bekomme ich das hin?
Hallo Mybb Profis,
dem Wunsch schliesse ich mich an!
Danke & Gruss
Fatih
Beiträge: 25.762
Themen: 269
Registriert seit: 20.09.2005
yabexxl schrieb:Und wenn ich den php-Inhalt der Shoutbox.php in eine Box einfüge, dann wird nichts angezeigt. Schau mal: https://www.mybb.de/forum/showthread.php?tid=19951
Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Beiträge: 55
Themen: 20
Registriert seit: 16.01.2008
05.02.2008, 13:17
(Dieser Beitrag wurde zuletzt bearbeitet: 05.02.2008, 13:17 von yabexxl.)
Hat jemand eine Idee, wie ich die Sideboxen auch auf den Forenseiten zu Gesicht bekomme?
Hier mal der Code zur Sidebox.php (Plugins)
Code: <?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");
function sideboxes_info()
{
return array(
"name" => "Side Boxes!",
"description" => "Additional boxes on the right of the forums in index page.",
"website" => "http://www.thetechex.net",
"author" => "Zaher1988",
"authorsite" => "http://www.thetechex.net",
"version" => "2.0",
);
}
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(TABLE_PREFIX."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" => 'yes',
"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" => 'yes',
"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" => 'yes',
"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" => 'yes',
"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="thead"><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(TABLE_PREFIX."settings", $sideboxes_setting_1);
$db->insert_query(TABLE_PREFIX."settings", $sideboxes_setting_2);
$db->insert_query(TABLE_PREFIX."settings", $sideboxes_setting_3);
$db->insert_query(TABLE_PREFIX."settings", $sideboxes_setting_4);
$db->insert_query(TABLE_PREFIX."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>');
}
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);
}
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'] == "yes")
{
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(TABLE_PREFIX."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 = 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(TABLE_PREFIX."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(TABLE_PREFIX."threads", "COUNT(tid) AS newthreads", "dateline>'".$mybb->user['lastvisit']."' $unviewwhere");
$newthreads = $db->fetch_field($query, "newthreads");
$query = $db->simple_select(TABLE_PREFIX."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 = sprintf($lang->new_announcements, $newann);
}
if($newthreads == 1)
{
$lang->new_threads = $lang->new_thread;
}
else
{
$lang->new_threads = sprintf($lang->new_threads, $newthreads);
}
if($newposts == 1)
{
$lang->new_posts = $lang->new_post;
}
else
{
$lang->new_posts = sprintf($lang->new_posts, $newposts);
}
eval("\$welcometext = \"".$templates->get("portal_welcome_membertext")."\";");
}
else
{
$lang->guest_welcome_registration = 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 = 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'] == "yes")
{
$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")."\";");
}
//Search Box
if($mybb->settings['sb_search'] == "yes")
{
eval("\$sb_search = \"".$templates->get("portal_search")."\";");
}
//Get latest threads
if($mybb->settings['sb_latest'] == "yes")
{
$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']);
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";
$logins = login_attempt_check();
$login_text = '';
if(!username_exists($mybb->input['username']))
{
my_setcookie('loginattempts', $logins + 1);
$db->query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'");
if($mybb->settings['failedlogintext'] == "yes")
{
$login_text = sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
}
error($lang->error_invalidusername.$login_text);
}
$user = validate_password_from_username($mybb->input['username'], $mybb->input['password']);
if(!$user['uid'])
{
my_setcookie('loginattempts', $logins + 1);
$db->query("UPDATE ".TABLE_PREFIX."sessions SET loginattempts=loginattempts+1 WHERE sid = '{$session->sid}'");
if($mybb->settings['failedlogintext'] == "yes")
{
$login_text = sprintf($lang->failed_login_again, $mybb->settings['failedlogincount'] - $logins);
}
error($lang->error_invalidpassword.$login_text);
}
my_setcookie('loginattempts', 1);
$db->delete_query(TABLE_PREFIX."sessions", "ip='".$db->escape_string($session->ipaddress)."' AND sid != '".$session->sid."'");
$newsession = array(
"uid" => $user['uid'],
"loginattempts" => 1,
);
$db->update_query(TABLE_PREFIX."sessions", $newsession, "sid='".$session->sid."'");
// 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(TABLE_PREFIX."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;
}
}
?>
Beiträge: 25.762
Themen: 269
Registriert seit: 20.09.2005
05.02.2008, 13:28
(Dieser Beitrag wurde zuletzt bearbeitet: 07.02.2008, 09:52 von StefanT.)
Probiere das:
Ersetze: PHP-Code: $plugins->add_hook("index_start", "sideboxes_start");
durch: PHP-Code: $plugins->add_hook("global_end", "sideboxes_start");
Und: PHP-Code: global $gobutton, $theme, $lastvisit;
durch: PHP-Code: global $gobutton, $theme, $lastvisit, $header, $footer;
Und füge nach: PHP-Code: //Workout additional cutom boxes eval("\$sb_additional = \"".$db->escape_string($mybb->settings['sb_additional'])."\";");
das ein: PHP-Code: $header .= '<table width="100%" border="0"> <tr> <td width="75%" valign="top">'; $footer = '</td> <td width="25%" valign="top">'.$sb_welcome.$sb_search.$sb_stats.$sb_latestthreads.$sb_additional.'</td> </tr> </table>'.$footer;
Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Beiträge: 55
Themen: 20
Registriert seit: 16.01.2008
05.02.2008, 13:40
(Dieser Beitrag wurde zuletzt bearbeitet: 05.02.2008, 14:11 von yabexxl.)
@ Dragon,
danke für die Hilfe. Die box erscheint jedoch nur auf der Startseite und daneben schreibt er jetzt {$sb_welcome}{$sb_search}{$sb_stats}{$sb_latestthreads}{$sb_additional}
Beiträge: 25.762
Themen: 269
Registriert seit: 20.09.2005
Ich habe den Code verbessert.
Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Beiträge: 55
Themen: 20
Registriert seit: 16.01.2008
05.02.2008, 13:56
(Dieser Beitrag wurde zuletzt bearbeitet: 05.02.2008, 13:56 von yabexxl.)
super, hat geklappt. Nur leider erscheit auf der indexseite die box nun 2x nebeneinander. das macht der aber nur auf der indexseite
Beiträge: 25.762
Themen: 269
Registriert seit: 20.09.2005
Ersetze im Template "index": Code: <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>
durch:
Bitte die Foren-Regeln beachten und im Profil die verwendete MyBB-Version angeben.
Beiträge: 55
Themen: 20
Registriert seit: 16.01.2008
05.02.2008, 14:11
(Dieser Beitrag wurde zuletzt bearbeitet: 05.02.2008, 14:12 von yabexxl.)
PERFEKT & GROSSEN DANK
für die Hilfe. Damit hast Du bestimmt auch anderen geholfen.
;-)
|