mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-09 19:13:26 +00:00
Add curly braces
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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/');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@@ -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());
|
||||
|
@@ -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(
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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]);
|
||||
}
|
||||
|
||||
|
@@ -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'];
|
||||
|
@@ -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()
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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,28 +114,31 @@ 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 "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -63,10 +63,11 @@ 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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -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';
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
@@ -210,8 +210,10 @@ 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');
|
||||
}
|
||||
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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');
|
||||
|
@@ -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)';
|
||||
|
@@ -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,11 +281,12 @@ 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,9 +295,10 @@ 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]);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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 ';
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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,11 +252,12 @@ 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");
|
||||
|
||||
|
@@ -203,9 +203,10 @@ 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');
|
||||
}
|
||||
|
@@ -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');
|
||||
}
|
||||
|
||||
|
@@ -65,11 +65,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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]))
|
||||
|
@@ -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']]))
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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<br>";
|
||||
@@ -311,8 +312,10 @@ class ftpclient
|
||||
{
|
||||
if ($this->debug)
|
||||
echo "Fermeture de la connexion\n<br>";
|
||||
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 .= "/";
|
||||
|
@@ -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())
|
||||
|
@@ -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' => '',
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -105,11 +105,12 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -152,11 +152,12 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc return le dashboard
|
||||
|
@@ -228,11 +228,12 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -69,11 +69,12 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @desc return the results
|
||||
|
@@ -121,11 +121,12 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return <void>
|
||||
|
@@ -122,11 +122,12 @@ 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();
|
||||
|
||||
|
@@ -113,11 +113,12 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -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) {
|
||||
|
@@ -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');
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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');
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -255,11 +255,12 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@@ -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()) . ' ';
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -131,9 +131,10 @@ 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);
|
||||
}
|
||||
|
||||
|
@@ -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'])) {
|
||||
|
@@ -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,12 +184,13 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function astable2(&$out, &$tree, $depth = 0)
|
||||
{
|
||||
@@ -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))
|
||||
return(false);
|
||||
if ( ! $this->set_default($tree["RB"], $emptyw, $depth + 1))
|
||||
if ( ! $this->set_default($tree["LB"], $emptyw, $depth + 1)) {
|
||||
return(false);
|
||||
}
|
||||
else { // OPK !
|
||||
if ( ! $this->set_default($tree["RB"], $emptyw, $depth + 1)) {
|
||||
return(false);
|
||||
}
|
||||
} 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,9 +1545,10 @@ class searchEngine_adapter_phrasea_queryParser
|
||||
"RB" => $this->maketree($depth + 1));
|
||||
}
|
||||
}
|
||||
if ( ! $tree)
|
||||
if ( ! $tree) {
|
||||
return(null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "TOK_VOID":
|
||||
// ce token est entre guillemets : on le saute
|
||||
@@ -1562,9 +1593,10 @@ class searchEngine_adapter_phrasea_queryParser
|
||||
"RB" => $this->maketree($depth + 1, true));
|
||||
}
|
||||
}
|
||||
if ( ! $tree)
|
||||
if ( ! $tree) {
|
||||
return(null);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$tree = $this->addtotree($tree, $t, $depth, $inquote);
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -268,13 +268,15 @@ 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,8 +285,9 @@ class setup
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
|
||||
if ($registry->get('GV_h264_streaming') !== true)
|
||||
if ($registry->get('GV_h264_streaming') !== true) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<h1>mod_auth_token configuration </h1>
|
||||
<ul class="setup">
|
||||
@@ -643,8 +646,9 @@ class setup
|
||||
{
|
||||
$constraints = array();
|
||||
|
||||
if ( ! extension_loaded('gettext'))
|
||||
if ( ! extension_loaded('gettext')) {
|
||||
return new Setup_ConstraintsIterator($constraints);
|
||||
}
|
||||
|
||||
foreach (User_Adapter::$locales as $code => $language_name) {
|
||||
phrasea::use_i18n($code, 'test');
|
||||
@@ -670,15 +674,20 @@ class setup
|
||||
if ($is_flag)
|
||||
$current = strtolower($current);
|
||||
|
||||
if (($current === '' || $current === 'off' || $current === '0') && $is_flag)
|
||||
if ($value === 'off' || $value === '0' || $value === '')
|
||||
if (($current === '' || $current === 'off' || $current === '0') && $is_flag) {
|
||||
if ($value === 'off' || $value === '0' || $value === '') {
|
||||
return $current;
|
||||
if (($current === '1' || $current === 'on') && $is_flag)
|
||||
if ($value === 'on' || $value === '1')
|
||||
}
|
||||
}
|
||||
if (($current === '1' || $current === 'on') && $is_flag) {
|
||||
if ($value === 'on' || $value === '1') {
|
||||
return $current;
|
||||
if ($current === $value)
|
||||
}
|
||||
}
|
||||
if ($current === $value) {
|
||||
return $current;
|
||||
}
|
||||
}
|
||||
|
||||
public static function rollback(connection_pdo $conn, connection_pdo $connbas = null)
|
||||
{
|
||||
|
@@ -250,8 +250,10 @@ class system_file extends SplFileObject
|
||||
, 'x3f' => 'image/x-tika-sigma');
|
||||
|
||||
|
||||
if (in_array($this->get_mime(), $raws))
|
||||
if (in_array($this->get_mime(), $raws)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -275,9 +277,10 @@ class system_file extends SplFileObject
|
||||
$extension = isset($pi['extension']) ? $pi['extension'] : '';
|
||||
}
|
||||
|
||||
if ($lowercase)
|
||||
if ($lowercase) {
|
||||
return mb_strtolower($extension);
|
||||
else
|
||||
}
|
||||
|
||||
return $extension;
|
||||
}
|
||||
|
||||
@@ -452,8 +455,9 @@ class system_file extends SplFileObject
|
||||
|
||||
$this->technical_datas = array();
|
||||
|
||||
if ( ! is_executable($registry->get('GV_mplayer')))
|
||||
if ( ! is_executable($registry->get('GV_mplayer'))) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$cmd = $registry->get('GV_mplayer')
|
||||
. ' -identify '
|
||||
@@ -669,8 +673,9 @@ class system_file extends SplFileObject
|
||||
|
||||
public function read_uuid()
|
||||
{
|
||||
if ($this->uuid)
|
||||
if ($this->uuid) {
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
$datas = exiftool::extract_metadatas($this, exiftool::EXTRACT_XML_RDF);
|
||||
$domrdf = new DOMDocument();
|
||||
@@ -701,8 +706,9 @@ class system_file extends SplFileObject
|
||||
|
||||
public function is_new_in_base($sbas_id)
|
||||
{
|
||||
if ( ! $this->uuid)
|
||||
if ( ! $this->uuid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$connbas = connection::getPDOConnection($sbas_id);
|
||||
|
||||
@@ -764,11 +770,12 @@ class system_file extends SplFileObject
|
||||
|
||||
if (($v = $x->firstChild) && $v->nodeType == XML_TEXT_NODE) {
|
||||
$value = $base64_encoded ? base64_decode($v->nodeValue) : $v->nodeValue;
|
||||
if (uuid::is_valid($value))
|
||||
if (uuid::is_valid($value)) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -859,8 +866,10 @@ class system_file extends SplFileObject
|
||||
|
||||
public function get_phrasea_tech_field($field)
|
||||
{
|
||||
if (isset($this->phrasea_tech_field[$field]))
|
||||
if (isset($this->phrasea_tech_field[$field])) {
|
||||
return $this->phrasea_tech_field[$field];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1151,17 +1160,18 @@ class system_file extends SplFileObject
|
||||
if (mb_convert_encoding(mb_convert_encoding($s, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32') == $s) {
|
||||
$mac = mb_convert_encoding($s, 'windows-1252', 'UTF-8');
|
||||
for ($i = strlen($mac); $i;) {
|
||||
if (strpos($macchars, $mac[ -- $i]) !== false)
|
||||
if (strpos($macchars, $mac[ -- $i]) !== false) {
|
||||
return(iconv('MACINTOSH', 'UTF-8', $mac));
|
||||
}
|
||||
}
|
||||
|
||||
return($s);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
for ($i = strlen($s); $i;) {
|
||||
if (strpos($macchars, $s[ -- $i]) !== false)
|
||||
if (strpos($macchars, $s[ -- $i]) !== false) {
|
||||
return(iconv('MACINTOSH', 'UTF-8', $s));
|
||||
}
|
||||
}
|
||||
|
||||
return(iconv('windows-1252', 'UTF-8', $s));
|
||||
}
|
||||
|
@@ -42,8 +42,10 @@ class system_server
|
||||
*/
|
||||
public function is_nginx()
|
||||
{
|
||||
if (strpos($this->_server_software, 'nginx') !== false)
|
||||
if (strpos($this->_server_software, 'nginx') !== false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -54,8 +56,10 @@ class system_server
|
||||
*/
|
||||
public function is_lighttpd()
|
||||
{
|
||||
if (strpos($this->_server_software, 'lighttpd') !== false)
|
||||
if (strpos($this->_server_software, 'lighttpd') !== false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -66,8 +70,10 @@ class system_server
|
||||
*/
|
||||
public function is_apache()
|
||||
{
|
||||
if (strpos($this->_server_software, 'apache') !== false)
|
||||
if (strpos($this->_server_software, 'apache') !== false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -82,9 +88,11 @@ class system_server
|
||||
static $_system = NULL;
|
||||
if ($_system === NULL) {
|
||||
$_system = strtoupper(php_uname('s'));
|
||||
if ($_system == 'WINDOWS NT')
|
||||
|
||||
if ($_system == 'WINDOWS NT') {
|
||||
$_system = 'WINDOWS';
|
||||
}
|
||||
}
|
||||
|
||||
return($_system);
|
||||
}
|
||||
|
@@ -34,8 +34,10 @@ class task_manager
|
||||
|
||||
public function old_get_tasks($refresh = false)
|
||||
{
|
||||
if ($this->tasks && ! $refresh)
|
||||
if ($this->tasks && ! $refresh) {
|
||||
return $this->tasks;
|
||||
}
|
||||
|
||||
$sql = "SELECT task2.* FROM task2 ORDER BY task_id ASC";
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
$stmt->execute();
|
||||
@@ -62,8 +64,9 @@ class task_manager
|
||||
|
||||
public function get_tasks($refresh = false)
|
||||
{
|
||||
if ($this->tasks && ! $refresh)
|
||||
if ($this->tasks && ! $refresh) {
|
||||
return $this->tasks;
|
||||
}
|
||||
|
||||
$sql = "SELECT task2.* FROM task2 ORDER BY task_id ASC";
|
||||
$stmt = $this->appbox->get_connection()->prepare($sql);
|
||||
|
@@ -153,9 +153,9 @@ class task_period_apibridge extends task_appboxAbstract
|
||||
}
|
||||
$element->set_connector_status($connector_status);
|
||||
|
||||
if ($status === $previous_status)
|
||||
if ($status === $previous_status) {
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
switch ($status) {
|
||||
case Bridge_Element::STATUS_ERROR:
|
||||
|
@@ -546,8 +546,10 @@ class task_period_archive extends task_abstract
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
if ($row && $row['status'] == 'tostop')
|
||||
if ($row && $row['status'] == 'tostop') {
|
||||
return('NORECSTODO');
|
||||
}
|
||||
|
||||
sleep(2);
|
||||
$cold -= 2;
|
||||
}
|
||||
@@ -677,11 +679,12 @@ class task_period_archive extends task_abstract
|
||||
// on gere le magicfile
|
||||
if (($magicfile = trim((string) ($sxDotPhrasea->magicfile))) != '') {
|
||||
$magicmethod = strtoupper($sxDotPhrasea->magicfile['method']);
|
||||
if ($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile))
|
||||
if ($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile)) {
|
||||
return;
|
||||
elseif ($magicmethod == 'UNLOCK' && ! file_exists($path . '/' . $magicfile))
|
||||
} elseif ($magicmethod == 'UNLOCK' && ! file_exists($path . '/' . $magicfile)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// on gere le changement de collection
|
||||
if (($new_cid = $sxDotPhrasea['collection']) != '') {
|
||||
@@ -756,23 +759,25 @@ class task_period_archive extends task_abstract
|
||||
// on gere le magicfile
|
||||
if (($magicfile = trim((string) ($sxDotPhrasea->magicfile))) != '') {
|
||||
$magicmethod = strtoupper($sxDotPhrasea->magicfile['method']);
|
||||
if ($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile))
|
||||
if ($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile)) {
|
||||
return;
|
||||
elseif ($magicmethod == 'UNLOCK' && ! file_exists($path . '/' . $magicfile))
|
||||
} elseif ($magicmethod == 'UNLOCK' && ! file_exists($path . '/' . $magicfile)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (($file = $listFolder->read()) !== NULL) {
|
||||
// on gere le magicfile
|
||||
if (($magicfile = trim((string) ($sxDotPhrasea->magicfile))) != '') {
|
||||
$magicmethod = strtoupper($sxDotPhrasea->magicfile['method']);
|
||||
if ($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile))
|
||||
if ($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile)) {
|
||||
return;
|
||||
elseif ($magicmethod == 'UNLOCK' && ! file_exists($path . '/' . $magicfile))
|
||||
} elseif ($magicmethod == 'UNLOCK' && ! file_exists($path . '/' . $magicfile)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (($file = $listFolder->read()) !== NULL) {
|
||||
if ($this->isIgnoredFile($file))
|
||||
@@ -865,7 +870,6 @@ class task_period_archive extends task_abstract
|
||||
if ($n->getAttribute('isdir') == '1') {
|
||||
if (($grpSettings = $this->getGrpSettings($name)) !== FALSE) { // get 'caption', 'representation'
|
||||
// this is a grp folder, we check it
|
||||
|
||||
$dnl = $xpath->query('./file[@name=".grouping.xml"]', $n);
|
||||
if ($dnl->length == 1) {
|
||||
// this group is old (don't care about any linked files), just flag it
|
||||
|
@@ -199,8 +199,9 @@ class task_period_ftp extends task_appboxAbstract
|
||||
}
|
||||
|
||||
// si on doit changer le xml, on verifie qu'il est valide
|
||||
if ($parm["xml"] && ! @DOMDocument::loadXML($parm["xml"]))
|
||||
if ($parm["xml"] && ! @DOMDocument::loadXML($parm["xml"])) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
$sql = "";
|
||||
$params = array(':task_id' => $taskid);
|
||||
|
@@ -218,8 +218,9 @@ class task_period_ftpPull extends task_appboxAbstract
|
||||
}
|
||||
|
||||
// si on doit changer le xml, on verifie qu'il est valide
|
||||
if ($parm["xml"] && ! DOMDocument::loadXML($parm["xml"]))
|
||||
if ($parm["xml"] && ! DOMDocument::loadXML($parm["xml"])) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
$sql = "";
|
||||
$params = array(':task_id' => $taskid);
|
||||
|
@@ -17,8 +17,9 @@ class uuid
|
||||
*/
|
||||
public static function generate_v3($namespace, $name)
|
||||
{
|
||||
if ( ! self::is_valid($namespace))
|
||||
if ( ! self::is_valid($namespace)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get hexadecimal components of namespace
|
||||
$nhex = str_replace(array('-', '{', '}'), '', $namespace);
|
||||
@@ -82,8 +83,9 @@ class uuid
|
||||
*/
|
||||
public static function generate_v5($namespace, $name)
|
||||
{
|
||||
if ( ! self::is_valid($namespace))
|
||||
if ( ! self::is_valid($namespace)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get hexadecimal components of namespace
|
||||
$nhex = str_replace(array('-', '{', '}'), '', $namespace);
|
||||
|
@@ -66,6 +66,7 @@ if ( ! is_null($parm['token'])) {
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
||||
return;
|
||||
} catch (Exception $e) {
|
||||
?>
|
||||
@@ -95,6 +96,7 @@ if ( ! is_null($parm['token'])) {
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -272,9 +272,10 @@ function doUserConf($conf, $param)
|
||||
|
||||
return $new_conf;
|
||||
}
|
||||
else
|
||||
else {
|
||||
return $conf;
|
||||
}
|
||||
}
|
||||
|
||||
function displayListColumn($conf, $param, $twig)
|
||||
{
|
||||
|
@@ -318,9 +318,10 @@ function doUserConf($conf, $param)
|
||||
|
||||
return $new_conf;
|
||||
}
|
||||
else
|
||||
else {
|
||||
return $conf;
|
||||
}
|
||||
}
|
||||
|
||||
function displayListColumn($conf, $param, $twig)
|
||||
{
|
||||
|
@@ -108,11 +108,17 @@ class patch_th_2_0_3
|
||||
function fixRejected(connection_pdo &$connbas, &$node, $rejected)
|
||||
{
|
||||
global $debug;
|
||||
if ($node->nodeType != XML_ELEMENT_NODE)
|
||||
|
||||
if ($node->nodeType != XML_ELEMENT_NODE) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id = $node->getAttribute("id");
|
||||
if (substr($id, 0, 1) == "R")
|
||||
|
||||
if (substr($id, 0, 1) == "R") {
|
||||
$rejected = true;
|
||||
}
|
||||
|
||||
if ($rejected) {
|
||||
$newid = "R" . substr($id, 1);
|
||||
if ($newid != $id) {
|
||||
|
@@ -111,11 +111,17 @@ class patch_th_2_0_4
|
||||
function fixRejected(connection_pdo &$connbas, &$node, $rejected)
|
||||
{
|
||||
global $debug;
|
||||
if ($node->nodeType != XML_ELEMENT_NODE)
|
||||
|
||||
if ($node->nodeType != XML_ELEMENT_NODE) {
|
||||
return;
|
||||
}
|
||||
|
||||
$id = $node->getAttribute("id");
|
||||
if (substr($id, 0, 1) == "R")
|
||||
|
||||
if (substr($id, 0, 1) == "R") {
|
||||
$rejected = true;
|
||||
}
|
||||
|
||||
if ($rejected) {
|
||||
$newid = "R" . substr($id, 1);
|
||||
if ($newid != $id) {
|
||||
|
Reference in New Issue
Block a user