/** * Register SEO data * * @access private * @param array $_post _POST array * @return void */ private function reg_seo($_post) { $msg = null; // check permissions $msg = AdmUtils_helper::chk_priv_level($_SESSION['xuid'], 'pages', $_post['id'], 2); if (is_null($msg)) { // get object $mod = new Page_model('', '', $_post['id']); $page = $mod->get_by_id($_post['id'], 'pages', 'id_area, lang, url, xfrom'); // this pages cannot be changed $no_change = array('home', 'msg', 'search'); // remove slash from url if ($page->id_area > 1) { $_post['url'] = str_replace('/', '-', $_post['url']); } // handle _post $post = array('url' => !in_array($page->url, $no_change) ? X4Utils_helper::unspace($_post['url']) : $page->url, 'name' => $_post['name'], 'title' => $_post['title'], 'description' => $_post['description'], 'xfrom' => !in_array($page->url, $no_change) ? $_post['xfrom'] : $page->xfrom, 'hidden' => intval(isset($_post['hidden'])), 'xkeys' => $_post['xkeys'], 'robot' => $_post['robot'], 'redirect_code' => $_post['redirect_code'], 'redirect' => $_post['redirect'], 'tpl' => $_post['tpl']); // check if a page with the same URL already exists $check = (bool) $mod->exists($post['url'], $_post['id']); if ($check) { $msg = AdmUtils_helper::set_msg(false, '', $this->dict->get_word('_PAGE_ALREADY_EXISTS', 'msg')); } else { // set css for the page $tmod = new Template_model(); $css = $tmod->get_css($page->id_area, $_post['tpl']); $post['css'] = $css; // update page data $result = $mod->update_page($_post['id'], $post, $this->site->site->domain); if (APC) { apc_clear_cache(); apc_clear_cache('user'); apc_clear_cache('opcode'); } // set message $msg = AdmUtils_helper::set_msg($result); // set what update if ($result[1]) { $msg->update[] = array('element' => 'topic', 'url' => BASE_URL . 'pages/index/' . $page->id_area . '/' . $page->lang . '/' . str_replace('/', '-', $page->xfrom) . '/0/', 'title' => null); } } } $this->response($msg); }