]> source.dussan.org Git - nextcloud-server.git/commitdiff
Temporarily disable sharing with contacts and emails, will come in next release
authorMichael Gapczynski <mtgap@owncloud.com>
Wed, 12 Sep 2012 04:23:45 +0000 (00:23 -0400)
committerMichael Gapczynski <mtgap@owncloud.com>
Wed, 12 Sep 2012 05:02:08 +0000 (01:02 -0400)
core/ajax/share.php
core/js/share.js
lib/public/share.php

index 5b6763c08e7047c009d989ca0e4b682a46475eb3..b8e88acec2119a8a0d812aa5e8c5617456c42f01 100644 (file)
@@ -82,23 +82,23 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
                case 'getShareWith':
                        if (isset($_GET['search'])) {
                                $shareWith = array();
-                               if (OC_App::isEnabled('contacts')) {
-                                       // TODO Add function to contacts to only get the 'fullname' column to improve performance
-                                       $ids = OC_Contacts_Addressbook::activeIds();
-                                       foreach ($ids as $id) {
-                                               $vcards = OC_Contacts_VCard::all($id);
-                                               foreach ($vcards as $vcard) {
-                                                       $contact = $vcard['fullname'];
-                                                       if (stripos($contact, $_GET['search']) !== false
-                                                               && (!isset($_GET['itemShares'])
-                                                               || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_CONTACT])
-                                                               || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_CONTACT])
-                                                               || !in_array($contact, $_GET['itemShares'][OCP\Share::SHARE_TYPE_CONTACT]))) {
-                                                               $shareWith[] = array('label' => $contact, 'value' => array('shareType' => 5, 'shareWith' => $vcard['id']));
-                                                       }
-                                               }
-                                       }
-                               }
+//                             if (OC_App::isEnabled('contacts')) {
+//                                     // TODO Add function to contacts to only get the 'fullname' column to improve performance
+//                                     $ids = OC_Contacts_Addressbook::activeIds();
+//                                     foreach ($ids as $id) {
+//                                             $vcards = OC_Contacts_VCard::all($id);
+//                                             foreach ($vcards as $vcard) {
+//                                                     $contact = $vcard['fullname'];
+//                                                     if (stripos($contact, $_GET['search']) !== false
+//                                                             && (!isset($_GET['itemShares'])
+//                                                             || !isset($_GET['itemShares'][OCP\Share::SHARE_TYPE_CONTACT])
+//                                                             || !is_array($_GET['itemShares'][OCP\Share::SHARE_TYPE_CONTACT])
+//                                                             || !in_array($contact, $_GET['itemShares'][OCP\Share::SHARE_TYPE_CONTACT]))) {
+//                                                             $shareWith[] = array('label' => $contact, 'value' => array('shareType' => 5, 'shareWith' => $vcard['id']));
+//                                                     }
+//                                             }
+//                                     }
+//                             }
                                $count = 0;
                                $users = array();
                                $limit = 0;
index 535ae6da995158b94412aef345512421af242836..e85c134f82591b7ac8c7a37f472f4d7fc174d07c 100644 (file)
@@ -167,12 +167,12 @@ OC.Share={
                                                        response(result.data);
                                                } else {
                                                        // Suggest sharing via email if valid email address
-                                                       var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
-                                                       if (pattern.test(search.term)) {
-                                                               response([{label: 'Share via email: '+search.term, value: {shareType: OC.Share.SHARE_TYPE_EMAIL, shareWith: search.term}}]);
-                                                       } else {
+//                                                     var pattern = new RegExp(/^[+a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/i);
+//                                                     if (pattern.test(search.term)) {
+//                                                             response([{label: 'Share via email: '+search.term, value: {shareType: OC.Share.SHARE_TYPE_EMAIL, shareWith: search.term}}]);
+//                                                     } else {
                                                                response(['No people found']);
-                                                       }
+//                                                     }
                                                }
                                        });
        //                      }
index ccb5a56ac7477e012b50e6d58ecb1f565fe0bce9..9d2c98e41797174bfd1032ca7dae2b6a9e1f1c64 100644 (file)
@@ -252,26 +252,26 @@ class Share {
                        \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
                        throw new \Exception($message);
                        return false;
-               } else if ($shareType === self::SHARE_TYPE_CONTACT) {
-                       if (!\OC_App::isEnabled('contacts')) {
-                               $message = 'Sharing '.$itemSource.' failed, because the contacts app is not enabled';
-                               \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
-                               return false;
-                       }
-                       $vcard = \OC_Contacts_App::getContactVCard($shareWith);
-                       if (!isset($vcard)) {
-                               $message = 'Sharing '.$itemSource.' failed, because the contact does not exist';
-                               \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
-                               throw new \Exception($message);
-                       }
-                       $details = \OC_Contacts_VCard::structureContact($vcard);
-                       // TODO Add ownCloud user to contacts vcard
-                       if (!isset($details['EMAIL'])) {
-                               $message = 'Sharing '.$itemSource.' failed, because no email address is associated with the contact';
-                               \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
-                               throw new \Exception($message);
-                       }
-                       return self::shareItem($itemType, $itemSource, self::SHARE_TYPE_EMAIL, $details['EMAIL'], $permissions);
+//             } else if ($shareType === self::SHARE_TYPE_CONTACT) {
+//                     if (!\OC_App::isEnabled('contacts')) {
+//                             $message = 'Sharing '.$itemSource.' failed, because the contacts app is not enabled';
+//                             \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+//                             return false;
+//                     }
+//                     $vcard = \OC_Contacts_App::getContactVCard($shareWith);
+//                     if (!isset($vcard)) {
+//                             $message = 'Sharing '.$itemSource.' failed, because the contact does not exist';
+//                             \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+//                             throw new \Exception($message);
+//                     }
+//                     $details = \OC_Contacts_VCard::structureContact($vcard);
+//                     // TODO Add ownCloud user to contacts vcard
+//                     if (!isset($details['EMAIL'])) {
+//                             $message = 'Sharing '.$itemSource.' failed, because no email address is associated with the contact';
+//                             \OC_Log::write('OCP\Share', $message, \OC_Log::ERROR);
+//                             throw new \Exception($message);
+//                     }
+//                     return self::shareItem($itemType, $itemSource, self::SHARE_TYPE_EMAIL, $details['EMAIL'], $permissions);
                } else {
                        // Future share types need to include their own conditions
                        $message = 'Share type '.$shareType.' is not valid for '.$itemSource;