diff --git a/lib/Alchemy/Phrasea/Application/Root.php b/lib/Alchemy/Phrasea/Application/Root.php index a06cde0cea..e5c6f0be79 100644 --- a/lib/Alchemy/Phrasea/Application/Root.php +++ b/lib/Alchemy/Phrasea/Application/Root.php @@ -36,12 +36,13 @@ return call_user_func(function() { $app->get('/', function() use ($app) { $browser = \Browser::getInstance(); - if ($browser->isMobile()) + if ($browser->isMobile()) { return $app->redirect("/login/?redirect=/lightbox"); - elseif ($browser->isNewGeneration()) + } elseif ($browser->isNewGeneration()) { return $app->redirect("/login/?redirect=/prod"); - else + } else { return $app->redirect("/login/?redirect=/client"); + } }); $app->get('/robots.txt', function() use ($app) { diff --git a/lib/Alchemy/Phrasea/Application/Setup.php b/lib/Alchemy/Phrasea/Application/Setup.php index 4b87160f29..d9ba55264b 100644 --- a/lib/Alchemy/Phrasea/Application/Setup.php +++ b/lib/Alchemy/Phrasea/Application/Setup.php @@ -56,10 +56,11 @@ return call_user_func(function() { $app->get('/', function() use ($app) { - if ($app['install'] === true) + if ($app['install'] === true) { return $app->redirect('/setup/installer/'); - if ($app['upgrade'] === true) + }if ($app['upgrade'] === true) { return $app->redirect('/setup/upgrader/'); + } }); diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php index afb51c6980..49691b7035 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Publications.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Publications.php @@ -83,8 +83,9 @@ class Publications implements ControllerProviderInterface $feed = new \Feed_Adapter($appbox, $id); $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - if ( ! $feed->is_owner($user)) + if ( ! $feed->is_owner($user)) { return $app->redirect('/admin/publications/feed/' . $id . '/?error=' . _('You are not the owner of this feed, you can not edit it')); + } $request = $app['request']; @@ -107,29 +108,35 @@ class Publications implements ControllerProviderInterface $feed = new \Feed_Adapter($appbox, $id); $user = \User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); - if ( ! $feed->is_owner($user)) + if ( ! $feed->is_owner($user)) { return new Response('ERROR:you are not allowed'); + } $request = $app["request"]; $fileData = $request->files->get("Filedata"); - if ($fileData['error'] !== 0) + if ($fileData['error'] !== 0) { return new Response('ERROR:error while upload'); + } $file = new \system_file($fileData['tmp_name']); - if ( ! in_array($file->get_mime(), array('image/jpeg', 'image/jpg', 'image/gif'))) + if ( ! in_array($file->get_mime(), array('image/jpeg', 'image/jpg', 'image/gif'))) { return new Response('ERROR:bad filetype'); + } - if ($file->getSize() > 200000) + if ($file->getSize() > 200000) { return new Response('ERROR:file too large'); + } $datas = $file->get_technical_datas(); - if ( ! isset($datas[\system_file::TC_DATAS_WIDTH]) || ! isset($datas[\system_file::TC_DATAS_HEIGHT])) + if ( ! isset($datas[\system_file::TC_DATAS_WIDTH]) || ! isset($datas[\system_file::TC_DATAS_HEIGHT])) { return new Response('ERROR:file is not square'); + } - if ($datas[\system_file::TC_DATAS_WIDTH] != $datas[\system_file::TC_DATAS_HEIGHT]) + if ($datas[\system_file::TC_DATAS_WIDTH] != $datas[\system_file::TC_DATAS_HEIGHT]) { return new Response('ERROR:file is not square'); + } $feed->set_icon($file); unlink($file->getPathname()); diff --git a/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php index 3fbbead3d6..cd7fd883a1 100644 --- a/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php +++ b/lib/Alchemy/Phrasea/Helper/Record/MoveCollection.php @@ -62,8 +62,9 @@ class MoveCollection extends RecordHelper { $this->available_destinations = array(); - if ( ! $this->is_possible) + if ( ! $this->is_possible) { return $this; + } $this->available_destinations = array_keys( $this->getCore()->getAuthenticatedUser()->ACL()->get_granted_base( diff --git a/lib/Doctrine/Entities/Basket.php b/lib/Doctrine/Entities/Basket.php index 879a5cb77d..fb8da591fe 100644 --- a/lib/Doctrine/Entities/Basket.php +++ b/lib/Doctrine/Entities/Basket.php @@ -291,8 +291,9 @@ class Basket } } - if ($total_el1 === $total_el2) + if ($total_el1 === $total_el2) { return 0; + } return $total_el1 < $total_el2 ? 1 : -1; } @@ -313,8 +314,9 @@ class Basket } } - if ($total_el1 === $total_el2) + if ($total_el1 === $total_el2) { return 0; + } return $total_el1 < $total_el2 ? 1 : -1; } diff --git a/lib/classes/ACL.class.php b/lib/classes/ACL.class.php index c14b37c804..ba2bd03ff8 100644 --- a/lib/classes/ACL.class.php +++ b/lib/classes/ACL.class.php @@ -121,8 +121,9 @@ class ACL implements cache_cacheableInterface $key = $record->get_serialize_key(); - if (array_key_exists($key, $this->_rights_records_document)) + if (array_key_exists($key, $this->_rights_records_document)) { return true; + } return false; } @@ -229,8 +230,9 @@ class ACL implements cache_cacheableInterface */ public function apply_model(User_Interface $template_user, Array $base_ids) { - if (count($base_ids) == 0) + if (count($base_ids) == 0) { return $this; + } $sbas_ids = array(); @@ -378,8 +380,9 @@ class ACL implements cache_cacheableInterface { $this->load_rights_bas(); - if ( ! $this->has_access_to_base($base_id)) + if ( ! $this->has_access_to_base($base_id)) { return false; + } if ($this->is_limited($base_id)) { return false; @@ -463,8 +466,9 @@ class ACL implements cache_cacheableInterface { $this->load_rights_bas(); - if ( ! $this->has_access_to_base($base_id)) + if ( ! $this->has_access_to_base($base_id)) { return false; + } return $this->_rights_bas[$base_id]['restrict_dwnld']; } @@ -479,8 +483,9 @@ class ACL implements cache_cacheableInterface { $this->load_rights_bas(); - if ( ! $this->has_access_to_base($base_id)) + if ( ! $this->has_access_to_base($base_id)) { return false; + } return (int) $this->_rights_bas[$base_id]['remain_dwnld']; } @@ -496,8 +501,9 @@ class ACL implements cache_cacheableInterface { $this->load_rights_bas(); - if ( ! $this->has_access_to_base($base_id)) + if ( ! $this->has_access_to_base($base_id)) { return false; + } $this->_rights_bas[$base_id]['remain_dwnld'] = $this->_rights_bas[$base_id]['remain_dwnld'] - (int) $n; @@ -535,14 +541,16 @@ class ACL implements cache_cacheableInterface { $this->load_rights_sbas(); - if ( ! isset($this->_rights_sbas[$sbas_id])) + if ( ! isset($this->_rights_sbas[$sbas_id])) { return false; + } if ( ! isset($this->_rights_sbas[$sbas_id][$right])) throw new Exception('This right does not exists'); - if ($this->_rights_sbas[$sbas_id][$right] === true) + if ($this->_rights_sbas[$sbas_id][$right] === true) { return true; + } return false; } @@ -556,8 +564,9 @@ class ACL implements cache_cacheableInterface public function get_mask_and($base_id) { $this->load_rights_bas(); - if ( ! $this->has_access_to_base($base_id)) + if ( ! $this->has_access_to_base($base_id)) { return false; + } return $this->_rights_bas[$base_id]['mask_and']; } @@ -571,8 +580,9 @@ class ACL implements cache_cacheableInterface public function get_mask_xor($base_id) { $this->load_rights_bas(); - if ( ! $this->has_access_to_base($base_id)) + if ( ! $this->has_access_to_base($base_id)) { return false; + } return $this->_rights_bas[$base_id]['mask_xor']; } @@ -698,8 +708,9 @@ class ACL implements cache_cacheableInterface protected function load_hd_grant() { - if ($this->_rights_records_preview) + if ($this->_rights_records_preview) { return $this; + } try { $tmp_rights = $this->get_data_from_cache(self::CACHE_RIGHTS_RECORDS); @@ -747,8 +758,9 @@ class ACL implements cache_cacheableInterface protected function load_rights_sbas() { - if ($this->_rights_sbas && $this->_global_rights) + if ($this->_rights_sbas && $this->_global_rights) { return $this; + } try { $this->_rights_sbas = $this->get_data_from_cache(self::CACHE_RIGHTS_SBAS); @@ -804,8 +816,9 @@ class ACL implements cache_cacheableInterface */ protected function load_rights_bas() { - if ($this->_rights_bas && $this->_global_rights && is_array($this->_limited)) + if ($this->_rights_bas && $this->_global_rights && is_array($this->_limited)) { return $this; + } try { $this->_rights_bas = $this->get_data_from_cache(self::CACHE_RIGHTS_BAS); @@ -1286,8 +1299,9 @@ class ACL implements cache_cacheableInterface $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); - if ( ! $row) + if ( ! $row) { return $this; + } $this->give_access_to_base(array($base_id_dest)); @@ -1445,8 +1459,10 @@ class ACL implements cache_cacheableInterface public function get_limits($base_id) { $this->load_rights_bas(); - if ( ! isset($this->_limited[$base_id])) + if ( ! isset($this->_limited[$base_id])) { return null; + } + return ($this->_limited[$base_id]); } diff --git a/lib/classes/API/OAuth2/Adapter.class.php b/lib/classes/API/OAuth2/Adapter.class.php index 7d2798ff9b..ece19af220 100644 --- a/lib/classes/API/OAuth2/Adapter.class.php +++ b/lib/classes/API/OAuth2/Adapter.class.php @@ -194,8 +194,9 @@ class API_OAuth2_Adapter extends OAuth2 try { $application = API_OAuth2_Application::load_from_client_id($this->appbox, $client_id); - if ($client_secret === NULL) + if ($client_secret === NULL) { return true; + } $crypted = $this->crypt_secret($client_secret, $application->get_nonce()); @@ -610,13 +611,16 @@ class API_OAuth2_Adapter extends OAuth2 $token_param = $this->getAccessTokenParams(); - if ($token_param === FALSE) // Access token was not provided + if ($token_param === FALSE) { // Access token was not provided return $exit_not_present ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_BAD_REQUEST, $realm, OAUTH2_ERROR_INVALID_REQUEST, 'The request is missing a required parameter, includes an unsupported parameter or parameter value, repeats the same parameter, uses more than one method for including an access token, or is otherwise malformed.', NULL, $scope) : FALSE; + } + // Get the stored token data (from the implementing subclass) $token = $this->getAccessToken($token_param); - if ($token === NULL) + if ($token === NULL) { return $exit_invalid ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_UNAUTHORIZED, $realm, OAUTH2_ERROR_INVALID_TOKEN, 'The access token provided is invalid.', NULL, $scope) : FALSE; + } if (isset($token['revoked']) && $token['revoked']) { return $exit_invalid ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_UNAUTHORIZED, $realm, OAUTH2_ERROR_INVALID_TOKEN, 'End user has revoked access to his personal datas for your application.', NULL, $scope) : FALSE; @@ -624,14 +628,15 @@ class API_OAuth2_Adapter extends OAuth2 if ($this->enable_expire) { // Check token expiration (I'm leaving this check separated, later we'll fill in better error messages) - if (isset($token["expires"]) && time() > $token["expires"]) + if (isset($token["expires"]) && time() > $token["expires"]) { return $exit_expired ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_UNAUTHORIZED, $realm, OAUTH2_ERROR_EXPIRED_TOKEN, 'The access token provided has expired.', NULL, $scope) : FALSE; + } } // Check scope, if provided // If token doesn't have a scope, it's NULL/empty, or it's insufficient, then throw an error - if ($scope && ( ! isset($token["scope"]) || ! $token["scope"] || ! $this->checkScope($scope, $token["scope"]))) + if ($scope && ( ! isset($token["scope"]) || ! $token["scope"] || ! $this->checkScope($scope, $token["scope"]))) { return $exit_scope ? $this->errorWWWAuthenticateResponseHeader(OAUTH2_HTTP_FORBIDDEN, $realm, OAUTH2_ERROR_INSUFFICIENT_SCOPE, 'The request requires higher privileges than provided by the access token.', NULL, $scope) : FALSE; - + } //save token's linked ses_id $this->session_id = $token['session_id']; $this->usr_id = $token['usr_id']; diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index b149fe1495..62d117f652 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -1116,6 +1116,7 @@ class API_V1_adapter extends API_V1_Abstract * @todo ajouter une option pour avoir les values serialisées * dans un cas multi */ + return array( 'meta_id' => $value->getId() , 'meta_structure_id' => $field->get_meta_struct_id() diff --git a/lib/classes/API/V1/result.class.php b/lib/classes/API/V1/result.class.php index 0e8717b4ec..8548c0cd71 100644 --- a/lib/classes/API/V1/result.class.php +++ b/lib/classes/API/V1/result.class.php @@ -112,8 +112,9 @@ class API_V1_result protected function parse_response_type() { - if (trim($this->request->get('callback')) !== '') + if (trim($this->request->get('callback')) !== '') { return $this->response_type = self::FORMAT_JSONP; + } $accept = $this->request->getAcceptableContentTypes(); $response_types = array(); diff --git a/lib/classes/Bridge/Api.class.php b/lib/classes/Bridge/Api.class.php index 717931e524..afce08c0cd 100644 --- a/lib/classes/Bridge/Api.class.php +++ b/lib/classes/Bridge/Api.class.php @@ -108,8 +108,10 @@ class Bridge_Api */ public function is_disabled() { - if ($this->disable_time === null) + if ($this->disable_time === null) { return false; + } + $date_obj = new DateTime(); if ($date_obj > $this->disable_time) { $this->enable(); diff --git a/lib/classes/Bridge/Api/Dailymotion.class.php b/lib/classes/Bridge/Api/Dailymotion.class.php index 1702f6c5e4..1d5b8ab5f3 100644 --- a/lib/classes/Bridge/Api/Dailymotion.class.php +++ b/lib/classes/Bridge/Api/Dailymotion.class.php @@ -647,14 +647,17 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I public function is_configured() { - if ( ! $this->registry->get('GV_dailymotion_api')) + if ( ! $this->registry->get('GV_dailymotion_api')) { return false; + } - if (trim($this->registry->get('GV_dailymotion_client_id')) === '') + if (trim($this->registry->get('GV_dailymotion_client_id')) === '') { return false; + } - if (trim($this->registry->get('GV_dailymotion_client_secret')) === '') + if (trim($this->registry->get('GV_dailymotion_client_secret')) === '') { return false; + } return true; } diff --git a/lib/classes/Bridge/Api/Flickr.class.php b/lib/classes/Bridge/Api/Flickr.class.php index 21684155cc..0a1753c3bd 100644 --- a/lib/classes/Bridge/Api/Flickr.class.php +++ b/lib/classes/Bridge/Api/Flickr.class.php @@ -353,8 +353,10 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf $response = $this->_api->executeMethod('flickr.photosets.addPhoto', $params); if ( ! $response->isOk()) { - if ($response->err_code === 3) //Already exists in photoset + if ($response->err_code === 3) { //Already exists in photoset return; + } + throw new Bridge_Exception_ApiConnectorRequestFailed(); } break; @@ -626,14 +628,17 @@ class Bridge_Api_Flickr extends Bridge_Api_Abstract implements Bridge_Api_Interf public function is_configured() { - if ( ! $this->registry->get('GV_flickr_api')) + if ( ! $this->registry->get('GV_flickr_api')) { return false; + } - if (trim($this->registry->get('GV_flickr_client_id')) === '') + if (trim($this->registry->get('GV_flickr_client_id')) === '') { return false; + } - if (trim($this->registry->get('GV_flickr_client_secret')) === '') + if (trim($this->registry->get('GV_flickr_client_secret')) === '') { return false; + } return true; } diff --git a/lib/classes/Bridge/Api/Flickr/Element.class.php b/lib/classes/Bridge/Api/Flickr/Element.class.php index 6a7be08913..bae1127c1f 100644 --- a/lib/classes/Bridge/Api/Flickr/Element.class.php +++ b/lib/classes/Bridge/Api/Flickr/Element.class.php @@ -98,8 +98,10 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface private function generate_page_url($entry) { - if (isset($entry["owner"]) && isset($entry["id"])) + if (isset($entry["owner"]) && isset($entry["id"])) { return sprintf("http://www.flickr.com/%ss/%s/%s/", $this->type, (string) $entry["owner"], (string) $entry["id"]); + } + return ""; } @@ -112,27 +114,30 @@ class Bridge_Api_Flickr_Element implements Bridge_Api_ElementInterface */ private function generate_thumb_url($entry, $size = '', $extension = '') { - if (isset($entry["url_t"])) + if (isset($entry["url_t"])) { return (string) $entry["url_t"]; + } - if ( ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"])) + if ( ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"]) || ! isset($entry["farm"])) { return ''; + } $farm = (string) $entry["farm"]; $server_id = (string) $entry["server"]; $id_photo = (string) $entry["id"]; $secret = (string) $entry["secret"]; - if (empty($size) && empty($extension)) + if (empty($size) && empty($extension)) { return sprintf('https://farm%s.static.flickr.com/%s/%s_%s.jpg', $farm, $server_id, $id_photo, $secret); - elseif ( ! empty($size) && ! empty($extension)) + } elseif ( ! empty($size) && ! empty($extension)) { return sprintf('https://farm%s.static.flickr.com/%s/%s_%s_%s.jpg', $farm, $server_id, $id_photo, $secret, $size); - elseif ( ! empty($size)) + } elseif ( ! empty($size)) { return sprintf('https://farm%s.static.flickr.com/%s/%s_%s_%s.jpg', $farm, $server_id, $id_photo, $secret, $size, '.jpg'); - elseif ( ! empty($extension)) + } elseif ( ! empty($extension)) { return sprintf('https://farm%s.static.flickr.com/%s/%s_%s_o.%s', $farm, $server_id, $id_photo, $secret, $extension); - else + } else { return ""; + } } /** diff --git a/lib/classes/Bridge/Api/Youtube.class.php b/lib/classes/Bridge/Api/Youtube.class.php index df9a0e8b5a..b2d86303a6 100644 --- a/lib/classes/Bridge/Api/Youtube.class.php +++ b/lib/classes/Bridge/Api/Youtube.class.php @@ -632,8 +632,9 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter $xml = simplexml_load_string($string); libxml_clear_errors(); - if ( ! $xml) + if ( ! $xml) { return false; + } if (isset($xml->HEAD) || isset($xml->head)) { return array(); @@ -793,14 +794,17 @@ class Bridge_Api_Youtube extends Bridge_Api_Abstract implements Bridge_Api_Inter public function is_configured() { - if ( ! $this->registry->get('GV_youtube_api')) + if ( ! $this->registry->get('GV_youtube_api')) { return false; + } - if (trim($this->registry->get('GV_youtube_client_id')) === '') + if (trim($this->registry->get('GV_youtube_client_id')) === '') { return false; + } - if (trim($this->registry->get('GV_youtube_dev_key')) === '') + if (trim($this->registry->get('GV_youtube_dev_key')) === '') { return false; + } return true; } diff --git a/lib/classes/Bridge/Api/Youtube/Element.class.php b/lib/classes/Bridge/Api/Youtube/Element.class.php index d3117ce940..a1913027f5 100644 --- a/lib/classes/Bridge/Api/Youtube/Element.class.php +++ b/lib/classes/Bridge/Api/Youtube/Element.class.php @@ -63,8 +63,9 @@ class Bridge_Api_Youtube_Element implements Bridge_Api_ElementInterface $video_thumbnails = $this->entry->getVideoThumbnails(); foreach ($video_thumbnails as $thumb) { - if (120 == $thumb['width'] && 90 == $thumb['height']) + if (120 == $thumb['width'] && 90 == $thumb['height']) { return $thumb['url']; + } } } diff --git a/lib/classes/Feed/Adapter.class.php b/lib/classes/Feed/Adapter.class.php index 3cb20977e3..f4161523de 100644 --- a/lib/classes/Feed/Adapter.class.php +++ b/lib/classes/Feed/Adapter.class.php @@ -130,8 +130,9 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea */ public function get_icon_url() { - if ($this->icon_url) + if ($this->icon_url) { return $this->icon_url; + } $url = '/skins/icons/rss32.gif'; diff --git a/lib/classes/Feed/Aggregate.class.php b/lib/classes/Feed/Aggregate.class.php index 1c169fb31c..11ca33edf6 100644 --- a/lib/classes/Feed/Aggregate.class.php +++ b/lib/classes/Feed/Aggregate.class.php @@ -83,8 +83,9 @@ class Feed_Aggregate extends Feed_Abstract implements Feed_Interface { $result = new Feed_Entry_Collection(); - if (count($this->feeds) === 0) + if (count($this->feeds) === 0) { return $result; + } $offset_start = (int) $offset_start; $how_many = $how_many > 20 ? 20 : (int) $how_many; @@ -117,8 +118,10 @@ class Feed_Aggregate extends Feed_Abstract implements Feed_Interface */ public function get_count_total_entries() { - if (count($this->feeds) === 0) + if (count($this->feeds) === 0) { return 0; + } + $sql = 'SELECT count(id) as number FROM feed_entries WHERE feed_id diff --git a/lib/classes/Feed/Entry/Adapter.class.php b/lib/classes/Feed/Entry/Adapter.class.php index 6949cd5830..b791bdfd5f 100644 --- a/lib/classes/Feed/Entry/Adapter.class.php +++ b/lib/classes/Feed/Entry/Adapter.class.php @@ -406,8 +406,9 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa */ public function get_content() { - if ($this->items) + if ($this->items) { return $this->items; + } $rs = $this->retrieve_elements(); $items = array(); diff --git a/lib/classes/Feed/Publisher/Adapter.class.php b/lib/classes/Feed/Publisher/Adapter.class.php index 711e025b6b..4123facd15 100644 --- a/lib/classes/Feed/Publisher/Adapter.class.php +++ b/lib/classes/Feed/Publisher/Adapter.class.php @@ -210,7 +210,9 @@ class Feed_Publisher_Adapter implements Feed_Publisher_Interface, cache_cacheabl { foreach ($feed->get_publishers() as $publisher) { if ($publisher->get_user()->get_id() === $user->get_id()) + { return $publisher; + } } throw new Exception_Feed_PublisherNotFound('Publisher not found'); } diff --git a/lib/classes/Feed/XML/Abstract.class.php b/lib/classes/Feed/XML/Abstract.class.php index 0519bdbc6c..572b5271ec 100644 --- a/lib/classes/Feed/XML/Abstract.class.php +++ b/lib/classes/Feed/XML/Abstract.class.php @@ -227,11 +227,13 @@ abstract class Feed_XML_Abstract $medium = strtolower($content->get_record()->get_type()); - if ( ! in_array($medium, array('image', 'audio', 'video'))) + if ( ! in_array($medium, array('image', 'audio', 'video'))) { return $this; + } - if ( ! $preview_permalink || ! $thumbnail_permalink) + if ( ! $preview_permalink || ! $thumbnail_permalink) { return $this; + } $group = $this->addTag($document, $item, 'media:group'); diff --git a/lib/classes/Feed/XML/Cooliris.class.php b/lib/classes/Feed/XML/Cooliris.class.php index d2c133a187..7647e5d82d 100644 --- a/lib/classes/Feed/XML/Cooliris.class.php +++ b/lib/classes/Feed/XML/Cooliris.class.php @@ -357,11 +357,13 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface $medium = strtolower($content->get_record()->get_type()); - if ( ! in_array($medium, array('image', 'audio', 'video'))) + if ( ! in_array($medium, array('image', 'audio', 'video'))) { return $this; + } - if ( ! $preview_permalink || ! $thumbnail_permalink) + if ( ! $preview_permalink || ! $thumbnail_permalink) { return $this; + } //add item node to channel node $item = $this->addTag($document, $node, 'item'); diff --git a/lib/classes/Session/Authentication/Native.class.php b/lib/classes/Session/Authentication/Native.class.php index 4293450b99..8fd7a43faa 100644 --- a/lib/classes/Session/Authentication/Native.class.php +++ b/lib/classes/Session/Authentication/Native.class.php @@ -260,8 +260,9 @@ class Session_Authentication_Native implements Session_Authentication_Interface $row_count = $stmt->rowCount(); $stmt->closeCursor(); - if ($row_count == 0) + if ($row_count == 0) { return $this; + } if ($this->captcha_challenge_result === true) { $sql = 'UPDATE badlog SET locked="0" WHERE (login=:login OR ip=:ip)'; diff --git a/lib/classes/Session/Handler.class.php b/lib/classes/Session/Handler.class.php index 34e7ffa1dc..914220ef35 100644 --- a/lib/classes/Session/Handler.class.php +++ b/lib/classes/Session/Handler.class.php @@ -79,8 +79,9 @@ class Session_Handler public function logout() { // $this->remove_cookies(); - if ( ! $this->is_authenticated()) + if ( ! $this->is_authenticated()) { return; + } $this->storage()->reset(); $this->close_phrasea_session(); @@ -240,12 +241,13 @@ class Session_Handler */ public static function get_cookie($name, $default_value = null) { - if (http_request::is_command_line() && isset(self::$_cookie[$name])) + if (http_request::is_command_line() && isset(self::$_cookie[$name])) { return self::$_cookie[$name]; - elseif ( ! http_request::is_command_line() && isset($_COOKIE[$name])) + } elseif ( ! http_request::is_command_line() && isset($_COOKIE[$name])) { return $_COOKIE[$name]; - elseif ($default_value !== null) + } elseif ($default_value !== null) { return $default_value; + } return null; } @@ -279,10 +281,11 @@ class Session_Handler else unset($_COOKIE[$name]); } - if ( ! http_request::is_command_line()) + if ( ! http_request::is_command_line()) { return setcookie($name, $value, $expire, '/', '', $https, $http_only); - else + } else { return true; + } } /** @@ -292,10 +295,11 @@ class Session_Handler */ public static function isset_cookie($name) { - if (http_request::is_command_line()) + if (http_request::is_command_line()) { return isset(self::$_cookie[$name]); - else - return isset($_COOKIE[$name]); + } + + return isset($_COOKIE[$name]); } public function renew_phrasea_session() @@ -417,8 +421,9 @@ class Session_Handler $basks = array(); $oldusr = self::get_cookie('invite-usr_id'); - if ($oldusr == $this->get_usr_id()) + if ($oldusr == $this->get_usr_id()) { return $this; + } $sql = 'SELECT sselcont_id, s.ssel_id FROM sselcont c, ssel s diff --git a/lib/classes/Setup/Upgrade.class.php b/lib/classes/Setup/Upgrade.class.php index d694a6ac29..477107faba 100644 --- a/lib/classes/Setup/Upgrade.class.php +++ b/lib/classes/Setup/Upgrade.class.php @@ -125,8 +125,10 @@ class Setup_Upgrade */ protected function get_percentage() { - if ($this->total_steps === 0) + if ($this->total_steps === 0) { return 1; + } + return round(max(min(($this->completed_steps / $this->total_steps), 1), 0), 2); } diff --git a/lib/classes/User/Adapter.class.php b/lib/classes/User/Adapter.class.php index 866a05bb30..491f1d1ea7 100644 --- a/lib/classes/User/Adapter.class.php +++ b/lib/classes/User/Adapter.class.php @@ -891,8 +891,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public static function get_usr_id_from_email($email) { - if (is_null($email)) + if (is_null($email)) { return false; + } $conn = connection::getPDOConnection(); $sql = 'SELECT usr_id FROM usr @@ -1260,8 +1261,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface protected function load_preferences() { - if ($this->_prefs) + if ($this->_prefs) { return $this; + } $registry = \registry::get_instance(); @@ -1484,8 +1486,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface { $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); - if ( ! $session->is_authenticated()) + if ( ! $session->is_authenticated()) { return; + } $ses_id = $session->get_ses_id(); $usr_id = $session->get_usr_id(); @@ -1733,8 +1736,10 @@ class User_Adapter implements User_Interface, cache_cacheableInterface public function get_nonce() { - if ($this->nonce) + if ($this->nonce) { return $this->nonce; + } + $nonce = false; $sql = 'SELECT nonce FROM usr WHERE usr_id = :usr_id '; diff --git a/lib/classes/User/Query.class.php b/lib/classes/User/Query.class.php index dbec3bf45d..a6fdab538a 100644 --- a/lib/classes/User/Query.class.php +++ b/lib/classes/User/Query.class.php @@ -540,8 +540,9 @@ class User_Query implements User_QueryInterface */ public function get_total() { - if ($this->total) + if ($this->total) { return $this->total; + } $conn = $this->appbox->get_connection(); @@ -698,8 +699,9 @@ class User_Query implements User_QueryInterface */ public function on_base_ids(Array $base_ids = null) { - if ( ! $base_ids) + if ( ! $base_ids) { return $this; + } $this->bases_restrictions = true; @@ -722,8 +724,9 @@ class User_Query implements User_QueryInterface */ public function on_sbas_ids(Array $sbas_ids = null) { - if ( ! $sbas_ids) + if ( ! $sbas_ids) { return $this; + } $this->sbas_restrictions = true; diff --git a/lib/classes/appbox.class.php b/lib/classes/appbox.class.php index 8f6faee102..6517288b4a 100644 --- a/lib/classes/appbox.class.php +++ b/lib/classes/appbox.class.php @@ -140,12 +140,14 @@ class appbox extends base } $custom_path.= $collection->get_base_id(); - if (is_null($pathfile)) + if (is_null($pathfile)) { return $this; + } $datas = file_get_contents($pathfile->getPathname()); - if (is_null($datas)) + if (is_null($datas)) { return $this; + } file_put_contents($file, $datas); file_put_contents($custom_path, $datas); @@ -190,12 +192,14 @@ class appbox extends base } $custom_path.= $pic_type . '_' . $databox->get_sbas_id(); - if (is_null($pathfile)) + if (is_null($pathfile)) { return $this; + } $datas = file_get_contents($pathfile->getPathname()); - if (is_null($datas)) + if (is_null($datas)) { return $this; + } file_put_contents($file, $datas); file_put_contents($custom_path, $datas); @@ -515,8 +519,9 @@ class appbox extends base */ public function get_databoxes() { - if ($this->databoxes) + if ($this->databoxes) { return $this->databoxes; + } $ret = array(); foreach ($this->retrieve_sbas_ids() as $sbas_id) { diff --git a/lib/classes/base.class.php b/lib/classes/base.class.php index fbc26cc165..035da5fe4e 100644 --- a/lib/classes/base.class.php +++ b/lib/classes/base.class.php @@ -76,8 +76,9 @@ abstract class base implements cache_cacheableInterface */ public function get_schema() { - if ($this->schema) + if ($this->schema) { return $this->schema; + } $this->load_schema(); @@ -223,9 +224,9 @@ abstract class base implements cache_cacheableInterface public function get_version() { - - if ($this->version) + if ($this->version) { return $this->version; + } $version = '0.0.0'; @@ -251,10 +252,11 @@ abstract class base implements cache_cacheableInterface public function upgradeavailable() { - if ($this->get_version()) + if ($this->get_version()) { return version_compare(\Alchemy\Phrasea\Core\Version::getNumber(), $this->get_version(), '>'); - else + } else { return true; + } } protected function upgradeDb($apply_patches, Setup_Upgrade &$upgrader) @@ -375,8 +377,9 @@ abstract class base implements cache_cacheableInterface */ protected function load_schema() { - if ($this->schema) + if ($this->schema) { return $this; + } $structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml"); diff --git a/lib/classes/caption/record.class.php b/lib/classes/caption/record.class.php index 87fadf7bce..c5f23f1fc0 100644 --- a/lib/classes/caption/record.class.php +++ b/lib/classes/caption/record.class.php @@ -203,8 +203,9 @@ class caption_record implements caption_interface, cache_cacheableInterface public function get_field($fieldname) { foreach ($this->get_fields() as $meta_struct_id => $field) { - if ($field->get_name() == $fieldname) + if ($field->get_name() == $fieldname) { return $field; + } } throw new \Exception('Field not found'); diff --git a/lib/classes/connection.class.php b/lib/classes/connection.class.php index 9f2ba604dd..b8fc8e6bbe 100755 --- a/lib/classes/connection.class.php +++ b/lib/classes/connection.class.php @@ -52,8 +52,10 @@ class connection public static function printLog() { $registry = registry::get_instance(); - if ( ! $registry->get('GV_debug')) + if ( ! $registry->get('GV_debug')) { return; + } + $totalTime = 0; foreach (self::$log as $entry) { @@ -109,9 +111,9 @@ class connection $name = 'appbox'; } elseif (is_int((int) $name)) { $name = (int) $name; - } - else + } else { return false; + } if ( ! isset(self::$_PDO_instance[$name])) { $hostname = $port = $user = $password = $dbname = false; @@ -149,8 +151,10 @@ class connection throw new Exception('Connection not available'); } } - if (array_key_exists($name, self::$_PDO_instance)) + if (array_key_exists($name, self::$_PDO_instance)) { return self::$_PDO_instance[$name]; + } + throw new Exception('Connection not available'); } diff --git a/lib/classes/connection/pdo.class.php b/lib/classes/connection/pdo.class.php index 15cc7ae698..72acf325c2 100644 --- a/lib/classes/connection/pdo.class.php +++ b/lib/classes/connection/pdo.class.php @@ -65,10 +65,11 @@ class connection_pdo extends connection_abstract implements connection_interface */ public function prepare($statement, $driver_options = array()) { - if ($this->registry->get('GV_debug')) + if ($this->registry->get('GV_debug')) { return new connection_pdoStatementDebugger(parent::prepare($statement, $driver_options)); - else + } else { return parent::prepare($statement, $driver_options); + } } /** diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index b1b312dfc8..0572f439bb 100644 --- a/lib/classes/databox.class.php +++ b/lib/classes/databox.class.php @@ -429,8 +429,9 @@ class databox extends base $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); - if ($row) + if ($row) { return self::get_instance((int) $row['sbas_id']); + } try { $sql = 'CREATE DATABASE `' . $dbname . '` @@ -664,8 +665,9 @@ class databox extends base } } } - if ($n > $limit) + if ($n > $limit) { return true; + } return false; } @@ -1151,8 +1153,10 @@ class databox extends base */ public function get_structure() { - if ($this->structure) + if ($this->structure) { return $this->structure; + } + $this->structure = $this->retrieve_structure(); return $this->structure; @@ -1187,8 +1191,9 @@ class databox extends base */ public function get_cterms() { - if ($this->cterms) + if ($this->cterms) { return $this->cterms; + } $sql = "SELECT value FROM pref WHERE prop='cterms'"; $stmt = $this->get_connection()->prepare($sql); @@ -1343,8 +1348,9 @@ class databox extends base public function get_cgus() { - if ($this->cgus) + if ($this->cgus) { return $this->cgus; + } $this->load_cgus(); diff --git a/lib/classes/databox/descriptionStructure.class.php b/lib/classes/databox/descriptionStructure.class.php index f2e2e42e2a..eb27e4f7b2 100644 --- a/lib/classes/databox/descriptionStructure.class.php +++ b/lib/classes/databox/descriptionStructure.class.php @@ -95,8 +95,9 @@ class databox_descriptionStructure implements IteratorAggregate { $name = databox_field::generateName($name); - if (isset($this->cache_name_id[$name])) + if (isset($this->cache_name_id[$name])) { return $this->elements[$this->cache_name_id[$name]]; + } foreach ($this->elements as $id => $meta) { if ($meta->get_name() === $name) { diff --git a/lib/classes/databox/status.class.php b/lib/classes/databox/status.class.php index 3dcfb72f43..46e8695d1d 100644 --- a/lib/classes/databox/status.class.php +++ b/lib/classes/databox/status.class.php @@ -62,8 +62,9 @@ class databox_status $sbas_params = phrasea::sbas_params(); $registry = registry::get_instance(); - if ( ! isset($sbas_params[$sbas_id])) + if ( ! isset($sbas_params[$sbas_id])) { return; + } $path = $this->path = $registry->get('GV_RootPath') . "config/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]); $url = $this->url = "/custom/status/" . urlencode($sbas_params[$sbas_id]["host"]) . "-" . urlencode($sbas_params[$sbas_id]["port"]) . "-" . urlencode($sbas_params[$sbas_id]["dbname"]); @@ -115,8 +116,9 @@ class databox_status public static function getDisplayStatus() { - if (self::$_statuses) + if (self::$_statuses) { return self::$_statuses; + } $appbox = appbox::get_instance(\bootstrap::getCore()); $session = $appbox->get_session(); @@ -243,8 +245,9 @@ class databox_status $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - if ( ! $user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) + if ( ! $user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) { return false; + } $status = self::getStatus($sbas_id); @@ -295,8 +298,9 @@ class databox_status $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - if ( ! $user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) + if ( ! $user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) { return false; + } $status = self::getStatus($sbas_id); @@ -372,15 +376,17 @@ class databox_status $session = $appbox->get_session(); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox); - if ( ! $user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) + if ( ! $user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) { return false; + } $status = self::getStatus($sbas_id); $switch = in_array($switch, array('on', 'off')) ? $switch : false; - if ( ! $switch) + if ( ! $switch) { return false; + } if ($status[$bit]['img_' . $switch]) { if (isset($status[$bit]['path_' . $switch])) diff --git a/lib/classes/deprecated/inscript.api.php b/lib/classes/deprecated/inscript.api.php index 5355724194..aaa1f43465 100644 --- a/lib/classes/deprecated/inscript.api.php +++ b/lib/classes/deprecated/inscript.api.php @@ -44,8 +44,9 @@ function giveMeBases($usr = null) $rsU = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - if (count($rsU) == 0) + if (count($rsU) == 0) { return null; + } foreach ($rsU as $rowU) { if ( ! isset($usrerRegis[$rowU['dbname']])) diff --git a/lib/classes/eventsmanager/broker.class.php b/lib/classes/eventsmanager/broker.class.php index e422f56307..9c0c2377ec 100644 --- a/lib/classes/eventsmanager/broker.class.php +++ b/lib/classes/eventsmanager/broker.class.php @@ -316,8 +316,9 @@ class eventsmanager_broker function read(Array $notifications, $usr_id) { - if (count($notifications) == 0) + if (count($notifications) == 0) { return false; + } $sql = 'UPDATE notifications SET unread="0" WHERE usr_id = :usr_id diff --git a/lib/classes/eventsmanager/notify/autoregister.class.php b/lib/classes/eventsmanager/notify/autoregister.class.php index d6414b4d0f..18bd0a2bcd 100644 --- a/lib/classes/eventsmanager/notify/autoregister.class.php +++ b/lib/classes/eventsmanager/notify/autoregister.class.php @@ -49,8 +49,9 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract $params = array_merge($default, $params); $base_ids = array_keys($params['autoregister']); - if (count($base_ids) == 0) + if (count($base_ids) == 0) { return; + } $mailColl = array(); @@ -261,8 +262,9 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract { $bool = false; $session = $this->appbox->get_session(); - if ( ! $session->is_authenticated() || ! login::register_enabled()) + if ( ! $session->is_authenticated() || ! login::register_enabled()) { return false; + } try { $user = User_Adapter::getInstance($session->get_usr_id(), $this->appbox); diff --git a/lib/classes/eventsmanager/notify/order.class.php b/lib/classes/eventsmanager/notify/order.class.php index c080c6ebd1..fd50ce7123 100644 --- a/lib/classes/eventsmanager/notify/order.class.php +++ b/lib/classes/eventsmanager/notify/order.class.php @@ -73,9 +73,9 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract } - if (count($users) == 0) + if (count($users) == 0) { return; - + } $dom_xml = new DOMDocument('1.0', 'UTF-8'); @@ -239,8 +239,9 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract { $bool = false; $session = $this->appbox->get_session(); - if ( ! $session->is_authenticated()) + if ( ! $session->is_authenticated()) { return false; + } try { $user = User_Adapter::getInstance($session->get_usr_id(), $this->appbox); diff --git a/lib/classes/eventsmanager/notify/register.class.php b/lib/classes/eventsmanager/notify/register.class.php index cbad8faf06..21033464f1 100644 --- a/lib/classes/eventsmanager/notify/register.class.php +++ b/lib/classes/eventsmanager/notify/register.class.php @@ -49,8 +49,9 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract $params = array_merge($default, $params); $base_ids = $params['demand']; - if (count($base_ids) == 0) + if (count($base_ids) == 0) { return; + } $mailColl = array(); @@ -267,8 +268,9 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract $bool = false; $session = $this->appbox->get_session(); - if ( ! $session->is_authenticated() || ! login::register_enabled()) + if ( ! $session->is_authenticated() || ! login::register_enabled()) { return false; + } try { $user = User_Adapter::getInstance($session->get_usr_id(), $this->appbox); diff --git a/lib/classes/eventsmanager/notify/validationdone.class.php b/lib/classes/eventsmanager/notify/validationdone.class.php index 9e403f79f9..dea099d2cb 100644 --- a/lib/classes/eventsmanager/notify/validationdone.class.php +++ b/lib/classes/eventsmanager/notify/validationdone.class.php @@ -212,8 +212,9 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract $bool = false; $session = $this->appbox->get_session(); - if ( ! $session->is_authenticated()) + if ( ! $session->is_authenticated()) { return false; + } try { $user = User_Adapter::getInstance($session->get_usr_id(), $this->appbox); diff --git a/lib/classes/ftpclient.class.php b/lib/classes/ftpclient.class.php index b9417b90e4..96c34a2794 100644 --- a/lib/classes/ftpclient.class.php +++ b/lib/classes/ftpclient.class.php @@ -169,8 +169,9 @@ class ftpclient public function mkdir($remote_directory) { $remote_directory = $this->get_absolute_path($remote_directory); - if (isset($this->cached_dirs[$remote_directory])) + if (isset($this->cached_dirs[$remote_directory])) { return $this; + } if ($this->debug) echo "Creation du dossier $remote_directory\n
"; @@ -311,8 +312,10 @@ class ftpclient { if ($this->debug) echo "Fermeture de la connexion\n
"; - if ( ! $this->connexion) + if ( ! $this->connexion) { return $this; + } + if ((ftp_close($this->connexion)) === false) { throw new Exception('Impossible de fermer la connexion'); } @@ -334,8 +337,9 @@ class ftpclient protected function get_absolute_path($file) { $file = str_replace('//', '/', $file); - if ($this->is_absolute_path($file)) + if ($this->is_absolute_path($file)) { return $file; + } $pwd = $this->add_end_slash($this->pwd()); @@ -346,8 +350,9 @@ class ftpclient { $path = trim($path); - if ($path == "" || $path == '/' || $path == '//') + if ($path == "" || $path == '/' || $path == '//') { return("/"); + } if (substr($path, -1, 1) != "/") $path .= "/"; diff --git a/lib/classes/gatekeeper.class.php b/lib/classes/gatekeeper.class.php index 2703dea0f3..be0d3b267e 100644 --- a/lib/classes/gatekeeper.class.php +++ b/lib/classes/gatekeeper.class.php @@ -77,8 +77,9 @@ class gatekeeper $appbox = appbox::get_instance($this->Core); $session = $appbox->get_session(); - if (http_request::is_command_line()) + if (http_request::is_command_line()) { return; + } if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF'])) { $this->_PHP_SELF = $_SERVER['PHP_SELF']; @@ -119,16 +120,18 @@ class gatekeeper case 'thesaurus2': if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php' || $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php' - || $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php') + || $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php') { return; + } phrasea::redirect('/login/?redirect=/thesaurus2'); break; case 'report': phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']); break; case 'admin': - if ($this->_script_name === 'runscheduler.php') + if ($this->_script_name === 'runscheduler.php') { return; + } phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']); break; case 'login': @@ -145,10 +148,11 @@ class gatekeeper case '': return; case 'setup': - if ($appbox->upgradeavailable()) + if ($appbox->upgradeavailable()) { return; - else + } else { phrasea::redirect('/login/'); + } break; default: phrasea::redirect('/login/'); @@ -246,8 +250,9 @@ class gatekeeper $session = $appbox->get_session(); $parm = $request->get_parms('LOG'); - if (is_null($parm["LOG"])) + if (is_null($parm["LOG"])) { return $this; + } try { if ($session->is_authenticated()) diff --git a/lib/classes/geonames.class.php b/lib/classes/geonames.class.php index 787e1b8d57..8f1ab9e795 100644 --- a/lib/classes/geonames.class.php +++ b/lib/classes/geonames.class.php @@ -91,8 +91,9 @@ class geonames $output = array(); $cityName = self::clean_input($cityName); - if (strlen($cityName) === 0) + if (strlen($cityName) === 0) { return $output; + } $registry = registry::get_instance(); $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') @@ -128,8 +129,9 @@ class geonames public function find_geoname_from_ip($ip) { - if (array_key_exists($ip, $this->cache_ips)) + if (array_key_exists($ip, $this->cache_ips)) { return $this->cache_ips[$ip]; + } $output = array( 'city' => '', diff --git a/lib/classes/http/query.class.php b/lib/classes/http/query.class.php index 718baa5ec0..c624af252c 100644 --- a/lib/classes/http/query.class.php +++ b/lib/classes/http/query.class.php @@ -25,11 +25,13 @@ class http_query */ public static function getHttpCodeFromUrl($url) { - if ( ! is_scalar($url)) + if ( ! is_scalar($url)) { return null; + } - if (trim($url) === '') + if (trim($url) === '') { return null; + } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); @@ -51,11 +53,14 @@ class http_query public static function getHttpHeaders($url) { - if ( ! is_scalar($url)) + if ( ! is_scalar($url)) { return null; + } - if (trim($url) === '') + if (trim($url) === '') { return null; + } + $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); @@ -82,11 +87,13 @@ class http_query */ public static function getUrl($url, $post_data = false) { - if ( ! is_scalar($url)) + if ( ! is_scalar($url)) { return null; + } - if (trim($url) === '') + if (trim($url) === '') { return null; + } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); diff --git a/lib/classes/http/request.class.php b/lib/classes/http/request.class.php index 015bcc3d4a..54473510ea 100644 --- a/lib/classes/http/request.class.php +++ b/lib/classes/http/request.class.php @@ -87,8 +87,10 @@ class http_request public function is_ajax() { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && - strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') + strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { return true; + } + return false; } diff --git a/lib/classes/lazaret.class.php b/lib/classes/lazaret.class.php index d3f28f722e..8879be3506 100644 --- a/lib/classes/lazaret.class.php +++ b/lib/classes/lazaret.class.php @@ -33,8 +33,9 @@ class lazaret extends set_abstract $base_ids = array_keys($user->ACL()->get_granted_base(array('canaddrecord'))); - if (count($base_ids) == 0) + if (count($base_ids) == 0) { return $this; + } $sql = "SELECT id, filepath, filename, base_id, uuid, errors, created_on, usr_id diff --git a/lib/classes/mail.class.php b/lib/classes/mail.class.php index b1f331487c..cf76db1df1 100644 --- a/lib/classes/mail.class.php +++ b/lib/classes/mail.class.php @@ -190,8 +190,9 @@ class mail $registry = registry::get_instance(); - if ( ! isset($to['email']) || ! PHPMailer::ValidateAddress($to['email'])) + if ( ! isset($to['email']) || ! PHPMailer::ValidateAddress($to['email'])) { return false; + } $mail = new PHPMailer(); diff --git a/lib/classes/media/abstract.class.php b/lib/classes/media/abstract.class.php index 991e65a558..4ea9e2a787 100644 --- a/lib/classes/media/abstract.class.php +++ b/lib/classes/media/abstract.class.php @@ -105,10 +105,11 @@ abstract class media_abstract */ public function get_orientation() { - if ($this->width > $this->height) + if ($this->width > $this->height) { return self::PAYSAGE; - else + } else { return self::PORTRAIT; + } } /** diff --git a/lib/classes/module/report/dashboard.class.php b/lib/classes/module/report/dashboard.class.php index 6a62ca75cf..99f0e0aab8 100644 --- a/lib/classes/module/report/dashboard.class.php +++ b/lib/classes/module/report/dashboard.class.php @@ -152,10 +152,11 @@ class module_report_dashboard implements module_report_dashboard_componentInterf */ public function isValid() { - if (isset($this->dashboard) && sizeof($this->dashboard) > 0) + if (isset($this->dashboard) && sizeof($this->dashboard) > 0) { return true; - else + } else { return false; + } } /** diff --git a/lib/classes/module/report/dashboard/feed.class.php b/lib/classes/module/report/dashboard/feed.class.php index ac9173c137..23a36e339f 100644 --- a/lib/classes/module/report/dashboard/feed.class.php +++ b/lib/classes/module/report/dashboard/feed.class.php @@ -228,10 +228,11 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI */ public function isValid() { - if (isset($this->report) && sizeof($this->report) > 0) + if (isset($this->report) && sizeof($this->report) > 0) { return true; - else + } else { return false; + } } } diff --git a/lib/classes/module/report/dashboard/group.class.php b/lib/classes/module/report/dashboard/group.class.php index ac8a32cc5b..108702e8da 100644 --- a/lib/classes/module/report/dashboard/group.class.php +++ b/lib/classes/module/report/dashboard/group.class.php @@ -69,10 +69,11 @@ class module_report_dashboard_group implements module_report_dashboard_component */ public function isValid() { - if (isset($this->group_dash) && sizeof($this->group_dash) > 0) + if (isset($this->group_dash) && sizeof($this->group_dash) > 0) { return true; - else + } else { return false; + } } /** diff --git a/lib/classes/module/report/dashboard/merge.class.php b/lib/classes/module/report/dashboard/merge.class.php index a9ecbe8aa3..668ccb6878 100644 --- a/lib/classes/module/report/dashboard/merge.class.php +++ b/lib/classes/module/report/dashboard/merge.class.php @@ -121,10 +121,11 @@ class module_report_dashboard_merge implements module_report_dashboard_component */ public function isValid() { - if (isset($this->sorted) && sizeof($this->sorted) > 0) + if (isset($this->sorted) && sizeof($this->sorted) > 0) { return true; - else + } else { return false; + } } /** diff --git a/lib/classes/module/report/dashboard/sort.class.php b/lib/classes/module/report/dashboard/sort.class.php index ea6bf5598f..f30f4af44e 100644 --- a/lib/classes/module/report/dashboard/sort.class.php +++ b/lib/classes/module/report/dashboard/sort.class.php @@ -122,10 +122,11 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI public function isValid() { - if (isset($this->arraySorted) && sizeof($this->arraySorted) > 0) + if (isset($this->arraySorted) && sizeof($this->arraySorted) > 0) { return true; - else + } else { return false; + } } public function getDash() @@ -135,8 +136,9 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI public function getTop($nbtop) { - if ( ! is_int($nbtop)) + if ( ! is_int($nbtop)) { return array(); + } $tmp = array(); diff --git a/lib/classes/module/report/sql.class.php b/lib/classes/module/report/sql.class.php index 618d30bba0..04fbd2f3c7 100644 --- a/lib/classes/module/report/sql.class.php +++ b/lib/classes/module/report/sql.class.php @@ -113,10 +113,11 @@ class module_report_sql public function getTransQuery($champ) { $tanslation = $this->filter->getCorFilter(); - if (array_key_exists($champ, $tanslation)) + if (array_key_exists($champ, $tanslation)) { return $tanslation[$champ]; - else + } else { return $champ; + } } /** diff --git a/lib/classes/module/report/sqlfilter.class.php b/lib/classes/module/report/sqlfilter.class.php index 1ff1d2513a..a28759210e 100644 --- a/lib/classes/module/report/sqlfilter.class.php +++ b/lib/classes/module/report/sqlfilter.class.php @@ -184,8 +184,9 @@ class module_report_sqlfilter $this->filter['collection'] = false; $coll_filter = array(); - if ($report->getUserId() == '') + if ($report->getUserId() == '') { return; + } $tab = explode(",", $report->getListCollId()); if (count($tab) > 0) { diff --git a/lib/classes/patch/310.class.php b/lib/classes/patch/310.class.php index 170ace5e47..c5a172504d 100644 --- a/lib/classes/patch/310.class.php +++ b/lib/classes/patch/310.class.php @@ -59,8 +59,9 @@ class patch_310 implements patchInterface $subdefgroups = $sx_structure->xpath('//subdefgroup'); - if (count($subdefgroups) > 0) + if (count($subdefgroups) > 0) { return; + } $subdefs = $sx_structure->xpath('/record/subdefs'); diff --git a/lib/classes/phrasea.class.php b/lib/classes/phrasea.class.php index 2986e1f519..7390168f1b 100644 --- a/lib/classes/phrasea.class.php +++ b/lib/classes/phrasea.class.php @@ -215,8 +215,9 @@ class phrasea public static function sbas_params() { - if (self::$_sbas_params) + if (self::$_sbas_params) { return self::$_sbas_params; + } $appbox = appbox::get_instance(\bootstrap::getCore()); try { @@ -247,8 +248,9 @@ class phrasea public static function guest_allowed() { $usr_id = User_Adapter::get_usr_id_from_login('invite'); - if ( ! $usr_id) + if ( ! $usr_id) { return false; + } $appbox = appbox::get_instance(\bootstrap::getCore()); $user = User_Adapter::getInstance($usr_id, $appbox); diff --git a/lib/classes/phraseadate.class.php b/lib/classes/phraseadate.class.php index a68210afad..a9ffa2ac91 100644 --- a/lib/classes/phraseadate.class.php +++ b/lib/classes/phraseadate.class.php @@ -68,8 +68,9 @@ class phraseadate */ public static function getPrettyString(DateTime $date = null) { - if (is_null($date)) + if (is_null($date)) { return null; + } $compareTo = new DateTime('now'); $diff = $compareTo->format('U') - $date->format('U'); diff --git a/lib/classes/queries.class.php b/lib/classes/queries.class.php index d63f09aebe..c1e7c37363 100644 --- a/lib/classes/queries.class.php +++ b/lib/classes/queries.class.php @@ -71,11 +71,13 @@ class queries $session = $appbox->get_session(); $registry = $appbox->get_registry(); - if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics_' . $session->get_I18n() . '.xml')) + if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics_' . $session->get_I18n() . '.xml')) { return true; + } - if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics.xml')) + if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics.xml')) { return true; + } return false; } @@ -239,8 +241,10 @@ class queries private static function hastopics(&$topics) { - foreach ($topics->topics as $subtopic) + foreach ($topics->topics as $subtopic) { return true; + } + return false; } diff --git a/lib/classes/record/exportElement.class.php b/lib/classes/record/exportElement.class.php index 97b691145c..07f177ae88 100644 --- a/lib/classes/record/exportElement.class.php +++ b/lib/classes/record/exportElement.class.php @@ -255,10 +255,11 @@ class record_exportElement extends record_adapter */ public function get_size($name = false) { - if ($name) + if ($name) { return $this->size[$name]; - else + } else { return $this->size; + } } /** diff --git a/lib/classes/record/preview.class.php b/lib/classes/record/preview.class.php index 3400fb0c29..fb46ba0b86 100644 --- a/lib/classes/record/preview.class.php +++ b/lib/classes/record/preview.class.php @@ -196,8 +196,9 @@ class record_preview extends record_adapter public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null) { - if ($this->train) + if ($this->train) { return $this->train; + } switch ($this->env) { case 'RESULT': @@ -257,8 +258,9 @@ class record_preview extends record_adapter */ public function get_title($highlight = '', searchEngine_adapter $search_engine = null) { - if ($this->title) + if ($this->title) { return $this->title; + } $this->title = collection::getLogo($this->get_base_id()) . ' '; diff --git a/lib/classes/recordutils/image.class.php b/lib/classes/recordutils/image.class.php index 0d57589644..4945ffafe5 100644 --- a/lib/classes/recordutils/image.class.php +++ b/lib/classes/recordutils/image.class.php @@ -74,13 +74,15 @@ class recordutils_image extends recordutils $registry = registry::get_instance(); $debug = false; - if ( ! $registry->get('GV_imagick')) + if ( ! $registry->get('GV_imagick')) { return false; + } $sbas_id = phrasea::sbasFromBas($bas); - if ( ! isset($sbas_id)) + if ( ! isset($sbas_id)) { return false; + } $connSbas = connection::getPDOConnection($sbas_id); @@ -114,8 +116,9 @@ class recordutils_image extends recordutils ); } - if ($domprefs === FALSE || $sxxml === FALSE) + if ($domprefs === FALSE || $sxxml === FALSE) { return false; + } $xpprefs = new DOMXPath($domprefs); @@ -124,8 +127,9 @@ class recordutils_image extends recordutils $pathTmpStamp = $registry->get('GV_RootPath') . 'tmp/' . time() . '-stamptmp_' . $file['file']; - if ( ! is_file($pathIn)) + if ( ! is_file($pathIn)) { return false; + } if ($file['type'] != 'image' || $xpprefs->query('/baseprefs/stamp')->length == 0) { @@ -151,8 +155,9 @@ class recordutils_image extends recordutils } // ------------- CACHING ! - if (is_file($pathOut)) + if (is_file($pathOut)) { return $pathOut; + } $fields = $xpprefs->query('/baseprefs/stamp/*/field'); for ($i = 0; $i < $fields->length; $i ++ ) { @@ -174,9 +179,9 @@ class recordutils_image extends recordutils $collname = phrasea::bas_names($bas); - if ( ! ($tailleimg = @getimagesize($pathIn))) + if ( ! ($tailleimg = @getimagesize($pathIn))) { return false; - + } $image_width = $tailleimg[0]; $image_height = $tailleimg[1]; @@ -326,8 +331,9 @@ class recordutils_image extends recordutils unlink($pathTmpStamp); - if (is_file($pathOut)) + if (is_file($pathOut)) { return $pathOut; + } return false; } @@ -346,8 +352,9 @@ class recordutils_image extends recordutils $sbas_id = phrasea::sbasFromBas($bas); - if ( ! isset($sbas_id)) + if ( ! isset($sbas_id)) { return false; + } $connSbas = connection::getPDOConnection($sbas_id); @@ -360,8 +367,9 @@ class recordutils_image extends recordutils $row = $stmt->fetch(PDO::FETCH_ASSOC); $stmt->closeCursor(); - if ( ! $row) + if ( ! $row) { return false; + } $file = array( 'type' => $row['type'] @@ -374,12 +382,13 @@ class recordutils_image extends recordutils $pathOut = $file['path'] . 'watermark_' . $file['file']; - if ( ! is_file($pathIn)) + if ( ! is_file($pathIn)) { return false; + } - if (is_file($pathOut)) + if (is_file($pathOut)) { return $pathOut; - + } if ($registry->get('GV_pathcomposite') && file_exists($registry->get('GV_RootPath') . 'config/wm/' . $bas)) { // si il y a un WM @@ -469,8 +478,9 @@ class recordutils_image extends recordutils } } - if (is_file($pathOut)) + if (is_file($pathOut)) { return $pathOut; + } return false; } diff --git a/lib/classes/registry.class.php b/lib/classes/registry.class.php index f3e3a7768d..4c5f1e2a35 100644 --- a/lib/classes/registry.class.php +++ b/lib/classes/registry.class.php @@ -131,10 +131,11 @@ class registry implements registryInterface if ( ! $this->cache->contains($key)) $this->load(); - if ( ! $this->cache->contains($key) && ! is_null($defaultvalue)) + if ( ! $this->cache->contains($key) && ! is_null($defaultvalue)) { return $defaultvalue; - else - return $this->cache->fetch($key); + } + + return $this->cache->fetch($key); } /** diff --git a/lib/classes/searchEngine/adapter/phrasea/engine.class.php b/lib/classes/searchEngine/adapter/phrasea/engine.class.php index 9a17ab8199..000a2273d6 100644 --- a/lib/classes/searchEngine/adapter/phrasea/engine.class.php +++ b/lib/classes/searchEngine/adapter/phrasea/engine.class.php @@ -607,7 +607,10 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract ); if ( ! isset($res['results']) || ! is_array($res['results'])) + { return array(); + } + $rs = $res['results']; $res = array_shift($rs); if ( ! isset($res['xml'])) { diff --git a/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php b/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php index 9b4be59b74..15cbd106b5 100644 --- a/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php +++ b/lib/classes/searchEngine/adapter/phrasea/queryParser.class.php @@ -118,11 +118,14 @@ class searchEngine_adapter_phrasea_queryParser $this->proposals = Array("QRY" => "", "BASES" => array(), "QUERIES" => array()); $this->phq = $this->mb_trim($phq, 'UTF-8'); - if ($this->phq != "") + if ($this->phq != "") { return($this->maketree(0)); - else { - if ($this->errmsg != "") + } else { + + if ($this->errmsg != "") { $this->errmsg .= sprintf("\\n"); + } + $this->errmsg .= _('qparser::la question est vide'); return(null); @@ -133,32 +136,37 @@ class searchEngine_adapter_phrasea_queryParser { switch ($tree["CLASS"]) { case "SIMPLE": - if (is_array($tree["VALUE"])) + if (is_array($tree["VALUE"])) { return(implode(" ", $tree["VALUE"])); - else + } else { + return($tree["VALUE"]); + } break; case "QSIMPLE": - if (is_array($tree["VALUE"])) + if (is_array($tree["VALUE"])) { return("\"" . implode(" ", $tree["VALUE"]) . "\""); - else + } else { return("\"" . $tree["VALUE"] . "\""); + } break; case "PHRASEA_KW_ALL": return($tree["VALUE"][0]); break; case "PHRASEA_KW_LAST": - if ($tree["PNUM"] !== null) + if ($tree["PNUM"] !== null) { return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]"); - else + } else { return($tree["VALUE"][0]); + } break; case "OPS": case "OPK": - if (isset($tree["PNUM"])) + if (isset($tree["PNUM"])) { return("(" . $this->astext($tree["LB"]) . " " . $tree["VALUE"] . "[" . $tree["PNUM"] . "] " . $this->astext($tree["RB"]) . ")"); - else + } else { return("(" . $this->astext($tree["LB"]) . " " . $tree["VALUE"] . " " . $this->astext($tree["RB"]) . ")"); + } break; } } @@ -176,10 +184,11 @@ class searchEngine_adapter_phrasea_queryParser function calc_complexity(&$tree) { if ($tree) { - if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") + if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") { return($tree["COMPLEXITY"] = $this->calc_complexity($tree["LB"]) + $this->calc_complexity($tree["RB"])); - else + } else { return($tree["COMPLEXITY"] = 1); + } } } @@ -338,8 +347,10 @@ class searchEngine_adapter_phrasea_queryParser function priority_opk(&$tree, $depth = 0) { - if ( ! $tree) + if ( ! $tree) { return; + } + if ($tree["CLASS"] == "OPK" && ($tree["LB"]["CLASS"] == "OPS" || $tree["LB"]["CLASS"] == "OPK")) { // on a un truc du genre ((a ou b) < 5), on le transforme en (a ou (b < 5)) $t = $tree["LB"]; @@ -347,16 +358,19 @@ class searchEngine_adapter_phrasea_queryParser $t["RB"] = $tree; $tree = $t; } - if (isset($tree["LB"])) + if (isset($tree["LB"])) { $this->priority_opk($tree["LB"], $depth + 1); - if (isset($tree["RB"])) + }if (isset($tree["RB"])) { $this->priority_opk($tree["RB"], $depth + 1); + } } function distrib_opk(&$tree, $depth = 0) { - if ( ! $tree) + if ( ! $tree) { return; + } + if ($tree["CLASS"] == "OPK" && ($tree["RB"]["CLASS"] == "OPS")) { // on a un truc du genre (a = (5 ou 6)), on le transforme en ((a = 5) ou (a = 6)) $tmp = array("CLASS" => $tree["CLASS"], @@ -380,8 +394,10 @@ class searchEngine_adapter_phrasea_queryParser function thesaurus2_apply(&$tree, $bid) { - if ( ! $tree) + if ( ! $tree) { return; + } + if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE") && isset($tree["SREF"]) && isset($tree["SREF"]["TIDS"])) { $tids = array(); foreach ($tree["SREF"]["TIDS"] as $tid) { @@ -440,8 +456,10 @@ class searchEngine_adapter_phrasea_queryParser { if ($depth == 0) $ret = $tree; - if ( ! $useThesaurus) + if ( ! $useThesaurus) { return; // full-text only : inchangé + } + if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE")) { if (isset($tree["CONTEXT"])) $copy = $this->_extendToThesaurus_Simple($tree, false, $keepfuzzy, $path); @@ -565,8 +583,9 @@ class searchEngine_adapter_phrasea_queryParser if ($depth == 0) $this->proposals["BASES"]["b$bid"] = array("BID" => $bid, "NAME" => $name, "TERMS" => array()); - if ( ! $tree) + if ( ! $tree) { return(0); + } $ambigus = 0; if ($tree["CLASS"] == "OPK" && $tree["NODETYPE"] == PHRASEA_OP_COLON) { @@ -686,17 +705,19 @@ class searchEngine_adapter_phrasea_queryParser return($tree["VALUE"][0]); break; case "PHRASEA_KW_LAST": - if ($tree["PNUM"] !== null) + if ($tree["PNUM"] !== null) { return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]"); - else + } else { return($tree["VALUE"][0]); + } break; case "OPS": case "OPK": - if (isset($tree["PNUM"])) + if (isset($tree["PNUM"])) { return('(' . $this->_queryAsHTML($tree["LB"], $depth + 1) . ' ' . $tree["VALUE"] . '[' . $tree["PNUM"] . '] ' . $this->_queryAsHTML($tree["RB"], $depth + 1) . ')'); - else + } else { return('(' . $this->_queryAsHTML($tree["LB"], $depth + 1) . ' ' . $tree["VALUE"] . ' ' . $this->_queryAsHTML($tree["RB"], $depth + 1) . ')'); + } break; } } @@ -841,10 +862,12 @@ class searchEngine_adapter_phrasea_queryParser function containsColonOperator(&$tree) { - if ( ! $tree) + if ( ! $tree) { return(false); - if ($tree["CLASS"] == "OPK" && $tree["NODETYPE"] == PHRASEA_OP_COLON && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE")) + } + if ($tree["CLASS"] == "OPK" && $tree["NODETYPE"] == PHRASEA_OP_COLON && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE")) { return(true); + } $ret = false; if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") { $ret |= $this->containsColonOperator($tree["LB"]); @@ -950,25 +973,29 @@ class searchEngine_adapter_phrasea_queryParser return($tree["VALUE"][0]); break; case "PHRASEA_KW_LAST": - if ($tree["PNUM"] !== null) + if ($tree["PNUM"] !== null) { return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]"); - else + } else { return($tree["VALUE"][0]); + } break; case "OPS": case "OPK": - if (isset($tree["PNUM"])) + if (isset($tree["PNUM"])) { return("(" . $this->astext_ambigu($tree["LB"], $ambiguites, $mouseCallback, $depth + 1) . " " . $tree["VALUE"] . "[" . $tree["PNUM"] . "] " . $this->astext_ambigu($tree["RB"], $ambiguites, $mouseCallback, $depth + 1) . ")"); - else + } else { return("(" . $this->astext_ambigu($tree["LB"], $ambiguites, $mouseCallback, $depth + 1) . " " . $tree["VALUE"] . " " . $this->astext_ambigu($tree["RB"], $ambiguites, $mouseCallback, $depth + 1) . ")"); + } break; } } function get_ambigu(&$tree, $mouseCallback = "void", $depth = 0) { - if ( ! $tree) + if ( ! $tree) { return(""); + } + unset($tree["DEPTH"]); if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") { $this->get_ambigu($tree["LB"], $mouseCallback, $depth + 1); @@ -987,16 +1014,19 @@ class searchEngine_adapter_phrasea_queryParser function set_default(&$tree, &$emptyw, $depth = 0) { - if ( ! $tree) + if ( ! $tree) { return(true); + } + if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") { if ($tree["CLASS"] == "OPS") { - if ( ! $this->set_default($tree["LB"], $emptyw, $depth + 1)) + if ( ! $this->set_default($tree["LB"], $emptyw, $depth + 1)) { return(false); - if ( ! $this->set_default($tree["RB"], $emptyw, $depth + 1)) + } + if ( ! $this->set_default($tree["RB"], $emptyw, $depth + 1)) { return(false); - } - else { // OPK ! + } + } else { // OPK ! // jy 20041223 : ne pas appliquer d'op. par def. derriere un op arith. // ex : "d < 1/2/2003" : grouper la liste "1","2","2004" en "mot" unique if ( ! $tree["LB"] || ($tree["LB"]["CLASS"] != "SIMPLE" && $tree["LB"]["CLASS"] != "QSIMPLE") || (is_array($tree["LB"]["VALUE"]) && count($tree["LB"]["VALUE"]) != 1)) { @@ -1473,10 +1503,10 @@ class searchEngine_adapter_phrasea_queryParser if ($inquote) { // quand on est entre guillements les tokens perdent leur signification $tree = $this->addtotree($tree, $t, $depth, $inquote); - if ( ! $tree) + if ( ! $tree) { return(null); - } - else { + } + } else { if ($depth <= 0) { // ')' : retour de récursivité if ($this->errmsg != "") $this->errmsg .= sprintf("\\n"); @@ -1492,10 +1522,10 @@ class searchEngine_adapter_phrasea_queryParser if ($inquote) { // quand on est entre guillements les tokens perdent leur signification $tree = $this->addtotree($tree, $t, $depth, $inquote); - if ( ! $tree) + if ( ! $tree) { return(null); - } - else { // '(' : appel récursif + } + } else { // '(' : appel récursif if ( ! $tree) $tree = $this->maketree($depth + 1); else { @@ -1515,8 +1545,9 @@ class searchEngine_adapter_phrasea_queryParser "RB" => $this->maketree($depth + 1)); } } - if ( ! $tree) + if ( ! $tree) { return(null); + } } break; case "TOK_VOID": @@ -1562,8 +1593,9 @@ class searchEngine_adapter_phrasea_queryParser "RB" => $this->maketree($depth + 1, true)); } } - if ( ! $tree) + if ( ! $tree) { return(null); + } } break; default: @@ -1573,8 +1605,9 @@ class searchEngine_adapter_phrasea_queryParser var_dump($tree); print("-------------------------\n"); } - if ( ! $tree) + if ( ! $tree) { return(null); + } break; } } @@ -1597,8 +1630,10 @@ class searchEngine_adapter_phrasea_queryParser print("-------------------------\n"); } - if ( ! $t) + if ( ! $t) { return($tree); + } + switch ($t["CLASS"]) { case "TOK_CONTEXT": // if($this->debug) @@ -1823,8 +1858,10 @@ class searchEngine_adapter_phrasea_queryParser function nexttoken($inquote = false) { - if ($this->phq == "") + if ($this->phq == "") { return(null); + } + switch ($c = substr($this->phq, 0, 1)) { case "<": case ">": @@ -1940,10 +1977,11 @@ class searchEngine_adapter_phrasea_queryParser // le délimiteur était une simple ponctuation, on le saute $this->phq = $this->mb_ltrim(mb_substr($this->phq, $i + 1, 99999, 'UTF-8'), 'UTF-8'); } - if ($t != "") + if ($t != "") { return(array("CLASS" => "TOK_WORD", "VALUE" => $t)); - else + } else { return(array("CLASS" => "TOK_VOID", "VALUE" => $t)); + } break; } } diff --git a/lib/classes/set/abstract.class.php b/lib/classes/set/abstract.class.php index 274aee6cbc..6d62f2f7bd 100644 --- a/lib/classes/set/abstract.class.php +++ b/lib/classes/set/abstract.class.php @@ -100,8 +100,10 @@ abstract class set_abstract implements IteratorAggregate public function __isset($key) { trigger_error("Unable to use magic method get for key $key"); - if (isset($this->$key)) + if (isset($this->$key)) { return true; + } + return false; } diff --git a/lib/classes/set/ordermanager.class.php b/lib/classes/set/ordermanager.class.php index adbef03889..23ab47c6f0 100644 --- a/lib/classes/set/ordermanager.class.php +++ b/lib/classes/set/ordermanager.class.php @@ -136,8 +136,9 @@ class set_ordermanager extends set_abstract { $comp = strcasecmp($a['usage'], $b['usage']); - if ($comp == 0) + if ($comp == 0) { return 0; + } return $comp < 0 ? -1 : 1; } @@ -152,8 +153,9 @@ class set_ordermanager extends set_abstract { $comp = strcasecmp($a['usr_display'], $b['usr_display']); - if ($comp == 0) + if ($comp == 0) { return 0; + } return $comp < 0 ? -1 : 1; } @@ -168,8 +170,9 @@ class set_ordermanager extends set_abstract { $comp = $b->format('U') - $a->format('U'); - if ($comp == 0) + if ($comp == 0) { return 0; + } return $comp < 0 ? -1 : 1; } diff --git a/lib/classes/setup.class.php b/lib/classes/setup.class.php index 60a5923fea..bddec87e62 100644 --- a/lib/classes/setup.class.php +++ b/lib/classes/setup.class.php @@ -268,12 +268,14 @@ class setup protected static function discover_binary($binary, array $look_here = array()) { - if (system_server::get_platform() == 'WINDOWS') + if (system_server::get_platform() == 'WINDOWS') { return null; + } foreach ($look_here as $place) { - if (is_executable($place)) + if (is_executable($place)) { return $place; + } } return exec(sprintf('which %s', $binary)); @@ -283,23 +285,24 @@ class setup { $registry = registry::get_instance(); - if ($registry->get('GV_h264_streaming') !== true) + if ($registry->get('GV_h264_streaming') !== true) { return; + } ?>

mod_auth_token configuration

Apache Server mods avalaibility

- +