//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))); } $tpl->assign_block_vars('create', array()); //Génération de l'arborescence des catégories $cats = array(); $cat_list = display_pages_cat_explorer(0, $cats, 1); $current_cat = $LANG['pages_root']; $tpl->put_all(array('COUNT_HITS_CHECKED' => !empty($error) ? $count_hits == 1 ? 'checked="checked"' : '' : ($pages_config->get_count_hits_activated() == true ? 'checked="checked"' : ''), 'COMMENTS_ACTIVATED_CHECKED' => !empty($error) ? $enable_com == 1 ? 'checked="checked"' : '' : ($pages_config->get_comments_activated() == true ? 'checked="checked"' : ''), 'DISPLAY_PRINT_LINK_CHECKED' => !empty($error) ? $display_print_link == 1 ? 'checked="checked"' : '' : 'checked="checked"', 'OWN_AUTH_CHECKED' => '', 'CAT_0' => 'selected', 'ID_CAT' => '0', 'SELECTED_CAT' => '0', 'CHECK_IS_CAT' => $is_cat == 1 ? 'checked="checked"' : '')); } if (!empty($page_infos['auth'])) { $array_auth = unserialize($page_infos['auth']); } else { $array_auth = $config_authorizations; } $editor = AppContext::get_content_formatting_service()->get_default_editor(); $editor->set_identifier('contents'); $tpl->put_all(array('ID_EDIT' => $id_edit, 'SELECT_READ_PAGE' => Authorizations::generate_select(READ_PAGE, $array_auth), 'SELECT_EDIT_PAGE' => Authorizations::generate_select(EDIT_PAGE, $array_auth), 'SELECT_READ_COM' => Authorizations::generate_select(READ_COM, $array_auth), 'OWN_AUTH_DISABLED' => !empty($page_infos['auth']) ? 'false' : 'true', 'DISPLAY' => empty($page_infos['auth']) ? 'display:none;' : '', 'CAT_LIST' => $cat_list, 'KERNEL_EDITOR' => $editor->display(), 'L_AUTH' => $LANG['pages_auth'], 'L_COMMENTS_ACTIVATED' => $LANG['pages_comments_activated'], 'L_DISPLAY_PRINT_LINK' => $LANG['pages_display_print_link'], 'L_COUNT_HITS' => $LANG['pages_count_hits_activated'], 'L_ALERT_CONTENTS' => $LANG['page_alert_contents'], 'L_ALERT_TITLE' => $LANG['page_alert_title'], 'L_READ_PAGE' => $LANG['pages_auth_read'], 'L_EDIT_PAGE' => $LANG['pages_auth_edit'], 'L_READ_COM' => $LANG['pages_auth_read_com'], 'L_OWN_AUTH' => $LANG['pages_own_auth'], 'L_IS_CAT' => $LANG['pages_is_cat'], 'L_CAT' => $LANG['pages_parent_cat'], 'L_AUTH' => $LANG['pages_auth'], 'L_PATH' => $LANG['pages_page_path'], 'L_PROPERTIES' => $LANG['pages_properties'], 'L_TITLE_POST' => $id_edit > 0 ? sprintf($LANG['pages_edit_page'], stripslashes($page_infos['title'])) : $LANG['pages_creation'], 'L_TITLE_FIELD' => $LANG['page_title'], 'L_CONTENTS' => $LANG['page_contents'], 'L_RESET' => $LANG['reset'], 'L_PREVIEW' => $LANG['preview'], 'L_SUMBIT' => $LANG['submit'], 'L_ROOT' => $LANG['pages_root'], 'L_PREVIEWING' => $LANG['pages_previewing'], 'L_CONTENTS_PART' => $LANG['pages_contents_part'], 'L_SUBMIT' => $id_edit > 0 ? $LANG['update'] : $LANG['submit'])); $tpl->display(); require_once '../kernel/footer.php';
if ($del_cat > 0) { try { $page_infos = $db_querier->select_single_row(PREFIX . 'pages', array('id', 'title', 'encoded_title', 'auth', 'id_cat', 'redirect'), 'WHERE id = :id', array('id' => $del_cat)); } catch (RowNotFoundException $e) { $error_controller = PHPBoostErrors::unexisting_page(); DispatchManager::redirect($error_controller); } //Autorisation particulière ? $special_auth = !empty($page_infos['auth']); $array_auth = unserialize($page_infos['auth']); //Vérification de l'autorisation de renommer la page 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('/pages/pages.php?error=e_auth'); } $cats = array(); $cat_list = display_pages_cat_explorer($page_infos['id_cat'], $cats); $cats = array_reverse($cats); if (array_key_exists(0, $cats)) { unset($cats[0]); } $current_cat = ''; $nbr_cats = count($cats); $i = 1; foreach ($cats as $key => $value) { $current_cat .= $categories[$value]['title'] . ($i < $nbr_cats ? ' / ' : ''); $i++; } if ($page_infos['id_cat'] > 0) { $current_cat .= ($nbr_cats > 0 ? ' / ' : '') . $categories[$page_infos['id_cat']]['title']; } else { $current_cat = $LANG['pages_no_selected_cat'];