diff --git a/plugins/contacts-suggestions-example/ContactsExampleSuggestions.php b/plugins/contacts-suggestions-example/ContactsExampleSuggestions.php new file mode 100644 index 000000000..05fcc2dfe --- /dev/null +++ b/plugins/contacts-suggestions-example/ContactsExampleSuggestions.php @@ -0,0 +1,21 @@ +Email(), ''), + array('email@domain.com', 'name') + ); + + return $aResult; + } +} diff --git a/plugins/contacts-suggestions-example/LICENSE b/plugins/contacts-suggestions-example/LICENSE new file mode 100644 index 000000000..4aed64b3a --- /dev/null +++ b/plugins/contacts-suggestions-example/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2015 RainLoop Team + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/plugins/contacts-suggestions-example/VERSION b/plugins/contacts-suggestions-example/VERSION new file mode 100644 index 000000000..9f8e9b69a --- /dev/null +++ b/plugins/contacts-suggestions-example/VERSION @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/plugins/contacts-suggestions-example/index.php b/plugins/contacts-suggestions-example/index.php new file mode 100644 index 000000000..bb9bf2e73 --- /dev/null +++ b/plugins/contacts-suggestions-example/index.php @@ -0,0 +1,30 @@ +addHook('main.fabrica', 'MainFabrica'); + } + + /** + * @param string $sName + * @param mixed $mResult + */ + public function MainFabrica($sName, &$mResult) + { + switch ($sName) + { + case 'suggestions': + + if (!\is_array($mResult)) + { + $mResult = array(); + } + + include_once __DIR__.'/ContactsExampleSuggestions.php'; + $mResult[] = new ContactsExampleSuggestions(); + break; + } + } +} \ No newline at end of file diff --git a/plugins/postfixadmin-change-password/LICENSE b/plugins/postfixadmin-change-password/LICENSE index 4a4ca8d81..c6cb63dbf 100644 --- a/plugins/postfixadmin-change-password/LICENSE +++ b/plugins/postfixadmin-change-password/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 RainLoop Team +Copyright (c) 2015 RainLoop Team, @zaffkea Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/plugins/postfixadmin-change-password/VERSION b/plugins/postfixadmin-change-password/VERSION index b123147e2..ea710abb9 100644 --- a/plugins/postfixadmin-change-password/VERSION +++ b/plugins/postfixadmin-change-password/VERSION @@ -1 +1 @@ -1.1 \ No newline at end of file +1.2 \ No newline at end of file diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 121449e04..d7bb0ce3c 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -305,11 +305,9 @@ class Actions $mResult = array(); } - // \RainLoop\Providers\Suggestions\ISuggestions -// $mResult[] = new \RainLoop\Providers\Suggestions\TestSuggestions(); - if (\is_array($mResult) && \RainLoop\Utils::IsOwnCloud()) { + // \RainLoop\Providers\Suggestions\ISuggestions $mResult[] = new \RainLoop\Providers\Suggestions\OwnCloudSuggestions(); } @@ -7011,8 +7009,10 @@ class Actions $aResult = \array_merge($aResult, $aSuggestionsProviderResult); } } + } + $aResult = \RainLoop\Utils::RemoveSuggestionsdDuplicates($aResult); if ($iLimit < \count($aResult)) { $aResult = \array_slice($aResult, 0, $iLimit); @@ -7020,6 +7020,7 @@ class Actions $this->Plugins()->RunHook('ajax.suggestions-post', array(&$aResult, $sQuery, $oAccount, $iLimit)); + $aResult = \RainLoop\Utils::RemoveSuggestionsdDuplicates($aResult); if ($iLimit < \count($aResult)) { $aResult = \array_slice($aResult, 0, $iLimit); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php index 13cc8cbe9..6268a0893 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Providers/Suggestions.php @@ -35,7 +35,7 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider */ public function Process($oAccount, $sQuery, $iLimit = 20) { - $aResult = array(); + $aSuggestions = array(); if ($oAccount instanceof \RainLoop\Model\Account && $this->IsActive() && \is_array($this->aDrivers) && 0 < \strlen($sQuery)) @@ -54,16 +54,7 @@ class Suggestions extends \RainLoop\Providers\AbstractProvider } } - $aCache = array(); - foreach ($aSuggestions as $aItem) // remove duplicates - { - $sLine = \implode('~~', $aItem); - if (!isset($aCache[$sLine])) - { - $aCache[$sLine] = true; - $aResult[] = $aItem; - } - } + $aResult = \RainLoop\Utils::RemoveSuggestionsdDuplicates($aSuggestions); if ($iLimit < \count($aResult)) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Utils.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Utils.php index a4c587955..fbab59fe2 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Utils.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Utils.php @@ -608,6 +608,32 @@ class Utils return self::WebVersionPath().'static/'; } + /** + * @param array $aSuggestions + * + * @return array + */ + public static function RemoveSuggestionsdDuplicates($aSuggestions) + { + $aResult = array(); + + if (is_array($aSuggestions)) + { + $aCache = array(); + foreach ($aSuggestions as $aItem) + { + $sLine = \implode('~~', $aItem); + if (!isset($aCache[$sLine])) + { + $aCache[$sLine] = true; + $aResult[] = $aItem; + } + } + } + + return $aResult; + } + /** * @param string $sFileName * @param bool $bProcessSections = false