mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 19:43:16 +00:00
Update latests classes
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -31,14 +33,16 @@ class collection implements cache_cacheableInterface
|
||||
protected $databox;
|
||||
protected $is_active;
|
||||
protected $binary_logo;
|
||||
protected $app;
|
||||
|
||||
const PIC_LOGO = 'minilogos';
|
||||
const PIC_WM = 'wm';
|
||||
const PIC_STAMP = 'stamp';
|
||||
const PIC_PRESENTATION = 'presentation';
|
||||
|
||||
protected function __construct($coll_id, databox &$databox)
|
||||
protected function __construct(Application $app, $coll_id, databox &$databox)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->databox = $databox;
|
||||
$this->sbas_id = (int) $databox->get_sbas_id();
|
||||
$this->coll_id = (int) $coll_id;
|
||||
@@ -78,7 +82,7 @@ class collection implements cache_cacheableInterface
|
||||
$this->name = $row['asciiname'];
|
||||
$this->prefs = $row['prefs'];
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->app);
|
||||
|
||||
$sql = 'SELECT server_coll_id, sbas_id, base_id, active FROM bas
|
||||
WHERE server_coll_id = :coll_id AND sbas_id = :sbas_id';
|
||||
@@ -120,10 +124,9 @@ class collection implements cache_cacheableInterface
|
||||
|
||||
$this->is_active = true;
|
||||
$this->delete_data_from_cache();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||
$this->databox->delete_data_from_cache(databox::CACHE_COLLECTIONS);
|
||||
cache_databox::update($this->databox->get_sbas_id(), 'structure');
|
||||
cache_databox::update($this->app, $this->databox->get_sbas_id(), 'structure');
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -136,10 +139,9 @@ class collection implements cache_cacheableInterface
|
||||
$stmt->closeCursor();
|
||||
$this->is_active = false;
|
||||
$this->delete_data_from_cache();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||
$this->databox->delete_data_from_cache(databox::CACHE_COLLECTIONS);
|
||||
cache_databox::update($this->databox->get_sbas_id(), 'structure');
|
||||
cache_databox::update($this->app, $this->databox->get_sbas_id(), 'structure');
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -158,7 +160,7 @@ class collection implements cache_cacheableInterface
|
||||
$stmt->closeCursor();
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$record = new record_adapter($this->databox->get_sbas_id(), $row['record_id']);
|
||||
$record = $this->databox->get_record($row['record_id']);
|
||||
$record->delete();
|
||||
unset($record);
|
||||
}
|
||||
@@ -218,7 +220,7 @@ class collection implements cache_cacheableInterface
|
||||
|
||||
$this->delete_data_from_cache();
|
||||
|
||||
phrasea::reset_baseDatas();
|
||||
phrasea::reset_baseDatas($this->databox->get_appbox());
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -331,7 +333,7 @@ class collection implements cache_cacheableInterface
|
||||
$stmt->execute(array(':coll_id' => $this->get_coll_id()));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $this->databox->get_appbox();
|
||||
|
||||
$sql = "DELETE FROM bas WHERE base_id = :base_id";
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
@@ -363,17 +365,16 @@ class collection implements cache_cacheableInterface
|
||||
* @param int $base_id
|
||||
* @return collection
|
||||
*/
|
||||
public static function get_from_base_id($base_id)
|
||||
public static function get_from_base_id(Application $app, $base_id)
|
||||
{
|
||||
$coll_id = phrasea::collFromBas($base_id);
|
||||
$sbas_id = phrasea::sbasFromBas($base_id);
|
||||
$coll_id = phrasea::collFromBas($app, $base_id);
|
||||
$sbas_id = phrasea::sbasFromBas($app, $base_id);
|
||||
if ( ! $sbas_id || ! $coll_id) {
|
||||
throw new Exception_Databox_CollectionNotFound(sprintf("Collection could not be found"));
|
||||
}
|
||||
$appbox = \appbox::get_instance(\bootstrap::getCore());
|
||||
$databox = $appbox->get_databox($sbas_id);
|
||||
$databox = $app['phraseanet.appbox']->get_databox($sbas_id);
|
||||
|
||||
return self::get_from_coll_id($databox, $coll_id);
|
||||
return self::get_from_coll_id($app, $databox, $coll_id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,13 +383,13 @@ class collection implements cache_cacheableInterface
|
||||
* @param int $coll_id
|
||||
* @return collection
|
||||
*/
|
||||
public static function get_from_coll_id(databox $databox, $coll_id)
|
||||
public static function get_from_coll_id(Application $app, databox $databox, $coll_id)
|
||||
{
|
||||
assert(is_int($coll_id));
|
||||
|
||||
$key = sprintf('%d_%d', $databox->get_sbas_id(), $coll_id);
|
||||
if ( ! isset(self::$_collections[$key])) {
|
||||
self::$_collections[$key] = new self($coll_id, $databox);
|
||||
self::$_collections[$key] = new self($app, $coll_id, $databox);
|
||||
}
|
||||
|
||||
return self::$_collections[$key];
|
||||
@@ -443,11 +444,12 @@ class collection implements cache_cacheableInterface
|
||||
return $this->available;
|
||||
}
|
||||
|
||||
public function unmount_collection(appbox &$appbox)
|
||||
public function unmount_collection(Application $app)
|
||||
{
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$params = array(':base_id' => $this->get_base_id());
|
||||
|
||||
$query = new User_Query($appbox);
|
||||
$query = new User_Query($app);
|
||||
$total = $query->on_base_ids(array($this->get_base_id()))
|
||||
->include_phantoms(false)
|
||||
->include_special_users(true)
|
||||
@@ -483,21 +485,18 @@ class collection implements cache_cacheableInterface
|
||||
$stmt->execute($params);
|
||||
$stmt->closeCursor();
|
||||
|
||||
phrasea::reset_baseDatas();
|
||||
phrasea::reset_baseDatas($appbox);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function create(databox $databox, appbox $appbox, $name, User_Adapter $user = null)
|
||||
public static function create(Application $app, databox $databox, appbox $appbox, $name, User_Adapter $user = null)
|
||||
{
|
||||
$sbas_id = $databox->get_sbas_id();
|
||||
$connbas = $databox->get_connection();
|
||||
$conn = $appbox->get_connection();
|
||||
$new_bas = false;
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
|
||||
$prefs = '<?xml version="1.0" encoding="UTF-8"?>
|
||||
<baseprefs>
|
||||
<status>0</status>
|
||||
@@ -531,16 +530,15 @@ class collection implements cache_cacheableInterface
|
||||
$databox->delete_data_from_cache(databox::CACHE_COLLECTIONS);
|
||||
|
||||
$appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||
cache_databox::update($sbas_id, 'structure');
|
||||
cache_databox::update($app, $sbas_id, 'structure');
|
||||
|
||||
phrasea::reset_baseDatas();
|
||||
phrasea::reset_baseDatas($appbox);
|
||||
|
||||
if (null !== $user) {
|
||||
self::set_admin($new_bas, $user);
|
||||
$appbox->get_session()->renew_phrasea_session();
|
||||
}
|
||||
|
||||
return self::get_from_coll_id($databox, $new_id);
|
||||
return self::get_from_coll_id($app, $databox, $new_id);
|
||||
}
|
||||
|
||||
public function set_admin($base_id, user_adapter $user)
|
||||
@@ -571,47 +569,44 @@ class collection implements cache_cacheableInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function mount_collection($sbas_id, $coll_id, User_Adapter $user)
|
||||
public static function mount_collection(Application $app, databox $databox, $coll_id, User_Adapter $user)
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
|
||||
$sql = "INSERT INTO bas (base_id, active, server_coll_id, sbas_id, aliases)
|
||||
VALUES
|
||||
(null, 1, :server_coll_id, :sbas_id, '')";
|
||||
$stmt = $appbox->get_connection()->prepare($sql);
|
||||
$stmt = $databox->get_appbox()->get_connection()->prepare($sql);
|
||||
$stmt->execute(array(':server_coll_id' => $coll_id, ':sbas_id' => $sbas_id));
|
||||
$stmt->closeCursor();
|
||||
|
||||
$new_bas = $appbox->get_connection()->lastInsertId();
|
||||
$appbox->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||
$new_bas = $databox->get_appbox()->get_connection()->lastInsertId();
|
||||
$databox->get_appbox()->delete_data_from_cache(appbox::CACHE_LIST_BASES);
|
||||
|
||||
$databox = $appbox->get_databox((int) $sbas_id);
|
||||
$databox->delete_data_from_cache(databox::CACHE_COLLECTIONS);
|
||||
|
||||
cache_databox::update($sbas_id, 'structure');
|
||||
cache_databox::update($app, $sbas_id, 'structure');
|
||||
|
||||
phrasea::reset_baseDatas();
|
||||
phrasea::reset_baseDatas($databox->get_appbox());
|
||||
|
||||
self::set_admin($new_bas, $user);
|
||||
|
||||
return $new_bas;
|
||||
}
|
||||
|
||||
public static function getLogo($base_id, $printname = false)
|
||||
public static function getLogo($base_id, Application $app, $printname = false)
|
||||
{
|
||||
$base_id_key = $base_id . '_' . ($printname ? '1' : '0');
|
||||
|
||||
if ( ! isset(self::$_logos[$base_id_key])) {
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
if (is_file($registry->get('GV_RootPath') . 'config/minilogos/' . $base_id)) {
|
||||
$name = phrasea::bas_names($base_id);
|
||||
$name = phrasea::bas_names($base_id, $app);
|
||||
self::$_logos[$base_id_key] = '<img title="' . $name
|
||||
. '" src="' . $registry->get('GV_STATIC_URL')
|
||||
. '/custom/minilogos/' . $base_id . '" />';
|
||||
} elseif ($printname) {
|
||||
self::$_logos[$base_id_key] = phrasea::bas_names($base_id);
|
||||
self::$_logos[$base_id_key] = phrasea::bas_names($base_id, $app);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -622,8 +617,7 @@ class collection implements cache_cacheableInterface
|
||||
{
|
||||
if ( ! isset(self::$_watermarks['base_id'])) {
|
||||
|
||||
$registry = registry::get_instance();
|
||||
if (is_file($registry->get('GV_RootPath') . 'config/wm/' . $base_id))
|
||||
if (is_file(__DIR__ . '/../../config/wm/' . $base_id))
|
||||
self::$_watermarks['base_id'] = '<img src="/custom/wm/' . $base_id . '" />';
|
||||
}
|
||||
|
||||
@@ -634,8 +628,7 @@ class collection implements cache_cacheableInterface
|
||||
{
|
||||
if ( ! isset(self::$_presentations['base_id'])) {
|
||||
|
||||
$registry = registry::get_instance();
|
||||
if (is_file($registry->get('GV_RootPath') . 'config/presentation/' . $base_id))
|
||||
if (is_file(__DIR__ . '/../../config/presentation/' . $base_id))
|
||||
self::$_presentations['base_id'] = '<img src="/custom/presentation/' . $base_id . '" />';
|
||||
}
|
||||
|
||||
@@ -646,8 +639,7 @@ class collection implements cache_cacheableInterface
|
||||
{
|
||||
if ( ! isset(self::$_stamps['base_id'])) {
|
||||
|
||||
$registry = registry::get_instance();
|
||||
if (is_file($registry->get('GV_RootPath') . 'config/stamp/' . $base_id))
|
||||
if (is_file(__DIR__ . '/../../config/stamp/' . $base_id))
|
||||
self::$_stamps['base_id'] = '<img src="/custom/stamp/' . $base_id . '" />';
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -33,13 +35,19 @@ class connection
|
||||
* @var Array
|
||||
*/
|
||||
public static $log = array();
|
||||
protected $app;
|
||||
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
self::printLog();
|
||||
self::printLog($this->app);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -48,10 +56,9 @@ class connection
|
||||
*
|
||||
* @return Void
|
||||
*/
|
||||
public static function printLog()
|
||||
public static function printLog(Application $app)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
if ( ! $registry->get('GV_debug')) {
|
||||
if (!$app['phraseanet.registry']->get('GV_debug')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -65,7 +72,7 @@ class connection
|
||||
|
||||
$totalTime += $entry['time'];
|
||||
$string = $entry['time'] . "\t" . ' - ' . $query . ' - ' . "\n";
|
||||
file_put_contents($registry->get('GV_RootPath') . 'logs/mysql_log.log', $string, FILE_APPEND);
|
||||
file_put_contents($app['phraseanet.registry']->get('GV_RootPath') . 'logs/mysql_log.log', $string, FILE_APPEND);
|
||||
}
|
||||
$string = count(self::$log) . ' queries - ' . $totalTime
|
||||
. "\nEND OF QUERY " . $_SERVER['PHP_SELF']
|
||||
@@ -79,7 +86,7 @@ class connection
|
||||
}
|
||||
$string .= "\n\n\n\n";
|
||||
|
||||
file_put_contents($registry->get('GV_RootPath') . 'logs/mysql_log.log', $string, FILE_APPEND);
|
||||
file_put_contents($app['phraseanet.registry']->get('GV_RootPath') . 'logs/mysql_log.log', $string, FILE_APPEND);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -88,10 +95,10 @@ class connection
|
||||
*
|
||||
* @return type
|
||||
*/
|
||||
protected static function instantiate()
|
||||
protected static function instantiate(Application $app)
|
||||
{
|
||||
if ( ! self::$_selfinstance)
|
||||
self::$_selfinstance = new self();
|
||||
if (!self::$_selfinstance)
|
||||
self::$_selfinstance = new self($app);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -101,9 +108,9 @@ class connection
|
||||
* @param string $name
|
||||
* @return connection_pdo
|
||||
*/
|
||||
public static function getPDOConnection($name = null, registryInterface $registry = null)
|
||||
public static function getPDOConnection(Application $app, $name = null, registryInterface $registry = null)
|
||||
{
|
||||
self::instantiate();
|
||||
self::instantiate($app);
|
||||
if (trim($name) == '') {
|
||||
$name = 'appbox';
|
||||
} elseif (is_int((int) $name)) {
|
||||
@@ -112,19 +119,17 @@ class connection
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ! isset(self::$_PDO_instance[$name])) {
|
||||
if (!isset(self::$_PDO_instance[$name])) {
|
||||
$hostname = $port = $user = $password = $dbname = false;
|
||||
|
||||
$connection_params = array();
|
||||
|
||||
if (trim($name) !== 'appbox') {
|
||||
$connection_params = phrasea::sbas_params();
|
||||
$connection_params = phrasea::sbas_params($app);
|
||||
} else {
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
$choosenConnexion = $app['phraseanet.configuration']->getPhraseanet()->get('database');
|
||||
|
||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||
|
||||
$connexion = $configuration->getConnexion($choosenConnexion);
|
||||
$connexion = $app['phraseanet.configuration']->getConnexion($choosenConnexion);
|
||||
|
||||
$hostname = $connexion->get('host');
|
||||
$port = $connexion->get('port');
|
||||
@@ -142,6 +147,7 @@ class connection
|
||||
}
|
||||
|
||||
try {
|
||||
$registry = $registry ? : $app['phraseanet.registry'];
|
||||
self::$_PDO_instance[$name] = new connection_pdo($name, $hostname, $port, $user, $password, $dbname, array(), $registry);
|
||||
self::$_PDO_instance[$name]->query("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
|
||||
} catch (Exception $e) {
|
||||
|
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
class liste
|
||||
{
|
||||
|
||||
public static function filter($lst)
|
||||
public static function filter(Application $app, $lst)
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
|
||||
if ( ! is_array($lst))
|
||||
explode(';', $lst);
|
||||
|
||||
$okbrec = array();
|
||||
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
$user = $app['phraseanet.user'];
|
||||
|
||||
foreach ($lst as $basrec) {
|
||||
$basrec = explode("_", $basrec);
|
||||
@@ -21,7 +21,7 @@ class liste
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$record = new record_adapter($basrec[0], $basrec[1]);
|
||||
$record = new record_adapter($app, $basrec[0], $basrec[1]);
|
||||
} catch (Exception $e) {
|
||||
continue;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ class liste
|
||||
continue;
|
||||
|
||||
try {
|
||||
$connsbas = connection::getPDOConnection($basrec[0]);
|
||||
$connsbas = connection::getPDOConnection($app, $basrec[0]);
|
||||
|
||||
$sql = 'SELECT record_id FROM record WHERE ((status ^ ' . $user->ACL()->get_mask_xor($record->get_base_id()) . ')
|
||||
& ' . $user->ACL()->get_mask_and($record->get_base_id()) . ')=0' .
|
||||
|
@@ -1,19 +1,20 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class login
|
||||
{
|
||||
|
||||
public function get_cgus()
|
||||
public function get_cgus(Application $app)
|
||||
{
|
||||
return databox_cgu::getHome();
|
||||
return databox_cgu::getHome($app);
|
||||
}
|
||||
|
||||
public function register_enabled()
|
||||
public function register_enabled(Application $app)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
require_once $registry->get('GV_RootPath') . 'lib/classes/deprecated/inscript.api.php';
|
||||
require_once __DIR__ . '/deprecated/inscript.api.php';
|
||||
|
||||
$bases = giveMeBases();
|
||||
$bases = giveMeBases($app);
|
||||
|
||||
if ($bases) {
|
||||
foreach ($bases as $base) {
|
||||
@@ -26,22 +27,22 @@ class login
|
||||
return false;
|
||||
}
|
||||
|
||||
public function get_register_link()
|
||||
public function get_register_link(Application $app)
|
||||
{
|
||||
$demandLinkBox = '';
|
||||
|
||||
if (self::register_enabled()) {
|
||||
if (self::register_enabled($app)) {
|
||||
$demandLinkBox = '<a href="/login/register/" rel="external" class="link pointer" id="register-tab">' . _('login:: register') . '</a>';
|
||||
}
|
||||
|
||||
return $demandLinkBox;
|
||||
}
|
||||
|
||||
public function get_guest_link()
|
||||
public function get_guest_link(Application $app)
|
||||
{
|
||||
$inviteBox = '';
|
||||
|
||||
if (phrasea::guest_allowed()) {
|
||||
if (phrasea::guest_allowed($app)) {
|
||||
$inviteBox = '<a class="link" rel="external" href="/prod/?nolog=1">' . _('login:: guest Access') . '</a>';
|
||||
}
|
||||
|
||||
|
@@ -1,11 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class mail
|
||||
{
|
||||
|
||||
public static function mail_test($email)
|
||||
public static function mail_test(Application $app, $email)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$from = array('email' => $registry->get('GV_defaulmailsenderaddr'), 'name' => $registry->get('GV_defaulmailsenderaddr'));
|
||||
|
||||
$subject = _('mail:: test d\'envoi d\'email');
|
||||
@@ -14,33 +16,26 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $message, $to, $from);
|
||||
return self::send_mail($app, $subject, $message, $to, $from);
|
||||
}
|
||||
|
||||
public static function send_validation_results($email, $subject, $from, $message)
|
||||
public static function ftp_sent(Application $app, $email, $subject, $body)
|
||||
{
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $message, $to, $from);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function ftp_sent($email, $subject, $body)
|
||||
{
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function ftp_receive($email, $body)
|
||||
public static function ftp_receive(Application $app, $email, $body)
|
||||
{
|
||||
$subject = _("task::ftp:Someone has sent some files onto FTP server");
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function send_documents($email, $url, $from, $endate_obj, $message = '', $accuse)
|
||||
public static function send_documents(Application $app, $email, $url, $from, $endate_obj, $message = '', $accuse)
|
||||
{
|
||||
$subject = _('export::vous avez recu des documents');
|
||||
|
||||
@@ -49,7 +44,7 @@ class mail
|
||||
|
||||
$body .= '<br><div>' .
|
||||
sprintf(
|
||||
_('Attention, ce lien lien est valable jusqu\'au %s'), phraseadate::getDate($endate_obj) . ' ' . phraseadate::getTime($endate_obj)
|
||||
_('Attention, ce lien lien est valable jusqu\'au %s'), $app['date-formatter']->getDate($endate_obj) . ' ' . $app['date-formatter']->getTime($endate_obj)
|
||||
)
|
||||
. '</div>';
|
||||
|
||||
@@ -59,10 +54,10 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to, $from, array(), $accuse);
|
||||
return self::send_mail($app, $subject, $body, $to, $from, array(), $accuse);
|
||||
}
|
||||
|
||||
public static function forgot_passord($email, $login, $url)
|
||||
public static function forgot_passord(Application $app, $email, $login, $url)
|
||||
{
|
||||
$subject = _('login:: Forgot your password'); // Registration order on .
|
||||
|
||||
@@ -72,12 +67,12 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function register_confirm($email, $accept, $deny)
|
||||
public static function register_confirm(Application $app, $email, $accept, $deny)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$subject = sprintf(_('login::register:email: Votre compte %s'), $registry->get('GV_homeTitle'));
|
||||
|
||||
$body = '<div>' . _('login::register:email: Voici un compte rendu du traitement de vos demandes d\'acces :') . "</div>\n";
|
||||
@@ -91,35 +86,14 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function register_user($email, $auto, $others)
|
||||
public static function reset_email(Application $app, $email, $usr_id)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$subject = sprintf(_('login::register:email: Votre compte %s'), $registry->get('GV_homeTitle'));
|
||||
|
||||
$body = "<div>" . _('login::register:Votre inscription a ete prise en compte') . "</div>\n";
|
||||
|
||||
if ($auto != '') {
|
||||
$body .= "<br/>\n<div>" . _('login::register: vous avez des a present acces aux collections suivantes : ') . "</div>\n<ul>" . $auto . "</ul>\n";
|
||||
}
|
||||
|
||||
if ($others != '') {
|
||||
$body .= "<br/>\n<div>" . _('login::register: vos demandes concernat les collections suivantes sont sujettes a approbation d\'un administrateur') . "</div>\n<ul>" . $others . "</ul>\n";
|
||||
$body .= "<br/>\n<div>" . _('login::register : vous serez avertis par email lorsque vos demandes seront traitees') . "</div>\n";
|
||||
}
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function reset_email($email, $usr_id)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$date = new DateTime('1 day');
|
||||
$token = random::getUrlToken(\random::TYPE_EMAIL, $usr_id, $date, $email);
|
||||
$token = random::getUrlToken($app, \random::TYPE_EMAIL, $usr_id, $date, $email);
|
||||
|
||||
$url = $registry->get('GV_ServerName') . 'account/reset-email/?token=' . $token;
|
||||
|
||||
@@ -130,12 +104,12 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function change_mail_information($display_name, $old_email, $new_email)
|
||||
public static function change_mail_information(Application $app, $display_name, $old_email, $new_email)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$subject = sprintf(_('Update of your email address on %s'), $registry->get('GV_homeTitle'));
|
||||
|
||||
$body = "<div>" . sprintf(_('Dear %s,'), $display_name) . "</div>\n<br/>\n";
|
||||
@@ -152,30 +126,15 @@ class mail
|
||||
$to_old = array('email' => $old_email, 'name' => $display_name);
|
||||
$to_new = array('email' => $new_email, 'name' => $display_name);
|
||||
|
||||
$res_old = $old_email ? self::send_mail($subject, $body, $to_old) : true;
|
||||
$res_new = $new_email ? self::send_mail($subject, $body, $to_new) : true;
|
||||
$res_old = $old_email ? self::send_mail($app, $subject, $body, $to_old) : true;
|
||||
$res_new = $new_email ? self::send_mail($app, $subject, $body, $to_new) : true;
|
||||
|
||||
return $res_old && $res_new;
|
||||
}
|
||||
|
||||
public static function change_password(User_Adapter $user, $ip, \DateTime $date)
|
||||
public static function send_credentials(Application $app, $url, $login, $email)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
|
||||
$subject = sprintf(_('Your account update on %s'), $registry->get('GV_homeTitle'));
|
||||
|
||||
$body = "<div>" . sprintf(_('Dear %s,'), $user->get_display_name()) . "</div><br/>\n\n";
|
||||
$body .= "<div>" . sprintf(_('The password of your account %s has been successfully updated'), $user->get_login()) . "</div><br/>\n\n";
|
||||
$body .= "<div>" . sprintf(_('For your interest, the request has been done from %s at %s'), $ip, $date->format(DATE_ATOM)) . "</div>\n";
|
||||
|
||||
$to = array('email' => $user->get_email(), 'name' => $user->get_email());
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function send_credentials($url, $login, $email)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
$subject = sprintf(_('Your account on %s'), $registry->get('GV_homeTitle'));
|
||||
|
||||
@@ -185,12 +144,12 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function mail_confirm_registered($email)
|
||||
public static function mail_confirm_registered(Application $app, $email)
|
||||
{
|
||||
$registry = \registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||
|
||||
@@ -200,10 +159,10 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function mail_confirm_unregistered($email, array $others)
|
||||
public static function mail_confirm_unregistered(Application $app, $email, array $others)
|
||||
{
|
||||
|
||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||
@@ -219,14 +178,14 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function mail_confirmation($email, $usr_id)
|
||||
public static function mail_confirmation(Application $app, $email, $usr_id)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$expire = new DateTime('+3 days');
|
||||
$token = random::getUrlToken(\random::TYPE_PASSWORD, $usr_id, $expire, $email);
|
||||
$token = random::getUrlToken($app, \random::TYPE_PASSWORD, $usr_id, $expire, $email);
|
||||
|
||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||
|
||||
@@ -235,7 +194,7 @@ class mail
|
||||
|
||||
$to = array('email' => $email, 'name' => $email);
|
||||
|
||||
return self::send_mail($subject, $body, $to);
|
||||
return self::send_mail($app, $subject, $body, $to);
|
||||
}
|
||||
|
||||
public static function validateEmail($email)
|
||||
@@ -243,11 +202,9 @@ class mail
|
||||
return PHPMailer::ValidateAddress($email);
|
||||
}
|
||||
|
||||
public static function send_mail($subject, $body, $to, $from = false, $files = array(), $reading_confirm_to = false)
|
||||
public static function send_mail(Application $app, $subject, $body, $to, $from = false, $files = array(), $reading_confirm_to = false)
|
||||
{
|
||||
$Core = \bootstrap::getCore();
|
||||
|
||||
$registry = $Core->getRegistry();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
if ( ! isset($to['email']) || ! PHPMailer::ValidateAddress($to['email'])) {
|
||||
return false;
|
||||
@@ -255,8 +212,6 @@ class mail
|
||||
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$body = eregi_replace("[\]", '', $body);
|
||||
|
||||
$body .= "<br/><br/><br/><br/>\n\n\n\n";
|
||||
$body .= '<div style="font-style:italic;">' . _('si cet email contient des liens non cliquables copiez/collez ces liens dans votre navigateur.') . '</div>';
|
||||
$body .= "<br/>\n";
|
||||
@@ -270,13 +225,13 @@ class mail
|
||||
$mail->CharSet = 'utf-8';
|
||||
$mail->Encoding = 'base64'; //'quoted-printable';
|
||||
|
||||
$registry = registry::get_instance();
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
if ($registry->get('GV_smtp')) {
|
||||
$mail->IsSMTP();
|
||||
if ($registry->get('GV_smtp_host') != '')
|
||||
$mail->Host = $registry->get('GV_smtp_host');
|
||||
// $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
|
||||
|
||||
if ($registry->get('GV_smtp_auth')) {
|
||||
$mail->SMTPAuth = true;
|
||||
|
||||
@@ -311,7 +266,7 @@ class mail
|
||||
$mail->AddAttachment($f); // attachment
|
||||
}
|
||||
|
||||
if ($Core->getConfiguration()->getEnvironnement() !== 'test') {
|
||||
if ($app->getEnvironment() !== 'test') {
|
||||
$mail->Send();
|
||||
}
|
||||
|
||||
|
@@ -9,13 +9,14 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
class p4file
|
||||
{
|
||||
|
||||
public static function apache_tokenize($file)
|
||||
public static function apache_tokenize(\registry $registry, $file)
|
||||
{
|
||||
$ret = false;
|
||||
$registry = registry::get_instance();
|
||||
|
||||
if ($registry->get('GV_h264_streaming') && is_file($file)) {
|
||||
if (($pos = mb_strpos($file, $registry->get('GV_mod_auth_token_directory_path'))) === false) {
|
||||
@@ -56,143 +57,4 @@ class p4file
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public static function archiveFile(system_file &$system_file, $base_id, $delete = true, $name = false)
|
||||
{
|
||||
throw new Exception('This method is deprecated');
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
$system_file->set_phrasea_tech_field(system_file::TECH_FIELD_ORIGINALNAME, $name ? $name : $system_file->getFilename());
|
||||
$system_file->set_phrasea_tech_field(system_file::TECH_FIELD_PARENTDIRECTORY, null);
|
||||
$system_file->set_phrasea_tech_field(system_file::TECH_FIELD_SUBPATH, null);
|
||||
|
||||
$go = User_Adapter::getInstance($session->get_usr_id(), $appbox)
|
||||
->ACL()
|
||||
->has_right_on_base($base_id, 'canaddrecord');
|
||||
|
||||
if ( ! $go) {
|
||||
echo "\ndroits insuffisants";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$sbas_id = phrasea::sbasFromBas($base_id);
|
||||
$databox = $appbox->get_databox($sbas_id);
|
||||
$collection = collection::get_from_base_id($base_id);
|
||||
|
||||
$collprefs = simplexml_load_string($collection->get_prefs());
|
||||
|
||||
$server_coll_id = phrasea::collFromBas($base_id);
|
||||
|
||||
if ($collprefs === false) {
|
||||
if (GV_debug)
|
||||
echo 'Error loading collprefs';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$metadatas = $system_file->extract_metadatas($databox->get_meta_structure());
|
||||
|
||||
$status = "0";
|
||||
|
||||
if ($collprefs->status)
|
||||
$status = (string) ($collprefs->status);
|
||||
|
||||
$record_id = $record = false;
|
||||
|
||||
try {
|
||||
$record = record_adapter::create($collection, $system_file, $name);
|
||||
$record_id = $record->get_record_id();
|
||||
$record->set_metadatas($metadatas['metadatas'], true);
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
if ($record instanceof record_adapter)
|
||||
$record->delete();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$record->set_binary_status(databox_status::dec2bin($status));
|
||||
$record->rebuild_subdefs();
|
||||
$record->reindex();
|
||||
|
||||
if ($delete) {
|
||||
@unlink($system_file->getPathname());
|
||||
unset($system_file);
|
||||
}
|
||||
|
||||
return $record_id;
|
||||
}
|
||||
|
||||
public static function check_file_error($filename, $sbas_id, $originalname)
|
||||
{
|
||||
throw new Exception('This method is deprecated');
|
||||
|
||||
$core = \bootstrap::getCore();
|
||||
$appbox = \appbox::get_instance($core);
|
||||
$checks = array();
|
||||
|
||||
$system_file = new system_file($filename);
|
||||
|
||||
$doctype = $system_file->get_phrasea_type();
|
||||
|
||||
$databox = $appbox->get_databox($sbas_id);
|
||||
|
||||
if ($baseprefs = $databox->get_sxml_structure()) {
|
||||
|
||||
$file_checks = $baseprefs->filechecks;
|
||||
$checks = $file_checks->$doctype;
|
||||
$checks = $checks[0];
|
||||
} else {
|
||||
throw new Exception(_('prod::erreur : impossible de lire les preferences de base'));
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
|
||||
$media = $core['mediavorus']->guess($filename);
|
||||
|
||||
$width = $height = 0;
|
||||
$colorSpace = null;
|
||||
|
||||
if ($media instanceof \MediaVorus\Media\Image) {
|
||||
$width = $media->getWidth();
|
||||
$height = $media->getHeight();
|
||||
$colorSpace = strtolower($media->getColorSpace());
|
||||
}
|
||||
|
||||
foreach ($checks as $name => $value) {
|
||||
switch ($name) {
|
||||
case 'name':
|
||||
$records = record_adapter::get_records_by_originalname($databox, $original_name, false, 0, 1);
|
||||
if (count($records) > 0)
|
||||
$errors[] = sprintf(_('Le fichier \'%s\' existe deja'), $originalname);
|
||||
break;
|
||||
case 'size':
|
||||
if (min($width, $height) < (int) $value) {
|
||||
$errors[] = sprintf(_('Taille trop petite : %dpx'), $min);
|
||||
}
|
||||
break;
|
||||
case 'color_space':
|
||||
$required = strtolower(in_array($value, array('sRGB', 'RGB')) ? 'RGB' : $value);
|
||||
|
||||
$go = false;
|
||||
|
||||
if ( ! $colorSpace || $required == $colorSpace) {
|
||||
$go = true;
|
||||
} elseif ($required == 'rgb' && in_array($colorSpace, array('srgb', 'rgb')) > 0) {
|
||||
$go = true;
|
||||
}
|
||||
|
||||
if ( ! $go) {
|
||||
$errors[] = sprintf(_('Mauvais mode colorimetrique : %s'), $colorSpace);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,10 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
use Alchemy\Phrasea\Exception\RuntimeException;
|
||||
|
||||
class phrasea
|
||||
{
|
||||
private static $_bas2sbas = false;
|
||||
@@ -26,10 +30,10 @@ class phrasea
|
||||
const CACHE_SBAS_FROM_BAS = 'sbas_from_bas';
|
||||
const CACHE_SBAS_PARAMS = 'sbas_params';
|
||||
|
||||
public static function is_scheduler_started()
|
||||
public static function is_scheduler_started(Application $app)
|
||||
{
|
||||
$retval = false;
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($app);
|
||||
$sql = 'SELECT schedstatus FROM sitepreff';
|
||||
|
||||
$stmt = $conn->prepare($sql);
|
||||
@@ -44,10 +48,8 @@ class phrasea
|
||||
return $retval;
|
||||
}
|
||||
|
||||
public static function start(\Alchemy\Phrasea\Core $Core)
|
||||
public static function start(Configuration $configuration)
|
||||
{
|
||||
$configuration = $Core->getConfiguration();
|
||||
|
||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||
|
||||
$connexion = $configuration->getConnexion($choosenConnexion);
|
||||
@@ -58,23 +60,27 @@ class phrasea
|
||||
$password = $connexion->get('password');
|
||||
$dbname = $connexion->get('dbname');
|
||||
|
||||
if ( ! extension_loaded('phrasea2'))
|
||||
printf("Missing Extension php-phrasea");
|
||||
|
||||
if (function_exists('phrasea_conn'))
|
||||
if (phrasea_conn($hostname, $port, $user, $password, $dbname) !== true)
|
||||
self::headers(500);
|
||||
if (!extension_loaded('phrasea2')) {
|
||||
throw new RuntimeException('Phrasea extension is required');
|
||||
}
|
||||
|
||||
public function getHome($type = 'PUBLI', $context = 'prod')
|
||||
if (!function_exists('phrasea_conn')) {
|
||||
throw new RuntimeException('Phrasea extension requires upgrade');
|
||||
}
|
||||
|
||||
if (phrasea_conn($hostname, $port, $user, $password, $dbname) !== true) {
|
||||
throw new RuntimeException('Unable to initialize Phrasea connection');
|
||||
}
|
||||
}
|
||||
|
||||
public function getHome(Application $app, $type = 'PUBLI', $context = 'prod')
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$registry = $appbox->get_registry();
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
$user = $app['phraseanet.user'];
|
||||
if ($type == 'HELP') {
|
||||
if (file_exists($registry->get('GV_RootPath') . "config/help_" . $session->get_I18n() . ".php")) {
|
||||
require($registry->get('GV_RootPath') . "config/help_" . $session->get_I18n() . ".php");
|
||||
if (file_exists($registry->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php")) {
|
||||
require($registry->get('GV_RootPath') . "config/help_" . $app['locale.I18n'] . ".php");
|
||||
} elseif (file_exists($registry->get('GV_RootPath') . 'config/help.php')) {// on verifie si il y a une home personnalisee sans langage
|
||||
require($registry->get('GV_RootPath') . 'config/help.php');
|
||||
} else {
|
||||
@@ -101,7 +107,7 @@ class phrasea
|
||||
foreach ($searchSet->bases as $bases)
|
||||
$bas = array_merge($bas, $bases);
|
||||
} else {
|
||||
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
|
||||
$user = $app['phraseanet.user'];
|
||||
$bas = array_keys($user->ACL()->get_granted_base());
|
||||
}
|
||||
|
||||
@@ -150,22 +156,21 @@ class phrasea
|
||||
return;
|
||||
}
|
||||
|
||||
public static function clear_sbas_params()
|
||||
public static function clear_sbas_params(Application $app)
|
||||
{
|
||||
self::$_sbas_params = null;
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox->delete_data_from_cache(self::CACHE_SBAS_PARAMS);
|
||||
$app['phraseanet.appbox']->delete_data_from_cache(self::CACHE_SBAS_PARAMS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function sbas_params()
|
||||
public static function sbas_params(Application $app)
|
||||
{
|
||||
if (self::$_sbas_params) {
|
||||
return self::$_sbas_params;
|
||||
}
|
||||
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
try {
|
||||
self::$_sbas_params = $appbox->get_data_from_cache(self::CACHE_SBAS_PARAMS);
|
||||
|
||||
@@ -191,14 +196,13 @@ class phrasea
|
||||
return self::$_sbas_params;
|
||||
}
|
||||
|
||||
public static function guest_allowed()
|
||||
public static function guest_allowed(Application $app)
|
||||
{
|
||||
$usr_id = User_Adapter::get_usr_id_from_login('invite');
|
||||
if ( ! $usr_id) {
|
||||
$usr_id = User_Adapter::get_usr_id_from_login($app, 'invite');
|
||||
if (!$usr_id) {
|
||||
return false;
|
||||
}
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$user = User_Adapter::getInstance($usr_id, $appbox);
|
||||
$user = User_Adapter::getInstance($usr_id, $app);
|
||||
|
||||
return count($user->ACL()->get_granted_base()) > 0;
|
||||
}
|
||||
@@ -243,10 +247,10 @@ class phrasea
|
||||
return $array;
|
||||
}
|
||||
|
||||
public static function sbasFromBas($base_id)
|
||||
public static function sbasFromBas(Application $app, $base_id)
|
||||
{
|
||||
if ( ! self::$_bas2sbas) {
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
if (!self::$_bas2sbas) {
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
try {
|
||||
self::$_bas2sbas = $appbox->get_data_from_cache(self::CACHE_SBAS_FROM_BAS);
|
||||
} catch (Exception $e) {
|
||||
@@ -267,10 +271,10 @@ class phrasea
|
||||
return isset(self::$_bas2sbas[$base_id]) ? self::$_bas2sbas[$base_id] : false;
|
||||
}
|
||||
|
||||
public static function baseFromColl($sbas_id, $coll_id)
|
||||
public static function baseFromColl($sbas_id, $coll_id, Application $app)
|
||||
{
|
||||
if ( ! self::$_coll2bas) {
|
||||
$conn = connection::getPDOConnection();
|
||||
if (!self::$_coll2bas) {
|
||||
$conn = connection::getPDOConnection($app);
|
||||
$sql = 'SELECT base_id, server_coll_id, sbas_id FROM bas';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
@@ -278,7 +282,7 @@ class phrasea
|
||||
$stmt->closeCursor();
|
||||
|
||||
foreach ($rs as $row) {
|
||||
if ( ! isset(self::$_coll2bas[$row['sbas_id']]))
|
||||
if (!isset(self::$_coll2bas[$row['sbas_id']]))
|
||||
self::$_coll2bas[$row['sbas_id']] = array();
|
||||
self::$_coll2bas[$row['sbas_id']][$row['server_coll_id']] = (int) $row['base_id'];
|
||||
}
|
||||
@@ -287,10 +291,9 @@ class phrasea
|
||||
return isset(self::$_coll2bas[$sbas_id][$coll_id]) ? self::$_coll2bas[$sbas_id][$coll_id] : false;
|
||||
}
|
||||
|
||||
public static function reset_baseDatas()
|
||||
public static function reset_baseDatas(appbox $appbox)
|
||||
{
|
||||
self::$_coll2bas = self::$_bas2coll = self::$_bas_names = self::$_bas2sbas = null;
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox->delete_data_from_cache(
|
||||
array(
|
||||
self::CACHE_BAS_2_COLL
|
||||
@@ -303,10 +306,9 @@ class phrasea
|
||||
return;
|
||||
}
|
||||
|
||||
public static function reset_sbasDatas()
|
||||
public static function reset_sbasDatas(appbox $appbox)
|
||||
{
|
||||
self::$_sbas_names = self::$_sbas_params = self::$_bas2sbas = null;
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$appbox->delete_data_from_cache(
|
||||
array(
|
||||
self::CACHE_SBAS_NAMES
|
||||
@@ -318,10 +320,10 @@ class phrasea
|
||||
return;
|
||||
}
|
||||
|
||||
public static function collFromBas($base_id)
|
||||
public static function collFromBas(Application $app, $base_id)
|
||||
{
|
||||
if ( ! self::$_bas2coll) {
|
||||
$conn = connection::getPDOConnection();
|
||||
if (!self::$_bas2coll) {
|
||||
$conn = connection::getPDOConnection($app);
|
||||
$sql = 'SELECT base_id, server_coll_id FROM bas';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
@@ -336,10 +338,10 @@ class phrasea
|
||||
return isset(self::$_bas2coll[$base_id]) ? self::$_bas2coll[$base_id] : false;
|
||||
}
|
||||
|
||||
public static function sbas_names($sbas_id)
|
||||
public static function sbas_names($sbas_id, Application $app)
|
||||
{
|
||||
if ( ! self::$_sbas_names) {
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
if (!self::$_sbas_names) {
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
try {
|
||||
self::$_sbas_names = $appbox->get_data_from_cache(self::CACHE_SBAS_NAMES);
|
||||
} catch (Exception $e) {
|
||||
@@ -360,10 +362,10 @@ class phrasea
|
||||
return isset(self::$_sbas_names[$sbas_id]) ? self::$_sbas_names[$sbas_id] : 'Unknown base';
|
||||
}
|
||||
|
||||
public static function bas_names($base_id)
|
||||
public static function bas_names($base_id, Application $app)
|
||||
{
|
||||
if ( ! self::$_bas_names) {
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
if (!self::$_bas_names) {
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
try {
|
||||
self::$_bas_names = $appbox->get_data_from_cache(self::CACHE_BAS_NAMES);
|
||||
} catch (Exception $e) {
|
||||
@@ -423,9 +425,9 @@ class phrasea
|
||||
return;
|
||||
}
|
||||
|
||||
public static function scheduler_key($renew = false)
|
||||
public static function scheduler_key(Application $app, $renew = false)
|
||||
{
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($app);
|
||||
|
||||
$schedulerkey = false;
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
/*
|
||||
* Phraseanet Date class, mostly inspired by :
|
||||
*
|
||||
@@ -16,16 +18,21 @@
|
||||
class phraseadate
|
||||
{
|
||||
|
||||
private $app;
|
||||
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param DateTime $date
|
||||
* @return string
|
||||
*/
|
||||
public static function getTime(DateTime $date)
|
||||
public function getTime(DateTime $date)
|
||||
{
|
||||
$locale = Session_Handler::get_locale();
|
||||
|
||||
switch ($locale) {
|
||||
switch ($this->app['locale']) {
|
||||
default:
|
||||
case 'fr_FR':
|
||||
case 'de_DE':
|
||||
@@ -44,7 +51,7 @@ class phraseadate
|
||||
* @param DateTime $date
|
||||
* @return string
|
||||
*/
|
||||
public static function getDate(DateTime $date)
|
||||
public function getDate(DateTime $date)
|
||||
{
|
||||
$compareTo = new DateTime('now');
|
||||
$diff = $compareTo->format('U') - $date->format('U');
|
||||
@@ -55,9 +62,9 @@ class phraseadate
|
||||
}
|
||||
|
||||
if ($dayDiff < 365) {
|
||||
return self::formatDate($date, Session_Handler::get_locale(), 'DAY_MONTH');
|
||||
return $this->formatDate($date, $this->app['locale'], 'DAY_MONTH');
|
||||
} else {
|
||||
return self::formatDate($date, Session_Handler::get_locale(), 'DAY_MONTH_YEAR');
|
||||
return $this->formatDate($date, $this->app['locale'], 'DAY_MONTH_YEAR');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +73,7 @@ class phraseadate
|
||||
* @param DateTime $date
|
||||
* @return string
|
||||
*/
|
||||
public static function getPrettyString(DateTime $date = null)
|
||||
public function getPrettyString(DateTime $date = null)
|
||||
{
|
||||
if (is_null($date)) {
|
||||
return null;
|
||||
@@ -80,7 +87,7 @@ class phraseadate
|
||||
return '';
|
||||
}
|
||||
|
||||
$date_string = self::formatDate($date, Session_Handler::get_locale(), 'DAY_MONTH');
|
||||
$date_string = $this->formatDate($date, $this->app['locale'], 'DAY_MONTH');
|
||||
|
||||
if ($dayDiff == 0) {
|
||||
if ($diff < 60) {
|
||||
@@ -101,7 +108,7 @@ class phraseadate
|
||||
} elseif ($dayDiff < 365 && $dayDiff > 0) {
|
||||
return $date_string;
|
||||
} else {
|
||||
return self::formatDate($date, Session_Handler::get_locale(), 'DAY_MONTH_YEAR');
|
||||
return $this->formatDate($date, $this->app['locale'], 'DAY_MONTH_YEAR');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +117,7 @@ class phraseadate
|
||||
* @param DateTime $date
|
||||
* @return string
|
||||
*/
|
||||
public static function format_mysql(DateTime $date)
|
||||
public function format_mysql(DateTime $date)
|
||||
{
|
||||
return $date->format(DATE_ISO8601);
|
||||
}
|
||||
@@ -171,7 +178,7 @@ class phraseadate
|
||||
* @param string $format
|
||||
* @return string
|
||||
*/
|
||||
public static function isodateToDate($isodelimdate, $format)
|
||||
public function isodateToDate($isodelimdate, $format)
|
||||
{
|
||||
$tc = array();
|
||||
$bal = array();
|
||||
@@ -234,7 +241,7 @@ class phraseadate
|
||||
* @param string $format
|
||||
* @return string
|
||||
*/
|
||||
public static function dateToIsodate($strdate, $format)
|
||||
public function dateToIsodate($strdate, $format)
|
||||
{
|
||||
$v_y = $v_m = $v_d = $v_h = $v_n = $v_s = 0;
|
||||
$v = str_replace(
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@@ -18,23 +20,19 @@
|
||||
class queries
|
||||
{
|
||||
|
||||
public static function tree_topics()
|
||||
public static function tree_topics($I18N)
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
$out = '';
|
||||
|
||||
$xmlTopics = null;
|
||||
$sxTopics = null;
|
||||
|
||||
if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics_' . $session->get_I18n() . '.xml'))
|
||||
$xmlTopics = $registry->get('GV_RootPath') . 'config/topics/topics_' . $session->get_I18n() . '.xml';
|
||||
if (file_exists(__DIR__ . '/../../config/topics/topics_' . $I18N . '.xml'))
|
||||
$xmlTopics = __DIR__ . '/../../config/topics/topics_' . $I18N . '.xml';
|
||||
|
||||
if ( ! $xmlTopics) {
|
||||
if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics.xml')) {
|
||||
$xmlTopics = $registry->get('GV_RootPath') . 'config/topics/topics.xml';
|
||||
if (file_exists(__DIR__ . '/../../config/topics/topics.xml')) {
|
||||
$xmlTopics = __DIR__ . '/../../config/topics/topics.xml';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,40 +63,32 @@ class queries
|
||||
return $out;
|
||||
}
|
||||
|
||||
public static function topics_exists()
|
||||
public static function topics_exists($I18n)
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics_' . $session->get_I18n() . '.xml')) {
|
||||
if (file_exists(__DIR__ . '/../../config/topics/topics_' . $I18n . '.xml')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics.xml')) {
|
||||
if (file_exists(__DIR__ . '/../../config/topics/topics.xml')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function dropdown_topics()
|
||||
public static function dropdown_topics($I18n)
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$registry = $appbox->get_registry();
|
||||
|
||||
$out = '';
|
||||
|
||||
$xmlTopics = '';
|
||||
$sxTopics = null;
|
||||
|
||||
if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics_' . $session->get_I18n() . '.xml'))
|
||||
$xmlTopics = $registry->get('GV_RootPath') . 'config/topics/topics_' . $session->get_I18n() . '.xml';
|
||||
if (file_exists(__DIR__ . '/../../config/topics/topics_' . $I18n . '.xml'))
|
||||
$xmlTopics = __DIR__ . '/../../config/topics/topics_' . $I18n . '.xml';
|
||||
|
||||
if ($xmlTopics == '') {
|
||||
if (file_exists($registry->get('GV_RootPath') . 'config/topics/topics.xml')) {
|
||||
$xmlTopics = $registry->get('GV_RootPath') . 'config/topics/topics.xml';
|
||||
if (file_exists(__DIR__ . '/../../config/topics/topics.xml')) {
|
||||
$xmlTopics = __DIR__ . '/../../config/topics/topics.xml';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,14 +190,10 @@ class queries
|
||||
return $out;
|
||||
}
|
||||
|
||||
public static function history()
|
||||
public static function history(appbox $appbox, $usr_id)
|
||||
{
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$session = $appbox->get_session();
|
||||
$conn = $appbox->get_connection();
|
||||
|
||||
$usr_id = $session->get_usr_id();
|
||||
|
||||
$sql = "SELECT query from dsel where usr_id = :usr_id
|
||||
ORDER BY id DESC LIMIT 0,25";
|
||||
|
||||
@@ -219,8 +205,6 @@ class queries
|
||||
$history = '<ul>';
|
||||
|
||||
foreach ($rs as $row) {
|
||||
$longueur = strlen($row["query"]);
|
||||
|
||||
$history .= '<li onclick="doSpecialSearch(\'' . str_replace(array("'", '"'), array("\'", '"'), $row["query"]) . '\')">' . $row["query"] . '</li>';
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class random
|
||||
{
|
||||
/**
|
||||
@@ -36,14 +38,13 @@ class random
|
||||
*
|
||||
* @return Void
|
||||
*/
|
||||
public static function cleanTokens()
|
||||
public static function cleanTokens(Application $app)
|
||||
{
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($app);
|
||||
|
||||
$date = new DateTime();
|
||||
$date = phraseadate::format_mysql($date);
|
||||
$registry = registry::get_instance();
|
||||
$date = $app['date-formatter']->format_mysql($date);
|
||||
|
||||
$sql = 'SELECT * FROM tokens WHERE expire_on < :date
|
||||
AND datas IS NOT NULL AND (type="download" OR type="email")';
|
||||
@@ -55,7 +56,7 @@ class random
|
||||
switch ($row['type']) {
|
||||
case 'download':
|
||||
case 'email':
|
||||
$file = $registry->get('GV_RootPath') . 'tmp/download/' . $row['value'] . '.zip';
|
||||
$file = __DIR__ . '/../../tmp/download/' . $row['value'] . '.zip';
|
||||
if (is_file($file))
|
||||
unlink($file);
|
||||
break;
|
||||
@@ -108,10 +109,10 @@ class random
|
||||
* @param mixed content $datas
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getUrlToken($type, $usr, DateTime $end_date = null, $datas = '')
|
||||
public static function getUrlToken(Application $app, $type, $usr, DateTime $end_date = null, $datas = '')
|
||||
{
|
||||
self::cleanTokens();
|
||||
$conn = connection::getPDOConnection();
|
||||
self::cleanTokens($app);
|
||||
$conn = connection::getPDOConnection($app);
|
||||
$token = $test = false;
|
||||
|
||||
switch ($type) {
|
||||
@@ -164,12 +165,12 @@ class random
|
||||
return $token;
|
||||
}
|
||||
|
||||
public static function removeToken($token)
|
||||
public static function removeToken(Application $app, $token)
|
||||
{
|
||||
self::cleanTokens();
|
||||
self::cleanTokens($app);
|
||||
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($app);
|
||||
$sql = 'DELETE FROM tokens WHERE value = :token';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute(array(':token' => $token));
|
||||
@@ -183,10 +184,10 @@ class random
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function updateToken($token, $datas)
|
||||
public static function updateToken(Application $app, $token, $datas)
|
||||
{
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($app);
|
||||
|
||||
$sql = 'UPDATE tokens SET datas = :datas
|
||||
WHERE value = :token';
|
||||
@@ -203,11 +204,11 @@ class random
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function helloToken($token)
|
||||
public static function helloToken(Application $app, $token)
|
||||
{
|
||||
self::cleanTokens();
|
||||
self::cleanTokens($app);
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($app);
|
||||
$sql = 'SELECT * FROM tokens
|
||||
WHERE value = :token
|
||||
AND (expire_on > NOW() OR expire_on IS NULL)';
|
||||
@@ -230,9 +231,9 @@ class random
|
||||
* @return string The desired token
|
||||
* @throws \Exception_NotFound
|
||||
*/
|
||||
public static function getValidationToken($userId, $basketId)
|
||||
public static function getValidationToken(Application $app, $userId, $basketId)
|
||||
{
|
||||
$conn = \connection::getPDOConnection();
|
||||
$conn = \connection::getPDOConnection($app);
|
||||
$sql = '
|
||||
SELECT value FROM tokens
|
||||
WHERE type = :type
|
||||
|
@@ -9,6 +9,9 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Cache\ArrayCache;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
@@ -27,6 +30,7 @@ class registry implements registryInterface
|
||||
* @var registry
|
||||
*/
|
||||
protected static $_instance;
|
||||
protected $app;
|
||||
|
||||
const TYPE_BOOLEAN = 'boolean';
|
||||
const TYPE_ARRAY = 'array';
|
||||
@@ -34,35 +38,21 @@ class registry implements registryInterface
|
||||
const TYPE_INTEGER = 'integer';
|
||||
const TYPE_STRING = 'string';
|
||||
|
||||
/**
|
||||
*
|
||||
* @return registry
|
||||
*/
|
||||
public static function get_instance()
|
||||
{
|
||||
if ( ! self::$_instance instanceof self) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Alchemy\Phrasea\Cache\Cache $cache
|
||||
* @return registry
|
||||
*/
|
||||
protected function __construct()
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->cache = new Alchemy\Phrasea\Cache\ArrayCache();
|
||||
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
$this->app = $app;
|
||||
$this->cache = new ArrayCache();
|
||||
|
||||
$this->cache->save('GV_RootPath', dirname(dirname(__DIR__)) . '/');
|
||||
if ($configuration->isInstalled()) {
|
||||
$this->cache->save('GV_ServerName', $configuration->getPhraseanet()->get('servername'));
|
||||
$this->cache->save('GV_debug', $configuration->isDebug());
|
||||
$this->cache->save('GV_maintenance', $configuration->isMaintained());
|
||||
if ($app['phraseanet.configuration']->isInstalled()) {
|
||||
$this->cache->save('GV_ServerName', $app['phraseanet.configuration']->getPhraseanet()->get('servername'));
|
||||
$this->cache->save('GV_debug', $app['phraseanet.configuration']->isDebug());
|
||||
$this->cache->save('GV_maintenance', $app['phraseanet.configuration']->isMaintained());
|
||||
}
|
||||
|
||||
return $this;
|
||||
@@ -78,7 +68,7 @@ class registry implements registryInterface
|
||||
$rs = array();
|
||||
$loaded = false;
|
||||
try {
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->app);
|
||||
$sql = 'SELECT `key`, `value`, `type` FROM registry';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
@@ -95,7 +85,7 @@ class registry implements registryInterface
|
||||
|
||||
switch ($row['type']) {
|
||||
case self::TYPE_BOOLEAN:
|
||||
$value = ! ! $row['value'];
|
||||
$value = !!$row['value'];
|
||||
break;
|
||||
case self::TYPE_INTEGER:
|
||||
$value = (int) $row['value'];
|
||||
@@ -126,10 +116,10 @@ class registry implements registryInterface
|
||||
*/
|
||||
public function get($key, $defaultvalue = null)
|
||||
{
|
||||
if ( ! $this->cache->contains($key))
|
||||
if (!$this->cache->contains($key))
|
||||
$this->load();
|
||||
|
||||
if ( ! $this->cache->contains($key) && ! is_null($defaultvalue)) {
|
||||
if (!$this->cache->contains($key) && !is_null($defaultvalue)) {
|
||||
return $defaultvalue;
|
||||
}
|
||||
|
||||
@@ -159,7 +149,7 @@ class registry implements registryInterface
|
||||
break;
|
||||
case self::TYPE_BOOLEAN:
|
||||
$sql_value = $value ? '1' : '0';
|
||||
$value = ! ! $value;
|
||||
$value = !!$value;
|
||||
break;
|
||||
case self::TYPE_INTEGER:
|
||||
$sql_value = (int) $value;
|
||||
@@ -167,7 +157,7 @@ class registry implements registryInterface
|
||||
break;
|
||||
}
|
||||
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->app);
|
||||
|
||||
$sql = 'REPLACE INTO registry (`id`, `key`, `value`, `type`)
|
||||
VALUES (null, :key, :value, :type)';
|
||||
@@ -200,7 +190,7 @@ class registry implements registryInterface
|
||||
public function un_set($key)
|
||||
{
|
||||
$this->load();
|
||||
$conn = connection::getPDOConnection();
|
||||
$conn = connection::getPDOConnection($this->app);
|
||||
|
||||
$sql = 'DELETE FROM registry WHERE `key` = :key';
|
||||
$stmt = $conn->prepare($sql);
|
||||
|
@@ -8,6 +8,8 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
/**
|
||||
*
|
||||
* This file MUST NOT contains any default PHP function as
|
||||
@@ -144,12 +146,12 @@ class setup
|
||||
return;
|
||||
}
|
||||
|
||||
public function create_global_values(registryInterface &$registry, $datas = array())
|
||||
public function create_global_values(Application $app, $datas = array())
|
||||
{
|
||||
require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
|
||||
|
||||
if ($registry->is_set('GV_timezone'))
|
||||
date_default_timezone_set($registry->get('GV_timezone'));
|
||||
if ($app['phraseanet.registry']->is_set('GV_timezone'))
|
||||
date_default_timezone_set($app['phraseanet.registry']->get('GV_timezone'));
|
||||
else
|
||||
date_default_timezone_set('Europe/Berlin');
|
||||
|
||||
@@ -240,7 +242,10 @@ class setup
|
||||
|
||||
if ($error === false) {
|
||||
foreach ($vars as $key => $values) {
|
||||
$registry->set($key, $values['value'], $values['type']);
|
||||
if ($key == 'GV_sit' && null !== $app['phraseanet.registry']->get('GV_sit')) {
|
||||
continue;
|
||||
}
|
||||
$app['phraseanet.registry']->set($key, $values['value'], $values['type']);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -352,7 +357,6 @@ class setup
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
public static function check_phrasea()
|
||||
{
|
||||
$constraints = array();
|
||||
@@ -491,7 +495,6 @@ class setup
|
||||
return new Setup_ConstraintsIterator($constraints);
|
||||
}
|
||||
|
||||
|
||||
public static function check_cache_opcode()
|
||||
{
|
||||
$availables = array('XCache', 'apc', 'eAccelerator', 'phpa', 'WinCache');
|
||||
@@ -515,7 +518,7 @@ class setup
|
||||
|
||||
public static function check_php_configuration()
|
||||
{
|
||||
$nonblockers = array('log_errors', 'display_startup_errors', 'display_errors', 'output_buffering');
|
||||
$nonblockers = array('log_errors', 'display_startup_errors', 'display_errors', 'output_buffering', 'error_reporting');
|
||||
|
||||
$constraints = array();
|
||||
foreach (self::$PHP_REQ as $conf => $value) {
|
||||
@@ -562,12 +565,11 @@ class setup
|
||||
return new Setup_ConstraintsIterator($constraints);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Setup_ConstraintsIterator
|
||||
*/
|
||||
public static function check_system_locales()
|
||||
public static function check_system_locales(Application $app)
|
||||
{
|
||||
$constraints = array();
|
||||
|
||||
@@ -584,7 +586,7 @@ class setup
|
||||
$constraints[] = new Setup_Constraint($language_name, false, sprintf('Locale %s (%s) not installed', $language_name, $code), false);
|
||||
}
|
||||
}
|
||||
phrasea::use_i18n(Session_Handler::get_locale());
|
||||
phrasea::use_i18n($app['locale']);
|
||||
|
||||
return new Setup_ConstraintsIterator($constraints);
|
||||
}
|
||||
@@ -653,4 +655,4 @@ class setup
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -60,8 +60,7 @@ class sphinxrt
|
||||
*/
|
||||
public function delete(Array $index_ids, $rt_id, $id)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
require_once $registry->get('GV_RootPath') . 'lib/vendor/sphinx/sphinxapi.php';
|
||||
require_once __DIR__ . '/../../lib/vendor/sphinx/sphinxapi.php';
|
||||
|
||||
$cl = new SphinxClient();
|
||||
|
||||
@@ -85,8 +84,7 @@ class sphinxrt
|
||||
|
||||
public function update_status(Array $index_ids, $sbas_id, $record_id, $status)
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
require_once $registry->get('GV_RootPath') . 'lib/vendor/sphinx/sphinxapi.php';
|
||||
require_once __DIR__ . '/../../lib/vendor/sphinx/sphinxapi.php';
|
||||
|
||||
$cl = new SphinxClient();
|
||||
|
||||
|
Reference in New Issue
Block a user