trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } $backend = CAT_Backend::getInstance('Pages', 'pages_add', false); $users = CAT_Users::getInstance(); header('Content-type: application/json'); if (!$users->checkPermission('Pages', 'pages_add')) { $ajax = array('message' => $backend->lang()->translate('You do not have the permission to add a page.'), 'success' => false); print json_encode($ajax); exit; } // note: all pages are listed in the dropdown, even hidden / private AND deleted! $dropdown_list = CAT_Helper_ListBuilder::sort(CAT_Helper_Page::getPages(1), 0); // template / variant $template = CAT_Helper_Page::properties($val->sanitizePost('parent_id', 'numeric'), 'template'); $variant = CAT_Helper_Page::getPageSettings($val->sanitizePost('parent_id', 'numeric'), 'internal', 'template_variant'); $variants = array(); $info = CAT_Helper_Addons::checkInfo(CAT_PATH . '/templates/' . CAT_Helper_Page::getPageTemplate($val->sanitizePost('parent_id', 'numeric'))); if (isset($info['module_variants']) && is_array($info['module_variants']) && count($info['module_variants'])) { $variants = $info['module_variants']; array_unshift($variants, ''); } // ============================================= // ! Add result_array to the template variable // ============================================= $ajax = array('parent_id' => $val->sanitizePost('parent_id', 'numeric'), 'parent_list' => $dropdown_list, 'template' => $template, 'template_variant' => $variant, 'variants' => $variants, 'target' => '_self', 'success' => true); // ==================== // ! Return values // ==================== print json_encode($ajax); exit;
// ! Get display name of person who last modified the page // ========================================================= $user = $users->get_user_details($results_array['modified_by']); // ================================= // ! Add permissions to $data_dwoo // ================================= $permission['pages'] = $users->checkPermission('Pages', 'pages') ? true : false; $permission['pages_add'] = $users->checkPermission('Pages', 'pages_add') ? true : false; $permission['pages_add_l0'] = $users->checkPermission('Pages', 'pages_add_l0') ? true : false; $permission['pages_modify'] = $users->checkPermission('Pages', 'pages_modify') ? true : false; $permission['pages_delete'] = $users->checkPermission('Pages', 'pages_delete') ? true : false; $permission['pages_settings'] = $users->checkPermission('Pages', 'pages_settings') ? true : false; $permission['pages_intro'] = $users->checkPermission('Pages', 'pages_intro') != true || INTRO_PAGE != 'enabled' ? false : true; // list of all pages for dropdown, sorted by parent->child $pages = CAT_Helper_ListBuilder::sort(CAT_Helper_Page::getPages(CAT_Backend::isBackend()), 0); // ============================================= // ! Add result_array to the template variable // ============================================= $ajax = array('description' => $results_array['description'], 'keywords' => $results_array['keywords'], 'language' => $results_array['language'], 'level' => $results_array['level'], 'menu' => $results_array['menu'], 'menu_title' => htmlspecialchars_decode($results_array['menu_title'], ENT_QUOTES), 'modified_when' => $results_array['modified_when'] != 0 ? CAT_Helper_DateTime::getDate($results_array['modified_when']) : 'Unknown', 'page_id' => $results_array['page_id'], 'page_title' => htmlspecialchars_decode($results_array['page_title'], ENT_QUOTES), 'parent' => $results_array['parent'], 'searching' => $results_array['searching'] == 0 ? false : true, 'short_link' => substr($results_array['link'], strripos($results_array['link'], '/') + 1), 'target' => $results_array['target'], 'template' => $results_array['template'], 'visibility' => $results_array['visibility'], 'display_name' => $user['display_name'], 'username' => $user['username'], 'DISPLAY_MENU_LIST' => MULTIPLE_MENUS != false ? true : false, 'DISPLAY_LANGUAGE_LIST' => PAGE_LANGUAGES != false ? true : false, 'DISPLAY_SEARCHING' => SEARCH != false ? true : false, 'admin_groups' => explode(',', str_replace('_', '', $results_array['admin_groups'])), 'viewing_groups' => explode(',', str_replace('_', '', $results_array['viewing_groups'])), 'parent_list' => $pages, 'PAGE_EXTENSION' => $backend->db()->query("SELECT `value` FROM `:prefix:settings` WHERE name = 'page_extension'")->fetchColumn()); $ajax['variants'] = array(); $info = CAT_Helper_Addons::checkInfo(CAT_PATH . '/templates/' . CAT_Helper_Page::getPageTemplate($results_array['page_id'])); if (isset($info['module_variants']) && is_array($info['module_variants']) && count($info['module_variants'])) { $ajax['variants'] = $info['module_variants']; array_unshift($ajax['variants'], ''); } $ajax['template_variant'] = CAT_Helper_Page::getPageSettings($results_array['page_id'], 'internal', 'template_variant'); // ==================== // ! Return values // ==================== print json_encode($ajax); exit;
$tpl_data['MODIFIED_BY_USERNAME'] = $user['username']; $tpl_data['MODIFIED_WHEN'] = $results_array['modified_when'] != 0 ? $modified_ts = CAT_Helper_DateTime::getDateTime($results_array['modified_when']) : false; $tpl_data['SECTION_BLOCKS'] = SECTION_BLOCKS; $tpl_data['SEC_ANCHOR'] = SEC_ANCHOR; $tpl_data['DATE_FORMAT'] = CAT_DATE_FORMAT; $tpl_data['CUR_TAB'] = 'modify'; $tpl_data['PAGE_HEADER'] = $backend->lang()->translate('Modify page'); // ========================================================= // ! Work-out if we should show the "manage sections" link // ========================================================= $section_id = CAT_Sections::getSectionForPage($page_id); $tpl_data['MANAGE_SECTIONS'] = $section_id || MANAGE_SECTIONS != 'enabled' ? false : true; // =========================================================================== // ! get template used for the displayed page (for displaying block details) // =========================================================================== $current_template = CAT_Helper_Page::getPageTemplate($page_id); // ============================== // ! Get sections for this page // ============================== $tpl_data['modules'] = $addons->get_addons(1, 'module', 'page'); // Remove menu_link from list foreach ($tpl_data['modules'] as $index => $module) { if ($module['VALUE'] == 'menu_link') { unset($tpl_data['modules'][$index]); } } $sections = $page->getSections(); $module_permissions = $val->fromSession('MODULE_PERMISSIONS'); $bcnt = 0; foreach ($sections as $section) { $module = $section['module'];
$options = array(); if ($block) { $options['block'] = $val->add_slashes($block); } if ($name) { $options['name'] = $val->add_slashes($name); } $date_from = $day_from * $month_from * $year_from > 0 ? mktime($hour_from, $minute_from, 0, $month_from, $day_from, $year_from) : 0; $date_to = $day_to * $month_to * $year_to > 0 ? mktime($hour_to, $minute_to, 0, $month_to, $day_to, $year_to) : 0; if ($date_from > $date_to) { $ajax = array('message' => $backend->lang()->translate('Please check your entries for dates.'), 'success' => false); print json_encode($ajax); exit; } else { $options['publ_start'] = $date_from; $options['publ_end'] = $date_to; } if (!CAT_Sections::updateSection($update_section_id, $options)) { $ajax = array('message' => $backend->lang()->translate('Unable to save section: ' . $backend->db()->getError()), 'success' => false); print json_encode($ajax); exit; } $updated_section = CAT_Sections::getSection($update_section_id); $updated_block = $parser->get_template_block_name(CAT_Helper_Page::getPageTemplate($page_id), $updated_section['block']) . ' (' . $backend->lang()->translate('Block number') . ': ' . $updated_section['block'] . ')'; } // ============================================ // ! Check for error or print success message // ============================================ $ajax = array('message' => $backend->lang()->translate('Section properties saved successfully.'), 'updated_section' => isset($updated_section) ? $updated_section : false, 'updated_block' => isset($updated_block) ? $updated_block : false, 'success' => true); print json_encode($ajax); exit;