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 */ /* @var $twig \Twig_Environment */
$twig = $app['Core']->getTwig(); $twig = $app['Core']->getTwig();
// var_dump($twig->getLoader()->getPaths());
$browser = \Browser::getInstance(); $browser = \Browser::getInstance();
if (!$browser->isMobile()) 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(); $newstat = $record->get_status();

View File

@@ -18,4 +18,17 @@
class Exception_Session_MailLocked extends Exception 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(); $stmt->closeCursor();
if ($row && $row['mail_locked'] == "1") if ($row && $row['mail_locked'] == "1")
throw new Exception_Session_MailLocked(); throw new Exception_Session_MailLocked($this->user->get_id());
return $this; return $this;
} }

View File

@@ -256,7 +256,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
$body .= "<br/>\n<div>" $body .= "<br/>\n<div>"
. _('admin::register: l\'utilisateur s\'est inscrit sur les bases suivantes') . _('admin::register: l\'utilisateur s\'est inscrit sur les bases suivantes')
. "</div>\n"; . "</div>\n";
$body .= "<ul>"; $body .= "<ul>\n";
foreach ($base_ids->base_id as $base_id) 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"; . ' - ' . phrasea::bas_names((string) $base_id) . "</li>\n";
} }
$body .= "</ul>"; $body .= "</ul>\n";
$body .= "<br/>\n<div><a href='/login/?redirect=/admin' target='_blank'>" $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') . _('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>" $body .= "<br/>\n<div>"
. _('admin::register: les demandes de l\'utilisateur portent sur les bases suivantes') . _('admin::register: les demandes de l\'utilisateur portent sur les bases suivantes')
. "</div>\n"; . "</div>\n";
$body .= "<ul>"; $body .= "<ul>\n";
foreach ($base_ids->base_id as $base_id) 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"; . phrasea::bas_names((string) $base_id) . "</li>\n";
} }
$body .= "</ul>"; $body .= "</ul>\n";
$body .= "<br/>\n<div><a href='" . $this->registry->get('GV_ServerName') $body .= "<br/>\n<div><a href='" . $this->registry->get('GV_ServerName')
. "login/admin' target='_blank'>" . "login/admin' target='_blank'>"

View File

@@ -2,6 +2,15 @@
class geonames 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) public function name_from_id($geonameid)
{ {

View File

@@ -25,6 +25,12 @@ class http_query
*/ */
public static function getHttpCodeFromUrl($url) public static function getHttpCodeFromUrl($url)
{ {
if (!is_scalar($url))
return null;
if (trim($url) === '')
return null;
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
@@ -45,6 +51,11 @@ class http_query
public static function getHttpHeaders($url) public static function getHttpHeaders($url)
{ {
if (!is_scalar($url))
return null;
if (trim($url) === '')
return null;
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
@@ -69,8 +80,14 @@ class http_query
* @param array $post_data * @param array $post_data
* @return string * @return string
*/ */
public static function getUrl($url, $post_data=false) public static function getUrl($url, $post_data = false)
{ {
if (!is_scalar($url))
return null;
if (trim($url) === '')
return null;
$ch = curl_init(); $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HEADER, false);

View File

@@ -170,7 +170,7 @@ class mail
public static function mail_confirmation($email, $usr_id) public static function mail_confirmation($email, $usr_id)
{ {
$registry = registry::get_instance();
$expire = new DateTime('+3 days'); $expire = new DateTime('+3 days');
$token = random::getUrlToken('password', $usr_id, $expire, $email); $token = random::getUrlToken('password', $usr_id, $expire, $email);
@@ -256,7 +256,7 @@ class mail
$mail->ConfirmReadingTo = $reading_confirm_to; $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) foreach ($files as $f)
{ {

View File

@@ -23,171 +23,205 @@ class module_report
* @var string - timestamp * @var string - timestamp
*/ */
protected $dmin; protected $dmin;
/** /**
* End date of the report * End date of the report
* @var string - timestamp * @var string - timestamp
*/ */
protected $dmax; protected $dmax;
/** /**
* Id of the base we want to connect * Id of the base we want to connect
* @var int * @var int
*/ */
protected $sbas_id; protected $sbas_id;
/** /**
* Id of the current app's box user * Id of the current app's box user
* @var int * @var int
*/ */
protected $user_id; protected $user_id;
/** /**
* The result of the report * The result of the report
* @var array * @var array
*/ */
public $report = array(); public $report = array();
/** /**
* The title of the report * The title of the report
* @var string * @var string
*/ */
protected $title = ''; protected $title = '';
/** /**
* default displayed value in the formated tab * default displayed value in the formated tab
* @var array * @var array
*/ */
protected $display = array(); protected $display = array();
/** /**
* ? * ?
* @var <array> * @var <array>
*/ */
protected $default_display = array(); protected $default_display = array();
/** /**
* Contain all the field from the sql request * Contain all the field from the sql request
* @var array * @var array
*/ */
protected $champ = array(); protected $champ = array();
/** /**
* result of the report * result of the report
* @var array * @var array
*/ */
protected $result = array(); protected $result = array();
/** /**
* The id of all collections from a databox * The id of all collections from a databox
* @var string * @var string
*/ */
protected $list_coll_id = ''; protected $list_coll_id = '';
/** /**
* The number of record displayed by page if enable limit is false * The number of record displayed by page if enable limit is false
* @var int * @var int
*/ */
protected $nb_record = 30; protected $nb_record = 30;
/** /**
* The current number of the page where are displaying the results * The current number of the page where are displaying the results
* @var int * @var int
*/ */
protected $nb_page = 1; protected $nb_page = 1;
/** /**
* check if there is a previous page * check if there is a previous page
* @var <bool> * @var <bool>
*/ */
protected $previous_page = false; protected $previous_page = false;
/** /**
* check if there is a next page * check if there is a next page
* @var <bool> * @var <bool>
*/ */
protected $next_page = false; protected $next_page = false;
/** /**
* *
* @var int total of result * @var int total of result
*/ */
protected $total = 0; protected $total = 0;
/** /**
* the request executed * the request executed
*/ */
protected $req = ''; protected $req = '';
/** /**
* the request executed * the request executed
*/ */
protected $params = array(); protected $params = array();
/** /**
* do we display next and previous button * do we display next and previous button
* @var bool * @var bool
*/ */
protected $display_nav = false; protected $display_nav = false;
/** /**
* do we display the configuration button * do we display the configuration button
* @var <bool> * @var <bool>
*/ */
protected $config = true; protected $config = true;
/** /**
* gettext tags for days * gettext tags for days
* @var <array> * @var <array>
*/ */
protected $jour; protected $jour;
/** /**
* gettext tags for month * gettext tags for month
* @var <array> * @var <array>
*/ */
protected $month; protected $month;
/** /**
* The name of the database * The name of the database
* @var string * @var string
*/ */
protected $dbname; protected $dbname;
/** /**
* The periode displayed in a string of the report * The periode displayed in a string of the report
* @var string * @var string
*/ */
protected $periode; protected $periode;
/** /**
* filter executed on report choose by the user * filter executed on report choose by the user
* @var array; * @var array;
*/ */
protected $tab_filter = array(); protected $tab_filter = array();
/** /**
* column displayed in the report choose by the user * column displayed in the report choose by the user
* @var <array> * @var <array>
*/ */
protected $active_column = array(); protected $active_column = array();
/** /**
* array that contains the string displayed * array that contains the string displayed
* foreach filters * foreach filters
* @var <array> * @var <array>
*/ */
protected $posting_filter = array(); protected $posting_filter = array();
/** /**
* The ORDER BY filters of the query * The ORDER BY filters of the query
* by default is empty * by default is empty
* @var array * @var array
*/ */
protected $tab_order = array(); protected $tab_order = array();
/** /**
* define columns that are boundable * define columns that are boundable
* @var <array> * @var <array>
*/ */
protected $bound = array(); protected $bound = array();
/** /**
* do we display print button * do we display print button
* @var <bool> * @var <bool>
*/ */
protected $print = true; protected $print = true;
/** /**
* do we display csv button * do we display csv button
* @var <bool> * @var <bool>
*/ */
protected $csv = true; protected $csv = true;
/** /**
* do we enable limit filter for the report * do we enable limit filter for the report
* @var bool * @var bool
*/ */
protected $enable_limit = true; protected $enable_limit = true;
/** /**
* gettext correspondance for all available columns in report * gettext correspondance for all available columns in report
* @var array * @var array
*/ */
protected $cor = array(); protected $cor = array();
/** /**
* group result of a report this is the name ogf the grouped column * group result of a report this is the name ogf the grouped column
* @var string * @var string
*/ */
protected $groupby; protected $groupby;
/** /**
* disbale or enable pretty string useful for export in csv * disbale or enable pretty string useful for export in csv
* @var boolean * @var boolean
@@ -197,9 +231,8 @@ class module_report
/** /**
* *
*/ */
protected $cor_query = array();/* ~*~*~*~*~*~*~*~*~*~*~*~ */ protected $cor_query = array();
/* METHODS, VARIABLES */ protected $isInformative;
/* ~*~*~*~*~*~*~*~*~*~*~*~ */
/** /**
* Constructor * Constructor
@@ -227,6 +260,16 @@ class module_report
$this->month = $this->setMonth(); $this->month = $this->setMonth();
} }
public function IsInformative()
{
return $this->isInformative;
}
public function setIsInformative($isInformative)
{
$this->isInformative = $isInformative;
}
public function getUser_id() public function getUser_id()
{ {
return $this->user_id; return $this->user_id;
@@ -242,7 +285,6 @@ class module_report
$this->user_id = $user_id; $this->user_id = $user_id;
} }
public function getSbas_id() public function getSbas_id()
{ {
return $this->sbas_id; return $this->sbas_id;
@@ -301,8 +343,6 @@ class module_report
$this->req = $sql; $this->req = $sql;
} }
public function getPeriode() public function getPeriode()
{ {
return $this->periode; return $this->periode;
@@ -460,7 +500,6 @@ class module_report
public function getOrder($k = false) public function getOrder($k = false)
{ {
if ($k === false) if ($k === false)
return $this->tab_order; return $this->tab_order;
return $this->tab_order[$k]; return $this->tab_order[$k];
} }
@@ -509,6 +548,7 @@ class module_report
{ {
$this->total = $total; $this->total = $total;
} }
public function getDefault_display() public function getDefault_display()
{ {
return $this->default_display; return $this->default_display;
@@ -524,7 +564,6 @@ class module_report
return $this->champ; return $this->champ;
} }
/** /**
* Retourne un objet qui genere la requete selon le type de report * Retourne un objet qui genere la requete selon le type de report
* @param string $domain * @param string $domain
@@ -780,7 +819,6 @@ class module_report
public function buildReport($tab = false, $groupby = false, $on = false) public function buildReport($tab = false, $groupby = false, $on = false)
{ {
if (sizeof($this->report) > 0) if (sizeof($this->report) > 0)
return $this->report; return $this->report;
$conn = connection::getPDOConnection($this->sbas_id); $conn = connection::getPDOConnection($this->sbas_id);
@@ -795,7 +833,7 @@ class module_report
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
$stmt->closeCursor(); $stmt->closeCursor();
} }
catch(PDOException $e) catch (PDOException $e)
{ {
echo $e->getMessage(); echo $e->getMessage();

View File

@@ -39,7 +39,6 @@ class module_report_download extends module_report
'file' => 'subdef.file' 'file' => 'subdef.file'
); );
protected $isInformative;
/** /**
* constructor * constructor
* *
@@ -278,16 +277,6 @@ class module_report_download extends module_report
return $array; 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() ? : ''; $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 = $this->connbas->prepare($this->sql);
$stmt->execute($this->params); $stmt->execute($this->params);
$this->total_row = $stmt->rowCount(); $this->total_row = $stmt->rowCount();

View File

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

View File

@@ -85,7 +85,7 @@ interface record_Interface
public function substitute_subdef($name, system_file $pathfile); 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(); public function reindex();

View File

@@ -862,6 +862,7 @@ class record_adapter implements record_Interface, cache_cacheableInterface
, 'meta_id' => $value->getId() , 'meta_id' => $value->getId()
, 'value' => $original_name , '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->execute(array(':record_id' => $this->get_record_id()));
$stmt->closeCursor(); $stmt->closeCursor();
try
{
$subdef = $this->get_subdef($name);
$subdef->delete_data_from_cache();
}
catch (Exception $e)
{
}
$this->delete_data_from_cache(self::CACHE_SUBDEFS); $this->delete_data_from_cache(self::CACHE_SUBDEFS);
if ($meta_writable) if ($meta_writable)
{ {
$this->write_metas(); $this->write_metas();
@@ -1337,13 +1350,20 @@ class record_adapter implements record_Interface, cache_cacheableInterface
* @param array $metadatas * @param array $metadatas
* @return record_adapter * @return record_adapter
*/ */
public function set_metadatas(Array $metadatas) public function set_metadatas(Array $metadatas, $force_readonly = false)
{ {
foreach ($metadatas as $param) foreach ($metadatas as $param)
{ {
if (!is_array($param)) if (!is_array($param))
throw new Exception_InvalidArgument(); 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); $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( $txtlines = recordutils_image::wrap(
$fontsize, $fontsize,
0, 0,
$registry->get('GV_RootPath') . 'lib/stamper/arial.ttf', __DIR__ . '/arial.ttf',
$txtline, $txtline,
$text_width $text_width
); );
@@ -352,7 +352,7 @@ class recordutils_image extends recordutils
{ {
imagettftext($im, $block['s'], 0, $block['x'], imagettftext($im, $block['s'], 0, $block['x'],
$txt_ypos - $block['dy'], $black, $txt_ypos - $block['dy'], $black,
$registry->get('GV_RootPath') . 'lib/stamper/arial.ttf', $block['t']); __DIR__ . '/arial.ttf', $block['t']);
$txt_ypos += $block['h']; $txt_ypos += $block['h'];
} }
imagecolordeallocate($im, $black); imagecolordeallocate($im, $black);

View File

@@ -68,11 +68,13 @@ class searchEngine_adapter_phrasea_queryParser
var $defaultlast = 12; var $defaultlast = 12;
var $phq; var $phq;
var $errmsg = ""; var $errmsg = "";
/** /**
* *
* @var boolean * @var boolean
*/ */
var $debug = false; var $debug = false;
/** /**
* un tableau qui contiendra des propositions de thesaurus * un tableau qui contiendra des propositions de thesaurus
* pour les termes de l'arbre simple * pour les termes de l'arbre simple
@@ -80,12 +82,12 @@ class searchEngine_adapter_phrasea_queryParser
* @var array * @var array
*/ */
var $proposals = Array("QRY" => "", "BASES" => array()); var $proposals = Array("QRY" => "", "BASES" => array());
/** /**
* Current language for thesaurus * Current language for thesaurus
* @var <type> * @var <type>
*/ */
var $lng = null; var $lng = null;
protected $unicode; protected $unicode;
function __construct($lng = "???") function __construct($lng = "???")
@@ -120,7 +122,6 @@ class searchEngine_adapter_phrasea_queryParser
$this->proposals = Array("QRY" => "", "BASES" => array()); $this->proposals = Array("QRY" => "", "BASES" => array());
$this->phq = $this->mb_trim($phq, 'UTF-8'); $this->phq = $this->mb_trim($phq, 'UTF-8');
if ($this->phq != "") if ($this->phq != "")
return($this->maketree(0)); return($this->maketree(0));
else else
{ {
@@ -138,18 +139,14 @@ class searchEngine_adapter_phrasea_queryParser
{ {
case "SIMPLE": case "SIMPLE":
if (is_array($tree["VALUE"])) if (is_array($tree["VALUE"]))
return(implode(" ", $tree["VALUE"])); return(implode(" ", $tree["VALUE"]));
else else
return($tree["VALUE"]); return($tree["VALUE"]);
break; break;
case "QSIMPLE": case "QSIMPLE":
if (is_array($tree["VALUE"])) if (is_array($tree["VALUE"]))
return("\"" . implode(" ", $tree["VALUE"]) . "\""); return("\"" . implode(" ", $tree["VALUE"]) . "\"");
else else
return("\"" . $tree["VALUE"] . "\""); return("\"" . $tree["VALUE"] . "\"");
break; break;
case "PHRASEA_KW_ALL": case "PHRASEA_KW_ALL":
@@ -157,19 +154,15 @@ class searchEngine_adapter_phrasea_queryParser
break; break;
case "PHRASEA_KW_LAST": case "PHRASEA_KW_LAST":
if ($tree["PNUM"] !== null) if ($tree["PNUM"] !== null)
return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]"); return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]");
else else
return($tree["VALUE"][0]); return($tree["VALUE"][0]);
break; break;
case "OPS": case "OPS":
case "OPK": case "OPK":
if (isset($tree["PNUM"])) if (isset($tree["PNUM"]))
return("(" . $this->astext($tree["LB"]) . " " . $tree["VALUE"] . "[" . $tree["PNUM"] . "] " . $this->astext($tree["RB"]) . ")"); return("(" . $this->astext($tree["LB"]) . " " . $tree["VALUE"] . "[" . $tree["PNUM"] . "] " . $this->astext($tree["RB"]) . ")");
else else
return("(" . $this->astext($tree["LB"]) . " " . $tree["VALUE"] . " " . $this->astext($tree["RB"]) . ")"); return("(" . $this->astext($tree["LB"]) . " " . $tree["VALUE"] . " " . $this->astext($tree["RB"]) . ")");
break; break;
} }
@@ -178,7 +171,6 @@ class searchEngine_adapter_phrasea_queryParser
function astable(&$tree) function astable(&$tree)
{ {
$this->calc_complexity($tree); $this->calc_complexity($tree);
// var_dump($tree);
$txt = ""; $txt = "";
$this->astable2($txt, $tree); $this->astable2($txt, $tree);
$txt = "<table border=\"1\">\n<tr>\n" . $txt . "</tr>\n</table>\n"; $txt = "<table border=\"1\">\n<tr>\n" . $txt . "</tr>\n</table>\n";
@@ -191,15 +183,13 @@ class searchEngine_adapter_phrasea_queryParser
if ($tree) if ($tree)
{ {
if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK")
return($tree["COMPLEXITY"] = $this->calc_complexity($tree["LB"]) + $this->calc_complexity($tree["RB"])); return($tree["COMPLEXITY"] = $this->calc_complexity($tree["LB"]) + $this->calc_complexity($tree["RB"]));
else else
return($tree["COMPLEXITY"] = 1); return($tree["COMPLEXITY"] = 1);
} }
} }
function astable2(&$out, &$tree, $depth=0) function astable2(&$out, &$tree, $depth = 0)
{ {
switch ($tree["CLASS"]) switch ($tree["CLASS"])
{ {
@@ -246,7 +236,7 @@ class searchEngine_adapter_phrasea_queryParser
print("</div>\n"); print("</div>\n");
} }
function dumpDiv2(&$tree, $depth=0) function dumpDiv2(&$tree, $depth = 0)
{ {
switch ($tree["CLASS"]) switch ($tree["CLASS"])
{ {
@@ -355,10 +345,9 @@ class searchEngine_adapter_phrasea_queryParser
} }
} }
function priority_opk(&$tree, $depth=0) function priority_opk(&$tree, $depth = 0)
{ {
if (!$tree) if (!$tree)
return; return;
if ($tree["CLASS"] == "OPK" && ($tree["LB"]["CLASS"] == "OPS" || $tree["LB"]["CLASS"] == "OPK")) if ($tree["CLASS"] == "OPK" && ($tree["LB"]["CLASS"] == "OPS" || $tree["LB"]["CLASS"] == "OPK"))
{ {
@@ -374,10 +363,9 @@ class searchEngine_adapter_phrasea_queryParser
$this->priority_opk($tree["RB"], $depth + 1); $this->priority_opk($tree["RB"], $depth + 1);
} }
function distrib_opk(&$tree, $depth=0) function distrib_opk(&$tree, $depth = 0)
{ {
if (!$tree) if (!$tree)
return; return;
if ($tree["CLASS"] == "OPK" && ($tree["RB"]["CLASS"] == "OPS")) if ($tree["CLASS"] == "OPK" && ($tree["RB"]["CLASS"] == "OPS"))
{ {
@@ -404,7 +392,6 @@ class searchEngine_adapter_phrasea_queryParser
function thesaurus2_apply(&$tree, $bid) function thesaurus2_apply(&$tree, $bid)
{ {
if (!$tree) if (!$tree)
return; return;
if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE") && isset($tree["SREF"]) && isset($tree["SREF"]["TIDS"])) if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE") && isset($tree["SREF"]) && isset($tree["SREF"]["TIDS"]))
{ {
@@ -461,7 +448,6 @@ class searchEngine_adapter_phrasea_queryParser
$copy = $tree; $copy = $tree;
$this->_extendThesaurusOnTerms($tree, $copy, $useFullText, $useThesaurus, $keepfuzzy, 0, ""); $this->_extendThesaurusOnTerms($tree, $copy, $useFullText, $useThesaurus, $keepfuzzy, 0, "");
// var_dump($tree);
$this->proposals["QRY"] = "<span id=\"thprop_q\">" . $this->_queryAsHTML($tree) . "</span>"; $this->proposals["QRY"] = "<span id=\"thprop_q\">" . $this->_queryAsHTML($tree) . "</span>";
return($copy); return($copy);
@@ -472,7 +458,6 @@ class searchEngine_adapter_phrasea_queryParser
if ($depth == 0) if ($depth == 0)
$ret = $tree; $ret = $tree;
if (!$useThesaurus) if (!$useThesaurus)
return; // full-text only : inchangé return; // full-text only : inchangé
if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE")) if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE"))
{ {
@@ -598,7 +583,7 @@ class searchEngine_adapter_phrasea_queryParser
return($tmp); return($tmp);
} }
function thesaurus2(&$tree, $bid, $name, &$domthe, $searchsynonyms=true, $depth=0) function thesaurus2(&$tree, $bid, $name, &$domthe, $searchsynonyms = true, $depth = 0)
{ {
if ($this->debug) if ($this->debug)
print("thesaurus2:\n\$tree=" . var_export($tree, true) . "\n"); print("thesaurus2:\n\$tree=" . var_export($tree, true) . "\n");
@@ -607,7 +592,6 @@ class searchEngine_adapter_phrasea_queryParser
$this->proposals["BASES"]["b$bid"] = array("BID" => $bid, "NAME" => $name, "TERMS" => array()); $this->proposals["BASES"]["b$bid"] = array("BID" => $bid, "NAME" => $name, "TERMS" => array());
if (!$tree) if (!$tree)
return(0); return(0);
$ambigus = 0; $ambigus = 0;
@@ -625,7 +609,7 @@ class searchEngine_adapter_phrasea_queryParser
return($ambigus); return($ambigus);
} }
function propAsHTML(&$node, &$html, $path, $depth=0) function propAsHTML(&$node, &$html, $path, $depth = 0)
{ {
global $parm; global $parm;
if ($depth > 0) if ($depth > 0)
@@ -705,8 +689,6 @@ class searchEngine_adapter_phrasea_queryParser
} }
ksort($tsort); ksort($tsort);
// var_dump($tsort);
foreach ($tsort as $n) foreach ($tsort as $n)
{ {
$this->propAsHTML($n, $html, $path, $depth + 1); $this->propAsHTML($n, $html, $path, $depth + 1);
@@ -716,10 +698,8 @@ class searchEngine_adapter_phrasea_queryParser
$html .= $tab . "</div>\n"; $html .= $tab . "</div>\n";
} }
function _queryAsHTML($tree, $depth=0) function _queryAsHTML($tree, $depth = 0)
{ {
// printf("astext : ");
// var_dump($tree);
if ($depth == 0) if ($depth == 0)
{ {
$ambiguites = array("n" => 0, "refs" => array()); $ambiguites = array("n" => 0, "refs" => array());
@@ -753,86 +733,20 @@ class searchEngine_adapter_phrasea_queryParser
break; break;
case "PHRASEA_KW_LAST": case "PHRASEA_KW_LAST":
if ($tree["PNUM"] !== null) if ($tree["PNUM"] !== null)
return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]"); return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]");
else else
return($tree["VALUE"][0]); return($tree["VALUE"][0]);
break; break;
case "OPS": case "OPS":
case "OPK": case "OPK":
if (isset($tree["PNUM"])) if (isset($tree["PNUM"]))
return('(' . $this->_queryAsHTML($tree["LB"], $depth + 1) . ' ' . $tree["VALUE"] . '[' . $tree["PNUM"] . '] ' . $this->_queryAsHTML($tree["RB"], $depth + 1) . ')'); return('(' . $this->_queryAsHTML($tree["LB"], $depth + 1) . ' ' . $tree["VALUE"] . '[' . $tree["PNUM"] . '] ' . $this->_queryAsHTML($tree["RB"], $depth + 1) . ')');
else else
return('(' . $this->_queryAsHTML($tree["LB"], $depth + 1) . ' ' . $tree["VALUE"] . ' ' . $this->_queryAsHTML($tree["RB"], $depth + 1) . ')'); return('(' . $this->_queryAsHTML($tree["LB"], $depth + 1) . ' ' . $tree["VALUE"] . ' ' . $this->_queryAsHTML($tree["RB"], $depth + 1) . ')');
break; break;
} }
} }
/*
function _queryAsHTML($tree, $mouseCallback="void", $depth=0)
{
// printf("astext : ");
// var_dump($tree);
if($depth==0)
{
$ambiguites = array("n"=>0, "refs"=>array());
}
switch($tree["CLASS"])
{
case "SIMPLE":
case "QSIMPLE":
$w = is_array($tree["VALUE"]) ? implode(" ", $tree["VALUE"]) : $tree["VALUE"];
$tab = "\n" . str_repeat("\t", $depth);
if(isset($tree["PATH"]))
{
$path = $tree["PATH"];
if(isset($tree["CONTEXT"]))
$w .= " [" . $tree["CONTEXT"] . "]";
$txt = $tab . "<b><span onmouseover=\"return(".$mouseCallback."(event, '$path'));\" onmouseout=\"return(".$mouseCallback."(event, '$path'));\" id=\"thprop_a_".$path."\">";
$txt .= $tab . "\t\"" . $w . "";
// $txt .= $tab . "\t<span id='thprop_w_".$path."'></span>\"";
$txt .= "\"";
$txt .= $tab . "</span></b>\n";
}
else
{
if(isset($tree["CONTEXT"]))
$w .= "[" . $tree["CONTEXT"] . "]";
if($tree["CLASS"] == "QSIMPLE")
$txt = $tab . "\"" . $w . "\"\n";
else
$txt = $tab . "" . $w . "\n";
}
return($txt);
break;
case "PHRASEA_KW_ALL":
return($tree["VALUE"][0]);
break;
case "PHRASEA_KW_LAST":
if($tree["PNUM"]!==null)
return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]");
else
return($tree["VALUE"][0]);
break;
case "OPS":
case "OPK":
if(isset($tree["PNUM"]))
return("(" . $this->_queryAsHTML($tree["LB"], $mouseCallback, $depth+1) . "&nbsp;" . $tree["VALUE"] . "[" . $tree["PNUM"] . "]&nbsp;" . $this->_queryAsHTML($tree["RB"], $mouseCallback, $depth+1) . ")");
else
return("(" . $this->_queryAsHTML($tree["LB"], $mouseCallback, $depth+1) . "&nbsp;" . $tree["VALUE"] . "&nbsp;" . $this->_queryAsHTML($tree["RB"], $mouseCallback, $depth+1) . ")");
break;
}
}
*/
function setTids(&$tree, $bid, &$domthe, $searchsynonyms) function setTids(&$tree, $bid, &$domthe, $searchsynonyms)
{ {
if ($this->debug) if ($this->debug)
@@ -990,10 +904,8 @@ class searchEngine_adapter_phrasea_queryParser
function containsColonOperator(&$tree) function containsColonOperator(&$tree)
{ {
if (!$tree) if (!$tree)
return(false); return(false);
if ($tree["CLASS"] == "OPK" && $tree["NODETYPE"] == PHRASEA_OP_COLON && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE")) if ($tree["CLASS"] == "OPK" && $tree["NODETYPE"] == PHRASEA_OP_COLON && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE"))
return(true); return(true);
$ret = false; $ret = false;
if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK")
@@ -1074,14 +986,11 @@ class searchEngine_adapter_phrasea_queryParser
if (!$id) if (!$id)
break; // on a dépassé la racine du thésaurus break; // on a dépassé la racine du thésaurus
$node->setAttribute("marked", "1"); $node->setAttribute("marked", "1");
// printf("&lt;%s id='%s'<br/>\n", $node->nodeName, $node->getAttribute("id"));
} }
} }
function astext_ambigu($tree, &$ambiguites, $mouseCallback="void", $depth=0) function astext_ambigu($tree, &$ambiguites, $mouseCallback = "void", $depth = 0)
{ {
// printf("astext : ");
// var_dump($tree);
if ($depth == 0) if ($depth == 0)
{ {
$ambiguites = array("n" => 0, "refs" => array()); $ambiguites = array("n" => 0, "refs" => array());
@@ -1119,28 +1028,23 @@ class searchEngine_adapter_phrasea_queryParser
break; break;
case "PHRASEA_KW_LAST": case "PHRASEA_KW_LAST":
if ($tree["PNUM"] !== null) if ($tree["PNUM"] !== null)
return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]"); return("" . $tree["VALUE"][0] . "[" . $tree["PNUM"] . "]");
else else
return($tree["VALUE"][0]); return($tree["VALUE"][0]);
break; break;
case "OPS": case "OPS":
case "OPK": case "OPK":
if (isset($tree["PNUM"])) if (isset($tree["PNUM"]))
return("(" . $this->astext_ambigu($tree["LB"], $ambiguites, $mouseCallback, $depth + 1) . " " . $tree["VALUE"] . "[" . $tree["PNUM"] . "] " . $this->astext_ambigu($tree["RB"], $ambiguites, $mouseCallback, $depth + 1) . ")"); return("(" . $this->astext_ambigu($tree["LB"], $ambiguites, $mouseCallback, $depth + 1) . " " . $tree["VALUE"] . "[" . $tree["PNUM"] . "] " . $this->astext_ambigu($tree["RB"], $ambiguites, $mouseCallback, $depth + 1) . ")");
else else
return("(" . $this->astext_ambigu($tree["LB"], $ambiguites, $mouseCallback, $depth + 1) . " " . $tree["VALUE"] . " " . $this->astext_ambigu($tree["RB"], $ambiguites, $mouseCallback, $depth + 1) . ")"); return("(" . $this->astext_ambigu($tree["LB"], $ambiguites, $mouseCallback, $depth + 1) . " " . $tree["VALUE"] . " " . $this->astext_ambigu($tree["RB"], $ambiguites, $mouseCallback, $depth + 1) . ")");
break; break;
} }
} }
function get_ambigu(&$tree, $mouseCallback="void", $depth=0) function get_ambigu(&$tree, $mouseCallback = "void", $depth = 0)
{ {
if (!$tree) if (!$tree)
return(""); return("");
unset($tree["DEPTH"]); unset($tree["DEPTH"]);
if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK")
@@ -1162,20 +1066,17 @@ class searchEngine_adapter_phrasea_queryParser
} }
} }
function set_default(&$tree, &$emptyw, $depth=0) function set_default(&$tree, &$emptyw, $depth = 0)
{ {
if (!$tree) if (!$tree)
return(true); return(true);
if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK")
{ {
if ($tree["CLASS"] == "OPS") if ($tree["CLASS"] == "OPS")
{ {
if (!$this->set_default($tree["LB"], $emptyw, $depth + 1)) if (!$this->set_default($tree["LB"], $emptyw, $depth + 1))
return(false); return(false);
if (!$this->set_default($tree["RB"], $emptyw, $depth + 1)) if (!$this->set_default($tree["RB"], $emptyw, $depth + 1))
return(false); return(false);
} }
else // OPK ! else // OPK !
@@ -1281,10 +1182,8 @@ class searchEngine_adapter_phrasea_queryParser
while ($n > 0); while ($n > 0);
} }
function factor_or2(&$tree, $depth=0) function factor_or2(&$tree, $depth = 0)
{ {
// printf("<hr><b>factor_or depth=%s sur</b><br>", $depth);
// var_dump($tree);
$nmodif = 0; $nmodif = 0;
if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK")
{ {
@@ -1302,11 +1201,8 @@ class searchEngine_adapter_phrasea_queryParser
$tree["VALUE"][] = $tree["RB"]["VALUE"]; $tree["VALUE"][] = $tree["RB"]["VALUE"];
unset($tree["LB"]); unset($tree["LB"]);
unset($tree["RB"]); unset($tree["RB"]);
// unset($tree["NODETYPE"]);
unset($tree["PNUM"]); unset($tree["PNUM"]);
$nmodif++; $nmodif++;
// printf("<hr><b>donne</b><br>");
// var_dump($tree);
} }
else else
{ {
@@ -1314,13 +1210,11 @@ class searchEngine_adapter_phrasea_queryParser
$nmodif += $this->factor_or2($tree["RB"], $depth + 1); $nmodif += $this->factor_or2($tree["RB"], $depth + 1);
} }
} }
// printf("<br>return %s<br>", $nmodif);
return($nmodif); return($nmodif);
} }
function setNumValue(&$tree, SimpleXMLElement $sxml_struct, $depth=0) function setNumValue(&$tree, SimpleXMLElement $sxml_struct, $depth = 0)
{ {
// var_dump($tree);
if ($tree["CLASS"] == "OPK") if ($tree["CLASS"] == "OPK")
{ {
if (isset($tree["RB"]) && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE") && ($tree["LB"]["CLASS"] == "SIMPLE" || $tree["LB"]["CLASS"] == "QSIMPLE")) if (isset($tree["RB"]) && ($tree["RB"]["CLASS"] == "SIMPLE" || $tree["RB"]["CLASS"] == "QSIMPLE") && ($tree["LB"]["CLASS"] == "SIMPLE" || $tree["LB"]["CLASS"] == "QSIMPLE"))
@@ -1383,11 +1277,7 @@ class searchEngine_adapter_phrasea_queryParser
"PNUM" => NULL, "PNUM" => NULL,
"DEPTH" => 0) "DEPTH" => 0)
); );
// var_dump($newTreeLB);
// print("fin creation branche gauche ( '>=' ) \n");
## fin creation branche gauche ( ">=" )
## creation branche droite avec "<="
// print("creation branche droite avec '<=' \n");
$newTreeRB = array("CLASS" => "OPK", $newTreeRB = array("CLASS" => "OPK",
"VALUE" => "<=", "VALUE" => "<=",
"NODETYPE" => PHRASEA_OP_LEQT, "NODETYPE" => PHRASEA_OP_LEQT,
@@ -1400,7 +1290,6 @@ class searchEngine_adapter_phrasea_queryParser
"PNUM" => NULL, "PNUM" => NULL,
"DEPTH" => 0) "DEPTH" => 0)
); );
// var_dump($newTreeRB);
// print("fin creation branche droite avec '<=' \n"); // print("fin creation branche droite avec '<=' \n");
## fin creation branche droite ( "<=" ) ## fin creation branche droite ( "<=" )
@@ -1413,8 +1302,6 @@ class searchEngine_adapter_phrasea_queryParser
"RB" => $newTreeRB); "RB" => $newTreeRB);
// et on le retourne
// var_dump($tree);
return $tree; return $tree;
} }
@@ -1427,7 +1314,7 @@ class searchEngine_adapter_phrasea_queryParser
} }
} }
function isoDate($onedate, $max=false) function isoDate($onedate, $max = false)
{ {
$v_y = "1900"; $v_y = "1900";
$v_m = "01"; $v_m = "01";
@@ -1582,11 +1469,9 @@ class searchEngine_adapter_phrasea_queryParser
return("" . $v_y . $v_m . $v_d . $v_h . $v_minutes . $v_s); return("" . $v_y . $v_m . $v_d . $v_h . $v_minutes . $v_s);
} }
function distrib_in(&$tree, $depth=0) function distrib_in(&$tree, $depth = 0)
{ {
$opdistrib = array(PHRASEA_OP_AND, PHRASEA_OP_OR, PHRASEA_OP_EXCEPT, PHRASEA_OP_NEAR, PHRASEA_OP_BEFORE, PHRASEA_OP_AFTER); // ces opérateurs sont 'distribuables' autour d'un 'IN' $opdistrib = array(PHRASEA_OP_AND, PHRASEA_OP_OR, PHRASEA_OP_EXCEPT, PHRASEA_OP_NEAR, PHRASEA_OP_BEFORE, PHRASEA_OP_AFTER); // ces opérateurs sont 'distribuables' autour d'un 'IN'
// printf("<hr><b>distrib_in depth=%s sur</b><br>", $depth);
// var_dump($tree);
if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK")
{ {
@@ -1624,7 +1509,6 @@ class searchEngine_adapter_phrasea_queryParser
"RB" => $tree["RB"]); "RB" => $tree["RB"]);
$tree["LB"]["RB"] = $tree["RB"]["RB"]; $tree["LB"]["RB"] = $tree["RB"]["RB"];
// var_dump($tree);
// return; // return;
} }
@@ -1723,7 +1607,6 @@ class searchEngine_adapter_phrasea_queryParser
// quand on est entre guillements les tokens perdent leur signification // quand on est entre guillements les tokens perdent leur signification
$tree = $this->addtotree($tree, $t, $depth, $inquote); $tree = $this->addtotree($tree, $t, $depth, $inquote);
if (!$tree) if (!$tree)
return(null); return(null);
} }
else else
@@ -1746,7 +1629,6 @@ class searchEngine_adapter_phrasea_queryParser
// quand on est entre guillements les tokens perdent leur signification // quand on est entre guillements les tokens perdent leur signification
$tree = $this->addtotree($tree, $t, $depth, $inquote); $tree = $this->addtotree($tree, $t, $depth, $inquote);
if (!$tree) if (!$tree)
return(null); return(null);
} }
else // '(' : appel récursif else // '(' : appel récursif
@@ -1774,7 +1656,6 @@ class searchEngine_adapter_phrasea_queryParser
} }
} }
if (!$tree) if (!$tree)
return(null); return(null);
} }
break; break;
@@ -1831,7 +1712,6 @@ class searchEngine_adapter_phrasea_queryParser
} }
} }
if (!$tree) if (!$tree)
return(null); return(null);
} }
break; break;
@@ -1844,7 +1724,6 @@ class searchEngine_adapter_phrasea_queryParser
print("-------------------------\n"); print("-------------------------\n");
} }
if (!$tree) if (!$tree)
return(null); return(null);
break; break;
} }
@@ -1871,7 +1750,6 @@ class searchEngine_adapter_phrasea_queryParser
} }
if (!$t) if (!$t)
return($tree); return($tree);
switch ($t["CLASS"]) switch ($t["CLASS"])
{ {
@@ -1879,7 +1757,6 @@ class searchEngine_adapter_phrasea_queryParser
// if($this->debug) // if($this->debug)
// { // {
// printf("addtotree({tree}, \$t='%s', \$depth=%d, inquote=%s)\n", $t["VALUE"], $depth, $inquote?"true":"false"); // printf("addtotree({tree}, \$t='%s', \$depth=%d, inquote=%s)\n", $t["VALUE"], $depth, $inquote?"true":"false");
// var_dump($tree);
// } // }
if ($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE") if ($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE")
{ {
@@ -2129,10 +2006,9 @@ class searchEngine_adapter_phrasea_queryParser
$this->phq = $s . " " . $this->phq; $this->phq = $s . " " . $this->phq;
} }
function nexttoken($inquote=false) function nexttoken($inquote = false)
{ {
if ($this->phq == "") if ($this->phq == "")
return(null); return(null);
switch ($c = substr($this->phq, 0, 1)) switch ($c = substr($this->phq, 0, 1))
{ {
@@ -2267,10 +2143,8 @@ class searchEngine_adapter_phrasea_queryParser
$this->phq = $this->mb_ltrim(mb_substr($this->phq, $i + 1, 99999, 'UTF-8'), 'UTF-8'); $this->phq = $this->mb_ltrim(mb_substr($this->phq, $i + 1, 99999, 'UTF-8'), 'UTF-8');
} }
if ($t != "") if ($t != "")
return(array("CLASS" => "TOK_WORD", "VALUE" => $t)); return(array("CLASS" => "TOK_WORD", "VALUE" => $t));
else else
return(array("CLASS" => "TOK_VOID", "VALUE" => $t)); return(array("CLASS" => "TOK_VOID", "VALUE" => $t));
break; break;
} }

View File

@@ -713,8 +713,6 @@ class system_file extends SplFileObject
public function read_uuid() public function read_uuid()
{ {
$registry = registry::get_instance();
if ($this->uuid) if ($this->uuid)
return $this->uuid; return $this->uuid;
@@ -1390,7 +1388,7 @@ if (!function_exists('mime_content_type'))
, 'movie' => 'video/x-sgi-movie' // Videos MoviePlayer , 'movie' => 'video/x-sgi-movie' // Videos MoviePlayer
); );
$fileinfo = new system_file($f); $fileinfo = new system_file($f);
$extension = $fileinfo->get_extension(true); $ext = $fileinfo->get_extension(true);
return array_key_exists($ext, $ext2mime) ? return array_key_exists($ext, $ext2mime) ?
$ext2mime[$ext] : 'application/octet-stream'; $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); $collection = collection::get_from_coll_id($databox, $cid);
$record = record_adapter::create($collection, $system_file, false, true); $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->set_binary_status(databox_status::operation_or($stat0, $stat1));
$record->rebuild_subdefs(); $record->rebuild_subdefs();
$record->reindex(); $record->reindex();
@@ -1879,7 +1879,7 @@ class task_period_archive extends task_abstract
{ {
$collection = collection::get_from_base_id($base_id); $collection = collection::get_from_base_id($base_id);
$record = record_adapter::create($collection, $system_file, false, false); $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->set_binary_status(databox_status::operation_or(databox_status::operation_or($stat0, $stat1), databox_status::hex2bin($hexstat)));
$record->rebuild_subdefs(); $record->rebuild_subdefs();
$record->reindex(); $record->reindex();

View File

@@ -100,7 +100,7 @@ class task_period_batchupload extends task_appboxAbstract
$collection = collection::get_from_coll_id($databox, $coll_id); $collection = collection::get_from_coll_id($databox, $coll_id);
$record = record_adapter::create($collection, $system_file, $row2['filename'], false); $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->rebuild_subdefs();
$record->reindex(); $record->reindex();
unset($record); unset($record);

View File

@@ -1232,9 +1232,6 @@ class task_period_outofdate extends task_abstract
); );
phrasea::headers(200, true, 'application/json', 'UTF-8', false); phrasea::headers(200, true, 'application/json', 'UTF-8', false);
// return("hello4");
//var_dump($parm2);
//return;
$ret = NULL; $ret = NULL;
switch($parm2['ACT']) 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); unset($record);
} }
catch (Exception $e) catch (Exception $e)

View File

@@ -282,7 +282,6 @@ class task_period_writemeta extends task_databoxAbstract
{ {
$coll_id = $row['coll_id']; $coll_id = $row['coll_id'];
$record_id = $row['record_id']; $record_id = $row['record_id'];
$base_id = phrasea::baseFromColl($this->sbas_id, $coll_id);
$jeton = $row['jeton']; $jeton = $row['jeton'];
$record = new record_adapter($this->sbas_id, $record_id); $record = new record_adapter($this->sbas_id, $record_id);
@@ -303,91 +302,50 @@ class task_period_writemeta extends task_databoxAbstract
} }
} }
$uuid = $record->get_uuid();
$registry = $databox->get_registry(); $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(); $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) foreach ($fields as $field)
{ {
$meta = $field->get_databox_field(); $meta = $field->get_databox_field();
$fname = $field->get_name();
if (trim($meta->get_metadata_source()) === '') if (trim($meta->get_metadata_source()) === '')
continue; continue;
$tag = $meta->get_metadata_tagname();
$multi = $meta->is_multi(); $multi = $meta->is_multi();
$type = $meta->get_type(); $type = $meta->get_type();
$datas = $field->get_value(); $datas = $field->get_value();
$node = $nodedesc->appendChild($dom->createElement($tag));
if ($multi) if ($multi)
{ {
$node = $node->appendChild($dom->createElement('rdf:Bag'));
$datas = $field->get_value(); $datas = $field->get_value();
foreach ($datas as $value) foreach ($datas as $value)
{ {
$value = $this->format_value($type, $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 else
{ {
$datas = $this->format_value($type, $datas); $datas = $this->format_value($type, $datas);
$node->appendChild($dom->createTextNode($datas));
}
}
$temp = tempnam($registry->get('GV_RootPath') . 'tmp/', 'meta'); $subCMD .= '-'.$meta->get_metadata_namespace().':'.$meta->get_metadata_tagname().'=';
rename($temp, $tempxml = $temp . '.xml'); $subCMD .= escapeshellarg($datas).' ';
$dom->save($tempxml); }
}
foreach ($tsub as $name => $file) foreach ($tsub as $name => $file)
{ {
@@ -397,7 +355,10 @@ class task_period_writemeta extends task_databoxAbstract
$cmd .= ( $registry->get('GV_exiftool') . ' -m -overwrite_original '); $cmd .= ( $registry->get('GV_exiftool') . ' -m -overwrite_original ');
if ($name != 'document' || $this->clear_doc) if ($name != 'document' || $this->clear_doc)
$cmd .= '-all:all= '; $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)); $this->log(sprintf(('writing meta for sbas_id=%1$d - record_id=%2$d (%3$s)'), $this->sbas_id, $record_id, $name));
@@ -405,8 +366,7 @@ class task_period_writemeta extends task_databoxAbstract
$this->log("\t" . $s); $this->log("\t" . $s);
} }
return $this;
unlink($tempxml);
} }
protected function flush_records_sbas() protected function flush_records_sbas()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -108,17 +108,6 @@ class EntityBasketTest extends PhraseanetPHPUnitAuthenticatedAbstract
$date = $this->basket->getUpdated(); $date = $this->basket->getUpdated();
$this->assertInstanceOf('\DateTime', $date); $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() 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(); $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())); $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]; $field = $current_fields[0];
$multi_imploded = implode(' ' . $meta_el->get_separator() . ' ', array('un', 'jeu', 'de', 'test')); $multi_imploded = implode(' ' . $meta_el->get_separator() . ' ', array('un', 'jeu', 'de', 'test'));

View File

@@ -69,6 +69,7 @@
{% endif %} {% endif %}
{% for field in editing.get_fields() %} {% for field in editing.get_fields() %}
{% set i = field.get_id() %} {% set i = field.get_id() %}
{% if field.is_readonly() is empty %}
<div class="edit_field" id="EditFieldBox_{{i}}" onclick="return(edit_mdwn_fld(event, {{i}}, '{{field.get_name()}}'));" > <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 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=""/> <img src="/skins/icons/info.gif" tooltipsrc="/prod/tooltip/metas/FieldInfos/{{field.get_databox().get_sbas_id()}}/{{field.get_id()}}/" class="fieldTips" alt=""/>
@@ -80,6 +81,7 @@
</span> </span>
<span class="fieldvalue" id="idEditField_{{i}}" >???</span> <span class="fieldvalue" id="idEditField_{{i}}" >???</span>
</div> </div>
{% endif %}
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}

View File

@@ -88,7 +88,7 @@ if ((!is_null($parm['login']) && !is_null($parm['pwd'])) || $is_guest)
} }
catch (Exception_Session_MailLocked $e) 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) catch (Exception_Session_WrongToken $e)
{ {

View File

@@ -72,7 +72,7 @@ if ($parm['error'] !== null)
break; break;
case 'mailNotConfirm' : case 'mailNotConfirm' :
$errorWarning = '<div class="notice">' . _('login::erreur: Vous n\'avez pas confirme votre email') . '</div>'; $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>'; $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; break;
case 'no-base' : case 'no-base' :

View File

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

View File

@@ -176,22 +176,16 @@ if ($request->has_post_datas())
->set_position($parm['form_activity']) ->set_position($parm['form_activity'])
->set_geonameid($parm['form_geonameid']); ->set_geonameid($parm['form_geonameid']);
/**
* @todo implement this shit
*/
$fieldsname.= ",mail_locked";
$fieldsvalue.= ",'1'";
$newid = $user->get_id(); $newid = $user->get_id();
// //user cree, je branche autoregister si ya
// $autoSB = $autoB = array();
$demandOK = array(); $demandOK = array();
if ($registry->get('GV_autoregister')) 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])); $user->ACL()->apply_model($template_user, array_keys($inscOK[$base_id]));
} }
@@ -225,6 +219,7 @@ if ($request->has_post_datas())
if ($newUsrEmail) if ($newUsrEmail)
{ {
$user->set_mail_locked(true);
return phrasea::redirect('/login/sendmail-confirm.php?usr_id=' . $newid); return phrasea::redirect('/login/sendmail-confirm.php?usr_id=' . $newid);
} }

View File

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

View File

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

View File

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

View File

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