diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 1b47a924c..198d96351 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -53,7 +53,7 @@ class ApiController extends Zend_Controller_Action if (!in_array($api_key, $CC_CONFIG["apiKey"]) && is_null(Zend_Auth::getInstance()->getStorage()->read())) { header('HTTP/1.0 401 Unauthorized'); - print 'You are not allowed to access this resource.'; + print _('You are not allowed to access this resource.'); exit; } } @@ -80,7 +80,7 @@ class ApiController extends Zend_Controller_Action if (is_null(Zend_Auth::getInstance()->getStorage()->read())) { header('HTTP/1.0 401 Unauthorized'); - print 'You are not allowed to access this resource.'; + print _('You are not allowed to access this resource.'); return; } @@ -282,7 +282,7 @@ class ApiController extends Zend_Controller_Action echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); } else { header('HTTP/1.0 401 Unauthorized'); - print 'You are not allowed to access this resource. '; + print _('You are not allowed to access this resource. '); exit; } } @@ -321,7 +321,7 @@ class ApiController extends Zend_Controller_Action echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result); } else { header('HTTP/1.0 401 Unauthorized'); - print 'You are not allowed to access this resource. '; + print _('You are not allowed to access this resource. '); exit; } } @@ -502,7 +502,7 @@ class ApiController extends Zend_Controller_Action //File is not in database anymore. if (is_null($file)) { - $return_hash['error'] = "File does not exist in Airtime."; + $return_hash['error'] = _("File does not exist in Airtime."); return $return_hash; } @@ -515,7 +515,7 @@ class ApiController extends Zend_Controller_Action $md['MDATA_KEY_ORIGINAL_PATH']); if (is_null($file)) { - $return_hash['error'] = 'File does not exist in Airtime'; + $return_hash['error'] = _('File does not exist in Airtime'); } else { $filepath = $md['MDATA_KEY_FILEPATH']; //$filepath = str_replace("\\", "", $filepath); @@ -527,7 +527,7 @@ class ApiController extends Zend_Controller_Action $file = Application_Model_StoredFile::RecallByFilepath($filepath); if (is_null($file)) { - $return_hash['error'] = "File doesn't exist in Airtime."; + $return_hash['error'] = _("File doesn't exist in Airtime."); Logging::warn("Attempt to delete file that doesn't exist. Path: '$filepath'"); @@ -573,7 +573,7 @@ class ApiController extends Zend_Controller_Action Logging::info("Received bad request(key=$k), no 'mode' parameter. Bad request is:"); Logging::info( $info_json ); array_push( $responses, array( - 'error' => "Bad request. no 'mode' parameter passed.", + 'error' => _("Bad request. no 'mode' parameter passed."), 'key' => $k)); continue; } elseif ( !in_array($info_json['mode'], $valid_modes) ) { @@ -583,7 +583,7 @@ class ApiController extends Zend_Controller_Action Logging::info("Received bad request(key=$k). 'mode' parameter was invalid with value: '$mode'. Request:"); Logging::info( $info_json ); array_push( $responses, array( - 'error' => "Bad request. 'mode' parameter is invalid", + 'error' => _("Bad request. 'mode' parameter is invalid"), 'key' => $k, 'mode' => $mode ) ); continue; diff --git a/airtime_mvc/application/controllers/AudiopreviewController.php b/airtime_mvc/application/controllers/AudiopreviewController.php index afd413631..3adf3351c 100644 --- a/airtime_mvc/application/controllers/AudiopreviewController.php +++ b/airtime_mvc/application/controllers/AudiopreviewController.php @@ -210,7 +210,7 @@ class AudiopreviewController extends Zend_Controller_Action throw new Exception("Unknown file type: $mime"); } - $elementMap['uri'] = "/api/get-media/file/".$track['item_id']; + $elementMap['uri'] = $baseUrl."/api/get-media/file/".$track['item_id']; } else { $elementMap['uri'] = $track['path']; } diff --git a/airtime_mvc/application/controllers/DashboardController.php b/airtime_mvc/application/controllers/DashboardController.php index 1e693b08f..fe0a0e71c 100644 --- a/airtime_mvc/application/controllers/DashboardController.php +++ b/airtime_mvc/application/controllers/DashboardController.php @@ -33,9 +33,9 @@ class DashboardController extends Zend_Controller_Action Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data); } else { if ($source_connected) { - $this->view->error = "You don't have permission to disconnect source."; + $this->view->error = _("You don't have permission to disconnect source."); } else { - $this->view->error = "There is no source connected to this input."; + $this->view->error = _("There is no source connected to this input."); } } } @@ -79,12 +79,12 @@ class DashboardController extends Zend_Controller_Action } } else { if ($source_connected) { - $this->view->error = "You don't have permission to switch source."; + $this->view->error = _("You don't have permission to switch source."); } else { if ($sourcename == 'scheduled_play') { - $this->view->error = "You don't have permission to disconnect source."; + $this->view->error = _("You don't have permission to disconnect source."); } else { - $this->view->error = "There is no source connected to this input."; + $this->view->error = _("There is no source connected to this input."); } } } diff --git a/airtime_mvc/application/controllers/ErrorController.php b/airtime_mvc/application/controllers/ErrorController.php index 2c1aa0b87..0a4fee725 100644 --- a/airtime_mvc/application/controllers/ErrorController.php +++ b/airtime_mvc/application/controllers/ErrorController.php @@ -14,12 +14,12 @@ class ErrorController extends Zend_Controller_Action // 404 error -- controller or action not found $this->getResponse()->setHttpResponseCode(404); - $this->view->message = 'Page not found'; + $this->view->message = _('Page not found'); break; default: // application error $this->getResponse()->setHttpResponseCode(500); - $this->view->message = 'Application error'; + $this->view->message = _('Application error'); break; } diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 2e00a4208..f484388da 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -90,7 +90,7 @@ class LibraryController extends Zend_Controller_Action protected function playlistNotFound($p_type) { - $this->view->error = "$p_type not found"; + $this->view->error = sprintf(_("%s not found"), $p_type); Logging::info("$p_type not found"); Application_Model_Library::changePlaylist(null, $p_type); @@ -99,7 +99,7 @@ class LibraryController extends Zend_Controller_Action protected function playlistUnknownError($e) { - $this->view->error = "Something went wrong."; + $this->view->error = _("Something went wrong."); Logging::info($e->getMessage()); } @@ -156,7 +156,7 @@ class LibraryController extends Zend_Controller_Action $user = new Application_Model_User($userInfo->id); //Open a jPlayer window and play the audio clip. - $menu["play"] = array("name"=> "Preview", "icon" => "play", "disabled" => false); + $menu["play"] = array("name"=> _("Preview"), "icon" => "play", "disabled" => false); $isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)); @@ -177,19 +177,19 @@ class LibraryController extends Zend_Controller_Action } if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($obj_sess->type === "playlist") { - $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy"); } elseif ($obj_sess->type === "block" && $obj->isStatic()) { - $menu["pl_add"] = array("name"=> "Add to Smart Block", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Smart Block"), "icon" => "add-playlist", "icon" => "copy"); } } } if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) { - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete"); - $menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}"); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/library/delete"); + $menu["edit"] = array("name"=> _("Edit Metadata"), "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}"); } $url = $file->getRelativeFileUrl($baseUrl).'/download/true'; - $menu["download"] = array("name" => "Download", "icon" => "download", "url" => $url); + $menu["download"] = array("name" => _("Download"), "icon" => "download", "url" => $url); } elseif ($type === "playlist" || $type === "block") { if ($type === 'playlist') { $obj = new Application_Model_Playlist($id); @@ -200,19 +200,19 @@ class LibraryController extends Zend_Controller_Action } if (($isAdminOrPM || $obj->getCreatorId() == $user->getId()) && $screen == "playlist") { if ($obj_sess->type === "playlist") { - $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy"); } } } if ($obj_sess->id !== $id && $screen == "playlist") { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { - $menu["edit"] = array("name"=> "Edit", "icon" => "edit"); + $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit"); } } if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete"); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/library/delete"); } } elseif ($type == "stream") { @@ -221,15 +221,15 @@ class LibraryController extends Zend_Controller_Action if (isset($obj_sess->id) && $screen == "playlist") { if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($obj_sess->type === "playlist") { - $menu["pl_add"] = array("name"=> "Add to Playlist", "icon" => "add-playlist", "icon" => "copy"); + $menu["pl_add"] = array("name"=> _("Add to Playlist"), "icon" => "add-playlist", "icon" => "copy"); } } } if ($isAdminOrPM || $obj->getCreatorId() == $user->getId()) { if ($screen == "playlist") { - $menu["edit"] = array("name"=> "Edit", "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}"); + $menu["edit"] = array("name"=> _("Edit"), "icon" => "edit", "url" => $baseUrl."/library/edit-file-md/id/{$id}"); } - $menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => $baseUrl."/library/delete"); + $menu["del"] = array("name"=> _("Delete"), "icon" => "delete", "url" => $baseUrl."/library/delete"); } } @@ -240,26 +240,26 @@ class LibraryController extends Zend_Controller_Action $menu["sep1"] = "-----------"; //create a sub menu for Soundcloud actions. - $menu["soundcloud"] = array("name" => "Soundcloud", "icon" => "soundcloud", "items" => array()); + $menu["soundcloud"] = array("name" => _("Soundcloud"), "icon" => "soundcloud", "items" => array()); $scid = $file->getSoundCloudId(); if ($scid > 0) { $url = $file->getSoundCloudLinkToFile(); - $menu["soundcloud"]["items"]["view"] = array("name" => "View on Soundcloud", "icon" => "soundcloud", "url" => $url); + $menu["soundcloud"]["items"]["view"] = array("name" => _("View on Soundcloud"), "icon" => "soundcloud", "url" => $url); } if (!is_null($scid)) { - $text = "Re-upload to SoundCloud"; + $text = _("Re-upload to SoundCloud"); } else { - $text = "Upload to SoundCloud"; + $text = _("Upload to SoundCloud"); } $menu["soundcloud"]["items"]["upload"] = array("name" => $text, "icon" => "soundcloud", "url" => $baseUrl."/library/upload-file-soundcloud/id/{$id}"); } if (empty($menu)) { - $menu["noaction"] = array("name"=>"No action available"); + $menu["noaction"] = array("name"=>_("No action available")); } $this->view->items = $menu; @@ -279,7 +279,7 @@ class LibraryController extends Zend_Controller_Action $streams = array(); $message = null; - $noPermissionMsg = "You don't have permission to delete selected items."; + $noPermissionMsg = _("You don't have permission to delete selected items."); foreach ($mediaItems as $media) { @@ -328,7 +328,7 @@ class LibraryController extends Zend_Controller_Action $message = $noPermissionMsg; } catch (Exception $e) { //could throw a scheduled in future exception. - $message = "Could not delete some scheduled files."; + $message = _("Could not delete some scheduled files."); Logging::debug($e->getMessage()); } } @@ -455,10 +455,10 @@ class LibraryController extends Zend_Controller_Action $this->view->md = $md; if ($block->isStatic()) { - $this->view->blType = 'Static'; + $this->view->blType = _('Static'); $this->view->contents = $block->getContents(); } else { - $this->view->blType = 'Dynamic'; + $this->view->blType = _('Dynamic'); $this->view->contents = $block->getCriteria(); } $this->view->block = $block; diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index d4d66bf50..76be05bf4 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -31,7 +31,7 @@ class LoginController extends Zend_Controller_Action $form = new Application_Form_Login(); - $message = "Please enter your user name and password"; + $message = _("Please enter your user name and password"); if ($request->isPost()) { // if the post contains recaptcha field, which means form had recaptcha field. @@ -70,7 +70,7 @@ class LoginController extends Zend_Controller_Action $this->_redirect('Showbuilder'); } else { - $message = "Wrong username or password provided. Please try again."; + $message = _("Wrong username or password provided. Please try again."); Application_Model_Subjects::increaseLoginAttempts($username); Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']); $form = new Application_Form_Login(); @@ -132,10 +132,10 @@ class LoginController extends Zend_Controller_Action if ($success) { $this->_helper->redirector('password-restore-after', 'login'); } else { - $form->email->addError($this->view->translate("Email could not be sent. Check your mail server settings and ensure it has been configured properly.")); + $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); } } else { - $form->email->addError($this->view->translate("Given email not found.")); + $form->email->addError($this->view->translate(_("Given email not found."))); } } diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 7283bba48..19c2756e7 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -42,7 +42,7 @@ class PlaylistController extends Zend_Controller_Action $modified = $this->_getParam('modified', null); if ($obj->getLastModified("U") !== $modified) { $this->createFullResponse($obj); - throw new PlaylistOutDatedException("You are viewing an older version of {$obj->getName()}"); + throw new PlaylistOutDatedException(sprintf(_("You are viewing an older version of %s"), $obj->getName())); } } @@ -117,14 +117,14 @@ class PlaylistController extends Zend_Controller_Action private function blockDynamic($obj) { - $this->view->error = "You cannot add tracks to dynamic blocks."; + $this->view->error = _("You cannot add tracks to dynamic blocks."); $this->createFullResponse($obj); } private function playlistNotFound($p_type, $p_isJson = false) { $p_type = ucfirst($p_type); - $this->view->error = "{$p_type} not found"; + $this->view->error = sprintf(_("%s not found"), $p_type); Logging::info("{$p_type} not found"); Application_Model_Library::changePlaylist(null, $p_type); @@ -138,26 +138,26 @@ class PlaylistController extends Zend_Controller_Action private function playlistNoPermission($p_type) { - $this->view->error = "You don't have permission to delete selected {$p_type}(s)."; + $this->view->error = sprintf(_("You don't have permission to delete selected %s(s)."), $p_type); $this->changePlaylist(null, $p_type); $this->createFullResponse(null); } private function playlistUnknownError($e) { - $this->view->error = "Something went wrong."; + $this->view->error = _("Something went wrong."); Logging::info($e->getMessage()); } private function wrongTypeToBlock($obj) { - $this->view->error = "You can only add tracks to smart block."; + $this->view->error = _("You can only add tracks to smart block."); $this->createFullResponse($obj); } private function wrongTypeToPlaylist($obj) { - $this->view->error = "You can only add tracks, smart blocks, and webstreams to playlists."; + $this->view->error = _("You can only add tracks, smart blocks, and webstreams to playlists."); $this->createFullResponse($obj); } @@ -169,9 +169,9 @@ class PlaylistController extends Zend_Controller_Action $objInfo = Application_Model_Library::getObjInfo($type); - $name = 'Untitled Playlist'; + $name = _('Untitled Playlist'); if ($type == 'block') { - $name = 'Untitled Smart Block'; + $name = _('Untitled Smart Block'); } $obj = new $objInfo['className'](); @@ -434,7 +434,7 @@ class PlaylistController extends Zend_Controller_Action public function setPlaylistNameDescAction() { - $name = $this->_getParam('name', 'Unknown Playlist'); + $name = $this->_getParam('name', _('Unknown Playlist')); $description = $this->_getParam('description', ""); $type = $this->_getParam('type'); diff --git a/airtime_mvc/application/controllers/PreferenceController.php b/airtime_mvc/application/controllers/PreferenceController.php index 73856775a..d0d8ba89a 100644 --- a/airtime_mvc/application/controllers/PreferenceController.php +++ b/airtime_mvc/application/controllers/PreferenceController.php @@ -66,7 +66,7 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]); Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]); - $this->view->statusMsg = "