CC-4895: Remove all json die() statements from code
This commit is contained in:
parent
3bc2876f27
commit
d4e89df94e
|
@ -411,7 +411,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
||||
|
||||
if (!is_null($result)) {
|
||||
die('{"jsonrpc" : "2.0", "error" : {"code": '.$result['code'].', "message" : "'.$result['message'].'"}}');
|
||||
$this->_helper->json->sendJson('{"jsonrpc" : "2.0", "error" : {"code": '.$result['code'].', "message" : "'.$result['message'].'"}}');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -600,7 +600,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$response['key'] = $k;
|
||||
array_push($responses, $response);
|
||||
}
|
||||
die( json_encode($responses) );
|
||||
$this->_helper->json->sendJson( json_encode($responses) );
|
||||
}
|
||||
|
||||
public function listAllFilesAction()
|
||||
|
|
|
@ -507,7 +507,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$id = $this->_getParam('id');
|
||||
Application_Model_Soundcloud::uploadSoundcloud($id);
|
||||
// we should die with ui info
|
||||
die();
|
||||
$this->_helper->json->sendJson(null);
|
||||
}
|
||||
|
||||
public function getUploadToSoundcloudStatusAction()
|
||||
|
|
|
@ -76,6 +76,6 @@ class ListenerstatController extends Zend_Controller_Action
|
|||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
||||
$data = Application_Model_ListenerStat::getDataPointsWithinRange($startsDT->format("Y-m-d H:i:s"), $endsDT->format("Y-m-d H:i:s"), $mountName);
|
||||
die(json_encode($data));
|
||||
$this->_helper->json->sendJson(json_encode($data));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
if (!$p_isJson) {
|
||||
$this->createFullResponse(null);
|
||||
} else {
|
||||
die(json_encode(array("error"=>$this->view->error, "result"=>1, "html"=>$this->createFullResponse(null, $p_isJson))));
|
||||
$this->_helper->json->sendJson(json_encode(array("error"=>$this->view->error, "result"=>1, "html"=>$this->createFullResponse(null, $p_isJson))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$result["modified"] = $this->view->modified;
|
||||
die(json_encode($result));
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
}
|
||||
|
||||
public function smartBlockGenerateAction()
|
||||
|
@ -504,7 +504,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$form->startForm($params['obj_id']);
|
||||
if ($form->isValid($params)) {
|
||||
$result = $bl->generateSmartBlock($params['data']);
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true))));
|
||||
$this->_helper->json->sendJson(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true))));
|
||||
} else {
|
||||
$this->view->obj = $bl;
|
||||
$this->view->id = $bl->getId();
|
||||
|
@ -512,7 +512,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$viewPath = 'playlist/smart-block.phtml';
|
||||
$result['html'] = $this->view->render($viewPath);
|
||||
$result['result'] = 1;
|
||||
die(json_encode($result));
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
}
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
|
@ -531,9 +531,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$result = $bl->shuffleSmartBlock();
|
||||
|
||||
if ($result['result'] == 0) {
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
||||
$this->_helper->json->sendJson(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
||||
} else {
|
||||
die(json_encode($result));
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
}
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
|
@ -551,9 +551,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$result = $pl->shuffle();
|
||||
|
||||
if ($result['result'] == 0) {
|
||||
die(json_encode(array("result"=>0, "html"=>$this->createFullResponse($pl, true))));
|
||||
$this->_helper->json->sendJson(json_encode(array("result"=>0, "html"=>$this->createFullResponse($pl, true))));
|
||||
} else {
|
||||
die(json_encode($result));
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
}
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
|
@ -574,7 +574,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$out = $bl->getCriteria();
|
||||
$out['isStatic'] = false;
|
||||
}
|
||||
die(json_encode($out));
|
||||
$this->_helper->json->sendJson(json_encode($out));
|
||||
}
|
||||
}
|
||||
class WrongTypeToBlockException extends Exception {}
|
||||
|
|
|
@ -32,7 +32,7 @@ class PluploadController extends Zend_Controller_Action
|
|||
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir);
|
||||
$tempFileName = basename($tempFilePath);
|
||||
|
||||
die('{"jsonrpc" : "2.0", "tempfilepath" : "'.$tempFileName.'" }');
|
||||
$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "tempfilepath" => $tempFileName));
|
||||
}
|
||||
|
||||
public function copyfileAction()
|
||||
|
@ -43,8 +43,8 @@ class PluploadController extends Zend_Controller_Action
|
|||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir,
|
||||
$filename, $tempname);
|
||||
if (!is_null($result))
|
||||
die('{"jsonrpc" : "2.0", "error" : '.json_encode($result).'}');
|
||||
$this->_helper->json->sendJson('{"jsonrpc" : "2.0", "error" : '.json_encode($result).'}');
|
||||
|
||||
die('{"jsonrpc" : "2.0"}');
|
||||
$this->_helper->json->sendJson('{"jsonrpc" : "2.0"}');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,10 +70,10 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
$this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>";
|
||||
$this->view->form = $form;
|
||||
die(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml'))));
|
||||
} else {
|
||||
$this->view->form = $form;
|
||||
die(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml'))));
|
||||
}
|
||||
}
|
||||
$this->view->form = $form;
|
||||
|
@ -322,7 +322,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->form = $form;
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->view->statusMsg = "<div class='success'>"._("Stream Setting Updated.")."</div>";
|
||||
die(json_encode(array(
|
||||
$this->_helper->json->sendJson(json_encode(array(
|
||||
"valid"=>"true",
|
||||
"html"=>$this->view->render('preference/stream-setting.phtml'),
|
||||
"s1_set_admin_pass"=>$s1_set_admin_pass,
|
||||
|
@ -334,7 +334,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||
$this->view->form = $form;
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
die(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/stream-setting.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/stream-setting.phtml'))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
ksort($result);
|
||||
//returns format serverBrowse is looking for.
|
||||
die(json_encode($result));
|
||||
$this->_helper->json->sendJson($result);
|
||||
}
|
||||
|
||||
public function changeStorDirectoryAction()
|
||||
|
@ -420,7 +420,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_RabbitMq::SendMessageToMediaMonitor('rescan_watch', $data);
|
||||
Logging::info("Unhiding all files belonging to:: $dir_path");
|
||||
$dir->unhideFiles();
|
||||
die(); # Get rid of this ugliness later
|
||||
$this->_helper->json->sendJson(null);
|
||||
}
|
||||
|
||||
public function removeWatchDirectoryAction()
|
||||
|
@ -440,7 +440,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
if (Application_Model_Preference::GetImportTimestamp()+10 > $now) {
|
||||
$res = true;
|
||||
}
|
||||
die(json_encode($res));
|
||||
$this->_helper->json->sendJson(json_encode($res));
|
||||
}
|
||||
|
||||
public function getLiquidsoapStatusAction()
|
||||
|
@ -455,7 +455,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
$out[] = array("id"=>$i, "status"=>$status);
|
||||
}
|
||||
die(json_encode($out));
|
||||
$this->_helper->json->sendJson(json_encode($out));
|
||||
}
|
||||
|
||||
public function setSourceConnectionUrlAction()
|
||||
|
@ -473,7 +473,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetLiveDjConnectionUrlOverride($override);
|
||||
}
|
||||
|
||||
die();
|
||||
$this->_helper->json->sendJson(null);
|
||||
}
|
||||
|
||||
public function getAdminPasswordStatusAction()
|
||||
|
@ -486,6 +486,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$out["s".$i] = true;
|
||||
}
|
||||
}
|
||||
die(json_encode($out));
|
||||
$this->_helper->json->sendJson(json_encode($out));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -218,7 +218,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$id = $file->getId();
|
||||
Application_Model_Soundcloud::uploadSoundcloud($id);
|
||||
// we should die with ui info
|
||||
die();
|
||||
$this->_helper->json->sendJson(null);
|
||||
}
|
||||
|
||||
public function makeContextMenuAction()
|
||||
|
@ -897,7 +897,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
'title' => _('Download'));
|
||||
|
||||
//returns format jjmenu is looking for.
|
||||
die(json_encode($menu));
|
||||
$this->_helper->json->sendJson(json_encode($menu));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ class UserController extends Zend_Controller_Action
|
|||
&& $formData['user_id'] != 0) {
|
||||
$this->view->form = $form;
|
||||
$this->view->successMessage = "<div class='errors'>"._("Specific action is not allowed in demo version!")."</div>";
|
||||
die(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
} elseif ($form->validateLogin($formData)) {
|
||||
$user = new Application_Model_User($formData['user_id']);
|
||||
if (empty($formData['user_id'])) {
|
||||
|
@ -89,14 +89,14 @@ class UserController extends Zend_Controller_Action
|
|||
$this->view->successMessage = "<div class='success'>"._("User updated successfully!")."</div>";
|
||||
}
|
||||
|
||||
die(json_encode(array("valid"=>"true", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"true", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
} else {
|
||||
$this->view->form = $form;
|
||||
die(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
}
|
||||
} else {
|
||||
$this->view->form = $form;
|
||||
die(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ class UserController extends Zend_Controller_Action
|
|||
$post = $this->getRequest()->getPost();
|
||||
$users = Application_Model_User::getUsersDataTablesInfo($post);
|
||||
|
||||
die(json_encode($users));
|
||||
$this->_helper->json->sendJson($users);
|
||||
}
|
||||
|
||||
public function getUserDataAction()
|
||||
|
@ -135,7 +135,7 @@ class UserController extends Zend_Controller_Action
|
|||
&& $formData['cu_login'] == 'admin') {
|
||||
$this->view->form = $form;
|
||||
$this->view->successMessage = "<div class='errors'>"._("Specific action is not allowed in demo version!")."</div>";
|
||||
die(json_encode(array("html"=>$this->view->render('user/edit-user.phtml'))));
|
||||
$this->_helper->json->sendJson(json_encode(array("html"=>$this->view->render('user/edit-user.phtml'))));
|
||||
} else if ($form->isValid($formData) &&
|
||||
$form->validateLogin($formData['cu_login'], $formData['cu_user_id'])) {
|
||||
$user = new Application_Model_User($formData['cu_user_id']);
|
||||
|
|
Loading…
Reference in New Issue