CC-4090: Make code style PSR compliant - part 4

-controllers dir
This commit is contained in:
Martin Konecny 2012-08-29 10:54:36 -04:00
parent b2327472e8
commit 699a49a103
6 changed files with 104 additions and 112 deletions

View File

@ -378,7 +378,6 @@ class ApiController extends Zend_Controller_Action
Application_Common_DateHelper::ConvertToUtcDateTime($end_timestamp, date_default_timezone_get()),
$excludeInstance = null, $onlyRecord = true);
$this->view->is_recording = false;
$this->view->server_timezone = Application_Model_Preference::GetTimezone();
@ -482,35 +481,32 @@ class ApiController extends Zend_Controller_Action
$file->setFileExistsFlag(true);
$file->setMetadata($md);
}
}
else if ($mode == "modify") {
} elseif ($mode == "modify") {
$filepath = $md['MDATA_KEY_FILEPATH'];
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
//File is not in database anymore.
if (is_null($file)) {
$return_hash['error'] = "File does not exist in Airtime.";
return $return_hash;
}
//Updating a metadata change.
else {
$file->setMetadata($md);
}
}
else if ($mode == "moved") {
} elseif ($mode == "moved") {
$md5 = $md['MDATA_KEY_MD5'];
$file = Application_Model_StoredFile::RecallByMd5($md5);
if (is_null($file)) {
return "File doesn't exist in Airtime.";
}
else {
} else {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$file->setFilePath($filepath);
}
}
else if ($mode == "delete") {
} elseif ($mode == "delete") {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$file = Application_Model_StoredFile::RecallByFilepath($filepath);
@ -519,13 +515,12 @@ class ApiController extends Zend_Controller_Action
$return_hash['error'] = "File doesn't exist in Airtime.";
Logging::warn("Attempt to delete file that doesn't exist.
Path: '$filepath'");
return $return_hash;
}
else {
} else {
$file->deleteByMediaMonitor();
}
}
else if ($mode == "delete_dir") {
} elseif ($mode == "delete_dir") {
$filepath = $md['MDATA_KEY_FILEPATH'];
//$filepath = str_replace("\\", "", $filepath);
$files = Application_Model_StoredFile::RecallByPartialFilepath($filepath);
@ -534,9 +529,11 @@ class ApiController extends Zend_Controller_Action
$file->deleteByMediaMonitor();
}
$return_hash['success'] = 1;
return $return_hash;
}
$return_hash['fileid'] = $file->getId();
return $return_hash;
}

View File

@ -29,7 +29,6 @@ class AudiopreviewController extends Zend_Controller_Action
$request = $this->getRequest();
$baseUrl = $request->getBaseUrl();
$baseDir = dirname($_SERVER['SCRIPT_FILENAME']);
$this->view->headScript()->appendFile(
@ -219,6 +218,7 @@ class AudiopreviewController extends Zend_Controller_Action
} else {
$elementMap['uri'] = $track['path'];
}
return $elementMap;
}

View File

@ -143,7 +143,6 @@ class LibraryController extends Zend_Controller_Action
}
}
public function contextMenuAction()
{
$id = $this->_getParam('id');
@ -296,10 +295,10 @@ class LibraryController extends Zend_Controller_Action
Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
} catch (PlaylistNoPermissionException $e) {
$this->view->message = "You don't have permission to delete selected items.";
return;
}
try {
Application_Model_Block::deleteBlocks($blocks, $user->getId());
} catch (Exception $e) {

View File

@ -48,7 +48,6 @@ class PlaylistController extends Zend_Controller_Action
return $obj;
}
private function createUpdateResponse($obj)
{
$formatter = new LengthFormatter($obj->getLength());
@ -205,7 +204,6 @@ class PlaylistController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
try {
@ -274,17 +272,13 @@ class PlaylistController extends Zend_Controller_Action
$this->playlistOutdated($e);
} catch (PlaylistNotFoundException $e) {
$this->playlistNotFound($obj_type);
}
catch (WrongTypeToBlockException $e) {
} catch (WrongTypeToBlockException $e) {
$this->wrongTypeToBlock($obj);
}
catch (WrongTypeToPlaylistException $e) {
} catch (WrongTypeToPlaylistException $e) {
$this->wrongTypeToPlaylist($obj);
}
catch (BlockDynamicException $e) {
} catch (BlockDynamicException $e) {
$this->blockDynamic($obj);
}
catch (Exception $e) {
} catch (Exception $e) {
$this->playlistUnknownError($e);
}
}

View File

@ -18,6 +18,7 @@ class WebstreamController extends Zend_Controller_Action
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
if (!$this->isAuthorized(-1)) {
header("Status: 401 Not Authorized");
return;
}
@ -63,7 +64,6 @@ class WebstreamController extends Zend_Controller_Action
throw new Exception("Missing parameter 'id'");
}
$webstream = CcWebstreamQuery::create()->findPK($id);
if ($webstream) {
Application_Model_Library::changePlaylist($id, "stream");
@ -80,6 +80,7 @@ class WebstreamController extends Zend_Controller_Action
if (!$this->isAuthorized($id)) {
header("Status: 401 Not Authorized");
return;
}
@ -135,6 +136,7 @@ class WebstreamController extends Zend_Controller_Action
if (!$this->isAuthorized($id)) {
header("Status: 401 Not Authorized");
return;
}