Fix CS lib/classes

This commit is contained in:
Romain Neutron
2013-01-29 16:39:02 +01:00
parent 53206af159
commit 4414892b91
108 changed files with 178 additions and 249 deletions

View File

@@ -176,7 +176,7 @@ class API_OAuth2_Account
*/ */
public function get_token() public function get_token()
{ {
if ( ! $this->token) { if (! $this->token) {
try { try {
$this->token = new API_OAuth2_Token($this->app['phraseanet.appbox'], $this); $this->token = new API_OAuth2_Token($this->app['phraseanet.appbox'], $this);
} catch (Exception_NotFound $e) { } catch (Exception_NotFound $e) {
@@ -262,7 +262,7 @@ class API_OAuth2_Account
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
if ( ! $row) { if (! $row) {
throw new Exception_NotFound(); throw new Exception_NotFound();
} }

View File

@@ -85,7 +85,7 @@ class API_OAuth2_Adapter extends OAuth2
/** /**
* *
* @param Application $app * @param Application $app
* @return API_OAuth2_Adapter * @return API_OAuth2_Adapter
*/ */
public function __construct(Application $app) public function __construct(Application $app)
@@ -418,7 +418,7 @@ class API_OAuth2_Adapter extends OAuth2
* check for valid client_id * check for valid client_id
* check for valid redirect_uri * check for valid redirect_uri
*/ */
if ( ! $input["client_id"]) { if (! $input["client_id"]) {
if ($input["redirect_uri"]) if ($input["redirect_uri"])
$this->errorDoRedirectUriCallback( $this->errorDoRedirectUriCallback(
$input["redirect_uri"], OAUTH2_ERROR_INVALID_CLIENT, NULL, NULL, $input["state"] $input["redirect_uri"], OAUTH2_ERROR_INVALID_CLIENT, NULL, NULL, $input["state"]
@@ -472,7 +472,7 @@ class API_OAuth2_Adapter extends OAuth2
/** /**
* Check response_type * Check response_type
*/ */
if ( ! $input["response_type"]) { if (! $input["response_type"]) {
$this->errorDoRedirectUriCallback($input["redirect_uri"], OAUTH2_ERROR_INVALID_REQUEST, 'Invalid response type.', NULL, $input["state"]); $this->errorDoRedirectUriCallback($input["redirect_uri"], OAUTH2_ERROR_INVALID_REQUEST, 'Invalid response type.', NULL, $input["state"]);
} }

View File

@@ -128,7 +128,7 @@ class API_OAuth2_Application
/** /**
* *
* @param Application $app * @param Application $app
* @param int $application_id * @param int $application_id
* @return API_OAuth2_Application * @return API_OAuth2_Application
*/ */
@@ -596,7 +596,7 @@ class API_OAuth2_Application
/** /**
* *
* @param Application $app * @param Application $app
* @param User_Adapter $user * @param User_Adapter $user
* @param type $name * @param type $name
* @return API_OAuth2_Application * @return API_OAuth2_Application
@@ -644,7 +644,7 @@ class API_OAuth2_Application
/** /**
* *
* @param Application $app * @param Application $app
* @param type $client_id * @param type $client_id
* @return API_OAuth2_Application * @return API_OAuth2_Application
*/ */

View File

@@ -135,7 +135,7 @@ class API_OAuth2_AuthCode
/** /**
* *
* @param Application $app * @param Application $app
* @param API_OAuth2_Account $account * @param API_OAuth2_Account $account
* @return array * @return array
*/ */
@@ -162,7 +162,7 @@ class API_OAuth2_AuthCode
/** /**
* *
* @param Application $app * @param Application $app
* @param API_OAuth2_Account $account * @param API_OAuth2_Account $account
* @param type $code * @param type $code
* @param int $expires * @param int $expires

View File

@@ -61,7 +61,7 @@ class API_OAuth2_RefreshToken
*/ */
public function get_account() public function get_account()
{ {
if ( ! $this->account) { if (! $this->account) {
$this->account = new API_OAuth2_Account($this->app, $this->account_id); $this->account = new API_OAuth2_Account($this->app, $this->account_id);
} }
@@ -96,7 +96,7 @@ class API_OAuth2_RefreshToken
/** /**
* *
* @param Application $app * @param Application $app
* @param API_OAuth2_Account $account * @param API_OAuth2_Account $account
* @return array * @return array
*/ */
@@ -121,7 +121,7 @@ class API_OAuth2_RefreshToken
/** /**
* *
* @param Application $app * @param Application $app
* @param API_OAuth2_Account $account * @param API_OAuth2_Account $account
* @param int $expires * @param int $expires
* @param type $refresh_token * @param type $refresh_token

View File

@@ -83,7 +83,7 @@ class API_V1_Log
/** /**
* *
* @param Application $app * @param Application $app
* @param Request $request * @param Request $request
* @param API_OAuth2_Account $account * @param API_OAuth2_Account $account
*/ */

View File

@@ -43,7 +43,7 @@ class API_V1_adapter extends API_V1_Abstract
/** /**
* API constructor * API constructor
* *
* @param Application $app The application context * @param Application $app The application context
* @return API_V1_adapter * @return API_V1_adapter
*/ */
public function __construct(Application $app) public function __construct(Application $app)
@@ -94,7 +94,7 @@ class API_V1_adapter extends API_V1_Abstract
/** /**
* Return an array of key-values informations about scheduler * Return an array of key-values informations about scheduler
* *
* @param Application $app The silex application * @param Application $app The silex application
* @return \API_V1_result * @return \API_V1_result
*/ */
public function get_scheduler(Application $app) public function get_scheduler(Application $app)
@@ -825,7 +825,7 @@ class API_V1_adapter extends API_V1_Abstract
/** /**
* Search for results * Search for results
* *
* @param Request $request * @param Request $request
* @return \API_V1_result * @return \API_V1_result
*/ */
public function search(Request $request) public function search(Request $request)
@@ -885,7 +885,7 @@ class API_V1_adapter extends API_V1_Abstract
$options = SearchEngineOptions::fromRequest($this->app, $request); $options = SearchEngineOptions::fromRequest($this->app, $request);
$offsetStart = (int) ($request->get('offset_start') ? : 0); $offsetStart = (int) ($request->get('offset_start') ? : 0);
$perPage = (int) $request->get('per_page') ? : 10; $perPage = (int) $request->get('per_page') ? : 10;
$query = (string) $request->request->get('query'); $query = (string) $request->request->get('query');

View File

@@ -313,7 +313,7 @@ class Bridge_Account
/** /**
* *
* @param Application $app * @param Application $app
* @param user_adapter $user * @param user_adapter $user
* @return Bridge_Account * @return Bridge_Account
*/ */

View File

@@ -59,7 +59,7 @@ class Bridge_Api
/** /**
* *
* @param Application $app * @param Application $app
* @param int $id * @param int $id
* @return Bridge_Api * @return Bridge_Api
*/ */
public function __construct(Application $app, $id) public function __construct(Application $app, $id)

View File

@@ -47,7 +47,7 @@ class Bridge_Api_Auth_Flickr extends Bridge_Api_Auth_Abstract implements Bridge_
*/ */
protected function get_api() protected function get_api()
{ {
if ( ! $this->_api) { if (! $this->_api) {
$this->_api = new Phlickr_Api( $this->_api = new Phlickr_Api(
$this->flickr_client_id, $this->flickr_client_id,
$this->flickr_client_secret $this->flickr_client_secret

View File

@@ -305,7 +305,7 @@ class Bridge_Api_Dailymotion extends Bridge_Api_Abstract implements Bridge_Api_I
), ),
'page' => ! $offset_start ? 1 : $offset_start); 'page' => ! $offset_start ? 1 : $offset_start);
//add quantity //add quantity
if ( ! ! $quantity) { if (! ! $quantity) {
$params["limit"] = $quantity; $params["limit"] = $quantity;
} }
$url = sprintf('/me/%ss', $object); $url = sprintf('/me/%ss', $object);

View File

@@ -75,7 +75,6 @@ class Bridge_Api_Flickr_Container implements Bridge_Api_ContainerInterface
*/ */
public function get_thumbnail($width = 120, $height = 90) public function get_thumbnail($width = 120, $height = 90)
{ {
return $this->thumbnail; return $this->thumbnail;
} }

View File

@@ -298,7 +298,7 @@ class Bridge_Element
*/ */
public function build_connector_element() public function build_connector_element()
{ {
if ( ! $this->connector_element) { if (! $this->connector_element) {
try { try {
$this->connector_element = $this->account->get_api()->get_element_from_id($this->dist_id, $this->type); $this->connector_element = $this->account->get_api()->get_element_from_id($this->dist_id, $this->type);
} catch (Exception $e) { } catch (Exception $e) {

View File

@@ -84,4 +84,3 @@ class DailymotionWithoutOauth2 extends Dailymotion
return $result['url']; return $result['url'];
} }
} }

View File

@@ -49,7 +49,7 @@ class Feed_Collection implements Feed_CollectionInterface, cache_cacheableInterf
/** /**
* *
* @param Application $app * @param Application $app
* @param User_Adapter $user * @param User_Adapter $user
* @return Feed_Collection * @return Feed_Collection
*/ */
@@ -102,7 +102,7 @@ class Feed_Collection implements Feed_CollectionInterface, cache_cacheableInterf
/** /**
* *
* @param Application $app * @param Application $app
* @return Feed_Collection * @return Feed_Collection
*/ */
public static function load_public_feeds(Application $app) public static function load_public_feeds(Application $app)

View File

@@ -177,7 +177,7 @@ class Feed_Publisher_Adapter implements Feed_Publisher_Interface, cache_cacheabl
/** /**
* *
* @param Application $app * @param Application $app
* @param User_Adapter $user * @param User_Adapter $user
* @param Feed_Adapter $feed * @param Feed_Adapter $feed
* @param boolean $owner * @param boolean $owner

View File

@@ -56,10 +56,10 @@ class Feed_TokenAggregate extends Feed_Token
*/ */
public function get_feed() public function get_feed()
{ {
if ( ! $this->feed) { if (! $this->feed) {
$this->feed = Feed_Aggregate::load_with_user($this->app, $this->get_user()); $this->feed = Feed_Aggregate::load_with_user($this->app, $this->get_user());
} }
return $this->feed; return $this->feed;
} }
} }

View File

@@ -231,7 +231,7 @@ abstract class Feed_XML_Abstract
return $this; return $this;
} }
if ( ! $preview_permalink || ! $thumbnail_permalink) { if (! $preview_permalink || ! $thumbnail_permalink) {
return $this; return $this;
} }

View File

@@ -360,7 +360,7 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface
return $this; return $this;
} }
if ( ! $preview_permalink || ! $thumbnail_permalink) { if (! $preview_permalink || ! $thumbnail_permalink) {
return $this; return $this;
} }

View File

@@ -38,7 +38,7 @@ class Session_Authentication_Guest implements Session_Authentication_Interface
/** /**
* *
* @param Application $app * @param Application $app
* @return Session_Authentication_Guest * @return Session_Authentication_Guest
*/ */
public function __construct(Application $app) public function __construct(Application $app)

View File

@@ -52,7 +52,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface
/** /**
* *
* @param Application $app * @param Application $app
* @param string $login * @param string $login
* @param string $password * @param string $password
* @return Session_Authentication_Native * @return Session_Authentication_Native

View File

@@ -42,7 +42,6 @@ class Session_Authentication_PersistentCookie implements Session_Authentication_
$this->app= $app; $this->app= $app;
$this->persistent_cookie = $persistent_cookie; $this->persistent_cookie = $persistent_cookie;
$dql = 'SELECT s FROM Entities\Session s $dql = 'SELECT s FROM Entities\Session s
WHERE s.token = :token'; WHERE s.token = :token';
@@ -50,7 +49,7 @@ class Session_Authentication_PersistentCookie implements Session_Authentication_
$query->setParameters(array('token' => $persistent_cookie)); $query->setParameters(array('token' => $persistent_cookie));
$session = $query->getOneOrNullResult(); $session = $query->getOneOrNullResult();
if ( ! $session) { if (! $session) {
throw new \Exception_Session_WrongToken('Persistent cookie value does not have any valid session'); throw new \Exception_Session_WrongToken('Persistent cookie value does not have any valid session');
} }

View File

@@ -63,7 +63,6 @@ class Session_Authentication_Token implements Session_Authentication_Interface
*/ */
public function signOn() public function signOn()
{ {
return $this->user; return $this->user;
} }
@@ -73,7 +72,6 @@ class Session_Authentication_Token implements Session_Authentication_Interface
*/ */
public function get_user() public function get_user()
{ {
return $this->user; return $this->user;
} }

View File

@@ -92,9 +92,9 @@ class Session_Logger
/** /**
* *
* @param databox $databox * @param databox $databox
* @param User_Adapter $user * @param User_Adapter $user
* @param Browser $browser * @param Browser $browser
* @return Session_Logger * @return Session_Logger
*/ */
public static function create(Application $app, databox $databox, Browser $browser) public static function create(Application $app, databox $databox, Browser $browser)

View File

@@ -1243,7 +1243,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_applied_template() public function get_applied_template()
{ {
return $this->applied_template; return $this->applied_template;
} }
@@ -1474,7 +1473,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$app['EM']->flush(); $app['EM']->flush();
} }
$usr_id = $app['phraseanet.user']->get_id(); $usr_id = $app['phraseanet.user']->get_id();
$user = User_Adapter::getInstance($usr_id, $app); $user = User_Adapter::getInstance($usr_id, $app);

View File

@@ -217,18 +217,18 @@ class User_Query implements User_QueryInterface
LEFT JOIN sbasusr ON (usr.usr_id = sbasusr.usr_id) LEFT JOIN sbasusr ON (usr.usr_id = sbasusr.usr_id)
WHERE 1 '; WHERE 1 ';
if ( ! $this->include_special_users) { if (! $this->include_special_users) {
$sql .= ' AND usr_login != "autoregister" $sql .= ' AND usr_login != "autoregister"
AND usr_login != "invite" '; AND usr_login != "invite" ';
} }
$sql .= ' AND usr_login NOT LIKE "(#deleted_%" '; $sql .= ' AND usr_login NOT LIKE "(#deleted_%" ';
if ( ! $this->include_invite) { if (! $this->include_invite) {
$sql .= ' AND usr.invite=0 '; $sql .= ' AND usr.invite=0 ';
} }
if ( ! $this->email_not_null) { if (! $this->email_not_null) {
$sql .= ' AND usr.usr_mail IS NOT NULL '; $sql .= ' AND usr.usr_mail IS NOT NULL ';
} }
@@ -714,7 +714,7 @@ class User_Query implements User_QueryInterface
*/ */
public function on_base_ids(Array $base_ids = null) public function on_base_ids(Array $base_ids = null)
{ {
if ( ! $base_ids) { if (! $base_ids) {
return $this; return $this;
} }
@@ -739,7 +739,7 @@ class User_Query implements User_QueryInterface
*/ */
public function on_sbas_ids(Array $sbas_ids = null) public function on_sbas_ids(Array $sbas_ids = null)
{ {
if ( ! $sbas_ids) { if (! $sbas_ids) {
return $this; return $this;
} }

View File

@@ -94,7 +94,7 @@ class appbox extends base
$media = $this->app['mediavorus']->guess($filename); $media = $this->app['mediavorus']->guess($filename);
if($media->getWidth() > 120 || $media->getHeight() > 24) { if ($media->getWidth() > 120 || $media->getHeight() > 24) {
$imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO); $imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO);
$imageSpec->setDimensions(120, 24); $imageSpec->setDimensions(120, 24);
} }
@@ -110,7 +110,7 @@ class appbox extends base
} catch (\MediaAlchemyst\Exception $e) { } catch (\MediaAlchemyst\Exception $e) {
} }
} else if ($pic_type === collection::PIC_PRESENTATION) { } elseif ($pic_type === collection::PIC_PRESENTATION) {
//resize collection logo //resize collection logo
$imageSpec = new ImageSpecification(); $imageSpec = new ImageSpecification();
$imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO); $imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO);

View File

@@ -153,7 +153,6 @@ class cache_databox
$connbas = \connection::getPDOConnection($app, $sbas_id); $connbas = \connection::getPDOConnection($app, $sbas_id);
$sql = 'SELECT distinct site_id as site_id $sql = 'SELECT distinct site_id as site_id
FROM clients FROM clients
WHERE site_id != :site_id'; WHERE site_id != :site_id';
@@ -181,7 +180,6 @@ class cache_databox
{ {
$connbas = $databox->get_connection(); $connbas = $databox->get_connection();
$sql = 'SELECT site_id FROM clients WHERE site_id = :site_id'; $sql = 'SELECT site_id FROM clients WHERE site_id = :site_id';
$stmt = $connbas->prepare($sql); $stmt = $connbas->prepare($sql);
$stmt->execute(array(':site_id' => $app['phraseanet.registry']->get('GV_ServerName'))); $stmt->execute(array(':site_id' => $app['phraseanet.registry']->get('GV_ServerName')));

View File

@@ -293,7 +293,7 @@ class caption_Field_Value implements cache_cacheableInterface
/* @var $value \caption_Field_Value */ /* @var $value \caption_Field_Value */
$caption_field_value->set_value($value); $caption_field_value->set_value($value);
if ( ! $vocabulary || ! $vocabularyId) { if (! $vocabulary || ! $vocabularyId) {
$caption_field_value->removeVocabulary(); $caption_field_value->removeVocabulary();
} else { } else {
$caption_field_value->setVocab($vocabulary, $vocabularyId); $caption_field_value->setVocab($vocabulary, $vocabularyId);
@@ -348,7 +348,7 @@ class caption_Field_Value implements cache_cacheableInterface
$tbranch = $this->databox_field->get_tbranch(); $tbranch = $this->databox_field->get_tbranch();
if ( ! $tbranch || ! $XPATH_thesaurus) { if (! $tbranch || ! $XPATH_thesaurus) {
return $value; return $value;
} }
@@ -402,7 +402,7 @@ class caption_Field_Value implements cache_cacheableInterface
} }
} }
} }
if ( ! $lngfound) { if (! $lngfound) {
list($term, $context) = $this->splitTermAndContext($fvalue); list($term, $context) = $this->splitTermAndContext($fvalue);
$term = str_replace(array("<em>", "</em>"), array("", ""), $term); $term = str_replace(array("<em>", "</em>"), array("", ""), $term);
$context = str_replace(array("<em>", "</em>"), array("", ""), $context); $context = str_replace(array("<em>", "</em>"), array("", ""), $context);

View File

@@ -369,7 +369,7 @@ class collection implements cache_cacheableInterface
{ {
$coll_id = phrasea::collFromBas($app, $base_id); $coll_id = phrasea::collFromBas($app, $base_id);
$sbas_id = phrasea::sbasFromBas($app, $base_id); $sbas_id = phrasea::sbasFromBas($app, $base_id);
if ( ! $sbas_id || ! $coll_id) { if (! $sbas_id || ! $coll_id) {
throw new Exception_Databox_CollectionNotFound(sprintf("Collection could not be found")); throw new Exception_Databox_CollectionNotFound(sprintf("Collection could not be found"));
} }
$databox = $app['phraseanet.appbox']->get_databox($sbas_id); $databox = $app['phraseanet.appbox']->get_databox($sbas_id);

View File

@@ -570,7 +570,7 @@ class databox extends base
*/ */
public function get_subdef_structure() public function get_subdef_structure()
{ {
if ( ! $this->subdef_struct) { if (! $this->subdef_struct) {
$this->subdef_struct = new databox_subdefsStructure($this); $this->subdef_struct = new databox_subdefsStructure($this);
} }
@@ -579,7 +579,7 @@ class databox extends base
public static function dispatch(Filesystem $filesystem, $repository_path, $date = false) public static function dispatch(Filesystem $filesystem, $repository_path, $date = false)
{ {
if ( ! $date) { if (! $date) {
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
} }

View File

@@ -63,7 +63,7 @@ class databox_cgu
$value = $cgus[$app['locale']]['value']; $value = $cgus[$app['locale']]['value'];
$userValidation = true; $userValidation = true;
if ( ! $home) { if (! $home) {
if ( ! $app['phraseanet.user']->ACL()->has_access_to_sbas($databox->get_sbas_id())) { if ( ! $app['phraseanet.user']->ACL()->has_access_to_sbas($databox->get_sbas_id())) {
continue; continue;
} }

View File

@@ -581,7 +581,7 @@ class databox_field implements cache_cacheableInterface
{ {
$this->Business = ! ! $boolean; $this->Business = ! ! $boolean;
if($this->Business) { if ($this->Business) {
$this->thumbtitle = '0'; $this->thumbtitle = '0';
} }
@@ -657,7 +657,7 @@ class databox_field implements cache_cacheableInterface
*/ */
protected static function checkMultiSeparator($separator, $multi) protected static function checkMultiSeparator($separator, $multi)
{ {
if ( ! $multi) { if (! $multi) {
return ''; return '';
} }
@@ -677,7 +677,7 @@ class databox_field implements cache_cacheableInterface
{ {
$this->thumbtitle = $value; $this->thumbtitle = $value;
if($this->thumbtitle != '0') { if ($this->thumbtitle != '0') {
$this->Business = false; $this->Business = false;
} }

View File

@@ -190,7 +190,7 @@ class databox_status
$set = true; $set = true;
} }
} }
if ( ! $set) { if (! $set) {
$stats[$bit][] = array( $stats[$bit][] = array(
'sbas' => array($sbas_id), 'sbas' => array($sbas_id),
'labeloff' => $props['labeloff'], 'labeloff' => $props['labeloff'],
@@ -202,7 +202,7 @@ class databox_status
} }
} }
if ( ! $set) { if (! $set) {
$stats[$bit] = array( $stats[$bit] = array(
array( array(
'sbas' => array($sbas_id), 'sbas' => array($sbas_id),
@@ -360,7 +360,7 @@ class databox_status
$switch = in_array($switch, array('on', 'off')) ? $switch : false; $switch = in_array($switch, array('on', 'off')) ? $switch : false;
if ( ! $switch) { if (! $switch) {
return false; return false;
} }
@@ -380,7 +380,7 @@ class databox_status
{ {
$switch = in_array($switch, array('on', 'off')) ? $switch : false; $switch = in_array($switch, array('on', 'off')) ? $switch : false;
if ( ! $switch) { if (! $switch) {
throw new Exception_InvalidArgument(); throw new Exception_InvalidArgument();
} }

View File

@@ -34,7 +34,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
public function count() public function count()
{ {
$n = 0; $n = 0;
foreach($this->AvSubdefs as $subdefs) { foreach ($this->AvSubdefs as $subdefs) {
$n += count($subdefs); $n += count($subdefs);
} }
@@ -84,7 +84,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
'flash' => array() 'flash' => array()
); );
if ( ! $sx_struct) { if (! $sx_struct) {
return $this; return $this;
} }
@@ -160,7 +160,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
. 'subdef[@name="' . $name . '"]' . 'subdef[@name="' . $name . '"]'
); );
for($i = 0; $i < $nodes->length; $i++) { for ($i = 0; $i < $nodes->length; $i++) {
$node = $nodes->item($i); $node = $nodes->item($i);
$parent = $node->parentNode; $parent = $node->parentNode;
$parent->removeChild($node); $parent->removeChild($node);
@@ -273,7 +273,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
$refNode = null; $refNode = null;
if ($nodes->length > 0) { if ($nodes->length > 0) {
for ($i = 0; $i < $nodes->length; $i ++ ) { for ($i = 0; $i < $nodes->length; $i ++) {
$refNode = $nodes->item($i)->nextSibling; $refNode = $nodes->item($i)->nextSibling;
$dom_group->removeChild($nodes->item($i)); $dom_group->removeChild($nodes->item($i));
} }

View File

@@ -157,7 +157,7 @@ function giveMeBases(Application $app, $usr = null)
$inscriptions[$sbas_id]['CollsNonactif'][$collection->get_coll_id()] = $lacgu; $inscriptions[$sbas_id]['CollsNonactif'][$collection->get_coll_id()] = $lacgu;
elseif ($usrerRegis[$databox->get_dbname()][$collection->get_coll_id()] === true) elseif ($usrerRegis[$databox->get_dbname()][$collection->get_coll_id()] === true)
$inscriptions[$sbas_id]['CollsRegistered'][$collection->get_coll_id()] = $lacgu; $inscriptions[$sbas_id]['CollsRegistered'][$collection->get_coll_id()] = $lacgu;
} elseif ( ! $cguSpec && $collInscript) {//ne va pas.. si l'inscriptio na la coll est explicitement non autorise, je refuse' } elseif (! $cguSpec && $collInscript) {//ne va pas.. si l'inscriptio na la coll est explicitement non autorise, je refuse'
$inscriptions[$sbas_id]['Colls'][$collection->get_coll_id()] = $collection->get_name(); $inscriptions[$sbas_id]['Colls'][$collection->get_coll_id()] = $collection->get_name();
} elseif ($cguSpec) { } elseif ($cguSpec) {
$inscriptions[$sbas_id]['CollsCGU'][$collection->get_coll_id()]['name'] = $collection->get_name(); $inscriptions[$sbas_id]['CollsCGU'][$collection->get_coll_id()]['name'] = $collection->get_name();

View File

@@ -202,7 +202,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
$receiver = Receiver::fromUser($to); $receiver = Receiver::fromUser($to);
$readyToSend = true; $readyToSend = true;
} catch (Exception $e) { } catch (Exception $e) {
} }
if ($readyToSend) { if ($readyToSend) {

View File

@@ -86,7 +86,7 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
do { do {
$results = $Query->limit($start, $perLoop)->execute()->get_results(); $results = $Query->limit($start, $perLoop)->execute()->get_results();
foreach ($results as $user_to_notif) { foreach ($results as $user_to_notif) {
/* @var $user_to_notif \User_Adapter */ /* @var $user_to_notif \User_Adapter */
$mailed = false; $mailed = false;

View File

@@ -73,7 +73,7 @@ class ftpclient
$done = true; $done = true;
} }
} }
if ( ! $done) { if (! $done) {
throw new Exception('Impossible de s\'authentifier sur le serveur FTP'); throw new Exception('Impossible de s\'authentifier sur le serveur FTP');
} }
@@ -312,7 +312,7 @@ class ftpclient
{ {
if ($this->debug) if ($this->debug)
echo "Fermeture de la connexion\n<br>"; echo "Fermeture de la connexion\n<br>";
if ( ! $this->connexion) { if (! $this->connexion) {
return $this; return $this;
} }
@@ -384,7 +384,7 @@ class ftpclient
$file = $this->add_end_slash($current_dir) . $info[8]; $file = $this->add_end_slash($current_dir) . $info[8];
$date = strtotime($info[6] . ' ' . $info[5] . ' ' . $info[7]); $date = strtotime($info[6] . ' ' . $info[5] . ' ' . $info[7]);
if ( ! $date) { if (! $date) {
$date = strtotime($info[6] . ' ' . $info[5] . ' ' . date('Y') . ' ' . $info[7]); $date = strtotime($info[6] . ' ' . $info[5] . ' ' . date('Y') . ' ' . $info[7]);
} }
@@ -396,4 +396,3 @@ class ftpclient
return $list; return $list;
} }
} }

View File

@@ -161,7 +161,6 @@ class gatekeeper
return $this; return $this;
} }
/** /**
* Checks if session is open * Checks if session is open
* Redirect if session is missing * Redirect if session is missing

View File

@@ -162,7 +162,7 @@ class http_request
} }
} }
} else { } else {
for ($i = 0; $i < $nargs; $i ++ ) { for ($i = 0; $i < $nargs; $i ++) {
$nom = func_get_arg($i); $nom = func_get_arg($i);
$parm[$nom] = isset($_GET[$nom]) ? $parm[$nom] = isset($_GET[$nom]) ?
$_GET[$nom] : (isset($_POST[$nom]) ? $_POST[$nom] : NULL); $_GET[$nom] : (isset($_POST[$nom]) ? $_POST[$nom] : NULL);

View File

@@ -223,7 +223,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
throw new Exception_Media_SubdefNotFound($this->name . ' not found'); throw new Exception_Media_SubdefNotFound($this->name . ' not found');
} }
if ( ! $row) { if (! $row) {
$this->find_substitute_file(); $this->find_substitute_file();
} }
@@ -529,14 +529,12 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
} }
try { try {
return $this->record return $this->record
->get_databox() ->get_databox()
->get_subdef_structure() ->get_subdef_structure()
->get_subdef($this->record->get_type(), $this->get_name()) ->get_subdef($this->record->get_type(), $this->get_name())
->getDevices(); ->getDevices();
} catch (\Exception_Databox_SubdefNotFound $e) { } catch (\Exception_Databox_SubdefNotFound $e) {
return array(); return array();
} }
} }
@@ -685,7 +683,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
if ( ! $row) { if (! $row) {
throw new \Exception_Media_SubdefNotFound('Require the real one'); throw new \Exception_Media_SubdefNotFound('Require the real one');
} }
@@ -719,6 +717,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
} }
unset($media); unset($media);
return $subdef; return $subdef;
} }
@@ -777,4 +776,3 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
return $databox->delete_data_from_cache($this->get_cache_key($option)); return $databox->delete_data_from_cache($this->get_cache_key($option));
} }
} }

View File

@@ -14,7 +14,6 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Service\Builder; use Alchemy\Phrasea\Core\Service\Builder;
/** /**

View File

@@ -14,7 +14,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Service\Builder; use Alchemy\Phrasea\Core\Service\Builder;
/** /**

View File

@@ -39,7 +39,6 @@ class module_console_schedulerStop extends Command
return 0; return 0;
} catch (\Exception $e) { } catch (\Exception $e) {
return 1; return 1;
} }

View File

@@ -98,7 +98,7 @@ class module_console_systemExport extends Command
$export_directory = realpath(substr($directory, 0, 1) === '/' ? $directory : getcwd() . '/' . $directory . '/'); $export_directory = realpath(substr($directory, 0, 1) === '/' ? $directory : getcwd() . '/' . $directory . '/');
if ( ! $export_directory) { if (! $export_directory) {
throw new Exception('Export directory does not exists or is not accessible'); throw new Exception('Export directory does not exists or is not accessible');
} }
@@ -147,7 +147,7 @@ class module_console_systemExport extends Command
} }
} }
if ( ! $go) { if (! $go) {
$output->writeln(sprintf("Collections not selected, bypassing ...")); $output->writeln(sprintf("Collections not selected, bypassing ..."));
continue; continue;
} }

View File

@@ -62,7 +62,7 @@ class module_console_systemMailCheck extends Command
{ {
$is_stopped = false; $is_stopped = false;
while ( ! $is_stopped) { while (! $is_stopped) {
$this->write_infos($email, $users, $output, $appbox); $this->write_infos($email, $users, $output, $appbox);
$dialog = $this->getHelperSet()->get('dialog'); $dialog = $this->getHelperSet()->get('dialog');

View File

@@ -114,4 +114,3 @@ class module_console_taskState extends Command
return $exitCode; return $exitCode;
} }
} }

View File

@@ -95,7 +95,6 @@ class module_console_taskrun extends Command
} }
} }
if ($input->getOption('verbose')) { if ($input->getOption('verbose')) {
$this->container['monolog']->pushHandler(new StreamHandler('php://stdout')); $this->container['monolog']->pushHandler(new StreamHandler('php://stdout'));
} }

View File

@@ -77,7 +77,7 @@ class module_report_activity extends module_report
{ {
$hours = array(); $hours = array();
for ($i = 0; $i < 24; $i ++ ) { for ($i = 0; $i < 24; $i ++) {
array_push($this->display, $i); array_push($this->display, $i);
$hours[$i] = 0; $hours[$i] = 0;
} }
@@ -362,7 +362,6 @@ class module_report_activity extends module_report
{ {
$this->title = _('report:: telechargements par jour'); $this->title = _('report:: telechargements par jour');
$s = new module_report_sql($this->app, $this); $s = new module_report_sql($this->app, $this);
$filter = $s->getFilters(); $filter = $s->getFilters();
$conn = $s->getConnBas(); $conn = $s->getConnBas();

View File

@@ -174,4 +174,3 @@ class module_report_connexion extends module_report
return (int) $row['nb']; return (int) $row['nb'];
} }
} }

View File

@@ -180,7 +180,7 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
*/ */
protected function getPlotLegendDay($dmin, $dmax = false) protected function getPlotLegendDay($dmin, $dmax = false)
{ {
if ( ! $dmax) { if (! $dmax) {
$date = new Datetime(); $date = new Datetime();
$dmax = $date->format('d-m-Y'); $dmax = $date->format('d-m-Y');
} else { } else {

View File

@@ -237,4 +237,3 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
} }
} }
} }

View File

@@ -94,4 +94,3 @@ class module_report_dashboard_group implements module_report_dashboard_component
return new module_report_dashboard_merge($this); return new module_report_dashboard_merge($this);
} }
} }

View File

@@ -205,4 +205,3 @@ class module_report_dashboard_merge implements module_report_dashboard_component
return new module_report_dashboard_sort($this); return new module_report_dashboard_sort($this);
} }
} }

View File

@@ -158,4 +158,3 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
return $tmp; return $tmp;
} }
} }

View File

@@ -272,4 +272,3 @@ class module_report_download extends module_report
return $array; return $array;
} }
} }

View File

@@ -127,4 +127,3 @@ class module_report_edit extends module_report
} }
} }
} }

View File

@@ -130,4 +130,3 @@ class module_report_push extends module_report
} }
} }
} }

View File

@@ -109,4 +109,3 @@ class module_report_question extends module_report
} }
} }
} }

View File

@@ -15,7 +15,7 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3 * @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com * @link www.phraseanet.com
*/ */
interface module_report_sqlReportinterface interface module_report_sqlReportInterface
{ {
public function buildSql(); public function buildSql();

View File

@@ -258,4 +258,3 @@ class module_report_sqlfilter
return; return;
} }
} }

View File

@@ -103,4 +103,3 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
return array('sql' => $sql, 'params' => $params); return array('sql' => $sql, 'params' => $params);
} }
} }

View File

@@ -130,4 +130,3 @@ class module_report_validate extends module_report
} }
} }
} }

View File

@@ -65,4 +65,3 @@ class patch_320 implements patchInterface
return true; return true;
} }
} }

View File

@@ -82,7 +82,7 @@ class patch_320f implements patchInterface
$feed = $this->get_feed($appbox, $user, $row['pub_restrict'], $row['homelink']); $feed = $this->get_feed($appbox, $user, $row['pub_restrict'], $row['homelink']);
if ( ! $feed instanceof Feed_Adapter) { if (! $feed instanceof Feed_Adapter) {
continue; continue;
} }

View File

@@ -128,4 +128,3 @@ class patch_361 implements patchInterface
return true; return true;
} }
} }

View File

@@ -63,7 +63,7 @@ class patch_370 implements patchInterface
$result = $stmt->fetch(PDO::FETCH_ASSOC); $result = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
if ( ! $result) { if (! $result) {
throw new \RuntimeException('Unable to find structure'); throw new \RuntimeException('Unable to find structure');
} }
@@ -90,4 +90,3 @@ class patch_370 implements patchInterface
return true; return true;
} }
} }

View File

@@ -70,4 +70,3 @@ class patch_370a3 implements patchInterface
} }
} }
} }

View File

@@ -89,4 +89,3 @@ class patch_370a4 implements patchInterface
return true; return true;
} }
} }

View File

@@ -83,4 +83,3 @@ class patch_370a5 implements patchInterface
return true; return true;
} }
} }

View File

@@ -196,4 +196,3 @@ class patch_370a6 implements patchInterface
$root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg); $root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg);
} }
} }

View File

@@ -70,6 +70,7 @@ class patch_370a7 implements patchInterface
if ($e->getCode() == '42S02') { if ($e->getCode() == '42S02') {
} }
return; return;
} }
@@ -148,7 +149,6 @@ class patch_370a7 implements patchInterface
$app['EM']->close(); $app['EM']->close();
} }
$stmt->closeCursor(); $stmt->closeCursor();
return; return;
@@ -160,4 +160,3 @@ class patch_370a7 implements patchInterface
$query->execute(); $query->execute();
} }
} }

View File

@@ -262,4 +262,3 @@ class patch_370a8 implements patchInterface
return true; return true;
} }
} }

View File

@@ -142,4 +142,3 @@ class patch_370a9 implements patchInterface
$app['phraseanet.configuration']->setConfigurations($configs); $app['phraseanet.configuration']->setConfigurations($configs);
} }
} }

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\Checker;
/** /**
* *
@@ -59,9 +58,8 @@ class patch_371 implements patchInterface
*/ */
public function apply(base $databox, Application $app) public function apply(base $databox, Application $app)
{ {
foreach($databox->get_meta_structure() as $databox_field) { foreach ($databox->get_meta_structure() as $databox_field) {
$databox_field->save(); $databox_field->save();
} }
} }
} }

View File

@@ -131,4 +131,3 @@ class patch_373 implements patchInterface
return true; return true;
} }
} }

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\Checker;
/** /**
* *
@@ -68,4 +67,3 @@ class patch_380 implements patchInterface
$app['phraseanet.configuration']->setConnexions($connexions); $app['phraseanet.configuration']->setConnexions($connexions);
} }
} }

View File

@@ -10,7 +10,6 @@
*/ */
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\Checker;
/** /**
* *
@@ -73,4 +72,3 @@ class patch_3802 implements patchInterface
return; return;
} }
} }

View File

@@ -116,4 +116,3 @@ class patch_3803 implements patchInterface
} }
} }

View File

@@ -81,4 +81,3 @@ class patch_3804 implements patchInterface
return false; return false;
} }
} }

View File

@@ -211,7 +211,7 @@ class phraseadate
$patfound = false; $patfound = false;
foreach ($paterns as $pat => $idx) { foreach ($paterns as $pat => $idx) {
if (substr($format, 0, ($l = strlen($pat))) == $pat) { if (substr($format, 0, ($l = strlen($pat))) == $pat) {
for ($i = 0; $i < $l; $i ++ ) { for ($i = 0; $i < $l; $i ++) {
$bal_out = ""; $bal_out = "";
if (isset($tc[$idx + $i])) { if (isset($tc[$idx + $i])) {
foreach ($tc[$idx + $i]["bals"] as $b) { foreach ($tc[$idx + $i]["bals"] as $b) {
@@ -226,7 +226,7 @@ class phraseadate
break; break;
} }
} }
if ( ! $patfound) { if (! $patfound) {
$strdate .= $format[0]; $strdate .= $format[0];
$format = substr($format, 1); $format = substr($format, 1);
} }

View File

@@ -28,7 +28,7 @@ class queries
if (file_exists(__DIR__ . '/../../config/topics/topics_' . $I18N . '.xml')) if (file_exists(__DIR__ . '/../../config/topics/topics_' . $I18N . '.xml'))
$xmlTopics = __DIR__ . '/../../config/topics/topics_' . $I18N . '.xml'; $xmlTopics = __DIR__ . '/../../config/topics/topics_' . $I18N . '.xml';
if ( ! $xmlTopics) { if (! $xmlTopics) {
if (file_exists(__DIR__ . '/../../config/topics/topics.xml')) { if (file_exists(__DIR__ . '/../../config/topics/topics.xml')) {
$xmlTopics = __DIR__ . '/../../config/topics/topics.xml'; $xmlTopics = __DIR__ . '/../../config/topics/topics.xml';
} }
@@ -171,7 +171,7 @@ class queries
</table> </table>
' . _('client::recherche: dans les categories') . '<br/>'; ' . _('client::recherche: dans les categories') . '<br/>';
for ($i = 0; $i <= $maxdepth; $i ++ ) { for ($i = 0; $i <= $maxdepth; $i ++) {
$out .= '<p id="divTopic_' . $i . '" style="margin:0px;margin-bottom:5px;" > $out .= '<p id="divTopic_' . $i . '" style="margin:0px;margin-bottom:5px;" >
<select style="width:100%;" id="popTopic_' . $i . '" name="popTopic_' . $i . '" onchange="chgPopTopic(' . ($i + 1) . ');"> <select style="width:100%;" id="popTopic_' . $i . '" name="popTopic_' . $i . '" onchange="chgPopTopic(' . ($i + 1) . ');">
</select> </select>

View File

@@ -226,9 +226,9 @@ class random
/** /**
* Get the validation token for one user and one validation basket * Get the validation token for one user and one validation basket
* *
* @param integer $userId * @param integer $userId
* @param integer $basketId * @param integer $basketId
* @return string The desired token * @return string The desired token
* @throws \Exception_NotFound * @throws \Exception_NotFound
*/ */
public static function getValidationToken(Application $app, $userId, $basketId) public static function getValidationToken(Application $app, $userId, $basketId)
@@ -250,7 +250,7 @@ class random
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
if ( ! $row) { if (! $row) {
throw new \Exception_NotFound('Token not found'); throw new \Exception_NotFound('Token not found');
} }

View File

@@ -13,10 +13,7 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\SearchEngine\SearchEngineInterface; use Alchemy\Phrasea\SearchEngine\SearchEngineInterface;
use Doctrine\ORM\EntityManager; use Doctrine\ORM\EntityManager;
use MediaVorus\Media\MediaInterface; use MediaVorus\Media\MediaInterface;
use Monolog\Logger;
use MediaAlchemyst\Alchemyst;
use MediaVorus\MediaVorus; use MediaVorus\MediaVorus;
use Symfony\Component\Filesystem\Filesystem;
/** /**
* *

View File

@@ -1296,7 +1296,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
/** /**
* *
* @param File $file * @param File $file
* @return \record_adapter * @return \record_adapter
*/ */
public static function createFromFile(File $file, Application $app) public static function createFromFile(File $file, Application $app)

View File

@@ -172,7 +172,7 @@ class record_exportElement extends record_adapter
$downloadable_settings = $subdef->is_downloadable(); $downloadable_settings = $subdef->is_downloadable();
if ( ! $downloadable_settings || $go_dl[$class] === false) { if (! $downloadable_settings || $go_dl[$class] === false) {
continue; continue;
} }
@@ -233,7 +233,7 @@ class record_exportElement extends record_adapter
*/ */
private function add_count($name, $size) private function add_count($name, $size)
{ {
if ( ! $this->size) { if (! $this->size) {
$objectsize = array(); $objectsize = array();
} else } else
$objectsize = $this->size; $objectsize = $this->size;

View File

@@ -95,7 +95,7 @@ class record_preview extends record_adapter
switch ($env) { switch ($env) {
case "RESULT": case "RESULT":
if(null === $search_engine) { if (null === $search_engine) {
throw new \LogicException('Search Engine should be provided'); throw new \LogicException('Search Engine should be provided');
} }
@@ -329,7 +329,7 @@ class record_preview extends record_adapter
AND d.record_id = :record_id '; AND d.record_id = :record_id ';
$params = array(':record_id' => $this->get_record_id()); $params = array(':record_id' => $this->get_record_id());
if ( ! $report) { if (! $report) {
$sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")'; $sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")';
$params[':usr_id'] = $this->app['phraseanet.user']->get_id(); $params[':usr_id'] = $this->app['phraseanet.user']->get_id();
$params[':site'] = $this->app['phraseanet.registry']->get('GV_sit'); $params[':site'] = $this->app['phraseanet.registry']->get('GV_sit');
@@ -376,7 +376,7 @@ class record_preview extends record_adapter
} }
if ( ! in_array($row['final'], $tab[$hour][$site][$action][$row['usr_id']]['final'])) { if ( ! in_array($row['final'], $tab[$hour][$site][$action][$row['usr_id']]['final'])) {
if($action == 'collection') { if ($action == 'collection') {
$tab[$hour][$site][$action][$row['usr_id']]['final'][] = phrasea::baseFromColl($this->get_sbas_id(), $row['final'], $this->app); $tab[$hour][$site][$action][$row['usr_id']]['final'][] = phrasea::baseFromColl($this->get_sbas_id(), $row['final'], $this->app);
} else { } else {
$tab[$hour][$site][$action][$row['usr_id']]['final'][] = $row['final']; $tab[$hour][$site][$action][$row['usr_id']]['final'][] = $row['final'];

View File

@@ -41,7 +41,6 @@ class recordutils
public function binary_datas($type, $bas, $rec, $usr = false, $ses = false) public function binary_datas($type, $bas, $rec, $usr = false, $ses = false)
{ {
return false; return false;
} }
} }

View File

@@ -109,7 +109,7 @@ class recordutils_image extends recordutils
} }
$vars = $xpprefs->query('/baseprefs/stamp/*/var'); $vars = $xpprefs->query('/baseprefs/stamp/*/var');
for ($i = 0; $i < $vars->length; $i ++ ) { for ($i = 0; $i < $vars->length; $i ++) {
$varval = ''; $varval = '';
$n = $vars->item($i); $n = $vars->item($i);
switch (strtoupper($n->getAttribute('name'))) { switch (strtoupper($n->getAttribute('name'))) {
@@ -131,7 +131,7 @@ class recordutils_image extends recordutils
} }
$fields = $xpprefs->query('/baseprefs/stamp/*/field'); $fields = $xpprefs->query('/baseprefs/stamp/*/field');
for ($i = 0; $i < $fields->length; $i ++ ) { for ($i = 0; $i < $fields->length; $i ++) {
$fldval = ''; $fldval = '';
$n = $fields->item($i); $n = $fields->item($i);
$fieldname = $n->getAttribute('name'); $fieldname = $n->getAttribute('name');
@@ -211,7 +211,7 @@ class recordutils_image extends recordutils
$txtblock = array(); $txtblock = array();
$texts = $xpprefs->query('/baseprefs/stamp/text'); $texts = $xpprefs->query('/baseprefs/stamp/text');
$fontsize = "100%"; $fontsize = "100%";
for ($i = 0; $i < $texts->length; $i ++ ) { for ($i = 0; $i < $texts->length; $i ++) {
if (($tmpfontsize = trim($texts->item($i)->getAttribute('size'))) != '') { if (($tmpfontsize = trim($texts->item($i)->getAttribute('size'))) != '') {
if (substr($tmpfontsize, -1) == '%') if (substr($tmpfontsize, -1) == '%')
$tmpfontsize = (int) ($tmpfontsize * $image_width / 4000); $tmpfontsize = (int) ($tmpfontsize * $image_width / 4000);
@@ -308,7 +308,7 @@ class recordutils_image extends recordutils
/** /**
* *
* @param \media_subdef $subdef * @param \media_subdef $subdef
* @return boolean|string * @return boolean|string
*/ */
public static function watermark(Application $app, \media_subdef $subdef) public static function watermark(Application $app, \media_subdef $subdef)

View File

@@ -754,11 +754,11 @@ class set_export extends set_abstract
/** /**
* *
* @param Application $app * @param Application $app
* @param string $file * @param string $file
* @param string $exportname * @param string $exportname
* @param string $mime * @param string $mime
* @param string $disposition * @param string $disposition
* @return Response * @return Response
*/ */
public static function stream_file(Application $app, $file, $exportname, $mime, $disposition = 'inline') public static function stream_file(Application $app, $file, $exportname, $mime, $disposition = 'inline')
@@ -828,7 +828,7 @@ class set_export extends set_abstract
public static function stream_data($data, $exportname, $mime, $disposition = 'attachment') public static function stream_data($data, $exportname, $mime, $disposition = 'attachment')
{ {
$unicode = new \unicode(); $unicode = new \unicode();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: no-store, no-cache, must-revalidate");

View File

@@ -72,10 +72,10 @@ class set_order extends set_abstract
/** /**
* Create a new order entry * Create a new order entry
* *
* @param RecordsRequest $recordsRequest * @param RecordsRequest $recordsRequest
* @param integer $orderer * @param integer $orderer
* @param string $usage * @param string $usage
* @param \DateTime $deadline * @param \DateTime $deadline
* @return boolean * @return boolean
*/ */
public static function create(Application $app, RecordsRequest $records, \User_Adapter $orderer, $usage, \DateTime $deadline = null) public static function create(Application $app, RecordsRequest $records, \User_Adapter $orderer, $usage, \DateTime $deadline = null)
@@ -130,11 +130,11 @@ class set_order extends set_abstract
/** /**
* List orders * List orders
* *
* @param appbox $appbox * @param appbox $appbox
* @param array $baseIds * @param array $baseIds
* @param integer $offsetStart * @param integer $offsetStart
* @param integer $perPage * @param integer $perPage
* @return array * @return array
*/ */
public static function listOrders(Application $app, array $baseIds, $offsetStart = 0, $perPage = 10, $sort = null) public static function listOrders(Application $app, array $baseIds, $offsetStart = 0, $perPage = 10, $sort = null)
{ {
@@ -177,9 +177,9 @@ class set_order extends set_abstract
/** /**
* Get total orders for selected base ids * Get total orders for selected base ids
* *
* @param appbox $appbox * @param appbox $appbox
* @param array $baseIds * @param array $baseIds
* @return integer * @return integer
*/ */
public static function countTotalOrder(appbox $appbox, array $baseIds = array()) public static function countTotalOrder(appbox $appbox, array $baseIds = array())
{ {
@@ -367,7 +367,7 @@ class set_order extends set_abstract
} }
} }
if ( ! $Basket) { if (! $Basket) {
$Basket = new \Entities\Basket(); $Basket = new \Entities\Basket();
$Basket->setName(sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d'))); $Basket->setName(sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d')));
$Basket->setOwner($this->user); $Basket->setOwner($this->user);
@@ -391,7 +391,7 @@ class set_order extends set_abstract
WHERE order_id = :order_id WHERE order_id = :order_id
AND id = :order_element_id'; AND id = :order_element_id';
if ( ! $force) { if (! $force) {
$sql .= ' AND ISNULL(order_master_id)'; $sql .= ' AND ISNULL(order_master_id)';
} }
@@ -471,7 +471,7 @@ class set_order extends set_abstract
$stmt->closeCursor(); $stmt->closeCursor();
$n ++; $n ++;
} }
if ($n > 0) { if ($n > 0) {
$params = array( $params = array(
'from' => $this->app['phraseanet.user']->get_id(), 'from' => $this->app['phraseanet.user']->get_id(),

View File

@@ -59,7 +59,7 @@ class set_selection extends set_abstract
$base_id = $record->get_base_id(); $base_id = $record->get_base_id();
$sbas_id = $record->get_sbas_id(); $sbas_id = $record->get_sbas_id();
$record_id = $record->get_record_id(); $record_id = $record->get_record_id();
if ( ! $rights) { if (! $rights) {
if ($this->app['phraseanet.user']->ACL()->has_hd_grant($record)) { if ($this->app['phraseanet.user']->ACL()->has_hd_grant($record)) {
continue; continue;
} }
@@ -157,4 +157,3 @@ class set_selection extends set_abstract
return $ret; return $ret;
} }
} }

View File

@@ -29,4 +29,3 @@ class system_url
return $this->url; return $this->url;
} }
} }

View File

@@ -85,7 +85,7 @@ class task_Scheduler
$lockdir = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/'; $lockdir = $this->dependencyContainer['phraseanet.registry']->get('GV_RootPath') . 'tmp/locks/';
for ($try = 1; true; $try ++ ) { for ($try = 1; true; $try ++) {
$lockfile = ($lockdir . 'scheduler.lock'); $lockfile = ($lockdir . 'scheduler.lock');
if (($schedlock = fopen($lockfile, 'a+')) != FALSE) { if (($schedlock = fopen($lockfile, 'a+')) != FALSE) {
if (flock($schedlock, LOCK_EX | LOCK_NB) === FALSE) { if (flock($schedlock, LOCK_EX | LOCK_NB) === FALSE) {
@@ -156,10 +156,10 @@ class task_Scheduler
} }
unset($conn); unset($conn);
if ( ! $connwaslost) { if (! $connwaslost) {
$this->log(sprintf("Warning : abox connection lost, restarting in 10 min.")); $this->log(sprintf("Warning : abox connection lost, restarting in 10 min."));
} }
for ($i = 0; $i < 60 * 10; $i ++ ) { for ($i = 0; $i < 60 * 10; $i ++) {
sleep(1); sleep(1);
} }
try { try {
@@ -328,7 +328,7 @@ class task_Scheduler
$taskPoll[$tkey]["killat"] = NULL; $taskPoll[$tkey]["killat"] = NULL;
if ($this->method == self::METHOD_PROC_OPEN) { if ($this->method == self::METHOD_PROC_OPEN) {
if ( ! $taskPoll[$tkey]["process"]) { if (! $taskPoll[$tkey]["process"]) {
$nullfile = defined('PHP_WINDOWS_VERSION_BUILD') ? 'NUL' : '/dev/null'; $nullfile = defined('PHP_WINDOWS_VERSION_BUILD') ? 'NUL' : '/dev/null';
@@ -429,7 +429,7 @@ class task_Scheduler
$crashed = true; $crashed = true;
} }
if ( ! $crashed) { if (! $crashed) {
$taskPoll[$tkey]["killat"] = NULL; $taskPoll[$tkey]["killat"] = NULL;
$runningtask ++; $runningtask ++;
} else { } else {
@@ -469,7 +469,7 @@ class task_Scheduler
// send ctrl-c to tell the task to CLEAN quit // send ctrl-c to tell the task to CLEAN quit
// (just in case the task doesn't pool his status 'tostop' fast enough) // (just in case the task doesn't pool his status 'tostop' fast enough)
if (function_exists('posix_kill')) { if (function_exists('posix_kill')) {
if ( ! $taskPoll[$tkey]['sigterm_sent']) { if (! $taskPoll[$tkey]['sigterm_sent']) {
posix_kill($pid, SIGTERM); posix_kill($pid, SIGTERM);
$this->log( $this->log(
sprintf( sprintf(
@@ -551,7 +551,7 @@ class task_Scheduler
} }
} }
for ($i = 0; $i < $sleeptime; $i ++ ) { for ($i = 0; $i < $sleeptime; $i ++) {
sleep(1); sleep(1);
} }
} }

View File

@@ -1,6 +1,5 @@
<?php <?php
use Alchemy\Phrasea\Application;
use Monolog\Logger; use Monolog\Logger;
abstract class task_abstract abstract class task_abstract
@@ -149,7 +148,7 @@ abstract class task_abstract
$stmt->execute(array(':taskid' => $this->getID())); $stmt->execute(array(':taskid' => $this->getID()));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
if ( ! $row) { if (! $row) {
throw new Exception('Unknown task id'); throw new Exception('Unknown task id');
} }
$this->title = $row['name']; $this->title = $row['name'];
@@ -183,14 +182,14 @@ abstract class task_abstract
{ {
static $stmt = NULL; static $stmt = NULL;
$conn = connection::getPDOConnection($this->dependencyContainer); $conn = connection::getPDOConnection($this->dependencyContainer);
if ( ! $stmt) { if (! $stmt) {
$sql = 'SELECT status FROM task2 WHERE task_id = :taskid'; $sql = 'SELECT status FROM task2 WHERE task_id = :taskid';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
} }
$stmt->execute(array(':taskid' => $this->taskid)); $stmt->execute(array(':taskid' => $this->taskid));
$row = $stmt->fetch(PDO::FETCH_ASSOC); $row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
if ( ! $row) { if (! $row) {
throw new Exception('Unknown task id'); throw new Exception('Unknown task id');
} }
unset($conn); unset($conn);
@@ -303,8 +302,7 @@ abstract class task_abstract
$dom = new DOMDocument('1.0', 'UTF-8'); $dom = new DOMDocument('1.0', 'UTF-8');
$dom->preserveWhiteSpace = false; $dom->preserveWhiteSpace = false;
$dom->formatOutput = true; $dom->formatOutput = true;
if(!@$dom->loadXML($settings)) if (!@$dom->loadXML($settings)) {
{
throw new Exception_InvalidArgument('Bad XML'); throw new Exception_InvalidArgument('Bad XML');
} }
@@ -539,7 +537,7 @@ abstract class task_abstract
if ($this->running) { // && $this->records_done == 0) if ($this->running) { // && $this->records_done == 0)
$when_started = time() - $when_started; $when_started = time() - $when_started;
if ($when_started < $this->period) { if ($when_started < $this->period) {
for ($t = $this->period - $when_started; $this->running && $t > 0; $t -- ) { // DON'T do sleep($this->period - $when_started) because it prevents ticks ! for ($t = $this->period - $when_started; $this->running && $t > 0; $t --) { // DON'T do sleep($this->period - $when_started) because it prevents ticks !
$s = $this->getState(); $s = $this->getState();
if ($s == self::STATE_TOSTOP) { if ($s == self::STATE_TOSTOP) {
$this->setState(self::STATE_STOPPED); $this->setState(self::STATE_STOPPED);
@@ -717,7 +715,7 @@ abstract class task_abstract
$this->running = FALSE; $this->running = FALSE;
} }
if ( ! $this->running) { if (! $this->running) {
break; break;
} }
} }
@@ -851,7 +849,7 @@ abstract class task_abstract
$domdoc = new DOMDocument(); $domdoc = new DOMDocument();
if ($settings && ! $domdoc->loadXML($settings)) { if ($settings && ! $domdoc->loadXML($settings)) {
throw new Exception('settings invalide'); throw new Exception('settings invalide');
} elseif ( ! $settings) { } elseif (! $settings) {
$settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n</tasksettings>"; $settings = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tasksettings>\n</tasksettings>";
} }

View File

@@ -35,7 +35,7 @@ abstract class task_appboxAbstract extends task_abstract
$this->log(("Warning : abox connection lost, restarting in 10 min.")); $this->log(("Warning : abox connection lost, restarting in 10 min."));
// DON'T do sleep(600) because it prevents ticks ! // DON'T do sleep(600) because it prevents ticks !
for ($t = 60 * 10; $this->running && $t; $t -- ) { for ($t = 60 * 10; $this->running && $t; $t --) {
sleep(1); sleep(1);
} }
// because connection is lost we cannot change status to 'torestart' // because connection is lost we cannot change status to 'torestart'
@@ -67,7 +67,7 @@ abstract class task_appboxAbstract extends task_abstract
} }
if ($row) { if ($row) {
if ( ! $this->running) { if (! $this->running) {
break; break;
} }

View File

@@ -39,7 +39,7 @@ abstract class task_databoxAbstract extends task_abstract
$this->log("appbox connection lost, restarting in 10 min.", self::LOG_ERROR); $this->log("appbox connection lost, restarting in 10 min.", self::LOG_ERROR);
// DON'T do sleep(600) because it prevents ticks ! // DON'T do sleep(600) because it prevents ticks !
for ($t = 60 * 10; $this->running && $t; $t-- ) { for ($t = 60 * 10; $this->running && $t; $t--) {
sleep(1); sleep(1);
} }
// because connection is lost we cannot change status to 'torestart' // because connection is lost we cannot change status to 'torestart'
@@ -77,7 +77,7 @@ abstract class task_databoxAbstract extends task_abstract
} }
foreach ($rs as $row) { // every sbas foreach ($rs as $row) { // every sbas
if ( ! $this->running) { if (! $this->running) {
break; break;
} }
@@ -174,4 +174,3 @@ abstract class task_databoxAbstract extends task_abstract
return $ret; return $ret;
} }
} }

View File

@@ -152,8 +152,7 @@ class task_period_RecordMover extends task_appboxAbstract
{ {
$("#sqlu").text(""); $("#sqlu").text("");
$("#sqls").text(""); $("#sqls").text("");
if(xml) if (xml) {
{
xml2 = $.parseXML(xml); xml2 = $.parseXML(xml);
xml2 = $(xml2); xml2 = $(xml2);
@@ -258,8 +257,7 @@ class task_period_RecordMover extends task_appboxAbstract
} ; } ;
$(".formElem").change(function(){ $(".formElem").change(function(){
fieldname = $(this).attr("name"); fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase()) switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
{
case "inputtext": case "inputtext":
if (typeof(limits[fieldname])!='undefined') { if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value; var v = 0|this.value;
@@ -301,6 +299,7 @@ class task_period_RecordMover extends task_appboxAbstract
<div class="terminal" id="sqla"></div> <div class="terminal" id="sqla"></div>
</center> </center>
<?php <?php
return ob_get_clean(); return ob_get_clean();
} }
/** /**
@@ -395,8 +394,8 @@ class task_period_RecordMover extends task_appboxAbstract
/** /**
* work on ONE record * work on ONE record
* *
* @param appbox $appbox * @param appbox $appbox
* @param array $row * @param array $row
* @return \task_period_RecordMover * @return \task_period_RecordMover
*/ */
protected function processOneContent(appbox $appbox, Array $row) protected function processOneContent(appbox $appbox, Array $row)
@@ -459,8 +458,8 @@ class task_period_RecordMover extends task_appboxAbstract
/** /**
* all work done on processOneContent, so nothing to do here * all work done on processOneContent, so nothing to do here
* *
* @param appbox $appbox * @param appbox $appbox
* @param array $row * @param array $row
* @return \task_period_RecordMover * @return \task_period_RecordMover
*/ */
protected function postProcessOneContent(appbox $appbox, Array $row) protected function postProcessOneContent(appbox $appbox, Array $row)

View File

@@ -146,8 +146,7 @@ class task_period_archive extends task_abstract
<script type="text/javascript"> <script type="text/javascript">
function taskFillGraphic_<?php echo(get_class($this));?>(xml) function taskFillGraphic_<?php echo(get_class($this));?>(xml)
{ {
if(xml) if (xml) {
{
xml2 = $.parseXML(xml); xml2 = $.parseXML(xml);
xml2 = $(xml2); xml2 = $(xml2);
@@ -182,8 +181,7 @@ class task_period_archive extends task_abstract
} ; } ;
$(".formElem").change(function(){ $(".formElem").change(function(){
fieldname = $(this).attr("name"); fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase()) switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
{
case "inputtext": case "inputtext":
if (typeof(limits[fieldname])!='undefined') { if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value; var v = 0|this.value;
@@ -201,6 +199,7 @@ class task_period_archive extends task_abstract
</script> </script>
<?php <?php
return; return;
} }
@@ -218,7 +217,7 @@ class task_period_archive extends task_abstract
<select class="formElem" name="base_id"> <select class="formElem" name="base_id">
<option value="">...</option> <option value="">...</option>
<?php <?php
foreach($this->dependencyContainer['phraseanet.appbox']->get_databoxes() as $databox) { foreach ($this->dependencyContainer['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($databox->get_collections() as $collection) { foreach ($databox->get_collections() as $collection) {
print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_name() . "</option>"); print("<option value=\"" . $collection->get_base_id() . "\">" . $databox->get_viewname() . " / " . $collection->get_name() . "</option>");
} }
@@ -245,6 +244,7 @@ class task_period_archive extends task_abstract
<input class="formElem" type="checkbox" name="delfolder">&nbsp;<?php echo _('task::archive:supprimer les repertoires apres archivage') ?><br/> <input class="formElem" type="checkbox" name="delfolder">&nbsp;<?php echo _('task::archive:supprimer les repertoires apres archivage') ?><br/>
</form> </form>
<?php <?php
return ob_get_clean(); return ob_get_clean();
} }
@@ -602,10 +602,8 @@ class task_period_archive extends task_abstract
// something happened : a least one file has moved // something happened : a least one file has moved
return 'MAXRECSDONE'; return 'MAXRECSDONE';
} elseif (memory_get_usage() >> 20 > 25) { } elseif (memory_get_usage() >> 20 > 25) {
return 'MAXMEGSREACHED'; return 'MAXMEGSREACHED';
} else { } else {
return 'NORECSTODO'; return 'NORECSTODO';
} }
} }
@@ -1711,7 +1709,7 @@ class task_period_archive extends task_abstract
$record = null; $record = null;
$postProcess = function($element, $visa, $code) use(&$record) { $postProcess = function($element, $visa, $code) use (&$record) {
$record = $element; $record = $element;
}; };
@@ -2049,7 +2047,7 @@ class task_period_archive extends task_abstract
* indexed by **FieldNames** * indexed by **FieldNames**
* *
* @param \databox_descriptionStructure $metadatasStructure The databox structure related * @param \databox_descriptionStructure $metadatasStructure The databox structure related
* @param ExiftoolMetadataBag $bag The metadata bag * @param ExiftoolMetadataBag $bag The metadata bag
* @return MetadataBag * @return MetadataBag
*/ */
protected function getIndexByFieldName(\databox_descriptionStructure $metadatasStructure, ExiftoolMetadataBag $bag) protected function getIndexByFieldName(\databox_descriptionStructure $metadatasStructure, ExiftoolMetadataBag $bag)

Some files were not shown because too many files have changed in this diff Show More