예제 #1
0
 public function __construct(array $options = null)
 {
     parent::__construct();
     $this->last_id = 0;
     if (is_array($options)) {
         return $this->create($options);
     }
     return true;
 }
예제 #2
0
 public static function delete($fname)
 {
     self::findBy("name='{$fname}'");
     if (get_called_class() == 'Flat') {
         $flat = new Flat();
         $flat->getFull($this->object_id);
         $photo_flat_path = $flat->getPhotoPath();
         unlink($photo_flat_path . $fname);
         unlink($photo_flat_path . $fname . '_prev');
     }
     parent::delete("name='{$fname}'");
 }
예제 #3
0
파일: User.php 프로젝트: alex731/m12private
 public function __construct(array $options = null)
 {
     parent::__construct($options);
 }
예제 #4
0
 public function update($values, $prefix = '')
 {
     $id = $this->id;
     $options = array();
     $called_class = get_called_class();
     foreach ($called_class::$_properties as $k => $v) {
         if (isset($values[$prefix . $k]) && $values[$prefix . $k] !== '') {
             if ($v['type'] == 'int') {
                 $values[$prefix . $k] = str_replace(',', '.', $values[$prefix . $k]);
                 $values[$prefix . $k] = str_replace(' ', '', $values[$prefix . $k]);
                 $options[$k] = $values[$prefix . $k];
             } else {
                 $options[$k] = htmlspecialchars($values[$prefix . $k], ENT_NOQUOTES, 'UTF-8');
             }
         } elseif (isset($v['type']) && $v['type'] == 'bool' && !isset($values[$prefix . $k])) {
             $options[$k] = 0;
         }
     }
     // если пользователь гость и объявление подавалось через агенство - уберем is_owner
     if (User::isGuest() && $this->user_id > 0 && !isset($_SESSION['admin'])) {
         $options['is_owner'] = 0;
     }
     parent::update($id, $options);
     $this->_vals['id'] = $id;
 }