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

This commit is contained in:
Nicolas Le Goff
2012-01-25 19:02:26 +01:00
41 changed files with 610 additions and 723 deletions

View File

@@ -74,7 +74,6 @@ return call_user_func(
{
/* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig();
// var_dump($twig->getLoader()->getPaths());
$browser = \Browser::getInstance();
if (!$browser->isMobile())

View File

@@ -566,7 +566,7 @@ class Edit extends RecordHelper
)
);
$record->set_metadatas($metas);
$record->set_metadatas($metas, true);
}
$newstat = $record->get_status();

View File

@@ -18,4 +18,17 @@
class Exception_Session_MailLocked extends Exception
{
protected $usr_id;
public function __construct($usr_id = null, $message = null, $code = null, $previous = null)
{
$this->usr_id = $usr_id;
parent::__construct($message, $code, $previous);
}
public function get_usr_id()
{
return $this->usr_id;
}
}

View File

@@ -141,7 +141,7 @@ class Session_Authentication_Native implements Session_Authentication_Interface
$stmt->closeCursor();
if ($row && $row['mail_locked'] == "1")
throw new Exception_Session_MailLocked();
throw new Exception_Session_MailLocked($this->user->get_id());
return $this;
}

View File

@@ -256,7 +256,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
$body .= "<br/>\n<div>"
. _('admin::register: l\'utilisateur s\'est inscrit sur les bases suivantes')
. "</div>\n";
$body .= "<ul>";
$body .= "<ul>\n";
foreach ($base_ids->base_id as $base_id)
{
@@ -265,7 +265,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
. ' - ' . phrasea::bas_names((string) $base_id) . "</li>\n";
}
$body .= "</ul>";
$body .= "</ul>\n";
$body .= "<br/>\n<div><a href='/login/?redirect=/admin' target='_blank'>"
. _('admin::register: vous pourrez consulter son compte en ligne via l\'interface d\'administration')

View File

@@ -261,7 +261,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
$body .= "<br/>\n<div>"
. _('admin::register: les demandes de l\'utilisateur portent sur les bases suivantes')
. "</div>\n";
$body .= "<ul>";
$body .= "<ul>\n";
foreach ($base_ids->base_id as $base_id)
{
@@ -271,7 +271,7 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
. phrasea::bas_names((string) $base_id) . "</li>\n";
}
$body .= "</ul>";
$body .= "</ul>\n";
$body .= "<br/>\n<div><a href='" . $this->registry->get('GV_ServerName')
. "login/admin' target='_blank'>"

View File

@@ -2,7 +2,16 @@
class geonames
{
protected static $NamesFromId = array();
protected static $CountryFromId = array();
protected static $CountryCodeFromId = array();
protected static $GeonameFromIp = array();
protected static $Searches = array();
public function name_from_id($geonameid)
{
$registry = registry::get_instance();

View File

@@ -25,26 +25,37 @@ class http_query
*/
public static function getHttpCodeFromUrl($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
if (!is_scalar($url))
return null;
curl_exec($ch);
$result = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (trim($url) === '')
return null;
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
return $result;
curl_exec($ch);
$result = (int) curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $result;
}
public static function getHttpHeaders($url)
{
if (!is_scalar($url))
return null;
if (trim($url) === '')
return null;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
@@ -69,24 +80,30 @@ class http_query
* @param array $post_data
* @return string
*/
public static function getUrl($url, $post_data=false)
public static function getUrl($url, $post_data = false)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
if (!is_scalar($url))
return null;
if ($post_data)
{
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
if (trim($url) === '')
return null;
$result = (curl_exec($ch));
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, 1);
if ($post_data)
{
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
$result = (curl_exec($ch));
curl_close($ch);
return $result;
}

View File

@@ -170,7 +170,7 @@ class mail
public static function mail_confirmation($email, $usr_id)
{
$registry = registry::get_instance();
$expire = new DateTime('+3 days');
$token = random::getUrlToken('password', $usr_id, $expire, $email);
@@ -256,7 +256,7 @@ class mail
$mail->ConfirmReadingTo = $reading_confirm_to;
}
$mail->MsgHTML(strip_tags($body, '<div><br>'));
$mail->MsgHTML(strip_tags($body, '<div><br><ul><li>'));
foreach ($files as $f)
{

View File

@@ -23,171 +23,205 @@ class module_report
* @var string - timestamp
*/
protected $dmin;
/**
* End date of the report
* @var string - timestamp
*/
protected $dmax;
/**
* Id of the base we want to connect
* @var int
*/
protected $sbas_id;
/**
* Id of the current app's box user
* @var int
*/
protected $user_id;
/**
* The result of the report
* @var array
*/
public $report = array();
/**
* The title of the report
* @var string
*/
protected $title = '';
/**
* default displayed value in the formated tab
* @var array
*/
protected $display = array();
/**
* ?
* @var <array>
*/
protected $default_display = array();
/**
* Contain all the field from the sql request
* @var array
*/
protected $champ = array();
/**
* result of the report
* @var array
*/
protected $result = array();
/**
* The id of all collections from a databox
* @var string
*/
protected $list_coll_id = '';
/**
* The number of record displayed by page if enable limit is false
* @var int
*/
protected $nb_record = 30;
/**
* The current number of the page where are displaying the results
* @var int
*/
protected $nb_page = 1;
/**
* check if there is a previous page
* @var <bool>
*/
protected $previous_page = false;
/**
* check if there is a next page
* @var <bool>
*/
protected $next_page = false;
/**
*
* @var int total of result
*/
protected $total = 0;
/**
* the request executed
*/
protected $req = '';
/**
* the request executed
*/
protected $params = array();
/**
* do we display next and previous button
* @var bool
*/
protected $display_nav = false;
/**
* do we display the configuration button
* @var <bool>
*/
protected $config = true;
/**
* gettext tags for days
* @var <array>
*/
protected $jour;
/**
* gettext tags for month
* @var <array>
*/
protected $month;
/**
* The name of the database
* @var string
*/
protected $dbname;
/**
* The periode displayed in a string of the report
* @var string
*/
protected $periode;
/**
* filter executed on report choose by the user
* @var array;
*/
protected $tab_filter = array();
/**
* column displayed in the report choose by the user
* @var <array>
*/
protected $active_column = array();
/**
* array that contains the string displayed
* foreach filters
* @var <array>
*/
protected $posting_filter = array();
/**
* The ORDER BY filters of the query
* by default is empty
* @var array
*/
protected $tab_order = array();
/**
* define columns that are boundable
* @var <array>
*/
protected $bound = array();
/**
* do we display print button
* @var <bool>
*/
protected $print = true;
/**
* do we display csv button
* @var <bool>
*/
protected $csv = true;
/**
* do we enable limit filter for the report
* @var bool
*/
protected $enable_limit = true;
/**
* gettext correspondance for all available columns in report
* @var array
*/
protected $cor = array();
/**
* group result of a report this is the name ogf the grouped column
* @var string
*/
protected $groupby;
/**
* disbale or enable pretty string useful for export in csv
* @var boolean
@@ -197,9 +231,8 @@ class module_report
/**
*
*/
protected $cor_query = array();/* ~*~*~*~*~*~*~*~*~*~*~*~ */
/* METHODS, VARIABLES */
/* ~*~*~*~*~*~*~*~*~*~*~*~ */
protected $cor_query = array();
protected $isInformative;
/**
* Constructor
@@ -212,7 +245,7 @@ class module_report
*/
public function __construct($d1, $d2, $sbas_id, $collist)
{
$appbox = appbox::get_instance();
$appbox = appbox::get_instance();
$session = $appbox->get_session();
$this->dmin = $d1;
$this->dmax = $d2;
@@ -220,13 +253,23 @@ class module_report
$this->list_coll_id = $collist;
$this->user_id = $session->get_usr_id();
$this->periode = phraseadate::getPrettyString(new DateTime($d1))
. ' - ' . phraseadate::getPrettyString(new DateTime($d2));
. ' - ' . phraseadate::getPrettyString(new DateTime($d2));
$this->dbname = phrasea::sbas_names($sbas_id);
$this->cor = $this->setCor();
$this->jour = $this->setDay();
$this->month = $this->setMonth();
}
public function IsInformative()
{
return $this->isInformative;
}
public function setIsInformative($isInformative)
{
$this->isInformative = $isInformative;
}
public function getUser_id()
{
return $this->user_id;
@@ -242,7 +285,6 @@ class module_report
$this->user_id = $user_id;
}
public function getSbas_id()
{
return $this->sbas_id;
@@ -253,7 +295,7 @@ class module_report
$this->sbas_id = $sbas_id;
}
public function setPrettyString($bool)
public function setPrettyString($bool)
{
$this->pretty_string = $bool;
}
@@ -301,8 +343,6 @@ class module_report
$this->req = $sql;
}
public function getPeriode()
{
return $this->periode;
@@ -342,9 +382,9 @@ class module_report
public function setActiveColumn(array $active_column)
{
$this->active_column = $active_column;
$this->active_column = $active_column;
return $this;
return $this;
}
public function getActiveColumn()
@@ -460,7 +500,6 @@ class module_report
public function getOrder($k = false)
{
if ($k === false)
return $this->tab_order;
return $this->tab_order[$k];
}
@@ -509,6 +548,7 @@ class module_report
{
$this->total = $total;
}
public function getDefault_display()
{
return $this->default_display;
@@ -524,7 +564,6 @@ class module_report
return $this->champ;
}
/**
* Retourne un objet qui genere la requete selon le type de report
* @param string $domain
@@ -619,28 +658,28 @@ class module_report
private function setCor()
{
return array(
'user' => _('report:: utilisateur'),
'coll_id' => _('report:: collections'),
'connexion' => _('report:: Connexion'),
'comment' => _('report:: commentaire'),
'search' => _('report:: question'),
'date' => _('report:: date'),
'ddate' => _('report:: date'),
'fonction' => _('report:: fonction'),
'activite' => _('report:: activite'),
'pays' => _('report:: pays'),
'societe' => _('report:: societe'),
'nb' => _('report:: nombre'),
'pourcent' => _('report:: pourcentage'),
'telechargement' => _('report:: telechargement'),
'record_id' => _('report:: record id'),
'final' => _('report:: type d\'action'),
'xml' => _('report:: sujet'),
'file' => _('report:: fichier'),
'mime' => _('report:: type'),
'size' => _('report:: taille'),
'copyright' => _('report:: copyright'),
'final' => _('phraseanet:: sous definition')
'user' => _('report:: utilisateur'),
'coll_id' => _('report:: collections'),
'connexion' => _('report:: Connexion'),
'comment' => _('report:: commentaire'),
'search' => _('report:: question'),
'date' => _('report:: date'),
'ddate' => _('report:: date'),
'fonction' => _('report:: fonction'),
'activite' => _('report:: activite'),
'pays' => _('report:: pays'),
'societe' => _('report:: societe'),
'nb' => _('report:: nombre'),
'pourcent' => _('report:: pourcentage'),
'telechargement' => _('report:: telechargement'),
'record_id' => _('report:: record id'),
'final' => _('report:: type d\'action'),
'xml' => _('report:: sujet'),
'file' => _('report:: fichier'),
'mime' => _('report:: type'),
'size' => _('report:: taille'),
'copyright' => _('report:: copyright'),
'final' => _('phraseanet:: sous definition')
);
return;
@@ -653,13 +692,13 @@ class module_report
private function setDay()
{
return Array(
1 => _('phraseanet::jours:: lundi'),
2 => _('phraseanet::jours:: mardi'),
3 => _('phraseanet::jours:: mercredi'),
4 => _('phraseanet::jours:: jeudi'),
5 => _('phraseanet::jours:: vendredi'),
6 => _('phraseanet::jours:: samedi'),
7 => _('phraseanet::jours:: dimanche'));
1 => _('phraseanet::jours:: lundi'),
2 => _('phraseanet::jours:: mardi'),
3 => _('phraseanet::jours:: mercredi'),
4 => _('phraseanet::jours:: jeudi'),
5 => _('phraseanet::jours:: vendredi'),
6 => _('phraseanet::jours:: samedi'),
7 => _('phraseanet::jours:: dimanche'));
}
/**
@@ -669,18 +708,18 @@ class module_report
private function setMonth()
{
return array(
_('janvier'),
_('fevrier'),
_('mars'),
_('avril'),
_('mai'),
_('juin'),
_('juillet'),
_('aout'),
_('septembre'),
_('octobre'),
_('novembre'),
_('decembre')
_('janvier'),
_('fevrier'),
_('mars'),
_('avril'),
_('mai'),
_('juin'),
_('juillet'),
_('aout'),
_('septembre'),
_('octobre'),
_('novembre'),
_('decembre')
);
}
@@ -748,21 +787,21 @@ class module_report
if (array_key_exists($column, $this->cor))
{
$title_text = $this->cor[$column];
$def = true;
$def = true;
}
empty($row[0]) ? $title = $column : $title = $row[0];
empty($row[0]) ? $title = $column : $title = $row[0];
$sort = $row[1];
$sort = $row[1];
array_key_exists($column, $this->bound) ?
$bound = $this->bound[$column] : $bound = $row[2];
$filter = (isset($row[3]) ? $row[3] : 0);
$bound = $this->bound[$column] : $bound = $row[2];
$filter = (isset($row[3]) ? $row[3] : 0);
$groupby = $row[4];
$config = array(
'title' => $title,
'sort' => $sort,
'bound' => $bound,
'filter' => $filter,
'groupby' => $groupby
$config = array(
'title' => $title,
'sort' => $sort,
'bound' => $bound,
'filter' => $filter,
'groupby' => $groupby
);
$def ? $config['title'] = $title_text : "";
@@ -780,7 +819,6 @@ 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);
@@ -792,10 +830,10 @@ class module_report
{
$stmt = $conn->prepare($this->req);
$stmt->execute($this->params);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor();
}
catch(PDOException $e)
catch (PDOException $e)
{
echo $e->getMessage();
@@ -837,13 +875,13 @@ class module_report
{
if ($attribut)
{
foreach ($sxe->$champ->attributes() as $a => $b)
foreach ($sxe->$champ->attributes() as $a => $b)
{
if ($a == $attribut)
{
if ($a == $attribut)
{
$ret.= $b;
}
$ret.= $b;
}
}
}
else
{
@@ -871,7 +909,7 @@ class module_report
$tab["struct"] = "";
$tab['champs'] = array();
$databox = databox::get_instance((int) $sbasid);
$databox = databox::get_instance((int) $sbasid);
$tab['struct'] = $databox->get_structure();
$sxe = $databox->get_sxml_structure();
@@ -897,7 +935,7 @@ class module_report
public static function getHost($url)
{
$parse_url = parse_url(trim($url));
$result = isset($parse_url['host']) ? $parse_url['host'] : array_shift(explode('/', $parse_url['path'], 2));
$result = isset($parse_url['host']) ? $parse_url['host'] : array_shift(explode('/', $parse_url['path'], 2));
return trim($result);
}

View File

@@ -38,8 +38,7 @@ class module_report_download extends module_report
'mime' => 'subdef.mime',
'file' => 'subdef.file'
);
protected $isInformative;
/**
* constructor
*
@@ -278,16 +277,6 @@ class module_report_download extends module_report
return $array;
}
public function IsInformative()
{
return $this->isInformative;
}
public function setIsInformative($isInformative)
{
$this->isInformative = $isInformative;
}
}

View File

@@ -70,7 +70,6 @@ class module_report_sqldownload extends module_report_sql implements module_repo
$this->sql .= $this->filter->getOrderFilter() ? : '';
// var_dump(str_replace(array_keys($this->params), array_values($this->params), $this->sql), $this->sql, $this->params);
$stmt = $this->connbas->prepare($this->sql);
$stmt->execute($this->params);
$this->total_row = $stmt->rowCount();

View File

@@ -113,7 +113,7 @@ class p4file
{
$record = record_adapter::create($collection, $system_file, $name);
$record_id = $record->get_record_id();
$record->set_metadatas($metadatas['metadatas']);
$record->set_metadatas($metadatas['metadatas'], true);
}
catch (Exception $e)
{

View File

@@ -85,7 +85,7 @@ interface record_Interface
public function substitute_subdef($name, system_file $pathfile);
public function set_metadatas(Array $metadatas);
public function set_metadatas(Array $metadatas, $force_readonly = false);
public function reindex();

View File

@@ -862,6 +862,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
, 'meta_id' => $value->getId()
, 'value' => $original_name
)
, true
);
}
}
@@ -1211,8 +1212,20 @@ class record_adapter implements record_Interface, cache_cacheableInterface
$stmt->execute(array(':record_id' => $this->get_record_id()));
$stmt->closeCursor();
try
{
$subdef = $this->get_subdef($name);
$subdef->delete_data_from_cache();
}
catch (Exception $e)
{
}
$this->delete_data_from_cache(self::CACHE_SUBDEFS);
if ($meta_writable)
{
$this->write_metas();
@@ -1337,13 +1350,20 @@ class record_adapter implements record_Interface, cache_cacheableInterface
* @param array $metadatas
* @return record_adapter
*/
public function set_metadatas(Array $metadatas)
public function set_metadatas(Array $metadatas, $force_readonly = false)
{
foreach ($metadatas as $param)
{
if (!is_array($param))
throw new Exception_InvalidArgument();
$db_field = \databox_field::get_instance($this->get_databox(), $param['meta_struct_id']);
if ($db_field->is_readonly() === false && !$force_readonly)
{
continue;
}
$this->set_metadata($param, $this->databox);
}

Binary file not shown.

View File

@@ -292,7 +292,7 @@ class recordutils_image extends recordutils
$txtlines = recordutils_image::wrap(
$fontsize,
0,
$registry->get('GV_RootPath') . 'lib/stamper/arial.ttf',
__DIR__ . '/arial.ttf',
$txtline,
$text_width
);
@@ -352,7 +352,7 @@ class recordutils_image extends recordutils
{
imagettftext($im, $block['s'], 0, $block['x'],
$txt_ypos - $block['dy'], $black,
$registry->get('GV_RootPath') . 'lib/stamper/arial.ttf', $block['t']);
__DIR__ . '/arial.ttf', $block['t']);
$txt_ypos += $block['h'];
}
imagecolordeallocate($im, $black);

View File

@@ -713,8 +713,6 @@ class system_file extends SplFileObject
public function read_uuid()
{
$registry = registry::get_instance();
if ($this->uuid)
return $this->uuid;
@@ -1135,12 +1133,12 @@ class system_file extends SplFileObject
foreach ($tmpval as $val)
{
$ret[] = array(
'meta_struct_id' => $meta->get_id(),
'meta_id' => null,
$ret[] = array(
'meta_struct_id' => $meta->get_id(),
'meta_id' => null,
'value' => $val
);
}
);
}
}
@@ -1390,7 +1388,7 @@ if (!function_exists('mime_content_type'))
, 'movie' => 'video/x-sgi-movie' // Videos MoviePlayer
);
$fileinfo = new system_file($f);
$extension = $fileinfo->get_extension(true);
$ext = $fileinfo->get_extension(true);
return array_key_exists($ext, $ext2mime) ?
$ext2mime[$ext] : 'application/octet-stream';

View File

@@ -1538,7 +1538,7 @@ class task_period_archive extends task_abstract
$collection = collection::get_from_coll_id($databox, $cid);
$record = record_adapter::create($collection, $system_file, false, true);
$record->set_metadatas($meta['metadatas']);
$record->set_metadatas($meta['metadatas'], true);
$record->set_binary_status(databox_status::operation_or($stat0, $stat1));
$record->rebuild_subdefs();
$record->reindex();
@@ -1879,7 +1879,7 @@ class task_period_archive extends task_abstract
{
$collection = collection::get_from_base_id($base_id);
$record = record_adapter::create($collection, $system_file, false, false);
$record->set_metadatas($meta['metadatas']);
$record->set_metadatas($meta['metadatas'], true);
$record->set_binary_status(databox_status::operation_or(databox_status::operation_or($stat0, $stat1), databox_status::hex2bin($hexstat)));
$record->rebuild_subdefs();
$record->reindex();

View File

@@ -100,7 +100,7 @@ class task_period_batchupload extends task_appboxAbstract
$collection = collection::get_from_coll_id($databox, $coll_id);
$record = record_adapter::create($collection, $system_file, $row2['filename'], false);
$record->set_metadatas($meta['metadatas']);
$record->set_metadatas($meta['metadatas'], true);
$record->rebuild_subdefs();
$record->reindex();
unset($record);

View File

@@ -1232,9 +1232,6 @@ class task_period_outofdate extends task_abstract
);
phrasea::headers(200, true, 'application/json', 'UTF-8', false);
// return("hello4");
//var_dump($parm2);
//return;
$ret = NULL;
switch($parm2['ACT'])
{

View File

@@ -338,7 +338,7 @@ class task_period_upgradetov32 extends task_abstract
}
}
}
$record->set_metadatas($metadatas);
$record->set_metadatas($metadatas, true);
unset($record);
}
catch (Exception $e)

View File

@@ -282,7 +282,6 @@ class task_period_writemeta extends task_databoxAbstract
{
$coll_id = $row['coll_id'];
$record_id = $row['record_id'];
$base_id = phrasea::baseFromColl($this->sbas_id, $coll_id);
$jeton = $row['jeton'];
$record = new record_adapter($this->sbas_id, $record_id);
@@ -303,92 +302,51 @@ class task_period_writemeta extends task_databoxAbstract
}
}
$uuid = $record->get_uuid();
$registry = $databox->get_registry();
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
$dom->preserveWhiteSpace = true;
$noderoot = $dom->appendChild($dom->createElement('rdf:RDF'));
$noderoot->setAttribute('xmlns:rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#');
$nodedesc = $noderoot->appendChild($dom->createElement('rdf:Description'));
if ($uuid)
{
$node = $nodedesc->appendChild($dom->createElement('XMP-exif:ImageUniqueID'));
$node->appendChild($dom->createTextNode($uuid));
$node = $nodedesc->appendChild($dom->createElement('IPTC:UniqueDocumentID'));
$node->appendChild($dom->createTextNode($uuid));
}
$nodedesc->setAttribute('xmlns:et', 'http://ns.exiftool.ca/1.0/');
$nodedesc->setAttribute('et:toolkit', 'Image::ExifTool 7.62');
$nodedesc->setAttribute('xmlns:ExifTool', 'http://ns.exiftool.ca/ExifTool/1.0/');
$nodedesc->setAttribute('xmlns:File', 'http://ns.exiftool.ca/File/1.0/');
$nodedesc->setAttribute('xmlns:JFIF', 'http://ns.exiftool.ca/JFIF/JFIF/1.0/');
$nodedesc->setAttribute('xmlns:Photoshop', 'http://ns.exiftool.ca/Photoshop/Photoshop/1.0/');
$nodedesc->setAttribute('xmlns:IPTC', 'http://ns.exiftool.ca/IPTC/IPTC/1.0/');
$nodedesc->setAttribute('xmlns:Adobe', 'http://ns.exiftool.ca/APP14/Adobe/1.0/');
$nodedesc->setAttribute('xmlns:FotoStation', 'http://ns.exiftool.ca/FotoStation/FotoStation/1.0/');
$nodedesc->setAttribute('xmlns:File2', 'http://ns.exiftool.ca/File/1.0/');
$nodedesc->setAttribute('xmlns:IPTC2', 'http://ns.exiftool.ca/IPTC/IPTC2/1.0/');
$nodedesc->setAttribute('xmlns:Composite', 'http://ns.exiftool.ca/Composite/1.0/');
$nodedesc->setAttribute('xmlns:IFD0', 'http://ns.exiftool.ca/EXIF/IFD0/1.0/');
$nodedesc->setAttribute('xmlns:XMP-x', 'http://ns.exiftool.ca/XMP/XMP-x/1.0/');
$nodedesc->setAttribute('xmlns:XMP-exif', 'http://ns.exiftool.ca/XMP/XMP-exif/1.0/');
$nodedesc->setAttribute('xmlns:XMP-photoshop', 'http://ns.exiftool.ca/XMP/XMP-photoshop/1.0/');
$nodedesc->setAttribute('xmlns:XMP-tiff', 'http://ns.exiftool.ca/XMP/XMP-tiff/1.0/');
$nodedesc->setAttribute('xmlns:XMP-xmp', 'http://ns.exiftool.ca/XMP/XMP-xmp/1.0/');
$nodedesc->setAttribute('xmlns:XMP-xmpMM', 'http://ns.exiftool.ca/XMP/XMP-xmpMM/1.0/');
$nodedesc->setAttribute('xmlns:XMP-xmpRights', 'http://ns.exiftool.ca/XMP/XMP-xmpRights/1.0/');
$nodedesc->setAttribute('xmlns:XMP-dc', 'http://ns.exiftool.ca/XMP/XMP-dc/1.0/');
$nodedesc->setAttribute('xmlns:ExifIFD', 'http://ns.exiftool.ca/EXIF/ExifIFD/1.0/');
$nodedesc->setAttribute('xmlns:GPS', 'http://ns.exiftool.ca/EXIF/GPS/1.0/');
$nodedesc->setAttribute('xmlns:PDF', 'http://ns.exiftool.ca/PDF/PDF/1.0/');
$meta_struct = $databox->get_meta_structure();
$fields = $record->get_caption()->get_fields();
$subCMD = '';
if ($record->get_uuid())
{
$subCMD .= '-XMP-exif:ImageUniqueID=';
$subCMD .= escapeshellarg($record->get_uuid());
$subCMD .= '-IPTC:UniqueDocumentID=';
$subCMD .= escapeshellarg($record->get_uuid());
}
foreach ($fields as $field)
{
$meta = $field->get_databox_field();
$fname = $field->get_name();
if (trim($meta->get_metadata_source()) === '')
continue;
$tag = $meta->get_metadata_tagname();
$multi = $meta->is_multi();
$type = $meta->get_type();
$datas = $field->get_value();
$node = $nodedesc->appendChild($dom->createElement($tag));
if ($multi)
{
$node = $node->appendChild($dom->createElement('rdf:Bag'));
$datas = $field->get_value();
foreach ($datas as $value)
{
$value = $this->format_value($type, $value);
$node->appendChild($dom->createElement('rdf:li'))->appendChild($dom->createTextNode($value));
$subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'=';
$subCMD .= escapeshellarg($value).' ';
}
}
else
{
$datas = $this->format_value($type, $datas);
$node->appendChild($dom->createTextNode($datas));
$subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'=';
$subCMD .= escapeshellarg($datas).' ';
}
}
$temp = tempnam($registry->get('GV_RootPath') . 'tmp/', 'meta');
rename($temp, $tempxml = $temp . '.xml');
$dom->save($tempxml);
foreach ($tsub as $name => $file)
{
$cmd = '';
@@ -397,16 +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 -TagsFromFile ' . escapeshellarg($tempxml) . ' ' . escapeshellarg($file) );
$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);
}
unlink($tempxml);
return $this;
}
protected function flush_records_sbas()

View File

@@ -894,12 +894,6 @@ $GV = array(
), array(
'section' => _('GV::section:: Parametrage de l\'inscription'),
'vars' => array(
array(
'type' => 'boolean',
'name' => 'GV_needMail',
'comment' => _('reglages:: Une addresse email valide est necessaire pour l\'inscription online'),
'default' => false
),
array(
'type' => 'boolean',
'name' => 'GV_autoselectDB',

View File

@@ -1154,7 +1154,6 @@ class ApiYamlApplication extends PhraseanetWebTestCaseAbstract
*
* @todo
*/
// var_dump($record["technical_informations"]);
$this->assertTrue(is_array($record["technical_informations"]));

View File

@@ -109,7 +109,6 @@ class ControllerFeedApp extends \PhraseanetWebTestCaseAuthenticatedAbstract
{
$appbox = appbox::get_instance();
$crawler = $this->client->request('POST', '/feeds/requestavailable/');
var_dump($this->client->getResponse()->getStatusCode());
$this->assertTrue($this->client->getResponse()->isOk());
$feeds = Feed_Collection::load_all($appbox, self::$user);
foreach ($feeds->get_feeds() as $one_feed)

View File

@@ -24,7 +24,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
*/
public static $entry;
public static $publisher;
public static $need_records = 1;
public static $need_records = 2;
public static $need_subdefs = true;
protected $client;
public function setUp()
@@ -35,6 +36,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
self::$publisher = Feed_Publisher_Adapter::getPublisher(appbox::get_instance(), self::$feed, self::$user);
self::$entry = Feed_Entry_Adapter::create(appbox::get_instance(), self::$feed, self::$publisher, 'title_entry', 'subtitle', 'hello', "test@mail.com");
Feed_Entry_Item::create(appbox::get_instance(), self::$entry, self::$record_1);
Feed_Entry_Item::create(appbox::get_instance(), self::$entry, self::$record_2);
self::$feed->set_public(true);
}
@@ -73,6 +75,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/rss/");
$this->assertEquals("application/rss+xml", $this->client->getResponse()->headers->get("content-type"));
$xml = $this->client->getResponse()->getContent();
$this->verifyXML($xml);
$this->verifyRSS($feed, $xml);
@@ -141,6 +144,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/rss/");
$this->assertTrue($this->client->getResponse()->isOk());
$xml = $this->client->getResponse()->getContent();
$this->verifyXML($xml);
$this->verifyRSS($feed, $xml);
$crawler = $this->client->request("GET", "/feeds/feed/" . $feed->get_id() . "/atom/");
@@ -161,7 +165,12 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
public function verifyXML($xml)
{
/**
* XML is not verified due to Validator Service bug
*/
return;
try
{
$validator = new W3CFeedRawValidator($xml);
@@ -177,8 +186,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
function verifyRSS(Feed_Adapter $feed, $xml_string)
{
$this->verifyXML($xml_string);
$dom_doc = new DOMDocument();
$dom_doc->loadXML($xml_string);
@@ -213,7 +220,6 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
break;
case 'pubDate':
$this->assertTrue(new DateTime() >= new DateTime($child->nodeValue));
break;
case 'generator':
$this->assertEquals("Phraseanet", $child->nodeValue);
@@ -314,8 +320,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
case 'media:content' :
$this->checkMediaContentAttributes($item, $node);
break;
case 'media:thumbnail' :
break;
case 'media:thumbnail':
default :
$this->checkOptionnalMediaGroupNode($node, $item);
break;
@@ -470,6 +475,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
)
);
foreach ($fields as $key_field => $field)
{
if ($field["media_field"]["name"] == $node->nodeName)
@@ -482,7 +488,8 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
{
foreach ($node->attributes as $attribute)
{
$this->assertTrue(array_key_exists($attribute->name, $field["media_field"]["attributes"]), "MIssing attribute " . $attribute->name . " for " . $field['media_field']['name']);
$this->assertTrue(array_key_exists($attribute->name, $field["media_field"]["attributes"]), "Checkin attribute ".$attribute->name." for " . $field['media_field']['name']);
$this->assertEquals($attribute->value, $field["media_field"]["attributes"][$attribute->name], "Checkin attribute ".$attribute->name." for " . $field['media_field']['name']);
}
}
}
@@ -640,4 +647,4 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
}
}
}
}

View File

@@ -17,13 +17,13 @@ require_once __DIR__ . '/../../../../../../PhraseanetPHPUnitAbstract.class.inc';
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class DoctrineNormalTest extends PhraseanetPHPUnitAbstract
class DoctrinePhpechoTest extends PhraseanetPHPUnitAbstract
{
public function testService()
{
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Normal(
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Phpecho(
'hello', array(), array()
);
@@ -32,7 +32,7 @@ class DoctrineNormalTest extends PhraseanetPHPUnitAbstract
public function testType()
{
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Normal(
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Phpecho(
'hello', array(), array()
);
@@ -41,7 +41,7 @@ class DoctrineNormalTest extends PhraseanetPHPUnitAbstract
public function testScope()
{
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Normal(
$log = new \Alchemy\Phrasea\Core\Service\Log\Doctrine\Phpecho(
'hello', array(), array());
$this->assertEquals("log", $log->getScope());
}

View File

@@ -38,8 +38,7 @@ class Bridge_AccountSettingsTest extends PhraseanetPHPUnitAuthenticatedAbstract
}
catch (Exception $e)
{
var_dump($e->getMessage());
$this->fail();
$this->fail($e->getMessage());
}
}

View File

@@ -108,17 +108,6 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
$date = $this->basket->getUpdated();
$this->assertInstanceOf('\DateTime', $date);
// sleep(5);
// $this->basket->setName('hello COCOCOCO');
// $this->basket->setDescription('44WDFDFOLSDF');
// $this->em->persist($this->basket);
// $this->em->flush();
// var_dump($this->basket->getId());
// $basket = $this->em->getRepository('\Entities\Basket')->find($this->basket->getId());
// $dateUpdated = $basket->getUpdated();
// var_dump($date->format(DATE_ATOM), $dateUpdated->format(DATE_ATOM));
// $this->assertGreaterThan($dateUpdated, $date);
// $this->assertGreaterThan($dateUpdated, $this->basket->getCreated());
}
public function testGetElements()

View File

@@ -371,7 +371,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
}
}
self::$record_1->set_metadatas($metadatas);
self::$record_1->set_metadatas($metadatas, true);
$caption = self::$record_1->get_caption();
@@ -381,7 +381,7 @@ class record_adapterTest extends PhraseanetPHPUnitAuthenticatedAbstract
{
$current_fields = $caption->get_fields(array($meta_el->get_name()));
$this->assertTrue(count($current_fields) == 1);
$this->assertEquals(1, count($current_fields));
$field = $current_fields[0];
$multi_imploded = implode(' ' . $meta_el->get_separator() . ' ', array('un', 'jeu', 'de', 'test'));

View File

@@ -69,17 +69,19 @@
{% endif %}
{% for field in editing.get_fields() %}
{% set i = field.get_id() %}
<div class="edit_field" id="EditFieldBox_{{i}}" onclick="return(edit_mdwn_fld(event, {{i}}, '{{field.get_name()}}'));" >
<img id="editSGtri_{{i}}" style="visibility:hidden;" src="/skins/prod/{{cssfile}}/images/suggested.gif" />
<img src="/skins/icons/info.gif" tooltipsrc="/prod/tooltip/metas/FieldInfos/{{field.get_databox().get_sbas_id()}}/{{field.get_id()}}/" class="fieldTips" alt=""/>
{% if field.get_dces_element %}
<img src="/skins/icons/dublincore.png" tooltipsrc="/prod/tooltip/DCESInfos/{{field.get_databox().get_sbas_id()}}/{{field.get_id()}}/" alt="{% trans 'Ce champ est decrit comme un element DublinCore' %}" class="DCESTips" alt=""/>
{% endif %}
<span id="spanidEditFieldBox_{{i}}">
{{field.get_name()}} {% if field.is_required() %}<span style="font-weight:bold;font-size:16px;"> * </span>{% endif %} :
</span>
<span class="fieldvalue" id="idEditField_{{i}}" >???</span>
</div>
{% if field.is_readonly() is empty %}
<div class="edit_field" id="EditFieldBox_{{i}}" onclick="return(edit_mdwn_fld(event, {{i}}, '{{field.get_name()}}'));" >
<img id="editSGtri_{{i}}" style="visibility:hidden;" src="/skins/prod/{{cssfile}}/images/suggested.gif" />
<img src="/skins/icons/info.gif" tooltipsrc="/prod/tooltip/metas/FieldInfos/{{field.get_databox().get_sbas_id()}}/{{field.get_id()}}/" class="fieldTips" alt=""/>
{% if field.get_dces_element %}
<img src="/skins/icons/dublincore.png" tooltipsrc="/prod/tooltip/DCESInfos/{{field.get_databox().get_sbas_id()}}/{{field.get_id()}}/" alt="{% trans 'Ce champ est decrit comme un element DublinCore' %}" class="DCESTips" alt=""/>
{% endif %}
<span id="spanidEditFieldBox_{{i}}">
{{field.get_name()}} {% if field.is_required() %}<span style="font-weight:bold;font-size:16px;"> * </span>{% endif %} :
</span>
<span class="fieldvalue" id="idEditField_{{i}}" >???</span>
</div>
{% endif %}
{% endfor %}
{% endmacro %}

View File

@@ -88,7 +88,7 @@ if ((!is_null($parm['login']) && !is_null($parm['pwd'])) || $is_guest)
}
catch (Exception_Session_MailLocked $e)
{
return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=mailNotConfirm&usr=" . $logged['usr_id']);
return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=mailNotConfirm&usr=" . $e->get_usr_id());
}
catch (Exception_Session_WrongToken $e)
{

View File

@@ -72,7 +72,7 @@ if ($parm['error'] !== null)
break;
case 'mailNotConfirm' :
$errorWarning = '<div class="notice">' . _('login::erreur: Vous n\'avez pas confirme votre email') . '</div>';
if (is_numeric((int) $parm['usr']))
if (ctype_digit($parm['usr']))
$errorWarning .= '<div class="notice"><a href="/login/sendmail-confirm.php?usr_id=' . $parm['usr'] . '" target ="_self" style="color:black;text-decoration:none;">' . _('login:: Envoyer a nouveau le mail de confirmation') . '</a></div>';
break;
case 'no-base' :

View File

@@ -19,7 +19,7 @@ require_once __DIR__ . "/../../lib/bootstrap.php";
$appbox = appbox::get_instance();
$request = http_request::getInstance();
$parm = $request->get_post_datas('code');
$parm = $request->get_parms('code');
try
{
@@ -27,7 +27,7 @@ try
}
catch(Exception_NotFound $e)
{
return phrasea::redirect('/login/?redirect=/prod');
return phrasea::redirect('/login/?redirect=/prod&error=TokenNotFound');
}
$usr_id = $datas['usr_id'];

View File

@@ -175,23 +175,17 @@ if ($request->has_post_datas())
->set_company($parm['form_company'])
->set_position($parm['form_activity'])
->set_geonameid($parm['form_geonameid']);
/**
* @todo implement this shit
*/
$fieldsname.= ",mail_locked";
$fieldsvalue.= ",'1'";
$newid = $user->get_id();
// //user cree, je branche autoregister si ya
// $autoSB = $autoB = array();
$demandOK = array();
if ($registry->get('GV_autoregister'))
{
$template_user = User_Adapter::get_usr_id_from_login('autoregister');
$template_user_id = User_Adapter::get_usr_id_from_login('autoregister');
$template_user = User_Adapter::getInstance($template_user_id, appbox::get_instance());
$user->ACL()->apply_model($template_user, array_keys($inscOK[$base_id]));
}
@@ -225,6 +219,7 @@ if ($request->has_post_datas())
if ($newUsrEmail)
{
$user->set_mail_locked(true);
return phrasea::redirect('/login/sendmail-confirm.php?usr_id=' . $newid);
}

View File

@@ -18,7 +18,7 @@
require_once __DIR__ . "/../../lib/bootstrap.php";
$request = http_request::getInstance();
$parm = $request->get_post_datas('usr_id');
$parm = $request->get_parms('usr_id');
$appbox = appbox::get_instance();
$confirm = '';

View File

@@ -41,7 +41,6 @@ if (!$parm['bas'])
$parm["pag"] = (int) $parm["pag"];
$mod = $user->getPrefs('view');
//var_dump($session->get_ses_id(), phrasea_open_session($session->get_ses_id(), $session->get_usr_id()));
function dmicrotime_float($message = '', $stack = 'def')
{
static $last = array();
@@ -49,9 +48,6 @@ function dmicrotime_float($message = '', $stack = 'def')
$new = ((float) $usec + (float) $sec);
// if (isset($last[$stack]) && $message)
// echo "$stack \t\t temps : $message " . ($new - $last[$stack]) . "\n";
$last[$stack] = $new;
return ($new - $last[$stack]);

View File

@@ -64,9 +64,6 @@ if ($parm["bid"] !== null)
$s_thits .= ( str_replace('d', '.', $rowbas['value']) . ';');
}
if ($parm['debug'])
var_dump($s_thits);
if ($parm['typ'] == 'CT')
{
$dom = $databox->get_dom_cterms();

View File

@@ -242,10 +242,7 @@ function simplified($t)
return(array('a' => $sa, 'u' => $su));
}
if ($parm['debug'])
var_dump($result);
else
print(p4string::jsonencode(array('parm' => $parm, 'result' => $result)));
print(p4string::jsonencode(array('parm' => $parm, 'result' => $result)));
if ($parm['debug'])
print("</pre>");