diff --git a/lib/Alchemy/Phrasea/Application/Api.php b/lib/Alchemy/Phrasea/Application/Api.php index 3b221d0701..9cdd1a3729 100644 --- a/lib/Alchemy/Phrasea/Application/Api.php +++ b/lib/Alchemy/Phrasea/Application/Api.php @@ -144,7 +144,7 @@ return call_user_func(function() { return; } - + if ($oauth2_adapter->has_ses_id()) { try diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php index a11e92afad..26207697da 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/ApcCache.php @@ -50,6 +50,6 @@ class ApcCache extends ServiceAbstract implements ServiceInterface return 'apc'; } - + } diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php index 9ab7c75e4e..1eab95aaea 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/MemcacheCache.php @@ -36,7 +36,7 @@ class MemcacheCache extends ServiceAbstract implements ServiceInterface protected function init() { $options = $this->getOptions(); - + $this->host = isset($options["host"]) ? $options["host"] : self::DEFAULT_HOST; $this->port = isset($options["port"]) ? $options["port"] : self::DEFAULT_PORT; diff --git a/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php b/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php index ecc13b661d..934efd25e9 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php +++ b/lib/Alchemy/Phrasea/Core/Service/Cache/RedisCache.php @@ -25,7 +25,7 @@ use Alchemy\Phrasea\Core, */ class RedisCache extends ServiceAbstract implements ServiceInterface { - + const DEFAULT_HOST = "localhost"; const DEFAULT_PORT = "6379"; @@ -36,7 +36,7 @@ class RedisCache extends ServiceAbstract implements ServiceInterface protected function init() { $options = $this->getOptions(); - + $this->host = isset($options["host"]) ? $options["host"] : self::DEFAULT_HOST; $this->port = isset($options["port"]) ? $options["port"] : self::DEFAULT_PORT; diff --git a/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php b/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php index c1da3e8f39..daf20f88f9 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php +++ b/lib/Alchemy/Phrasea/Core/Service/Log/FirePHP.php @@ -37,7 +37,7 @@ class FirePHP extends ServiceAbstract implements ServiceInterface $this->logger->pushHandler(new FirePHPHandler()); } - + return $this->logger; } diff --git a/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php b/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php index d721b8e191..db47305387 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php +++ b/lib/Alchemy/Phrasea/Core/Service/Log/Monolog.php @@ -40,7 +40,7 @@ class Monolog extends ServiceAbstract implements ServiceInterface protected function init() { $options = $this->getOptions(); - + if (empty($options)) { throw new \Exception(sprintf("'%s' service options can not be empty", $this->name)); diff --git a/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php b/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php index 45b94cdae8..f4aafbdc73 100644 --- a/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php +++ b/lib/Alchemy/Phrasea/Core/Service/Orm/Doctrine.php @@ -37,7 +37,7 @@ class Doctrine extends ServiceAbstract implements ServiceInterface protected function init() { $options = $this->getOptions(); - + $config = new \Doctrine\ORM\Configuration(); $this->debug = !!$options["debug"]; diff --git a/lib/Alchemy/Phrasea/Core/Service/ServiceInterface.php b/lib/Alchemy/Phrasea/Core/Service/ServiceInterface.php index f6f68a28c7..50ac477436 100644 --- a/lib/Alchemy/Phrasea/Core/Service/ServiceInterface.php +++ b/lib/Alchemy/Phrasea/Core/Service/ServiceInterface.php @@ -25,7 +25,7 @@ interface ServiceInterface public function getDriver(); public function getOptions(); - + public function getMandatoryOptions(); } diff --git a/lib/Alchemy/Phrasea/Helper/Record/Edit.php b/lib/Alchemy/Phrasea/Helper/Record/Edit.php index 943a6e4707..bce8c9bcdd 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/Record/Edit.php @@ -578,7 +578,7 @@ class Edit extends RecordHelper $collection = \collection::get_from_base_id($record->get_base_id()); $collection->reset_stamp($record->get_record_id()); - + $record->write_metas(); if ($statbits != '') diff --git a/lib/Alchemy/Phrasea/Helper/User/Edit.php b/lib/Alchemy/Phrasea/Helper/User/Edit.php index 4161fcfade..972864e942 100644 --- a/lib/Alchemy/Phrasea/Helper/User/Edit.php +++ b/lib/Alchemy/Phrasea/Helper/User/Edit.php @@ -691,7 +691,7 @@ class Edit extends \Alchemy\Phrasea\Helper\Helper continue; } } - + foreach ($base_ids as $base_id) { if (!$ACL->has_access_to_base($base_id)) diff --git a/lib/Doctrine/Entities/Basket.php b/lib/Doctrine/Entities/Basket.php index 555d45b1a7..2b4d5a033b 100644 --- a/lib/Doctrine/Entities/Basket.php +++ b/lib/Doctrine/Entities/Basket.php @@ -26,7 +26,7 @@ class Basket const ELEMENTSORDER_NAT = 'nat'; const ELEMENTSORDER_DESC = 'desc'; const ELEMENTSORDER_ASC = 'asc'; - + /** * @var integer $id */ @@ -246,46 +246,46 @@ class Basket { return $this->elements; } - + public function getElementsByOrder($ordre) { if($ordre === self::ELEMENTSORDER_DESC) { $ret = new \Doctrine\Common\Collections\ArrayCollection(); $elements = $this->elements->toArray(); - + uasort($elements, 'self::setBEOrderDESC'); foreach($elements as $elem) { $ret->add($elem); } - + return $ret; } elseif($ordre === self::ELEMENTSORDER_ASC) { $ret = new \Doctrine\Common\Collections\ArrayCollection(); $elements = $this->elements->toArray(); - + uasort($elements, 'self::setBEOrderASC'); foreach($elements as $elem) { $ret->add($elem); } - - return $ret; + + return $ret; } - + return $this->elements; } - + private static function setBEOrderDESC($element1, $element2) { $total_el1 = 0; $total_el2 = 0; - + foreach($element1->getValidationDatas() as $datas) { if($datas->getAgreement() !== null) @@ -300,18 +300,19 @@ class Basket $total_el2 += $datas->getAgreement() ? 1 : 0; } } - + if($total_el1 === $total_el2) + return 0; - + return $total_el1 < $total_el2 ? 1 : -1; } - + private static function setBEOrderASC($element1, $element2) { $total_el1 = 0; $total_el2 = 0; - + foreach($element1->getValidationDatas() as $datas) { if($datas->getAgreement() !== null) @@ -326,10 +327,11 @@ class Basket $total_el2 += $datas->getAgreement() ? 0 : 1; } } - + if($total_el1 === $total_el2) + return 0; - + return $total_el1 < $total_el2 ? 1 : -1; } diff --git a/lib/classes/Feed/Entry/Adapter.class.php b/lib/classes/Feed/Entry/Adapter.class.php index db78a2a64c..95cdfe8e96 100644 --- a/lib/classes/Feed/Entry/Adapter.class.php +++ b/lib/classes/Feed/Entry/Adapter.class.php @@ -411,6 +411,7 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa public function get_content() { if ($this->items) + return $this->items; $rs = $this->retrieve_elements(); diff --git a/lib/classes/User/Query.class.php b/lib/classes/User/Query.class.php index 1be1de2966..d377b6491e 100644 --- a/lib/classes/User/Query.class.php +++ b/lib/classes/User/Query.class.php @@ -582,6 +582,7 @@ class User_Query implements User_QueryInterface public function get_total() { if ($this->total) + return $this->total; $conn = $this->appbox->get_connection(); @@ -742,6 +743,7 @@ class User_Query implements User_QueryInterface public function on_base_ids(Array $base_ids = null) { if (!$base_ids) + return $this; $this->bases_restrictions = true; @@ -766,6 +768,7 @@ class User_Query implements User_QueryInterface public function on_sbas_ids(Array $sbas_ids = null) { if (!$sbas_ids) + return $this; $this->sbas_restrictions = true; diff --git a/lib/classes/gatekeeper.class.php b/lib/classes/gatekeeper.class.php index c20974e1cd..eb997d6836 100644 --- a/lib/classes/gatekeeper.class.php +++ b/lib/classes/gatekeeper.class.php @@ -79,6 +79,7 @@ class gatekeeper $session = $appbox->get_session(); if (http_request::is_command_line()) + return; if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF'])) @@ -140,6 +141,7 @@ class gatekeeper break; case 'admin': if ($this->_script_name === 'runscheduler.php') + return; phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']); break; @@ -159,6 +161,7 @@ class gatekeeper return; case 'setup': if ($appbox->upgradeavailable()) + return; else phrasea::redirect('/login/'); @@ -275,6 +278,7 @@ class gatekeeper $parm = $request->get_parms('LOG'); if (is_null($parm["LOG"])) + return $this; try diff --git a/lib/classes/module/console/checkExtension.class.php b/lib/classes/module/console/checkExtension.class.php index f7c5571bc7..35fcfd9117 100644 --- a/lib/classes/module/console/checkExtension.class.php +++ b/lib/classes/module/console/checkExtension.class.php @@ -245,4 +245,4 @@ class module_console_checkExtension extends Command return 0; } -} \ No newline at end of file +} diff --git a/lib/classes/module/console/fieldsDelete.class.php b/lib/classes/module/console/fieldsDelete.class.php index 6d8693af53..b94f70c366 100644 --- a/lib/classes/module/console/fieldsDelete.class.php +++ b/lib/classes/module/console/fieldsDelete.class.php @@ -82,6 +82,7 @@ class module_console_fieldsDelete extends Command if($continue != 'y') { $output->writeln("Request canceled by user"); + return 1; } diff --git a/lib/classes/module/console/fieldsRename.class.php b/lib/classes/module/console/fieldsRename.class.php index 992dd7ae10..adc1a691f3 100644 --- a/lib/classes/module/console/fieldsRename.class.php +++ b/lib/classes/module/console/fieldsRename.class.php @@ -89,6 +89,7 @@ class module_console_fieldsRename extends Command if($continue != 'y') { $output->writeln("Request canceled by user"); + return 1; } diff --git a/lib/classes/module/console/sphinxGenerateSuggestion.class.php b/lib/classes/module/console/sphinxGenerateSuggestion.class.php index 42d504a437..40133e3559 100644 --- a/lib/classes/module/console/sphinxGenerateSuggestion.class.php +++ b/lib/classes/module/console/sphinxGenerateSuggestion.class.php @@ -60,19 +60,21 @@ class module_console_sphinxGenerateSuggestion extends Command $databox = databox::get_instance($sbas_id); $output->writeln("process Databox " . $databox->get_viewname() . " / $index\n"); - + if(!is_executable("/usr/local/bin/indexer")) { $output->writeln("'/usr/local/bin/indexer' is not executable"); + return 1; } - + if(!file_exists($tmp_file)) { $output->writeln(" file '".$tmp_file."' does not exist"); + return 1; } - + $cmd = '/usr/local/bin/indexer metadatas' . $index . ' --buildstops ' . $tmp_file . ' 1000000 --buildfreqs'; exec($cmd); diff --git a/lib/classes/unicode.class.php b/lib/classes/unicode.class.php index 46d8648a85..274d7f5b9d 100644 --- a/lib/classes/unicode.class.php +++ b/lib/classes/unicode.class.php @@ -1406,7 +1406,7 @@ class unicode { $regexp .= '\.'; } - + $regexp .= ']{1}/'; $string = $this->remove_diacritics($string); diff --git a/lib/unitTest/Alchemy/Phrasea/Controller/Admin/UsersTest.php b/lib/unitTest/Alchemy/Phrasea/Controller/Admin/UsersTest.php index 4e752c4920..863fb823e4 100644 --- a/lib/unitTest/Alchemy/Phrasea/Controller/Admin/UsersTest.php +++ b/lib/unitTest/Alchemy/Phrasea/Controller/Admin/UsersTest.php @@ -303,13 +303,13 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract $this->assertEquals("attachment; filename=export.txt", $response->headers->get("content-disposition")); } - + public function testResetRights() { $appbox = \appbox::get_instance(self::$core); $username = uniqid('user_'); $user = User_Adapter::create($appbox, $username, "test", $username . "@email.com", false); - + $user->ACL()->give_access_to_sbas(array_keys($appbox->get_databoxes())); foreach ($appbox->get_databoxes() as $databox) @@ -340,8 +340,8 @@ class ControllerUsersTest extends \PhraseanetWebTestCaseAuthenticatedAbstract break; } } -// - +// + $this->client->request('POST', '/users/rights/reset/', array('users' => $user->get_id())); $response = $this->client->getResponse(); $this->assertTrue($response->isOK()); diff --git a/templates/web/admin/editusers.twig b/templates/web/admin/editusers.twig index 33a2ffa4f1..3f54b7b53d 100644 --- a/templates/web/admin/editusers.twig +++ b/templates/web/admin/editusers.twig @@ -152,7 +152,7 @@ {% endfor %} - + @@ -579,7 +579,7 @@ $('#users_rights_form button#reset_rights').bind('click', function(){ if(confirm("{% trans'are you sure you want reset rights ?' %}")) { var users = $('#users_rights_form input[name="users"]').val(); - + $.ajax({ type: 'POST', url: '/admin/users/rights/reset/', @@ -608,6 +608,7 @@ $('#users_rights_form button#reset_rights').bind('click', function(){ $('#right-ajax').removeClass('loading').html(data); } }); + return false; } else @@ -618,5 +619,5 @@ $('#users_rights_form button#reset_rights').bind('click', function(){ }); } }); - - \ No newline at end of file + + diff --git a/templates/web/prod/WorkZone/Macros.twig b/templates/web/prod/WorkZone/Macros.twig index 325d72f17f..abffbb66ff 100644 --- a/templates/web/prod/WorkZone/Macros.twig +++ b/templates/web/prod/WorkZone/Macros.twig @@ -312,7 +312,7 @@ - + {% for basket_element in basket.getElementsByOrder(ordre) %}