diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 6bbe480da..ffbae08aa 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -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() diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index a180be814..2974d85a1 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -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() diff --git a/airtime_mvc/application/controllers/ListenerstatController.php b/airtime_mvc/application/controllers/ListenerstatController.php index 817f6ca11..f64ea8bfb 100644 --- a/airtime_mvc/application/controllers/ListenerstatController.php +++ b/airtime_mvc/application/controllers/ListenerstatController.php @@ -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)); } } diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 19c2756e7..789d4a904 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -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 {} diff --git a/airtime_mvc/application/controllers/PluploadController.php b/airtime_mvc/application/controllers/PluploadController.php index ed7403693..49b706644 100644 --- a/airtime_mvc/application/controllers/PluploadController.php +++ b/airtime_mvc/application/controllers/PluploadController.php @@ -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"}'); } } diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 269215783..af78f996a 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -70,10 +70,10 @@ class PreferenceController extends Zend_Controller_Action $this->view->statusMsg = "