function execute()
 {
     $photo_id = Request::get('photo_id');
     $photo_type = Request::get('photo_type');
     $model = new connectionUserPhotoModel();
     if (!in_array($photo_type, array_keys($model->dir))) {
         $this->notFound();
     }
     $photo = $model->getPhotoByID($photo_id);
     if (!$photo) {
         $this->notFound();
     }
     return ConnectionHelper::getPhotoDir($photo['user_id']) . $model->dir[$photo_type] . '/' . $photo['file'];
 }
 function execute()
 {
     $photo_id = (int) Request::post('photo');
     if ($photo_id == 0) {
         return false;
     }
     $model = new connectionUserPhotoModel();
     $photo = $model->getPhotoByID($photo_id);
     $user = ConnectionHelper::userLogin();
     if (!$photo || isset($photo['avatar']) && $photo['avatar'] || $photo['user_id'] != $user['id']) {
         return false;
     }
     return $model->deletePhoto($photo_id);
 }