Пример #1
0
/**
 * Generates entries, frontpages and archives for a given entry ID.
 *
 * @uses generate_html generates entry (HTML)
 * @uses generate_archive generates archive page
 * @uses generate_frontpage generates front page
 */
function generate_pages($id, $singlepage = TRUE, $frontpage = TRUE, $archive = TRUE, $ping = FALSE, $rss = TRUE)
{
    global $db, $Weblogs, $Current_weblog, $Allow_RSS;
    //LoadTempLanguage();
    $Allow_RSS = $rss;
    // load an entry
    $entry = $db->read_entry($id, TRUE);
    $in_weblogs = find_weblogs_with_cat($entry['category']);
    foreach ($in_weblogs as $in_weblog) {
        $entry = $db->read_entry($id);
        $org_date = $entry['date'];
        $Current_weblog = $in_weblog;
        $template = $Weblogs[$in_weblog]['entry_template'];
        // we generate the single (static) entry only if it's published
        if ($Weblogs[$in_weblog]['live_entries'] != 1 && $entry['status'] == 'publish') {
            generate_html($template, $in_weblog);
        }
        // generate the archives (for this date) only if the entry is
        // published.
        if ($archive && $Weblogs[$Current_weblog]['archive_unit'] != 'none' && $entry['status'] == 'publish') {
            generate_archive($in_weblog, $org_date);
        }
        // generate the frontpage
        if ($frontpage) {
            $filename = generate_frontpage($in_weblog);
        }
        LoadUserLanguage();
    }
    // if we need to ping. do here:
    if ($ping) {
        open_ping_window($in_weblogs);
    }
}
Пример #2
0
/**
 * Initialise some things when the pivot interface must be shown:
 *
 * - Check if user is trying to register him/herself
 * - Check if user is logged in
 * - Load languages
 * - Convert encoding
 * - Load allowed functions for 'normal users' and 'admins'
 * - depending on userlevel, display the screen for normal or admin users
 *
 * @see CheckSanity(), CheckLogin(), LoadUserLanguage(), mainFunctions(), adminFunctions(), startAdmin(), startNormal()
 */
function Load()
{
    global $Pivot_Vars, $Cfg, $Users, $ThisUser;
    CheckSanity();
    if ($Cfg['installed'] == 0) {
        require_once 'setup.php';
    } else {
        CheckLogin();
        // Redirecting to page requested after log in (if needed)
        if (!empty($Pivot_Vars['login_query_string'])) {
            SaveSettings();
            redirect("index.php?" . urldecode($Pivot_Vars['login_query_string']) . "&session=" . $Pivot_Vars['session']);
        }
        LoadUserLanguage();
        // convert encoding to UTF-8
        i18n_array_to_utf8($Pivot_Vars, $dummy_variable);
        $ThisUser = $Users[$Pivot_Vars['user']];
        require_once 'pv_data.php';
        mainFunctions();
        if ($Users[$Pivot_Vars['user']]['userlevel'] >= 3) {
            adminFunctions();
        }
        if (isset($Pivot_Vars['menu']) && $Pivot_Vars['menu'] == 'admin') {
            require_once 'pv_admin.php';
            startAdmin();
        } else {
            startNormal();
        }
    }
    SaveSettings();
}