/**
  * move image to album (via ajax)
  */
 public function moveimageAction()
 {
     $Images = new Application_Model_Images();
     $Albums = new Application_Model_Albums();
     $current_user = Zend_Auth::getInstance()->getIdentity();
     $request = $this->getRequest();
     $image_id = $request->getParam('resource_id');
     $album_id = $request->getParam('album_id');
     // do some basic checks
     if (!$image_id || !$album_id) {
         $this->getHelper('json')->sendJson(false);
     }
     // see if this is a delete
     if ($album_id == 'trash') {
         $ret = $Images->deleteImage($image_id, 'posts');
         $this->getHelper('json')->sendJson($ret);
         return;
     }
     // see if this is "set as profile picture"
     if ($album_id == 'avatar' || $album_id == 'cover') {
         $image = $Images->getImage($image_id);
         $file_name = $image['data']['file_name'];
         $tmp_file_name = 'setas_' . $file_name;
         $Storage = new Application_Model_Storage();
         $StorageAdapter = $Storage->getAdapter();
         $StorageAdapter->getFileFromStorage($file_name, $tmp_file_name, 'posts');
         // save params to session and redirect to edit page
         $session = new Zend_Session_Namespace('Default');
         $pass_params = array('tmp_image' => $tmp_file_name, 'image_type' => $album_id, 'callback' => '', 'profile_name' => $current_user->name);
         $session->pass_params = $pass_params;
         $this->getHelper('json')->sendJson(true);
         return;
     }
     $album = $Albums->getAlbum($album_id);
     // see if this album belongs to the current user
     if (!isset($album['user_id']) || $album['user_id'] != $current_user->id) {
         $this->getHelper('json')->sendJson(false);
     }
     $ret = $Images->updateField($image_id, 'album_id', $album_id);
     if ($album['name']) {
         $ret = $album['name'];
     }
     $this->getHelper('json')->sendJson($ret);
 }
 /**
  * Update reported resource (via ajax)
  */
 public function updatereportedAction()
 {
     $report_id = (int) $this->getRequest()->getParam('report_id');
     $mark_reported = (int) $this->getRequest()->getParam('mark_reported');
     $Reports = new Application_Model_Reports();
     $report = $Reports->getReport($report_id);
     $ret = false;
     if ($mark_reported == 1) {
         switch ($report['resource_type']) {
             case 'post':
                 // posts
                 $Posts = new Application_Model_Posts();
                 $ret = $Posts->markHidden($report['resource_id']);
                 break;
             case 'user':
             case 'group':
             case 'page':
                 // profiles
                 $Profiles = new Application_Model_Profiles();
                 $ret = $Profiles->markHidden($report['resource_id']);
                 break;
             case 'message':
                 // messages
                 $Messages = new Application_Model_Messages();
                 $ret = $Messages->markHidden($report['resource_id']);
                 break;
             case 'comment':
                 // comments
                 $Comments = new Application_Model_Comments();
                 $ret = $Comments->deleteComment($report['resource_id']);
                 break;
             case 'image':
                 // images
                 $Images = new Application_Model_Images();
                 $ret = $Images->deleteImage($report['resource_id'], 'posts');
                 $Reports->clearReports($report['resource_id'], 'image');
                 break;
             default:
                 break;
         }
     }
     $Reports->updateReport($report_id, $mark_reported);
     $this->getHelper('json')->sendJson($ret);
 }