Use public api for getting l10n

This commit is contained in:
Robin Appelman 2014-08-31 10:05:59 +02:00
parent 23137f4798
commit d0266c0bf8
66 changed files with 97 additions and 94 deletions

View File

@ -2,7 +2,7 @@
OCP\JSON::checkLoggedIn();
\OC::$server->getSession()->close();
$l = OC_L10N::get('files');
$l = \OC::$server->getL10N('files');
// Load the files
$dir = isset($_GET['dir']) ? $_GET['dir'] : '';

View File

@ -9,7 +9,7 @@ $dir = stripslashes($_POST["dir"]);
$file = stripslashes($_POST["file"]);
$target = stripslashes(rawurldecode($_POST["target"]));
$l = OC_L10N::get('files');
$l = \OC::$server->getL10N('files');
if(\OC\Files\Filesystem::file_exists($target . '/' . $file)) {
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not move %s - File with this name already exists", array($file)) )));

View File

@ -46,7 +46,7 @@ function progress($notification_code, $severity, $message, $message_code, $bytes
}
}
$l10n = \OC_L10n::get('files');
$l10n = \OC::$server->getL10N('files');
$result = array(
'success' => false,

View File

@ -11,7 +11,7 @@ OCP\JSON::callCheck();
$dir = isset( $_POST['dir'] ) ? stripslashes($_POST['dir']) : '';
$foldername = isset( $_POST['foldername'] ) ? stripslashes($_POST['foldername']) : '';
$l10n = \OC_L10n::get('files');
$l10n = \OC::$server->getL10N('files');
$result = array(
'success' => false,

View File

@ -27,7 +27,7 @@ OCP\JSON::callCheck();
$files = new \OCA\Files\App(
\OC\Files\Filesystem::getView(),
\OC_L10n::get('files')
\OC::$server->getL10N('files')
);
$result = $files->rename(
$_GET["dir"],

View File

@ -10,7 +10,7 @@ OCP\JSON::setContentTypeHeader('text/plain');
$allowedPermissions = OCP\PERMISSION_ALL;
$errorCode = null;
$l = OC_L10N::get('files');
$l = \OC::$server->getL10N('files');
if (empty($_POST['dirToken'])) {
// The standard case, files are uploaded through logged in users :)
OCP\JSON::checkLoggedIn();

View File

@ -1,6 +1,6 @@
<?php
$l = OC_L10N::get('files');
$l = \OC::$server->getL10N('files');
OCP\App::registerAdmin('files', 'admin');

View File

@ -13,7 +13,7 @@ use OCA\Encryption;
\OCP\JSON::checkAppEnabled('files_encryption');
\OCP\JSON::callCheck();
$l = OC_L10N::get('files_encryption');
$l = \OC::$server->getL10N('files_encryption');
$return = false;
// Enable recoveryAdmin

View File

@ -15,7 +15,7 @@ use OCA\Encryption;
\OCP\JSON::checkAppEnabled('files_encryption');
\OCP\JSON::callCheck();
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
$return = false;

View File

@ -15,7 +15,7 @@ use OCA\Encryption;
\OCP\JSON::checkAppEnabled('files_encryption');
\OCP\JSON::callCheck();
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
$return = false;

View File

@ -4,7 +4,7 @@ if (!isset($_)) { //also provide standalone error page
require_once __DIR__ . '/../../../lib/base.php';
require_once __DIR__ . '/../lib/crypt.php';
$l = OC_L10N::get('files_encryption');
$l = \OC::$server->getL10N('files_encryption');
if (isset($_GET['errorCode'])) {
$errorCode = $_GET['errorCode'];

View File

@ -5,7 +5,7 @@ require_once __DIR__ . '/../3rdparty/Dropbox/autoload.php';
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l = OC_L10N::get('files_external');
$l = \OC::$server->getL10N('files_external');
if (isset($_POST['app_key']) && isset($_POST['app_secret'])) {
$oauth = new Dropbox_OAuth_Curl($_POST['app_key'], $_POST['app_secret']);

View File

@ -6,7 +6,7 @@ require_once 'Google_Client.php';
OCP\JSON::checkAppEnabled('files_external');
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l = OC_L10N::get('files_external');
$l = \OC::$server->getL10N('files_external');
if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST['redirect'])) {
$client = new Google_Client();

View File

@ -6,7 +6,7 @@
* later.
* See the COPYING-README file.
*/
$l = \OC_L10N::get('files_external');
$l = \OC::$server->getL10N('files_external');
OC::$CLASSPATH['OC\Files\Storage\StreamWrapper'] = 'files_external/lib/streamwrapper.php';
OC::$CLASSPATH['OC\Files\Storage\FTP'] = 'files_external/lib/ftp.php';

View File

@ -10,7 +10,7 @@ OCP\JSON::callCheck();
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('files_sharing');
$l = OC_L10N::get('files_sharing');
$l = \OC::$server->getL10N('files_sharing');
// check if server admin allows to mount public links from other servers
if (OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) {

View File

@ -1,5 +1,5 @@
<?php
$l = OC_L10N::get('files_sharing');
$l = \OC::$server->getL10N('files_sharing');
OC::$CLASSPATH['OC_Share_Backend_File'] = 'files_sharing/lib/share/file.php';
OC::$CLASSPATH['OC_Share_Backend_Folder'] = 'files_sharing/lib/share/folder.php';

View File

@ -55,7 +55,7 @@ if ( $error ) {
foreach ( $error as $e ) {
$filelist .= $e.', ';
}
$l = OC_L10N::get('files_trashbin');
$l = \OC::$server->getL10N('files_trashbin');
$message = $l->t("Couldn't delete %s permanently", array(rtrim($filelist, ', ')));
OCP\JSON::error(array("data" => array("message" => $message,
"success" => $success, "error" => $error)));

View File

@ -60,7 +60,7 @@ if ( $error ) {
foreach ( $error as $e ) {
$filelist .= $e.', ';
}
$l = OC_L10N::get('files_trashbin');
$l = OC::$server->getL10N('files_trashbin');
$message = $l->t("Couldn't restore %s", array(rtrim($filelist, ', ')));
OCP\JSON::error(array("data" => array("message" => $message,
"success" => $success, "error" => $error)));

View File

@ -1,5 +1,5 @@
<?php
$l = OC_L10N::get('files_trashbin');
$l = \OC::$server->getL10N('files_trashbin');
OC::$CLASSPATH['OCA\Files_Trashbin\Exceptions\CopyRecursiveException'] = 'files_trashbin/lib/exceptions.php';

View File

@ -891,7 +891,7 @@ class Trashbin {
private static function getUniqueFilename($location, $filename, $view) {
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$name = pathinfo($filename, PATHINFO_FILENAME);
$l = \OC_L10N::get('files_trashbin');
$l = \OC::$server->getL10N('files_trashbin');
// if extension is not empty we set a dot in front of it
if ($ext !== '') {

View File

@ -9,6 +9,6 @@ $revision=(int)$_GET['revision'];
if(OCA\Files_Versions\Storage::rollback( $file, $revision )) {
OCP\JSON::success(array("data" => array( "revision" => $revision, "file" => $file )));
}else{
$l = OC_L10N::get('files_versions');
$l = \OC::$server->getL10N('files_versions');
OCP\JSON::error(array("data" => array( "message" => $l->t("Could not revert: %s", array($file) ))));
}

View File

@ -30,6 +30,6 @@ $subject = $_POST['ldap_clear_mapping'];
if(\OCA\user_ldap\lib\Helper::clearMapping($subject)) {
OCP\JSON::success();
} else {
$l=OC_L10N::get('user_ldap');
$l = \OC::$server->getL10N('user_ldap');
OCP\JSON::error(array('message' => $l->t('Failed to clear the mappings.')));
}

View File

@ -30,6 +30,6 @@ $prefix = $_POST['ldap_serverconfig_chooser'];
if(\OCA\user_ldap\lib\Helper::deleteServerConfiguration($prefix)) {
OCP\JSON::success();
} else {
$l=OC_L10N::get('user_ldap');
$l = \OC::$server->getL10N('user_ldap');
OCP\JSON::error(array('message' => $l->t('Failed to delete the server configuration')));
}

View File

@ -26,7 +26,7 @@ OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$l=OC_L10N::get('user_ldap');
$l = \OC::$server->getL10N('user_ldap');
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null);

View File

@ -26,7 +26,7 @@ OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$l=OC_L10N::get('user_ldap');
$l = \OC::$server->getL10N('user_ldap');
if(!isset($_POST['action'])) {
\OCP\JSON::error(array('message' => $l->t('No action specified')));

View File

@ -53,7 +53,7 @@ class Wizard extends LDAPUtility {
parent::__construct($ldap);
$this->configuration = $configuration;
if(is_null(Wizard::$l)) {
Wizard::$l = \OC_L10N::get('user_ldap');
Wizard::$l = \OC::$server->getL10N('user_ldap');
}
$this->access = $access;
$this->result = new WizardResult;

View File

@ -46,7 +46,7 @@ $wControls = $wControls->fetchPage();
$sControls = new OCP\Template('user_ldap', 'part.settingcontrols');
$sControls = $sControls->fetchPage();
$l = \OC_L10N::get('user_ldap');
$l = \OC::$server->getL10N('user_ldap');
$wizTabs = array();
$wizTabs[] = array('tpl' => 'part.wizard-server', 'cap' => $l->t('Server'));

View File

@ -90,7 +90,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
}
break;
case 'informRecipients':
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
$shareType = (int) $_POST['shareType'];
$itemType = $_POST['itemType'];
$itemSource = $_POST['itemSource'];
@ -153,7 +153,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
if(empty($result)) {
\OCP\JSON::success();
} else {
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
OCP\JSON::error(array(
'data' => array(
'message' => $l->t("Couldn't send mail to following users: %s ",
@ -287,7 +287,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$count = 0;
// enable l10n support
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
foreach ($groups as $group) {
if ($count < 15) {

View File

@ -25,6 +25,6 @@ $app = isset($_POST["app"]) ? $_POST["app"] : "";
$app = OC_App::cleanAppId($app);
$l = OC_L10N::get( $app );
$l = \OC::$server->getL10N($app);
OC_JSON::success(array('data' => $l->getTranslations(), 'plural_form' => $l->getPluralFormString()));

View File

@ -14,7 +14,7 @@ header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
// Enable l10n support
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
// Enable OC_Defaults support
$defaults = new OC_Defaults();

View File

@ -132,7 +132,7 @@ class Controller {
}
if (\OC_Util::runningOnMac()) {
$l10n = \OC_L10N::get('core');
$l10n = \OC::$server->getL10N('core');
$themeName = \OC_Util::getTheme();
$theme = new \OC_Defaults();
$errors[] = array(

View File

@ -1,7 +1,7 @@
<?php
//some strings that are used in /lib but wont be translatable unless they are in /core too
$l=OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
$l->t("Personal");
$l->t("Users");
$l->t("Apps");

View File

@ -193,7 +193,7 @@ class OC {
}
public static function checkConfig() {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
if (file_exists(self::$configDir . "/config.php")
and !is_writable(self::$configDir . "/config.php")
) {
@ -574,7 +574,7 @@ class OC {
// Check whether the sample configuration has been copied
if(OC_Config::getValue('copied_sample_config', false)) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
OC_Template::printErrorPage(
@ -672,7 +672,6 @@ class OC {
* Handle the request
*/
public static function handleRequest() {
$l = \OC_L10N::get('lib');
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
OC::loadAppClassPaths();

View File

@ -359,7 +359,7 @@ class OC_App {
* entries are sorted by the key 'order' ascending.
*/
public static function getSettingsNavigation() {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
$settings = array();
// by default, settings only contain the help menu
@ -1094,7 +1094,7 @@ class OC_App {
* @throws Exception if no app-name was specified
*/
public static function installApp($app) {
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
$appData=OC_OCSClient::getApplication($app);
// check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string

View File

@ -62,12 +62,12 @@ class OC_Avatar implements \OCP\IAvatar {
$type = 'jpg';
}
if ($type !== 'jpg' && $type !== 'png') {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
throw new \Exception($l->t("Unknown filetype"));
}
if (!$img->valid()) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
throw new \Exception($l->t("Invalid image"));
}

View File

@ -27,7 +27,7 @@ class OC_Defaults {
private $defaultMailHeaderColor;
function __construct() {
$this->l = OC_L10N::get('lib');
$this->l = \OC::$server->getL10N('lib');
$version = OC_Util::getVersion();
$this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */

View File

@ -62,7 +62,7 @@ class OC_Installer{
* @return integer
*/
public static function installApp( $data = array()) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
list($extractDir, $path) = self::downloadApp($data);
$info = self::checkAppsIntegrity($data, $extractDir, $path);
@ -229,7 +229,7 @@ class OC_Installer{
* @throws Exception
*/
public static function downloadApp($data = array()) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
if(!isset($data['source'])) {
throw new \Exception($l->t("No source specified when installing app"));
@ -285,7 +285,7 @@ class OC_Installer{
* @throws \Exception
*/
public static function checkAppsIntegrity($data = array(), $extractDir, $path, $isShipped=false) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
//load the info.xml file of the app
if(!is_file($extractDir.'/appinfo/info.xml')) {
//try to find it in a subdir

View File

@ -25,7 +25,7 @@ class OC_JSON{
*/
public static function checkAppEnabled($app) {
if( !OC_App::isEnabled($app)) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' )));
exit();
}
@ -36,7 +36,7 @@ class OC_JSON{
*/
public static function checkLoggedIn() {
if( !OC_User::isLoggedIn()) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
@ -47,7 +47,7 @@ class OC_JSON{
*/
public static function callCheck() {
if( !OC_Util::isCallRegistered()) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' )));
exit();
}
@ -58,7 +58,7 @@ class OC_JSON{
*/
public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
@ -70,7 +70,7 @@ class OC_JSON{
*/
public static function checkUserExists($user) {
if (!OCP\User::userExists($user)) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' )));
exit;
}
@ -83,7 +83,7 @@ class OC_JSON{
*/
public static function checkSubAdminUser() {
if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}

View File

@ -20,12 +20,15 @@ class Factory {
/**
* get an L10N instance
*
* @param string $app
* @param string|null $lang
* @return \OC_L10N
*/
public function get($app) {
if (!isset($this->instances[$app])) {
public function get($app, $lang = null) {
if (!is_null($lang)) {
return new \OC_L10N($app, $lang);
} else if (!isset($this->instances[$app])) {
$this->instances[$app] = new \OC_L10N($app);
}
return $this->instances[$app];

View File

@ -369,10 +369,11 @@ class Server extends SimpleContainer implements IServerContainer {
* get an L10N instance
*
* @param string $app appid
* @param string $lang
* @return \OC_L10N
*/
function getL10N($app) {
return $this->query('L10NFactory')->get($app);
function getL10N($app, $lang = null) {
return $this->query('L10NFactory')->get($app, $lang);
}
/**

View File

@ -15,7 +15,7 @@ class OC_Setup {
);
public static function getTrans(){
return OC_L10N::get('lib');
return \OC::$server->getL10N('lib');
}
public static function install($options) {

View File

@ -52,7 +52,7 @@ class MailNotifications {
* @param string $sender user id (if nothing is set we use the currently logged-in user)
*/
public function __construct($sender = null) {
$this->l = \OC_L10N::get('core');
$this->l = \OC::$server->getL10N('core');
$this->senderId = $sender;

View File

@ -479,7 +479,7 @@ class Share extends \OC\Share\Constants {
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null) {
$uidOwner = \OC_User::getUser();
$shareWithinGroupOnly = self::shareWithGroupMembersOnly();
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
if (is_null($itemSourceName)) {
$itemSourceName = $itemSource;
@ -849,7 +849,7 @@ class Share extends \OC\Share\Constants {
* @return boolean true on success or false on failure
*/
public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith,
\OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) {
// Check if this item is a reshare and verify that the permissions
@ -938,7 +938,7 @@ class Share extends \OC\Share\Constants {
* @throws \Exception
*/
private static function validateExpireDate($expireDate, $shareTime, $itemType, $itemSource) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
$date = new \DateTime($expireDate);
$today = new \DateTime('now');
@ -1083,7 +1083,7 @@ class Share extends \OC\Share\Constants {
* @return \OCP\Share_Backend
*/
public static function getBackend($itemType) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
if (isset(self::$backends[$itemType])) {
return self::$backends[$itemType];
} else if (isset(self::$backendTypes[$itemType]['class'])) {
@ -1516,7 +1516,7 @@ class Share extends \OC\Share\Constants {
private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$permissions, $parentFolder = null, $token = null, $itemSourceName = null, \DateTime $expirationDate = null) {
$backend = self::getBackend($itemType);
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
// Check if this is a reshare
if ($checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true)) {

View File

@ -178,7 +178,7 @@ class Tags implements \OCP\ITags {
}
if($tagId === false) {
$l10n = \OC_L10N::get('core');
$l10n = \OC::$server->getL10N('core');
throw new \Exception(
$l10n->t('Could not find category "%s"', $tag)
);

View File

@ -56,7 +56,7 @@ class OC_Template extends \OC\Template\Base {
$requesttoken = (OC::$server->getSession() and $registerCall) ? OC_Util::callRegister() : '';
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
$l10n = OC_L10N::get($parts[0]);
$l10n = \OC::$server->getL10N($parts[0]);
$themeDefaults = new OC_Defaults();
list($path, $template) = $this->findTemplate($theme, $app, $name, $fext);

View File

@ -117,7 +117,7 @@ function strip_time($timestamp){
* @return OC_L10N_String timestamp
*/
function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) {
$l=OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
if (!isset($fromTime) || $fromTime === null){
$fromTime = time();
}

View File

@ -237,7 +237,7 @@ class Manager extends PublicEmitter implements IUserManager {
* @return bool|\OC\User\User the created user of false
*/
public function createUser($uid, $password) {
$l = \OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
// Check the name for bad characters
// Allowed are: "a-z", "A-Z", "0-9" and "_.@-"
if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) {

View File

@ -392,7 +392,7 @@ class OC_Util {
$offset = $clientTimeZone - $systemTimeZone;
$timestamp = $timestamp + $offset * 60;
}
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
return $l->l($dateOnly ? 'date' : 'datetime', $timestamp);
}
@ -402,7 +402,7 @@ class OC_Util {
* @return array arrays with error messages and hints
*/
public static function checkServer() {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
$errors = array();
$CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
@ -626,7 +626,7 @@ class OC_Util {
* @return array errors array
*/
public static function checkDatabaseVersion() {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
$errors = array();
$dbType = \OC_Config::getValue('dbtype', 'sqlite');
if ($dbType === 'pgsql') {
@ -707,7 +707,7 @@ class OC_Util {
* @return array arrays with error messages and hints
*/
public static function checkDataDirectoryPermissions($dataDirectory) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
$errors = array();
if (self::runningOnWindows()) {
//TODO: permissions checks for windows hosts
@ -738,7 +738,7 @@ class OC_Util {
* @return bool true if the data directory is valid, false otherwise
*/
public static function checkDataDirectoryValidity($dataDirectory) {
$l = OC_L10N::get('lib');
$l = \OC::$server->getL10N('lib');
$errors = array();
if (!file_exists($dataDirectory . '/.ocdata')) {
$errors[] = array(

View File

@ -36,7 +36,7 @@ class LockNotAcquiredException extends \Exception {
public $lockType;
public function __construct($path, $lockType, $code = 0, \Exception $previous = null) {
$message = \OC_L10N::get('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path));
$message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path));
parent::__construct($message, $code, $previous);
}
@ -44,4 +44,4 @@ class LockNotAcquiredException extends \Exception {
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
}
}

View File

@ -132,7 +132,7 @@ class Util {
* @return \OC_L10N
*/
public static function getL10N($application, $language = null) {
return \OC_L10N::get($application, $language);
return \OC::$server->getL10N($application, $language);
}
/**

View File

@ -27,7 +27,7 @@ class Controller {
\OC_Util::checkAdminUser();
\OCP\JSON::callCheck();
$l = \OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
$smtp_settings = array(
'mail_domain' => null,
@ -80,7 +80,7 @@ class Controller {
\OC_Util::checkAdminUser();
\OCP\JSON::callCheck();
$l = \OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
$email = \OC_Preferences::getValue(\OC_User::getUser(), 'settings', 'email', '');
if (!empty($email)) {
$defaults = new \OC_Defaults();

View File

@ -8,7 +8,7 @@
OC_JSON::checkAdminUser();
$l = OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
if(OC_Config::getValue('appstoreenabled', true)==false) {
OCP\JSON::success(array('type' => 'external', 'data' => array()));

View File

@ -4,7 +4,7 @@
OCP\JSON::callCheck();
OC_JSON::checkLoggedIn();
$l=OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
$username = isset($_POST["username"]) ? $_POST["username"] : OC_User::getUser();
$displayName = $_POST["displayName"];

View File

@ -4,7 +4,7 @@ OCP\JSON::callCheck();
OC_JSON::checkAdminUser();
$groupname = $_POST["groupname"];
$l = OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
// Does the group exist?
if( in_array( $groupname, OC_Group::getGroups())) {

View File

@ -12,7 +12,7 @@ $params = array('uid' => \OCP\User::getUser(),
$view = new OC\Files\View('/');
$util = new \OCA\Encryption\Util($view, \OCP\User::getUser());
$l = \OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
$result = $util->initEncryption($params);

View File

@ -3,7 +3,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l = \OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
$user = \OC_User::getUser();
$view = new \OC\Files\View('/' . $user . '/files_encryption');

View File

@ -14,6 +14,6 @@ $result = OC_App::installApp($appId);
if($result !== false) {
OC_JSON::success(array('data' => array('appid' => $appId)));
} else {
$l = OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
}

View File

@ -3,7 +3,7 @@
OC_JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l=OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
// Get data
if( isset( $_POST['email'] ) && OC_Mail::validateAddress($_POST['email']) ) {

View File

@ -11,7 +11,7 @@ if(OC_User::getUser() === $username) {
}
if(!OC_User::isAdminUser(OC_User::getUser()) && !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)) {
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}
@ -21,6 +21,6 @@ if( OC_User::deleteUser( $username )) {
OC_JSON::success(array("data" => array( "username" => $username )));
}
else{
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
OC_JSON::error(array("data" => array( "message" => $l->t("Unable to delete user") )));
}

View File

@ -3,7 +3,7 @@
OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
$l = \OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
$user = \OC_User::getUser();
$view = new \OC\Files\View('/' . $user . '/files_encryption');

View File

@ -1,6 +1,6 @@
<?php
$l=OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
OC_JSON::checkLoggedIn();
OCP\JSON::callCheck();

View File

@ -13,7 +13,7 @@ $username = isset($_POST["username"])?$_POST["username"]:'';
if(($username === '' && !OC_User::isAdminUser(OC_User::getUser()))
|| (!OC_User::isAdminUser(OC_User::getUser())
&& !OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username))) {
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}

View File

@ -8,7 +8,7 @@ $username = $_POST["username"];
$group = $_POST["group"];
if($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUser($username)) {
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Admins can\'t remove themself from the admin group'))));
exit();
}
@ -16,7 +16,7 @@ if($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUs
if(!OC_User::isAdminUser(OC_User::getUser())
&& (!OC_SubAdmin::isUserAccessible(OC_User::getUser(), $username)
|| !OC_SubAdmin::isGroupAccessible(OC_User::getUser(), $group))) {
$l = OC_L10N::get('core');
$l = \OC::$server->getL10N('core');
OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
exit();
}
@ -25,7 +25,7 @@ if(!OC_Group::groupExists($group)) {
OC_Group::createGroup($group);
}
$l = OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
$error = $l->t("Unable to add user to group %s", $group);
$action = "add";

View File

@ -14,6 +14,6 @@ $result = OC_App::removeApp($appId);
if($result !== false) {
OC_JSON::success(array('data' => array('appid' => $appId)));
} else {
$l = OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
}

View File

@ -40,6 +40,6 @@ $result = OC_Installer::updateAppByOCSId($appId, $isShipped);
if($result !== false) {
OC_JSON::success(array('data' => array('appid' => $appId)));
} else {
$l = OC_L10N::get('settings');
$l = \OC::$server->getL10N('settings');
OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't update app.") )));
}

View File

@ -46,7 +46,7 @@ $languageNames=include 'languageCodes.php';
$languages=array();
$commonlanguages = array();
foreach($languageCodes as $lang) {
$l=OC_L10N::get('settings', $lang);
$l = \OC::$server->getL10N('settings', $lang);
if(substr($l->t('__language_name__'), 0, 1) !== '_') {//first check if the language name is in the translation file
$ln=array('code'=>$lang, 'name'=> (string)$l->t('__language_name__'));
}elseif(isset($languageNames[$lang])) {