/** * Register the site configuration * * @access private * @param array $_post _POST array * @return void */ private function configure($_post) { $msg = null; // check permission $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'sites', $_post['id'], 3); if (is_null($msg)) { // get parameters before update $params = $this->site->get_param($_post['id']); // build update array $sql = array(); foreach ($params as $i) { // handle _post switch ($i->xtype) { case '0|1': $val = intval(isset($_post[$i->name])); break; case 'IMG': $val = $_post[$i->name]; break; default: $val = $_post[$i->name]; break; } // if the new value is different then update if ($val != $i->xvalue) { $sql[$i->id] = $val; } } // do update $plugin = new X4Plugin_model(); $result = $plugin->update_param($sql); APC && apc_delete(SITE . 'param' . $_post['id']); // set message $msg = AdmUtils_helper::set_msg($result); // set what update if ($result[1]) { $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'sites/show/1', 'title' => null); } } $this->response($msg); }
/** * Register Plugin configuration * * @access private * @param object $plugin plugin * @param array $_post _POST array * @return void */ private function configure($plugin, $_post) { $msg = null; // check permission $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'modules', $_post['id'], 3); if (is_null($msg)) { // get parama $mod = new X4Plugin_model(); $params = $mod->get_param($_post['xrif'], $_post['id_area']); // build queries $sql = array(); foreach ($params as $i) { // handle type switch ($i->xtype) { case 'HIDDEN': // do nothing break; case '0|1': case 'BOOLEAN': $val = intval(isset($_post[$i->name])); break; case 'IMG': // when, a day, X3 CMS will handle IMG parameters $val = $_post[$i->name]; break; default: $val = $_post[$i->name]; break; } // if new value is different from old value if ($val != $i->xvalue && $i->xtype != 'HIDDEN') { $sql[$i->id] = $val; } } // update params $result = $mod->update_param($sql); APC && apc_delete(SITE . 'mod_param' . $plugin->name . $plugin->id_area); // set message $msg = AdmUtils_helper::set_msg($result); // set what update if ($result[1]) { $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'modules/index/' . $_post['id_area'] . '/' . $_post['xrif'], 'title' => null); } } $this->response($msg); }