MyBB.de Forum
Kalender - Druckversion

+- MyBB.de Forum (https://www.mybb.de/forum)
+-- Forum: Anpassungen (https://www.mybb.de/forum/forum-47.html)
+--- Forum: Plugin-Diskussionen (https://www.mybb.de/forum/forum-38.html)
+--- Thema: Kalender (/thread-8604.html)

Seiten: Seiten: 1 2


Kalender - yabexxl - 07.02.2008

-Hallo,
ich habe eventsindex_1.1 installiert.
Besteht die möglichkeit, die Termine auch in einer Box (sideboxes2.0) anzeigen zu lassen?

Hier einmal der Code der inc-php
PHP-Code:
<?php
/**
 * Mod Name: Ereignisse auf Startseite 1.1
 * Copyright © 2006 frankrieger
 */
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_end''eventsindex');

function 
eventsindex_info()
{
    return array(
        
"name"            =>    "Ereignisse auf Startseite",
        
"description"    =>    "Ereignisse werden auf der Startseite angezeigt.",
        
"website"        =>    "http://www.mybbcoder.info",
        
"author"        =>    "frankrieger",
        
"authorsite"    =>    "http://www.mybbcoder.info",
        
"version"        =>    "1.1"
    
);
}

function 
eventsindex_activate()
{
    global 
$db;
    
$eventsindex_group = array(
        
"name" =>            "events_on_indexpage",
        
"title" =>            "Ereignisse auf Startseite",
        
"description" =>    "Einstellungen f&uuml;r Plugin Ereignisse auf Startseite",
        
"disporder" =>        "5",
        
"isdefault" =>        "no"
    
);
    
$db->insert_query(TABLE_PREFIX."settinggroups"$eventsindex_group);
    
$gid $db->insert_id();
    
    
$eventsindex_1 = array(
        
"sid" => "NULL",
        
"name" => "events_on_indexpage_futuredays",
        
"title" => "Anzahl der nächsten x Tage?",
        
"description" => "Wieviele Tage sollen angezeigt werden (0=alle anzeigen, -1=nur heutige Ereignisse anzeigen)?",
        
"optionscode" => "text",
        
"value" => "7",
        
"disporder" => "1",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$eventsindex_1);
    
    
$eventsindex_2 = array(
        
"sid" => "NULL",
        
"name" => "events_on_indexpage_maxevents",
        
"title" => "Zeige maximal x Ereignisse",
        
"description" => "Anzahl der Ereignisse die maximal gezeigt werden sollen (0=alle anzeigen).",
        
"optionscode" => "text",
        
"value" => "5",
        
"disporder" => "2",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$eventsindex_2);
    
    
$eventsindex_3 = array(
        
"sid" => "NULL",
        
"name" => "events_on_indexpage_top",
        
"title" => "Anzeige am Anfang der Startseite?",
        
"description" => "Wollen sie die Ereignisse am Anfang der Startseite anzeigen?",
        
"optionscode" => "yesno",
        
"value" => "no",
        
"disporder" => "3",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$eventsindex_3);
    
    
$eventsindex_4 = array(
        
"sid" => "NULL",
        
"name" => "events_on_indexpage_bottom",
        
"title" => "Anzeige bei der Statistik?",
        
"description" => "Wollen sie die Ereignisse bei Who\'s online und der Statistik anzeigen?",
        
"optionscode" => "yesno",
        
"value" => "yes",
        
"disporder" => "4",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$eventsindex_4);
    
    
$eventsindex_5 = array(
        
"sid" => "NULL",
        
"name" => "events_on_indexpage_private",
        
"title" => "Private Ereignisse anzeigen?",
        
"description" => "Wollen sie die eigenen privaten Ereignisse auch anzeigen?",
        
"optionscode" => "yesno",
        
"value" => "yes",
        
"disporder" => "5",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$eventsindex_5);
    
    
$eventsindex_6 = array(
        
"sid" => "NULL",
        
"name" => "events_on_indexpage_dateformat",
        
"title" => "Wochentag  angezeigen?",
        
"description" => "Soll das Datum mit Wochentag angezeigt werden?",
        
"optionscode" => "yesno",
        
"value" => "yes",
        
"disporder" => "6",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$eventsindex_6);
    
    
$eventsindex_7 = array(
        
"sid" => "NULL",
        
"name" => "events_on_indexpage_dateformat2",
        
"title" => "Datumsformat",
        
"description" => "Wie soll das Datum angezeigt werden (Standard d.m.Y)?",
        
"optionscode" => "text",
        
"value" => "d.m.Y",
        
"disporder" => "7",
        
"gid" => intval($gid),
        );
    
$db->insert_query(TABLE_PREFIX."settings"$eventsindex_7);
    
    
rebuild_settings();

    
$template = array(
        
"tid"        => NULL,
        
"title"        => "events_on_indexpage_stat",
        
"template"    => "<tr>
    <td class=\"tcat\"><strong>{\$lang->events_on_indexpage}</strong> [<a href=\"calendar.php\">{\$lang->toplinks_calendar}</a>]</td>
</tr>
<tr>
    <td class=\"trow1\"><span class=\"smalltext\">{\$events}</span></td>
</tr>"
,
        
"sid"        => "-1"
    
);
    
$db->insert_query(TABLE_PREFIX."templates"$template);

    
$template2 = array(
        
"title"        => "events_on_indexpage_row_private",
        
"template"    => "{\$comma}{\$eventdate}<a href=\"calendar.php?action=event&amp;eid={\$event[\$x][\'eid\']}\" title=\"{\$event[\$x][\'subject\']}\"><span class=\"smalltext\"><font color=\"{\$mybb->settings[\'privateeventcolor\']}\">{\$event[\$x][\'subject\']}</font></span></a>",
        
"sid"        => -1
    
);
    
$db->insert_query(TABLE_PREFIX."templates"$template2);
    
    
$template3 = array(
        
"title"        => "events_on_indexpage_row_public",
        
"template"    => "{\$comma}{\$eventdate}<a href=\"calendar.php?action=event&amp;eid={\$event[\$x][\'eid\']}\" title=\"{\$event[\$x][\'subject\']}\"><span class=\"smalltext\"><font color=\"{\$mybb->settings[\'publiceventcolor\']}\">{\$event[\$x][\'subject\']}</font></span></a>",
        
"sid"        => -1
    
);
    
$db->insert_query(TABLE_PREFIX."templates"$template3);
    
    
$template4 = array(
        
"tid" => "NULL",
        
"title" => "events_on_indexpage_top",
        
"template" => "<table border=\"0\" cellspacing=\"{\$theme[borderwidth]}\" cellpadding=\"{\$theme[tablespace]}\" class=\"tborder\">
<thead>
<tr>
<td class=\"thead\" colspan=\"2\">
<div class=\"expcolimage\"><img src=\"{\$theme[\'imgdir\']}/collapse{\$collapsedimg[\'events\']}.gif\" id=\"events_img\" class=\"expander\" alt=\"[-]\" /></div>
<div><strong>{\$lang->events_on_indexpage}</strong></div>
</td>
</tr>
</thead>
<tbody style=\"{\$collapsed[\'events\']}\" id=\"events_e\">
<tr>
<td class=\"trow1\" align=\"center\" valign=\"top\" width=\"35\"><img src=\"{\$theme[\'imgdir\']}/events.gif\" border=\"0\" alt=\"Ereignisse\" />
</td>
<td class=\"trow2\"><span class=\"smalltext\">{\$events}</span></td>
</tr>
</tbody>
</table>
<br />"
,
        
"sid" => "-1",
        );
    
$db->insert_query(TABLE_PREFIX."templates"$template4); 

    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
    
    
find_replace_templatesets('index''#{\$header}#'"{\$header}\n{\$eventstop}");
    
    
find_replace_templatesets('index''#{\$whosonline}#'"{\$whosonline}\n{\$eventsstat}");
}

function 
eventsindex_deactivate()
{
    
    global 
$db;
    
    
//Einstellungsgruppe löschen
    
$query $db->query("SELECT gid FROM ".TABLE_PREFIX."settinggroups WHERE name='events_on_indexpage'");
    
$g $db->fetch_array($query);
    
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE gid='".$g['gid']."'"); 
    
    
//Einstellungen löschen
    
$db->query("DELETE FROM ".TABLE_PREFIX."settings WHERE gid='".$g['gid']."'"); 
    
    
rebuild_settings();
    
    
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='events_on_indexpage_stat'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='events_on_indexpage_row_private'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='events_on_indexpage_row_public'");
    
$db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title='events_on_indexpage_top'");


    require 
MYBB_ROOT."/inc/adminfunctions_templates.php";
    
    
find_replace_templatesets('index''#(\r?)(\n?){\$eventstop}#'''0);

    
find_replace_templatesets('index''#(\r?)(\n?){\$eventsstat}#'''0);
}

function 
eventsindex()
{
 
    global 
$db$mybb$templates$eventsstat$eventstop$lang$theme;
    
    
$days intval($mybb->settings['events_on_indexpage_futuredays']);
    
$maxdays intval($mybb->settings['events_on_indexpage_maxevents']);
    
    if (
$maxdays == 1)
    {
        
$lang->events_on_indexpage $lang->events_on_indexpage_one_event;
    }
    elseif(
$days == -&& $maxdays 0)
    {
        
$max sprintf($lang->events_on_indexpage_max$maxdays);
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage_one$max);
    }
    elseif(
$days == -1)
    {
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage_one"");
    }
    elseif(
$days == && $maxdays 0)
    {
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage_tom$maxdays." ");
    }
    elseif(
$days == 1)
    {
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage_tom"");
    }
    elseif (
$days && $maxdays 0)
    {
        
$max sprintf($lang->events_on_indexpage_max$maxdays);
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage$days$max);
    }
    elseif (
$days 0)
    {
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage$days"");
    }
    elseif (
$maxdays 0)
    {
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage_no_days$maxdays." ");
    }
    else
    {
        
$lang->events_on_indexpage sprintf($lang->events_on_indexpage_no_days"");
    }

    if (
$mybb->settings['events_on_indexpage_private'] != "no")
    {
        
$private "((author = '".$mybb->user['uid']."' AND private = 'yes') OR private != 'yes')";
    }
    else
    {
        
$private "private != 'yes'";
    }

    
$query $db->query("SELECT * FROM ".TABLE_PREFIX."events WHERE ".$private);
    
    
$y = -1;
    while(
$eventtemp $db->fetch_array($query))
    {
         ++
$y;
          
$event[$y]['eid'] = $eventtemp['eid'];
          
$event[$y]['subject'] = $eventtemp['subject'];
          
$event[$y]['description'] = $eventtemp['description'];
          
$event[$y]['private'] = $eventtemp['private'];
          
$event[$y]['date'] = $eventtemp['date'];
          
$datum explode("-"$eventtemp['date']);
          
$event[$y]['datetimestamp'] = mktime(0,0,0,$datum[1],$datum[0],$datum[2]);
    }

    for(
$x=0$x <= $y$x++)
    {
        for(
$z=$x$z <= $y$z++)
        {
            if(
$event[$x]['datetimestamp'] > $event[$z]['datetimestamp'])
            {
                  
$var $event[$x];
                  
$event[$x] = $event[$z];
                  
$event[$z] = $var;
            }
          }
    }

    
$comma $events '';

    
$anzahl 0;

    
$today mktime000date("m"), date("d"), date("Y"));
    if (
$days 0)
    {
        
$lastday mktime000date("m"), date("d") + $days 1date("Y"));
    }
    elseif (
$days == -1)
    {
        
$lastday mktime000date("m"), date("d") + 1date("Y"));
    }
    

    for(
$x=0$x <= $y$x++)
    {
         if (
$event[$x]['datetimestamp'] >= $today && ($event[$x]['datetimestamp'] < $lastday || $days == 0) && ($anzahl $maxdays || $maxdays == 0))
         {
             if (
$days != -1)
             {
                 
$eventdate date($mybb->settings['events_on_indexpage_dateformat2'], $event[$x]['datetimestamp']);
                 
$eventdate .= " ";
                
                if (
$mybb->settings['events_on_indexpage_dateformat'] != "no" && $event[$x]['date'] == date("j-n-Y"))
                {
                    
$eventdate $lang->today.": ".$wochentag." ";
                }
                elseif (
$event[$x]['date'] == date("j-n-Y"))
                {
                    
$eventdate $lang->today." ";
                }
                elseif (
$mybb->settings['events_on_indexpage_dateformat'] != "no")
                {
                    switch(
date("w"$event[$x]['datetimestamp']))
                    {
                        case 
0:
                            
$wochentag $lang->sunday;
                            break;
                        case 
1:
                            
$wochentag $lang->monday;
                               break;
                        case 
2:
                            
$wochentag $lang->tuesday;
                            break;
                        case 
3:
                            
$wochentag $lang->wednesday;
                            break;
                        case 
4:
                            
$wochentag $lang->thursday;
                            break;
                        case 
5:
                            
$wochentag $lang->friday;
                            break;
                        case 
6:
                            
$wochentag $lang->saturday;
                            break;
                    }            
                    
$eventdate $wochentag.", ".$eventdate;        
                }
            }
            if (
$event[$x]['private'] != "no")
            {
                eval(
"\$events .= \"".$templates->get("events_on_indexpage_row_private")."\";");
            }
            else
            {
                eval(
"\$events .= \"".$templates->get("events_on_indexpage_row_public")."\";");
            }            
            
$comma "<br />";
            ++
$anzahl;
        }
    }        

    if(
$events != "") {
         if (
$mybb->settings['events_on_indexpage_top'] != "no")
         {
             eval(
"\$eventstop = \"".$templates->get("events_on_indexpage_top")."\";");
        }
        if (
$mybb->settings['events_on_indexpage_bottom'] != "no")
         {
            eval(
"\$eventsstat = \"".$templates->get("events_on_indexpage_stat")."\";");
        }
    }
}

if(!
function_exists("rebuild_settings"))
{
    function 
rebuild_settings()
    {
        global 
$db;
        
$query $db->query("SELECT * FROM ".TABLE_PREFIX."settings ORDER BY title ASC");
        while(
$setting $db->fetch_array($query)) {
            
$setting['value'] = addslashes($setting['value']);
            
$settings .= "\$settings['".$setting['name']."'] = \"".$setting['value']."\";\n";
        }
        
$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""w");
        
fwrite($file$settings);
        
fclose($file);
    }
}
?>

Bin für jeden Tipp dankbar.

Gruss Carsten


RE: Kalender - StefanT - 08.02.2008

Ersetze:
PHP-Code:
$plugins->add_hook('index_end''eventsindex'); 
durch:
PHP-Code:
$plugins->add_hook('global_end''eventsindex'); 
Und füge $eventstop dort ein, wo es ausgegeben werden soll.


RE: Kalender - yabexxl - 08.02.2008

Danke Dragon,

jedoch bleibt die Box leer:

Code:
<table border="0" cellspacing="1" cellpadding="4" class="tborder">
<tr>
<td class="thead"><strong>Termine & Events</strong></td>
</tr>
<tr>
<td class="trow1">
$eventstop
</tr>
</table>
<br />

Auch dann, wenn ich $eventstop in eine PHP-Zeile "<?.. ?>" setzte.


RE: Kalender - StefanT - 08.02.2008

Du musst die Variable natürlich zu den anderen Variablen im Code hinzufügen bei:
PHP-Code:
$sb_additional.$sb_welcome.$sb_search.$sb_stats.$sb_latestthreads.$eventstop 
Und auch bei:
PHP-Code:
global $gobutton$theme$lastvisit$header$footer$eventstop



RE: Kalender - yabexxl - 08.02.2008

Sorry,
stehe ein Wenig auf dem Schlauch.

In welchen Dateien denn jetzt?


RE: Kalender - StefanT - 08.02.2008

In der Plugin-Datei der Sidebox.


RE: Kalender - yabexxl - 08.02.2008

Hi Dragon,
so, habe alle so gemacht, wie Du gesagt hast. Leider bekomme ich nur noch leere Seiten angezeigt. Auch im Adminpanel alle leer.
PHP-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("global_end""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"        => "1",
        
"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"        => '3',
        
"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"        => '4',
        
"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"        => '5',
        
"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"        => '6',
        
"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"        => '2',
    
"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}</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}{$sb_eventstop}</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$header$footer$eventstop;  

    
$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'], 025) . "...";
            }
            
$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'])."\";");


$header .= '<table width="100%"  border="0">
  <tr>
    <td width="75%" valign="top">'
;
$footer '<td>
    <td width="25%" valign="top">'
.$sb_additional.$sb_welcome.$sb_search.$sb_stats.$sb_latestthreads.$eventstop'</td>
  </tr>
</table>'
.$footer

    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'], nulltrue);
        
my_setcookie("sid"$session->sid, -1true);
    
        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;
    }

}
?>



RE: Kalender - StefanT - 08.02.2008

Da ist ein Syntax-Fehler drin. Es muss so heißen:
PHP-Code:
$footer '<td>
    <td width="25%" valign="top">'
.$sb_additional.$sb_welcome.$sb_search.$sb_stats.$sb_latestthreads.$eventstop.'</td>
  </tr>
</table>'
.$footer



RE: Kalender - yabexxl - 08.02.2008

Okay, geändert. vielen Dank.
Leider bleibt die Box noch leer.


RE: Kalender - StefanT - 08.02.2008

Ist die Box da oder nicht?