]> source.dussan.org Git - nextcloud-server.git/commitdiff
Contacts: small fixes and cleanups
authorBart Visscher <bartv@thisnet.nl>
Wed, 7 Mar 2012 20:29:23 +0000 (21:29 +0100)
committerBart Visscher <bartv@thisnet.nl>
Wed, 7 Mar 2012 20:46:42 +0000 (21:46 +0100)
apps/calendar/lib/object.php
apps/contacts/ajax/loadphoto.php
apps/contacts/lib/vcard.php

index b84e575bc8358c2baf68ad8fd543517021d7ea9c..e0c0e83d5d0f71742e1c3a932d22736867a1e7fa 100644 (file)
@@ -96,8 +96,7 @@ class OC_Calendar_Object{
                list($type,$startdate,$enddate,$summary,$repeating,$uid) = self::extractData($object);
 
                if(is_null($uid)){
-                       $uid = self::createUID();
-                       $object->add('UID',$uid);
+                       $object->setUID();
                        $data = $object->serialize();
                }
 
@@ -208,14 +207,6 @@ class OC_Calendar_Object{
                return true;
        }
 
-       /**
-        * @brief Creates a UID
-        * @return string
-        */
-       protected static function createUID(){
-               return substr(md5(rand().time()),0,10);
-       }
-
        /**
         * @brief Extracts data from a vObject-Object
         * @param Sabre_VObject $object
index 358e046942b5272cedb5edd9e314ec01cdff5f7b..1f4cde0b535afd574ee1623b8bb48289f70f5834 100644 (file)
@@ -18,8 +18,6 @@
  * You should have received a copy of the GNU Affero General Public
  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
  *
- * TODO: Translatable strings.
- *       Remember to delete tmp file at some point.
  */
 // Init owncloud
 require_once('../../../lib/base.php');
@@ -33,7 +31,7 @@ OC_JSON::checkAppEnabled('contacts');
 
 function bailOut($msg) {
        OC_JSON::error(array('data' => array('message' => $msg)));
-       OC_Log::write('contacts','ajax/savecrop.php: '.$msg, OC_Log::DEBUG);
+       OC_Log::write('contacts','ajax/loadphoto.php: '.$msg, OC_Log::DEBUG);
        exit();
 }
 
@@ -42,7 +40,7 @@ $image = null;
 $id = isset($_GET['id']) ? $_GET['id'] : '';
 
 if($id == '') {
-       bailOut('Missing contact id.');
+       bailOut(OC_Contacts_App::$l10n->t('Missing contact id.'));
 }
 
 $tmpl = new OC_TEMPLATE("contacts", "part.contactphoto");
index 9324f158cc77322f86ca7f5dbeca5bffcf5c4d99..eade8859e76c8c63aafefc1b694bbf08bcc2efdb 100644 (file)
@@ -174,6 +174,9 @@ class OC_Contacts_VCard{
                        if($property->name == 'UID'){
                                $uid = $property->value;
                        }
+                       if($property->name == 'ORG'){
+                               $org = $property->value;
+                       }
                        if($property->name == 'EMAIL' && is_null($email)){ // only use the first email as substitute for missing N or FN.
                                $email = $property->value;
                        }
@@ -184,6 +187,8 @@ class OC_Contacts_VCard{
                                $fn = join(' ', array_reverse(array_slice(explode(';', $n), 0, 2)));
                        } elseif($email) {
                                $fn = $email;
+                       } elseif($org) {
+                               $fn = $org;
                        } else {
                                $fn = 'Unknown Name';
                        }