diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-02-12 16:11:41 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-02-12 16:11:41 +0100 |
commit | 623afb69b6a51d57ca99d1d825b6c433a93baa96 (patch) | |
tree | e6990f47200de183680e58df4c288dd11e151951 /apps/contacts/ajax | |
parent | 39f342d595136ae6edace17870d14e32c7466cbd (diff) | |
download | nextcloud-server-623afb69b6a51d57ca99d1d825b6c433a93baa96.tar.gz nextcloud-server-623afb69b6a51d57ca99d1d825b6c433a93baa96.zip |
Contacts: cleanup OC_L10N usage
Diffstat (limited to 'apps/contacts/ajax')
-rw-r--r-- | apps/contacts/ajax/addbook.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/addcard.php | 3 | ||||
-rw-r--r-- | apps/contacts/ajax/addcontact.php | 3 | ||||
-rw-r--r-- | apps/contacts/ajax/addproperty.php | 9 | ||||
-rw-r--r-- | apps/contacts/ajax/chooseaddressbook.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/contactdetails.php | 9 | ||||
-rw-r--r-- | apps/contacts/ajax/createaddressbook.php | 6 | ||||
-rw-r--r-- | apps/contacts/ajax/deletebook.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/deleteproperty.php | 6 | ||||
-rw-r--r-- | apps/contacts/ajax/editaddressbook.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/importdialog.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/loadphoto.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/messagebox.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/savecrop.php | 1 | ||||
-rw-r--r-- | apps/contacts/ajax/saveproperty.php | 13 | ||||
-rw-r--r-- | apps/contacts/ajax/showsetproperty.php | 3 | ||||
-rw-r--r-- | apps/contacts/ajax/updateaddressbook.php | 2 | ||||
-rw-r--r-- | apps/contacts/ajax/uploadphoto.php | 13 |
18 files changed, 27 insertions, 48 deletions
diff --git a/apps/contacts/ajax/addbook.php b/apps/contacts/ajax/addbook.php index 36acb9af391..f5852183cc3 100644 --- a/apps/contacts/ajax/addbook.php +++ b/apps/contacts/ajax/addbook.php @@ -7,7 +7,6 @@ */ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('contacts'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); $book = array( diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index fbf5b57ae7c..b1dc69a4691 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -31,7 +31,6 @@ function bailOut($msg) { // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l=new OC_L10N('contacts'); $aid = $_POST['id']; OC_Contacts_App::getAddressbook( $aid ); // is owner access check @@ -95,7 +94,7 @@ foreach( $add as $propname){ } $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); if(!$id) { - OC_JSON::error(array('data' => array('message' => $l->t('There was an error adding the contact.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.')))); OC_Log::write('contacts','ajax/addcard.php: Recieved non-positive ID on adding card: '.$id, OC_Log::ERROR); exit(); } diff --git a/apps/contacts/ajax/addcontact.php b/apps/contacts/ajax/addcontact.php index 80034327011..5d17631caa4 100644 --- a/apps/contacts/ajax/addcontact.php +++ b/apps/contacts/ajax/addcontact.php @@ -34,7 +34,6 @@ function debug($msg) { // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l=new OC_L10N('contacts'); foreach ($_POST as $key=>$element) { debug('_POST: '.$key.'=>'.$element); @@ -55,7 +54,7 @@ $vcard->setString('N',$n); $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); if(!$id) { - OC_JSON::error(array('data' => array('message' => $l->t('There was an error adding the contact.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('There was an error adding the contact.')))); OC_Log::write('contacts','ajax/addcontact.php: Recieved non-positive ID on adding card: '.$id, OC_Log::ERROR); exit(); } diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index 23f0a9379b2..03a45532f9b 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -26,7 +26,6 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l=new OC_L10N('contacts'); $id = $_POST['id']; $vcard = OC_Contacts_App::getContactVCard( $id ); @@ -36,7 +35,7 @@ $value = $_POST['value']; if(!is_array($value)){ $value = trim($value); if(!$value && in_array($name, array('TEL', 'EMAIL', 'ORG', 'BDAY', 'NICKNAME'))) { - OC_JSON::error(array('data' => array('message' => $l->t('Cannot add empty property.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Cannot add empty property.')))); exit(); } } elseif($name === 'ADR') { // only add if non-empty elements. @@ -48,7 +47,7 @@ if(!is_array($value)){ } } if($empty) { - OC_JSON::error(array('data' => array('message' => $l->t('At least one of the address fields has to be filled out.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('At least one of the address fields has to be filled out.')))); exit(); } } @@ -59,7 +58,7 @@ $current = $vcard->select($name); foreach($current as $item) { $tmpvalue = (is_array($value)?implode(';', $value):$value); if($tmpvalue == $item->value) { - OC_JSON::error(array('data' => array('message' => $l->t('Trying to add duplicate property: ').$name.': '.$tmpvalue))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Trying to add duplicate property: ').$name.': '.$tmpvalue))); OC_Log::write('contacts','ajax/addproperty.php: Trying to add duplicate property: '.$name.': '.$tmpvalue, OC_Log::DEBUG); exit(); } @@ -114,7 +113,7 @@ foreach ($parameters as $key=>$element) { $checksum = md5($vcard->children[$line]->serialize()); if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) { - OC_JSON::error(array('data' => array('message' => $l->t('Error adding contact property.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding contact property.')))); OC_Log::write('contacts','ajax/addproperty.php: Error updating contact property: '.$name, OC_Log::ERROR); exit(); } diff --git a/apps/contacts/ajax/chooseaddressbook.php b/apps/contacts/ajax/chooseaddressbook.php index b0a10bb3118..8298c16b041 100644 --- a/apps/contacts/ajax/chooseaddressbook.php +++ b/apps/contacts/ajax/chooseaddressbook.php @@ -7,7 +7,6 @@ */ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('contacts'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/contactdetails.php b/apps/contacts/ajax/contactdetails.php index f7ac25ea515..f35fd595c56 100644 --- a/apps/contacts/ajax/contactdetails.php +++ b/apps/contacts/ajax/contactdetails.php @@ -34,15 +34,14 @@ function debug($msg) { // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l=new OC_L10N('contacts'); $id = isset($_GET['id'])?$_GET['id']:null; if(is_null($id)) { - bailOut($l->t('Missing ID')); + bailOut(OC_Contacts_App::$l10n->t('Missing ID')); } $vcard = OC_Contacts_App::getContactVCard( $id ); if(is_null($vcard)) { - bailOut($l->t('Error parsing VCard for ID: "'.$id.'"')); + bailOut(OC_Contacts_App::$l10n->t('Error parsing VCard for ID: "'.$id.'"')); } $details = OC_Contacts_VCard::structureContact($vcard); @@ -54,7 +53,7 @@ if(!isset($details['FN'])) { } elseif(isset($details['EMAIL'])) { $details['FN'] = array('value' => $details['EMAIL'][0]['value']); } else { - $details['FN'] = array('value' => $l->t('Unknown')); + $details['FN'] = array('value' => OC_Contacts_App::$l10n->t('Unknown')); } } @@ -73,4 +72,4 @@ if(isset($details['PHOTO'])) { } $details['id'] = $id; -OC_JSON::success(array('data' => $details));
\ No newline at end of file +OC_JSON::success(array('data' => $details)); diff --git a/apps/contacts/ajax/createaddressbook.php b/apps/contacts/ajax/createaddressbook.php index 3d766b6a60a..fbd70bae583 100644 --- a/apps/contacts/ajax/createaddressbook.php +++ b/apps/contacts/ajax/createaddressbook.php @@ -8,8 +8,6 @@ */ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('contacts'); - // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); @@ -17,13 +15,13 @@ OC_JSON::checkAppEnabled('contacts'); $userid = OC_User::getUser(); $bookid = OC_Contacts_Addressbook::add($userid, strip_tags($_POST['name']), null); if(!$bookid) { - OC_JSON::error(array('data' => array('message' => $l->t('Error adding addressbook.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error adding addressbook.')))); OC_Log::write('contacts','ajax/createaddressbook.php: Error adding addressbook: '.$_POST['name'], OC_Log::ERROR); exit(); } if(!OC_Contacts_Addressbook::setActive($bookid, 1)) { - OC_JSON::error(array('data' => array('message' => $l->t('Error activating addressbook.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error activating addressbook.')))); OC_Log::write('contacts','ajax/createaddressbook.php: Error activating addressbook: '.$bookid, OC_Log::ERROR); //exit(); } diff --git a/apps/contacts/ajax/deletebook.php b/apps/contacts/ajax/deletebook.php index d782c9dfb8d..46d8deb4868 100644 --- a/apps/contacts/ajax/deletebook.php +++ b/apps/contacts/ajax/deletebook.php @@ -23,7 +23,6 @@ // Init owncloud require_once('../../../lib/base.php'); -$l10n = new OC_L10N('contacts'); // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php index d745d3271db..a9afffaad4c 100644 --- a/apps/contacts/ajax/deleteproperty.php +++ b/apps/contacts/ajax/deleteproperty.php @@ -26,7 +26,6 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l10n = new OC_L10N('contacts'); $id = $_GET['id']; $checksum = $_GET['checksum']; @@ -34,15 +33,14 @@ $checksum = $_GET['checksum']; $vcard = OC_Contacts_App::getContactVCard( $id ); $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum); if(is_null($line)){ - $l=new OC_L10N('contacts'); - OC_JSON::error(array('data' => array( 'message' => $l->t('Information about vCard is incorrect. Please reload the page.')))); + OC_JSON::error(array('data' => array( 'message' => OC_Contacts_App::$l10n->t('Information about vCard is incorrect. Please reload the page.')))); exit(); } unset($vcard->children[$line]); if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) { - OC_JSON::error(array('data' => array('message' => $l->t('Error deleting contact property.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error deleting contact property.')))); OC_Log::write('contacts','ajax/deleteproperty.php: Error deleting contact property', OC_Log::ERROR); exit(); } diff --git a/apps/contacts/ajax/editaddressbook.php b/apps/contacts/ajax/editaddressbook.php index ced673ce807..a6262f39b23 100644 --- a/apps/contacts/ajax/editaddressbook.php +++ b/apps/contacts/ajax/editaddressbook.php @@ -7,7 +7,6 @@ */ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('contacts'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); $addressbook = OC_Contacts_App::getAddressbook($_GET['bookid']); diff --git a/apps/contacts/ajax/importdialog.php b/apps/contacts/ajax/importdialog.php index 17b4cebdbd1..280e462f662 100644 --- a/apps/contacts/ajax/importdialog.php +++ b/apps/contacts/ajax/importdialog.php @@ -9,7 +9,6 @@ require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); -$l10n = new OC_L10N('contacts'); $tmpl = new OC_Template('contacts', 'part.import'); $tmpl->assign('path', $_POST['path']); $tmpl->assign('filename', $_POST['filename']); diff --git a/apps/contacts/ajax/loadphoto.php b/apps/contacts/ajax/loadphoto.php index d9f7e737b55..358e046942b 100644 --- a/apps/contacts/ajax/loadphoto.php +++ b/apps/contacts/ajax/loadphoto.php @@ -26,7 +26,6 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l=new OC_L10N('contacts'); // foreach ($_POST as $key=>$element) { // OC_Log::write('contacts','ajax/savecrop.php: '.$key.'=>'.$element, OC_Log::DEBUG); diff --git a/apps/contacts/ajax/messagebox.php b/apps/contacts/ajax/messagebox.php index b3cad947674..408e7a537aa 100644 --- a/apps/contacts/ajax/messagebox.php +++ b/apps/contacts/ajax/messagebox.php @@ -7,7 +7,6 @@ */ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('contacts'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/savecrop.php b/apps/contacts/ajax/savecrop.php index 7b7384723cd..1a84f6fdfae 100644 --- a/apps/contacts/ajax/savecrop.php +++ b/apps/contacts/ajax/savecrop.php @@ -28,7 +28,6 @@ OC_Log::write('contacts','ajax/savecrop.php: Huzzah!!!', OC_Log::DEBUG); // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l=new OC_L10N('contacts'); // foreach ($_POST as $key=>$element) { // OC_Log::write('contacts','ajax/savecrop.php: '.$key.'=>'.$element, OC_Log::DEBUG); diff --git a/apps/contacts/ajax/saveproperty.php b/apps/contacts/ajax/saveproperty.php index 8f575c6b81e..6c8132c1dbf 100644 --- a/apps/contacts/ajax/saveproperty.php +++ b/apps/contacts/ajax/saveproperty.php @@ -26,7 +26,6 @@ require_once('../../../lib/base.php'); // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); -$l=new OC_L10N('contacts'); function bailOut($msg) { OC_JSON::error(array('data' => array('message' => $msg))); @@ -59,24 +58,24 @@ if(is_array($value)){ // FIXME: How to strip_tags for compound values? $value = trim(strip_tags($value)); } if(!$id) { - bailOut($l->t('id is not set.')); + bailOut(OC_Contacts_App::$l10n->t('id is not set.')); } if(!$checksum) { - bailOut($l->t('checksum is not set.')); + bailOut(OC_Contacts_App::$l10n->t('checksum is not set.')); } if(!$name) { - bailOut($l->t('element name is not set.')); + bailOut(OC_Contacts_App::$l10n->t('element name is not set.')); } $vcard = OC_Contacts_App::getContactVCard( $id ); $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum); if(is_null($line)) { - bailOut($l->t('Information about vCard is incorrect. Please reload the page.'.$checksum.' "'.$line.'"')); + bailOut(OC_Contacts_App::$l10n->t('Information about vCard is incorrect. Please reload the page.'.$checksum.' "'.$line.'"')); } $element = $vcard->children[$line]->name; if($element != $name) { - bailOut($l->t('Something went FUBAR. ').$name.' != '.$element); + bailOut(OC_Contacts_App::$l10n->t('Something went FUBAR. ').$name.' != '.$element); } switch($element) { @@ -123,7 +122,7 @@ $checksum = md5($vcard->children[$line]->serialize()); debug('New checksum: '.$checksum); if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) { - OC_JSON::error(array('data' => array('message' => $l->t('Error updating contact property.')))); + OC_JSON::error(array('data' => array('message' => OC_Contacts_App::$l10n->t('Error updating contact property.')))); OC_Log::write('contacts','ajax/setproperty.php: Error updating contact property: '.$value, OC_Log::ERROR); exit(); } diff --git a/apps/contacts/ajax/showsetproperty.php b/apps/contacts/ajax/showsetproperty.php index 577230e4566..73bef655351 100644 --- a/apps/contacts/ajax/showsetproperty.php +++ b/apps/contacts/ajax/showsetproperty.php @@ -34,8 +34,7 @@ $vcard = OC_Contacts_App::getContactVCard( $id ); $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum); if(is_null($line)){ - $l=new OC_L10N('contacts'); - OC_JSON::error(array('data' => array( 'message' => $l->t('Information about vCard is incorrect. Please reload the page.')))); + OC_JSON::error(array('data' => array( 'message' => OC_Contacts_App::$l10n->t('Information about vCard is incorrect. Please reload the page.')))); exit(); } diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/updateaddressbook.php index d6c1ad179bb..b43b5b93a32 100644 --- a/apps/contacts/ajax/updateaddressbook.php +++ b/apps/contacts/ajax/updateaddressbook.php @@ -8,8 +8,6 @@ require_once('../../../lib/base.php'); -$l10n = new OC_L10N('contacts'); - // Check if we are a user OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); diff --git a/apps/contacts/ajax/uploadphoto.php b/apps/contacts/ajax/uploadphoto.php index 62cd32f5dbb..9780df46476 100644 --- a/apps/contacts/ajax/uploadphoto.php +++ b/apps/contacts/ajax/uploadphoto.php @@ -94,14 +94,13 @@ if (!isset($_FILES['imagefile'])) { } $error = $_FILES['imagefile']['error']; if($error !== UPLOAD_ERR_OK) { - $l=new OC_L10N('contacts'); $errors = array( - 0=>$l->t("There is no error, the file uploaded with success"), - 1=>$l->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'), - 2=>$l->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"), - 3=>$l->t("The uploaded file was only partially uploaded"), - 4=>$l->t("No file was uploaded"), - 6=>$l->t("Missing a temporary folder") + 0=>OC_Contacts_App::$l10n->t("There is no error, the file uploaded with success"), + 1=>OC_Contacts_App::$l10n->t("The uploaded file exceeds the upload_max_filesize directive in php.ini").ini_get('upload_max_filesize'), + 2=>OC_Contacts_App::$l10n->t("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"), + 3=>OC_Contacts_App::$l10n->t("The uploaded file was only partially uploaded"), + 4=>OC_Contacts_App::$l10n->t("No file was uploaded"), + 6=>OC_Contacts_App::$l10n->t("Missing a temporary folder") ); bailOut($errors[$error]); } |