Esempio n. 1
0
 public function DeleteField($id)
 {
     if (empty($id)) {
         throw new ExceptionAllError('не передан индификатор поля');
     }
     $this->_db->Delete('auto_fields', array('id' => $id));
     return $this;
 }
Esempio n. 2
0
 /**
  * Delete resume
  *
  * @param int $id
  */
 public function DeleteResume($id)
 {
     if (!$this->old_value) {
         $this->old_value = $this->dbase->SelectOne('job_resumes', array('*'), array('id' => $id));
     }
     if ($this->old_value['photo']) {
         @unlink(PHOTO_PATCH . $this->old_value['photo']);
     }
     $this->dbase->Delete('job_resumes', array('id' => $id));
 }
Esempio n. 3
0
 public function DelPhoto($auto_id, $photo_id)
 {
     if (!$photo_id) {
         return;
     }
     if (!(int) $auto_id) {
         $auto_id = 0;
     }
     $allow_del = false;
     if ($auto_id) {
         $this->old_values = $this->base->SelectOne('auto_autos', array("photo", "photo_count", "author_id"), array('id' => $auto_id));
         if (!$this->old_values) {
             return 'denied';
         }
         if (in_array($this->member['group'], $this->config['general_moderator']) || ($this->old_values['author_id'] && $this->member['id'] == $this->old_values['author_id'] || $this->old_values['guest_session'] && $this->old_values['guest_session'] == $this->guest_session) && in_array($this->member['group'], $this->config['user_int_allow_edit'])) {
             $allow_del = true;
         }
     } else {
         $allow_del = true;
     }
     if ($allow_del) {
         $photo = $this->base->SelectOne('auto_images', array("*"), array("id" => $photo_id, "auto_id" => $auto_id));
         @unlink(ROOT_DIR . "/uploads/auto_foto/" . $photo['model_id'] . "/" . $photo['image_name']);
         @unlink(ROOT_DIR . "/uploads/auto_foto/" . $photo['model_id'] . "/thumbs/" . $photo['image_name']);
         $this->base->Delete('auto_images', array('id' => $photo['id']));
         if (--$this->old_values['photo_count'] <= 0 && $auto_id) {
             $this->base->Update('auto_autos', array("photo" => 0, "photo_count" => 0), array("id" => $auto_id));
         } else {
             if ($auto_id) {
                 if ($photo_id == $this->old_values['photo']) {
                     $id = $this->base->SelectOne('auto_images', array("id"), array('auto_id' => $auto_id), array("add_date" => "DESC"));
                     if (!$id['id']) {
                         $id['id'] = 0;
                     }
                     $this->base->Update('auto_autos', array("photo" => $id['id'], "photo_count" => $this->old_values['photo_count']), array("id" => $auto_id));
                 } else {
                     $this->base->Update('auto_autos', array("photo_count" => $this->old_values['photo_count']), array("id" => $auto_id));
                 }
             }
         }
         return "ok";
     } else {
         return 'denied';
     }
 }