$val = CAT_Helper_Validate::getInstance(); $users = CAT_Users::getInstance(); header('Content-type: application/json'); // Make sure people are allowed to access this page if (!CAT_Registry::exists('MANAGE_SECTIONS') || CAT_Registry::get('MANAGE_SECTIONS') != 'enabled') { $ajax = array('message' => $backend->lang()->translate('You cannot modify sections. Please enable "Manage section".'), 'success' => false); print json_encode($ajax); exit; } $delete_section_id = $val->sanitizePost('delete_section_id', 'numeric'); $update_section_id = $val->sanitizePost('update_section_id', 'numeric'); $section_id = $delete_section_id ? $delete_section_id : $update_section_id; // =============== // ! Get page id // =============== $page_id = CAT_Sections::getPageForSection($section_id); if (!$page_id) { $ajax = array('message' => $backend->lang()->translate('You sent an invalid value.') . ' ' . $backend->lang()->translate('Unable to get page_id for section [{{section}}].', array('section' => $section_id)), 'success' => false); print json_encode($ajax); exit; } // ============= // ! Get perms // ============= $page = CAT_Helper_Page::getPage($page_id); $old_admin_groups = explode(',', $page['admin_groups']); $old_admin_users = explode(',', $page['admin_users']); $in_old_group = false; foreach ($users->get_groups_id() as $cur_gid) { if (in_array($cur_gid, $old_admin_groups)) { $in_old_group = true;