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'];
@@ -620,21 +639,21 @@ class ACL implements cache_cacheableInterface
{
$this->load_rights_bas();
$ret = array();
foreach($this->appbox->get_databoxes() as $databox)
{
if ($sbas_ids && !in_array($databox->get_sbas_id(), $sbas_ids))
{
continue;
}
foreach ($databox->get_collections() as $collection)
{
$continue = false;
if(!array_key_exists($collection->get_base_id(), $this->_rights_bas))
continue;
$base_id = $collection->get_base_id();
$datas = $this->_rights_bas[$base_id];
@@ -702,7 +721,7 @@ class ACL implements cache_cacheableInterface
}
catch (Exception $e)
{
}
}
@@ -718,6 +737,7 @@ class ACL implements cache_cacheableInterface
{
if ($this->_rights_records_preview)
return $this;
try
@@ -730,7 +750,7 @@ class ACL implements cache_cacheableInterface
}
catch (Exception $e)
{
}
$sql = 'SELECT sbas_id, record_id, preview, document
FROM records_rights WHERE usr_id = :usr_id';
@@ -771,6 +791,7 @@ class ACL implements cache_cacheableInterface
{
if ($this->_rights_sbas && $this->_global_rights)
return $this;
try
@@ -782,7 +803,7 @@ class ACL implements cache_cacheableInterface
}
catch (Exception $e)
{
}
$sql = 'SELECT sbasusr.* FROM sbasusr, sbas
@@ -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
@@ -844,7 +866,7 @@ class ACL implements cache_cacheableInterface
}
catch (Exception $e)
{
}
$sql = 'SELECT u.* FROM basusr u, bas b, sbas s
@@ -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]);
}
@@ -1509,18 +1533,18 @@ class ACL implements cache_cacheableInterface
{
if ($limit)
{
$sql = 'UPDATE basusr
$sql = 'UPDATE basusr
SET time_limited = 1
, limited_from = :limited_from
, limited_to = :limited_to
, limited_from = :limited_from
, limited_to = :limited_to
WHERE base_id = :base_id AND usr_id = :usr_id';
}
else
{
$sql = 'UPDATE basusr
$sql = 'UPDATE basusr
SET time_limited = 0
, limited_from = :limited_from
, limited_to = :limited_to
, limited_from = :limited_from
, limited_to = :limited_to
WHERE base_id = :base_id AND usr_id = :usr_id';
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -54,7 +54,7 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$request = $app['request'];
$feed = Feed_Adapter::create($appbox, $user, $request->get('title'), $request->get('subtitle'));
if($request->get('public') == '1')
$feed->set_public (true);
elseif ($request->get('base_id'))
@@ -93,6 +93,7 @@ class Controller_Admin_Publications implements ControllerProviderInterface
$user = User_Adapter::getInstance($appbox->get_session()->get_usr_id(), $appbox);
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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,12 +10,12 @@
*/
/**
*
*
* @package Exception
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class Exception_Setup_FixBadEmailAddresses extends Exception
{
}
}

View File

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

View File

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

View File

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

View File

@@ -370,9 +370,11 @@ class Feed_XML_Cooliris extends Feed_XML_Abstract implements Feed_XML_Interface
$medium = strtolower($content->get_record()->get_type());
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

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

View File

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

View File

@@ -907,6 +907,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public static function get_usr_id_from_email($email)
{
if (is_null($email))
return false;
$conn = connection::getPDOConnection();
@@ -1255,7 +1256,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
public function get_applied_template()
{
return $this->applied_template;
}
@@ -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);
}
@@ -1370,7 +1380,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return $this;
@@ -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();
@@ -1660,7 +1672,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
}
}
@@ -1724,7 +1736,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return false;
@@ -1810,7 +1822,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return $locale;
@@ -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

@@ -269,7 +269,7 @@ class User_Query implements User_QueryInterface
$extra = $this->include_phantoms ? ' OR sbas_id IS NULL ' : '';
$not_sbas_id = array_diff($this->active_sbas, $this->sbas_ids);
if (count($not_sbas_id) > 0 && count($not_sbas_id) < count($this->sbas_ids))
{
$sql .= sprintf(' AND ((sbas_id != %s ) ' . $extra . ')'
@@ -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

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

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;
}
@@ -477,7 +484,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
$sql = 'SELECT s.pushFrom, n.id as noview, s.usr_id as owner, s.rid
@@ -542,7 +549,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
}
@@ -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();
@@ -630,7 +638,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception_Record_AdapterNotFound $e)
{
}
catch (Exception $e)
{
@@ -745,7 +753,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
}
@@ -900,7 +908,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
}
}
@@ -1016,6 +1024,7 @@ class basket_adapter implements cache_cacheableInterface
public function set_read()
{
if (!$this->noview)
return true;
$session = $this->appbox->get_session();
@@ -1075,7 +1084,7 @@ class basket_adapter implements cache_cacheableInterface
foreach ($this->get_elements() as $basket_element)
{
$basket_element->validate($me, $user, $insert_id, $can_hd);
if ($can_hd && $me->ACL()->has_hd_grant($basket_element->get_record()))
$user->ACL()->grant_hd_on($basket_element->get_record(), $me, 'validate');
else
@@ -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();
@@ -1274,7 +1288,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
}
@@ -1372,7 +1386,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
return array('error' => true, 'status' => 0);
@@ -1412,7 +1426,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
$ret = array('error' => false, 'status' => 0);
@@ -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);
}
@@ -1869,7 +1886,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
return $appbox->delete_data_from_cache($ssel_ids);
@@ -1897,7 +1914,7 @@ class basket_adapter implements cache_cacheableInterface
}
catch (Exception $e)
{
}
$sql = 'SELECT id, usr_id, confirmed, can_agree, can_see_others

View File

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

View File

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

View File

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

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');
$cache_appbox = cache_appbox::getInstance();
$last_update = $cache_appbox->get('memcached_update');
if ($last_update)
$last_update = new DateTime($last_update);
else
$last_update = new DateTime('-10 years');
$appbox = \appbox::get_instance();
if ($date <= $last_update || !$cache_appbox->is_ok())
$registry = \registry::get_instance();
return $this;
$last_update = null;
$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))
try
{
$cache_thumbnail = cache_thumbnail::getInstance();
$cache_preview = cache_preview::getInstance();
while ($row = $connsbas->fetch_assoc($rs))
{
switch ($row['type'])
{
case 'record':
$cache_thumbnail->delete($sbas_id, $row['value'], false);
$cache_preview->delete($sbas_id, $row['value'], false);
$sql = 'DELETE FROM memcached
WHERE site_id="' . $connsbas->escape_string($registry->get('GV_ServerName')) . '"
AND type="record" AND value="' . $row['value'] . '"';
$connsbas->query($sql);
break;
case 'structure':
$cache_appbox->delete('list_bases');
$sql = 'DELETE FROM memcached
WHERE site_id="' . $connsbas->escape_string($registry->get('GV_ServerName')) . '"
AND type="structure" AND value="' . $row['value'] . '"';
$connsbas->query($sql);
break;
}
}
$connsbas->free_result($rs);
$last_update = $appbox->get_data_from_cache('memcached_update_' . $sbas_id);
}
catch (\Exception $e)
{
}
$date = new DateTime();
$now = phraseadate::format_mysql($date);
$cache_appbox->set('memcached_update', $now);
if ($last_update)
$last_update = new \DateTime($last_update);
else
$last_update = new \DateTime('-10 years');
$conn = connection::getInstance();
$sql = 'UPDATE sitepreff
SET memcached_update="' . $conn->escape_string($now) . '"';
$conn->query($sql);
if ($date <= $last_update || !$appbox->get_cache()->ping())
{
return;
}
return $this;
$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':
$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 = :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':
$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 = :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;
}
}
$date = new \DateTime();
$now = $date->format(DATE_ISO8601);
$appbox->set_data_to_cache($now, 'memcached_update_' . $sbas_id);
$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->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

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

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();
@@ -96,7 +97,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
}
$this->fields = $rec_fields;
@@ -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

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

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

@@ -142,7 +142,7 @@ class databox extends base
}
catch (Exception $e)
{
}
}
@@ -157,7 +157,7 @@ class databox extends base
}
catch (Exception $e)
{
}
$conn = connection::getPDOConnection();
@@ -451,6 +451,7 @@ class databox extends base
$stmt->closeCursor();
if ($row)
return self::get_instance((int) $row['sbas_id']);
try
@@ -463,7 +464,7 @@ class databox extends base
}
catch (Exception $e)
{
}
$sql = 'USE `' . $dbname . '`';
@@ -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;
@@ -986,7 +989,7 @@ class databox extends base
}
catch (Exception $e)
{
}
if (isset($field['regname']))
@@ -1220,6 +1223,7 @@ class databox extends base
public function get_structure()
{
if ($this->structure)
return $this->structure;
$this->structure = $this->retrieve_structure();
@@ -1234,7 +1238,7 @@ class databox extends base
}
catch (Exception $e)
{
}
$structure = null;
@@ -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();
@@ -1443,7 +1449,7 @@ class databox extends base
}
catch (Exception $e)
{
}
$sql = 'SELECT value, locale, updated_on FROM pref WHERE prop ="ToU"';

View File

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

View File

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

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;
@@ -479,7 +491,7 @@ class databox_status
$conn = connection::getPDOConnection();
$status = '0';
if(substr($stat1, 0, 2) === '0x')
{
$stat1 = self::hex2bin(substr($stat1, 2));
@@ -518,7 +530,7 @@ class databox_status
{
$stat2 = self::hex2bin(substr($stat2, 2));
}
$sql = 'select bin(0b' . trim($stat1) . ' & ~0b' . trim($stat2) . ') as result';
$stmt = $conn->prepare($sql);
@@ -548,7 +560,7 @@ class databox_status
{
$stat2 = self::hex2bin(substr($stat2, 2));
}
$sql = 'select bin(0b' . trim($stat1) . ' | 0b' . trim($stat2) . ') as result';
$stmt = $conn->prepare($sql);
@@ -567,12 +579,12 @@ class databox_status
public static function dec2bin($status)
{
$status = (string) $status;
if(!ctype_digit($status))
{
throw new \Exception('Non-decimal value');
}
$conn = connection::getPDOConnection();
$sql = 'select bin(' . $status . ') as result';
@@ -583,7 +595,7 @@ class databox_status
$stmt->closeCursor();
$status = '0';
if ($row)
{
$status = $row['result'];
@@ -599,12 +611,12 @@ class databox_status
{
$status = substr($status, 2);
}
if(!ctype_xdigit($status))
{
throw new \Exception('Non-hexadecimal value');
}
$conn = connection::getPDOConnection();
$sql = 'select BIN( CAST( 0x'.trim($status).' AS UNSIGNED ) ) as result';
@@ -615,7 +627,7 @@ class databox_status
$stmt->closeCursor();
$status = '0';
if ($row)
{
$status = $row['result'];

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']))
@@ -104,7 +105,7 @@ class gatekeeper
}
catch (Exception $e)
{
}
}
@@ -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,11 +286,12 @@ class gatekeeper
try
{
$datas = random::helloToken($parm['LOG']);
return phrasea::redirect("/lightbox/validate/" . $datas['datas'] . "/");
}
catch (Exception_NotFound $e)
{
}
return $this;

View File

@@ -33,7 +33,7 @@ class geonames
{
return '';
}
$registry = registry::get_instance();
$url = $registry->get('GV_i18n_service', 'http://localization.webservice.alchemyasp.com/')
. 'get_name.php?geonameid='
@@ -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

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

View File

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

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

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

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

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(
@@ -77,4 +80,4 @@ return call_user_func(function()
});
return $app;
});
});

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -75,7 +75,7 @@ class module_prod
else
$dates[$name] = array('sbas' => array($sbas_id), 'fieldname' => $name);
}
if (isset($fields[$name]))
{
$fields[$name]['sbas'][] = $sbas_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();
/**
*
@@ -244,7 +244,7 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
}
catch (Exception $e)
{
}
$_lst[$indice]['type'] = $record->get_type();
}
@@ -450,11 +450,12 @@ class module_prod_route_records_edit extends module_prod_route_records_abstract
}
catch (Exception $e)
{
}
}
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

@@ -935,7 +935,7 @@ class module_report_activity extends module_report
AND (" . $collfilter['sql'] . ")
GROUP by ddate
ORDER BY ddate ASC";
$stmt = $conn->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -951,7 +951,7 @@ class module_report_activity extends module_report
{
$res[$key] = number_format($act, 2, '.', '');
}
return $res;
}
@@ -1102,7 +1102,7 @@ class module_report_activity extends module_report
AND (" . $collfilter['sql'] . ")
GROUP BY ddate
ORDER BY activity ASC ";
$stmt = $conn->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
@@ -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;
}
@@ -348,11 +350,11 @@ class module_report_dashboard implements module_report_dashboard_componentInterf
}
catch (Exception $e)
{
}
$i++;
}
return;
}

View File

@@ -75,9 +75,9 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
}
catch (Exception $e)
{
}
$tmp = new self($sbasid, $sbas_coll, $dmin, $dmax);
$appbox->set_data_to_cache($tmp, $cache_id);
@@ -131,7 +131,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
* @return <void>
*/
public function process()
{
{
try
{
//Get number of DLs
@@ -250,8 +250,9 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
}
catch(PDOException $e)
{
}
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,10 +164,11 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
public function getTop($nbtop)
{
if (!is_int($nbtop))
return array();
$tmp = array();
if ($this->isValid())
{
foreach ($this->arraySorted as $k => $v)
@@ -182,6 +185,7 @@ class module_report_dashboard_sort implements module_report_dashboard_componentI
}
}
}
return $tmp;
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -180,7 +180,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
$connbas = $this->databox->get_connection();
@@ -530,7 +530,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
return null;
@@ -580,7 +580,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
$sql = 'SELECT BIN(status) as status FROM record
WHERE record_id = :record_id';
@@ -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)
@@ -657,7 +658,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
$connbas = $this->get_databox()->get_connection();
@@ -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;
}
@@ -860,7 +863,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
);
}
$sql = 'UPDATE record
$sql = 'UPDATE record
SET originalname = :originalname WHERE record_id = :record_id';
$params = array(
@@ -1114,7 +1117,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
$this->delete_data_from_cache(self::CACHE_SUBDEFS);
@@ -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;
}
@@ -1340,7 +1343,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
$this->delete_data_from_cache(self::CACHE_STATUS);
@@ -1355,6 +1358,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
public function get_reg_name()
{
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;
}
@@ -1773,7 +1778,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
$this->delete_data_from_cache(self::CACHE_SUBDEFS);
}
@@ -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));
}
@@ -1867,7 +1874,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
}
catch (Exception $e)
{
}
}
@@ -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

@@ -86,7 +86,7 @@ class record_preview extends record_adapter
* @param boolean $reload_train
* @return record_preview
*/
public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine =null, $query='')
public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine = null, $query = '')
{
$appbox = appbox::get_instance();
$number = null;
@@ -95,7 +95,7 @@ class record_preview extends record_adapter
switch ($env)
{
case "RESULT":
$results = $search_engine->query_per_offset($query, (int) ($pos), 1);
$results = $search_engine->query_per_offset($query, (int) ($pos), 1);
$mypreview = array();
if ($results->get_datas()->is_empty())
@@ -104,22 +104,22 @@ class record_preview extends record_adapter
}
foreach ($results->get_datas() as $record)
{
$number = $pos;
$sbas_id = $record->get_sbas_id();
$number = $pos;
$sbas_id = $record->get_sbas_id();
$record_id = $record->get_record_id();
break;
}
break;
case "REG":
$contId = explode('_', $contId);
$sbas_id = $contId[0];
$contId = explode('_', $contId);
$sbas_id = $contId[0];
$record_id = $contId[1];
$this->container = new record_adapter($sbas_id, $record_id);
if ($pos == 0)
{
$number = 0;
$title = _('preview:: regroupement ');
$title = _('preview:: regroupement ');
}
else
{
@@ -127,12 +127,12 @@ class record_preview extends record_adapter
$children = $this->container->get_children();
foreach ($children as $child)
{
$sbas_id = $child->get_sbas_id();
$sbas_id = $child->get_sbas_id();
$record_id = $child->get_record_id();
if ($child->get_number() == $pos)
break;
}
$number = $pos;
$number = $pos;
$this->total = $children->get_count();
}
@@ -142,7 +142,7 @@ class record_preview extends record_adapter
$this->container = $basket;
$this->total = count($basket->get_elements());
$i = 0;
$i = 0;
$first = true;
foreach ($basket->get_elements() as $element)
@@ -150,29 +150,29 @@ class record_preview extends record_adapter
$i++;
if ($first)
{
$sbas_id = $element->get_record()->get_sbas_id();
$sbas_id = $element->get_record()->get_sbas_id();
$record_id = $element->get_record()->get_record_id();
$this->name = $basket->get_name();
$number = $element->get_order();
$number = $element->get_order();
}
$first = false;
$first = false;
if ($element->get_order() == $pos)
{
$sbas_id = $element->get_record()->get_sbas_id();
$sbas_id = $element->get_record()->get_sbas_id();
$record_id = $element->get_record()->get_record_id();
$this->name = $basket->get_name();
$number = $element->get_order();
$number = $element->get_order();
}
}
break;
case "FEED":
$entry = Feed_Entry_Adapter::load_from_id($appbox, $contId);
$entry = Feed_Entry_Adapter::load_from_id($appbox, $contId);
// $basket = basket_adapter::getInstance($appbox, $contId, $appbox->get_session()->get_usr_id());
$this->container = $entry;
$this->total = count($entry->get_content());
$i = 0;
$i = 0;
$first = true;
foreach ($entry->get_content() as $element)
@@ -180,19 +180,19 @@ class record_preview extends record_adapter
$i++;
if ($first)
{
$sbas_id = $element->get_record()->get_sbas_id();
$sbas_id = $element->get_record()->get_sbas_id();
$record_id = $element->get_record()->get_record_id();
$this->name = $entry->get_title();
$number = $element->get_ord();
$number = $element->get_ord();
}
$first = false;
$first = false;
if ($element->get_ord() == $pos)
{
$sbas_id = $element->get_record()->get_sbas_id();
$sbas_id = $element->get_record()->get_sbas_id();
$record_id = $element->get_record()->get_record_id();
$this->name = $entry->get_title();
$number = $element->get_ord();
$number = $element->get_ord();
}
}
break;
@@ -202,7 +202,7 @@ class record_preview extends record_adapter
return $this;
}
public function get_train($pos = 0, $query='', searchEngine_adapter $search_engine=null)
public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null)
{
if ($this->train)
return $this->train;
@@ -211,8 +211,8 @@ class record_preview extends record_adapter
{
case 'RESULT':
$perPage = 56;
$index = ($pos - 3) < 0 ? 0 : ($pos - 3);
$page = (int) ceil($pos / $perPage);
$index = ($pos - 3) < 0 ? 0 : ($pos - 3);
$page = (int) ceil($pos / $perPage);
$results = $search_engine->query_per_offset($query, $index, $perPage);
$this->train = $results->get_datas();
@@ -264,27 +264,27 @@ class record_preview extends record_adapter
*
* @return String
*/
public function get_title($highlight = '', searchEngine_adapter $search_engine=null)
public function get_title($highlight = '', searchEngine_adapter $search_engine = null)
{
if ($this->title)
return $this->title;
$this->title = collection::getLogo($this->get_base_id()) . ' ';
switch ($this->env)
{
case "RESULT":
$this->title .= sprintf(
_('preview:: resultat numero %s '), '<span id="current_result_n">' . ($this->number + 1)
. '</span> : '
_('preview:: resultat numero %s '), '<span id="current_result_n">' . ($this->number + 1)
. '</span> : '
);
$this->title .= parent::get_title($highlight, $search_engine);
break;
case "BASK":
$this->title .= $this->name . ' - ' . parent::get_title($highlight, $search_engine)
. ' (' . $this->get_number() . '/' . $this->total . ') ';
. ' (' . $this->get_number() . '/' . $this->total . ') ';
break;
case "REG":
$title = parent::get_title();
@@ -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;
@@ -327,16 +327,16 @@ class record_preview extends record_adapter
$tab = array();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$registry = $appbox->get_registry();
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$report = $user->ACL()->has_right_on_base($this->get_base_id(), 'canreport');
$connsbas = connection::getPDOConnection($this->get_sbas_id());
$sql = 'SELECT d . * , l.user, l.usrid as usr_id, l.site
$sql = 'SELECT d . * , l.user, l.usrid as usr_id, l.site
FROM log_docs d, log l
WHERE d.log_id = l.id
AND d.record_id = :record_id ';
@@ -346,14 +346,14 @@ class record_preview extends record_adapter
{
$sql .= ' AND ((l.usrid = :usr_id AND l.site= :site) OR action="add")';
$params[':usr_id'] = $session->get_usr_id();
$params[':site'] = $registry->get('GV_sit');
$params[':site'] = $registry->get('GV_sit');
}
$sql .= 'ORDER BY d.date, usrid DESC';
$stmt = $connsbas->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row)
@@ -376,7 +376,7 @@ class record_preview extends record_adapter
if (!isset($tab[$hour][$site][$action][$row['usr_id']]))
{
$user = null;
try
{
$user = \User_Adapter::getInstance($row['usr_id'], $appbox);
@@ -387,20 +387,20 @@ class record_preview extends record_adapter
}
$tab[$hour][$site][$action][$row['usr_id']] =
array(
'final' => array()
, 'comment' => array()
, 'user' => $user
array(
'final' => array()
, 'comment' => array()
, 'user' => $user
);
}
if (!in_array($row['final'], $tab[$hour][$site][$action][$row['usr_id']]['final']))
$tab[$hour][$site][$action][$row['usr_id']]['final'][] =
$row['final'];
$row['final'];
if (!in_array($row['comment'], $tab[$hour][$site][$action][$row['usr_id']]['comment']))
$tab[$hour][$site][$action][$row['usr_id']]['comment'][] =
$row['comment'];
$row['comment'];
}
$this->short_history = array_reverse($tab);
@@ -416,12 +416,12 @@ class record_preview extends record_adapter
{
if (!is_null($this->view_popularity))
return $this->view_popularity;
$appbox = appbox::get_instance();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport');
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport');
$registry = $appbox->get_registry();
if (!$report && !$registry->get('GV_google_api'))
@@ -432,16 +432,16 @@ class record_preview extends record_adapter
}
$views = $dwnls = array();
$top = 1;
$day = 30;
$min = 0;
$top = 1;
$day = 30;
$min = 0;
$average = 0;
while ($day >= 0)
{
$datetime = new DateTime('-' . $day . ' days');
$date = date_format($datetime, 'Y-m-d');
$datetime = new DateTime('-' . $day . ' days');
$date = date_format($datetime, 'Y-m-d');
$views[$date] = $dwnls[$date] = 0;
$day--;
}
@@ -454,14 +454,14 @@ class record_preview extends record_adapter
GROUP BY datee ORDER BY datee ASC';
$connsbas = connection::getPDOConnection($this->get_sbas_id());
$stmt = $connsbas->prepare($sql);
$stmt = $connsbas->prepare($sql);
$stmt->execute(
array(
':record_id' => $this->get_record_id(),
':site' => $registry->get('GV_sit')
)
array(
':record_id' => $this->get_record_id(),
':site' => $registry->get('GV_sit')
)
);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row)
@@ -469,8 +469,8 @@ class record_preview extends record_adapter
if (isset($views[$row['datee']]))
{
$views[$row['datee']] = (int) $row['views'];
$top = max((int) $row['views'], $top);
$min = isset($min) ? min($row['views'], $min) : $row['views'];
$top = max((int) $row['views'], $top);
$min = isset($min) ? min($row['views'], $min) : $row['views'];
$average += $row['views'];
}
}
@@ -478,26 +478,26 @@ class record_preview extends record_adapter
$topScale = round($top * 1.2);
$average = $average / 30;
$max = round(($top) * 100 / ($topScale));
$min = round($min * 100 / ($topScale));
$max = round(($top) * 100 / ($topScale));
$min = round($min * 100 / ($topScale));
$average = round($average * 100 / ($topScale));
$width = 350;
$width = 350;
$height = 150;
$url = 'http://chart.apis.google.com/chart?' .
'chs=' . $width . 'x' . $height .
'&chd=t:' . implode(',', $views) .
'&cht=lc' .
'&chf=bg,s,00000000' .
'&chxt=x,y,r' .
'&chds=0,' . $topScale .
'&chls=2.0&chxtc=2,-350' .
'&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|'
. date_format(new DateTime('-15 days'), 'd M') . '|'
. date_format(new DateTime(), 'd M') . '|1:|0|'
. round($top / 2, 2) . '|' . $top
. '|2:|min|average|max' .
'&chxp=2,' . $min . ',' . $average . ',' . $max;
$url = 'http://chart.apis.google.com/chart?' .
'chs=' . $width . 'x' . $height .
'&chd=t:' . implode(',', $views) .
'&cht=lc' .
'&chf=bg,s,00000000' .
'&chxt=x,y,r' .
'&chds=0,' . $topScale .
'&chls=2.0&chxtc=2,-350' .
'&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|'
. date_format(new DateTime('-15 days'), 'd M') . '|'
. date_format(new DateTime(), 'd M') . '|1:|0|'
. round($top / 2, 2) . '|' . $top
. '|2:|min|average|max' .
'&chxp=2,' . $min . ',' . $average . ',' . $max;
$this->view_popularity = new media_adapter($url, $width, $height);
@@ -513,12 +513,12 @@ class record_preview extends record_adapter
{
if (!is_null($this->refferer_popularity))
return $this->refferer_popularity;
$appbox = appbox::get_instance();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport');
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport');
$registry = $appbox->get_registry();
if (!$report && !$registry->get('GV_google_api'))
@@ -538,7 +538,7 @@ class record_preview extends record_adapter
$stmt = $connsbas->prepare($sql);
$stmt->execute(array(':record_id' => $this->get_record_id()));
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$referrers = array();
@@ -566,24 +566,24 @@ class record_preview extends record_adapter
if (strpos($row['referrer'], $registry->get('GV_ServerName') . 'permalink/') !== false)
{
if (strpos($row['referrer'], '/view/') !== false)
$row['referrer'] = _('report::presentation page preview');
$row['referrer'] = _('report::presentation page preview');
else
$row['referrer'] = _('report::acces direct');
$row['referrer'] = _('report::acces direct');
}
if (!isset($referrers[$row['referrer']]))
$referrers[$row['referrer']] = 0;
$referrers[$row['referrer']] += (int) $row['views'];
}
$width = 550;
$width = 550;
$height = 100;
$url = 'http://chart.apis.google.com/chart?'
. 'cht=p3&chf=bg,s,00000000&chd=t:'
. implode(',', $referrers)
. '&chs=' . $width . 'x' . $height
. '&chl='
. urlencode(implode('|', array_keys($referrers))) . '';
. 'cht=p3&chf=bg,s,00000000&chd=t:'
. implode(',', $referrers)
. '&chs=' . $width . 'x' . $height
. '&chl='
. urlencode(implode('|', array_keys($referrers))) . '';
$this->refferer_popularity = new media_adapter($url, $width, $height);
@@ -599,13 +599,13 @@ class record_preview extends record_adapter
if (!is_null($this->download_popularity))
return $this->download_popularity;
$appbox = appbox::get_instance();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$registry = $appbox->get_registry();
$report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport');
$report = $user->ACL()->has_right_on_base(
$this->get_base_id(), 'canreport');
$ret = false;
if (!$report && !$registry->get('GV_google_api'))
@@ -616,16 +616,16 @@ class record_preview extends record_adapter
}
$views = $dwnls = array();
$top = 1;
$day = 30;
$min = 0;
$top = 1;
$day = 30;
$min = 0;
$average = 0;
while ($day >= 0)
{
$datetime = new DateTime('-' . $day . ' days');
$date = date_format($datetime, 'Y-m-d');
$datetime = new DateTime('-' . $day . ' days');
$date = date_format($datetime, 'Y-m-d');
$views[$date] = $dwnls[$date] = 0;
$day--;
}
@@ -640,14 +640,14 @@ class record_preview extends record_adapter
GROUP BY datee ORDER BY datee ASC';
$connsbas = connection::getPDOConnection($this->get_sbas_id());
$stmt = $connsbas->prepare($sql);
$stmt = $connsbas->prepare($sql);
$stmt->execute(
array(
':record_id' => $this->get_record_id(),
':site' => $registry->get('GV_sit')
)
array(
':record_id' => $this->get_record_id(),
':site' => $registry->get('GV_sit')
)
);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
$top = 10;
@@ -657,23 +657,23 @@ class record_preview extends record_adapter
if (isset($dwnls[$row['datee']]))
{
$dwnls[$row['datee']] = (int) $row['dwnl'];
$top = max(((int) $row['dwnl'] + 10), $top);
$top = max(((int) $row['dwnl'] + 10), $top);
}
}
$width = 250;
$width = 250;
$height = 150;
$url = 'http://chart.apis.google.com/chart?' .
'chs=' . $width . 'x' . $height .
'&chd=t:' . implode(',', $dwnls) .
'&cht=lc' .
'&chf=bg,s,00000000' .
'&chxt=x,y' .
'&chds=0,' . $top .
'&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|'
. date_format(new DateTime('-15 days'), 'd M') . '|'
. date_format(new DateTime(), 'd M') . '|1:|0|'
. round($top / 2) . '|' . $top . '';
$url = 'http://chart.apis.google.com/chart?' .
'chs=' . $width . 'x' . $height .
'&chd=t:' . implode(',', $dwnls) .
'&cht=lc' .
'&chf=bg,s,00000000' .
'&chxt=x,y' .
'&chds=0,' . $top .
'&chxl=0:|' . date_format(new DateTime('-30 days'), 'd M') . '|'
. date_format(new DateTime('-15 days'), 'd M') . '|'
. date_format(new DateTime(), 'd M') . '|1:|0|'
. round($top / 2) . '|' . $top . '';
$ret = new media_adapter($url, $width, $height);
$this->download_popularity = $ret;

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

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

View File

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

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

View File

@@ -36,8 +36,8 @@ class set_export extends set_abstract
*/
public function __construct($lst, $sstid)
{
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$registry = $appbox->get_registry();
@@ -53,7 +53,7 @@ class set_export extends set_abstract
foreach ($basket->get_elements() as $basket_element)
{
$base_id = $basket_element->get_record()->get_base_id();
$base_id = $basket_element->get_record()->get_base_id();
$record_id = $basket_element->get_record()->get_record_id();
if (!isset($remain_hd[$base_id]))
@@ -69,11 +69,11 @@ class set_export extends set_abstract
}
$current_element = $download_list[] =
new record_exportElement(
$basket_element->get_record()->get_sbas_id(),
$record_id,
$basket->get_name() . '/',
$remain_hd[$base_id]
new record_exportElement(
$basket_element->get_record()->get_sbas_id(),
$record_id,
$basket->get_name() . '/',
$remain_hd[$base_id]
);
$remain_hd[$base_id] = $current_element->get_remain_hd();
@@ -82,7 +82,7 @@ class set_export extends set_abstract
else
{
$tmp_lst = explode(';', $lst);
$n = 1;
$n = 1;
foreach ($tmp_lst as $basrec)
{
$basrec = explode('_', $basrec);
@@ -104,7 +104,7 @@ class set_export extends set_abstract
foreach ($record->get_children() as $child_basrec)
{
$base_id = $child_basrec->get_base_id();
$base_id = $child_basrec->get_base_id();
$record_id = $child_basrec->get_record_id();
if (!isset($remain_hd[$base_id]))
@@ -112,7 +112,7 @@ class set_export extends set_abstract
if ($user->ACL()->is_restricted_download($base_id))
{
$remain_hd[$base_id] =
$user->ACL()->remaining_download($base_id);
$user->ACL()->remaining_download($base_id);
}
else
{
@@ -121,11 +121,11 @@ class set_export extends set_abstract
}
$current_element = $download_list[] =
new record_exportElement(
$child_basrec->get_sbas_id(),
$record_id,
$regfield['regname'] . '_' . $n . '/',
$remain_hd[$base_id]
new record_exportElement(
$child_basrec->get_sbas_id(),
$record_id,
$regfield['regname'] . '_' . $n . '/',
$remain_hd[$base_id]
);
$remain_hd[$base_id] = $current_element->get_remain_hd();
@@ -133,7 +133,7 @@ class set_export extends set_abstract
}
else
{
$base_id = $record->get_base_id();
$base_id = $record->get_base_id();
$record_id = $record->get_record_id();
if (!isset($remain_hd[$base_id]))
@@ -141,7 +141,7 @@ class set_export extends set_abstract
if ($user->ACL()->is_restricted_download($base_id))
{
$remain_hd[$base_id] =
$user->ACL()->remaining_download($base_id);
$user->ACL()->remaining_download($base_id);
}
else
{
@@ -149,13 +149,13 @@ class set_export extends set_abstract
}
}
$current_element =
$download_list[$basrec[0] . '_' . $basrec[1]] =
new record_exportElement(
$record->get_sbas_id(),
$record_id,
'',
$remain_hd[$base_id]
$current_element =
$download_list[$basrec[0] . '_' . $basrec[1]] =
new record_exportElement(
$record->get_sbas_id(),
$record_id,
'',
$remain_hd[$base_id]
);
$remain_hd[$base_id] = $current_element->get_remain_hd();
@@ -180,10 +180,10 @@ class set_export extends set_abstract
if (!isset($display_download[$name]))
{
$display_download[$name] = array(
'size' => 0,
'total' => 0,
'available' => 0,
'refused' => array()
'size' => 0,
'total' => 0,
'available' => 0,
'refused' => array()
);
}
@@ -195,12 +195,12 @@ class set_export extends set_abstract
$display_download[$name]['label'] = $properties['label'];
$this->total_download++;
$display_download[$name]['size'] +=
$download_element->get_size($name);
$download_element->get_size($name);
}
else
{
$display_download[$name]['refused'][] =
$download_element->get_thumbnail();
$download_element->get_thumbnail();
}
}
foreach ($download_element->get_orderable() as $name => $properties)
@@ -208,9 +208,9 @@ class set_export extends set_abstract
if (!isset($display_orderable[$name]))
{
$display_orderable[$name] = array(
'total' => 0,
'available' => 0,
'refused' => array()
'total' => 0,
'available' => 0,
'refused' => array()
);
}
@@ -224,7 +224,7 @@ class set_export extends set_abstract
else
{
$display_orderable[$name]['refused'][] =
$download_element->get_thumbnail();
$download_element->get_thumbnail();
}
}
}
@@ -237,10 +237,10 @@ class set_export extends set_abstract
$display_ftp = array();
$hasadminright = $user->ACL()->has_right('addrecord')
|| $user->ACL()->has_right('deleterecord')
|| $user->ACL()->has_right('modifyrecord')
|| $user->ACL()->has_right('coll_manage')
|| $user->ACL()->has_right('coll_modify_struct');
|| $user->ACL()->has_right('deleterecord')
|| $user->ACL()->has_right('modifyrecord')
|| $user->ACL()->has_right('coll_manage')
|| $user->ACL()->has_right('coll_modify_struct');
$this->ftp_datas = array();
@@ -253,7 +253,7 @@ class set_export extends set_abstract
if ($hasadminright)
{
$sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP,
$sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP,
usr.pwdFTP,usr.destFTP,prefixFTPfolder,usr.passifFTP,
usr.retryFTP,usr.usr_mail
FROM (usr INNER JOIN basusr
@@ -269,7 +269,7 @@ class set_export extends set_abstract
}
elseif ($registry->get('GV_ftp_for_user'))
{
$sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP,
$sql = "SELECT usr.usr_id,usr_login,usr.addrFTP,usr.loginFTP,usr.sslFTP,
usr.pwdFTP,usr.destFTP,prefixFTPfolder,
usr.passifFTP,usr.retryFTP,usr.usr_mail
FROM (usr INNER JOIN basusr
@@ -285,43 +285,43 @@ class set_export extends set_abstract
}
$datas[] = array(
'name' => _('export::ftp: reglages manuels'),
'usr_id' => '0',
'addrFTP' => '',
'loginFTP' => '',
'pwdFTP' => '',
'ssl' => '0',
'destFTP' => '',
'prefixFTPfolder' => 'Export_' . date("Y-m-d_H.i.s"),
'passifFTP' => false,
'retryFTP' => 5,
'mailFTP' => '',
'sendermail' => $user->get_email()
'name' => _('export::ftp: reglages manuels'),
'usr_id' => '0',
'addrFTP' => '',
'loginFTP' => '',
'pwdFTP' => '',
'ssl' => '0',
'destFTP' => '',
'prefixFTPfolder' => 'Export_' . date("Y-m-d_H.i.s"),
'passifFTP' => false,
'retryFTP' => 5,
'mailFTP' => '',
'sendermail' => $user->get_email()
);
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute($params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($rs as $row)
{
$datas[] = array(
'name' => $row["usr_login"],
'usr_id' => $row['usr_id'],
'addrFTP' => $row['addrFTP'],
'loginFTP' => $row['loginFTP'],
'pwdFTP' => $row['pwdFTP'],
'ssl' => $row['sslFTP'],
'destFTP' => $row['destFTP'],
'prefixFTPfolder' =>
(strlen(trim($row['prefixFTPfolder'])) > 0 ?
trim($row['prefixFTPfolder']) :
'Export_' . date("Y-m-d_H.i.s")),
'passifFTP' => ($row['passifFTP'] > 0),
'retryFTP' => $row['retryFTP'],
'mailFTP' => $row['usr_mail'],
'sendermail' => $user->get_email()
'name' => $row["usr_login"],
'usr_id' => $row['usr_id'],
'addrFTP' => $row['addrFTP'],
'loginFTP' => $row['loginFTP'],
'pwdFTP' => $row['pwdFTP'],
'ssl' => $row['sslFTP'],
'destFTP' => $row['destFTP'],
'prefixFTPfolder' =>
(strlen(trim($row['prefixFTPfolder'])) > 0 ?
trim($row['prefixFTPfolder']) :
'Export_' . date("Y-m-d_H.i.s")),
'passifFTP' => ($row['passifFTP'] > 0),
'retryFTP' => $row['retryFTP'],
'mailFTP' => $row['usr_mail'],
'sendermail' => $user->get_email()
);
}
@@ -411,8 +411,8 @@ class set_export extends set_abstract
{
throw new Exception('No subdefs given');
}
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$registry = $appbox->get_registry();
$unicode = new unicode();
@@ -431,11 +431,11 @@ class set_export extends set_abstract
$id = count($files);
$files[$id] = array(
'base_id' => $download_element->get_base_id(),
'record_id' => $download_element->get_record_id(),
'original_name' => '',
'export_name' => '',
'subdefs' => array()
'base_id' => $download_element->get_base_id(),
'record_id' => $download_element->get_record_id(),
'original_name' => '',
'export_name' => '',
'subdefs' => array()
);
$sbas_id = phrasea::sbasFromBas($download_element->get_base_id());
@@ -445,12 +445,12 @@ class set_export extends set_abstract
$desc = $download_element->get_xml();
$files[$id]['original_name'] =
$files[$id]['export_name'] =
$download_element->get_original_name();
$files[$id]['export_name'] =
$download_element->get_original_name();
$files[$id]['original_name'] =
trim($files[$id]['original_name']) != '' ?
$files[$id]['original_name'] : $id;
trim($files[$id]['original_name']) != '' ?
$files[$id]['original_name'] : $id;
$infos = pathinfo($files[$id]['original_name']);
@@ -462,7 +462,7 @@ class set_export extends set_abstract
$title = strip_tags($download_element->get_title());
$files[$id]['export_name'] = $unicode->remove_nonazAZ09($title, true);
$rename_done = true;
$rename_done = true;
}
else
{
@@ -470,12 +470,12 @@ class set_export extends set_abstract
}
$sizeMaxAjout = 0;
$sizeMaxExt = 0;
$sizeMaxExt = 0;
$sd = $download_element->get_subdefs();
foreach ($download_element->get_downloadable() as $name => $properties)
{
{
if ($properties === false || !in_array($name, $subdefs))
{
continue;
@@ -486,7 +486,7 @@ class set_export extends set_abstract
}
set_time_limit(100);
$subdef_export = $subdef_alive = false;
$subdef_export = $subdef_alive = false;
$n_files++;
@@ -497,32 +497,32 @@ class set_export extends set_abstract
case 'caption':
case 'caption-yaml':
$subdef_export = true;
$subdef_alive = true;
$subdef_alive = true;
break;
case 'thumbnail':
$tmp_pathfile = array(
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
$tmp_pathfile = array(
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
);
$subdef_export = true;
$subdef_alive = true;
$subdef_alive = true;
break;
case 'document':
$subdef_export = true;
$path = recordutils_image::stamp(
$download_element->get_base_id()
, $download_element->get_record_id()
, true
$path = recordutils_image::stamp(
$download_element->get_base_id()
, $download_element->get_record_id()
, true
);
$tmp_pathfile = array(
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
$tmp_pathfile = array(
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
);
if (file_exists($path))
{
$tmp_pathfile = array(
'path' => dirname($path)
, 'file' => basename($path)
'path' => dirname($path)
, 'file' => basename($path)
);
$subdef_alive = true;
}
@@ -532,24 +532,24 @@ class set_export extends set_abstract
$subdef_export = true;
$tmp_pathfile = array(
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
'path' => $sd[$name]->get_path()
, 'file' => $sd[$name]->get_file()
);
if (!$user->ACL()->has_right_on_base(
$download_element->get_base_id()
, "nowatermark"
)
&& $sd[$name]->get_type() == media_subdef::TYPE_IMAGE)
$download_element->get_base_id()
, "nowatermark"
)
&& $sd[$name]->get_type() == media_subdef::TYPE_IMAGE)
{
$path = recordutils_image::watermark(
$download_element->get_base_id()
, $download_element->get_record_id()
$download_element->get_base_id()
, $download_element->get_record_id()
);
if (file_exists($path))
{
$tmp_pathfile = array(
'path' => dirname($path)
, 'file' => basename($path)
'path' => dirname($path)
, 'file' => basename($path)
);
$subdef_alive = true;
}
@@ -568,44 +568,44 @@ class set_export extends set_abstract
case 'caption':
if ($name == 'caption-yaml')
{
$suffix = '_captionyaml';
$suffix = '_captionyaml';
$extension = 'yml';
$mime = 'text/x-yaml';
$mime = 'text/x-yaml';
}
else
{
$suffix = '_caption';
$suffix = '_caption';
$extension = 'xml';
$mime = 'text/xml';
$mime = 'text/xml';
}
$files[$id]["subdefs"][$name]["ajout"] = $suffix;
$files[$id]["subdefs"][$name]["ajout"] = $suffix;
$files[$id]["subdefs"][$name]["exportExt"] = $extension;
$files[$id]["subdefs"][$name]["label"] = $properties['label'];
$files[$id]["subdefs"][$name]["path"] = null;
$files[$id]["subdefs"][$name]["file"] = null;
$files[$id]["subdefs"][$name]["size"] = 0;
$files[$id]["subdefs"][$name]["folder"] = $download_element->get_directory();
$files[$id]["subdefs"][$name]["mime"] = $mime;
$files[$id]["subdefs"][$name]["label"] = $properties['label'];
$files[$id]["subdefs"][$name]["path"] = null;
$files[$id]["subdefs"][$name]["file"] = null;
$files[$id]["subdefs"][$name]["size"] = 0;
$files[$id]["subdefs"][$name]["folder"] = $download_element->get_directory();
$files[$id]["subdefs"][$name]["mime"] = $mime;
break;
case 'document':
case 'preview':
case 'thumbnail':
$infos = pathinfo(p4string::addEndSlash($tmp_pathfile["path"]) .
$tmp_pathfile["file"]);
$tmp_pathfile["file"]);
$files[$id]["subdefs"][$name]["ajout"] =
$properties['class'] == 'document' ? '' : "_" . $name;
$files[$id]["subdefs"][$name]["path"] = $tmp_pathfile["path"];
$files[$id]["subdefs"][$name]["file"] = $tmp_pathfile["file"];
$files[$id]["subdefs"][$name]["label"] = $properties['label'];
$files[$id]["subdefs"][$name]["size"] = $sd[$name]->get_size();
$files[$id]["subdefs"][$name]["mime"] = $sd[$name]->get_mime();
$files[$id]["subdefs"][$name]["folder"] =
$download_element->get_directory();
$files[$id]["subdefs"][$name]["ajout"] =
$properties['class'] == 'document' ? '' : "_" . $name;
$files[$id]["subdefs"][$name]["path"] = $tmp_pathfile["path"];
$files[$id]["subdefs"][$name]["file"] = $tmp_pathfile["file"];
$files[$id]["subdefs"][$name]["label"] = $properties['label'];
$files[$id]["subdefs"][$name]["size"] = $sd[$name]->get_size();
$files[$id]["subdefs"][$name]["mime"] = $sd[$name]->get_mime();
$files[$id]["subdefs"][$name]["folder"] =
$download_element->get_directory();
$files[$id]["subdefs"][$name]["exportExt"] =
isset($infos['extension']) ? $infos['extension'] : '';
isset($infos['extension']) ? $infos['extension'] : '';
$size += $sd[$name]->get_size();
@@ -613,12 +613,12 @@ class set_export extends set_abstract
}
$longueurAjoutCourant =
mb_strlen($files[$id]["subdefs"][$name]["ajout"]);
$sizeMaxAjout = max($longueurAjoutCourant, $sizeMaxAjout);
mb_strlen($files[$id]["subdefs"][$name]["ajout"]);
$sizeMaxAjout = max($longueurAjoutCourant, $sizeMaxAjout);
$longueurExtCourant =
mb_strlen($files[$id]["subdefs"][$name]["exportExt"]);
$sizeMaxExt = max($longueurExtCourant, $sizeMaxExt);
mb_strlen($files[$id]["subdefs"][$name]["exportExt"]);
$sizeMaxExt = max($longueurExtCourant, $sizeMaxExt);
}
}
@@ -628,34 +628,34 @@ class set_export extends set_abstract
$start_length = mb_strlen($name);
if ($start_length > $max_length)
$name = mb_substr($name, 0, $max_length);
$name = mb_substr($name, 0, $max_length);
$n = 1;
while (in_array(mb_strtolower($name), $file_names))
{
$n++;
$suffix = "-" . $n; // pour diese si besoin
$max_length = 31 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix);
$name = mb_strtolower($files[$id]["export_name"]);
$suffix = "-" . $n; // pour diese si besoin
$max_length = 31 - $sizeMaxExt - $sizeMaxAjout - mb_strlen($suffix);
$name = mb_strtolower($files[$id]["export_name"]);
if ($start_length > $max_length)
$name = mb_substr($name, 0, $max_length) . $suffix;
$name = mb_substr($name, 0, $max_length) . $suffix;
else
$name = $name . $suffix;
$name = $name . $suffix;
}
$file_names[] = mb_strtolower($name);
$file_names[] = mb_strtolower($name);
$files[$id]["export_name"] = $name;
$files[$id]["export_name"] = $unicode->remove_nonazAZ09($files[$id]["export_name"]);
$files[$id]["export_name"] = $unicode->remove_nonazAZ09($files[$id]["export_name"]);
$files[$id]["original_name"] = $unicode->remove_nonazAZ09($files[$id]["original_name"]);
$i = 0;
$name = utf8_decode($files[$id]["export_name"]);
$tmp_name = "";
$i = 0;
$name = utf8_decode($files[$id]["export_name"]);
$tmp_name = "";
$good_keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '-', '_', '.', '#');
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3',
'4', '5', '6', '7', '8', '9', '-', '_', '.', '#');
while (isset($name[$i]))
{
@@ -673,19 +673,19 @@ class set_export extends set_abstract
if (in_array('caption', $subdefs))
{
$caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/'
. time() . $session->get_usr_id()
. $session->get_ses_id() . '/';
. time() . $session->get_usr_id()
. $session->get_ses_id() . '/';
system_file::mkdir($caption_dir);
$desc = self::get_caption(
$download_element->get_base_id()
, $download_element->get_record_id()
$download_element->get_base_id()
, $download_element->get_record_id()
);
$file = $files[$id]["export_name"]
. $files[$id]["subdefs"]['caption']["ajout"] . '.'
. $files[$id]["subdefs"]['caption']["exportExt"];
. $files[$id]["subdefs"]['caption']["ajout"] . '.'
. $files[$id]["subdefs"]['caption']["exportExt"];
$path = $caption_dir;
@@ -701,22 +701,22 @@ class set_export extends set_abstract
if (in_array('caption-yaml', $subdefs))
{
$caption_dir = $registry->get('GV_RootPath') . 'tmp/desc_tmp/'
. time() . $session->get_usr_id()
. $session->get_ses_id() . '/';
. time() . $session->get_usr_id()
. $session->get_ses_id() . '/';
system_file::mkdir($caption_dir);
$desc = self::get_caption(
$download_element->get_base_id()
, $download_element->get_record_id()
, true
, 'yaml'
$download_element->get_base_id()
, $download_element->get_record_id()
, true
, 'yaml'
);
$file = $files[$id]["export_name"]
. $files[$id]["subdefs"]['caption-yaml']["ajout"] . '.'
. $files[$id]["subdefs"]['caption-yaml']["exportExt"];
. $files[$id]["subdefs"]['caption-yaml']["ajout"] . '.'
. $files[$id]["subdefs"]['caption-yaml']["exportExt"];
$path = $caption_dir;
@@ -732,10 +732,10 @@ class set_export extends set_abstract
}
$this->list = array(
'files' => $files,
'names' => $file_names,
'size' => $size,
'count' => $n_files
'files' => $files,
'names' => $file_names,
'size' => $size,
'count' => $n_files
);
@@ -769,13 +769,13 @@ class set_export extends set_abstract
random::updateToken($token, serialize($list));
$str_in = array("à", "á", "â", "ã", "ä", "å", "ç", "è", "é", "ê",
"ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô",
"õ", "ö", "ù", "ú", "û", "ü", "ý", "ÿ");
"ë", "ì", "í", "î", "ï", "ð", "ñ", "ò", "ó", "ô",
"õ", "ö", "ù", "ú", "û", "ü", "ý", "ÿ");
$str_out = array("a", "a", "a", "a", "a", "a", "c", "e", "e", "e",
"e", "i", "i", "i", "i", "o", "n", "o", "o", "o",
"o", "o", "u", "u", "u", "u", "y", "y");
"e", "i", "i", "i", "i", "o", "n", "o", "o", "o",
"o", "o", "u", "u", "u", "u", "y", "y");
$caption_dirs = $unlinks = array();
$caption_dirs = $unlinks = array();
foreach ($files as $record)
{
@@ -787,9 +787,9 @@ class set_export extends set_abstract
if (is_file($path))
{
$name = $obj["folder"]
. $record["export_name"]
. $obj["ajout"]
. '.' . $obj["exportExt"];
. $record["export_name"]
. $obj["ajout"]
. '.' . $obj["exportExt"];
$name = str_replace($str_in, $str_out, $name);
@@ -799,7 +799,7 @@ class set_export extends set_abstract
{
if (!in_array(dirname($path), $caption_dirs))
$caption_dirs[] = dirname($path);
$unlinks[] = $path;
$unlinks[] = $path;
}
}
}
@@ -842,7 +842,7 @@ class set_export extends set_abstract
$dom->encoding = 'UTF-8';
$dom_record = $dom->createElement('record');
$dom_desc = $dom->createElement('description');
$dom_desc = $dom->createElement('description');
$dom_record->appendChild($dom_desc);
$dom->appendChild($dom_record);
@@ -850,19 +850,19 @@ class set_export extends set_abstract
$restrict = array();
$sbas_id = phrasea::sbasFromBas($bas);
$record = new record_adapter($sbas_id, $rec);
$desc = $record->get_xml();
$appbox = appbox::get_instance();
$record = new record_adapter($sbas_id, $rec);
$desc = $record->get_xml();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$databox = databox::get_instance($sbas_id);
$struct = $databox->get_structure();
$struct = $databox->get_structure();
$rights = true;
if ($check_rights && $session->is_authenticated())
{
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$user = User_Adapter::getInstance($session->get_usr_id(), $appbox);
$rights = $user->ACL()->has_right_on_base($bas, 'canmodifrecord');
if ($rights == false)
@@ -875,7 +875,7 @@ class set_export extends set_abstract
foreach ($z[0] as $ki => $vi)
{
if (isset($vi["export"])
&& ($vi["export"] == "0" || $vi["export"] == "off"))
&& ($vi["export"] == "0" || $vi["export"] == "off"))
$restrict[$ki] = true;
}
}
@@ -885,36 +885,27 @@ 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)
switch ($format)
{
if (($rights || !isset($restrict[$ki])))
{
case 'yaml':
case 'yml':
$vi = $field->get_value();
if (ctype_digit($vi))
$vi = (int) $vi;
switch ($format)
{
case 'yaml':
case 'yml':
$vi = trim($vi);
if (ctype_digit($vi))
$vi = (int) $vi;
$buffer[trim($ki)] = $vi;
break;
case 'xml':
default:
$dom_el = $dom->createElement($ki);
$dom_el->appendChild($dom->createTextNode(trim($vi)));
$dom_desc->appendChild($dom_el);
break;
}
}
$buffer[$field->get_name()] = $vi;
break;
case 'xml':
default:
$dom_el = $dom->createElement($field->get_name());
$dom_el->appendChild($dom->createTextNode($field->get_value(true)));
$dom_desc->appendChild($dom_el);
break;
}
}
}
@@ -954,7 +945,7 @@ class set_export extends set_abstract
$registry = registry::get_instance();
$disposition = in_array($disposition, array('inline', 'attachment')) ?
$disposition : 'attachment';
$disposition : 'attachment';
$response = new Symfony\Component\HttpFoundation\Response();
@@ -964,17 +955,17 @@ class set_export extends set_abstract
if ($registry->get('GV_modxsendfile') && strpos($file, $registry->get('GV_X_Accel_Redirect')) !== false)
{
$file_xaccel = str_replace(
array(
$registry->get('GV_X_Accel_Redirect'),
$registry->get('GV_RootPath') . 'tmp/download/',
$registry->get('GV_RootPath') . 'tmp/lazaret/'
)
, array(
'/' . $registry->get('GV_X_Accel_Redirect_mount_point') . '/',
'/download/',
'/lazaret/'
)
, $file
array(
$registry->get('GV_X_Accel_Redirect'),
$registry->get('GV_RootPath') . 'tmp/download/',
$registry->get('GV_RootPath') . 'tmp/lazaret/'
)
, array(
'/' . $registry->get('GV_X_Accel_Redirect_mount_point') . '/',
'/download/',
'/lazaret/'
)
, $file
);
$response->headers->set('X-Sendfile', $file);
$response->headers->set('X-Accel-Redirect', $file_xaccel);
@@ -989,13 +980,13 @@ class set_export extends set_abstract
else
{
/**
*
*
* Header "Pragma: public" SHOULD be present.
* In case it is not present, download on IE 8 and previous over HTTPS
* will fail.
*
*
* @todo : merge this shitty fix with Response object.
*
*
*/
if (!headers_sent())
{
@@ -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;
}
}
@@ -1034,7 +1026,7 @@ class set_export extends set_abstract
header("Content-Length: " . strlen($data));
header("Cache-Control: max-age=3600, must-revalidate ");
header("Content-Disposition: " . $disposition
. "; filename=" . $exportname . ";");
. "; filename=" . $exportname . ";");
echo $data;
@@ -1052,9 +1044,9 @@ class set_export extends set_abstract
public static function log_download(Array $list, $type, $anonymous = false, $comment = '')
{
//download
$appbox = appbox::get_instance();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$user = false;
$user = false;
if ($anonymous)
{
@@ -1068,8 +1060,8 @@ class set_export extends set_abstract
$files = $list['files'];
$event_names = array(
'mail-export' => Session_Logger::EVENT_EXPORTMAIL,
'download' => Session_Logger::EVENT_EXPORTDOWNLOAD
'mail-export' => Session_Logger::EVENT_EXPORTMAIL,
'download' => Session_Logger::EVENT_EXPORTDOWNLOAD
);
$event_name = isset($event_names[$type]) ? $event_names[$type] : Session_Logger::EVENT_EXPORTDOWNLOAD;
@@ -1078,18 +1070,18 @@ class set_export extends set_abstract
{
foreach ($record["subdefs"] as $o => $obj)
{
$sbas_id = phrasea::sbasFromBas($record['base_id']);
$sbas_id = phrasea::sbasFromBas($record['base_id']);
$record_object = new record_adapter($sbas_id, $record['record_id']);
$session->get_logger($record_object->get_databox())
->log($record_object, $event_name, $o, $comment);
->log($record_object, $event_name, $o, $comment);
if ($o != "caption")
{
$log["rid"] = $record_object->get_record_id();
$log["subdef"] = $o;
$log["poids"] = $obj["size"];
$log["shortXml"] = $record_object->get_xml();
$log["rid"] = $record_object->get_record_id();
$log["subdef"] = $o;
$log["poids"] = $obj["size"];
$log["shortXml"] = $record_object->get_xml();
$tmplog[$record_object->get_base_id()][] = $log;
if (!$anonymous && $o == 'document')
$user->ACL()->remove_remaining($record_object->get_base_id());
@@ -1100,9 +1092,9 @@ class set_export extends set_abstract
}
$export_types = array(
'download' => 0,
'mail-export' => 2,
'ftp' => 4
'download' => 0,
'mail-export' => 2,
'ftp' => 4
);
$list_base = array_unique(array_keys($tmplog));
@@ -1120,9 +1112,9 @@ class set_export extends set_abstract
if ($user->ACL()->is_restricted_download($base_id))
{
$params = array(
':remain_dl' => $user->ACL()->remaining_download($base_id)
, ':base_id' => $base_id
, ':usr_id' => $user->get_id()
':remain_dl' => $user->ACL()->remaining_download($base_id)
, ':base_id' => $base_id
, ':usr_id' => $user->get_id()
);
$stmt->execute($params);

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)
{
@@ -31,12 +33,12 @@ class task_Scheduler
}
$registry = registry::get_instance();
$logdir = $registry->get('GV_RootPath') . 'logs/';
$logdir = $registry->get('GV_RootPath') . 'logs/';
logs::rotate($logdir . "scheduler.log");
$date_obj = new DateTime();
$message = sprintf("%s %s \n", $date_obj->format(DATE_ATOM), $message);
$message = sprintf("%s %s \n", $date_obj->format(DATE_ATOM), $message);
file_put_contents($logdir . "scheduler.log", $message, FILE_APPEND);
@@ -47,14 +49,19 @@ 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)
{
require_once dirname(__FILE__) . '/../../bootstrap.php';
$this->output = $output;
$appbox = appbox::get_instance();
$appbox = appbox::get_instance();
$registry = $appbox->get_registry();
$system = system_server::get_platform();
@@ -63,7 +70,7 @@ class task_Scheduler
for ($try = 0; true; $try++)
{
$schedlock = fopen(($lockfile = ($lockdir . 'scheduler.lock')), 'a+');
$schedlock = fopen(($lockfile = ($lockdir . 'scheduler.lock')), 'a+');
if (flock($schedlock, LOCK_EX | LOCK_NB) != true)
{
$this->log(sprintf("failed to lock '%s' (try=%s/4)", $lockfile, $try));
@@ -96,7 +103,7 @@ class task_Scheduler
$sleeptime = 3;
$sql = "UPDATE sitepreff SET schedstatus='started', schedpid = :pid";
$sql = "UPDATE sitepreff SET schedstatus='started', schedpid = :pid";
$stmt = $conn->prepare($sql);
$stmt->execute(array(':pid' => getmypid()));
$stmt->closeCursor();
@@ -139,14 +146,14 @@ class task_Scheduler
$this->log(sprintf("Warning : abox connection lost, restarting in 10 min."));
}
sleep(60 * 10);
$conn = self::get_connection();
$conn = self::get_connection();
$connwaslost = true;
}
if ($connwaslost)
{
$this->log("abox connection restored");
$sql = 'UPDATE task SET crashed=0';
$sql = 'UPDATE task SET crashed=0';
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
@@ -155,10 +162,10 @@ class task_Scheduler
}
$schedstatus = '';
$sql = "SELECT schedstatus FROM sitepreff";
$stmt = $conn->prepare($sql);
$sql = "SELECT schedstatus FROM sitepreff";
$stmt = $conn->prepare($sql);
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ($row)
@@ -168,13 +175,13 @@ class task_Scheduler
if ($schedstatus == 'tostop')
{
$sql = 'UPDATE sitepreff SET schedstatus = "stopping"';
$sql = 'UPDATE sitepreff SET schedstatus = "stopping"';
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
// if scheduler is stopped, stop the tasks
$sql = 'UPDATE task2 SET status="tostop" WHERE status != "stopped" and status != "manual"';
$sql = 'UPDATE task2 SET status="tostop" WHERE status != "stopped" and status != "manual"';
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->closeCursor();
@@ -194,10 +201,10 @@ class task_Scheduler
$ttask[$tkey]["todel"] = true;
}
$sql = "SELECT * FROM task2";
$sql = "SELECT * FROM task2";
$stmt = $conn->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
foreach ($task_manager->get_tasks(true) as $task)
@@ -218,27 +225,27 @@ class task_Scheduler
case "WINDOWS":
case "LINUX":
$cmd = $phpcli . ' -f '
. $registry->get('GV_RootPath')
. "bin/console task:run "
. $task->get_task_id()
. " --runner=scheduler ";
. $registry->get('GV_RootPath')
. "bin/console task:run "
. $task->get_task_id()
. " --runner=scheduler ";
break;
}
$ttask[$tkey] = array(
"task" => $task,
"current_status" => $task->get_status(),
"process" => null,
"cmd" => $cmd,
"killat" => null,
"pipes" => null
"task" => $task,
"current_status" => $task->get_status(),
"process" => null,
"cmd" => $cmd,
"killat" => null,
"pipes" => null
);
$this->log(
sprintf(
"new Task %s, status=%s"
, $ttask[$tkey]["task"]->get_task_id()
, $task->get_status()
)
sprintf(
"new Task %s, status=%s"
, $ttask[$tkey]["task"]->get_task_id()
, $task->get_status()
)
);
}
else
@@ -246,17 +253,17 @@ class task_Scheduler
if ($ttask[$tkey]["current_status"] != $task->get_status())
{
$this->log(
sprintf(
"Task %s, oldstatus=%s, newstatus=%s"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["current_status"]
, $task->get_status()
)
sprintf(
"Task %s, oldstatus=%s, newstatus=%s"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["current_status"]
, $task->get_status()
)
);
$ttask[$tkey]["current_status"] = $task->get_status();
}
$ttask[$tkey]["task"] = $task;
$ttask[$tkey]["task"] = $task;
}
$ttask[$tkey]["todel"] = false;
}
@@ -275,32 +282,32 @@ class task_Scheduler
* Launch task that are not yet launched
*/
$runningtask = 0;
$common_status = array(
task_abstract::STATUS_STARTED
, task_abstract::RETURNSTATUS_STOPPED
task_abstract::STATUS_STARTED
, task_abstract::RETURNSTATUS_STOPPED
);
foreach ($ttask as $tkey => $tv)
{
if (!in_array($ttask[$tkey]["task"]->get_status(), $common_status))
{
$this->log(
sprintf(
'task %s has status %s'
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["task"]->get_status()
)
sprintf(
'task %s has status %s'
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["task"]->get_status()
)
);
}
switch ($ttask[$tkey]["task"]->get_status())
{
default:
$this->log(
sprintf(
'Unknow status `%s`'
, $ttask[$tkey]["task"]->get_status()
)
sprintf(
'Unknow status `%s`'
, $ttask[$tkey]["task"]->get_status()
)
);
break;
case task_abstract::RETURNSTATUS_TORESTART:
@@ -319,31 +326,31 @@ class task_Scheduler
if ($schedstatus == 'started' && !$ttask[$tkey]["process"])
{
$descriptors = array(
1 => array("pipe", "w")
, 2 => array("pipe", "w")
1 => array("pipe", "w")
, 2 => array("pipe", "w")
);
if ($log_tasks === true)
{
$descriptors[1] = array(
"file"
, $logdir . "task_$tkey.log"
, "a+"
"file"
, $logdir . "task_$tkey.log"
, "a+"
);
$descriptors[2] = array(
"file"
, $logdir . "task_$tkey.error.log"
, "a+"
"file"
, $logdir . "task_$tkey.error.log"
, "a+"
);
}
$ttask[$tkey]["process"] = proc_open(
$ttask[$tkey]["cmd"]
, $descriptors
, $ttask[$tkey]["pipes"]
, $registry->get('GV_RootPath') . "bin/"
, null
, array('bypass_shell' => true)
$ttask[$tkey]["cmd"]
, $descriptors
, $ttask[$tkey]["pipes"]
, $registry->get('GV_RootPath') . "bin/"
, null
, array('bypass_shell' => true)
);
if (is_resource($ttask[$tkey]["process"]))
@@ -356,12 +363,12 @@ class task_Scheduler
if ($ttask[$tkey]['task']->get_pid() !== null)
{
$this->log(
sprintf(
"Task %s '%s' started (pid=%s)"
, $ttask[$tkey]['task']->get_task_id()
, $ttask[$tkey]["cmd"]
, $ttask[$tkey]['task']->get_pid()
)
sprintf(
"Task %s '%s' started (pid=%s)"
, $ttask[$tkey]['task']->get_task_id()
, $ttask[$tkey]["cmd"]
, $ttask[$tkey]['task']->get_pid()
)
);
$runningtask++;
}
@@ -375,12 +382,12 @@ class task_Scheduler
$ttask[$tkey]["process"] = null;
$this->log(
sprintf(
"Task %s '%s' failed to start %d times"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["cmd"]
, $ttask[$tkey]["task"]->get_crash_counter()
)
sprintf(
"Task %s '%s' failed to start %d times"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["cmd"]
, $ttask[$tkey]["task"]->get_crash_counter()
)
);
$ttask[$tkey]["task"]->increment_crash_counter();
@@ -411,7 +418,7 @@ class task_Scheduler
if ($proc_status['running'])
$runningtask++;
else
$crashed = true;
$crashed = true;
}
else
{
@@ -433,11 +440,11 @@ class task_Scheduler
$ttask[$tkey]["process"] = null;
$this->log(
sprintf(
"Task %s crashed %d times"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["task"]->get_crash_counter()
)
sprintf(
"Task %s crashed %d times"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["task"]->get_crash_counter()
)
);
@@ -459,7 +466,7 @@ class task_Scheduler
{
if ($ttask[$tkey]["killat"] === NULL)
$ttask[$tkey]["killat"] = time() + self::TASKDELAYTOQUIT;
if (($dt = $ttask[$tkey]["killat"] - time()) < 0)
if (($dt = $ttask[$tkey]["killat"] - time()) < 0)
{
$ppid = $ttask[$tkey]['task']->get_pid();
$pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`);
@@ -473,11 +480,11 @@ class task_Scheduler
}
$this->log(
sprintf(
"SIGKILL sent to task %s (pid=%s)"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["task"]->get_pid()
)
sprintf(
"SIGKILL sent to task %s (pid=%s)"
, $ttask[$tkey]["task"]->get_task_id()
, $ttask[$tkey]["task"]->get_pid()
)
);
proc_terminate($ttask[$tkey]["process"], 9);
@@ -493,11 +500,11 @@ class task_Scheduler
else
{
$this->log(
sprintf(
"waiting task %s to quit (kill in %d seconds)"
, $ttask[$tkey]["task"]->get_task_id()
, $dt
)
sprintf(
"waiting task %s to quit (kill in %d seconds)"
, $ttask[$tkey]["task"]->get_task_id()
, $dt
)
);
$runningtask++;
}
@@ -523,6 +530,7 @@ class task_Scheduler
{
$conn->close();
unset($conn);
self::$connection = null;
$to_reopen = true;
}
sleep($sleeptime);
@@ -532,7 +540,7 @@ class task_Scheduler
}
}
$sql = "UPDATE sitepreff SET schedstatus='stopped', schedpid='0'";
$sql = "UPDATE sitepreff SET schedstatus='stopped', schedpid='0'";
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->closeCursor();

View File

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

View File

@@ -825,7 +825,20 @@ class task_period_archive extends task_abstract
$xp = new DOMXPath($dom);
while (($file = $listFolder->read()) !== NULL)
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))
continue;

View File

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

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

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;
}
@@ -241,7 +242,7 @@ class task_period_upgradetov32 extends task_abstract
}
catch (Exception $e)
{
}
}
@@ -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;
}
}
@@ -408,9 +411,9 @@ class task_period_upgradetov32 extends task_abstract
$stmt->closeCursor();
$this->setProgress(0, 0);
$this->return_value = self::RETURNSTATUS_TODELETE;
flush();
return;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@
*/
/**
*
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
@@ -40,7 +40,7 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
$session->logout();
parent::tearDown();
}
// public static function setUpBeforeClass()
// {
// parent::setUpBeforeClass();
@@ -55,4 +55,4 @@ abstract class PhraseanetPHPUnitAuthenticatedAbstract extends PhraseanetPHPUnitA
// parent::tearDownAfterClass();
// }
}
}

View File

@@ -10,7 +10,7 @@
*/
/**
*
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
@@ -34,4 +34,4 @@ abstract class PhraseanetWebTestCaseAbstract extends PhraseanetPHPUnitAbstract
$this->app = $this->createApplication();
}
}
}

View File

@@ -10,7 +10,7 @@
*/
/**
*
*
* @package
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
@@ -35,4 +35,4 @@ abstract class PhraseanetWebTestCaseAuthenticatedAbstract extends PhraseanetPHPU
$this->app = $this->createApplication();
}
}
}

View File

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

View File

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

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;
}
@@ -211,7 +212,7 @@ class Module_Prod_Route_RecordFeedApp extends PhraseanetWebTestCaseAuthenticated
// }
// catch (Exception $e)
// {
//
//
// }
// }
//

View File

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

View File

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

View File

@@ -29,12 +29,9 @@ class searchEngine_optionsTest extends PhraseanetPHPUnitAuthenticatedAbstract
*/
public function tearDown()
{
}
/**
* @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

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

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

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

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