CC-4895: Remove all json die() statements from code
- removed json_encode
This commit is contained in:
parent
7bc4151741
commit
525b2dcb33
15 changed files with 43 additions and 51 deletions
|
@ -411,7 +411,9 @@ class ApiController extends Zend_Controller_Action
|
|||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, $fileName, $tempFileName);
|
||||
|
||||
if (!is_null($result)) {
|
||||
$this->_helper->json->sendJson('{"jsonrpc" : "2.0", "error" : {"code": '.$result['code'].', "message" : "'.$result['message'].'"}}');
|
||||
$this->_helper->json->sendJson(
|
||||
array("jsonrpc" => "2.0", "error" => array("code" => $result['code'], "message" => $result['message']))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -600,7 +602,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$response['key'] = $k;
|
||||
array_push($responses, $response);
|
||||
}
|
||||
$this->_helper->json->sendJson( json_encode($responses) );
|
||||
$this->_helper->json->sendJson($responses);
|
||||
}
|
||||
|
||||
public function listAllFilesAction()
|
||||
|
|
|
@ -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);
|
||||
$this->_helper->json->sendJson(json_encode($data));
|
||||
$this->_helper->json->sendJson($data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
if (!$p_isJson) {
|
||||
$this->createFullResponse(null);
|
||||
} else {
|
||||
$this->_helper->json->sendJson(json_encode(array("error"=>$this->view->error, "result"=>1, "html"=>$this->createFullResponse(null, $p_isJson))));
|
||||
$this->_helper->json->sendJson(array("error"=>$this->view->error, "result"=>1, "html"=>$this->createFullResponse(null, $p_isJson)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
}
|
||||
|
||||
$result["modified"] = $this->view->modified;
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
$this->_helper->json->sendJson($result);
|
||||
}
|
||||
|
||||
public function smartBlockGenerateAction()
|
||||
|
@ -525,7 +525,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$form->startForm($params['obj_id']);
|
||||
if ($form->isValid($params)) {
|
||||
$result = $bl->generateSmartBlock($params['data']);
|
||||
$this->_helper->json->sendJson(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true))));
|
||||
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true, true)));
|
||||
} else {
|
||||
$this->view->obj = $bl;
|
||||
$this->view->id = $bl->getId();
|
||||
|
@ -533,7 +533,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$viewPath = 'playlist/smart-block.phtml';
|
||||
$result['html'] = $this->view->render($viewPath);
|
||||
$result['result'] = 1;
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
$this->_helper->json->sendJson($result);
|
||||
}
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
|
@ -552,9 +552,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$result = $bl->shuffleSmartBlock();
|
||||
|
||||
if ($result['result'] == 0) {
|
||||
$this->_helper->json->sendJson(json_encode(array("result"=>0, "html"=>$this->createFullResponse($bl, true))));
|
||||
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($bl, true)));
|
||||
} else {
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
$this->_helper->json->sendJson($result);
|
||||
}
|
||||
} catch (BlockNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
|
@ -572,9 +572,9 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$result = $pl->shuffle();
|
||||
|
||||
if ($result['result'] == 0) {
|
||||
$this->_helper->json->sendJson(json_encode(array("result"=>0, "html"=>$this->createFullResponse($pl, true))));
|
||||
$this->_helper->json->sendJson(array("result"=>0, "html"=>$this->createFullResponse($pl, true)));
|
||||
} else {
|
||||
$this->_helper->json->sendJson(json_encode($result));
|
||||
$this->_helper->json->sendJson($result);
|
||||
}
|
||||
} catch (PlaylistNotFoundException $e) {
|
||||
$this->playlistNotFound('block', true);
|
||||
|
@ -595,7 +595,7 @@ class PlaylistController extends Zend_Controller_Action
|
|||
$out = $bl->getCriteria();
|
||||
$out['isStatic'] = false;
|
||||
}
|
||||
$this->_helper->json->sendJson(json_encode($out));
|
||||
$this->_helper->json->sendJson($out);
|
||||
}
|
||||
}
|
||||
class WrongTypeToBlockException extends Exception {}
|
||||
|
|
|
@ -43,8 +43,8 @@ class PluploadController extends Zend_Controller_Action
|
|||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir,
|
||||
$filename, $tempname);
|
||||
if (!is_null($result))
|
||||
$this->_helper->json->sendJson('{"jsonrpc" : "2.0", "error" : '.json_encode($result).'}');
|
||||
$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "error" => $result));
|
||||
|
||||
$this->_helper->json->sendJson('{"jsonrpc" : "2.0"}');
|
||||
$this->_helper->json->sendJson(array("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;
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml'))));
|
||||
$this->_helper->json->sendJson(array("valid"=>"true", "html"=>$this->view->render('preference/index.phtml')));
|
||||
} else {
|
||||
$this->view->form = $form;
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml'))));
|
||||
$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/index.phtml')));
|
||||
}
|
||||
}
|
||||
$this->view->form = $form;
|
||||
|
@ -323,19 +323,19 @@ 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>";
|
||||
$this->_helper->json->sendJson(json_encode(array(
|
||||
$this->_helper->json->sendJson(array(
|
||||
"valid"=>"true",
|
||||
"html"=>$this->view->render('preference/stream-setting.phtml'),
|
||||
"s1_set_admin_pass"=>$s1_set_admin_pass,
|
||||
"s2_set_admin_pass"=>$s2_set_admin_pass,
|
||||
"s3_set_admin_pass"=>$s3_set_admin_pass,
|
||||
)));
|
||||
));
|
||||
} else {
|
||||
$live_stream_subform->updateVariables();
|
||||
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
|
||||
$this->view->form = $form;
|
||||
$this->view->num_stream = $num_of_stream;
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('preference/stream-setting.phtml'))));
|
||||
$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('preference/stream-setting.phtml')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
if (Application_Model_Preference::GetImportTimestamp()+10 > $now) {
|
||||
$res = true;
|
||||
}
|
||||
$this->_helper->json->sendJson(json_encode($res));
|
||||
$this->_helper->json->sendJson($res);
|
||||
}
|
||||
|
||||
public function getLiquidsoapStatusAction()
|
||||
|
@ -456,7 +456,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
}
|
||||
$out[] = array("id"=>$i, "status"=>$status);
|
||||
}
|
||||
$this->_helper->json->sendJson(json_encode($out));
|
||||
$this->_helper->json->sendJson($out);
|
||||
}
|
||||
|
||||
public function setSourceConnectionUrlAction()
|
||||
|
@ -479,6 +479,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
public function getAdminPasswordStatusAction()
|
||||
{
|
||||
Logging::info("11111111111");
|
||||
$out = array();
|
||||
for ($i=1; $i<=3; $i++) {
|
||||
if (Application_Model_StreamSetting::getAdminPass('s'.$i)=='') {
|
||||
|
@ -487,6 +488,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$out["s".$i] = true;
|
||||
}
|
||||
}
|
||||
$this->_helper->json->sendJson(json_encode($out));
|
||||
$this->_helper->json->sendJson($out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -925,7 +925,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
'title' => _('Download'));
|
||||
|
||||
//returns format jjmenu is looking for.
|
||||
$this->_helper->json->sendJson(json_encode($menu));
|
||||
$this->_helper->json->sendJson($menu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -983,6 +983,6 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
$schedId = $this->_getParam('schedId');
|
||||
$redrawLibTable = Application_Model_StoredFile::setIsScheduled($schedId, false);
|
||||
$this->_helper->json->sendJson(json_encode(array("redrawLibTable" => $redrawLibTable)));
|
||||
$this->_helper->json->sendJson(array("redrawLibTable" => $redrawLibTable));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>";
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(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>";
|
||||
}
|
||||
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"true", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(array("valid"=>"true", "html"=>$this->view->render('user/add-user.phtml')));
|
||||
} else {
|
||||
$this->view->form = $form;
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml')));
|
||||
}
|
||||
} else {
|
||||
$this->view->form = $form;
|
||||
$this->_helper->json->sendJson(json_encode(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml'))));
|
||||
$this->_helper->json->sendJson(array("valid"=>"false", "html"=>$this->view->render('user/add-user.phtml')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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>";
|
||||
$this->_helper->json->sendJson(json_encode(array("html"=>$this->view->render('user/edit-user.phtml'))));
|
||||
$this->_helper->json->sendJson(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…
Add table
Add a link
Reference in a new issue