Exemplo n.º 1
0
if ($id_edit > 0) {
    $special_auth = !empty($page_infos['auth']);
    $array_auth = unserialize($page_infos['auth']);
    if ($special_auth && !$User->check_auth($array_auth, EDIT_PAGE) || !$special_auth && !$User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) {
        redirect(HOST . DIR . url('/pages/pages.php?error=e_auth', '', '&'));
    }
    if ($error == 'cat_contains_cat') {
        $Errorh->handler($LANG['pages_cat_contains_cat'], E_USER_WARNING);
    } elseif ($error == 'preview') {
        $Errorh->handler($LANG['pages_notice_previewing'], E_USER_NOTICE);
        $Template->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title)));
    }
    $cats = array();
    $id_cat_display = $page_infos['is_cat'] == 1 ? $_PAGES_CATS[$page_infos['id_cat']]['id_parent'] : $page_infos['id_cat'];
    $cat_list = display_cat_explorer($id_cat_display, $cats, 1);
    $Template->assign_vars(array('CONTENTS' => !empty($error) ? htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1') : pages_unparse($page_infos['contents']), 'COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($page_infos['count_hits'] == 1 ? 'checked="checked"' : ''), 'ACTIV_COM_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($page_infos['activ_com'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => !empty($page_infos['auth']) ? 'checked="checked"' : '', 'CAT_0' => $id_cat_display == 0 ? 'pages_selected_cat' : '', 'ID_CAT' => $id_cat_display, 'SELECTED_CAT' => $id_cat_display, 'CHECK_IS_CAT' => 'disabled="disabled"' . ($page_infos['is_cat'] == 1 ? ' checked="checked"' : '')));
} else {
    if (!$User->check_auth($_PAGES_CONFIG['auth'], EDIT_PAGE)) {
        redirect(HOST . DIR . '/pages/pages.php?error=e_auth');
    }
    if ($error == 'page_already_exists') {
        $Errorh->handler($LANG['pages_already_exists'], E_USER_WARNING);
    } elseif ($error == 'preview') {
        $Errorh->handler($LANG['pages_notice_previewing'], E_USER_NOTICE);
        $Template->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title)));
    }
    if (!empty($error)) {
        $Template->assign_vars(array('CONTENTS' => htmlspecialchars(stripslashes($contents), ENT_COMPAT, 'ISO-8859-1'), 'PAGE_TITLE' => stripslashes($title)));
    }
    $Template->assign_block_vars('create', array());
    $cats = array();
Exemplo n.º 2
0
    if ($special_auth && !AppContext::get_current_user()->check_auth($array_auth, EDIT_PAGE) || !$special_auth && !AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE)) {
        AppContext::get_response()->redirect(HOST . DIR . url('/pages/pages.php?error=e_auth', '', '&'));
    }
    //Erreur d'enregistrement ?
    if ($error == 'cat_contains_cat') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_cat_contains_cat'], MessageHelper::WARNING));
    } elseif ($error == 'preview') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_notice_previewing'], MessageHelper::NOTICE));
        $tpl->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title)));
    }
    //Génération de l'arborescence des catégories
    $cats = array();
    //numéro de la catégorie de la page ou de la catégorie
    $id_cat_display = $page_infos['is_cat'] == 1 ? $categories[$page_infos['id_cat']]['id_parent'] : $page_infos['id_cat'];
    $cat_list = display_pages_cat_explorer($id_cat_display, $cats, 1);
    $tpl->put_all(array('CONTENTS' => !empty($error) ? stripslashes($contents) : pages_unparse($page_infos['contents']), 'COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($page_infos['count_hits'] == 1 ? 'checked="checked"' : ''), 'COMMENTS_ACTIVATED_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($page_infos['activ_com'] == 1 ? 'checked="checked"' : ''), 'DISPLAY_PRINT_LINK_CHECKED' => !empty($error) ? $display_print_link == 1 ? 'checked="checked"' : '' : ($page_infos['display_print_link'] == 1 ? 'checked="checked"' : ''), 'OWN_AUTH_CHECKED' => !empty($page_infos['auth']) ? 'checked="checked"' : '', 'CAT_0' => $id_cat_display == 0 ? 'selected' : '', 'ID_CAT' => $id_cat_display, 'SELECTED_CAT' => $id_cat_display, 'CHECK_IS_CAT' => 'disabled="disabled"' . ($page_infos['is_cat'] == 1 ? ' checked="checked"' : '')));
} else {
    //Autorisations
    if (!AppContext::get_current_user()->check_auth($config_authorizations, EDIT_PAGE)) {
        AppContext::get_response()->redirect('/pages/pages.php?error=e_auth');
    }
    //La page existe déjà !
    if ($error == 'page_already_exists') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_already_exists'], MessageHelper::WARNING));
    } elseif ($error == 'preview') {
        $tpl->put('message_helper', MessageHelper::display($LANG['pages_notice_previewing'], MessageHelper::NOTICE));
        $tpl->assign_block_vars('previewing', array('PREVIEWING' => pages_second_parse(stripslashes(pages_parse($contents))), 'TITLE' => stripslashes($title)));
    }
    if (!empty($error)) {
        $tpl->put_all(array('CONTENTS' => stripslashes($contents), 'PAGE_TITLE' => stripslashes($title)));
    }