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'); }
e107::setRegistry('pageParams', $uc_qs); //AJAX request check is already made by the API if (e_AJAX_REQUEST) { $class_num = intval($params); if ($action == 'edit') { require_once e_HANDLER . 'js_helper.php'; $jshelper = new e_jshelper(); if (!check_allowed($class_num, false)) { //This will raise an error //'Access denied' is the message which will be thrown //by the JS AJAX handler e_jshelper::sendAjaxError('403', 'Access denied. ' . UCSLAN_90); } elseif ($sql->db_Select('userclass_classes', '*', "userclass_id='" . $class_num . "' ")) { $row = $sql->db_Fetch(MYSQL_ASSOC); //Response action - reset all group checkboxes $jshelper->addResponseAction('reset-checked', array('group_classes_select' => '0')); //it's grouped userclass if ($row['userclass_type'] == UC_TYPE_GROUP) { //Response action - show group, hide standard $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);