public function restore() { $restore = parent::restore(); if ($restore) { $parent_id = $this->getParentId(); $s = empty($this->id) ? '' : 'p_obj_id <> "' . $this->id . '" and '; $s .= empty($parent_id) ? 'r_parent_id is NULL' : 'r_parent_id = "' . $parent_id . '"'; $sql = 'SELECT count(p_obj_id) FROM <<pages>>, <<objects>>, <<rels>> WHERE pseudo_url = "' . $this->__get('pseudo_url') . '" and lang_id = "' . languages::curId() . '" and domain_id = "' . domains::curId() . '" and r_children_id = p_obj_id and ' . $s . ' and o_id = p_obj_id and o_to_trash = 0;'; $count = db::q($sql, value); if ($count > 0) { $pseudo_url = $this->__get('pseudo_url') . rand(100, 999); db::q('UPDATE <<pages>> SET pseudo_url="' . $pseudo_url . '" WHERE p_obj_id = "' . $this->id . '";'); return true; } } return false; }