Coding standards

This commit is contained in:
Romain Neutron
2012-01-31 18:35:27 +01:00
parent dcb4933438
commit 99a344774f
110 changed files with 668 additions and 536 deletions

View File

@@ -14,12 +14,10 @@
* *
*/ */
require_once __DIR__ . '/lib/Alchemy/Phrasea/Core.php'; require_once __DIR__ . '/lib/bootstrap.php';
use Symfony\Component\Finder\Finder; use Symfony\Component\Finder\Finder;
\Alchemy\Phrasea\Core::initAutoloads();
$fix = isset($argv[1]) && 'fix' == $argv[1]; $fix = isset($argv[1]) && 'fix' == $argv[1];
$finder = new Finder(); $finder = new Finder();

View File

@@ -121,6 +121,7 @@ class ACL implements cache_cacheableInterface
$key = $record->get_serialize_key(); $key = $record->get_serialize_key();
if (array_key_exists($key, $this->_rights_records_document)) if (array_key_exists($key, $this->_rights_records_document))
return true; return true;
return false; return false;
@@ -188,6 +189,7 @@ class ACL implements cache_cacheableInterface
$key = $record->get_serialize_key(); $key = $record->get_serialize_key();
if (array_key_exists($key, $this->_rights_records_preview)) if (array_key_exists($key, $this->_rights_records_preview))
return true; return true;
return false; return false;
@@ -241,6 +243,7 @@ class ACL implements cache_cacheableInterface
public function apply_model(User_Interface $template_user, Array $base_ids) public function apply_model(User_Interface $template_user, Array $base_ids)
{ {
if (count($base_ids) == 0) if (count($base_ids) == 0)
return $this; return $this;
$sbas_ids = array(); $sbas_ids = array();
@@ -382,6 +385,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas(); $this->load_rights_bas();
if (!$this->has_access_to_base($base_id)) if (!$this->has_access_to_base($base_id))
return false; return false;
if ($this->is_limited($base_id)) if ($this->is_limited($base_id))
@@ -469,6 +473,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas(); $this->load_rights_bas();
if (!$this->has_access_to_base($base_id)) if (!$this->has_access_to_base($base_id))
return false; return false;
return $this->_rights_bas[$base_id]['restrict_dwnld']; return $this->_rights_bas[$base_id]['restrict_dwnld'];
@@ -485,6 +490,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas(); $this->load_rights_bas();
if (!$this->has_access_to_base($base_id)) if (!$this->has_access_to_base($base_id))
return false; return false;
return (int) $this->_rights_bas[$base_id]['remain_dwnld']; return (int) $this->_rights_bas[$base_id]['remain_dwnld'];
@@ -502,6 +508,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas(); $this->load_rights_bas();
if (!$this->has_access_to_base($base_id)) if (!$this->has_access_to_base($base_id))
return false; return false;
$this->_rights_bas[$base_id]['remain_dwnld'] = $this->_rights_bas[$base_id]['remain_dwnld'] =
@@ -541,12 +548,14 @@ class ACL implements cache_cacheableInterface
$this->load_rights_sbas(); $this->load_rights_sbas();
if (!isset($this->_rights_sbas[$sbas_id])) if (!isset($this->_rights_sbas[$sbas_id]))
return false; return false;
if (!isset($this->_rights_sbas[$sbas_id][$right])) if (!isset($this->_rights_sbas[$sbas_id][$right]))
throw new Exception('This right does not exists'); throw new Exception('This right does not exists');
if ($this->_rights_sbas[$sbas_id][$right] === true) if ($this->_rights_sbas[$sbas_id][$right] === true)
return true; return true;
return false; return false;
@@ -562,6 +571,7 @@ class ACL implements cache_cacheableInterface
{ {
$this->load_rights_bas(); $this->load_rights_bas();
if (!$this->has_access_to_base($base_id)) if (!$this->has_access_to_base($base_id))
return false; return false;
return $this->_rights_bas[$base_id]['mask_and']; return $this->_rights_bas[$base_id]['mask_and'];
@@ -577,6 +587,7 @@ class ACL implements cache_cacheableInterface
{ {
$this->load_rights_bas(); $this->load_rights_bas();
if (!$this->has_access_to_base($base_id)) if (!$this->has_access_to_base($base_id))
return false; return false;
return $this->_rights_bas[$base_id]['mask_xor']; return $this->_rights_bas[$base_id]['mask_xor'];
@@ -620,21 +631,21 @@ class ACL implements cache_cacheableInterface
{ {
$this->load_rights_bas(); $this->load_rights_bas();
$ret = array(); $ret = array();
foreach($this->appbox->get_databoxes() as $databox) foreach($this->appbox->get_databoxes() as $databox)
{ {
if ($sbas_ids && !in_array($databox->get_sbas_id(), $sbas_ids)) if ($sbas_ids && !in_array($databox->get_sbas_id(), $sbas_ids))
{ {
continue; continue;
} }
foreach ($databox->get_collections() as $collection) foreach ($databox->get_collections() as $collection)
{ {
$continue = false; $continue = false;
if(!array_key_exists($collection->get_base_id(), $this->_rights_bas)) if(!array_key_exists($collection->get_base_id(), $this->_rights_bas))
continue; continue;
$base_id = $collection->get_base_id(); $base_id = $collection->get_base_id();
$datas = $this->_rights_bas[$base_id]; $datas = $this->_rights_bas[$base_id];
@@ -702,7 +713,7 @@ class ACL implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -718,6 +729,7 @@ class ACL implements cache_cacheableInterface
{ {
if ($this->_rights_records_preview) if ($this->_rights_records_preview)
return $this; return $this;
try try
@@ -730,7 +742,7 @@ class ACL implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'SELECT sbas_id, record_id, preview, document $sql = 'SELECT sbas_id, record_id, preview, document
FROM records_rights WHERE usr_id = :usr_id'; FROM records_rights WHERE usr_id = :usr_id';
@@ -771,6 +783,7 @@ class ACL implements cache_cacheableInterface
{ {
if ($this->_rights_sbas && $this->_global_rights) if ($this->_rights_sbas && $this->_global_rights)
return $this; return $this;
try try
@@ -782,7 +795,7 @@ class ACL implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'SELECT sbasusr.* FROM sbasusr, sbas $sql = 'SELECT sbasusr.* FROM sbasusr, sbas
@@ -832,6 +845,7 @@ class ACL implements cache_cacheableInterface
protected function load_rights_bas() protected function load_rights_bas()
{ {
if ($this->_rights_bas && $this->_global_rights && is_array($this->_limited)) if ($this->_rights_bas && $this->_global_rights && is_array($this->_limited))
return $this; return $this;
try try
@@ -844,7 +858,7 @@ class ACL implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'SELECT u.* FROM basusr u, bas b, sbas s $sql = 'SELECT u.* FROM basusr u, bas b, sbas s
@@ -1335,6 +1349,7 @@ class ACL implements cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
if (!$row) if (!$row)
return $this; return $this;
$this->give_access_to_base(array($base_id_dest)); $this->give_access_to_base(array($base_id_dest));
@@ -1501,6 +1516,7 @@ class ACL implements cache_cacheableInterface
{ {
$this->load_rights_bas(); $this->load_rights_bas();
if (!isset($this->_limited[$base_id])) if (!isset($this->_limited[$base_id]))
return null; return null;
return ($this->_limited[$base_id]); return ($this->_limited[$base_id]);
} }
@@ -1509,18 +1525,18 @@ class ACL implements cache_cacheableInterface
{ {
if ($limit) if ($limit)
{ {
$sql = 'UPDATE basusr $sql = 'UPDATE basusr
SET time_limited = 1 SET time_limited = 1
, limited_from = :limited_from , limited_from = :limited_from
, limited_to = :limited_to , limited_to = :limited_to
WHERE base_id = :base_id AND usr_id = :usr_id'; WHERE base_id = :base_id AND usr_id = :usr_id';
} }
else else
{ {
$sql = 'UPDATE basusr $sql = 'UPDATE basusr
SET time_limited = 0 SET time_limited = 0
, limited_from = :limited_from , limited_from = :limited_from
, limited_to = :limited_to , limited_to = :limited_to
WHERE base_id = :base_id AND usr_id = :usr_id'; WHERE base_id = :base_id AND usr_id = :usr_id';
} }

View File

@@ -551,7 +551,7 @@ class API_OAuth2_Adapter extends OAuth2
return $account; return $account;
} }
/** /**
* *
* @param int $usr_id * @param int $usr_id

View File

@@ -71,7 +71,7 @@ class API_V1_Log
/** /**
* *
* @var API_OAuth2_Account * @var API_OAuth2_Account
*/ */
protected $account; protected $account;
@@ -85,7 +85,7 @@ class API_V1_Log
* *
* @param appbox $appbox * @param appbox $appbox
* @param Request $request * @param Request $request
* @param API_OAuth2_Account $account * @param API_OAuth2_Account $account
*/ */
public function __construct(appbox &$appbox, $log_id) public function __construct(appbox &$appbox, $log_id)
{ {
@@ -93,16 +93,16 @@ class API_V1_Log
$this->id = (int) $log_id; $this->id = (int) $log_id;
$sql = ' $sql = '
SELECT SELECT
api_log_id, api_log_id,
api_account_id, api_account_id,
api_log_route, api_log_route,
api_log_date, api_log_date,
api_log_status_code, api_log_status_code,
api_log_format, api_log_format,
api_log_ressource, api_log_ressource,
api_log_general, api_log_general,
api_log_aspect, api_log_aspect,
api_log_action api_log_action
FROM FROM
api_logs api_logs
@@ -172,7 +172,7 @@ class API_V1_Log
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
return $this; return $this;
} }
@@ -184,7 +184,7 @@ class API_V1_Log
public function set_status_code($status_code) public function set_status_code($status_code)
{ {
$this->status_code = (int) $status_code; $this->status_code = (int) $status_code;
$sql = 'UPDATE api_log $sql = 'UPDATE api_log
SET api_log_status_code = :code SET api_log_status_code = :code
WHERE api_log_id = :log_id'; WHERE api_log_id = :log_id';
@@ -197,7 +197,7 @@ class API_V1_Log
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
return $this; return $this;
} }
@@ -208,12 +208,12 @@ class API_V1_Log
public function set_format($format) public function set_format($format)
{ {
if (!in_array($format, array('json', 'jsonp', 'yaml', 'unknow'))) if (!in_array($format, array('json', 'jsonp', 'yaml', 'unknow')))
throw new Exception_InvalidArgument(); throw new Exception_InvalidArgument();
$this->format = $format; $this->format = $format;
$sql = 'UPDATE api_log $sql = 'UPDATE api_log
SET api_log_format = :format SET api_log_format = :format
WHERE api_log_id = :log_id'; WHERE api_log_id = :log_id';
@@ -226,7 +226,7 @@ class API_V1_Log
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
return $this; return $this;
} }
@@ -239,9 +239,9 @@ class API_V1_Log
{ {
if (!in_array($format, array(self::DATABOXES_RESSOURCE,self::BASKETS_RESSOURCE, self::FEEDS_RESSOURCE, self::RECORDS_RESSOURCE))) if (!in_array($format, array(self::DATABOXES_RESSOURCE,self::BASKETS_RESSOURCE, self::FEEDS_RESSOURCE, self::RECORDS_RESSOURCE)))
throw new Exception_InvalidArgument(); throw new Exception_InvalidArgument();
$this->ressource = $ressource; $this->ressource = $ressource;
$sql = 'UPDATE api_log $sql = 'UPDATE api_log
SET api_log_ressource = :ressource SET api_log_ressource = :ressource
WHERE api_log_id = :log_id'; WHERE api_log_id = :log_id';
@@ -254,7 +254,7 @@ class API_V1_Log
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
return $this; return $this;
} }
@@ -266,7 +266,7 @@ class API_V1_Log
public function set_general($general) public function set_general($general)
{ {
$this->general = $general; $this->general = $general;
$sql = 'UPDATE api_log $sql = 'UPDATE api_log
SET api_log_general = :general SET api_log_general = :general
WHERE api_log_id = :log_id'; WHERE api_log_id = :log_id';
@@ -279,7 +279,7 @@ class API_V1_Log
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
return $this; return $this;
} }
@@ -291,7 +291,7 @@ class API_V1_Log
public function set_aspect($aspect) public function set_aspect($aspect)
{ {
$this->aspect = $aspect; $this->aspect = $aspect;
$sql = 'UPDATE api_log $sql = 'UPDATE api_log
SET api_log_aspect = :aspect SET api_log_aspect = :aspect
WHERE api_log_id = :log_id'; WHERE api_log_id = :log_id';
@@ -304,7 +304,7 @@ class API_V1_Log
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
return $this; return $this;
} }
@@ -316,7 +316,7 @@ class API_V1_Log
public function set_action($action) public function set_action($action)
{ {
$this->action = $action; $this->action = $action;
$sql = 'UPDATE api_log $sql = 'UPDATE api_log
SET api_log_action = :action SET api_log_action = :action
WHERE api_log_id = :log_id'; WHERE api_log_id = :log_id';
@@ -329,7 +329,7 @@ class API_V1_Log
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();
return $this; return $this;
} }
@@ -338,8 +338,8 @@ class API_V1_Log
return $this->account; return $this->account;
} }
public static function create(appbox &$appbox, API_OAuth2_Account $account, $route, $status_code, $format, $ressource, $general = null, $aspect = null, $action = null) public static function create(appbox &$appbox, API_OAuth2_Account $account, $route, $status_code, $format, $ressource, $general = null, $aspect = null, $action = null)
{ {
$sql = ' $sql = '
INSERT INTO INSERT INTO
@@ -347,38 +347,38 @@ class API_V1_Log
api_log_id, api_log_id,
api_account_id, api_account_id,
api_log_route, api_log_route,
api_log_date, api_log_date,
api_log_status_code, api_log_status_code,
api_log_format, api_log_format,
api_log_ressource, api_log_ressource,
api_log_general, api_log_general,
api_log_aspect, api_log_aspect,
api_log_action api_log_action
) )
VALUES ( VALUES (
null, null,
:account_id, :account_id,
:route, :route,
NOW(), NOW(),
:status_code, :status_code,
:format, :format,
:ressource, :ressource,
:general, :general,
:aspect, :aspect,
:action :action
)'; )';
$params = array( $params = array(
':account_id' => $account->get_id(), ':account_id' => $account->get_id(),
':route' => $route, ':route' => $route,
':status_code' => $status_code, ':status_code' => $status_code,
':format' => $format, ':format' => $format,
':ressource' => $ressource, ':ressource' => $ressource,
':general' => $general, ':general' => $general,
':aspect' => $aspect, ':aspect' => $aspect,
':action' => $action ':action' => $action
); );
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$stmt->closeCursor(); $stmt->closeCursor();

View File

@@ -18,4 +18,4 @@
class Bridge_Exception extends Exception class Bridge_Exception extends Exception
{ {
} }

View File

@@ -68,4 +68,4 @@ class Controller_Admin_Fields implements ControllerProviderInterface
return $controllers; return $controllers;
} }
} }

View File

@@ -54,7 +54,7 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$request = $app['request']; $request = $app['request'];
$feed = Feed_Adapter::create($appbox, $user, $request->get('title'), $request->get('subtitle')); $feed = Feed_Adapter::create($appbox, $user, $request->get('title'), $request->get('subtitle'));
if($request->get('public') == '1') if($request->get('public') == '1')
$feed->set_public (true); $feed->set_public (true);
elseif ($request->get('base_id')) elseif ($request->get('base_id'))
@@ -93,6 +93,7 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
if (!$feed->is_owner($user)) if (!$feed->is_owner($user))
return $app->redirect('/admin/publications/feed/' . $id . '/?error=' . _('You are not the owner of this feed, you can not edit it')); return $app->redirect('/admin/publications/feed/' . $id . '/?error=' . _('You are not the owner of this feed, you can not edit it'));
$request = $app['request']; $request = $app['request'];
@@ -121,23 +122,29 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox); $user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
if (!$feed->is_owner($user)) if (!$feed->is_owner($user))
return new Response('ERROR:you are not allowed'); return new Response('ERROR:you are not allowed');
if ($_FILES['Filedata']['error'] !== 0) if ($_FILES['Filedata']['error'] !== 0)
return new Response('ERROR:error while upload'); return new Response('ERROR:error while upload');
$file = new system_file($_FILES['Filedata']['tmp_name']); $file = new system_file($_FILES['Filedata']['tmp_name']);
if (!in_array($file->get_mime(), array('image/jpeg', 'image/jpg', 'image/gif'))) if (!in_array($file->get_mime(), array('image/jpeg', 'image/jpg', 'image/gif')))
return new Response('ERROR:bad filetype'); return new Response('ERROR:bad filetype');
if ($file->getSize() > 200000) if ($file->getSize() > 200000)
return new Response('ERROR:file too large'); return new Response('ERROR:file too large');
$datas = $file->get_technical_datas(); $datas = $file->get_technical_datas();
if (!isset($datas[system_file::TC_DATAS_WIDTH]) || !isset($datas[system_file::TC_DATAS_HEIGHT])) if (!isset($datas[system_file::TC_DATAS_WIDTH]) || !isset($datas[system_file::TC_DATAS_HEIGHT]))
return new Response('ERROR:file is not square'); return new Response('ERROR:file is not square');
if ($datas[system_file::TC_DATAS_WIDTH] != $datas[system_file::TC_DATAS_HEIGHT]) if ($datas[system_file::TC_DATAS_WIDTH] != $datas[system_file::TC_DATAS_HEIGHT])
return new Response('ERROR:file is not square'); return new Response('ERROR:file is not square');
$feed->set_icon($file); $feed->set_icon($file);

View File

@@ -260,7 +260,7 @@ class Controller_Admin_Users implements ControllerProviderInterface
$response = new Response($CSVDatas, 200, array('Content-Type' => 'text/plain')); $response = new Response($CSVDatas, 200, array('Content-Type' => 'text/plain'));
$response->headers->set('Content-Disposition', 'attachment; filename=export.txt'); $response->headers->set('Content-Disposition', 'attachment; filename=export.txt');
return $response; return $response;
} }
); );

View File

@@ -54,7 +54,7 @@ class Controller_Prod_Records_Edit implements ControllerProviderInterface
return $twig->render($template, array('edit' => $editing, 'message' => '')); return $twig->render($template, array('edit' => $editing, 'message' => ''));
} }
); );
return $controllers; return $controllers;
} }

View File

@@ -57,4 +57,4 @@ class Controller_Prod_Records_MoveCollection implements ControllerProviderInterf
return $controllers; return $controllers;
} }
} }

View File

@@ -174,4 +174,4 @@ class Controller_Prod_Records_Tooltip implements ControllerProviderInterface
return $controllers; return $controllers;
} }
} }

View File

@@ -44,17 +44,17 @@ class Controller_RSSFeeds implements ControllerProviderInterface
{ {
$content = new Feed_XML_RSS(); $content = new Feed_XML_RSS();
} }
if ($format == Feed_Adapter::FORMAT_ATOM) if ($format == Feed_Adapter::FORMAT_ATOM)
{ {
$content = new Feed_XML_Atom(); $content = new Feed_XML_Atom();
} }
if($format == Feed_Adapter::FORMAT_COOLIRIS) if($format == Feed_Adapter::FORMAT_COOLIRIS)
{ {
$content = new Feed_XML_Cooliris(); $content = new Feed_XML_Cooliris();
} }
if ($user instanceof User_Adapter) if ($user instanceof User_Adapter)
$link = $feed->get_user_link($registry, $user, $format, $page); $link = $feed->get_user_link($registry, $user, $format, $page);
else else
@@ -82,7 +82,7 @@ class Controller_RSSFeeds implements ControllerProviderInterface
} }
foreach ($entries->get_entries() as $entry) foreach ($entries->get_entries() as $entry)
$content->set_item($entry); $content->set_item($entry);
$render = $content->render(); $render = $content->render();
$response = new Response($render, 200, array('Content-Type' => $content->get_mimetype())); $response = new Response($render, 200, array('Content-Type' => $content->get_mimetype()));
$response->setCharset('UTF-8'); $response->setCharset('UTF-8');
@@ -176,8 +176,8 @@ class Controller_RSSFeeds implements ControllerProviderInterface
return $display_feed($feed, Feed_Adapter::FORMAT_COOLIRIS , $page); return $display_feed($feed, Feed_Adapter::FORMAT_COOLIRIS , $page);
}); });
return $controllers; return $controllers;
} }
} }

View File

@@ -51,8 +51,8 @@ class Controller_Setup_Installer implements ControllerProviderInterface
$request = $app['request']; $request = $app['request'];
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/'; $servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
setup::write_config($servername); setup::write_config($servername);
$php_constraint = setup::check_php_version(); $php_constraint = setup::check_php_version();
$writability_constraints = setup::check_writability(new Setup_Registry()); $writability_constraints = setup::check_writability(new Setup_Registry());
$extension_constraints = setup::check_php_extension(); $extension_constraints = setup::check_php_extension();
@@ -89,11 +89,11 @@ class Controller_Setup_Installer implements ControllerProviderInterface
return $app->redirect('/setup/installer/step2/'); return $app->redirect('/setup/installer/step2/');
} }
$ld_path = array(dirname(__FILE__) . '/../../../../templates/web'); $ld_path = array(dirname(__FILE__) . '/../../../../templates/web');
$loader = new Twig_Loader_Filesystem($ld_path); $loader = new Twig_Loader_Filesystem($ld_path);
$twig = new Twig_Environment($loader); $twig = new Twig_Environment($loader);
$html = $twig->render( $html = $twig->render(
'/setup/index.twig' '/setup/index.twig'
, array_merge($constraints_coll, array( , array_merge($constraints_coll, array(
@@ -111,12 +111,12 @@ class Controller_Setup_Installer implements ControllerProviderInterface
$controllers->get('/step2/', function() use ($app) $controllers->get('/step2/', function() use ($app)
{ {
phrasea::use_i18n(Session_Handler::get_locale()); phrasea::use_i18n(Session_Handler::get_locale());
$ld_path = array(dirname(__FILE__) . '/../../../../templates/web'); $ld_path = array(dirname(__FILE__) . '/../../../../templates/web');
$loader = new Twig_Loader_Filesystem($ld_path); $loader = new Twig_Loader_Filesystem($ld_path);
$twig = new Twig_Environment($loader); $twig = new Twig_Environment($loader);
$twig->addExtension(new Twig_Extensions_Extension_I18n()); $twig->addExtension(new Twig_Extensions_Extension_I18n());
$request = $app['request']; $request = $app['request'];
@@ -303,4 +303,4 @@ class Controller_Setup_Installer implements ControllerProviderInterface
return $controllers; return $controllers;
} }
} }

View File

@@ -86,4 +86,4 @@ class Controller_Setup_Upgrader implements ControllerProviderInterface
return $controllers; return $controllers;
} }
} }

View File

@@ -50,7 +50,7 @@ class Controller_Utils_ConnectionTest implements ControllerProviderInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
if ($dbname && $connection_ok === true) if ($dbname && $connection_ok === true)
@@ -83,7 +83,7 @@ class Controller_Utils_ConnectionTest implements ControllerProviderInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }

View File

@@ -57,4 +57,4 @@ class Controller_Utils_PathFileTest implements ControllerProviderInterface
return $controllers; return $controllers;
} }
} }

View File

@@ -14,8 +14,8 @@ require_once __DIR__ . '/../vendor/dailymotion-sdk-php/Dailymotion.php';
class DailymotionWithoutOauth2 extends Dailymotion class DailymotionWithoutOauth2 extends Dailymotion
{ {
/** /**
* Call a remote method. * Call a remote method.
* *
@@ -37,7 +37,7 @@ class DailymotionWithoutOauth2 extends Dailymotion
'call' => $method, 'call' => $method,
'args' => $args, 'args' => $args,
)); ));
$status_code = null; $status_code = null;
try try
{ {
@@ -45,7 +45,7 @@ class DailymotionWithoutOauth2 extends Dailymotion
} }
catch (DailymotionAuthException $e) catch (DailymotionAuthException $e)
{ {
if ($e->error === 'invalid_token') if ($e->error === 'invalid_token')
{ {
throw new Bridge_Exception_ActionAuthNeedReconnect(); throw new Bridge_Exception_ActionAuthNeedReconnect();
@@ -84,8 +84,8 @@ class DailymotionWithoutOauth2 extends Dailymotion
return $result['result']; return $result['result'];
} }
/** /**
* Upload a file on the Dailymotion servers and generate an URL to be used with API methods. * Upload a file on the Dailymotion servers and generate an URL to be used with API methods.
* *
@@ -100,6 +100,7 @@ class DailymotionWithoutOauth2 extends Dailymotion
$this->timeout = null; $this->timeout = null;
$result = json_decode($this->httpRequest($result['upload_url'], array('file' => '@' . $filePath)), true); $result = json_decode($this->httpRequest($result['upload_url'], array('file' => '@' . $filePath)), true);
$this->timeout = $timeout; $this->timeout = $timeout;
return $result['url']; return $result['url'];
} }
} }

View File

@@ -10,12 +10,12 @@
*/ */
/** /**
* *
* @package Exception * @package Exception
* @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
*/ */
class Exception_Setup_FixBadEmailAddresses extends Exception class Exception_Setup_FixBadEmailAddresses extends Exception
{ {
} }

View File

@@ -26,7 +26,7 @@ abstract class Feed_Abstract
*/ */
const FORMAT_ATOM = 'atom'; const FORMAT_ATOM = 'atom';
/** /**
* *
*/ */
const FORMAT_COOLIRIS = 'cooliris'; const FORMAT_COOLIRIS = 'cooliris';

View File

@@ -57,7 +57,7 @@ class Feed_Adapter extends Feed_Abstract implements Feed_Interface, cache_cachea
const CACHE_ENTRY_NUMBER = 'entrynumber'; const CACHE_ENTRY_NUMBER = 'entrynumber';
const CACHE_USER_TOKEN = 'usr_token'; const CACHE_USER_TOKEN = 'usr_token';
const MAX_ENTRIES = 20; const MAX_ENTRIES = 20;
/** /**

View File

@@ -357,11 +357,11 @@ class Feed_Entry_Adapter implements Feed_Entry_Interface, cache_cacheableInterfa
return $this->publisher; return $this->publisher;
} }
/** /**
* *
* @param User_adapter $user * @param User_adapter $user
* @return boolean * @return boolean
*/ */
public function is_publisher(User_adapter $user) public function is_publisher(User_adapter $user)
{ {

View File

@@ -370,9 +370,11 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface
$medium = strtolower($content->get_record()->get_type()); $medium = strtolower($content->get_record()->get_type());
if (!in_array($medium, array('image', 'audio', 'video'))) if (!in_array($medium, array('image', 'audio', 'video')))
return $this; return $this;
if (!$preview_permalink || !$thumbnail_permalink) if (!$preview_permalink || !$thumbnail_permalink)
return $this; return $this;
//add item node to channel node //add item node to channel node

View File

@@ -324,7 +324,7 @@ class Session_Handler
{ {
if (!$this->phrasea_session instanceof Session_Phrasea) if (!$this->phrasea_session instanceof Session_Phrasea)
throw new \Exception('No phrasea session available'); throw new \Exception('No phrasea session available');
$this->phrasea_session->open(); $this->phrasea_session->open();
return $this; return $this;
@@ -597,7 +597,7 @@ class Session_Handler
'ssel_id' => $row['ssel_id'], 'ssel_id' => $row['ssel_id'],
'from' => $row['owner'], 'from' => $row['owner'],
'validate_id' => $row['validate_id'], 'validate_id' => $row['validate_id'],
'url' => $registry->get('GV_ServerName') 'url' => $registry->get('GV_ServerName')
. 'lightbox/validate/'.$row['ssel_id'].'/?LOG=' . $row['value'] . 'lightbox/validate/'.$row['ssel_id'].'/?LOG=' . $row['value']
); );

View File

@@ -55,14 +55,14 @@ class Setup_Upgrade
{ {
throw new Exception_Setup_UpgradeAlreadyStarted('The upgrade is already started'); throw new Exception_Setup_UpgradeAlreadyStarted('The upgrade is already started');
} }
$this->appbox = $appbox; $this->appbox = $appbox;
if(count(User_Adapter::get_wrong_email_users($appbox)) > 0) if(count(User_Adapter::get_wrong_email_users($appbox)) > 0)
{ {
throw new Exception_Setup_FixBadEmailAddresses('Please fix the database before starting'); throw new Exception_Setup_FixBadEmailAddresses('Please fix the database before starting');
} }
$this->write_lock(); $this->write_lock();
return $this; return $this;

View File

@@ -907,6 +907,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public static function get_usr_id_from_email($email) public static function get_usr_id_from_email($email)
{ {
if (is_null($email)) if (is_null($email))
return false; return false;
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
@@ -1255,7 +1256,7 @@ 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;
} }
@@ -1277,10 +1278,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
protected function load_preferences() protected function load_preferences()
{ {
if ($this->_prefs) if ($this->_prefs)
return $this; return $this;
$registry = \registry::get_instance(); $registry = \registry::get_instance();
$sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id'; $sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id';
$stmt = $this->appbox->get_connection()->prepare($sql); $stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':id' => $this->id)); $stmt->execute(array(':id' => $this->id));
@@ -1300,7 +1302,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
{ {
$v = $registry->get('GV_defaultQuery'); $v = $registry->get('GV_defaultQuery');
} }
$this->_prefs[$k] = $v; $this->_prefs[$k] = $v;
$this->update_pref($k, $v); $this->update_pref($k, $v);
} }
@@ -1378,7 +1380,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return $this; return $this;
@@ -1573,6 +1575,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
{ {
$this->load_preferences(); $this->load_preferences();
if (isset($this->_prefs[$prop]) && $this->_prefs[$prop] === $value) if (isset($this->_prefs[$prop]) && $this->_prefs[$prop] === $value)
return $value; return $value;
$ok = true; $ok = true;
@@ -1610,6 +1613,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
if (!$session->is_authenticated()) if (!$session->is_authenticated())
return; return;
$ses_id = $session->get_ses_id(); $ses_id = $session->get_ses_id();
@@ -1668,7 +1672,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
} }
@@ -1732,7 +1736,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return false; return false;
@@ -1818,7 +1822,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return $locale; return $locale;
@@ -1884,6 +1888,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_nonce() public function get_nonce()
{ {
if ($this->nonce) if ($this->nonce)
return $this->nonce; return $this->nonce;
$nonce = false; $nonce = false;

View File

@@ -269,7 +269,7 @@ class User_Query implements User_QueryInterface
$extra = $this->include_phantoms ? ' OR sbas_id IS NULL ' : ''; $extra = $this->include_phantoms ? ' OR sbas_id IS NULL ' : '';
$not_sbas_id = array_diff($this->active_sbas, $this->sbas_ids); $not_sbas_id = array_diff($this->active_sbas, $this->sbas_ids);
if (count($not_sbas_id) > 0 && count($not_sbas_id) < count($this->sbas_ids)) if (count($not_sbas_id) > 0 && count($not_sbas_id) < count($this->sbas_ids))
{ {
$sql .= sprintf(' AND ((sbas_id != %s ) ' . $extra . ')' $sql .= sprintf(' AND ((sbas_id != %s ) ' . $extra . ')'
@@ -489,6 +489,7 @@ class User_Query implements User_QueryInterface
public function get_total() public function get_total()
{ {
if ($this->total) if ($this->total)
return $this->total; return $this->total;
$conn = $this->appbox->get_connection(); $conn = $this->appbox->get_connection();
@@ -637,6 +638,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;
$this->bases_restrictions = true; $this->bases_restrictions = true;
@@ -661,6 +663,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;
$this->sbas_restrictions = true; $this->sbas_restrictions = true;

View File

@@ -215,7 +215,7 @@ class appbox extends base
$stmt = $this->get_connection()->prepare($sqlupd); $stmt = $this->get_connection()->prepare($sqlupd);
$stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id())); $stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id()));
$stmt->closeCursor(); $stmt->closeCursor();
$collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS); $collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS);
return $this; return $this;

View File

@@ -327,6 +327,7 @@ class basket_adapter implements cache_cacheableInterface
public function get_first_element() public function get_first_element()
{ {
foreach ($this->get_elements() as $basket_element) foreach ($this->get_elements() as $basket_element)
return $basket_element; return $basket_element;
return null; return null;
} }
@@ -338,6 +339,7 @@ class basket_adapter implements cache_cacheableInterface
public function get_validation_end_date() public function get_validation_end_date()
{ {
if (!$this->valid || !$this->validation_end_date) if (!$this->valid || !$this->validation_end_date)
return null; return null;
return $this->validation_end_date; return $this->validation_end_date;
} }
@@ -349,6 +351,7 @@ class basket_adapter implements cache_cacheableInterface
public function is_validation_finished() public function is_validation_finished()
{ {
if (!$this->valid || !$this->validation_end_date) if (!$this->valid || !$this->validation_end_date)
return null; return null;
$now = new DateTime(); $now = new DateTime();
@@ -362,6 +365,7 @@ class basket_adapter implements cache_cacheableInterface
public function is_confirmed() public function is_confirmed()
{ {
if (!$this->valid) if (!$this->valid)
return null; return null;
return $this->validation_is_confirmed; return $this->validation_is_confirmed;
@@ -370,14 +374,17 @@ class basket_adapter implements cache_cacheableInterface
public function is_releasable() public function is_releasable()
{ {
if (!$this->valid) if (!$this->valid)
return false; return false;
if ($this->is_confirmed()) if ($this->is_confirmed())
return false; return false;
foreach ($this->get_elements() as $element) foreach ($this->get_elements() as $element)
{ {
if ($element->get_my_agreement() == '0') if ($element->get_my_agreement() == '0')
return false; return false;
} }
@@ -477,7 +484,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'SELECT s.pushFrom, n.id as noview, s.usr_id as owner, s.rid $sql = 'SELECT s.pushFrom, n.id as noview, s.usr_id as owner, s.rid
@@ -542,7 +549,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -585,6 +592,7 @@ class basket_adapter implements cache_cacheableInterface
public function sort($order) public function sort($order)
{ {
if (!$this->valid || !in_array($order, array('asc', 'desc'))) if (!$this->valid || !in_array($order, array('asc', 'desc')))
return; return;
$this->load_elements(); $this->load_elements();
@@ -630,7 +638,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception_Record_AdapterNotFound $e) catch (Exception_Record_AdapterNotFound $e)
{ {
} }
catch (Exception $e) catch (Exception $e)
{ {
@@ -745,7 +753,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -900,7 +908,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
} }
@@ -1016,6 +1024,7 @@ class basket_adapter implements cache_cacheableInterface
public function set_read() public function set_read()
{ {
if (!$this->noview) if (!$this->noview)
return true; return true;
$session = $this->appbox->get_session(); $session = $this->appbox->get_session();
@@ -1075,7 +1084,7 @@ class basket_adapter implements cache_cacheableInterface
foreach ($this->get_elements() as $basket_element) foreach ($this->get_elements() as $basket_element)
{ {
$basket_element->validate($me, $user, $insert_id, $can_hd); $basket_element->validate($me, $user, $insert_id, $can_hd);
if ($can_hd && $me->ACL()->has_hd_grant($basket_element->get_record())) if ($can_hd && $me->ACL()->has_hd_grant($basket_element->get_record()))
$user->ACL()->grant_hd_on($basket_element->get_record(), $me, 'validate'); $user->ACL()->grant_hd_on($basket_element->get_record(), $me, 'validate');
else else
@@ -1131,15 +1140,19 @@ class basket_adapter implements cache_cacheableInterface
if ($this->is_mine) if ($this->is_mine)
{ {
if ($this->is_validation_finished()) if ($this->is_validation_finished())
return sprintf(_('Vous aviez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1)); return sprintf(_('Vous aviez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1));
else else
return sprintf(_('Vous avez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1)); return sprintf(_('Vous avez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1));
} }
else else
{ {
if ($this->validation_see_others) if ($this->validation_see_others)
return sprintf(_('Processus de validation recu de %s et concernant %d utilisateurs'), User_Adapter::getInstance($this->usr_id, $this->appbox)->get_display_name(), (count($this->validating_users) - 1)); return sprintf(_('Processus de validation recu de %s et concernant %d utilisateurs'), User_Adapter::getInstance($this->usr_id, $this->appbox)->get_display_name(), (count($this->validating_users) - 1));
else else
return sprintf(_('Processus de validation recu de %s'), User_Adapter::getInstance($this->usr_id, $this->appbox)->get_display_name()); return sprintf(_('Processus de validation recu de %s'), User_Adapter::getInstance($this->usr_id, $this->appbox)->get_display_name());
} }
} }
@@ -1248,6 +1261,7 @@ class basket_adapter implements cache_cacheableInterface
protected function load_elements() protected function load_elements()
{ {
if (!is_null($this->elements)) if (!is_null($this->elements))
return; return;
$this->elements = array(); $this->elements = array();
@@ -1274,7 +1288,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -1372,7 +1386,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return array('error' => true, 'status' => 0); return array('error' => true, 'status' => 0);
@@ -1412,7 +1426,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$ret = array('error' => false, 'status' => 0); $ret = array('error' => false, 'status' => 0);
@@ -1525,11 +1539,14 @@ class basket_adapter implements cache_cacheableInterface
public function remove_from_ssel($sselcont_id) public function remove_from_ssel($sselcont_id)
{ {
if (!$this->is_mine) if (!$this->is_mine)
return array('error' => 'error', 'status' => 0); return array('error' => 'error', 'status' => 0);
if ($this->is_grouping) if ($this->is_grouping)
return $this->remove_grouping_elements($sselcont_id); return $this->remove_grouping_elements($sselcont_id);
else else
return $this->remove_basket_elements($sselcont_id); return $this->remove_basket_elements($sselcont_id);
} }
@@ -1869,7 +1886,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return $appbox->delete_data_from_cache($ssel_ids); return $appbox->delete_data_from_cache($ssel_ids);
@@ -1897,7 +1914,7 @@ class basket_adapter implements cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'SELECT id, usr_id, confirmed, can_agree, can_see_others $sql = 'SELECT id, usr_id, confirmed, can_agree, can_see_others

View File

@@ -548,20 +548,20 @@ class basket_element_adapter implements cache_cacheableInterface
} }
$this->delete_data_from_cache(); $this->delete_data_from_cache();
$sql = 'SELECT distinct v.usr_id FROM ssel s, validate v $sql = 'SELECT distinct v.usr_id FROM ssel s, validate v
WHERE v.ssel_id = s.ssel_id AND s.ssel_id = :ssel_id'; WHERE v.ssel_id = s.ssel_id AND s.ssel_id = :ssel_id';
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute(array(':ssel_id' => $this->get_ssel_id())); $stmt->execute(array(':ssel_id' => $this->get_ssel_id()));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
foreach($rs as $row) foreach($rs as $row)
{ {
$appbox->delete_data_from_cache('basket_element_' . $row['usr_id'] . '_' . $this->sselcont_id); $appbox->delete_data_from_cache('basket_element_' . $row['usr_id'] . '_' . $this->sselcont_id);
} }
try try
{ {
$basket = basket_adapter::getInstance($appbox, $this->ssel_id, $usr_id); $basket = basket_adapter::getInstance($appbox, $this->ssel_id, $usr_id);
@@ -654,23 +654,23 @@ class basket_element_adapter implements cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
$this->delete_data_from_cache(); $this->delete_data_from_cache();
$sql = 'SELECT distinct v.usr_id FROM ssel s, validate v $sql = 'SELECT distinct v.usr_id FROM ssel s, validate v
WHERE v.ssel_id = s.ssel_id AND s.ssel_id = :ssel_id'; WHERE v.ssel_id = s.ssel_id AND s.ssel_id = :ssel_id';
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute(array(':ssel_id' => $this->get_ssel_id())); $stmt->execute(array(':ssel_id' => $this->get_ssel_id()));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
foreach($rs as $row) foreach($rs as $row)
{ {
$appbox->delete_data_from_cache('basket_element_' . $row['usr_id'] . '_' . $this->sselcont_id); $appbox->delete_data_from_cache('basket_element_' . $row['usr_id'] . '_' . $this->sselcont_id);
} }
$basket = basket_adapter::getInstance($appbox, $this->ssel_id, $usr_id); $basket = basket_adapter::getInstance($appbox, $this->ssel_id, $usr_id);
$basket->delete_cache(); $basket->delete_cache();
return $this; return $this;
} }

View File

@@ -151,7 +151,7 @@ class basketCollection
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$conn = $appbox->get_connection(); $conn = $appbox->get_connection();
$session = $appbox->get_session(); $session = $appbox->get_session();
$sql = 'SELECT n.ssel_id FROM sselnew n $sql = 'SELECT n.ssel_id FROM sselnew n
WHERE n.usr_id = :usr_id '; WHERE n.usr_id = :usr_id ';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(array(':usr_id' => $session->get_usr_id())); $stmt->execute(array(':usr_id' => $session->get_usr_id()));
@@ -164,12 +164,12 @@ class basketCollection
try try
{ {
$basket = basket_adapter::getInstance($appbox, $row['ssel_id'], $session->get_usr_id()); $basket = basket_adapter::getInstance($appbox, $row['ssel_id'], $session->get_usr_id());
if ($basket->is_valid() && !$basket->is_my_valid() && $basket->is_validation_finished()) if ($basket->is_valid() && !$basket->is_my_valid() && $basket->is_validation_finished())
throw new Exception('Finished'); throw new Exception('Finished');
$baskets[] = $basket; $baskets[] = $basket;
} }
catch(Exception $e) catch(Exception $e)
{ {

View File

@@ -154,7 +154,7 @@ class bootstrap
Twig_Autoloader::register(); Twig_Autoloader::register();
Twig_Extensions_Autoloader::register(); Twig_Extensions_Autoloader::register();
/** /**
* Load symfony components needed * Load symfony components needed
*/ */

View File

@@ -43,7 +43,7 @@ class cache_databox
} }
catch (\Exception $e) catch (\Exception $e)
{ {
} }
if ($last_update) if ($last_update)

View File

@@ -208,7 +208,7 @@ class caption_field implements cache_cacheableInterface
{ {
if(strlen($separator) > 1) if(strlen($separator) > 1)
$separator = $separator[0]; $separator = $separator[0];
if (trim($separator) === '') if (trim($separator) === '')
$separator = ' '; $separator = ' ';
else else

View File

@@ -60,6 +60,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
protected function retrieve_fields() protected function retrieve_fields()
{ {
if (is_array($this->fields)) if (is_array($this->fields))
return $this->fields; return $this->fields;
$fields = array(); $fields = array();
@@ -96,7 +97,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
$this->fields = $rec_fields; $this->fields = $rec_fields;
@@ -133,6 +134,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
{ {
$fields = $this->retrieve_fields(); $fields = $this->retrieve_fields();
if (isset($this->dces_elements[$label])) if (isset($this->dces_elements[$label]))
return $fields[$this->dces_elements[$label]]; return $fields[$this->dces_elements[$label]];
return null; return null;
} }

View File

@@ -200,9 +200,9 @@ class collection implements cache_cacheableInterface
$stmt = $this->get_connection()->prepare($sql); $stmt = $this->get_connection()->prepare($sql);
$stmt->execute(array(':pub_wm' => $publi, ':coll_id' => $this->get_coll_id())); $stmt->execute(array(':pub_wm' => $publi, ':coll_id' => $this->get_coll_id()));
$stmt->closeCursor(); $stmt->closeCursor();
$this->pub_wm = $publi; $this->pub_wm = $publi;
$this->delete_data_from_cache(); $this->delete_data_from_cache();
} }
@@ -223,9 +223,9 @@ class collection implements cache_cacheableInterface
$stmt->closeCursor(); $stmt->closeCursor();
$this->name = $name; $this->name = $name;
$this->delete_data_from_cache(); $this->delete_data_from_cache();
phrasea::reset_baseDatas(); phrasea::reset_baseDatas();
return $this; return $this;
@@ -404,7 +404,7 @@ class collection implements cache_cacheableInterface
$stmt = $this->get_connection()->prepare($sql); $stmt = $this->get_connection()->prepare($sql);
$stmt->execute(array(':prefs' => $this->prefs, ':coll_id' => $this->get_coll_id())); $stmt->execute(array(':prefs' => $this->prefs, ':coll_id' => $this->get_coll_id()));
$stmt->closeCursor(); $stmt->closeCursor();
$this->delete_data_from_cache(); $this->delete_data_from_cache();
return $this->prefs; return $this->prefs;

View File

@@ -175,6 +175,7 @@ class connection
self::$_PDO_instance[$name] = null; self::$_PDO_instance[$name] = null;
unset(self::$_PDO_instance[$name]); unset(self::$_PDO_instance[$name]);
} }
return; return;
} }

View File

@@ -142,7 +142,7 @@ class databox extends base
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -157,7 +157,7 @@ class databox extends base
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
@@ -451,6 +451,7 @@ class databox extends base
$stmt->closeCursor(); $stmt->closeCursor();
if ($row) if ($row)
return self::get_instance((int) $row['sbas_id']); return self::get_instance((int) $row['sbas_id']);
try try
@@ -463,7 +464,7 @@ class databox extends base
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'USE `' . $dbname . '`'; $sql = 'USE `' . $dbname . '`';
@@ -575,6 +576,7 @@ class databox extends base
public function get_meta_structure() public function get_meta_structure()
{ {
if ($this->meta_struct) if ($this->meta_struct)
return $this->meta_struct; return $this->meta_struct;
try try
@@ -697,6 +699,7 @@ class databox extends base
} }
} }
if ($n > $limit) if ($n > $limit)
return true; return true;
return false; return false;
@@ -986,7 +989,7 @@ class databox extends base
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
if (isset($field['regname'])) if (isset($field['regname']))
@@ -1220,6 +1223,7 @@ class databox extends base
public function get_structure() public function get_structure()
{ {
if ($this->structure) if ($this->structure)
return $this->structure; return $this->structure;
$this->structure = $this->retrieve_structure(); $this->structure = $this->retrieve_structure();
@@ -1234,7 +1238,7 @@ class databox extends base
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$structure = null; $structure = null;
@@ -1260,6 +1264,7 @@ class databox extends base
public function get_cterms() public function get_cterms()
{ {
if ($this->cterms) if ($this->cterms)
return $this->cterms; return $this->cterms;
$sql = "SELECT value FROM pref WHERE prop='cterms'"; $sql = "SELECT value FROM pref WHERE prop='cterms'";
@@ -1426,6 +1431,7 @@ class databox extends base
public function get_cgus() public function get_cgus()
{ {
if ($this->cgus) if ($this->cgus)
return $this->cgus; return $this->cgus;
$this->load_cgus(); $this->load_cgus();
@@ -1443,7 +1449,7 @@ class databox extends base
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'SELECT value, locale, updated_on FROM pref WHERE prop ="ToU"'; $sql = 'SELECT value, locale, updated_on FROM pref WHERE prop ="ToU"';

View File

@@ -94,12 +94,12 @@ class databox_cgu
$terms = array(); $terms = array();
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
if(!$home) if(!$home)
{ {
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox); $user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
} }
foreach ($appbox->get_databoxes() as $databox) foreach ($appbox->get_databoxes() as $databox)
{ {
try try

View File

@@ -554,7 +554,7 @@ class databox_field implements cache_cacheableInterface
{ {
if (strpos($separator, ';') === false) if (strpos($separator, ';') === false)
$separator .= ';'; $separator .= ';';
$this->separator = $separator; $this->separator = $separator;
return $this; return $this;

View File

@@ -159,13 +159,13 @@ class databox_status
$statuses = array(); $statuses = array();
$sbas_ids = $user->ACL()->get_granted_sbas(); $sbas_ids = $user->ACL()->get_granted_sbas();
$see_all = array(); $see_all = array();
foreach ($sbas_ids as $databox) foreach ($sbas_ids as $databox)
{ {
$see_all[$databox->get_sbas_id()] = false; $see_all[$databox->get_sbas_id()] = false;
foreach($databox->get_collections() as $collection) foreach($databox->get_collections() as $collection)
{ {
if($user->ACL()->has_right_on_base($collection->get_base_id(), 'chgstatus')) if($user->ACL()->has_right_on_base($collection->get_base_id(), 'chgstatus'))
@@ -193,7 +193,7 @@ class databox_status
if ($user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct')) if ($user->ACL()->has_right_on_sbas($sbas_id, 'bas_modify_struct'))
$see_this = true; $see_this = true;
foreach ($status as $bit => $props) foreach ($status as $bit => $props)
{ {
@@ -491,7 +491,7 @@ class databox_status
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
$status = '0'; $status = '0';
if(substr($stat1, 0, 2) === '0x') if(substr($stat1, 0, 2) === '0x')
{ {
$stat1 = self::hex2bin(substr($stat1, 2)); $stat1 = self::hex2bin(substr($stat1, 2));
@@ -530,7 +530,7 @@ class databox_status
{ {
$stat2 = self::hex2bin(substr($stat2, 2)); $stat2 = self::hex2bin(substr($stat2, 2));
} }
$sql = 'select bin(0b' . trim($stat1) . ' & ~0b' . trim($stat2) . ') as result'; $sql = 'select bin(0b' . trim($stat1) . ' & ~0b' . trim($stat2) . ') as result';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
@@ -560,7 +560,7 @@ class databox_status
{ {
$stat2 = self::hex2bin(substr($stat2, 2)); $stat2 = self::hex2bin(substr($stat2, 2));
} }
$sql = 'select bin(0b' . trim($stat1) . ' | 0b' . trim($stat2) . ') as result'; $sql = 'select bin(0b' . trim($stat1) . ' | 0b' . trim($stat2) . ') as result';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
@@ -579,12 +579,12 @@ class databox_status
public static function dec2bin($status) public static function dec2bin($status)
{ {
$status = (string) $status; $status = (string) $status;
if(!ctype_digit($status)) if(!ctype_digit($status))
{ {
throw new \Exception('Non-decimal value'); throw new \Exception('Non-decimal value');
} }
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
$sql = 'select bin(' . $status . ') as result'; $sql = 'select bin(' . $status . ') as result';
@@ -595,7 +595,7 @@ class databox_status
$stmt->closeCursor(); $stmt->closeCursor();
$status = '0'; $status = '0';
if ($row) if ($row)
{ {
$status = $row['result']; $status = $row['result'];
@@ -611,12 +611,12 @@ class databox_status
{ {
$status = substr($status, 2); $status = substr($status, 2);
} }
if(!ctype_xdigit($status)) if(!ctype_xdigit($status))
{ {
throw new \Exception('Non-hexadecimal value'); throw new \Exception('Non-hexadecimal value');
} }
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
$sql = 'select BIN( CAST( 0x'.trim($status).' AS UNSIGNED ) ) as result'; $sql = 'select BIN( CAST( 0x'.trim($status).' AS UNSIGNED ) ) as result';
@@ -627,7 +627,7 @@ class databox_status
$stmt->closeCursor(); $stmt->closeCursor();
$status = '0'; $status = '0';
if ($row) if ($row)
{ {
$status = $row['result']; $status = $row['result'];

View File

@@ -76,6 +76,7 @@ class gatekeeper
$session = $appbox->get_session(); $session = $appbox->get_session();
if (http_request::is_command_line()) if (http_request::is_command_line())
return; return;
if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF'])) if (isset($_SERVER['PHP_SELF']) && trim($_SERVER['PHP_SELF']))
@@ -104,7 +105,7 @@ class gatekeeper
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -121,6 +122,7 @@ class gatekeeper
if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php' if ($this->_PHP_SELF == '/thesaurus2/xmlhttp/getterm.x.php'
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php' || $this->_PHP_SELF == '/thesaurus2/xmlhttp/searchcandidate.x.php'
|| $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php') || $this->_PHP_SELF == '/thesaurus2/xmlhttp/getsy.x.php')
return; return;
phrasea::redirect('/login/?redirect=/thesaurus2'); phrasea::redirect('/login/?redirect=/thesaurus2');
break; break;
@@ -129,6 +131,7 @@ class gatekeeper
break; break;
case 'admin': case 'admin':
if ($this->_script_name === 'runscheduler.php') if ($this->_script_name === 'runscheduler.php')
return; return;
phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']); phrasea::redirect('/login/?redirect=' . $_SERVER['REQUEST_URI']);
break; break;
@@ -148,6 +151,7 @@ class gatekeeper
return; return;
case 'setup': case 'setup':
if ($appbox->upgradeavailable()) if ($appbox->upgradeavailable())
return; return;
else else
phrasea::redirect('/login/'); phrasea::redirect('/login/');
@@ -264,6 +268,7 @@ class gatekeeper
$parm = $request->get_parms('LOG'); $parm = $request->get_parms('LOG');
if (is_null($parm["LOG"])) if (is_null($parm["LOG"]))
return $this; return $this;
try try
@@ -281,11 +286,12 @@ class gatekeeper
try try
{ {
$datas = random::helloToken($parm['LOG']); $datas = random::helloToken($parm['LOG']);
return phrasea::redirect("/lightbox/validate/" . $datas['datas'] . "/"); return phrasea::redirect("/lightbox/validate/" . $datas['datas'] . "/");
} }
catch (Exception_NotFound $e) catch (Exception_NotFound $e)
{ {
} }
return $this; return $this;

View File

@@ -33,7 +33,7 @@ class geonames
{ {
return ''; return '';
} }
$registry = registry::get_instance(); $registry = registry::get_instance();
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/') $url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid=' . 'get_name.php?geonameid='
@@ -94,6 +94,7 @@ class geonames
$cityName = self::clean_input($cityName); $cityName = self::clean_input($cityName);
if (strlen($cityName) === 0) if (strlen($cityName) === 0)
return $output; return $output;
$registry = registry::get_instance(); $registry = registry::get_instance();
@@ -134,6 +135,7 @@ class geonames
public function find_geoname_from_ip($ip) public function find_geoname_from_ip($ip)
{ {
if (array_key_exists($ip, $this->cache_ips)) if (array_key_exists($ip, $this->cache_ips))
return $this->cache_ips[$ip]; return $this->cache_ips[$ip];
$output = array( $output = array(

View File

@@ -93,7 +93,7 @@ class http_request
return true; return true;
return false; return false;
} }
public function is_secure() public function is_secure()
{ {
return ( return (

View File

@@ -138,7 +138,7 @@ class lazaretFile
$record = new record_adapter($sbas_id, $record_id); $record = new record_adapter($sbas_id, $record_id);
$record->substitute_subdef('document', new system_file($pathfile)); $record->substitute_subdef('document', new system_file($pathfile));
$this->delete(); $this->delete();
return $this; return $this;

View File

@@ -34,4 +34,4 @@ return call_user_func(
}); });
return $app; return $app;
}); });

View File

@@ -58,6 +58,7 @@ return call_user_func(
{ {
$browser = Browser::getInstance(); $browser = Browser::getInstance();
if (!$browser->isMobile()) if (!$browser->isMobile())
return new Response(''); return new Response('');
$twig = new supertwig(); $twig = new supertwig();

View File

@@ -70,10 +70,11 @@ return call_user_func(function()
return new response($twig->render('/prod/actions/Bridge/deactivated.twig', $params), 200); return new response($twig->render('/prod/actions/Bridge/deactivated.twig', $params), 200);
} }
return new response($twig->render('/prod/actions/Bridge/error.twig', $params), 200); return new response($twig->render('/prod/actions/Bridge/error.twig', $params), 200);
} }
}); });
return $app; return $app;
}); });

View File

@@ -34,10 +34,13 @@ return call_user_func(function()
{ {
$browser = Browser::getInstance(); $browser = Browser::getInstance();
if ($browser->isMobile()) if ($browser->isMobile())
return $app->redirect("/login/?redirect=/lightbox"); return $app->redirect("/login/?redirect=/lightbox");
elseif ($browser->isNewGeneration()) elseif ($browser->isNewGeneration())
return $app->redirect("/login/?redirect=/prod"); return $app->redirect("/login/?redirect=/prod");
else else
return $app->redirect("/login/?redirect=/client"); return $app->redirect("/login/?redirect=/client");
}); });
@@ -70,6 +73,7 @@ return call_user_func(function()
/** /**
* Mount all aps * Mount all aps
*/ */
return $app; return $app;
} }
); );

View File

@@ -49,8 +49,10 @@ return call_user_func(function()
$app->get('/', function() use ($app) $app->get('/', function() use ($app)
{ {
if ($app['install'] === true) if ($app['install'] === true)
return $app->redirect('/setup/installer/'); return $app->redirect('/setup/installer/');
if ($app['upgrade'] === true) if ($app['upgrade'] === true)
return $app->redirect('/setup/upgrader/'); return $app->redirect('/setup/upgrader/');
}); });
@@ -63,6 +65,7 @@ return call_user_func(function()
$app->error(function($e) use ($app) $app->error(function($e) use ($app)
{ {
if ($e instanceof Exception_Setup_PhraseaAlreadyInstalled) if ($e instanceof Exception_Setup_PhraseaAlreadyInstalled)
return $app->redirect('/login'); return $app->redirect('/login');
return new Response( return new Response(
@@ -77,4 +80,4 @@ return call_user_func(function()
}); });
return $app; return $app;
}); });

View File

@@ -77,6 +77,7 @@ class module_admin
); );
$twig = new supertwig(); $twig = new supertwig();
return $twig->render('admin/tree.html.twig', $params); return $twig->render('admin/tree.html.twig', $params);
} }

View File

@@ -42,7 +42,7 @@ class module_admin_route_users
return $this; return $this;
} }
public function export(Symfony\Component\HttpFoundation\Request $request) public function export(Symfony\Component\HttpFoundation\Request $request)
{ {
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
@@ -143,8 +143,8 @@ class module_admin_route_users
if (is_null($v)) if (is_null($v))
$this->query_parms[$k] = false; $this->query_parms[$k] = false;
} }
$query = new User_Query($appbox); $query = new User_Query($appbox);
$templates = $query $templates = $query
->only_templates(true) ->only_templates(true)

View File

@@ -183,7 +183,7 @@ class module_admin_route_users_edit
$templates = $query $templates = $query
->only_templates(true) ->only_templates(true)
->execute()->get_results(); ->execute()->get_results();
$this->users_datas = $rs; $this->users_datas = $rs;
$out = array( $out = array(
'datas' => $this->users_datas, 'datas' => $this->users_datas,
@@ -543,7 +543,7 @@ class module_admin_route_users_edit
} }
$users = $this->users; $users = $this->users;
$user = User_adapter::getInstance(array_pop($users), appbox::get_instance()); $user = User_adapter::getInstance(array_pop($users), appbox::get_instance());
if ($user->is_template() || $user->is_special()) if ($user->is_template() || $user->is_special())
@@ -594,29 +594,29 @@ class module_admin_route_users_edit
{ {
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
$template = \User_adapter::getInstance($this->request->get('template'), $appbox); $template = \User_adapter::getInstance($this->request->get('template'), $appbox);
if ($template->get_template_owner()->get_id() != $session->get_usr_id()) if ($template->get_template_owner()->get_id() != $session->get_usr_id())
{ {
throw new \Exception_Forbidden('You are not the owner of the template'); throw new \Exception_Forbidden('You are not the owner of the template');
} }
$current_user = \User_adapter::getInstance($session->get_usr_id(), $appbox); $current_user = \User_adapter::getInstance($session->get_usr_id(), $appbox);
$base_ids = array_keys($current_user->ACL()->get_granted_base(array('canadmin'))); $base_ids = array_keys($current_user->ACL()->get_granted_base(array('canadmin')));
foreach ($this->users as $usr_id) foreach ($this->users as $usr_id)
{ {
$user = \User_adapter::getInstance($usr_id, $appbox); $user = \User_adapter::getInstance($usr_id, $appbox);
if($user->is_template()) if($user->is_template())
{ {
continue; continue;
} }
$user->ACL()->apply_model($template, $base_ids); $user->ACL()->apply_model($template, $base_ids);
} }
return $this; return $this;
} }

View File

@@ -338,7 +338,7 @@ return call_user_func(function()
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return new Response(json_encode($result), 200, array("content-type" => "application/json")); return new Response(json_encode($result), 200, array("content-type" => "application/json"));
@@ -367,7 +367,7 @@ return call_user_func(function()
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return new response(json_encode($result), 200, array("content-type" => "application/json")); return new response(json_encode($result), 200, array("content-type" => "application/json"));
@@ -387,7 +387,7 @@ return call_user_func(function()
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return new Response(json_encode($result), 200, array("content-type" => "application/json")); return new Response(json_encode($result), 200, array("content-type" => "application/json"));
@@ -405,7 +405,7 @@ return call_user_func(function()
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return new Response(json_encode($result), 200, array("content-type" => "application/json")); return new Response(json_encode($result), 200, array("content-type" => "application/json"));
@@ -430,4 +430,4 @@ return call_user_func(function()
return $app; return $app;
}); });

View File

@@ -29,7 +29,7 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception; use Symfony\Component\HttpKernel\Exception;
return call_user_func(function(){ return call_user_func(function(){
$app = new Silex\Application(); $app = new Silex\Application();
@@ -42,7 +42,7 @@ $app["appbox"] = appbox::get_instance();
$app['p4user'] = null; $app['p4user'] = null;
/** /**
* @var API_OAuth2_Token * @var API_OAuth2_Token
*/ */
$app['token'] = null; $app['token'] = null;
@@ -121,6 +121,7 @@ $parseRoute = function ($route, Response $response)
} }
} }
} }
return array('ressource' => $ressource, 'general' => $general, 'aspect' => $aspect, 'action' => $action); return array('ressource' => $ressource, 'general' => $general, 'aspect' => $aspect, 'action' => $action);
}; };
@@ -139,6 +140,7 @@ $app->before(function($request) use ($app)
$app['token'] = API_OAuth2_Token::load_by_oauth_token($app["appbox"], $oauth2_adapter->getToken()); $app['token'] = API_OAuth2_Token::load_by_oauth_token($app["appbox"], $oauth2_adapter->getToken());
if ($session->is_authenticated()) if ($session->is_authenticated())
return; return;
if ($oauth2_adapter->has_ses_id()) if ($oauth2_adapter->has_ses_id())
{ {
@@ -150,7 +152,7 @@ $app->before(function($request) use ($app)
} }
catch (\Exception $e) catch (\Exception $e)
{ {
} }
} }
$auth = new Session_Authentication_None($app['p4user']); $auth = new Session_Authentication_None($app['p4user']);
@@ -171,7 +173,7 @@ $app->after(function (Request $request, Response $response) use ($app, $parseRou
$route = $parseRoute($pathInfo, $response); $route = $parseRoute($pathInfo, $response);
$log = API_V1_Log::create( $log = API_V1_Log::create(
$app["appbox"], $app["appbox"],
$account, $account,
$request->getMethod() . " " . $pathInfo, $request->getMethod() . " " . $pathInfo,
$response->getStatusCode(), $response->getStatusCode(),
$response->headers->get('content-type'), $response->headers->get('content-type'),
@@ -659,7 +661,7 @@ $app->get('/feeds/{wrong_feed_id}/content/', $bad_request_exception);
*/ */
$app->error(function (\Exception $e) use ($app) $app->error(function (\Exception $e) use ($app)
{ {
if ($e instanceof API_V1_exception_methodnotallowed) if ($e instanceof API_V1_exception_methodnotallowed)
$code = API_V1_result::ERROR_METHODNOTALLOWED; $code = API_V1_result::ERROR_METHODNOTALLOWED;
elseif ($e instanceof Exception\MethodNotAllowedHttpException) elseif ($e instanceof Exception\MethodNotAllowedHttpException)
@@ -745,4 +747,4 @@ $app->error(function (\Exception $e) use ($app)
//// public function add_user(\Symfony\Component\HttpFoundation\Request $app['request']); //// public function add_user(\Symfony\Component\HttpFoundation\Request $app['request']);
return $app; return $app;
}); });

View File

@@ -46,14 +46,14 @@ class module_console_systemUpgrade extends Command
$output->writeln('This version of Phraseanet requires a config/config.inc'); $output->writeln('This version of Phraseanet requires a config/config.inc');
$output->writeln('Would you like it to be created based on your settings ?'); $output->writeln('Would you like it to be created based on your settings ?');
$dialog = $this->getHelperSet()->get('dialog'); $dialog = $this->getHelperSet()->get('dialog');
do do
{ {
$continue = mb_strtolower($dialog->ask($output, '<question>' . _('Create automatically') . ' (Y/n)</question>', 'y')); $continue = mb_strtolower($dialog->ask($output, '<question>' . _('Create automatically') . ' (Y/n)</question>', 'y'));
} }
while (!in_array($continue, array('y', 'n'))); while (!in_array($continue, array('y', 'n')));
if ($continue == 'y') if ($continue == 'y')
{ {
require __DIR__ . "/../../../../config/_GV.php"; require __DIR__ . "/../../../../config/_GV.php";
@@ -64,16 +64,16 @@ class module_console_systemUpgrade extends Command
.'$debug=false;'."\n" .'$debug=false;'."\n"
.'$debug=true;'."\n" .'$debug=true;'."\n"
.''; .'';
file_put_contents(__DIR__ . "/../../../../config/config.inc", $datas); file_put_contents(__DIR__ . "/../../../../config/config.inc", $datas);
} }
else else
{ {
throw new RuntimeException('Phraseanet is not set up'); throw new RuntimeException('Phraseanet is not set up');
} }
} }
} }
require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php'; require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php';

View File

@@ -75,7 +75,7 @@ class module_prod
else else
$dates[$name] = array('sbas' => array($sbas_id), 'fieldname' => $name); $dates[$name] = array('sbas' => array($sbas_id), 'fieldname' => $name);
} }
if (isset($fields[$name])) if (isset($fields[$name]))
{ {
$fields[$name]['sbas'][] = $sbas_id; $fields[$name]['sbas'][] = $sbas_id;

View File

@@ -244,7 +244,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$_lst[$indice]['type'] = $record->get_type(); $_lst[$indice]['type'] = $record->get_type();
} }
@@ -450,11 +450,12 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
if (!is_array($request->get('mds'))) if (!is_array($request->get('mds')))
return $this; return $this;
$sbas_id = (int) $request->get('sbid'); $sbas_id = (int) $request->get('sbid');

View File

@@ -500,6 +500,7 @@ class module_report
public function getOrder($k = false) public function getOrder($k = false)
{ {
if ($k === false) if ($k === false)
return $this->tab_order; return $this->tab_order;
return $this->tab_order[$k]; return $this->tab_order[$k];
} }
@@ -819,6 +820,7 @@ class module_report
public function buildReport($tab = false, $groupby = false, $on = false) public function buildReport($tab = false, $groupby = false, $on = false)
{ {
if (sizeof($this->report) > 0) if (sizeof($this->report) > 0)
return $this->report; return $this->report;
$conn = connection::getPDOConnection($this->sbas_id); $conn = connection::getPDOConnection($this->sbas_id);

View File

@@ -935,7 +935,7 @@ class module_report_activity extends module_report
AND (" . $collfilter['sql'] . ") AND (" . $collfilter['sql'] . ")
GROUP by ddate GROUP by ddate
ORDER BY ddate ASC"; ORDER BY ddate ASC";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -951,7 +951,7 @@ class module_report_activity extends module_report
{ {
$res[$key] = number_format($act, 2, '.', ''); $res[$key] = number_format($act, 2, '.', '');
} }
return $res; return $res;
} }
@@ -1102,7 +1102,7 @@ class module_report_activity extends module_report
AND (" . $collfilter['sql'] . ") AND (" . $collfilter['sql'] . ")
GROUP BY ddate GROUP BY ddate
ORDER BY activity ASC "; ORDER BY activity ASC ";
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute($params); $stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -1112,6 +1112,7 @@ class module_report_activity extends module_report
$date = new DateTime($row['ddate']); $date = new DateTime($row['ddate']);
$result[$date->format(DATE_ATOM)] = $row['activity']; $result[$date->format(DATE_ATOM)] = $row['activity'];
} }
return $result; return $result;
} }

View File

@@ -157,8 +157,10 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
public function isValid() public function isValid()
{ {
if (isset($this->dashboard) && sizeof($this->dashboard) > 0) if (isset($this->dashboard) && sizeof($this->dashboard) > 0)
return true; return true;
else else
return false; return false;
} }
@@ -348,11 +350,11 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$i++; $i++;
} }
return; return;
} }

View File

@@ -75,9 +75,9 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$tmp = new self($sbasid, $sbas_coll, $dmin, $dmax); $tmp = new self($sbasid, $sbas_coll, $dmin, $dmax);
$appbox->set_data_to_cache($tmp, $cache_id); $appbox->set_data_to_cache($tmp, $cache_id);
@@ -131,7 +131,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
* @return <void> * @return <void>
*/ */
public function process() public function process()
{ {
try try
{ {
//Get number of DLs //Get number of DLs
@@ -250,8 +250,9 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
} }
catch(PDOException $e) catch(PDOException $e)
{ {
} }
return; return;
} }

View File

@@ -149,8 +149,10 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
public function isValid() public function isValid()
{ {
if (isset($this->arraySorted) && sizeof($this->arraySorted) > 0) if (isset($this->arraySorted) && sizeof($this->arraySorted) > 0)
return true; return true;
else else
return false; return false;
} }
@@ -162,10 +164,11 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
public function getTop($nbtop) public function getTop($nbtop)
{ {
if (!is_int($nbtop)) if (!is_int($nbtop))
return array(); return array();
$tmp = array(); $tmp = array();
if ($this->isValid()) if ($this->isValid())
{ {
foreach ($this->arraySorted as $k => $v) foreach ($this->arraySorted as $k => $v)
@@ -182,6 +185,7 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
} }
} }
} }
return $tmp; return $tmp;
} }

View File

@@ -38,7 +38,7 @@ class module_report_download extends module_report
'mime' => 'subdef.mime', 'mime' => 'subdef.mime',
'file' => 'subdef.file' 'file' => 'subdef.file'
); );
/** /**
* constructor * constructor
* *

View File

@@ -603,10 +603,10 @@ class module_report_nav extends module_report
, 'titre' => $record->get_title() , 'titre' => $record->get_title()
, 'taille' => $document->get_size() , 'taille' => $document->get_size()
); );
$this->setDisplayNav(); $this->setDisplayNav();
$this->setReport(); $this->setReport();
return $this->report; return $this->report;
} }

View File

@@ -55,7 +55,7 @@ class patch_320f implements patchInterface
function apply(base &$appbox) function apply(base &$appbox)
{ {
$feeds = array(); $feeds = array();
try try
{ {
$sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"'; $sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"';
@@ -65,9 +65,9 @@ class patch_320f implements patchInterface
} }
catch(Exception $e) catch(Exception $e)
{ {
} }
$sql = 'SELECT ssel_id, usr_id, name, descript, pub_date $sql = 'SELECT ssel_id, usr_id, name, descript, pub_date
, updater, pub_restrict, homelink , updater, pub_restrict, homelink
FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0'; FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0';
@@ -123,7 +123,7 @@ class patch_320f implements patchInterface
} }
} }
$sql = 'UPDATE ssel SET deleted = "1", migrated="1" $sql = 'UPDATE ssel SET deleted = "1", migrated="1"
WHERE ssel_id = :ssel_id'; WHERE ssel_id = :ssel_id';
$stmt = $appbox->get_connection()->prepare($sql); $stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute(array(':ssel_id' => $row['ssel_id'])); $stmt->execute(array(':ssel_id' => $row['ssel_id']));

View File

@@ -202,8 +202,8 @@ class random
self::cleanTokens(); self::cleanTokens();
$conn = connection::getPDOConnection(); $conn = connection::getPDOConnection();
$sql = 'SELECT * FROM tokens $sql = 'SELECT * FROM tokens
WHERE value = :token WHERE value = :token
AND (expire_on > NOW() OR expire_on IS NULL)'; AND (expire_on > NOW() OR expire_on IS NULL)';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(array(':token' => $token)); $stmt->execute(array(':token' => $token));

View File

@@ -180,7 +180,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$connbas = $this->databox->get_connection(); $connbas = $this->databox->get_connection();
@@ -530,7 +530,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
return null; return null;
@@ -580,7 +580,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$sql = 'SELECT BIN(status) as status FROM record $sql = 'SELECT BIN(status) as status FROM record
WHERE record_id = :record_id'; WHERE record_id = :record_id';
@@ -617,6 +617,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
throw new Exception_Media_SubdefNotFound (); throw new Exception_Media_SubdefNotFound ();
if (isset($this->subdefs[$name])) if (isset($this->subdefs[$name]))
return $this->subdefs[$name]; return $this->subdefs[$name];
if (!$this->subdefs) if (!$this->subdefs)
@@ -657,7 +658,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$connbas = $this->get_databox()->get_connection(); $connbas = $this->get_databox()->get_connection();
@@ -756,8 +757,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
if ($data) if ($data)
{ {
if (isset($this->technical_datas[$data])) if (isset($this->technical_datas[$data]))
return $this->technical_datas[$data]; return $this->technical_datas[$data];
else else
return false; return false;
} }
@@ -860,7 +863,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
); );
} }
$sql = 'UPDATE record $sql = 'UPDATE record
SET originalname = :originalname WHERE record_id = :record_id'; SET originalname = :originalname WHERE record_id = :record_id';
$params = array( $params = array(
@@ -1114,7 +1117,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$this->delete_data_from_cache(self::CACHE_SUBDEFS); $this->delete_data_from_cache(self::CACHE_SUBDEFS);
@@ -1340,7 +1343,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$this->delete_data_from_cache(self::CACHE_STATUS); $this->delete_data_from_cache(self::CACHE_STATUS);
@@ -1355,6 +1358,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_reg_name() public function get_reg_name()
{ {
if (!$this->is_grouping()) if (!$this->is_grouping())
return false; return false;
$balisename = ''; $balisename = '';
@@ -1551,6 +1555,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
{ {
$hd = $this->get_subdef('document'); $hd = $this->get_subdef('document');
if ($hd->is_physically_present()) if ($hd->is_physically_present())
return new system_file(p4string::addEndSlash($hd->get_path()) . $hd->get_file()); return new system_file(p4string::addEndSlash($hd->get_path()) . $hd->get_file());
return null; return null;
} }
@@ -1773,7 +1778,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$this->delete_data_from_cache(self::CACHE_SUBDEFS); $this->delete_data_from_cache(self::CACHE_SUBDEFS);
} }
@@ -1803,16 +1808,16 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_data_from_cache($option = null) public function get_data_from_cache($option = null)
{ {
\cache_databox::refresh($this->get_sbas_id()); \cache_databox::refresh($this->get_sbas_id());
$databox = $this->get_databox(); $databox = $this->get_databox();
return $databox->get_data_from_cache($this->get_cache_key($option)); return $databox->get_data_from_cache($this->get_cache_key($option));
} }
public function set_data_to_cache($value, $option = null, $duration = 0) public function set_data_to_cache($value, $option = null, $duration = 0)
{ {
$databox = $this->get_databox(); $databox = $this->get_databox();
return $databox->set_data_to_cache($value, $this->get_cache_key($option), $duration); return $databox->set_data_to_cache($value, $this->get_cache_key($option), $duration);
} }
@@ -1830,7 +1835,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
break; break;
} }
$databox = $this->get_databox(); $databox = $this->get_databox();
\cache_databox::update($this->get_sbas_id(), 'record', $this->get_record_id()); \cache_databox::update($this->get_sbas_id(), 'record', $this->get_record_id());
return $databox->delete_data_from_cache($this->get_cache_key($option)); return $databox->delete_data_from_cache($this->get_cache_key($option));
@@ -1871,7 +1876,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -1891,6 +1896,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_container_baskets() public function get_container_baskets()
{ {
if ($this->container_basket) if ($this->container_basket)
return $this->container_basket; return $this->container_basket;
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();

View File

@@ -205,6 +205,7 @@ class record_preview extends record_adapter
public function get_train($pos = 0, $query='', searchEngine_adapter $search_engine=null) public function get_train($pos = 0, $query='', searchEngine_adapter $search_engine=null)
{ {
if ($this->train) if ($this->train)
return $this->train; return $this->train;
switch ($this->env) switch ($this->env)
@@ -267,10 +268,11 @@ class record_preview extends record_adapter
public function get_title($highlight = '', searchEngine_adapter $search_engine=null) public function get_title($highlight = '', searchEngine_adapter $search_engine=null)
{ {
if ($this->title) if ($this->title)
return $this->title; return $this->title;
$this->title = collection::getLogo($this->get_base_id()) . ' '; $this->title = collection::getLogo($this->get_base_id()) . ' ';
switch ($this->env) switch ($this->env)
{ {
@@ -323,6 +325,7 @@ class record_preview extends record_adapter
public function get_short_history() public function get_short_history()
{ {
if (!is_null($this->short_history)) if (!is_null($this->short_history))
return $this->short_history; return $this->short_history;
$tab = array(); $tab = array();
@@ -376,14 +379,14 @@ class record_preview extends record_adapter
if (!isset($tab[$hour][$site][$action][$row['usr_id']])) if (!isset($tab[$hour][$site][$action][$row['usr_id']]))
{ {
$user = null; $user = null;
try try
{ {
$user = \User_Adapter::getInstance($row['usr_id'], $appbox); $user = \User_Adapter::getInstance($row['usr_id'], $appbox);
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
$tab[$hour][$site][$action][$row['usr_id']] = $tab[$hour][$site][$action][$row['usr_id']] =
@@ -415,6 +418,7 @@ class record_preview extends record_adapter
public function get_view_popularity() public function get_view_popularity()
{ {
if (!is_null($this->view_popularity)) if (!is_null($this->view_popularity))
return $this->view_popularity; return $this->view_popularity;
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
@@ -512,6 +516,7 @@ class record_preview extends record_adapter
public function get_refferer_popularity() public function get_refferer_popularity()
{ {
if (!is_null($this->refferer_popularity)) if (!is_null($this->refferer_popularity))
return $this->refferer_popularity; return $this->refferer_popularity;
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();
@@ -598,6 +603,7 @@ class record_preview extends record_adapter
{ {
if (!is_null($this->download_popularity)) if (!is_null($this->download_popularity))
return $this->download_popularity; return $this->download_popularity;
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$session = $appbox->get_session(); $session = $appbox->get_session();

View File

@@ -131,8 +131,10 @@ class registry implements registryInterface
$this->load(); $this->load();
if(!$this->cache->is_set($key) && !is_null($defaultvalue)) if(!$this->cache->is_set($key) && !is_null($defaultvalue))
return $defaultvalue; return $defaultvalue;
else else
return $this->cache->get($key); return $this->cache->get($key);
} }

View File

@@ -143,7 +143,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
public function set_options(searchEngine_options $options) public function set_options(searchEngine_options $options)
{ {
$this->options = $options; $this->options = $options;
$this->opt_search_type = (int) $options->get_search_type(); $this->opt_search_type = (int) $options->get_search_type();
$this->opt_bases = $options->get_bases(); $this->opt_bases = $options->get_bases();
$this->opt_fields = $options->get_fields(); $this->opt_fields = $options->get_fields();
@@ -397,7 +397,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
$total_time = 0; $total_time = 0;
$sort = ''; $sort = '';
if($this->options->get_sortby()) if($this->options->get_sortby())
{ {
switch($this->options->get_sortord()) switch($this->options->get_sortord())
@@ -412,7 +412,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
} }
$sort .= '0' . $this->options->get_sortby(); $sort .= '0' . $this->options->get_sortby();
} }
foreach ($this->queries as $sbas_id => $qry) foreach ($this->queries as $sbas_id => $qry)
{ {
$this->results[$sbas_id] = phrasea_query2( $this->results[$sbas_id] = phrasea_query2(
@@ -651,7 +651,7 @@ class searchEngine_adapter_phrasea_engine extends searchEngine_adapter_abstract
{ {
$val = $field['value']; $val = $field['value'];
} }
$ret[] = $val; $ret[] = $val;
} }

View File

@@ -752,9 +752,9 @@ class searchEngine_adapter_sphinx_engine extends searchEngine_adapter_abstract i
'before_match' => "<em>", 'before_match' => "<em>",
'after_match' => "</em>" 'after_match' => "</em>"
); );
$fields_to_send = array(); $fields_to_send = array();
foreach($fields as $k=>$f) foreach($fields as $k=>$f)
{ {
$fields_to_send[$k] = $f['value']; $fields_to_send[$k] = $f['value'];

View File

@@ -454,13 +454,13 @@ class searchEngine_options implements Serializable
{ {
$tmpvalue = (array) $value; $tmpvalue = (array) $value;
$value = array(); $value = array();
foreach($tmpvalue as $k=>$data) foreach($tmpvalue as $k=>$data)
{ {
$k = ctype_digit($k) ? (int) $k : $k; $k = ctype_digit($k) ? (int) $k : $k;
$value[$k] = $data; $value[$k] = $data;
} }
} }
$this->$key = $value; $this->$key = $value;

View File

@@ -475,7 +475,7 @@ class set_export extends set_abstract
$sd = $download_element->get_subdefs(); $sd = $download_element->get_subdefs();
foreach ($download_element->get_downloadable() as $name => $properties) foreach ($download_element->get_downloadable() as $name => $properties)
{ {
if ($properties === false || !in_array($name, $subdefs)) if ($properties === false || !in_array($name, $subdefs))
{ {
continue; continue;
@@ -758,6 +758,7 @@ class set_export extends set_abstract
return false; return false;
} }
if (isset($list['complete']) && $list['complete'] === true) if (isset($list['complete']) && $list['complete'] === true)
return; return;
@@ -989,13 +990,13 @@ class set_export extends set_abstract
else else
{ {
/** /**
* *
* Header "Pragma: public" SHOULD be present. * Header "Pragma: public" SHOULD be present.
* In case it is not present, download on IE 8 and previous over HTTPS * In case it is not present, download on IE 8 and previous over HTTPS
* will fail. * will fail.
* *
* @todo : merge this shitty fix with Response object. * @todo : merge this shitty fix with Response object.
* *
*/ */
if (!headers_sent()) if (!headers_sent())
{ {
@@ -1007,6 +1008,7 @@ class set_export extends set_abstract
$response->headers->set('Content-Disposition', $disposition . "; filename=" . $exportname . ";"); $response->headers->set('Content-Disposition', $disposition . "; filename=" . $exportname . ";");
$response->headers->set('Content-Length', filesize($file)); $response->headers->set('Content-Length', filesize($file));
$response->setContent(file_get_contents($file)); $response->setContent(file_get_contents($file));
return $response; return $response;
} }
} }
@@ -1057,7 +1059,7 @@ class set_export extends set_abstract
$user = false; $user = false;
if ($anonymous) if ($anonymous)
{ {
} }
else else
{ {

View File

@@ -53,7 +53,7 @@ class task_Scheduler
{ {
self::$connection = new connection_pdo ('appbox', $hostname, $port, $user, $password, $dbname); self::$connection = new connection_pdo ('appbox', $hostname, $port, $user, $password, $dbname);
} }
return self::$connection; return self::$connection;
} }

View File

@@ -112,7 +112,7 @@ class task_manager
return $row; return $row;
} }
public static function getAvailableTasks() public static function getAvailableTasks()
{ {
$registry = registry::get_instance(); $registry = registry::get_instance();
@@ -150,6 +150,7 @@ class task_manager
closedir($hdir); closedir($hdir);
} }
} }
return $tasks; return $tasks;
} }
} }

View File

@@ -459,7 +459,7 @@ class task_period_ftp extends task_appboxAbstract
if (in_array(trim($basefolder), array('.', './', ''))) if (in_array(trim($basefolder), array('.', './', '')))
$basefolder = '/'; $basefolder = '/';
foreach ($ftp_export['files'] as $fileid => $file) foreach ($ftp_export['files'] as $fileid => $file)
{ {
$base_id = $file["base_id"]; $base_id = $file["base_id"];
@@ -567,7 +567,7 @@ class task_period_ftp extends task_appboxAbstract
{ {
if($this->debug) if($this->debug)
echo "\nlogfile \n"; echo "\nlogfile \n";
$date = new DateTime(); $date = new DateTime();
$remote_file = $date->format('U'); $remote_file = $date->format('U');
@@ -575,12 +575,12 @@ class task_period_ftp extends task_appboxAbstract
FROM ftp_export_elements FROM ftp_export_elements
WHERE ftp_export_id = :ftp_export_id WHERE ftp_export_id = :ftp_export_id
AND error = "0" AND done="1"'; AND error = "0" AND done="1"';
$stmt = $conn->prepare($sql); $stmt = $conn->prepare($sql);
$stmt->execute(array(':ftp_export_id'=>$id)); $stmt->execute(array(':ftp_export_id'=>$id));
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
$buffer = '#transfert finished '.$date->format(DATE_ATOM)."\n\n"; $buffer = '#transfert finished '.$date->format(DATE_ATOM)."\n\n";
foreach ($rs as $row) foreach ($rs as $row)
@@ -602,7 +602,7 @@ class task_period_ftp extends task_appboxAbstract
$ftp_client->chdir($ftp_export["destfolder"]); $ftp_client->chdir($ftp_export["destfolder"]);
$ftp_client->put($remotefile, $tmpfile); $ftp_client->put($remotefile, $tmpfile);
unlink($tmpfile); unlink($tmpfile);
} }
@@ -766,7 +766,7 @@ class task_period_ftp extends task_appboxAbstract
_('task::ftp:Status about your FTP transfert from %1$s to %2$s') _('task::ftp:Status about your FTP transfert from %1$s to %2$s')
, $registry->get('GV_homeTitle'), $ftp_server , $registry->get('GV_homeTitle'), $ftp_server
); );
mail::ftp_sent($sendermail, $subject, $sender_message); mail::ftp_sent($sendermail, $subject, $sender_message);
mail::ftp_receive($mail, $receiver_message); mail::ftp_receive($mail, $receiver_message);

View File

@@ -162,6 +162,7 @@ class task_period_outofdate extends task_abstract
parent.calcSQL(); parent.calcSQL();
</script> </script>
<?php <?php
return(""); return("");
} }
else // ... so we NEVER come here else // ... so we NEVER come here
@@ -218,11 +219,12 @@ class task_period_outofdate extends task_abstract
jQuery.map($(this).serializeArray(), function(n, i){ jQuery.map($(this).serializeArray(), function(n, i){
json[n['name']] = n['value']; json[n['name']] = n['value'];
}); });
return json; return json;
}; };
})( jQuery ); })( jQuery );
function chgxmltxt(textinput, fieldname) function chgxmltxt(textinput, fieldname)
{ {
var limits = { 'period':{min:1, 'max':1440} , 'delay':{min:0} } ; var limits = { 'period':{min:1, 'max':1440} , 'delay':{min:0} } ;
@@ -274,7 +276,7 @@ class task_period_outofdate extends task_abstract
} }
$("#cmd").html(s); $("#cmd").html(s);
} }
}); });
} }
function chgsbas(sbaspopup) function chgsbas(sbaspopup)
@@ -289,7 +291,7 @@ class task_period_outofdate extends task_abstract
, async:false , async:false
, success:function(data) , success:function(data)
{ {
// console.log(data); // console.log(data);
var html = "<option value=\"\">...</option>"; var html = "<option value=\"\">...</option>";
for(i in data.date_fields) for(i in data.date_fields)
html += "\n<option class=\"jsFilled\" value=\"" + data.date_fields[i] + "\">" + data.date_fields[i] + "</option>"; html += "\n<option class=\"jsFilled\" value=\"" + data.date_fields[i] + "\">" + data.date_fields[i] + "</option>";
@@ -308,12 +310,13 @@ class task_period_outofdate extends task_abstract
for(fld=0; fld<=2; fld++) for(fld=0; fld<=2; fld++)
$("#status"+fld).html(html); $("#status"+fld).html(html);
} }
}); });
return; return;
} }
<?php <?php
/* /*
@@ -682,12 +685,13 @@ class task_period_outofdate extends task_abstract
} }
$ret = ($nchanged > 0 ? $nchanged : 'NORECSTODO'); $ret = ($nchanged > 0 ? $nchanged : 'NORECSTODO');
return($ret); return($ret);
} }
/* /*
function doRecords() function doRecords()
{ {
@@ -911,9 +915,9 @@ class task_period_outofdate extends task_abstract
private function calcSQL($sxTaskSettings) private function calcSQL($sxTaskSettings)
{ {
$ret = array(); $ret = array();
$this->sxTaskSettings = $sxTaskSettings; $this->sxTaskSettings = $sxTaskSettings;
$date1 = $date2 = NULL; $date1 = $date2 = NULL;
$field1 = $field2 = ''; $field1 = $field2 = '';
@@ -1007,7 +1011,7 @@ class task_period_outofdate extends task_abstract
SET " . $sqlset[0] . SET " . $sqlset[0] .
" WHERE " . $w; " WHERE " . $w;
// printf("%d : %s \n%s", __LINE__, $sql, var_export($params, true)); // printf("%d : %s \n%s", __LINE__, $sql, var_export($params, true));
$ret[] = array('sql'=>$sql, 'params'=>$params); $ret[] = array('sql'=>$sql, 'params'=>$params);
// $stmt = $this->connbas->prepare($sql); // $stmt = $this->connbas->prepare($sql);
@@ -1274,7 +1278,7 @@ class task_period_outofdate extends task_abstract
} }
catch(Exception $e) catch(Exception $e)
{ {
} }
} }
break; break;

View File

@@ -68,6 +68,7 @@ class task_period_upgradetov32 extends task_abstract
{ {
printf("sbas_id '" . $this->sbas_id . "' invalide\n"); printf("sbas_id '" . $this->sbas_id . "' invalide\n");
$this->return_value = self::RETURNSTATUS_STOPPED; $this->return_value = self::RETURNSTATUS_STOPPED;
return; return;
} }
@@ -241,7 +242,7 @@ class task_period_upgradetov32 extends task_abstract
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }
@@ -369,11 +370,13 @@ class task_period_upgradetov32 extends task_abstract
if ($n_done >= 5000) if ($n_done >= 5000)
{ {
$this->return_value = task_abstract::RETURNSTATUS_TORESTART; $this->return_value = task_abstract::RETURNSTATUS_TORESTART;
return; return;
} }
if ($memory > 100) if ($memory > 100)
{ {
$this->return_value = task_abstract::RETURNSTATUS_TORESTART; $this->return_value = task_abstract::RETURNSTATUS_TORESTART;
return; return;
} }
} }
@@ -408,9 +411,9 @@ class task_period_upgradetov32 extends task_abstract
$stmt->closeCursor(); $stmt->closeCursor();
$this->setProgress(0, 0); $this->setProgress(0, 0);
$this->return_value = self::RETURNSTATUS_TODELETE; $this->return_value = self::RETURNSTATUS_TODELETE;
flush(); flush();
return; return;

View File

@@ -307,7 +307,7 @@ class task_period_writemeta extends task_databoxAbstract
$fields = $record->get_caption()->get_fields(); $fields = $record->get_caption()->get_fields();
$subCMD = ''; $subCMD = '';
if ($record->get_uuid()) if ($record->get_uuid())
{ {
$subCMD .= '-XMP-exif:ImageUniqueID='; $subCMD .= '-XMP-exif:ImageUniqueID=';
@@ -315,7 +315,7 @@ class task_period_writemeta extends task_databoxAbstract
$subCMD .= '-IPTC:UniqueDocumentID='; $subCMD .= '-IPTC:UniqueDocumentID=';
$subCMD .= escapeshellarg($record->get_uuid()); $subCMD .= escapeshellarg($record->get_uuid());
} }
foreach ($fields as $field) foreach ($fields as $field)
{ {
$meta = $field->get_databox_field(); $meta = $field->get_databox_field();
@@ -326,23 +326,23 @@ class task_period_writemeta extends task_databoxAbstract
$multi = $meta->is_multi(); $multi = $meta->is_multi();
$type = $meta->get_type(); $type = $meta->get_type();
$datas = $field->get_value(); $datas = $field->get_value();
if ($multi) if ($multi)
{ {
$datas = $field->get_value(); $datas = $field->get_value();
foreach ($datas as $value) foreach ($datas as $value)
{ {
$value = $this->format_value($type, $value); $value = $this->format_value($type, $value);
$subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'='; $subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'=';
$subCMD .= escapeshellarg($value).' '; $subCMD .= escapeshellarg($value).' ';
} }
} }
else else
{ {
$datas = $this->format_value($type, $datas); $datas = $this->format_value($type, $datas);
$subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'='; $subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'=';
$subCMD .= escapeshellarg($datas).' '; $subCMD .= escapeshellarg($datas).' ';
} }
} }
@@ -355,17 +355,18 @@ class task_period_writemeta extends task_databoxAbstract
$cmd .= ( $registry->get('GV_exiftool') . ' -m -overwrite_original '); $cmd .= ( $registry->get('GV_exiftool') . ' -m -overwrite_original ');
if ($name != 'document' || $this->clear_doc) if ($name != 'document' || $this->clear_doc)
$cmd .= '-all:all= '; $cmd .= '-all:all= ';
$cmd .= ' -codedcharacterset=utf8 '; $cmd .= ' -codedcharacterset=utf8 ';
$cmd .= $subCMD.' '.escapeshellarg($file); $cmd .= $subCMD.' '.escapeshellarg($file);
$this->log(sprintf(('writing meta for sbas_id=%1$d - record_id=%2$d (%3$s)'), $this->sbas_id, $record_id, $name)); $this->log(sprintf(('writing meta for sbas_id=%1$d - record_id=%2$d (%3$s)'), $this->sbas_id, $record_id, $name));
$s = trim(shell_exec($cmd)); $s = trim(shell_exec($cmd));
$this->log("\t" . $s); $this->log("\t" . $s);
} }
return $this; return $this;
} }

View File

@@ -655,48 +655,48 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testis_limited() public function testis_limited()
{ {
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$found = false; $found = false;
foreach ($appbox->get_databoxes() as $databox) foreach ($appbox->get_databoxes() as $databox)
{ {
foreach ($databox->get_collections() as $collection) foreach ($databox->get_collections() as $collection)
{ {
$base_id = $collection->get_base_id(); $base_id = $collection->get_base_id();
if(!self::$user->ACL()->has_access_to_base($base_id)) if(!self::$user->ACL()->has_access_to_base($base_id))
continue; continue;
$this->assertFalse(self::$user->ACL()->is_limited($base_id)); $this->assertFalse(self::$user->ACL()->is_limited($base_id));
self::$user->ACL()->set_limits($base_id, true, new DateTime('-1 day'), new DateTime('+1 day')); self::$user->ACL()->set_limits($base_id, true, new DateTime('-1 day'), new DateTime('+1 day'));
$this->assertFalse(self::$user->ACL()->is_limited($base_id)); $this->assertFalse(self::$user->ACL()->is_limited($base_id));
self::$user->ACL()->set_limits($base_id, false, new DateTime('-1 day'), new DateTime('+1 day')); self::$user->ACL()->set_limits($base_id, false, new DateTime('-1 day'), new DateTime('+1 day'));
$this->assertFalse(self::$user->ACL()->is_limited($base_id)); $this->assertFalse(self::$user->ACL()->is_limited($base_id));
self::$user->ACL()->set_limits($base_id, true, new DateTime('+1 day'), new DateTime('+2 day')); self::$user->ACL()->set_limits($base_id, true, new DateTime('+1 day'), new DateTime('+2 day'));
$this->assertTrue(self::$user->ACL()->is_limited($base_id)); $this->assertTrue(self::$user->ACL()->is_limited($base_id));
self::$user->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('-1 day')); self::$user->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('-1 day'));
$this->assertTrue(self::$user->ACL()->is_limited($base_id)); $this->assertTrue(self::$user->ACL()->is_limited($base_id));
self::$user->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('+2 day')); self::$user->ACL()->set_limits($base_id, true, new DateTime('-2 day'), new DateTime('+2 day'));
$this->assertFalse(self::$user->ACL()->is_limited($base_id)); $this->assertFalse(self::$user->ACL()->is_limited($base_id));
self::$user->ACL()->set_limits($base_id, false, new DateTime('-2 day'), new DateTime('+2 day')); self::$user->ACL()->set_limits($base_id, false, new DateTime('-2 day'), new DateTime('+2 day'));
$this->assertFalse(self::$user->ACL()->is_limited($base_id)); $this->assertFalse(self::$user->ACL()->is_limited($base_id));
$found = true; $found = true;
} }
} }
if(!$found) if(!$found)
$this->fail ('Unable to test'); $this->fail ('Unable to test');
} }
@@ -704,50 +704,50 @@ class ACLTest extends PhraseanetPHPUnitAuthenticatedAbstract
public function testget_limits() public function testget_limits()
{ {
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
$found = false; $found = false;
foreach ($appbox->get_databoxes() as $databox) foreach ($appbox->get_databoxes() as $databox)
{ {
foreach ($databox->get_collections() as $collection) foreach ($databox->get_collections() as $collection)
{ {
$base_id = $collection->get_base_id(); $base_id = $collection->get_base_id();
if(!self::$user->ACL()->has_access_to_base($base_id)) if(!self::$user->ACL()->has_access_to_base($base_id))
continue; continue;
$minusone = new DateTime('-1 day'); $minusone = new DateTime('-1 day');
$plusone = new DateTime('+1 day'); $plusone = new DateTime('+1 day');
self::$user->ACL()->set_limits($base_id, true, $minusone, $plusone); self::$user->ACL()->set_limits($base_id, true, $minusone, $plusone);
$limits = self::$user->ACL()->get_limits($base_id); $limits = self::$user->ACL()->get_limits($base_id);
$this->assertEquals($limits['dmin'], $minusone); $this->assertEquals($limits['dmin'], $minusone);
$this->assertEquals($limits['dmax'], $plusone); $this->assertEquals($limits['dmax'], $plusone);
$minustwo = new DateTime('-2 day'); $minustwo = new DateTime('-2 day');
$plustwo = new DateTime('-2 day'); $plustwo = new DateTime('-2 day');
self::$user->ACL()->set_limits($base_id, true, $minustwo, $plustwo); self::$user->ACL()->set_limits($base_id, true, $minustwo, $plustwo);
$limits = self::$user->ACL()->get_limits($base_id); $limits = self::$user->ACL()->get_limits($base_id);
$this->assertEquals($limits['dmin'], $minustwo); $this->assertEquals($limits['dmin'], $minustwo);
$this->assertEquals($limits['dmax'], $plustwo); $this->assertEquals($limits['dmax'], $plustwo);
self::$user->ACL()->set_limits($base_id, false); self::$user->ACL()->set_limits($base_id, false);
$this->assertNull(self::$user->ACL()->get_limits($base_id)); $this->assertNull(self::$user->ACL()->get_limits($base_id));
$found = true; $found = true;
} }
} }
if(!$found) if(!$found)
$this->fail ('Unable to test'); $this->fail ('Unable to test');
} }

View File

@@ -12,7 +12,7 @@ require_once dirname(__FILE__) . '/../../bootstrap.php';
*/ */
/** /**
* *
* @package * @package
* @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
@@ -25,17 +25,17 @@ class Bridge_Api_Apitest_Containers implements Bridge_Api_ContainerInterface
public function __construct() public function __construct()
{ {
} }
public function get_created_on() public function get_created_on()
{ {
} }
public function get_description() public function get_description()
{ {
} }
public function get_id() public function get_id()
@@ -45,12 +45,12 @@ class Bridge_Api_Apitest_Containers implements Bridge_Api_ContainerInterface
public function get_thumbnail($width = 120, $height = 90) public function get_thumbnail($width = 120, $height = 90)
{ {
} }
public function get_title() public function get_title()
{ {
} }
public function get_type() public function get_type()
@@ -60,12 +60,12 @@ class Bridge_Api_Apitest_Containers implements Bridge_Api_ContainerInterface
public function get_updated_on() public function get_updated_on()
{ {
} }
public function get_url() public function get_url()
{ {
} }
} }
@@ -78,27 +78,27 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
public function __construct() public function __construct()
{ {
} }
public function get_category() public function get_category()
{ {
} }
public function get_created_on() public function get_created_on()
{ {
} }
public function get_description() public function get_description()
{ {
} }
public function get_duration() public function get_duration()
{ {
} }
public function get_id() public function get_id()
@@ -108,17 +108,17 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
public function get_rating() public function get_rating()
{ {
} }
public function get_thumbnail() public function get_thumbnail()
{ {
} }
public function get_title() public function get_title()
{ {
} }
public function get_type() public function get_type()
@@ -128,22 +128,22 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
public function get_updated_on() public function get_updated_on()
{ {
} }
public function get_url() public function get_url()
{ {
} }
public function get_view_count() public function get_view_count()
{ {
} }
public function is_private() public function is_private()
{ {
} }
} }
@@ -159,17 +159,17 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
protected function initialize_transport() protected function initialize_transport()
{ {
} }
protected function set_auth_params() protected function set_auth_params()
{ {
} }
protected function set_transport_authentication_params() protected function set_transport_authentication_params()
{ {
} }
public function get_terms_url() public function get_terms_url()
@@ -178,7 +178,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
} }
/** /**
* *
* @return Array * @return Array
*/ */
public function connect() public function connect()
@@ -188,7 +188,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
/** /**
* *
* @return Bridge_Api_Interface * @return Bridge_Api_Interface
*/ */
public function reconnect() public function reconnect()
{ {
@@ -197,7 +197,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
/** /**
* *
* @return Bridge_Api_Interface * @return Bridge_Api_Interface
*/ */
public function disconnect() public function disconnect()
{ {
@@ -206,7 +206,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
/** /**
* *
* @return boolean * @return boolean
*/ */
public function is_connected() public function is_connected()
{ {
@@ -214,16 +214,16 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
} }
/** /**
* *
* @return Bridge_Api_Interface * @return Bridge_Api_Interface
*/ */
public function set_locale($locale) public function set_locale($locale)
{ {
} }
/** /**
* *
* @return string * @return string
*/ */
public function get_name() public function get_name()
@@ -232,39 +232,39 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
} }
/** /**
* *
* @return string * @return string
*/ */
public function get_icon_url() public function get_icon_url()
{ {
} }
/** /**
* *
* @return string * @return string
*/ */
public function get_image_url() public function get_image_url()
{ {
} }
/** /**
* *
* @return string * @return string
*/ */
public function get_url() public function get_url()
{ {
} }
/** /**
* *
* @return string * @return string
*/ */
public function get_infos() public function get_infos()
{ {
} }
public function get_object_class_from_type($type) public function get_object_class_from_type($type)
@@ -292,12 +292,12 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
public function get_element_types() public function get_element_types()
{ {
} }
public function get_container_types() public function get_container_types()
{ {
} }
public function get_element_from_id($element_id, $object) public function get_element_from_id($element_id, $object)
@@ -305,6 +305,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
$element = new Bridge_Api_Apitest_Element(); $element = new Bridge_Api_Apitest_Element();
$element->id = $element_id; $element->id = $element_id;
$element->type = $object; $element->type = $object;
return $element; return $element;
} }
@@ -313,12 +314,13 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
$container = new Bridge_Api_Apitest_Containers(); $container = new Bridge_Api_Apitest_Containers();
$container->id = $element_id; $container->id = $element_id;
$container->type = $object; $container->type = $object;
return $container; return $container;
} }
public function get_category_list() public function get_category_list()
{ {
} }
public function get_user_name() public function get_user_name()
@@ -340,6 +342,7 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
$element_collection->add_element(new Bridge_Api_Apitest_Element()); $element_collection->add_element(new Bridge_Api_Apitest_Element());
$i++; $i++;
} }
return $element_collection; return $element_collection;
} }
@@ -352,61 +355,62 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
$container_collection->add_element(new Bridge_Api_Apitest_Containers()); $container_collection->add_element(new Bridge_Api_Apitest_Containers());
$i++; $i++;
} }
return $container_collection; return $container_collection;
} }
public function update_element($object, $object_id, Array $datas) public function update_element($object, $object_id, Array $datas)
{ {
} }
public function create_container($container_type, Request $request) public function create_container($container_type, Request $request)
{ {
} }
public function add_element_to_container($element_type, $element_id, $destination, $container_id) public function add_element_to_container($element_type, $element_id, $destination, $container_id)
{ {
} }
public function delete_object($object, $object_id) public function delete_object($object, $object_id)
{ {
} }
/** /**
* *
* @return Closure * @return Closure
*/ */
public function acceptable_records() public function acceptable_records()
{ {
} }
public function get_element_status(Bridge_Element $element) public function get_element_status(Bridge_Element $element)
{ {
} }
public function map_connector_to_element_status($status) public function map_connector_to_element_status($status)
{ {
} }
public function get_error_message_from_status($connector_status) public function get_error_message_from_status($connector_status)
{ {
} }
public function upload(record_adapter &$record, array $options = array()) public function upload(record_adapter &$record, array $options = array())
{ {
} }
public function is_valid_object_id($object_id) public function is_valid_object_id($object_id)
{ {
} }
public function is_configured() public function is_configured()
@@ -416,27 +420,27 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
public function check_upload_constraints(array $datas, record_adapter $record) public function check_upload_constraints(array $datas, record_adapter $record)
{ {
} }
public function get_upload_datas(Request $request, record_adapter $record) public function get_upload_datas(Request $request, record_adapter $record)
{ {
} }
public function is_multiple_upload() public function is_multiple_upload()
{ {
} }
public function check_update_constraints(Array $datas) public function check_update_constraints(Array $datas)
{ {
} }
public function get_update_datas(Request $request) public function get_update_datas(Request $request)
{ {
} }
} }
@@ -446,12 +450,12 @@ class Bridge_Api_Auth_None extends Bridge_Api_Auth_Abstract implements Bridge_Ap
public function connect($param) public function connect($param)
{ {
} }
public function parse_request_token() public function parse_request_token()
{ {
} }
public function reconnect() public function reconnect()
@@ -476,12 +480,12 @@ class Bridge_Api_Auth_None extends Bridge_Api_Auth_Abstract implements Bridge_Ap
public function get_auth_signatures() public function get_auth_signatures()
{ {
} }
public function set_parameters(Array $parameters) public function set_parameters(Array $parameters)
{ {
} }
} }

View File

@@ -1,8 +1,8 @@
<?php <?php
/** /**
* @example * @example
* *
try try
{ {
$validator = new W3CFeedRawValidator($xml); $validator = new W3CFeedRawValidator($xml);
@@ -22,7 +22,7 @@
{ {
print "\n" . $e->getMessage(); print "\n" . $e->getMessage();
} }
* *
*/ */
/** /**
@@ -30,7 +30,7 @@
*/ */
class W3CFeedValidatorException extends Exception class W3CFeedValidatorException extends Exception
{ {
} }
/** /**
@@ -55,7 +55,7 @@ class W3CFeedUrlValidator extends W3CFeedValidator
/** /**
* The URL of the document to validate * The URL of the document to validate
* @var string * @var string
*/ */
private $url; private $url;
@@ -88,12 +88,13 @@ class W3CFeedUrlValidator extends W3CFeedValidator
{ {
throw new W3CFeedValidatorException("Unable to request W3C API"); throw new W3CFeedValidatorException("Unable to request W3C API");
} }
return new W3CFeedValidatorResponse($response); return new W3CFeedValidatorResponse($response);
} }
/** /**
* Check if an url is valid * Check if an url is valid
* @param string $url * @param string $url
* @return boolean * @return boolean
*/ */
private function isValidUrl($url) private function isValidUrl($url)
@@ -112,14 +113,14 @@ class W3CFeedRawValidator extends W3CFeedValidator
/** /**
* The source of the document to validate * The source of the document to validate
* @var string * @var string
*/ */
private $rawData; private $rawData;
/** /**
* Constructor * Constructor
* Init instance which the specified data to validate * Init instance which the specified data to validate
* @param string $rawData * @param string $rawData
*/ */
public function __construct($rawData) public function __construct($rawData)
{ {
@@ -151,6 +152,7 @@ class W3CFeedRawValidator extends W3CFeedValidator
{ {
throw new W3CFeedValidatorException("Unable to request W3C API"); throw new W3CFeedValidatorException("Unable to request W3C API");
} }
return new W3CFeedValidatorResponse($response); return new W3CFeedValidatorResponse($response);
} }
@@ -209,36 +211,40 @@ class W3CFeedValidatorResponse
$string .= $name . "=>" . $detail . "\n"; $string .= $name . "=>" . $detail . "\n";
} }
} }
return $string; return $string;
} }
/** /**
* Check if the XML is valid * Check if the XML is valid
* @return boolean * @return boolean
*/ */
public function isValid() public function isValid()
{ {
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:validity"; $xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:validity";
return $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== "false"; return $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== "false";
} }
/** /**
* Check for errors * Check for errors
* @return boolean * @return boolean
*/ */
public function hasError() public function hasError()
{ {
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:errors/m:errorcount"; $xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:errors/m:errorcount";
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0; return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
} }
/** /**
* check fro warnings * check fro warnings
* @return boolean * @return boolean
*/ */
public function hasWarning() public function hasWarning()
{ {
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:warnings/m:warningcount"; $xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:warnings/m:warningcount";
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0; return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
} }
@@ -271,8 +277,8 @@ class W3CFeedValidatorResponse
* 1 => etc .. * 1 => etc ..
* } * }
* } * }
* *
* @return array * @return array
*/ */
public function getWarnings() public function getWarnings()
{ {
@@ -286,12 +292,13 @@ class W3CFeedValidatorResponse
$warnings[] = $this->domNodeToArray($warning); $warnings[] = $this->domNodeToArray($warning);
} }
} }
return $warnings; return $warnings;
} }
/** /**
* Get an array with all errors as follow * Get an array with all errors as follow
* @return array * @return array
*/ */
public function getErrors() public function getErrors()
{ {
@@ -305,14 +312,15 @@ class W3CFeedValidatorResponse
$errors[] = $this->domNodeToArray($error); $errors[] = $this->domNodeToArray($error);
} }
} }
return $errors; return $errors;
} }
/** /**
* @source http://www.ermshaus.org/2010/12/php-transform-domnode-to-array * @source http://www.ermshaus.org/2010/12/php-transform-domnode-to-array
* *
* Transforms the contents of a DOMNode to an associative array * Transforms the contents of a DOMNode to an associative array
* *
* XML node names become array keys, attributes will be discarded. If $node * XML node names become array keys, attributes will be discarded. If $node
* doesn't contain child nodes, a string will be returned. * doesn't contain child nodes, a string will be returned.
* *

View File

@@ -10,7 +10,7 @@
*/ */
/** /**
* *
* @package * @package
* @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
@@ -29,7 +29,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
const USER_AGENT_IPHONE = 'Mozilla/5.0 (iPod; U; CPU iPhone OS 2_1 like Mac OS X; fr-fr) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5F137 Safari/525.20'; const USER_AGENT_IPHONE = 'Mozilla/5.0 (iPod; U; CPU iPhone OS 2_1 like Mac OS X; fr-fr) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5F137 Safari/525.20';
/** /**
* *
* @var Symfony\Component\HttpKernel\Client * @var Symfony\Component\HttpKernel\Client
*/ */
protected $client; protected $client;
@@ -330,7 +330,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
/** /**
* *
* @var collection * @var collection
*/ */
protected static $collection; protected static $collection;
protected static $time_start; protected static $time_start;
@@ -340,7 +340,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
{ {
if (!self::$time_start) if (!self::$time_start)
self::$time_start = microtime(true); self::$time_start = microtime(true);
if(!setup::is_installed()) if(!setup::is_installed())
exit("Phraseanet is not set up\n"); exit("Phraseanet is not set up\n");
@@ -431,12 +431,12 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
$basket_coll = new basketCollection($appbox, self::$user->get_id()); $basket_coll = new basketCollection($appbox, self::$user->get_id());
$baskets = $basket_coll->get_baskets(); $baskets = $basket_coll->get_baskets();
foreach($baskets['baskets'] as $basket) foreach($baskets['baskets'] as $basket)
{ {
$basket->delete(); $basket->delete();
} }
basket_adapter::create($appbox, 'TEST', self::$user); basket_adapter::create($appbox, 'TEST', self::$user);
$appbox->get_session()->authenticate(new Session_Authentication_None(self::$user)); $appbox->get_session()->authenticate(new Session_Authentication_None(self::$user));
@@ -919,11 +919,11 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
{ {
return $this->assertRegExp('/\d{4}[-]\d{2}[-]\d{2}[T]\d{2}[:]\d{2}[:]\d{2}[+]\d{2}[:]\d{2}/', $date); return $this->assertRegExp('/\d{4}[-]\d{2}[-]\d{2}[T]\d{2}[:]\d{2}[:]\d{2}[+]\d{2}[:]\d{2}/', $date);
} }
protected function set_user_agent($user_agent) protected function set_user_agent($user_agent)
{ {
$browser = Browser::getInstance(); $browser = Browser::getInstance();
$browser->setUserAgent($user_agent); $browser->setUserAgent($user_agent);
} }
} }

View File

@@ -10,7 +10,7 @@
*/ */
/** /**
* *
* @package * @package
* @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
@@ -40,7 +40,7 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
$session->logout(); $session->logout();
parent::tearDown(); parent::tearDown();
} }
// public static function setUpBeforeClass() // public static function setUpBeforeClass()
// { // {
// parent::setUpBeforeClass(); // parent::setUpBeforeClass();
@@ -55,4 +55,4 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
// parent::tearDownAfterClass(); // parent::tearDownAfterClass();
// } // }
} }

View File

@@ -10,7 +10,7 @@
*/ */
/** /**
* *
* @package * @package
* @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
@@ -34,4 +34,4 @@ abstract class PhraseanetWebTestCaseAbstract extends PhraseanetPHPUnitAbstract
$this->app = $this->createApplication(); $this->app = $this->createApplication();
} }
} }

View File

@@ -10,7 +10,7 @@
*/ */
/** /**
* *
* @package * @package
* @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
@@ -35,4 +35,4 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
$this->app = $this->createApplication(); $this->app = $this->createApplication();
} }
} }

View File

@@ -153,13 +153,13 @@ class databox_statusTest extends PhraseanetPHPUnitAbstract
public function testDec2bin() public function testDec2bin()
{ {
$this->assertEquals('1010', databox_status::dec2bin('10')); $this->assertEquals('1010', databox_status::dec2bin('10'));
try try
{ {
} }
catch(Exception $e) catch(Exception $e)
{ {
} }
} }
@@ -167,7 +167,7 @@ class databox_statusTest extends PhraseanetPHPUnitAbstract
{ {
$this->assertEquals('10100001', databox_status::hex2bin('0x0A1')); $this->assertEquals('10100001', databox_status::hex2bin('0x0A1'));
$this->assertEquals('10100001', databox_status::hex2bin('0A1')); $this->assertEquals('10100001', databox_status::hex2bin('0A1'));
try try
{ {
databox_status::hex2bin('G1'); databox_status::hex2bin('G1');
@@ -175,7 +175,7 @@ class databox_statusTest extends PhraseanetPHPUnitAbstract
} }
catch(Exception $e) catch(Exception $e)
{ {
} }
} }

View File

@@ -117,7 +117,7 @@ class Feed_overviewTest extends PhraseanetWebTestCaseAuthenticatedAbstract
$crawler = $this->client->request('GET', $url); $crawler = $this->client->request('GET', $url);
$response = $this->client->getResponse(); $response = $this->client->getResponse();
if (self::$record_1->get_preview()->get_baseurl() !== '') if (self::$record_1->get_preview()->get_baseurl() !== '')
{ {
$this->assertEquals(302, $response->getStatusCode()); $this->assertEquals(302, $response->getStatusCode());

View File

@@ -64,6 +64,7 @@ class Module_Prod_Route_RecordFeedApp extends PhraseanetWebTestCaseAuthenticated
public function createApplication() public function createApplication()
{ {
$app = require __DIR__ . '/../../../../../classes/module/Prod.php'; $app = require __DIR__ . '/../../../../../classes/module/Prod.php';
return $app; return $app;
} }
@@ -211,7 +212,7 @@ class Module_Prod_Route_RecordFeedApp extends PhraseanetWebTestCaseAuthenticated
// } // }
// catch (Exception $e) // catch (Exception $e)
// { // {
// //
// } // }
// } // }
// //

View File

@@ -163,9 +163,9 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
/** /**
* XML is not verified due to Validator Service bug * XML is not verified due to Validator Service bug
*/ */
return; return;
try try
{ {
$validator = new W3CFeedRawValidator($xml); $validator = new W3CFeedRawValidator($xml);
@@ -253,7 +253,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
$offset_start = ($offset_start++) * $n_entries; $offset_start = ($offset_start++) * $n_entries;
$collection = $feed->get_entries($offset_start, $n_entries); $collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries(); $entries = $collection->get_entries();
if (sizeof($entries) == 0) //no more if (sizeof($entries) == 0) //no more
break; break;
} }
$feed_entry = array_shift($entries); $feed_entry = array_shift($entries);
@@ -331,6 +331,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
{ {
$current_attributes[$attribute->name] = $attribute->value; $current_attributes[$attribute->name] = $attribute->value;
} }
return $current_attributes; return $current_attributes;
} }
@@ -470,7 +471,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
) )
); );
foreach ($fields as $key_field => $field) foreach ($fields as $key_field => $field)
{ {
if ($field["media_field"]["name"] == $node->nodeName) if ($field["media_field"]["name"] == $node->nodeName)
@@ -516,6 +517,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
unset($item_entries[$key]); //remove unset($item_entries[$key]); //remove
} }
}; };
return $remove; return $remove;
} }
@@ -562,7 +564,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
$offset_start = ($offset_start++) * $n_entries; $offset_start = ($offset_start++) * $n_entries;
$collection = $feed->get_entries($offset_start, $n_entries); $collection = $feed->get_entries($offset_start, $n_entries);
$entries = $collection->get_entries(); $entries = $collection->get_entries();
if (sizeof($entries) == 0) //no more if (sizeof($entries) == 0) //no more
break; break;
} }
$feed_entry = array_shift($entries); $feed_entry = array_shift($entries);
@@ -642,4 +644,4 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
} }
} }
} }

View File

@@ -100,7 +100,7 @@ class dashboardTest extends PhraseanetPHPUnitAbstract
{ {
if ($key == 'activity_added') if ($key == 'activity_added')
{ {
} }
$this->assertLessThanOrEqual($nbDay, count($dash)); $this->assertLessThanOrEqual($nbDay, count($dash));
} }
@@ -119,7 +119,7 @@ class dashboardTest extends PhraseanetPHPUnitAbstract
} }
catch (Exception $e) catch (Exception $e)
{ {
} }
} }

View File

@@ -29,7 +29,7 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
*/ */
public function tearDown() public function tearDown()
{ {
} }
/** /**

View File

@@ -23,8 +23,8 @@ require_once dirname(__FILE__) . '/PhraseanetPHPUnitAbstract.class.inc';
class userTest extends PhraseanetPHPUnitAbstract class userTest extends PhraseanetPHPUnitAbstract
{ {
public function testMail() public function testMail()
{ {
$this->assertFalse(User_Adapter::get_usr_id_from_email(null)); $this->assertFalse(User_Adapter::get_usr_id_from_email(null));
@@ -32,10 +32,10 @@ class userTest extends PhraseanetPHPUnitAbstract
{ {
$appbox = appbox::get_instance(); $appbox = appbox::get_instance();
self::$user->set_email(null); self::$user->set_email(null);
$this->assertFalse(User_Adapter::get_usr_id_from_email(null)); $this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email(''); self::$user->set_email('');
$this->assertFalse(User_Adapter::get_usr_id_from_email(null)); $this->assertFalse(User_Adapter::get_usr_id_from_email(null));
self::$user->set_email('noone@example.com'); self::$user->set_email('noone@example.com');
$this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noone@example.com')); $this->assertEquals(self::$user->get_id(), User_Adapter::get_usr_id_from_email('noone@example.com'));
@@ -46,14 +46,14 @@ class userTest extends PhraseanetPHPUnitAbstract
} }
try try
{ {
self::$user->set_email('noonealt1@example.com'); self::$user->set_email('noonealt1@example.com');
$this->fail('A user already got this address'); $this->fail('A user already got this address');
} }
catch(Exception $e) catch(Exception $e)
{ {
} }
$this->assertFalse(User_Adapter::get_usr_id_from_email(null)); $this->assertFalse(User_Adapter::get_usr_id_from_email(null));
} }
} }

View File

@@ -124,7 +124,7 @@
<tr> <tr>
<td> <td>
{% if main_user is not empty %} {% if main_user is not empty %}
{% if main_user.is_special is not empty %} {% if main_user.is_special is not empty %}
{% if main_user.get_login() == 'invite' %} {% if main_user.get_login() == 'invite' %}
{% trans 'Reglages:: reglages d acces guest' %} {% trans 'Reglages:: reglages d acces guest' %}
@@ -199,7 +199,7 @@
<td></td> <td></td>
</tr> </tr>
{% endif %} {% endif %}
<tr> <tr>
<td style="width:122px;overflow:hidden;white-space:nowrap;"> <td style="width:122px;overflow:hidden;white-space:nowrap;">
{{rights['sbas_id']|sbas_name}} {{rights['sbas_id']|sbas_name}}
@@ -556,7 +556,7 @@
{% endif %} {% endif %}
</div> </div>
<div class="PNB10" style="top:auto;height:20px;"> <div class="PNB10" style="top:auto;height:20px;">
<button class="users_rights_valid">{% trans 'boutton::valider' %}</button> <button class="users_rights_valid">{% trans 'boutton::valider' %}</button>
<a href="/admin/users/search/" class="users_rights_cancel">{% trans 'boutton::retour' %}</a> <a href="/admin/users/search/" class="users_rights_cancel">{% trans 'boutton::retour' %}</a>
</div> </div>
</div> </div>

View File

@@ -21,13 +21,13 @@
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
{% trans 'De' %} {% trans 'De' %}
<input type="text" class="dmin datepicker" name="dmin" {% if datas.time_limited == 0 %}readonly="readonly"{% endif %} value="{{datas.limited_from}}" /> <input type="text" class="dmin datepicker" name="dmin" {% if datas.time_limited == 0 %}readonly="readonly"{% endif %} value="{{datas.limited_from}}" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
{% trans 'A' %} {% trans 'A' %}
<input type="text" class="dmax datepicker" name="dmax" {% if datas.time_limited == 0 %}readonly="readonly"{% endif %} value="{{datas.limited_to}}" /> <input type="text" class="dmax datepicker" name="dmax" {% if datas.time_limited == 0 %}readonly="readonly"{% endif %} value="{{datas.limited_to}}" />
</td> </td>
</tr> </tr>

View File

@@ -94,7 +94,7 @@
} }
}) })
}; };
function activeTree(click) function activeTree(click)
{ {
$('#FNDR').treeview({ $('#FNDR').treeview({
@@ -142,7 +142,7 @@
activeTree(true); activeTree(true);
} }
); );
function refreshBaskets() function refreshBaskets()
{ {
return; return;

View File

@@ -32,7 +32,7 @@
{% endif %} {% endif %}
<li class="{% if feature == 'connected' %}selected{% endif %}"> <li class="{% if feature == 'connected' %}selected{% endif %}">
<a target="right" href="sessionwhois.php" class="ajax zone_online_users"> <a target="right" href="sessionwhois.php" class="ajax zone_online_users">
<img src="/skins/admin/Connected.png" /> <img src="/skins/admin/Connected.png" />
{% trans 'admin::utilisateurs: utilisateurs connectes' %} {% trans 'admin::utilisateurs: utilisateurs connectes' %}
</a> </a>
@@ -40,13 +40,13 @@
{% if user.ACL().has_right('manageusers') %} {% if user.ACL().has_right('manageusers') %}
<li class="{% if feature == 'users' %}selected{% endif %}"> <li class="{% if feature == 'users' %}selected{% endif %}">
<a target="right" href="/admin/users/search/" class="ajax zone_editusers"> <a target="right" href="/admin/users/search/" class="ajax zone_editusers">
<img src="/skins/admin/Users.png" /> <img src="/skins/admin/Users.png" />
{% trans 'admin::utilisateurs: utilisateurs' %} {% trans 'admin::utilisateurs: utilisateurs' %}
</a> </a>
</li> </li>
<li class="{% if feature == 'registrations' %}selected{% endif %}"> <li class="{% if feature == 'registrations' %}selected{% endif %}">
<a target="right" href="demand.php?act=LISTUSERS"> <a target="right" href="demand.php?act=LISTUSERS">
<img src="/skins/admin/Demandes.png" /> <img src="/skins/admin/Demandes.png" />
{% trans 'admin::utilisateurs: demandes en cours' %} {% trans 'admin::utilisateurs: demandes en cours' %}
</a> </a>
@@ -64,7 +64,7 @@
{% if user.ACL().has_right('taskmanager') %} {% if user.ACL().has_right('taskmanager') %}
<li class="{% if feature == 'taskmanager' %}selected{% endif %}"> <li class="{% if feature == 'taskmanager' %}selected{% endif %}">
<a target="right" href="taskmanager.php"> <a target="right" href="taskmanager.php">
<img src="/skins/admin/TaskManager.png" /> <img src="/skins/admin/TaskManager.png" />
{% trans 'admin::utilisateurs: gestionnaire de taches' %} {% trans 'admin::utilisateurs: gestionnaire de taches' %}
</a> </a>
@@ -73,7 +73,7 @@
<li class="open"> <li class="open">
<div class="{% if feature == 'bases' %}selected{% endif %}" style="padding:0 0 2px 0;"> <div class="{% if feature == 'bases' %}selected{% endif %}" style="padding:0 0 2px 0;">
<a id="TREE_DATABASES" target="right" href="databases.php"> <a id="TREE_DATABASES" target="right" href="databases.php">
<img src="/skins/admin/DatabasesAvailable.png" /> <img src="/skins/admin/DatabasesAvailable.png" />
{% trans 'admin::utilisateurs: bases de donnees' %} {% trans 'admin::utilisateurs: bases de donnees' %}
</a> </a>
@@ -98,46 +98,46 @@
<li class="{% if this_is_open %}open{% endif %}"> <li class="{% if this_is_open %}open{% endif %}">
<div style="padding:0 0 2px 0;" class="{% if this_is_selected %}selected{% endif %}"> <div style="padding:0 0 2px 0;" class="{% if this_is_selected %}selected{% endif %}">
<a target="right" href="database.php?p0={{ sbas_id }}"> <a target="right" href="database.php?p0={{ sbas_id }}">
<img src="/skins/admin/Database.png"/> <img src="/skins/admin/Database.png"/>
{{ databox.get_viewname() }} {{ databox.get_viewname() }}
</a> </a>
</div> </div>
<ul> <ul>
{% if user.ACL().has_right_on_sbas( sbas_id , 'bas_modify_struct') %} {% if user.ACL().has_right_on_sbas( sbas_id , 'bas_modify_struct') %}
<li> <li>
<a target="right" href="structure.php?act=STRUCTURE&p0={{ sbas_id }}"> <a target="right" href="structure.php?act=STRUCTURE&p0={{ sbas_id }}">
<img src="/skins/icons/miniadjust01.gif"/> <img src="/skins/icons/miniadjust01.gif"/>
{% trans 'admin::structure: reglage de la structure' %} {% trans 'admin::structure: reglage de la structure' %}
</a> </a>
</li> </li>
<li> <li>
<a target="right" href="description.php?act=STRUCTURE&p0={{ sbas_id }}"> <a target="right" href="description.php?act=STRUCTURE&p0={{ sbas_id }}">
<img src="/skins/icons/miniadjust01.gif"/> <img src="/skins/icons/miniadjust01.gif"/>
{% trans 'CHAMPS' %} {% trans 'CHAMPS' %}
</a> </a>
</li> </li>
<li> <li>
<a target="right" href="subdefs.php?act=STRUCTURE&p0={{ sbas_id }}"> <a target="right" href="subdefs.php?act=STRUCTURE&p0={{ sbas_id }}">
<img src="/skins/icons/miniadjust01.gif"/> <img src="/skins/icons/miniadjust01.gif"/>
{% trans 'SUBDEFS' %} {% trans 'SUBDEFS' %}
</a> </a>
</li> </li>
<li> <li>
<a target="right" href="statbits.php?act=STATBITS&p0={{ sbas_id }}"> <a target="right" href="statbits.php?act=STATBITS&p0={{ sbas_id }}">
<img src="/skins/icons/miniadjust02.gif"/> <img src="/skins/icons/miniadjust02.gif"/>
{% trans 'admin::status: reglage des status' %} {% trans 'admin::status: reglage des status' %}
</a> </a>
</li> </li>
<li> <li>
<a target="right" href="cgus.php?p0={{ sbas_id }}"> <a target="right" href="cgus.php?p0={{ sbas_id }}">
{% trans 'admin:: CGUs' %} {% trans 'admin:: CGUs' %}
</a> </a>
</li> </li>
<li> <li>
<a target="right" href="collorder.php?p0={{ sbas_id }}"> <a target="right" href="collorder.php?p0={{ sbas_id }}">
<img src="/skins/icons/miniadjust03.gif"/> <img src="/skins/icons/miniadjust03.gif"/>
{% trans 'admin::collection: ordre des collections' %} {% trans 'admin::collection: ordre des collections' %}
</a> </a>
</li> </li>
@@ -153,7 +153,7 @@
{% if seeUsrGene %} {% if seeUsrGene %}
<li> <li>
<a target="right" href="/admin/users/search/?sbas_id[]={{ sbas_id }}" class="ajax"> <a target="right" href="/admin/users/search/?sbas_id[]={{ sbas_id }}" class="ajax">
<img src="/skins/admin/Users.png"/> <img src="/skins/admin/Users.png"/>
{% trans 'admin::utilisateurs: utilisateurs' %} {% trans 'admin::utilisateurs: utilisateurs' %}
</a> </a>
@@ -175,20 +175,20 @@
{% if (user.ACL.has_right_on_base(collection.get_base_id(), 'modify_struct')) %} {% if (user.ACL.has_right_on_base(collection.get_base_id(), 'modify_struct')) %}
<li> <li>
<a target="right" href="sugval.php?p0={{ sbas_id }}&p1={{ collection.get_base_id() }}"> <a target="right" href="sugval.php?p0={{ sbas_id }}&p1={{ collection.get_base_id() }}">
<img src="/skins/icons/foldph20open_0.gif"/> <img src="/skins/icons/foldph20open_0.gif"/>
{% trans 'admin::base: preferences de collection' %} {% trans 'admin::base: preferences de collection' %}
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if (user.ACL.has_right_on_base( collection.get_base_id(), 'canadmin')) %} {% if (user.ACL.has_right_on_base( collection.get_base_id(), 'canadmin')) %}
{% if (user.ACL.has_right_on_base( collection.get_base_id(), 'canmodifrecord') {% if (user.ACL.has_right_on_base( collection.get_base_id(), 'canmodifrecord')
and user.ACL.has_right_on_base( collection.get_base_id(), 'manage') and user.ACL.has_right_on_base( collection.get_base_id(), 'manage')
and user.ACL.has_right_on_sbas( sbas_id, 'bas_manage') ) %} and user.ACL.has_right_on_sbas( sbas_id, 'bas_manage') ) %}
<li> <li>
<a target="right" href="/admin/users/search/?base_id[]={{ collection.get_base_id() }}" class="ajax"> <a target="right" href="/admin/users/search/?base_id[]={{ collection.get_base_id() }}" class="ajax">
<img src="/skins/admin/Users.png"/> <img src="/skins/admin/Users.png"/>
{% trans 'admin::utilisateurs: utilisateurs' %} {% trans 'admin::utilisateurs: utilisateurs' %}
</a> </a>
</li> </li>
@@ -214,4 +214,4 @@
' . $row["dbname"] . '(' . $row["host"] . ':' . $row["port"] . ') ' . $row["dbname"] . '(' . $row["host"] . ':' . $row["port"] . ')
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>

View File

@@ -32,7 +32,7 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
</li> </li>
{% if browser.isNewGeneration and registry.get('GV_thesaurus') == true and user.ACL.has_access_to_module('thesaurus') %} {% if browser.isNewGeneration and registry.get('GV_thesaurus') == true and user.ACL.has_access_to_module('thesaurus') %}
<li> <li>
<a target="_blank" href="/thesaurus2/"> <a target="_blank" href="/thesaurus2/">
@@ -42,8 +42,8 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
{# MODULE #} {# MODULE #}
{% if user.ACL.has_access_to_module('admin') %} {% if user.ACL.has_access_to_module('admin') %}
<li> <li>
@@ -104,20 +104,20 @@
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% endif %} {% endif %}
</ol> </ol>
</div> </div>
<div class="PNB" style="left:auto;overflow:hidden;"> <div class="PNB" style="left:auto;overflow:hidden;">
<ol> <ol>
{% if module == "client" or module == "prod" %} {% if module == "client" or module == "prod" %}
<li id="notification_trigger"> <li id="notification_trigger">
<a href="#" style="font-weight:bold;text-decoration:none;"> <a href="#" style="font-weight:bold;text-decoration:none;">
<span> <span>
{% trans 'Notifications' %} {% trans 'Notifications' %}
<span class="counter" style="visibility:{% if events.get_unread_notifications_number > 0 %}visible{% else %}hidden{% endif %};"> <span class="counter" style="visibility:{% if events.get_unread_notifications_number > 0 %}visible{% else %}hidden{% endif %};">
<div style="padding:1px 3px 0;"> <div style="padding:1px 3px 0;">
{% if events.get_unread_notifications_number > 0 %} {% if events.get_unread_notifications_number > 0 %}
@@ -191,4 +191,4 @@
<div style="display:none;z-index:30000;" id="notification_box"> <div style="display:none;z-index:30000;" id="notification_box">
{% set notifications = events.get_notifications %} {% set notifications = events.get_notifications %}
{% include 'prod/notifications.twig' %} {% include 'prod/notifications.twig' %}
</div> </div>

View File

@@ -122,7 +122,7 @@
setTimeout("$('form#create_admin').submit();",500); setTimeout("$('form#create_admin').submit();",500);
}; };
} }
if($current.hasClass('appbox_settings')) if($current.hasClass('appbox_settings'))
{ {
test_connection_appbox(callback); test_connection_appbox(callback);
@@ -195,7 +195,7 @@
var password_input = $('input[name="ab_password"]', appbox_scope); var password_input = $('input[name="ab_password"]', appbox_scope);
var dbname_input = $('input[name="db_name"]', databox_scope); var dbname_input = $('input[name="db_name"]', databox_scope);
var user = user_input.val(); var user = user_input.val();
var password = password_input.val(); var password = password_input.val();
var dbname = dbname_input.val(); var dbname = dbname_input.val();

View File

@@ -83,7 +83,7 @@ $TOU = $databox->get_cgus();
</head> </head>
<body> <body>
<h1><?php echo _('Terms Of Use'); ?></h1> <h1><?php echo _('Terms Of Use'); ?></h1>
<form target="_self" method="post" action="cgus.php"> <form target="_self" method="post" action="cgus.php">
<div style="text-align:center;margin:10px 0;"> <div style="text-align:center;margin:10px 0;">
<input type="submit" value="<?php echo _('Mettre a jour'); ?>" id="valid"/><input type="checkbox" value="1" name="valid"/><label for="valid"><?php echo _('admin::CGU Les utilisateurs doivent imperativement revalider ces conditions'); ?></label> <input type="submit" value="<?php echo _('Mettre a jour'); ?>" id="valid"/><input type="checkbox" value="1" name="valid"/><label for="valid"><?php echo _('admin::CGU Les utilisateurs doivent imperativement revalider ces conditions'); ?></label>

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