function ajax_exec_cat() { if (!getperms('0|7')) { exit; } //require_once (e_HANDLER.'js_helper.php'); $e107 = e107::getInstance(); $category = array(); if ($e107->sql->db_Select("news_category", "*", "category_id=" . $this->getId())) { $category = $e107->sql->db_Fetch(); } if (empty($category)) { e_jshelper::sendAjaxError(404, 'Page not found!', 'Requested news category was not found in the DB.', true); } $jshelper = new e_jshelper(); $jshelper->addResponseAction('fill-form', $category); //show cancel and update, hide create buttons; disable create button (just in case) $jshelper->addResponseAction('element-invoke-by-id', array('show' => 'category-clear,update-category', 'disabled,1' => 'create-category', 'hide' => 'create-category', 'newsScrollToMe' => 'core-newspost-cat-create')); //Send the prefered response type $jshelper->sendResponse('XML'); }
require_once e_ADMIN . "header.php"; } else { // boot.php is included in admin dispatcher constructor, so do it only for legacy code require_once e_ADMIN . 'boot.php'; } } /* * FIXME - missing $style for tablerender * The Solution: parse_admin() without sending it to the browser if it's an ajax call * The Problem: doubled render time for the ajax called page!!! */ } else { //login via AJAX call is not allowed if (e_AJAX_REQUEST) { require_once e_HANDLER . 'js_helper.php'; e_jshelper::sendAjaxError(403, ADLAN_86, ADLAN_87, true); } require_once e_ADMIN . 'boot.php'; $sec_img = e107::getSecureImg(); $use_imagecode = $pref['logcode'] && extension_loaded("gd"); if ($_POST['authsubmit']) { $obj = new auth(); if ($use_imagecode) { if ($sec_img->invalidCode($_POST['rand_num'], $_POST['code_verify'])) { e107::getRedirect()->redirect('admin.php?failed'); exit; // echo "<script type='text/javascript'>document.location.href='../index.php'</script>\n"; // header("location: ../index.php"); // exit; } }
$jshelper->addResponseAction('element-invoke-by-id', array('show' => 'userclass_type_groups', 'hide' => 'userclass_type_standard')); //fill in the classes array $tmp = explode(',', $row['userclass_accum']); foreach ($tmp as $uid) { $row['group_classes_select_' . $uid] = $uid; } } else { //hide group, show standard rows $jshelper->addResponseAction('element-invoke-by-id', array('hide' => 'userclass_type_groups', 'show' => 'userclass_type_standard')); } unset($row['userclass_accum']); $jshelper->addResponseAction('fill-form', $row); $jshelper->sendResponse('XML'); // $jshelper->sendResponse('JSON'); - another option (tested) - faster transfer! } else { e_jshelper::sendAjaxError('500', 'Database read error!'); } } exit; } e107::getJs()->headerCore('core/admin.js'); /* * Authorization should be done a bit later! */ require_once "auth.php"; $emessage = e107::getMessage(); //--------------------------------------------------- // Set Initial Classes //--------------------------------------------------- if (isset($_POST['set_initial_classes'])) { $changed = $pref['init_class_stage'] != intval($_POST['init_class_stage']);