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}'"); }
function apply($s) { $id = intval($_REQUEST['id']); if (isset($_SESSION['user_id'])) { $flat = new Flat(); $flat->getFull($id); if ($flat->user_id!=$_SESSION['user_id']) { header("Location: /index.html"); exit(); } } else if ($id!=$_SESSION['last_flat_id']) { header("Location: /index.html"); exit(); } $flat = new Flat(); $status = ($_GET['status']!=REALTY_STATUS_RENT_APPLY) ? REALTY_STATUS_APPLY : REALTY_STATUS_RENT_APPLY; $user_cond = (isset($_SESSION['user_id'])) ? ' AND user_id='.$_SESSION['user_id'] : ''; $flat->updateBy("id=$id".$user_cond,array('status'=>$status)); $block_html = Html::getBlock('Сообщение',"Ваше объявление отправлено на проверку администратором."); $s->assign("block_html",$block_html); $s->display("msg.tpl"); }