Example #1
0
 protected function changeObject()
 {
     $old_hp = isset($this->cur_prop['is_home_page']) ? $this->cur_prop['is_home_page'] : false;
     $ret = parent::changeObject();
     if ($ret !== false) {
         $this->saveRight();
         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($old_hp);
             $sql = 'UPDATE <<pages>> SET ' . $fields . ' WHERE p_obj_id = "' . $this->id . '";';
             if (db::q($sql) !== false) {
                 $ret = $this->id;
                 searchIndex::autoIndex($this);
                 system::revue($this, 'Изменил данные страницы', info);
             } else {
                 $ret = false;
                 system::revue($this, 'Произошла ошибка при изменении данных страницы', error);
             }
         }
     }
     return $ret;
 }