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()
{
if ( ! $this->token) {
if (! $this->token) {
try {
$this->token = new API_OAuth2_Token($this->app['phraseanet.appbox'], $this);
} catch (Exception_NotFound $e) {
@@ -262,7 +262,7 @@ class API_OAuth2_Account
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ( ! $row) {
if (! $row) {
throw new Exception_NotFound();
}

View File

@@ -418,7 +418,7 @@ class API_OAuth2_Adapter extends OAuth2
* check for valid client_id
* check for valid redirect_uri
*/
if ( ! $input["client_id"]) {
if (! $input["client_id"]) {
if ($input["redirect_uri"])
$this->errorDoRedirectUriCallback(
$input["redirect_uri"], OAUTH2_ERROR_INVALID_CLIENT, NULL, NULL, $input["state"]
@@ -472,7 +472,7 @@ class API_OAuth2_Adapter extends OAuth2
/**
* 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"]);
}

View File

@@ -61,7 +61,7 @@ class API_OAuth2_RefreshToken
*/
public function get_account()
{
if ( ! $this->account) {
if (! $this->account) {
$this->account = new API_OAuth2_Account($this->app, $this->account_id);
}

View File

@@ -47,7 +47,7 @@ class Bridge_Api_Auth_Flickr extends Bridge_Api_Auth_Abstract implements Bridge_
*/
protected function get_api()
{
if ( ! $this->_api) {
if (! $this->_api) {
$this->_api = new Phlickr_Api(
$this->flickr_client_id,
$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);
//add quantity
if ( ! ! $quantity) {
if (! ! $quantity) {
$params["limit"] = $quantity;
}
$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)
{
return $this->thumbnail;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -42,7 +42,6 @@ class Session_Authentication_PersistentCookie implements Session_Authentication_
$this->app= $app;
$this->persistent_cookie = $persistent_cookie;
$dql = 'SELECT s FROM Entities\Session s
WHERE s.token = :token';
@@ -50,7 +49,7 @@ class Session_Authentication_PersistentCookie implements Session_Authentication_
$query->setParameters(array('token' => $persistent_cookie));
$session = $query->getOneOrNullResult();
if ( ! $session) {
if (! $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()
{
return $this->user;
}
@@ -73,7 +72,6 @@ class Session_Authentication_Token implements Session_Authentication_Interface
*/
public function get_user()
{
return $this->user;
}

View File

@@ -1243,7 +1243,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_applied_template()
{
return $this->applied_template;
}
@@ -1474,7 +1473,6 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$app['EM']->flush();
}
$usr_id = $app['phraseanet.user']->get_id();
$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)
WHERE 1 ';
if ( ! $this->include_special_users) {
if (! $this->include_special_users) {
$sql .= ' AND usr_login != "autoregister"
AND usr_login != "invite" ';
}
$sql .= ' AND usr_login NOT LIKE "(#deleted_%" ';
if ( ! $this->include_invite) {
if (! $this->include_invite) {
$sql .= ' AND usr.invite=0 ';
}
if ( ! $this->email_not_null) {
if (! $this->email_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)
{
if ( ! $base_ids) {
if (! $base_ids) {
return $this;
}
@@ -739,7 +739,7 @@ class User_Query implements User_QueryInterface
*/
public function on_sbas_ids(Array $sbas_ids = null)
{
if ( ! $sbas_ids) {
if (! $sbas_ids) {
return $this;
}

View File

@@ -94,7 +94,7 @@ class appbox extends base
$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->setDimensions(120, 24);
}
@@ -110,7 +110,7 @@ class appbox extends base
} catch (\MediaAlchemyst\Exception $e) {
}
} else if ($pic_type === collection::PIC_PRESENTATION) {
} elseif ($pic_type === collection::PIC_PRESENTATION) {
//resize collection logo
$imageSpec = new ImageSpecification();
$imageSpec->setResizeMode(ImageSpecification::RESIZE_MODE_INBOUND_FIXEDRATIO);

View File

@@ -153,7 +153,6 @@ class cache_databox
$connbas = \connection::getPDOConnection($app, $sbas_id);
$sql = 'SELECT distinct site_id as site_id
FROM clients
WHERE site_id != :site_id';
@@ -181,7 +180,6 @@ class cache_databox
{
$connbas = $databox->get_connection();
$sql = 'SELECT site_id FROM clients WHERE site_id = :site_id';
$stmt = $connbas->prepare($sql);
$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 */
$caption_field_value->set_value($value);
if ( ! $vocabulary || ! $vocabularyId) {
if (! $vocabulary || ! $vocabularyId) {
$caption_field_value->removeVocabulary();
} else {
$caption_field_value->setVocab($vocabulary, $vocabularyId);
@@ -348,7 +348,7 @@ class caption_Field_Value implements cache_cacheableInterface
$tbranch = $this->databox_field->get_tbranch();
if ( ! $tbranch || ! $XPATH_thesaurus) {
if (! $tbranch || ! $XPATH_thesaurus) {
return $value;
}
@@ -402,7 +402,7 @@ class caption_Field_Value implements cache_cacheableInterface
}
}
}
if ( ! $lngfound) {
if (! $lngfound) {
list($term, $context) = $this->splitTermAndContext($fvalue);
$term = str_replace(array("<em>", "</em>"), array("", ""), $term);
$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);
$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"));
}
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);

View File

@@ -570,7 +570,7 @@ class databox extends base
*/
public function get_subdef_structure()
{
if ( ! $this->subdef_struct) {
if (! $this->subdef_struct) {
$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)
{
if ( ! $date) {
if (! $date) {
$date = date('Y-m-d H:i:s');
}

View File

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

View File

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

View File

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

View File

@@ -34,7 +34,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
public function count()
{
$n = 0;
foreach($this->AvSubdefs as $subdefs) {
foreach ($this->AvSubdefs as $subdefs) {
$n += count($subdefs);
}
@@ -84,7 +84,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
'flash' => array()
);
if ( ! $sx_struct) {
if (! $sx_struct) {
return $this;
}
@@ -160,7 +160,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
. 'subdef[@name="' . $name . '"]'
);
for($i = 0; $i < $nodes->length; $i++) {
for ($i = 0; $i < $nodes->length; $i++) {
$node = $nodes->item($i);
$parent = $node->parentNode;
$parent->removeChild($node);
@@ -273,7 +273,7 @@ class databox_subdefsStructure implements IteratorAggregate, Countable
$refNode = null;
if ($nodes->length > 0) {
for ($i = 0; $i < $nodes->length; $i ++ ) {
for ($i = 0; $i < $nodes->length; $i ++) {
$refNode = $nodes->item($i)->nextSibling;
$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;
elseif ($usrerRegis[$databox->get_dbname()][$collection->get_coll_id()] === true)
$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();
} elseif ($cguSpec) {
$inscriptions[$sbas_id]['CollsCGU'][$collection->get_coll_id()]['name'] = $collection->get_name();

View File

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

View File

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

View File

@@ -162,7 +162,7 @@ class http_request
}
}
} else {
for ($i = 0; $i < $nargs; $i ++ ) {
for ($i = 0; $i < $nargs; $i ++) {
$nom = func_get_arg($i);
$parm[$nom] = isset($_GET[$nom]) ?
$_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');
}
if ( ! $row) {
if (! $row) {
$this->find_substitute_file();
}
@@ -529,14 +529,12 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
}
try {
return $this->record
->get_databox()
->get_subdef_structure()
->get_subdef($this->record->get_type(), $this->get_name())
->getDevices();
} catch (\Exception_Databox_SubdefNotFound $e) {
return array();
}
}
@@ -685,7 +683,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ( ! $row) {
if (! $row) {
throw new \Exception_Media_SubdefNotFound('Require the real one');
}
@@ -719,6 +717,7 @@ class media_subdef extends media_abstract implements cache_cacheableInterface
}
unset($media);
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));
}
}

View File

@@ -14,7 +14,6 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Alchemy\Phrasea\Application;
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\Output\OutputInterface;
use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Service\Builder;
/**

View File

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

View File

@@ -98,7 +98,7 @@ class module_console_systemExport extends Command
$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');
}
@@ -147,7 +147,7 @@ class module_console_systemExport extends Command
}
}
if ( ! $go) {
if (! $go) {
$output->writeln(sprintf("Collections not selected, bypassing ..."));
continue;
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -174,4 +174,3 @@ class module_report_connexion extends module_report
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)
{
if ( ! $dmax) {
if (! $dmax) {
$date = new Datetime();
$dmax = $date->format('d-m-Y');
} 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);
}
}

View File

@@ -205,4 +205,3 @@ class module_report_dashboard_merge implements module_report_dashboard_component
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;
}
}

View File

@@ -272,4 +272,3 @@ class module_report_download extends module_report
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
* @link www.phraseanet.com
*/
interface module_report_sqlReportinterface
interface module_report_sqlReportInterface
{
public function buildSql();

View File

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

View File

@@ -103,4 +103,3 @@ class module_report_sqlquestion extends module_report_sql implements module_repo
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;
}
}

View File

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

View File

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

View File

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

View File

@@ -83,4 +83,3 @@ class patch_370a5 implements patchInterface
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);
}
}

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,6 @@
*/
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)
{
foreach($databox->get_meta_structure() as $databox_field) {
foreach ($databox->get_meta_structure() as $databox_field) {
$databox_field->save();
}
}
}

View File

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

View File

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

View File

@@ -10,7 +10,6 @@
*/
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Border\Checker;
/**
*
@@ -73,4 +72,3 @@ class patch_3802 implements patchInterface
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;
}
}

View File

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

View File

@@ -28,7 +28,7 @@ class queries
if (file_exists(__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')) {
$xmlTopics = __DIR__ . '/../../config/topics/topics.xml';
}
@@ -171,7 +171,7 @@ class queries
</table>
' . _('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;" >
<select style="width:100%;" id="popTopic_' . $i . '" name="popTopic_' . $i . '" onchange="chgPopTopic(' . ($i + 1) . ');">
</select>

View File

@@ -250,7 +250,7 @@ class random
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ( ! $row) {
if (! $row) {
throw new \Exception_NotFound('Token not found');
}

View File

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

View File

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

View File

@@ -95,7 +95,7 @@ class record_preview extends record_adapter
switch ($env) {
case "RESULT":
if(null === $search_engine) {
if (null === $search_engine) {
throw new \LogicException('Search Engine should be provided');
}
@@ -329,7 +329,7 @@ class record_preview extends record_adapter
AND d.record_id = :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")';
$params[':usr_id'] = $this->app['phraseanet.user']->get_id();
$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($action == 'collection') {
if ($action == 'collection') {
$tab[$hour][$site][$action][$row['usr_id']]['final'][] = phrasea::baseFromColl($this->get_sbas_id(), $row['final'], $this->app);
} else {
$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)
{
return false;
}
}

View File

@@ -109,7 +109,7 @@ class recordutils_image extends recordutils
}
$vars = $xpprefs->query('/baseprefs/stamp/*/var');
for ($i = 0; $i < $vars->length; $i ++ ) {
for ($i = 0; $i < $vars->length; $i ++) {
$varval = '';
$n = $vars->item($i);
switch (strtoupper($n->getAttribute('name'))) {
@@ -131,7 +131,7 @@ class recordutils_image extends recordutils
}
$fields = $xpprefs->query('/baseprefs/stamp/*/field');
for ($i = 0; $i < $fields->length; $i ++ ) {
for ($i = 0; $i < $fields->length; $i ++) {
$fldval = '';
$n = $fields->item($i);
$fieldname = $n->getAttribute('name');
@@ -211,7 +211,7 @@ class recordutils_image extends recordutils
$txtblock = array();
$texts = $xpprefs->query('/baseprefs/stamp/text');
$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 (substr($tmpfontsize, -1) == '%')
$tmpfontsize = (int) ($tmpfontsize * $image_width / 4000);

View File

@@ -367,7 +367,7 @@ class set_order extends set_abstract
}
}
if ( ! $Basket) {
if (! $Basket) {
$Basket = new \Entities\Basket();
$Basket->setName(sprintf(_('Commande du %s'), $this->created_on->format('Y-m-d')));
$Basket->setOwner($this->user);
@@ -391,7 +391,7 @@ class set_order extends set_abstract
WHERE order_id = :order_id
AND id = :order_element_id';
if ( ! $force) {
if (! $force) {
$sql .= ' AND ISNULL(order_master_id)';
}

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,5 @@
<?php
use Alchemy\Phrasea\Application;
use Monolog\Logger;
abstract class task_abstract
@@ -149,7 +148,7 @@ abstract class task_abstract
$stmt->execute(array(':taskid' => $this->getID()));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ( ! $row) {
if (! $row) {
throw new Exception('Unknown task id');
}
$this->title = $row['name'];
@@ -183,14 +182,14 @@ abstract class task_abstract
{
static $stmt = NULL;
$conn = connection::getPDOConnection($this->dependencyContainer);
if ( ! $stmt) {
if (! $stmt) {
$sql = 'SELECT status FROM task2 WHERE task_id = :taskid';
$stmt = $conn->prepare($sql);
}
$stmt->execute(array(':taskid' => $this->taskid));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ( ! $row) {
if (! $row) {
throw new Exception('Unknown task id');
}
unset($conn);
@@ -303,8 +302,7 @@ abstract class task_abstract
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
if(!@$dom->loadXML($settings))
{
if (!@$dom->loadXML($settings)) {
throw new Exception_InvalidArgument('Bad XML');
}
@@ -539,7 +537,7 @@ abstract class task_abstract
if ($this->running) { // && $this->records_done == 0)
$when_started = time() - $when_started;
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();
if ($s == self::STATE_TOSTOP) {
$this->setState(self::STATE_STOPPED);
@@ -717,7 +715,7 @@ abstract class task_abstract
$this->running = FALSE;
}
if ( ! $this->running) {
if (! $this->running) {
break;
}
}
@@ -851,7 +849,7 @@ abstract class task_abstract
$domdoc = new DOMDocument();
if ($settings && ! $domdoc->loadXML($settings)) {
throw new Exception('settings invalide');
} elseif ( ! $settings) {
} elseif (! $settings) {
$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."));
// 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);
}
// because connection is lost we cannot change status to 'torestart'
@@ -67,7 +67,7 @@ abstract class task_appboxAbstract extends task_abstract
}
if ($row) {
if ( ! $this->running) {
if (! $this->running) {
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);
// 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);
}
// 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
if ( ! $this->running) {
if (! $this->running) {
break;
}
@@ -174,4 +174,3 @@ abstract class task_databoxAbstract extends task_abstract
return $ret;
}
}

View File

@@ -152,8 +152,7 @@ class task_period_RecordMover extends task_appboxAbstract
{
$("#sqlu").text("");
$("#sqls").text("");
if(xml)
{
if (xml) {
xml2 = $.parseXML(xml);
xml2 = $(xml2);
@@ -258,8 +257,7 @@ class task_period_RecordMover extends task_appboxAbstract
} ;
$(".formElem").change(function(){
fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase())
{
switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
case "inputtext":
if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value;
@@ -301,6 +299,7 @@ class task_period_RecordMover extends task_appboxAbstract
<div class="terminal" id="sqla"></div>
</center>
<?php
return ob_get_clean();
}
/**

View File

@@ -146,8 +146,7 @@ class task_period_archive extends task_abstract
<script type="text/javascript">
function taskFillGraphic_<?php echo(get_class($this));?>(xml)
{
if(xml)
{
if (xml) {
xml2 = $.parseXML(xml);
xml2 = $(xml2);
@@ -182,8 +181,7 @@ class task_period_archive extends task_abstract
} ;
$(".formElem").change(function(){
fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase())
{
switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
case "inputtext":
if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value;
@@ -201,6 +199,7 @@ class task_period_archive extends task_abstract
</script>
<?php
return;
}
@@ -218,7 +217,7 @@ class task_period_archive extends task_abstract
<select class="formElem" name="base_id">
<option value="">...</option>
<?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) {
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/>
</form>
<?php
return ob_get_clean();
}
@@ -602,10 +602,8 @@ class task_period_archive extends task_abstract
// something happened : a least one file has moved
return 'MAXRECSDONE';
} elseif (memory_get_usage() >> 20 > 25) {
return 'MAXMEGSREACHED';
} else {
return 'NORECSTODO';
}
}
@@ -1711,7 +1709,7 @@ class task_period_archive extends task_abstract
$record = null;
$postProcess = function($element, $visa, $code) use(&$record) {
$postProcess = function($element, $visa, $code) use (&$record) {
$record = $element;
};

View File

@@ -176,13 +176,13 @@ class task_period_cindexer extends task_abstract
function taskFillGraphic_<?php echo(get_class($this));?>(xml)
{
if(xml)
{
if (xml) {
xml = $.parseXML(xml);
xml = $(xml);
var isyes = function(v) {
v = v.toUpperCase().trim();
return v=='O' || v=='Y' || v=='OUI' || v=='YES' || v=='1';
}
@@ -247,6 +247,7 @@ class task_period_cindexer extends task_abstract
</script>
<?php
return;
}
@@ -296,7 +297,6 @@ class task_period_cindexer extends task_abstract
<input type="checkbox" name="nolog">&nbsp;<?php echo _('task::cindexer:do not (sys)log, but out to console)') ?>
<br/>
<?php echo _('task::cindexer:windows specific') ?>&nbsp;:<br/>
<input type="checkbox" name="winsvc_run">&nbsp;<?php echo _('task::cindexer:run as application, not as service') ?>
</form>
@@ -305,6 +305,7 @@ class task_period_cindexer extends task_abstract
<div style="margin:10px; padding:5px; border:1px #000000 solid; font-family:monospace; font-size:14px; text-align:left; color:#00e000; background-color:#404040" id="cmd">cmd</div>
</center>
<?php
return ob_get_clean();
}
@@ -466,7 +467,7 @@ class task_period_cindexer extends task_abstract
if (socket_connect($sock, '127.0.0.1', $this->socket) === true) {
socket_write($sock, 'Q', 1);
socket_write($sock, "\r\n", strlen("\r\n"));
for ($i = 0; $this->running && $i < 5; $i ++ ) {
for ($i = 0; $this->running && $i < 5; $i ++) {
sleep(1);
}
$qsent = 'Q';
@@ -479,7 +480,7 @@ class task_period_cindexer extends task_abstract
}
$proc_status = proc_get_status($process);
if ( ! $proc_status['running']) {
if (! $proc_status['running']) {
// the cindexer died
if ($qsent == 'Q') {
$this->log(_('task::cindexer:the cindexer clean-quit'));
@@ -504,7 +505,7 @@ class task_period_cindexer extends task_abstract
}
}
}
for ($i = 0; $this->running && $i < 5; $i ++ ) {
for ($i = 0; $this->running && $i < 5; $i ++) {
sleep(1);
}
}

View File

@@ -43,7 +43,7 @@ class task_period_emptyColl extends task_appboxAbstract
protected function retrieveContent(appbox $appbox)
{
if ( ! $this->base_id) {
if (! $this->base_id) {
$this->setState(self::STATE_STOPPED);
return array();

View File

@@ -91,8 +91,7 @@ class task_period_ftp extends task_appboxAbstract
<script type="text/javascript">
function taskFillGraphic_<?php echo(get_class($this));?>(xml)
{
if(xml)
{
if (xml) {
xml = $.parseXML(xml);
xml = $(xml);
@@ -111,8 +110,7 @@ class task_period_ftp extends task_appboxAbstract
} ;
$(".formElem").change(function(){
fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase())
{
switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
case "inputtext":
if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value;
@@ -129,6 +127,7 @@ class task_period_ftp extends task_appboxAbstract
});
</script>
<?php
return;
}
@@ -153,6 +152,7 @@ class task_period_ftp extends task_appboxAbstract
&nbsp;<?php echo _('task::_common_:secondes (unite temporelle)') ?><br/>
</form>
<?php
return ob_get_clean();
}
@@ -696,4 +696,3 @@ class task_period_ftp extends task_appboxAbstract
return $this;
}
}

View File

@@ -109,8 +109,7 @@ class task_period_ftpPull extends task_appboxAbstract
function taskFillGraphic_<?php echo(get_class($this));?>(xml)
{
if(xml)
{
if (xml) {
xml = $.parseXML(xml);
xml = $(xml);
@@ -137,8 +136,7 @@ class task_period_ftpPull extends task_appboxAbstract
} ;
$(".formElem").change(function(){
fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase())
{
switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
case "inputtext":
if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value;
@@ -203,6 +201,7 @@ class task_period_ftpPull extends task_appboxAbstract
&nbsp;<?php echo('task::_common_:minutes (unite temporelle)') ?><br/>
</form>
<?php
return ob_get_clean();
}
@@ -297,11 +296,9 @@ class task_period_ftpPull extends task_appboxAbstract
return true;
} catch (Exception $e) {
return false;
}
} else {
return true;
}
}
@@ -424,4 +421,3 @@ class task_period_ftpPull extends task_appboxAbstract
}
}

View File

@@ -138,6 +138,7 @@ class task_period_subdef extends task_databoxAbstract
</script>
<?php
return("");
} else {
return("BAD XML");
@@ -155,8 +156,7 @@ class task_period_subdef extends task_databoxAbstract
<script type="text/javascript">
function taskFillGraphic_<?php echo(get_class($this));?>(xml)
{
if(xml)
{
if (xml) {
xml = $.parseXML(xml);
xml = $(xml);
@@ -179,8 +179,7 @@ class task_period_subdef extends task_databoxAbstract
} ;
$(".formElem").change(function(){
fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase())
{
switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
case "inputtext":
if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value;
@@ -225,6 +224,7 @@ class task_period_subdef extends task_databoxAbstract
<br/>
</form>
<?php
return ob_get_clean();
}
@@ -318,4 +318,3 @@ class task_period_subdef extends task_databoxAbstract
return $this;
}
}

View File

@@ -123,8 +123,7 @@ class task_period_writemeta extends task_databoxAbstract
<script type="text/javascript">
function taskFillGraphic_<?php echo(get_class($this));?>(xml)
{
if(xml)
{
if (xml) {
xml = $.parseXML(xml);
xml = $(xml);
@@ -146,8 +145,7 @@ class task_period_writemeta extends task_databoxAbstract
} ;
$(".formElem").change(function(){
fieldname = $(this).attr("name");
switch((this.nodeName+$(this).attr("type")).toLowerCase())
{
switch ((this.nodeName+$(this).attr("type")).toLowerCase()) {
case "inputtext":
if (typeof(limits[fieldname])!='undefined') {
var v = 0|this.value;
@@ -331,4 +329,3 @@ class task_period_writemeta extends task_databoxAbstract
return $this;
}
}

View File

@@ -41,4 +41,3 @@ class thesaurus_xpath extends DOMXPath
return(self::$r[$context_path]);
}
}

View File

@@ -1351,7 +1351,7 @@ class unicode
$l = mb_strlen($string, "UTF-8");
$lastwasblank = false;
for ($i = 0; $i < $l; $i ++ ) {
for ($i = 0; $i < $l; $i ++) {
$c = mb_substr($string, $i, 1, "UTF-8");
$c = isset($this->map[$c]) ? $this->map[$c] : $c;
if (mb_strpos($this->endCharacters_utf8, $c) !== FALSE) {
@@ -1374,7 +1374,7 @@ class unicode
$l = mb_strlen($string);
$regexp = '/[a-zA-Z0-9]{1}/';
for ($i = 0; $i < $l; $i ++ ) {
for ($i = 0; $i < $l; $i ++) {
$c = mb_substr($string, $i, 1);
if ( ! preg_match($regexp, $c))
$c = isset($this->map[$c]) ? $this->map[$c] : $c;
@@ -1404,7 +1404,7 @@ class unicode
$out = '';
$l = mb_strlen($string);
for ($i = 0; $i < $l; $i ++ ) {
for ($i = 0; $i < $l; $i ++) {
$c = mb_substr($string, $i, 1);
if (preg_match($regexp, $c))
$out .= $c;
@@ -1478,7 +1478,7 @@ class unicode
$chars_in = array();
for ($cc = 0; $cc < 32; $cc ++ ) {
for ($cc = 0; $cc < 32; $cc ++) {
if (in_array($cc, array(9, 10, 13))) {
continue;
}