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();
if (array_key_exists($key, $this->_rights_records_document))
return true;
return false;
@@ -188,6 +189,7 @@ class ACL implements cache_cacheableInterface
$key = $record->get_serialize_key();
if (array_key_exists($key, $this->_rights_records_preview))
return true;
return false;
@@ -241,6 +243,7 @@ class ACL implements cache_cacheableInterface
public function apply_model(User_Interface $template_user, Array $base_ids)
{
if (count($base_ids) == 0)
return $this;
$sbas_ids = array();
@@ -327,8 +330,16 @@ class ACL implements cache_cacheableInterface
// apply sb : unchecked boxes on template will be unchecked on user
// checked boxes on template does nothing (left unchanged on user)
// 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' => '');
for ($i = 0; $i < 64; $i++)
{
@@ -382,6 +393,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas();
if (!$this->has_access_to_base($base_id))
return false;
if ($this->is_limited($base_id))
@@ -469,6 +481,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas();
if (!$this->has_access_to_base($base_id))
return false;
return $this->_rights_bas[$base_id]['restrict_dwnld'];
@@ -485,6 +498,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas();
if (!$this->has_access_to_base($base_id))
return false;
return (int) $this->_rights_bas[$base_id]['remain_dwnld'];
@@ -502,6 +516,7 @@ class ACL implements cache_cacheableInterface
$this->load_rights_bas();
if (!$this->has_access_to_base($base_id))
return false;
$this->_rights_bas[$base_id]['remain_dwnld'] =
@@ -541,12 +556,14 @@ class ACL implements cache_cacheableInterface
$this->load_rights_sbas();
if (!isset($this->_rights_sbas[$sbas_id]))
return false;
if (!isset($this->_rights_sbas[$sbas_id][$right]))
throw new Exception('This right does not exists');
if ($this->_rights_sbas[$sbas_id][$right] === true)
return true;
return false;
@@ -562,6 +579,7 @@ class ACL implements cache_cacheableInterface
{
$this->load_rights_bas();
if (!$this->has_access_to_base($base_id))
return false;
return $this->_rights_bas[$base_id]['mask_and'];
@@ -577,6 +595,7 @@ class ACL implements cache_cacheableInterface
{
$this->load_rights_bas();
if (!$this->has_access_to_base($base_id))
return false;
return $this->_rights_bas[$base_id]['mask_xor'];
@@ -718,6 +737,7 @@ class ACL implements cache_cacheableInterface
{
if ($this->_rights_records_preview)
return $this;
try
@@ -771,6 +791,7 @@ class ACL implements cache_cacheableInterface
{
if ($this->_rights_sbas && $this->_global_rights)
return $this;
try
@@ -832,6 +853,7 @@ class ACL implements cache_cacheableInterface
protected function load_rights_bas()
{
if ($this->_rights_bas && $this->_global_rights && is_array($this->_limited))
return $this;
try
@@ -1335,6 +1357,7 @@ class ACL implements cache_cacheableInterface
$stmt->closeCursor();
if (!$row)
return $this;
$this->give_access_to_base(array($base_id_dest));
@@ -1501,6 +1524,7 @@ class ACL implements cache_cacheableInterface
{
$this->load_rights_bas();
if (!isset($this->_limited[$base_id]))
return null;
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);
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'));
$request = $app['request'];
@@ -121,23 +122,29 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
if (!$feed->is_owner($user))
return new Response('ERROR:you are not allowed');
if ($_FILES['Filedata']['error'] !== 0)
return new Response('ERROR:error while upload');
$file = new system_file($_FILES['Filedata']['tmp_name']);
if (!in_array($file->get_mime(), array('image/jpeg', 'image/jpg', 'image/gif')))
return new Response('ERROR:bad filetype');
if ($file->getSize() > 200000)
return new Response('ERROR:file too large');
$datas = $file->get_technical_datas();
if (!isset($datas[system_file::TC_DATAS_WIDTH]) || !isset($datas[system_file::TC_DATAS_HEIGHT]))
return new Response('ERROR:file is not square');
if ($datas[system_file::TC_DATAS_WIDTH] != $datas[system_file::TC_DATAS_HEIGHT])
return new Response('ERROR:file is not square');
$feed->set_icon($file);

View File

@@ -287,7 +287,7 @@ class Controller_Setup_Installer implements ControllerProviderInterface
$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);
}

View File

@@ -100,6 +100,7 @@ class DailymotionWithoutOauth2 extends Dailymotion
$this->timeout = null;
$result = json_decode($this->httpRequest($result['upload_url'], array('file' => '@' . $filePath)), true);
$this->timeout = $timeout;
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());
if (!in_array($medium, array('image', 'audio', 'video')))
return $this;
if (!$preview_permalink || !$thumbnail_permalink)
return $this;
//add item node to channel node

View File

@@ -395,6 +395,7 @@ class Session_Handler
foreach ($user->ACL()->get_granted_sbas() as $databox)
{
Session_Logger::create($databox, $browser, $this, $user);
\cache_databox::insertClient($databox);
}
$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)
{
if (is_null($email))
return false;
$conn = connection::getPDOConnection();
@@ -1277,7 +1278,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
protected function load_preferences()
{
if ($this->_prefs)
return $this;
$registry = \registry::get_instance();
$sql = 'SELECT prop, value FROM usr_settings WHERE usr_id= :id';
$stmt = $this->appbox->get_connection()->prepare($sql);
$stmt->execute(array(':id' => $this->id));
@@ -1293,6 +1298,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
{
if (!isset($this->_prefs[$k]))
{
if($k == 'start_page_query' && $registry->get('GV_defaultQuery'))
{
$v = $registry->get('GV_defaultQuery');
}
$this->_prefs[$k] = $v;
$this->update_pref($k, $v);
}
@@ -1565,6 +1575,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
{
$this->load_preferences();
if (isset($this->_prefs[$prop]) && $this->_prefs[$prop] === $value)
return $value;
$ok = true;
@@ -1602,6 +1613,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
$appbox = appbox::get_instance();
$session = $appbox->get_session();
if (!$session->is_authenticated())
return;
$ses_id = $session->get_ses_id();
@@ -1876,6 +1888,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_nonce()
{
if ($this->nonce)
return $this->nonce;
$nonce = false;

View File

@@ -489,6 +489,7 @@ class User_Query implements User_QueryInterface
public function get_total()
{
if ($this->total)
return $this->total;
$conn = $this->appbox->get_connection();
@@ -637,6 +638,7 @@ class User_Query implements User_QueryInterface
public function on_base_ids(Array $base_ids = null)
{
if (!$base_ids)
return $this;
$this->bases_restrictions = true;
@@ -661,6 +663,7 @@ class User_Query implements User_QueryInterface
public function on_sbas_ids(Array $sbas_ids = null)
{
if (!$sbas_ids)
return $this;
$this->sbas_restrictions = true;

View File

@@ -180,6 +180,12 @@ abstract class base implements cache_cacheableInterface
*/
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));
}

View File

@@ -327,6 +327,7 @@ class basket_adapter implements cache_cacheableInterface
public function get_first_element()
{
foreach ($this->get_elements() as $basket_element)
return $basket_element;
return null;
}
@@ -338,6 +339,7 @@ class basket_adapter implements cache_cacheableInterface
public function get_validation_end_date()
{
if (!$this->valid || !$this->validation_end_date)
return null;
return $this->validation_end_date;
}
@@ -349,6 +351,7 @@ class basket_adapter implements cache_cacheableInterface
public function is_validation_finished()
{
if (!$this->valid || !$this->validation_end_date)
return null;
$now = new DateTime();
@@ -362,6 +365,7 @@ class basket_adapter implements cache_cacheableInterface
public function is_confirmed()
{
if (!$this->valid)
return null;
return $this->validation_is_confirmed;
@@ -370,14 +374,17 @@ class basket_adapter implements cache_cacheableInterface
public function is_releasable()
{
if (!$this->valid)
return false;
if ($this->is_confirmed())
return false;
foreach ($this->get_elements() as $element)
{
if ($element->get_my_agreement() == '0')
return false;
}
@@ -585,6 +592,7 @@ class basket_adapter implements cache_cacheableInterface
public function sort($order)
{
if (!$this->valid || !in_array($order, array('asc', 'desc')))
return;
$this->load_elements();
@@ -1016,6 +1024,7 @@ class basket_adapter implements cache_cacheableInterface
public function set_read()
{
if (!$this->noview)
return true;
$session = $this->appbox->get_session();
@@ -1131,15 +1140,19 @@ class basket_adapter implements cache_cacheableInterface
if ($this->is_mine)
{
if ($this->is_validation_finished())
return sprintf(_('Vous aviez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1));
else
return sprintf(_('Vous avez envoye cette demande a %d utilisateurs'), (count($this->validating_users) - 1));
}
else
{
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));
else
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()
{
if (!is_null($this->elements))
return;
$this->elements = array();
@@ -1525,11 +1539,14 @@ class basket_adapter implements cache_cacheableInterface
public function remove_from_ssel($sselcont_id)
{
if (!$this->is_mine)
return array('error' => 'error', 'status' => 0);
if ($this->is_grouping)
return $this->remove_grouping_elements($sselcont_id);
else
return $this->remove_basket_elements($sselcont_id);
}

View File

@@ -18,142 +18,125 @@
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
* @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)
$last_update = new DateTime($last_update);
$last_update = new \DateTime($last_update);
else
$last_update = new DateTime('-10 years');
$last_update = new \DateTime('-10 years');
if ($date <= $last_update || !$cache_appbox->is_ok())
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))
if ($date <= $last_update || !$appbox->get_cache()->ping())
{
$cache_thumbnail = cache_thumbnail::getInstance();
$cache_preview = cache_preview::getInstance();
while ($row = $connsbas->fetch_assoc($rs))
return;
}
$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'])
{
case 'record':
$cache_thumbnail->delete($sbas_id, $row['value'], false);
$cache_preview->delete($sbas_id, $row['value'], false);
$key = 'record_' . $sbas_id . '_' . $row['value'];
$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
WHERE site_id="' . $connsbas->escape_string($registry->get('GV_ServerName')) . '"
AND type="record" AND value="' . $row['value'] . '"';
$connsbas->query($sql);
WHERE site_id = :site_id AND type="record" AND value = :value';
$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;
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
WHERE site_id="' . $connsbas->escape_string($registry->get('GV_ServerName')) . '"
AND type="structure" AND value="' . $row['value'] . '"';
$connsbas->query($sql);
WHERE site_id = :site_id AND type="structure" AND value = :value';
$params = array(
':site_id' => $registry->get('GV_ServerName')
, ':value' => $row['value']
);
$stmt = $connsbas->prepare($sql);
$stmt->execute($params);
$stmt->closeCursor();
break;
}
}
$connsbas->free_result($rs);
}
$date = new DateTime();
$now = phraseadate::format_mysql($date);
$cache_appbox->set('memcached_update', $now);
$date = new \DateTime();
$now = $date->format(DATE_ISO8601);
$conn = connection::getInstance();
$sql = 'UPDATE sitepreff
SET memcached_update="' . $conn->escape_string($now) . '"';
$conn->query($sql);
$appbox->set_data_to_cache($now, 'memcached_update_' . $sbas_id);
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
* @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
FROM clients
WHERE site_id != :site_id';
$stmt = $connbas->prepare($sql);
$stmt->execute(array(':site_id' => $registry->get('GV_ServerName')));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
$sql = 'REPLACE INTO memcached (site_id, type, value)
VALUES (:site_id, :type, :value)';
$stmt = $connbas->prepare($sql);
foreach ($rs as $row)
{
$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();
return;

View File

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

View File

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

View File

@@ -451,6 +451,7 @@ class databox extends base
$stmt->closeCursor();
if ($row)
return self::get_instance((int) $row['sbas_id']);
try
@@ -575,6 +576,7 @@ class databox extends base
public function get_meta_structure()
{
if ($this->meta_struct)
return $this->meta_struct;
try
@@ -697,6 +699,7 @@ class databox extends base
}
}
if ($n > $limit)
return true;
return false;
@@ -1220,6 +1223,7 @@ class databox extends base
public function get_structure()
{
if ($this->structure)
return $this->structure;
$this->structure = $this->retrieve_structure();
@@ -1260,6 +1264,7 @@ class databox extends base
public function get_cterms()
{
if ($this->cterms)
return $this->cterms;
$sql = "SELECT value FROM pref WHERE prop='cterms'";
@@ -1426,6 +1431,7 @@ class databox extends base
public function get_cgus()
{
if ($this->cgus)
return $this->cgus;
$this->load_cgus();

View File

@@ -160,8 +160,20 @@ class databox_status
$sbas_ids = $user->ACL()->get_granted_sbas();
$see_all = array();
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
{
$statuses[$databox->get_sbas_id()] = $databox->get_statusbits();
@@ -177,15 +189,15 @@ class databox_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'))
$see_all = true;
$see_this = true;
foreach ($status as $bit => $props)
{
if ($props['searchable'] == 0 && !$see_all)
if ($props['searchable'] == 0 && !$see_this)
continue;
$set = false;

View File

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

View File

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

View File

@@ -94,6 +94,7 @@ class geonames
$cityName = self::clean_input($cityName);
if (strlen($cityName) === 0)
return $output;
$registry = registry::get_instance();
@@ -134,6 +135,7 @@ class geonames
public function find_geoname_from_ip($ip)
{
if (array_key_exists($ip, $this->cache_ips))
return $this->cache_ips[$ip];
$output = array(

View File

@@ -143,6 +143,8 @@ class mail
public static function mail_confirm_registered($email)
{
$registry = \registry::get_instance();
$subject = _('login::register: sujet email : confirmation de votre adresse email');
$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();
if (!$browser->isMobile())
return new Response('');
$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/error.twig', $params), 200);
}
});

View File

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

View File

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

View File

@@ -77,6 +77,7 @@ class module_admin
);
$twig = new supertwig();
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());
if ($user->is_template())
if ($user->is_template() || $user->is_special())
{
return $this;
}

View File

@@ -121,6 +121,7 @@ $parseRoute = function ($route, Response $response)
}
}
}
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());
if ($session->is_authenticated())
return;
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
*/
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')))
return $this;
$sbas_id = (int) $request->get('sbid');

View File

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

View File

@@ -1112,6 +1112,7 @@ class module_report_activity extends module_report
$date = new DateTime($row['ddate']);
$result[$date->format(DATE_ATOM)] = $row['activity'];
}
return $result;
}

View File

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

View File

@@ -252,6 +252,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
{
}
return;
}

View File

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

View File

@@ -617,6 +617,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
throw new Exception_Media_SubdefNotFound ();
if (isset($this->subdefs[$name]))
return $this->subdefs[$name];
if (!$this->subdefs)
@@ -756,8 +757,10 @@ class record_adapter implements record_Interface, cache_cacheableInterface
if ($data)
{
if (isset($this->technical_datas[$data]))
return $this->technical_datas[$data];
else
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']);
if ($db_field->is_readonly() === false && !$force_readonly)
if ($db_field->is_readonly() === true && !$force_readonly)
{
continue;
}
@@ -1355,6 +1358,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_reg_name()
{
if (!$this->is_grouping())
return false;
$balisename = '';
@@ -1551,6 +1555,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
{
$hd = $this->get_subdef('document');
if ($hd->is_physically_present())
return new system_file(p4string::addEndSlash($hd->get_path()) . $hd->get_file());
return null;
}
@@ -1829,6 +1834,8 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
$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));
}
@@ -1887,6 +1894,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_container_baskets()
{
if ($this->container_basket)
return $this->container_basket;
$appbox = appbox::get_instance();

View File

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

View File

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

View File

@@ -353,7 +353,7 @@ class searchEngine_options implements Serializable
{
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;
@@ -377,7 +377,7 @@ class searchEngine_options implements Serializable
{
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;

View File

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

View File

@@ -19,9 +19,11 @@ use Symfony\Component\Console\Output\OutputInterface;
class task_Scheduler
{
const TASKDELAYTOQUIT = 60;
protected $output;
protected static $connection;
protected function log($message)
{
@@ -47,7 +49,12 @@ class task_Scheduler
{
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)
@@ -523,6 +530,7 @@ class task_Scheduler
{
$conn->close();
unset($conn);
self::$connection = null;
$to_reopen = true;
}
sleep($sleeptime);

View File

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

View File

@@ -825,6 +825,19 @@ class task_period_archive extends task_abstract
$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)
{
if ($this->isIgnoredFile($file))

View File

@@ -162,6 +162,7 @@ class task_period_outofdate extends task_abstract
parent.calcSQL();
</script>
<?php
return("");
}
else // ... so we NEVER come here
@@ -218,6 +219,7 @@ class task_period_outofdate extends task_abstract
jQuery.map($(this).serializeArray(), function(n, i){
json[n['name']] = n['value'];
});
return json;
};
})( jQuery );
@@ -309,6 +311,7 @@ class task_period_outofdate extends task_abstract
$("#status"+fld).html(html);
}
});
return;
}
@@ -682,6 +685,7 @@ class task_period_outofdate extends task_abstract
}
$ret = ($nchanged > 0 ? $nchanged : 'NORECSTODO');
return($ret);
}

View File

@@ -68,6 +68,7 @@ class task_period_upgradetov32 extends task_abstract
{
printf("sbas_id '" . $this->sbas_id . "' invalide\n");
$this->return_value = self::RETURNSTATUS_STOPPED;
return;
}
@@ -369,11 +370,13 @@ class task_period_upgradetov32 extends task_abstract
if ($n_done >= 5000)
{
$this->return_value = task_abstract::RETURNSTATUS_TORESTART;
return;
}
if ($memory > 100)
{
$this->return_value = task_abstract::RETURNSTATUS_TORESTART;
return;
}
}

View File

@@ -366,6 +366,7 @@ class task_period_writemeta extends task_databoxAbstract
$this->log("\t" . $s);
}
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->id = $element_id;
$element->type = $object;
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->id = $element_id;
$container->type = $object;
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());
$i++;
}
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());
$i++;
}
return $container_collection;
}

View File

@@ -88,6 +88,7 @@ class W3CFeedUrlValidator extends W3CFeedValidator
{
throw new W3CFeedValidatorException("Unable to request W3C API");
}
return new W3CFeedValidatorResponse($response);
}
@@ -151,6 +152,7 @@ class W3CFeedRawValidator extends W3CFeedValidator
{
throw new W3CFeedValidatorException("Unable to request W3C API");
}
return new W3CFeedValidatorResponse($response);
}
@@ -209,6 +211,7 @@ class W3CFeedValidatorResponse
$string .= $name . "=>" . $detail . "\n";
}
}
return $string;
}
@@ -219,6 +222,7 @@ class W3CFeedValidatorResponse
public function isValid()
{
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:validity";
return $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== "false";
}
@@ -229,6 +233,7 @@ class W3CFeedValidatorResponse
public function hasError()
{
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:errors/m:errorcount";
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
}
@@ -239,6 +244,7 @@ class W3CFeedValidatorResponse
public function hasWarning()
{
$xPathQuery = "/env:Envelope/env:Body/m:feedvalidationresponse/m:warnings/m:warningcount";
return (int) $this->DOMXpath->query($xPathQuery)->item(0)->nodeValue !== 0;
}
@@ -286,6 +292,7 @@ class W3CFeedValidatorResponse
$warnings[] = $this->domNodeToArray($warning);
}
}
return $warnings;
}
@@ -305,6 +312,7 @@ class W3CFeedValidatorResponse
$errors[] = $this->domNodeToArray($error);
}
}
return $errors;
}

View File

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

View File

@@ -331,6 +331,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
{
$current_attributes[$attribute->name] = $attribute->value;
}
return $current_attributes;
}
@@ -516,6 +517,7 @@ class Module_RssFeedTest extends PhraseanetWebTestCaseAbstract
unset($item_entries[$key]); //remove
}
};
return $remove;
}

View File

@@ -32,9 +32,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
}
/**
* @covers {className}::{origMethodName}
*/
public function testSet_locale()
{
$locale = 'BABA';
@@ -42,10 +39,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($locale, $this->object->get_locale());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_locale().
*/
public function testGet_locale()
{
$locale = null;
@@ -53,10 +46,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($locale, $this->object->get_locale());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_sort().
*/
public function testSet_sort()
{
$by = 'NAME';
@@ -69,10 +58,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(searchEngine_options::SORT_MODE_DESC, $this->object->get_sortord());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_sortby().
*/
public function testGet_sortby()
{
$by = 'NAME';
@@ -82,10 +67,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($sort, $this->object->get_sortord());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_sortord().
*/
public function testGet_sortord()
{
$by = 'NAME';
@@ -95,10 +76,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($sort, $this->object->get_sortord());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_use_stemming().
*/
public function testSet_use_stemming()
{
$bool = true;
@@ -109,10 +86,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($bool, $this->object->get_use_stemming());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_use_stemming().
*/
public function testGet_use_stemming()
{
$bool = true;
@@ -123,10 +96,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals($bool, $this->object->get_use_stemming());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_search_type().
*/
public function testSet_search_type()
{
$type = "caca";
@@ -140,10 +109,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_search_type().
*/
public function testGet_search_type()
{
$type = "caca";
@@ -157,10 +122,6 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
$this->assertEquals(searchEngine_options::RECORD_GROUPING, $this->object->get_search_type());
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_bases().
*/
public function testSet_bases()
{
$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()));
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testGet_bases().
*/
public function testGet_bases()
{
$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()));
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testSet_fields().
*/
public function testSet_fields()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
// 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()
{
$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)));
}
/**
* @covers {className}::{origMethodName}
* @todo Implement testUnserialize().
*/
public function testUnserialize()
{
// 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
* @link www.phraseanet.com
*/
define('GV_version', '3.5.9.0');
define('GV_version', '3.5.10.0');
define('GV_version_name', 'Baobab');

View File

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

View File

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

View File

@@ -102,7 +102,7 @@ if ($cssfile)
}
?>
</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%;">
<?php

View File

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

View File

@@ -46,7 +46,7 @@ catch(Exception_NotFound $e)
{
if (count($user->ACL()->get_granted_base()) > 0)
{
mail::mail_confirm_registered($row['usr_mail']);
mail::mail_confirm_registered($user->get_email());
}
else
{
@@ -58,7 +58,7 @@ catch(Exception_NotFound $e)
$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();
$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");
$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");
/**
* @todo transactionner cette page
@@ -186,7 +184,14 @@ if ($request->has_post_datas())
$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();
@@ -220,6 +225,7 @@ if ($request->has_post_datas())
if ($newUsrEmail)
{
$user->set_mail_locked(true);
return phrasea::redirect('/login/sendmail-confirm.php?usr_id=' . $newid);
}

View File

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

View File

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

View File

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