protected function createObject() { // Проверяем, если в структуре сайта нет домашней страницы, делаем текущую таковой if (isset($this->new_prop['is_home_page']) && !$this->new_prop['is_home_page']) { $hp = db::q('SELECT p_obj_id FROM <<pages>> WHERE lang_id = "' . languages::curId() . '" and domain_id = "' . domains::curId() . '" and is_home_page = 1', value); $this->new_prop['is_home_page'] = empty($hp) ? 1 : 0; } $ret = parent::createObject(); if ($ret !== false) { $this->saveRight(true); if (isset($this->new_prop['pseudo_url']) && strlen($this->new_prop['pseudo_url']) > 80) { $this->new_prop['pseudo_url'] = $this->id; } $fields = ''; reset($this->new_prop); while (list($key, $value) = each($this->new_prop)) { if ($this->isPageField($key)) { $fields .= $this->procValue($key, $value); } } $fields = substr($fields, 0, strlen($fields) - 2); if (!empty($fields)) { $this->setHomePage(false); $fields = ', ' . $fields; $sql = 'INSERT INTO <<pages>> SET p_obj_id = "' . $this->id . '", lang_id = "' . languages::curId() . '", domain_id = "' . domains::curId() . '"' . $fields . ';'; if (db::q($sql) !== false) { $ret = $this->id; searchIndex::autoIndex($this); ormPages::clearCache(); system::revue($this, 'Добавил страницу', info); } else { $ret = false; } } } return $ret; }