Example #1
0
/**
 * Display the Main screen
 *
 */
function main_screen()
{
    global $Cfg, $build, $Users, $Pivot_Vars, $db, $Paths;
    $db = new db();
    PageHeader($Cfg['sitename'], 1);
    PageAnkeiler(lang('userbar', 'main_title'));
    $welcome = lang('general', 'welcome');
    $welcome = str_replace('%build%', $build, $welcome);
    // Check if there are any comments waiting to be moderated..
    if (file_exists("db/ser_modqueue.php")) {
        $modqueue = array_reverse(load_serialize("db/ser_modqueue.php", true, true));
    } else {
        $modqueue = array();
    }
    if (count($modqueue) > 0) {
        // lang("userbar","moderate_comments"));
        $queuemsg = lang("userbar", "moderate_comments_desc");
        $queuemsg = str_replace("%1", count($modqueue), $queuemsg);
    } else {
        $queuemsg = lang("userbar", "moderate_nocomments_desc");
    }
    // check to see if there are any 'timed publish' items that need to be
    // published..
    timedpublishcheck();
    echo "<!-- main -->";
    echo "<p><b>" . $welcome . "</b></p>";
    // the 'main menu'..
    $main_funcs = array(array(lang('userbar', 'submit'), 'new_entry', lang('userbar', 'submit_title'), 'new_entry'), array(lang('userbar', 'moderate_comments'), 'moderate_comments', $queuemsg, 'moderate_comments'), array(lang('userbar', 'entries'), 'entries', lang('userbar', 'entries_title'), 'entries'), array(lang('userbar', 'u_settings'), 'userinfo', lang('userbar', 'u_settings_title'), 'userinfo'), array(lang('userbar', 'files'), 'files', lang('userbar', 'files_title'), 'files'));
    if ($Users[$Pivot_Vars['user']]['userlevel'] >= 3) {
        $main_funcs[] = array(lang('adminbar', 'spamprotection'), 'spamprotection', lang('adminbar', 'spamprotection_title'), 'admin&amp;func=admin&amp;do=spamprotection');
        $main_funcs[] = array(lang('userbar', 'admin'), 'admin', lang('userbar', 'admin_title'), 'admin');
    }
    DispPage($main_funcs, 'overview');
    // If $Pivot_Vars['morecomments'] is not set, we set '0' as default..
    if (!isset($Pivot_Vars['morecomments'])) {
        $Pivot_Vars['morecomments'] = 5;
    }
    echo "\n\n<div style='position: absolute; right: 20px; top: 55px; border: 0px solid #F00;'>\n\n";
    if ($Pivot_Vars['morecomments'] == 5) {
        // Show the 'remove setup' notification..
        if ((file_exists('../pivot-setup-safemode.php') || file_exists('../pivot-setup.php')) && $Cfg['ignore_setupscript'] != 1) {
            echo "\n\n<!-- remove setup script warning -->\n";
            printf("<table cellspacing='0' class='tabular_border' border='0' width='340'><tr class='tabular_nav'>");
            printf("<td colspan='4' class='tabular-lastheader'>%s:</td></tr>", lang("adminbar", "remove_setup_header"));
            printf("<tr class='tabular_line_even'><td class='tabular-small' style='white-space: normal;'>%s</td>", lang("adminbar", "remove_setup"));
            echo '</tr>';
            echo '</table><br />';
        }
        // Show the 'Register Globals is on' warning..
        if (ini_get('register_globals') && $Cfg['ignore_registerglobals'] != 1) {
            echo "\n\n<!-- register_globals warning -->\n";
            printf("<table cellspacing='0' class='tabular_border' border='0' width='340'><tr class='tabular_nav'>");
            printf("<td colspan='4' class='tabular-lastheader'>%s:</td></tr>", lang("adminbar", "register_globals_header"));
            printf("<tr class='tabular_line_even'><td class='tabular-small' style='white-space: normal;'>%s</td>", lang("adminbar", "register_globals"));
            echo '</tr>';
            echo '</table><br />';
        }
        // Show the 'magic_quotes is on' notification..
        if (get_magic_quotes_runtime() && $Cfg['ignore_magicquotes'] != 1) {
            echo "\n\n<!-- magic_quotes warning -->\n";
            printf("<table cellspacing='0' class='tabular_border' border='0' width='340'><tr class='tabular_nav'>");
            printf("<td colspan='4' class='tabular-lastheader'>%s:</td></tr>", lang("adminbar", "magic_quotes_header"));
            printf("<tr class='tabular_line_even'><td class='tabular-small' style='white-space: normal;'>%s</td>", lang("adminbar", "magic_quotes"));
            echo '</tr>';
            echo '</table><br />';
        }
        // Load the latest news from pivotlog.net/notifier.xml
        define('MAGPIE_DIR', realpath('.') . '/includes/magpierss/');
        define('MAGPIE_CACHE_DIR', './db/rsscache/');
        define('MAGPIE_FETCH_TIME_OUT', 5);
        // 5 second timeout
        define('MAGPIE_CACHE_AGE', 60 * 60 * 8);
        // 8 hours
        require_once MAGPIE_DIR . 'rss_fetch.inc';
        if (isset($Cfg['notifier'])) {
            $feed_url = $Cfg['notifier'];
        } else {
            $feed_url = "http://www.pivotlog.net/notifier.xml";
        }
        $feed = fetch_rss($feed_url);
        // show the 'latest news'.
        echo "\n\n<!-- show latest news -->\n";
        printf("<table cellspacing='0' class='tabular_border' border='0' width='340'><tr class='tabular_nav'>\n");
        printf("<td colspan='4' class='tabular-lastheader'><span style='float:right'>(<a href='http://www.pivotlog.net/'>%s</a>)</span>\n", lang("general", "more"));
        printf("%s (%s)</td></tr>\n", lang("adminbar", "latest_pivot_news"), date("d/m/Y", strtotime(substr(str_replace("T", " ", $feed->items[0]['published']), 0, 10))));
        printf("<tr class='tabular_line_even'><td class='tabular-small' style='white-space: normal;'> %s</td>\n", $feed->items[0]['atom_content']);
        echo "</tr>\n";
        echo "</table><br />\n";
    }
    // Show the last comments.
    last_comments_overview($Pivot_Vars['morecomments']);
    if ($Pivot_Vars['morecomments'] == 5) {
        // show the last 6 entries
        echo "\n\n<!-- show last entries -->\n";
        $entrylink = sprintf("index.php?session=%s&amp;menu=entries", $Pivot_Vars['session']);
        $overview_arr = array_reverse($db->getlist(-6, 0, "", "", TRUE, ''));
        printf("<table cellspacing='0' class='tabular_border' border='0' width='340'><tr class='tabular_nav'>\n");
        printf("<td colspan='5' class='tabular-lastheader'><span style='float:right'>(<a href='%s'>%s</a>)</span>%s</td></tr>\n", $entrylink, lang("general", "more"), lang("userbar", "recent_entries"));
        foreach ($overview_arr as $overview_line) {
            print_row_overview($overview_line);
        }
        echo "</table><br />\n";
    }
    echo "</div>\n";
    //echo "</td></tr></table>\n\n";
    PageFooter();
}
Example #2
0
function inweblogcheck()
{
    global $Paths;
    // store the current dir, and change to the pivot dir.
    $olddir = getcwd();
    chdir($Paths['pivot_path']);
    // start input buffering..
    ob_start();
    if (timedpublishcheck()) {
        if (!headers_sent()) {
            header("location: " . $_SERVER['REQUEST_URI']);
        } else {
            // else the next visitor will just see the updated page..
        }
    }
    // stop buffering and flush the output..
    ob_end_flush();
    // change back to the original dir.
    chdir($olddir);
}