Example #1
0
/**
* The screen to edit a weblog, screen 2
*/
function main_blogs_edit2()
{
    global $Cfg, $Pivot_Vars, $blog_settings, $Weblogs, $Current_subweblog;
    PageHeader(lang('weblog_config', 'create_2'));
    PageAnkeiler(lang('userbar', 'admin') . ' » ' . lang('weblog_config', 'create_2'));
    $temp_weblog = array('name' => stripslashes($Pivot_Vars['name']), 'payoff' => stripslashes($Pivot_Vars['payoff']), 'siteurl' => stripslashes($Pivot_Vars['siteurl']), 'front_filename' => $Pivot_Vars['front_filename'], 'front_path' => fixPathSlash($Pivot_Vars['front_path']), 'ssi_prefix' => $Pivot_Vars['ssi_prefix'], 'language' => $Pivot_Vars['language'], 'live_entries' => $Pivot_Vars['live_entries'], 'entry_filename' => $Pivot_Vars['entry_filename'], 'entry_path' => fixPathSlash($Pivot_Vars['entry_path']), 'read_more' => stripslashes($Pivot_Vars['read_more']), 'archive_filename' => $Pivot_Vars['archive_filename'], 'archive_path' => fixPathSlash($Pivot_Vars['archive_path']), 'archive_unit' => $Pivot_Vars['archive_unit'], 'archive_amount' => $Pivot_Vars['archive_amount'], 'archive_link' => stripslashes($Pivot_Vars['archive_link']), 'archive_linkfile' => stripslashes($Pivot_Vars['archive_linkfile']), 'archive_order' => stripslashes($Pivot_Vars['archive_order']), 'front_template' => $Pivot_Vars['front_template'], 'archive_template' => $Pivot_Vars['archive_template'], 'entry_template' => $Pivot_Vars['entry_template'], 'extra_template' => $Pivot_Vars['extra_template']);
    if (isset($Pivot_Vars['orig_name']) && strlen($Pivot_Vars['orig_name']) > 1) {
        $blog_settings = $Weblogs[$Pivot_Vars['orig_name']];
        $orig_name = $Pivot_Vars['orig_name'];
        MidHeading(sprintf(lang('weblog_config', 'edit_weblog') . ' \'%s\'', $Weblogs[$Pivot_Vars['orig_name']]['name']));
    } else {
        $blog_settings = get_tempweblog();
        $orig_name = "";
        MidHeading(lang('weblog_config', 'create_new'));
    }
    StartForm('blog_edit3', 1);
    StartTable();
    EndForm(lang('go'), 2, lang('weblog_config', 'subw_heading'));
    // initialize the settings array..
    $settings = array();
    $settings[] = array('orig_name', 'originalname', '', 7, $orig_name);
    $settings[] = array('temp_weblog', 'tempweblog', '', 7, urlencode(serialize($temp_weblog)));
    $templates = gettemplates('_sub');
    $categories = cfg_cats();
    $template_html = load_template($temp_weblog['front_template']);
    // to cater for users that upgraded their old templates, we
    // assume [[weblog]] to be [[weblog:standard]]
    $template_html = str_replace("[[weblog]]", "[[weblog:standard]]", $template_html);
    preg_match_all("/\\[\\[(sub)?weblog:([^:]*)(:.*)?\\]\\]/mUi", $template_html, $match);
    $subweblogs = $match[2];
    foreach ($subweblogs as $key) {
        $key = trim($key);
        // if the subweblog is in the template, but not in the config files, assume some defaults
        if (!isset($blog_settings['sub_weblog'][$key])) {
            $blog_settings['sub_weblog'][$key]['template'] = "_sub_entry_standard.html";
            $blog_settings['sub_weblog'][$key]['num_entries'] = 10;
            $blog_settings['sub_weblog'][$key]['comments'] = 1;
            $blog_settings['sub_weblog'][$key]['categories'] = array();
        }
        $subweblog = $blog_settings['sub_weblog'][$key];
        $settings[] = array('heading', $key, '', 8, '', 2);
        $settings[] = array('sub_weblog[' . $key . '][template]', lang('weblog_config', 'shortentry_template'), lang('weblog_config', 'shortentry_template_desc'), 3, $templates, '', $key);
        $settings[] = array('sub_weblog[' . $key . '][num_entries]', lang('weblog_config', 'num_entries'), lang('weblog_config', 'num_entries_desc'), 0, $subweblog['num_entries']);
        $settings[] = array('sub_weblog[' . $key . '][offset]', lang('weblog_config', 'offset'), lang('weblog_config', 'offset_desc'), 0, $subweblog['offset']);
        // JM - 2004/10/15 - lang abstraction inserted
        $settings[] = array('', lang('weblog_config', 'publish_cats'), '', 6);
        $style_nosearch = 'style="background-color:#eee;"';
        // NOTE - include style if a no-index category...
        $cats_nosearch = cfg_cat_nosearchindex();
        foreach ($categories as $category) {
            $label = sprintf('   ' . $category['name']);
            $name = urlencode($category['name']);
            if (in_array($category['name'], $subweblog['categories'])) {
                $settings[] = array('sub_weblog[' . $key . '][categories][' . $name . ']', $label, '', 2, 1, '', '');
            } else {
                $settings[] = array('sub_weblog[' . $key . '][categories][' . $name . ']', $label, '', 2, 0, '', '');
            }
        }
        $numentries = $blog_settings['sub_weblog'][$key]['num_entries'];
    }
    DisplaySettings($settings, 'blog_settings');
    EndForm(lang('go'), 1);
    PageFooter();
}
Example #2
0
/**
 * ok - we have to use all 8 parameters that the display engine can take, all because we
 * need to be able to get the saved settings when editing a weblog. eh.. it works, so
 * let's just leave it at that, shall we? -mark
 *
 * @return array
 */
function get_weblog_config1($orig_name = "")
{
    $templates = gettemplates();
    foreach ($templates as $key => $val) {
        $pos1 = strpos($val, '_aux_');
        $pos2 = strpos($val, '_sub_');
        if ($pos1 === 0 || $pos2 === 0) {
            unset($templates[$key]);
        }
    }
    sort($templates);
    $config = array(array('orig_name', lang('weblog_config', 'name'), '', 7, $orig_name), array('name', lang('weblog_config', 'name'), '', 0), array('payoff', lang('weblog_config', 'payoff'), lang('weblog_config', 'payoff_desc'), 0, '', 60), array('siteurl', lang('weblog_config', 'url'), lang('weblog_config', 'url_desc'), 0, '', 40), array('front_filename', lang('weblog_config', 'index_name'), lang('weblog_config', 'index_name_desc'), 0), array('front_path', lang('weblog_config', 'front_path'), lang('weblog_config', 'front_path_desc'), 0), array('language', lang('weblog_config', 'language'), lang('weblog_config', 'language_desc'), 3, GetLangs(), '', ''), array('heading', lang('weblog_config', 'entry_heading'), '', 8, '', 2), array('live_entries', lang('weblog_config', 'live_comments'), lang('weblog_config', 'live_comments_desc'), 3, 'yn'), array('entry_filename', lang('weblog_config', 'file_format'), '', 0), array('entry_path', lang('weblog_config', 'entry_path'), lang('weblog_config', 'entry_path_desc'), 0), array('read_more', lang('weblog_config', 'readmore'), lang('weblog_config', 'readmore_desc'), 0), array('heading', lang('weblog_config', 'arc_heading'), '', 8, '', 2), array('archive_filename', lang('weblog_config', 'arc_index'), '', 0), array('archive_path', lang('weblog_config', 'arc_path'), '', 0), array('archive_unit', lang('weblog_config', 'archive_unit'), '', 3, array(lang('weblog_config', 'archive_none'), 'none', lang('weblog_config', 'archive_weekly'), 'week', lang('weblog_config', 'archive_monthly'), 'month', lang('weblog_config', 'archive_yearly'), 'year')), array('archive_link', lang('weblog_config', 'archive_link'), '', 5, '', '60', 'rows=3'), array('archive_linkfile', lang('weblog_config', 'archive_linkfile'), '', 5, '', '60', 'rows=3'), array('archive_order', lang('weblog_config', 'archive_order'), '', 3, array(lang('weblog_config', 'archive_ascending'), 'ascending', lang('weblog_config', 'archive_descending'), 'descending')), array('heading', lang('weblog_config', 'templates_heading'), '', 8, '', 2), array('front_template', lang('weblog_config', 'frontpage_template'), lang('weblog_config', 'frontpage_template_desc'), 3, $templates), array('archive_template', lang('weblog_config', 'archivepage_template'), lang('weblog_config', 'archivepage_template_desc'), 3, $templates), array('entry_template', lang('weblog_config', 'entrypage_template'), lang('weblog_config', 'entrypage_template_desc'), 3, $templates), array('extra_template', lang('weblog_config', 'extrapage_template'), lang('weblog_config', 'extrapage_template_desc'), 3, $templates));
    return $config;
}