Exemplo n.º 1
0
<?php

require_once '../kernel/begin.php';
include_once '../wiki/wiki_functions.php';
load_module_lang('wiki');
define('TITLE', $LANG['wiki'] . ': ' . $LANG['wiki_contribuate']);
define('ALTERNATIVE_CSS', 'wiki');
$bread_crumb_key = 'wiki_post';
require_once '../wiki/wiki_bread_crumb.php';
$is_cat = retrieve(POST, 'is_cat', false) ? 1 : 0;
$is_cat_get = retrieve(GET, 'type', '') == 'cat' ? 1 : 0;
$is_cat = $is_cat > 0 ? $is_cat : $is_cat_get;
$id_edit = retrieve(POST, 'id_edit', 0);
$title = retrieve(POST, 'title', '');
$encoded_title = retrieve(GET, 'title', '');
$contents = wiki_parse(retrieve(POST, 'contents', '', TSTRING_AS_RECEIVED));
$contents_preview = htmlspecialchars(retrieve(POST, 'contents', '', TSTRING_UNCHANGE), ENT_COMPAT, 'ISO-8859-1');
$id_cat = retrieve(GET, 'id_parent', 0);
$new_id_cat = retrieve(POST, 'id_cat', 0);
$id_cat = $id_cat > 0 ? $id_cat : $new_id_cat;
$preview = !empty($_POST['preview']) ? true : false;
$id_edit_get = retrieve(GET, 'id', 0);
$id_edit = $id_edit > 0 ? $id_edit : $id_edit_get;
require_once '../kernel/header.php';
$error = '';
if (!empty($contents)) {
    include_once '../wiki/wiki_functions.php';
    $menu = '';
    if (preg_match('`[\\-]{2,6}`isU', $contents)) {
        $menu_list = wiki_explode_menu($contents);
        $menu = wiki_display_menu($menu_list);
Exemplo n.º 2
0
$request = AppContext::get_request();
$update = $request->get_postvalue('update', false);
$display_categories_on_index = $request->get_postvalue('display_categories_on_index', false);
$hits_counter = $request->get_postvalue('hits_counter', false);
$index_text = stripslashes(wiki_parse(retrieve(POST, 'contents', '', TSTRING_AS_RECEIVED)));
if ($update) {
    $config->set_wiki_name(TextHelper::strprotect(retrieve(POST, 'wiki_name', $LANG['wiki'], TSTRING_AS_RECEIVED), TextHelper::HTML_PROTECT, TextHelper::ADDSLASHES_NONE));
    $config->set_number_articles_on_index(retrieve(POST, 'number_articles_on_index', 0));
    if ($display_categories_on_index) {
        $config->display_categories_on_index();
    } else {
        $config->hide_categories_on_index();
    }
    if ($hits_counter) {
        $config->enable_hits_counter();
    } else {
        $config->disable_hits_counter();
    }
    $config->set_index_text(stripslashes(wiki_parse(retrieve(POST, 'contents', '', TSTRING_AS_RECEIVED))));
    WikiConfig::save();
    //Régénération du cache
    WikiCategoriesCache::invalidate();
}
$tpl = new FileTemplate('wiki/admin_wiki.tpl');
//On travaille uniquement en BBCode, on force le langage de l'éditeur
$content_editor = AppContext::get_content_formatting_service()->get_default_factory();
$editor = $content_editor->get_editor();
$editor->set_identifier('contents');
$tpl->put_all(array('KERNEL_EDITOR' => $editor->display(), 'HITS_SELECTED' => $config->is_hits_counter_enabled() ? 'checked="checked"' : '', 'WIKI_NAME' => $config->get_wiki_name(), 'HIDE_CATEGORIES_ON_INDEX' => !$config->are_categories_displayed_on_index() ? 'checked="checked"' : '', 'DISPLAY_CATEGORIES_ON_INDEX' => $config->are_categories_displayed_on_index() ? 'checked="checked"' : '', 'NUMBER_ARTICLES_ON_INDEX' => $config->get_number_articles_on_index(), 'DESCRIPTION' => wiki_unparse($config->get_index_text()), 'L_UPDATE' => $LANG['update'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_WIKI_MANAGEMENT' => $LANG['wiki_management'], 'L_WIKI_GROUPS' => $LANG['wiki_groups_config'], 'L_CONFIG_WIKI' => $LANG['wiki_config'], 'L_WHOLE_WIKI' => $LANG['wiki_config_whole'], 'L_INDEX_WIKI' => $LANG['wiki_index'], 'L_HITS_COUNTER' => $LANG['wiki_count_hits'], 'L_WIKI_NAME' => $LANG['wiki_name'], 'L_DISPLAY_CATEGORIES_ON_INDEX' => $LANG['wiki_display_cats'], 'L_NOT_DISPLAY' => $LANG['wiki_no_display'], 'L_DISPLAY' => $LANG['wiki_display'], 'L_NUMBER_ARTICLES_ON_INDEX' => $LANG['wiki_last_articles'], 'L_NUMBER_ARTICLES_ON_INDEX_EXPLAIN' => $LANG['wiki_last_articles_explain'], 'L_DESCRIPTION' => $LANG['wiki_desc']));
$tpl->display();
require_once '../admin/admin_footer.php';