Merge branch 'master' of github.com:alchemy-fr/Phraseanet

This commit is contained in:
Romain Neutron
2012-02-08 11:24:46 +01:00
121 changed files with 1821 additions and 1520 deletions

93
builder.php Executable file
View File

@@ -0,0 +1,93 @@
#!/usr/bin/env php
<?php
/*
* Build Phraseanet for download
*
*/
printf('Retrieve vendors ...' . PHP_EOL);
system('./vendors.php');
require_once __DIR__ . '/lib/classes/bootstrap.class.php';
\bootstrap::register_autoloads();
use Symfony\Component\Finder\Finder;
chdir(__DIR__);
set_time_limit(0);
printf('Remove files ...' . PHP_EOL);
$finder = new Finder();
$finder
->files()
->name('.gitmodules')
->name('.gitignore')
->name('check_cs.php')
->name('pom.xml')
->name('vendors.php')
->name('builder.php')
->ignoreDotFiles(false)
->ignoreVCS(false)
->in(__DIR__);
$files = array();
foreach ($finder as $file)
{
$files[] = $file->getPathname();
}
foreach ($files as $file)
{
echo "rm $file\n";
unlink($file);
}
$finder = new Finder();
$finder
->directories()
->name('test')
->name('tests')
->name('unitTest')
->name('demos')
->name('demo')
->name('example')
->name('examples')
->name('docs')
->name('documentation')
->name('doc')
->name('as-docs')
->name('hudson')
->name('.svn')
->name('.git')
->ignoreDotFiles(false)
->ignoreVCS(false)
->in(__DIR__);
$dirs = array();
foreach ($finder as $dir)
{
$dirs[] = $dir->getPathname();
}
foreach ($dirs as $dir)
{
if (!is_dir($dir))
{
continue;
}
$cmd = sprintf('rm -Rf %s' . PHP_EOL, escapeshellarg($dir));
printf($cmd);
system($cmd);
}
exit(0);

112
check_cs.php Executable file
View File

@@ -0,0 +1,112 @@
#!/usr/bin/env php
<?php
/*
* Coding Standards (a.k.a. CS)
*
* @Author Fabien Potencier
*
* @see https://github.com/symfony/symfony/blob/master/check_cs
*
* This script is designed to clean up the source files and thus follow coding
* conventions.
*
* @see http://symfony.com/doc/2.0/contributing/code/standards.html
*
*/
require_once __DIR__ . '/lib/bootstrap.php';
use Symfony\Component\Finder\Finder;
$fix = isset($argv[1]) && 'fix' == $argv[1];
$finder = new Finder();
$finder
->files()
->name('*.md')
->name('*.php')
->name('*.inc')
->name('*.php.dist')
->name('*.twig')
->name('*.xml')
->name('*.xml.dist')
->name('*.yml')
->in(
array(
__DIR__ . '/lib',
__DIR__ . '/bin',
__DIR__ . '/config',
__DIR__ . '/www',
__DIR__ . '/templates'
)
)
->notName(basename(__FILE__))
->exclude('.git')
->exclude('vendor')
;
$count = 0;
foreach ($finder as $file)
{
/* @var $file Symfony\Component\Finder\SplFileInfo */
$old = file_get_contents($file->getRealpath());
$new = $old;
// [Structure] Never use short tags (<?)
$new = str_replace('<? ', '<?php ', $new);
// [Structure] Indentation is done by steps of four spaces (tabs are never allowed)
$new = preg_replace_callback('/^( *)(\t+)/m', function ($matches) use ($new)
{
return $matches[1] . str_repeat(' ', strlen($matches[2]));
}, $new);
// [Structure] Use the linefeed character (0x0A) to end lines
$new = str_replace("\r\n", "\n", $new);
// [Structure] Don't add trailing spaces at the end of lines
$new = preg_replace('/[ \t]*$/m', '', $new);
// [Structure] Convert tabs to spaces
$new = preg_replace('/\t/m', ' ', $new);
// [Structure] Add a blank line before return statements
$new = preg_replace_callback('/(^.*$)\n(^ +return)/m', function ($match)
{
// don't add it if the previous line is ...
if (
preg_match('/\{$/m', $match[1]) || // ... ending with an opening brace
preg_match('/\:$/m', $match[1]) || // ... ending with a colon (e.g. a case statement)
preg_match('%^ *//%m', $match[1]) || // ... an inline comment
preg_match('/^$/m', $match[1]) // ... already blank
)
{
return $match[1] . "\n" . $match[2];
}
return $match[1] . "\n\n" . $match[2];
}, $new);
// [Structure] A file must always ends with a linefeed character
if (strlen($new) && "\n" != substr($new, -1))
{
$new .= "\n";
}
if ($new != $old)
{
$count++;
if ($fix)
{
file_put_contents($file->getRealpath(), $new);
}
printf('%4d) %s' . PHP_EOL, $count, $file->getRelativePathname());
}
}
exit($count ? 1 : 0);

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();
@@ -327,8 +330,16 @@ class ACL implements cache_cacheableInterface
// apply sb : unchecked boxes on template will be unchecked on user // apply sb : unchecked boxes on template will be unchecked on user
// checked boxes on template does nothing (left unchanged on user) // checked boxes on template does nothing (left unchanged on user)
// get masks from 64 bits int AS DECIMAL STRING to BINARY STRING // get masks from 64 bits int AS DECIMAL STRING to BINARY STRING
$mand = substr(str_repeat('0', 64) . databox_status::dec2bin($template_user->ACL()->get_mask_and($base_id)), -64);
$mxor = substr(str_repeat('0', 64) . databox_status::dec2bin($template_user->ACL()->get_mask_xor($base_id)), -64); $mask_and = $template_user->ACL()->get_mask_and($base_id);
$mask_xor = $template_user->ACL()->get_mask_xor($base_id);
$mask_and = ctype_digit($mask_and) ? $mask_and : '0';
$mask_xor = ctype_digit($mask_xor) ? $mask_xor : '0';
$mand = substr(str_repeat('0', 64) . databox_status::dec2bin($mask_and), -64);
$mxor = substr(str_repeat('0', 64) . databox_status::dec2bin($mask_xor), -64);
$m = array('aa' => '', 'ao' => '', 'xa' => '', 'xo' => ''); $m = array('aa' => '', 'ao' => '', 'xa' => '', 'xo' => '');
for ($i = 0; $i < 64; $i++) for ($i = 0; $i < 64; $i++)
{ {
@@ -382,6 +393,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 +481,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 +498,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 +516,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 +556,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 +579,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 +595,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'];
@@ -718,6 +737,7 @@ class ACL implements cache_cacheableInterface
{ {
if ($this->_rights_records_preview) if ($this->_rights_records_preview)
return $this; return $this;
try try
@@ -771,6 +791,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
@@ -832,6 +853,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
@@ -1335,6 +1357,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 +1524,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]);
} }

View File

@@ -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

@@ -287,7 +287,7 @@ class Controller_Setup_Installer implements ControllerProviderInterface
$appbox->get_session()->authenticate($auth); $appbox->get_session()->authenticate($auth);
$redirection = '/admin/?section=taskmanager&notice=install_success'; $redirection = '/admin/index.php?section=taskmanager&notice=install_success';
return $app->redirect($redirection); return $app->redirect($redirection);
} }

View File

@@ -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

@@ -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

@@ -395,6 +395,7 @@ class Session_Handler
foreach ($user->ACL()->get_granted_sbas() as $databox) foreach ($user->ACL()->get_granted_sbas() as $databox)
{ {
Session_Logger::create($databox, $browser, $this, $user); Session_Logger::create($databox, $browser, $this, $user);
\cache_databox::insertClient($databox);
} }
$this->set_usr_lastconn($conn, $user->get_id()); $this->set_usr_lastconn($conn, $user->get_id());

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();
@@ -1277,7 +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();
$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));
@@ -1293,6 +1298,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
{ {
if (!isset($this->_prefs[$k])) if (!isset($this->_prefs[$k]))
{ {
if($k == 'start_page_query' && $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);
} }
@@ -1565,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;
@@ -1602,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();
@@ -1876,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

@@ -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

@@ -180,6 +180,12 @@ abstract class base implements cache_cacheableInterface
*/ */
public function get_data_from_cache($option = null) public function get_data_from_cache($option = null)
{ {
if($this->get_base_type() == self::DATA_BOX)
{
\cache_databox::refresh($this->id);
}
return $this->get_cache()->get($this->get_cache_key($option)); return $this->get_cache()->get($this->get_cache_key($option));
} }

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;
} }
@@ -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();
@@ -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();
@@ -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();
@@ -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);
} }

View File

@@ -18,142 +18,125 @@
class cache_databox class cache_databox
{ {
/**
*
* @var cache_databox
*/
private static $_instance = false;
/**
*
* @var cache
*/
protected $_c_obj = false;
/**
*
* @return cache_databox
*/
function __construct()
{
$this->_c_obj = cache_adapter::getInstance(registry::get_instance());
return $this;
}
/**
* @return cache_databox
*/
public static function getInstance()
{
if (!(self::$_instance instanceof self))
self::$_instance = new self();
return self::$_instance;
}
/**
*
* @param string $type
* @param string $what
* @return boolean
*/
public function get($type, $what)
{
return $this->_c_obj->get('_databox_' . $type . '_' . $what);
}
/**
*
* @param string $type
* @param string $what
* @param mixed content $bin
* @return boolean
*/
public function set($type, $what, $bin)
{
return $this->_c_obj->set('_databox_' . $type . '_' . $what, $bin);
}
/**
*
* @param string $type
* @param string $what
* @return boolean
*/
public function delete($type, $what)
{
return $this->_c_obj->delete('_databox_' . $type . '_' . $what);
}
/** /**
* *
* @param int $sbas_id * @param int $sbas_id
* @return cache_databox * @return cache_databox
*/ */
function refresh($sbas_id) public static function refresh($sbas_id)
{ {
$date = new DateTime('-30 seconds'); $databox = \databox::get_instance((int) $sbas_id);
$registry = registry::get_instance(); $date = new \DateTime('-3 seconds');
$appbox = \appbox::get_instance();
$registry = \registry::get_instance();
$last_update = null;
try
{
$last_update = $appbox->get_data_from_cache('memcached_update_' . $sbas_id);
}
catch (\Exception $e)
{
}
$cache_appbox = cache_appbox::getInstance();
$last_update = $cache_appbox->get('memcached_update');
if ($last_update) if ($last_update)
$last_update = new DateTime($last_update); $last_update = new \DateTime($last_update);
else else
$last_update = new DateTime('-10 years'); $last_update = new \DateTime('-10 years');
if ($date <= $last_update || !$cache_appbox->is_ok()) if ($date <= $last_update || !$appbox->get_cache()->ping())
return $this;
$connsbas = connection::getInstance($sbas_id);
if (!$connsbas)
return $this;
$sql = 'SELECT type, value FROM memcached
WHERE site_id="' . $connsbas->escape_string($registry->get('GV_ServerName')) . '"';
if ($rs = $connsbas->query($sql))
{ {
$cache_thumbnail = cache_thumbnail::getInstance(); return;
$cache_preview = cache_preview::getInstance(); }
while ($row = $connsbas->fetch_assoc($rs))
$connsbas = \connection::getPDOConnection($sbas_id);
$sql = 'SELECT type, value FROM memcached WHERE site_id = :site_id';
$stmt = $connsbas->prepare($sql);
$stmt->execute(array(':site_id' => $registry->get('GV_ServerName')));
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row)
{ {
switch ($row['type']) switch ($row['type'])
{ {
case 'record': case 'record':
$cache_thumbnail->delete($sbas_id, $row['value'], false); $key = 'record_' . $sbas_id . '_' . $row['value'];
$cache_preview->delete($sbas_id, $row['value'], false); $databox->delete_data_from_cache($key);
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_SUBDEFS;
$databox->delete_data_from_cache($key);
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_GROUPING;
$databox->delete_data_from_cache($key);
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_MIME;
$databox->delete_data_from_cache($key);
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_ORIGINAL_NAME;
$databox->delete_data_from_cache($key);
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_SHA256;
$databox->delete_data_from_cache($key);
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_STATUS;
$databox->delete_data_from_cache($key);
$key = 'record_' . $sbas_id . '_' . $row['value'] . '_' . \record_adapter::CACHE_TECHNICAL_DATAS;
$databox->delete_data_from_cache($key);
$sql = 'DELETE FROM memcached $sql = 'DELETE FROM memcached
WHERE site_id="' . $connsbas->escape_string($registry->get('GV_ServerName')) . '" WHERE site_id = :site_id AND type="record" AND value = :value';
AND type="record" AND value="' . $row['value'] . '"';
$connsbas->query($sql); $params = array(
':site_id' => $registry->get('GV_ServerName')
, ':value' => $row['value']
);
$stmt = $connsbas->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
$record = new \record_adapter($sbas_id, $row['value']);
$record->get_caption()->delete_data_from_cache();
foreach ($record->get_caption()->get_fields() as $field)
{
$field->delete_data_from_cache();
}
break; break;
case 'structure': case 'structure':
$cache_appbox->delete('list_bases'); $appbox->delete_data_from_cache(\appbox::CACHE_LIST_BASES);
$appbox->delete_data_from_cache(\appbox::CACHE_SBAS_IDS);
$sql = 'DELETE FROM memcached $sql = 'DELETE FROM memcached
WHERE site_id="' . $connsbas->escape_string($registry->get('GV_ServerName')) . '" WHERE site_id = :site_id AND type="structure" AND value = :value';
AND type="structure" AND value="' . $row['value'] . '"';
$connsbas->query($sql); $params = array(
':site_id' => $registry->get('GV_ServerName')
, ':value' => $row['value']
);
$stmt = $connsbas->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
break; break;
} }
} }
$connsbas->free_result($rs);
}
$date = new DateTime(); $date = new \DateTime();
$now = phraseadate::format_mysql($date); $now = $date->format(DATE_ISO8601);
$cache_appbox->set('memcached_update', $now);
$conn = connection::getInstance(); $appbox->set_data_to_cache($now, 'memcached_update_' . $sbas_id);
$sql = 'UPDATE sitepreff
SET memcached_update="' . $conn->escape_string($now) . '"';
$conn->query($sql);
return $this; $conn = \connection::getPDOConnection();
$sql = 'UPDATE sitepreff SET memcached_update = :date';
$stmt = $conn->prepare($sql);
$stmt->execute(array(':date' => $now));
$stmt->closeCursor();
return;
} }
/** /**
@@ -163,28 +146,57 @@ class cache_databox
* @param mixed content $value * @param mixed content $value
* @return Void * @return Void
*/ */
function update($sbas_id, $type, $value='') public static function update($sbas_id, $type, $value = '')
{ {
$connbas = connection::getPDOConnection($sbas_id); $connbas = \connection::getPDOConnection($sbas_id);
$registry = registry::get_instance(); $registry = \registry::get_instance();
$sql = 'SELECT distinct site_id as site_id $sql = 'SELECT distinct site_id as site_id
FROM clients FROM clients
WHERE site_id != :site_id'; WHERE site_id != :site_id';
$stmt = $connbas->prepare($sql); $stmt = $connbas->prepare($sql);
$stmt->execute(array(':site_id' => $registry->get('GV_ServerName'))); $stmt->execute(array(':site_id' => $registry->get('GV_ServerName')));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
$sql = 'REPLACE INTO memcached (site_id, type, value) $sql = 'REPLACE INTO memcached (site_id, type, value)
VALUES (:site_id, :type, :value)'; VALUES (:site_id, :type, :value)';
$stmt = $connbas->prepare($sql); $stmt = $connbas->prepare($sql);
foreach ($rs as $row) foreach ($rs as $row)
{ {
$stmt->execute(array(':site_id' => $row['site_id'], ':type' => $type, ':value' => $value)); $stmt->execute(array(':site_id' => $row['site_id'], ':type' => $type, ':value' => $value));
} }
$stmt->closeCursor();
return;
}
public static function insertClient(\databox $databox)
{
$connbas = $databox->get_connection();
$registry = \registry::get_instance();
$sql = 'SELECT site_id FROM clients WHERE site_id = :site_id';
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':site_id' => $registry->get('GV_ServerName')));
$rowCount = $stmt->rowCount();
$stmt->closeCursor();
if ($rowCount > 0)
{
return;
}
$sql = 'INSERT INTO clients (site_id) VALUES (:site_id)';
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':site_id' => $registry->get('GV_ServerName')));
$stmt->closeCursor(); $stmt->closeCursor();
return; return;

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();
@@ -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

@@ -171,7 +171,10 @@ class connection
public static function close_PDO_connection($name) public static function close_PDO_connection($name)
{ {
if (isset(self::$_PDO_instance[$name])) if (isset(self::$_PDO_instance[$name]))
{
self::$_PDO_instance[$name] = null;
unset(self::$_PDO_instance[$name]); unset(self::$_PDO_instance[$name]);
}
return; return;
} }

View File

@@ -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
@@ -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;
@@ -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();
@@ -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();

View File

@@ -160,8 +160,20 @@ class databox_status
$sbas_ids = $user->ACL()->get_granted_sbas(); $sbas_ids = $user->ACL()->get_granted_sbas();
$see_all = array();
foreach ($sbas_ids as $databox) foreach ($sbas_ids as $databox)
{ {
$see_all[$databox->get_sbas_id()] = false;
foreach($databox->get_collections() as $collection)
{
if($user->ACL()->has_right_on_base($collection->get_base_id(), 'chgstatus'))
{
$see_all[$databox->get_sbas_id()] = true;
break;
}
}
try try
{ {
$statuses[$databox->get_sbas_id()] = $databox->get_statusbits(); $statuses[$databox->get_sbas_id()] = $databox->get_statusbits();
@@ -177,15 +189,15 @@ class databox_status
foreach ($statuses as $sbas_id => $status) foreach ($statuses as $sbas_id => $status)
{ {
$see_all = false; $see_this = isset($see_all[$sbas_id]) ? $see_all[$sbas_id] : false;
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_all = true; $see_this = true;
foreach ($status as $bit => $props) foreach ($status as $bit => $props)
{ {
if ($props['searchable'] == 0 && !$see_all) if ($props['searchable'] == 0 && !$see_this)
continue; continue;
$set = false; $set = false;

View File

@@ -213,7 +213,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
function mail($to, $from, $datas) function mail($to, $from, $datas)
{ {
$subject = sprintf(_('admin::register: Inscription automatique sur %s') $subject = sprintf(_('admin::register: Inscription automatique sur %s')
, GV_homeTitle); , $this->registry->get('GV_homeTitle'));
$body = "<div>" . _('admin::register: un utilisateur s\'est inscrit') $body = "<div>" . _('admin::register: un utilisateur s\'est inscrit')
. "</div>\n"; . "</div>\n";

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']))
@@ -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,6 +286,7 @@ 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)

View File

@@ -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

@@ -143,6 +143,8 @@ class mail
public static function mail_confirm_registered($email) public static function mail_confirm_registered($email)
{ {
$registry = \registry::get_instance();
$subject = _('login::register: sujet email : confirmation de votre adresse email'); $subject = _('login::register: sujet email : confirmation de votre adresse email');
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n"; $body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";

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,6 +70,7 @@ 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);
} }
}); });

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(

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

@@ -546,7 +546,7 @@ class module_admin_route_users_edit
$user = User_adapter::getInstance(array_pop($users), appbox::get_instance()); $user = User_adapter::getInstance(array_pop($users), appbox::get_instance());
if ($user->is_template()) if ($user->is_template() || $user->is_special())
{ {
return $this; return $this;
} }

View File

@@ -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())
{ {

View File

@@ -46,7 +46,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
* *
* @var Array * @var Array
*/ */
protected $javascript_elements; protected $javascript_elements = array();
/** /**
* *
@@ -455,6 +455,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
} }
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

@@ -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;
} }

View File

@@ -252,6 +252,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
{ {
} }
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,6 +164,7 @@ 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();
@@ -182,6 +185,7 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
} }
} }
} }
return $tmp; return $tmp;
} }

View File

@@ -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)
@@ -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;
} }
@@ -1227,7 +1230,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$db_field = \databox_field::get_instance($this->get_databox(), $param['meta_struct_id']); $db_field = \databox_field::get_instance($this->get_databox(), $param['meta_struct_id']);
if ($db_field->is_readonly() === false && !$force_readonly) if ($db_field->is_readonly() === true && !$force_readonly)
{ {
continue; continue;
} }
@@ -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;
} }
@@ -1829,6 +1834,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
} }
$databox = $this->get_databox(); $databox = $this->get_databox();
\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));
} }
@@ -1887,6 +1894,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

@@ -295,7 +295,7 @@ class record_preview extends record_adapter
else else
{ {
$this->title .= sprintf( $this->title .= sprintf(
_('%s %d/%d '), $title, $this->get_number() . '/' . $this->total '%s %d/%d ', $title, $this->get_number(), $this->total
); );
} }
break; break;

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

@@ -353,7 +353,7 @@ class searchEngine_options implements Serializable
{ {
if (!is_null($min_date) && trim($min_date) !== '') if (!is_null($min_date) && trim($min_date) !== '')
{ {
$this->date_min = DateTime::createFromFormat('d/m/Y h:i:s', $min_date.' 00:00:00'); $this->date_min = DateTime::createFromFormat('d/m/Y H:i:s', $min_date.' 00:00:00');
} }
return $this; return $this;
@@ -377,7 +377,7 @@ class searchEngine_options implements Serializable
{ {
if (!is_null($max_date) && trim($max_date) !== '') if (!is_null($max_date) && trim($max_date) !== '')
{ {
$this->date_max = DateTime::createFromFormat('d/m/Y h:i:s', $max_date.' 23:59:59'); $this->date_max = DateTime::createFromFormat('d/m/Y H:i:s', $max_date.' 23:59:59');
} }
return $this; return $this;

View File

@@ -885,39 +885,30 @@ class set_export extends set_abstract
$buffer = array(); $buffer = array();
if ($sxe = simplexml_load_string($desc)) foreach ($record->get_caption()->get_fields() as $field)
{ {
$z = $sxe->xpath('/record/description'); if (($rights || !isset($restrict[$field->get_name()])))
if ($z && is_array($z))
{ {
foreach ($z[0] as $ki => $vi)
{
if (($rights || !isset($restrict[$ki])))
{
switch ($format) switch ($format)
{ {
case 'yaml': case 'yaml':
case 'yml': case 'yml':
$vi = trim($vi); $vi = $field->get_value();
if (ctype_digit($vi)) if (ctype_digit($vi))
$vi = (int) $vi; $vi = (int) $vi;
$buffer[trim($ki)] = $vi; $buffer[$field->get_name()] = $vi;
break; break;
case 'xml': case 'xml':
default: default:
$dom_el = $dom->createElement($ki); $dom_el = $dom->createElement($field->get_name());
$dom_el->appendChild($dom->createTextNode(trim($vi))); $dom_el->appendChild($dom->createTextNode($field->get_value(true)));
$dom_desc->appendChild($dom_el); $dom_desc->appendChild($dom_el);
break; break;
} }
} }
} }
}
}
$buffer = array('record' => array('description' => $buffer)); $buffer = array('record' => array('description' => $buffer));
@@ -1007,6 +998,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;
} }
} }

View File

@@ -19,9 +19,11 @@ use Symfony\Component\Console\Output\OutputInterface;
class task_Scheduler class task_Scheduler
{ {
const TASKDELAYTOQUIT = 60; const TASKDELAYTOQUIT = 60;
protected $output; protected $output;
protected static $connection;
protected function log($message) protected function log($message)
{ {
@@ -47,7 +49,12 @@ class task_Scheduler
{ {
require dirname(__FILE__) . '/../../../config/connexion.inc'; require dirname(__FILE__) . '/../../../config/connexion.inc';
return new connection_pdo('appbox', $hostname, $port, $user, $password, $dbname); if (!self::$connection)
{
self::$connection = new connection_pdo ('appbox', $hostname, $port, $user, $password, $dbname);
}
return self::$connection;
} }
public function run(OutputInterface $output = null, $log_tasks = true) public function run(OutputInterface $output = null, $log_tasks = true)
@@ -523,6 +530,7 @@ class task_Scheduler
{ {
$conn->close(); $conn->close();
unset($conn); unset($conn);
self::$connection = null;
$to_reopen = true; $to_reopen = true;
} }
sleep($sleeptime); sleep($sleeptime);

View File

@@ -150,6 +150,7 @@ class task_manager
closedir($hdir); closedir($hdir);
} }
} }
return $tasks; return $tasks;
} }
} }

View File

@@ -825,6 +825,19 @@ class task_period_archive extends task_abstract
$xp = new DOMXPath($dom); $xp = new DOMXPath($dom);
if(($sxDotPhrasea = @simplexml_load_file($path . '/.phrasea.xml')))
{
// on gere le magicfile
if(($magicfile = trim((string) ($sxDotPhrasea->magicfile))) != '')
{
$magicmethod = strtoupper($sxDotPhrasea->magicfile['method']);
if($magicmethod == 'LOCK' && file_exists($path . '/' . $magicfile))
return;
elseif($magicmethod == 'UNLOCK' && !file_exists($path . '/' . $magicfile))
return;
}
}
while(($file = $listFolder->read()) !== NULL) while(($file = $listFolder->read()) !== NULL)
{ {
if ($this->isIgnoredFile($file)) if ($this->isIgnoredFile($file))

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,6 +219,7 @@ 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 );
@@ -309,6 +311,7 @@ class task_period_outofdate extends task_abstract
$("#status"+fld).html(html); $("#status"+fld).html(html);
} }
}); });
return; return;
} }
@@ -682,6 +685,7 @@ class task_period_outofdate extends task_abstract
} }
$ret = ($nchanged > 0 ? $nchanged : 'NORECSTODO'); $ret = ($nchanged > 0 ? $nchanged : 'NORECSTODO');
return($ret); return($ret);
} }

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;
} }
@@ -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;
} }
} }

View File

@@ -366,6 +366,7 @@ class task_period_writemeta extends task_databoxAbstract
$this->log("\t" . $s); $this->log("\t" . $s);
} }
return $this; return $this;
} }

View File

@@ -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,6 +314,7 @@ 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;
} }
@@ -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,6 +355,7 @@ 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;
} }

View File

@@ -88,6 +88,7 @@ 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);
} }
@@ -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,6 +211,7 @@ class W3CFeedValidatorResponse
$string .= $name . "=>" . $detail . "\n"; $string .= $name . "=>" . $detail . "\n";
} }
} }
return $string; return $string;
} }
@@ -219,6 +222,7 @@ class W3CFeedValidatorResponse
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";
} }
@@ -229,6 +233,7 @@ class W3CFeedValidatorResponse
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;
} }
@@ -239,6 +244,7 @@ class W3CFeedValidatorResponse
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;
} }
@@ -286,6 +292,7 @@ class W3CFeedValidatorResponse
$warnings[] = $this->domNodeToArray($warning); $warnings[] = $this->domNodeToArray($warning);
} }
} }
return $warnings; return $warnings;
} }
@@ -305,6 +312,7 @@ class W3CFeedValidatorResponse
$errors[] = $this->domNodeToArray($error); $errors[] = $this->domNodeToArray($error);
} }
} }
return $errors; return $errors;
} }

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;
} }

View File

@@ -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;
} }
@@ -516,6 +517,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
unset($item_entries[$key]); //remove unset($item_entries[$key]); //remove
} }
}; };
return $remove; return $remove;
} }

View File

@@ -32,9 +32,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
/**
* @covers {className}::{origMethodName}
*/
public function testSet_locale() public function testSet_locale()
{ {
$locale = 'BABA'; $locale = 'BABA';
@@ -42,10 +39,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($locale, $this->object->get_locale()); $this->assertEquals($locale, $this->object->get_locale());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_locale().
*/
public function testGet_locale() public function testGet_locale()
{ {
$locale = null; $locale = null;
@@ -53,10 +46,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($locale, $this->object->get_locale()); $this->assertEquals($locale, $this->object->get_locale());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_sort().
*/
public function testSet_sort() public function testSet_sort()
{ {
$by = 'NAME'; $by = 'NAME';
@@ -69,10 +58,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(searchEngine_options::SORT_MODE_DESC, $this->object->get_sortord()); $this->assertEquals(searchEngine_options::SORT_MODE_DESC, $this->object->get_sortord());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_sortby().
*/
public function testGet_sortby() public function testGet_sortby()
{ {
$by = 'NAME'; $by = 'NAME';
@@ -82,10 +67,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($sort, $this->object->get_sortord()); $this->assertEquals($sort, $this->object->get_sortord());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_sortord().
*/
public function testGet_sortord() public function testGet_sortord()
{ {
$by = 'NAME'; $by = 'NAME';
@@ -95,10 +76,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($sort, $this->object->get_sortord()); $this->assertEquals($sort, $this->object->get_sortord());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_use_stemming().
*/
public function testSet_use_stemming() public function testSet_use_stemming()
{ {
$bool = true; $bool = true;
@@ -109,10 +86,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($bool, $this->object->get_use_stemming()); $this->assertEquals($bool, $this->object->get_use_stemming());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_use_stemming().
*/
public function testGet_use_stemming() public function testGet_use_stemming()
{ {
$bool = true; $bool = true;
@@ -123,10 +96,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($bool, $this->object->get_use_stemming()); $this->assertEquals($bool, $this->object->get_use_stemming());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_search_type().
*/
public function testSet_search_type() public function testSet_search_type()
{ {
$type = "caca"; $type = "caca";
@@ -140,10 +109,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type()); $this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_search_type().
*/
public function testGet_search_type() public function testGet_search_type()
{ {
$type = "caca"; $type = "caca";
@@ -157,10 +122,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type()); $this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type());
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_bases().
*/
public function testSet_bases() public function testSet_bases()
{ {
$bases = array_keys(self::$user->ACL()->get_granted_base()); $bases = array_keys(self::$user->ACL()->get_granted_base());
@@ -168,10 +129,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(array_values($bases), array_values($this->object->get_bases())); $this->assertEquals(array_values($bases), array_values($this->object->get_bases()));
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_bases().
*/
public function testGet_bases() public function testGet_bases()
{ {
$bases = array_keys(self::$user->ACL()->get_granted_base()); $bases = array_keys(self::$user->ACL()->get_granted_base());
@@ -179,10 +136,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(array_values($bases), array_values($this->object->get_bases())); $this->assertEquals(array_values($bases), array_values($this->object->get_bases()));
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_fields().
*/
public function testSet_fields() public function testSet_fields()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -191,10 +144,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_fields().
*/
public function testGet_fields() public function testGet_fields()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -203,10 +152,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_status().
*/
public function testSet_status() public function testSet_status()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -215,10 +160,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_status().
*/
public function testGet_status() public function testGet_status()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -227,10 +168,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_record_type().
*/
public function testSet_record_type() public function testSet_record_type()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -239,10 +176,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_record_type().
*/
public function testGet_record_type() public function testGet_record_type()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -251,10 +184,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_min_date().
*/
public function testSet_min_date() public function testSet_min_date()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -263,10 +192,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_min_date().
*/
public function testGet_min_date() public function testGet_min_date()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -275,10 +200,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_max_date().
*/
public function testSet_max_date() public function testSet_max_date()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -287,10 +208,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_max_date().
*/
public function testGet_max_date() public function testGet_max_date()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -299,10 +216,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_date_fields().
*/
public function testSet_date_fields() public function testSet_date_fields()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -311,10 +224,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_date_fields().
*/
public function testGet_date_fields() public function testGet_date_fields()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -323,10 +232,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
); );
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testSerialize().
*/
public function testSerialize() public function testSerialize()
{ {
$bases = array_keys(self::$user->ACL()->get_granted_base()); $bases = array_keys(self::$user->ACL()->get_granted_base());
@@ -343,10 +248,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($this->object, unserialize(serialize($this->object))); $this->assertEquals($this->object, unserialize(serialize($this->object)));
} }
/**
* @covers {className}::{origMethodName}
* @todo Implement testUnserialize().
*/
public function testUnserialize() public function testUnserialize()
{ {
// Remove the following lines when you implement this test. // Remove the following lines when you implement this test.
@@ -356,5 +257,3 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
} }
} }
?>

View File

@@ -15,5 +15,5 @@
* @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
*/ */
define('GV_version', '3.5.9.0'); define('GV_version', '3.5.10.0');
define('GV_version_name', 'Baobab'); define('GV_version_name', 'Baobab');

View File

@@ -351,6 +351,7 @@ foreach ($tasks as $t)
{ {
if(window.console) if(window.console)
console.log('No task like this'); console.log('No task like this');
return(false); return(false);
} }

View File

@@ -72,6 +72,7 @@ $qrySbas = array();
if (is_null($parm['bas'])) if (is_null($parm['bas']))
{ {
echo 'vous devez selectionner des collections dans lesquelles chercher'; echo 'vous devez selectionner des collections dans lesquelles chercher';
return; return;
} }

View File

@@ -102,7 +102,7 @@ if ($cssfile)
} }
?> ?>
</head> </head>
<body style="overflow:hidden;"> <body class="PNB" style="overflow:hidden;">
<div id="container" style="position:absolute;top:0;left:0;overflow:hidden;width:100%;height:100%;"> <div id="container" style="position:absolute;top:0;left:0;overflow:hidden;width:100%;height:100%;">
<?php <?php

View File

@@ -112,7 +112,7 @@ if ((!is_null($parm['login']) && !is_null($parm['pwd'])) || $is_guest)
return phrasea::redirect($url); return phrasea::redirect($url);
} }
catch (Exception $e) catch (\Exception $e)
{ {
return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=".$e->getMessage().$e->getFile().$e->getLine() ); return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=".$e->getMessage().$e->getFile().$e->getLine() );
} }
@@ -140,4 +140,3 @@ else
{ {
return phrasea::redirect("/login/"); return phrasea::redirect("/login/");
} }
?>

View File

@@ -46,7 +46,7 @@ catch(Exception_NotFound $e)
{ {
if (count($user->ACL()->get_granted_base()) > 0) if (count($user->ACL()->get_granted_base()) > 0)
{ {
mail::mail_confirm_registered($row['usr_mail']); mail::mail_confirm_registered($user->get_email());
} }
else else
{ {
@@ -58,7 +58,7 @@ catch(Exception_NotFound $e)
$others .= '<li>' . $collection->get_name() . "</li>\n"; $others .= '<li>' . $collection->get_name() . "</li>\n";
} }
mail::mail_confirm_unregistered($row['usr_mail'], $others); mail::mail_confirm_unregistered($user->get_email(), $others);
} }
} }

View File

@@ -69,9 +69,7 @@ $arrayVerif['form_email'] = true;
$lstreceiver = array(); $lstreceiver = array();
$parm = $request->get_parms("form_login", "form_password", "form_city", "form_password_confirm", $parm = $request->get_parms("form_login", "form_password", "form_city", "form_password_confirm", "form_gender", "form_lastname", "form_firstname", "form_email", "form_job", "form_company", 'demand', "form_activity", "form_phone", "form_fax", "form_address", "form_zip", "form_geonameid", "demand");
"form_gender", "form_lastname", "form_firstname", "form_email", "form_job", "form_company", 'demand',
"form_activity", "form_phone", "form_fax", "form_address", "form_zip", "form_geonameid", "demand");
/** /**
* @todo transactionner cette page * @todo transactionner cette page
@@ -186,7 +184,14 @@ if ($request->has_post_datas())
$template_user = User_Adapter::getInstance($template_user_id, appbox::get_instance()); $template_user = User_Adapter::getInstance($template_user_id, appbox::get_instance());
$user->ACL()->apply_model($template_user, array_keys($inscOK[$base_id])); $base_ids = array();
foreach ($inscOK as $base_id => $done)
{
$base_ids[] = $base_id;
}
$user->ACL()->apply_model($template_user, $base_ids);
} }
$autoReg = $user->ACL()->get_granted_base(); $autoReg = $user->ACL()->get_granted_base();
@@ -220,6 +225,7 @@ if ($request->has_post_datas())
if ($newUsrEmail) if ($newUsrEmail)
{ {
$user->set_mail_locked(true); $user->set_mail_locked(true);
return phrasea::redirect('/login/sendmail-confirm.php?usr_id=' . $newid); return phrasea::redirect('/login/sendmail-confirm.php?usr_id=' . $newid);
} }

View File

@@ -53,6 +53,7 @@ try
{ {
$record->set_original_name($_FILES["newHD"]["name"]); $record->set_original_name($_FILES["newHD"]["name"]);
} }
}
catch (Exception $e) catch (Exception $e)
{ {
echo '<center>', $e->getMessage(), '<br/><br/>'; echo '<center>', $e->getMessage(), '<br/><br/>';

View File

@@ -61,7 +61,7 @@ if ($parm["act"] == "START" || $parm["act"] == "WORK")
foreach ($lst as $basrec) foreach ($lst as $basrec)
{ {
$basrec = explode('_', $basrec); $basrec = explode('_', $basrec);
$record = new record_adapter($barec[0], $basrec[1]); $record = new record_adapter($basrec[0], $basrec[1]);
if ($record->is_grouping()) if ($record->is_grouping())
{ {

View File

@@ -281,7 +281,7 @@ function dropOnBask(event,from,destKey)
{ {
sselcont = []; sselcont = [];
lstbr = p4.sel.join(';'); lstbr = p4.sel.join(';');
if($(from).hasClass('.baskAdder')) if($(from).hasClass('baskAdder'))
lstbr = $(from).attr('id').split('_').slice(2,4).join('_'); lstbr = $(from).attr('id').split('_').slice(2,4).join('_');
} }
else else