Merge with 3.7

This commit is contained in:
Romain Neutron
2012-10-16 15:56:43 +02:00
9 changed files with 199 additions and 121 deletions

View File

@@ -142,6 +142,9 @@ Cache:
xcache_cache: xcache_cache:
type: Cache\XcacheCache type: Cache\XcacheCache
wincache_cache:
type: Cache\WinCacheCache
Border: Border:
#Define Border service #Define Border service
#The border service handles checks validation constraints against incoming files #The border service handles checks validation constraints against incoming files

View File

@@ -0,0 +1,71 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Cache;
use Doctrine\Common\Cache\WincacheCache as DoctrineWinCache;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class WinCacheCache extends DoctrineWinCache implements Cache
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'wincache';
}
/**
* {@inheritdoc}
*/
public function isServer()
{
return false;
}
/**
* {@inheritdoc}
*/
public function isOnline()
{
return true;
}
/**
* {@inheritdoc}
*/
public function get($key)
{
if ( ! $this->contains($key)) {
throw new Exception('Unable to retrieve the value');
}
return $this->fetch($key);
}
/**
* {@inheritdoc}
*/
public function deleteMulti(array $keys)
{
foreach ($keys as $key) {
$this->delete($key);
}
return $this;
}
}

View File

@@ -13,6 +13,7 @@ namespace Alchemy\Phrasea\Command;
use Monolog\Handler\StreamHandler; use Monolog\Handler\StreamHandler;
use Alchemy\Phrasea\Command\Command; use Alchemy\Phrasea\Command\Command;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
@@ -64,7 +65,7 @@ class BuildMissingSubdefs extends Command
try { try {
$record->get_hd_file(); $record->get_hd_file();
} catch (\Exception_Media_SubdefNotFound $e) { } catch (FileNotFoundException $e) {
continue; continue;
} }

View File

@@ -0,0 +1,49 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\Service\Cache;
use Alchemy\Phrasea\Core,
Alchemy\Phrasea\Core\Service,
Alchemy\Phrasea\Core\Service\ServiceAbstract,
Alchemy\Phrasea\Core\Service\ServiceInterface,
Alchemy\Phrasea\Cache as CacheDriver;
/**
*
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class WinCacheCache extends ServiceAbstract
{
protected $cache;
public function getDriver()
{
if ( ! extension_loaded('wincache')) {
throw new \Exception('The WinCache cache requires the WinCache extension.');
}
if ( ! $this->cache) {
$this->cache = new CacheDriver\WinCacheCache();
$this->cache->setNamespace(md5(realpath(__DIR__ . '/../../../../../../')));
}
return $this->cache;
}
public function getType()
{
return 'wincache';
}
}

View File

@@ -31,7 +31,7 @@ class Video extends Audio
parent::__construct(); parent::__construct();
$this->registerOption(new OptionType\Range(_('GOP size'), self::OPTION_GOPSIZE, 1, 200, 25)); $this->registerOption(new OptionType\Range(_('GOP size'), self::OPTION_GOPSIZE, 1, 200, 25));
$this->registerOption(new OptionType\Range(_('Dimension'), self::OPTION_SIZE, 100, 2000, 600, 16)); $this->registerOption(new OptionType\Range(_('Dimension'), self::OPTION_SIZE, 64, 2000, 600, 16));
$this->registerOption(new OptionType\Range(_('Frame Rate'), self::OPTION_FRAMERATE, 1, 200, 20)); $this->registerOption(new OptionType\Range(_('Frame Rate'), self::OPTION_FRAMERATE, 1, 200, 20));
$this->registerOption(new OptionType\Enum(_('Video Codec'), self::OPTION_VCODEC, array('libx264', 'libvpx', 'libtheora'), 'libx264')); $this->registerOption(new OptionType\Enum(_('Video Codec'), self::OPTION_VCODEC, array('libx264', 'libvpx', 'libtheora'), 'libx264'));
$this->unregisterOption(self::OPTION_ACODEC); $this->unregisterOption(self::OPTION_ACODEC);

View File

@@ -1381,7 +1381,11 @@ class ACL implements cache_cacheableInterface
$this->give_access_to_base(array($base_id_dest)); $this->give_access_to_base(array($base_id_dest));
$rights = array(); $rights = array(
'mask_and' => $row['mask_and'],
'mask_xor' => $row['mask_xor'],
);
if ($row['canputinalbum']) if ($row['canputinalbum'])
$rights['canputinalbum'] = true; $rights['canputinalbum'] = true;
if ($row['candwnldhd']) if ($row['candwnldhd'])
@@ -1415,6 +1419,14 @@ class ACL implements cache_cacheableInterface
$this->update_rights_to_base($base_id_dest, $rights); $this->update_rights_to_base($base_id_dest, $rights);
if ($row['time_limited']) {
$this->set_limits($base_id_dest, $row['time_limited'], new \DateTime($row['limited_from']), new \DateTime($row['limited_to']));
}
if ($row['restrict_dwnld']) {
$this->set_quotas_on_base($base_id_dest, $row['month_dwnld_max'], $row['remain_dwnld']);
}
return $this; return $this;
} }

View File

@@ -114,7 +114,7 @@ class searchEngine_adapter_phrasea_queryParser
public function parsequery($phq) public function parsequery($phq)
{ {
if ($this->debug) { if ($this->debug) {
for ($i = 0; $i < mb_strlen($phq, 'UTF-8'); $i ++ ) { for ($i = 0; $i < mb_strlen($phq, 'UTF-8'); $i++) {
$c = mb_substr($phq, $i, 1, 'UTF-8'); $c = mb_substr($phq, $i, 1, 'UTF-8');
printf("// %s : '%s' (%d octets)\n", $i, $c, strlen($c)); printf("// %s : '%s' (%d octets)\n", $i, $c, strlen($c));
} }
@@ -351,7 +351,7 @@ class searchEngine_adapter_phrasea_queryParser
public function priority_opk(&$tree, $depth = 0) public function priority_opk(&$tree, $depth = 0)
{ {
if ( ! $tree) { if (!$tree) {
return; return;
} }
@@ -371,7 +371,7 @@ class searchEngine_adapter_phrasea_queryParser
public function distrib_opk(&$tree, $depth = 0) public function distrib_opk(&$tree, $depth = 0)
{ {
if ( ! $tree) { if (!$tree) {
return; return;
} }
@@ -398,7 +398,7 @@ class searchEngine_adapter_phrasea_queryParser
public function thesaurus2_apply(&$tree, $bid) public function thesaurus2_apply(&$tree, $bid)
{ {
if ( ! $tree) { if (!$tree) {
return; return;
} }
@@ -457,7 +457,7 @@ 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é
} }
@@ -473,7 +473,7 @@ class searchEngine_adapter_phrasea_queryParser
if (isset($tree["RB"]["CONTEXT"])) if (isset($tree["RB"]["CONTEXT"]))
$copy["CONTEXT"] = $tree["CONTEXT"] = $tree["RB"]["CONTEXT"]; $copy["CONTEXT"] = $tree["CONTEXT"] = $tree["RB"]["CONTEXT"];
else else
if ( ! $keepfuzzy) if (!$keepfuzzy)
$copy["CONTEXT"] = $tree["CONTEXT"] = "*"; $copy["CONTEXT"] = $tree["CONTEXT"] = "*";
$copy["RB"]["SREF"] = &$tree["RB"]; $copy["RB"]["SREF"] = &$tree["RB"];
@@ -534,7 +534,7 @@ class searchEngine_adapter_phrasea_queryParser
if ($context !== null) if ($context !== null)
$tmp["RB"]["CONTEXT"] = $context; $tmp["RB"]["CONTEXT"] = $context;
else else
if ( ! $keepfuzzy) if (!$keepfuzzy)
$tmp["RB"]["CONTEXT"] = "*"; $tmp["RB"]["CONTEXT"] = "*";
// corrige les profondeurs des 2 copies du 'simple' d'origine // corrige les profondeurs des 2 copies du 'simple' d'origine
$tmp["LB"]["DEPTH"] += 1; $tmp["LB"]["DEPTH"] += 1;
@@ -561,7 +561,7 @@ class searchEngine_adapter_phrasea_queryParser
if ($context !== null) if ($context !== null)
$tmp["CONTEXT"] = $context; $tmp["CONTEXT"] = $context;
else else
if ( ! $keepfuzzy) if (!$keepfuzzy)
$tmp["CONTEXT"] = "*"; $tmp["CONTEXT"] = "*";
// corrige la profondeur de la copie du 'simple' d'origine // corrige la profondeur de la copie du 'simple' d'origine
$tmp["RB"]["DEPTH"] += 1; $tmp["RB"]["DEPTH"] += 1;
@@ -581,7 +581,7 @@ class searchEngine_adapter_phrasea_queryParser
if ($depth == 0) if ($depth == 0)
$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);
} }
@@ -606,7 +606,7 @@ class searchEngine_adapter_phrasea_queryParser
for ($n = $node->firstChild; $n; $n = $n->nextSibling) { for ($n = $node->firstChild; $n; $n = $n->nextSibling) {
if ($n->nodeName == "sy") { if ($n->nodeName == "sy") {
$lng = $n->getAttribute("lng"); $lng = $n->getAttribute("lng");
if ( ! array_key_exists($lng, $tsy)) if (!array_key_exists($lng, $tsy))
$tsy[$lng] = array(); $tsy[$lng] = array();
$zsy = array("v" => $n->getAttribute("v"), "w" => $n->getAttribute("w"), "k" => $n->getAttribute("k")); $zsy = array("v" => $n->getAttribute("v"), "w" => $n->getAttribute("w"), "k" => $n->getAttribute("k"));
@@ -658,7 +658,7 @@ class searchEngine_adapter_phrasea_queryParser
} }
} }
$n->removeAttribute("marked"); $n->removeAttribute("marked");
for ($i = 0; array_key_exists($syfound . $i, $tsort) && $i < 9999; $i ++ ) for ($i = 0; array_key_exists($syfound . $i, $tsort) && $i < 9999; $i++)
; ;
$tsort[$syfound . $i] = $n; $tsort[$syfound . $i] = $n;
} }
@@ -731,7 +731,7 @@ class searchEngine_adapter_phrasea_queryParser
$t = $w = implode(" ", $w); $t = $w = implode(" ", $w);
if (isset($tree["CONTEXT"])) { if (isset($tree["CONTEXT"])) {
if ( ! $tree["CONTEXT"]) { if (!$tree["CONTEXT"]) {
$x0 = "@w=\"" . $w . "\" and not(@k)"; $x0 = "@w=\"" . $w . "\" and not(@k)";
} else { } else {
if ($tree["CONTEXT"] == "*") { if ($tree["CONTEXT"] == "*") {
@@ -753,7 +753,7 @@ class searchEngine_adapter_phrasea_queryParser
$dxp = new DOMXPath($domthe); $dxp = new DOMXPath($domthe);
$nodes = $dxp->query($x); $nodes = $dxp->query($x);
if ( ! isset($tree["RB"]["SREF"]["TIDS"])) if (!isset($tree["RB"]["SREF"]["TIDS"]))
$tree["RB"]["SREF"]["TIDS"] = array(); $tree["RB"]["SREF"]["TIDS"] = array();
if ($nodes->length >= 1) { if ($nodes->length >= 1) {
if ($nodes->length == 1) { if ($nodes->length == 1) {
@@ -764,8 +764,8 @@ class searchEngine_adapter_phrasea_queryParser
// on cherche plusieurs id's, on utilisera la syntaxe 'regexp' (l'extension repérera elle meme la syntaxe car la value finira par '$') // on cherche plusieurs id's, on utilisera la syntaxe 'regexp' (l'extension repérera elle meme la syntaxe car la value finira par '$')
$val = ""; $val = "";
foreach ($nodes as $node) { foreach ($nodes as $node) {
if ( ! isset($tree["CONTEXT"])) if (!isset($tree["CONTEXT"]))
$ambigus ++; $ambigus++;
$this->addtoTIDS($tree["RB"], $bid, $node); $this->addtoTIDS($tree["RB"], $bid, $node);
} }
} }
@@ -775,74 +775,15 @@ class searchEngine_adapter_phrasea_queryParser
$this->proposals["BASES"]["b$bid"]["TERMS"][$path]["HTML"] = $prophtml; $this->proposals["BASES"]["b$bid"]["TERMS"][$path]["HTML"] = $prophtml;
} else { } else {
// le mot n'est pas dans le thesaurus // le mot n'est pas dans le thesaurus
$tree = null;
} }
return($ambigus); return($ambigus);
} }
/*
function dead_setTids(&$tree, &$simple, $bid, &$domthe, $searchsynonyms)
{
// if($this->debug)
print("setTids:\n\$tree=" . var_export($tree, true) . "\n");
$ambigus = 0;
if(is_array($w = $simple["VALUE"]))
$t = $w = implode(" ", $w);
if (isset($tree["CONTEXT"])) {
if (!$tree["CONTEXT"]) {
$x0 = "@w=\"" . $w ."\" and not(@k)";
} else {
if ($tree["CONTEXT"]=="*") {
$x0 = "@w=\"" . $w ."\"";
} else {
$x0 = "@w=\"" . $w ."\" and @k=\"" . $tree["CONTEXT"] . "\"";
$t .= " (" . $tree["CONTEXT"] . ")";
}
}
} else {
$x0 = "@w=\"" . $w ."\"";
}
$x = "/thesaurus//sy[" . $x0 ."]";
if($this->debug)
printf("searching thesaurus with xpath='%s'<br/>\n", $x);
$dxp = new DOMXPath($domthe);
$nodes = $dxp->query($x);
if(!isset($tree["RB"]["SREF"]["TIDS"]))
$tree["RB"]["SREF"]["TIDS"] = array();
if ($nodes->length >= 1) {
if ($nodes->length == 1) {
// on cherche un id simple, on utilisera la syntaxe sql 'like' (l'extension repérera elle méme la syntaxe car la value finira par '%')
$this->addtoTIDS($tree["RB"], $bid, $nodes->item(0));
// $this->thesaurusDOMNodes[] = $nodes->item(0);
} else {
// on cherche plusieurs id's, on utilisera la syntaxe 'regexp' (l'extension repérera elle meme la syntaxe car la value finira par '$')
$val = "";
foreach ($nodes as $node) {
if(!isset($tree["CONTEXT"]))
$ambigus++;
$this->addtoTIDS($tree["RB"], $bid, $node);
}
}
$path = $tree["RB"]["SREF"]["PATH"];
$prophtml = "";
$this->propAsHTML($domthe->documentElement, $prophtml, $path);
$this->proposals["TERMS"][$path]["HTML"] = $prophtml;
} else {
// le mot n'est pas dans le thesaurus
}
return($ambigus);
}
*/
public function containsColonOperator(&$tree) public 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")) {
@@ -870,7 +811,7 @@ class searchEngine_adapter_phrasea_queryParser
if ($this->debug) if ($this->debug)
printf("found node id='%s', v='%s' w='%s', k='%s', p='%s' for node-path=%s \n", $id, $DOMnode->getAttribute("v"), $w, $k, $p, $path); printf("found node id='%s', v='%s' w='%s', k='%s', p='%s' for node-path=%s \n", $id, $DOMnode->getAttribute("v"), $w, $k, $p, $path);
if ( ! $k) if (!$k)
$k = null; $k = null;
$found = false; $found = false;
@@ -889,11 +830,11 @@ class searchEngine_adapter_phrasea_queryParser
// } // }
} }
} }
if ( ! $found) if (!$found)
$extendednode["SREF"]["TIDS"][] = array("bid" => $bid, "pid" => $pid, "id" => $id, "w" => $w, "k" => $k, "lng" => $lng, "p" => $p); $extendednode["SREF"]["TIDS"][] = array("bid" => $bid, "pid" => $pid, "id" => $id, "w" => $w, "k" => $k, "lng" => $lng, "p" => $p);
// on liste les propositions de thésaurus pour ce node (dans l'arbre simple) // on liste les propositions de thésaurus pour ce node (dans l'arbre simple)
if ( ! isset($this->proposals["BASES"]["b$bid"]["TERMS"][$path])) { if (!isset($this->proposals["BASES"]["b$bid"]["TERMS"][$path])) {
// $this->proposals["TERMS"][$path] = array("TERM"=>implode(" ", $extendednode["VALUE"]), "PROPOSALS"=>array()); // $this->proposals["TERMS"][$path] = array("TERM"=>implode(" ", $extendednode["VALUE"]), "PROPOSALS"=>array());
$term = implode(" ", $extendednode["VALUE"]); $term = implode(" ", $extendednode["VALUE"]);
if (isset($extendednode["CONTEXT"]) && $extendednode["CONTEXT"]) { if (isset($extendednode["CONTEXT"]) && $extendednode["CONTEXT"]) {
@@ -914,7 +855,7 @@ class searchEngine_adapter_phrasea_queryParser
// puis par remonter au père // puis par remonter au père
for ($node = $DOMnode->parentNode; $node && $node->nodeType == XML_ELEMENT_NODE && $node->parentNode; $node = $node->parentNode) { for ($node = $DOMnode->parentNode; $node && $node->nodeType == XML_ELEMENT_NODE && $node->parentNode; $node = $node->parentNode) {
$id = $node->getAttribute("id"); $id = $node->getAttribute("id");
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");
} }
@@ -937,7 +878,7 @@ class searchEngine_adapter_phrasea_queryParser
$txt .= $tab . "\t\"" . $w . ""; $txt .= $tab . "\t\"" . $w . "";
$txt .= $tab . "\t<span id='thamb_w_" . $ambiguites["n"] . "'></span>\""; $txt .= $tab . "\t<span id='thamb_w_" . $ambiguites["n"] . "'></span>\"";
$txt .= $tab . "</span></b>\n"; $txt .= $tab . "</span></b>\n";
$ambiguites["n"] ++; $ambiguites["n"]++;
} else { } else {
if (isset($tree["CONTEXT"])) if (isset($tree["CONTEXT"]))
$w .= "[" . $tree["CONTEXT"] . "]"; $w .= "[" . $tree["CONTEXT"] . "]";
@@ -972,7 +913,7 @@ class searchEngine_adapter_phrasea_queryParser
public function get_ambigu(&$tree, $mouseCallback = "void", $depth = 0) public function get_ambigu(&$tree, $mouseCallback = "void", $depth = 0)
{ {
if ( ! $tree) { if (!$tree) {
return(""); return("");
} }
@@ -994,22 +935,22 @@ class searchEngine_adapter_phrasea_queryParser
public function set_default(&$tree, &$emptyw, $depth = 0) public 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 !
// jy 20041223 : ne pas appliquer d'op. par def. derriere un op arith. // jy 20041223 : ne pas appliquer d'op. par def. derriere un op arith.
// ex : "d < 1/2/2003" : grouper la liste "1","2","2004" en "mot" unique // ex : "d < 1/2/2003" : grouper la liste "1","2","2004" en "mot" unique
if ( ! $tree["LB"] || ($tree["LB"]["CLASS"] != "SIMPLE" && $tree["LB"]["CLASS"] != "QSIMPLE") || (is_array($tree["LB"]["VALUE"]) && count($tree["LB"]["VALUE"]) != 1)) { if (!$tree["LB"] || ($tree["LB"]["CLASS"] != "SIMPLE" && $tree["LB"]["CLASS"] != "QSIMPLE") || (is_array($tree["LB"]["VALUE"]) && count($tree["LB"]["VALUE"]) != 1)) {
// un op. arith. doit étre précédé d'un seul nom de champ // un op. arith. doit étre précédé d'un seul nom de champ
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= sprintf("\\n"); $this->errmsg .= sprintf("\\n");
@@ -1017,7 +958,7 @@ class searchEngine_adapter_phrasea_queryParser
return(false); return(false);
} }
if ( ! $tree["RB"] || ($tree["RB"]["CLASS"] != "SIMPLE" && $tree["RB"]["CLASS"] != "QSIMPLE")) { if (!$tree["RB"] || ($tree["RB"]["CLASS"] != "SIMPLE" && $tree["RB"]["CLASS"] != "QSIMPLE")) {
// un op. arith. doit étre suivi d'une valeur // un op. arith. doit étre suivi d'une valeur
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= sprintf("\\n"); $this->errmsg .= sprintf("\\n");
@@ -1036,21 +977,21 @@ class searchEngine_adapter_phrasea_queryParser
/** gestion des branches null /** gestion des branches null
* a revoir car ca ppete pas d'erreur mais corrige automatiquement * a revoir car ca ppete pas d'erreur mais corrige automatiquement
* ** */ * ** */
if ( ! isset($tree["RB"])) if (!isset($tree["RB"]))
$tree = $tree["LB"]; $tree = $tree["LB"];
else else
if ( ! isset($tree["LB"])) if (!isset($tree["LB"]))
$tree = $tree["RB"]; $tree = $tree["RB"];
} else { } else {
if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE")) { if (($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE")) {
if (is_array($tree["VALUE"])) { if (is_array($tree["VALUE"])) {
$treetmp = null; $treetmp = null;
$pnum = 0; $pnum = 0;
for ($i = 0; $i < count($tree["VALUE"]); $i ++ ) { for ($i = 0; $i < count($tree["VALUE"]); $i++) {
// gestion mot vide // gestion mot vide
if (isset($emptyw[$tree["VALUE"][$i]]) || $tree["VALUE"][$i] == "?" || $tree["VALUE"][$i] == "*") { if (isset($emptyw[$tree["VALUE"][$i]]) || $tree["VALUE"][$i] == "?" || $tree["VALUE"][$i] == "*") {
// on a forcé les '?' ou '*' isolés comme des mots vides // on a forcé les '?' ou '*' isolés comme des mots vides
$pnum ++; $pnum++;
} else { } else {
if ($treetmp == null) { if ($treetmp == null) {
$treetmp = array("CLASS" => $tree["CLASS"], $treetmp = array("CLASS" => $tree["CLASS"],
@@ -1109,7 +1050,7 @@ class searchEngine_adapter_phrasea_queryParser
unset($tree["LB"]); unset($tree["LB"]);
unset($tree["RB"]); unset($tree["RB"]);
unset($tree["PNUM"]); unset($tree["PNUM"]);
$nmodif ++; $nmodif++;
} else { } else {
$nmodif += $this->factor_or2($tree["LB"], $depth + 1); $nmodif += $this->factor_or2($tree["LB"], $depth + 1);
$nmodif += $this->factor_or2($tree["RB"], $depth + 1); $nmodif += $this->factor_or2($tree["RB"], $depth + 1);
@@ -1223,7 +1164,7 @@ class searchEngine_adapter_phrasea_queryParser
} }
$tmp = $onedate; $tmp = $onedate;
if ( ! is_array($tmp)) if (!is_array($tmp))
$tmp = explode(" ", $tmp); $tmp = explode(" ", $tmp);
switch (sizeof($tmp)) { switch (sizeof($tmp)) {
@@ -1477,7 +1418,7 @@ class searchEngine_adapter_phrasea_queryParser
if ($inquote) { if ($inquote) {
// 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 {
@@ -1496,16 +1437,16 @@ class searchEngine_adapter_phrasea_queryParser
if ($inquote) { if ($inquote) {
// 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
if ( ! $tree) if (!$tree)
$tree = $this->maketree($depth + 1); $tree = $this->maketree($depth + 1);
else { else {
if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) { if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) {
$tree["RB"] = $this->maketree($depth + 1); $tree["RB"] = $this->maketree($depth + 1);
if ( ! $tree["RB"]) if (!$tree["RB"])
$tree = null; $tree = null;
} else { } else {
// ici on applique l'opérateur par défaut // ici on applique l'opérateur par défaut
@@ -1518,7 +1459,7 @@ class searchEngine_adapter_phrasea_queryParser
"RB" => $this->maketree($depth + 1)); "RB" => $this->maketree($depth + 1));
} }
} }
if ( ! $tree) { if (!$tree) {
return(null); return(null);
} }
} }
@@ -1547,12 +1488,12 @@ class searchEngine_adapter_phrasea_queryParser
print("OPENING QUOTE!<br>"); print("OPENING QUOTE!<br>");
} }
// ouverture des guillemets -> récursivité // ouverture des guillemets -> récursivité
if ( ! $tree) if (!$tree)
$tree = $this->maketree($depth + 1, true); $tree = $this->maketree($depth + 1, true);
else { else {
if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) { if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) {
$tree["RB"] = $this->maketree($depth + 1, true); $tree["RB"] = $this->maketree($depth + 1, true);
if ( ! $tree["RB"]) if (!$tree["RB"])
$tree = null; $tree = null;
} else { } else {
// ici on applique l'opérateur par défaut // ici on applique l'opérateur par défaut
@@ -1565,7 +1506,7 @@ class searchEngine_adapter_phrasea_queryParser
"RB" => $this->maketree($depth + 1, true)); "RB" => $this->maketree($depth + 1, true));
} }
} }
if ( ! $tree) { if (!$tree) {
return(null); return(null);
} }
} }
@@ -1577,7 +1518,7 @@ class searchEngine_adapter_phrasea_queryParser
var_dump($tree); var_dump($tree);
print("-------------------------\n"); print("-------------------------\n");
} }
if ( ! $tree) { if (!$tree) {
return(null); return(null);
} }
break; break;
@@ -1602,7 +1543,7 @@ class searchEngine_adapter_phrasea_queryParser
print("-------------------------\n"); print("-------------------------\n");
} }
if ( ! $t) { if (!$t) {
return($tree); return($tree);
} }
@@ -1616,7 +1557,7 @@ class searchEngine_adapter_phrasea_queryParser
// un [xxx] suit un terme : il introduit un contexte // un [xxx] suit un terme : il introduit un contexte
$tree["CONTEXT"] = $t["VALUE"]; $tree["CONTEXT"] = $t["VALUE"];
} elseif ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") { } elseif ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") {
if ( ! isset($tree["RB"]) || ! $tree["RB"]) { if (!isset($tree["RB"]) || !$tree["RB"]) {
// un [xxx] peut suivre un opérateur, c'est un paramétre normalement numérique // un [xxx] peut suivre un opérateur, c'est un paramétre normalement numérique
$tree["PNUM"] = $t["VALUE"]; $tree["PNUM"] = $t["VALUE"];
} else { } else {
@@ -1643,7 +1584,7 @@ class searchEngine_adapter_phrasea_queryParser
break; break;
case "TOK_CMP": case "TOK_CMP":
// < > <= >= <> = : sont des opérateurs de comparaison // < > <= >= <> = : sont des opérateurs de comparaison
if ( ! $tree) { if (!$tree) {
// printf("\nUne question ne peut commencer par '" . $t["VALUE"] . "'<br>"); // printf("\nUne question ne peut commencer par '" . $t["VALUE"] . "'<br>");
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= "\\n"; $this->errmsg .= "\\n";
@@ -1663,9 +1604,9 @@ class searchEngine_adapter_phrasea_queryParser
return(array("CLASS" => "OPK", "VALUE" => $t["VALUE"], "NODETYPE" => $this->opk[$t["VALUE"]]["NODETYPE"], "PNUM" => null, "DEPTH" => $depth, "LB" => $tree, "RB" => null)); return(array("CLASS" => "OPK", "VALUE" => $t["VALUE"], "NODETYPE" => $this->opk[$t["VALUE"]]["NODETYPE"], "PNUM" => null, "DEPTH" => $depth, "LB" => $tree, "RB" => null));
break; break;
case "TOK_WORD": case "TOK_WORD":
if ($t["CLASS"] == "TOK_WORD" && isset($this->ops[$t["VALUE"]]) && ! $inquote) { if ($t["CLASS"] == "TOK_WORD" && isset($this->ops[$t["VALUE"]]) && !$inquote) {
// ce mot est un opérateur phrasea // ce mot est un opérateur phrasea
if ( ! $tree) { if (!$tree) {
// printf("\n581 : Une question ne peut commencer par un opérateur<br>"); // printf("\n581 : Une question ne peut commencer par un opérateur<br>");
if ($this->errmsg != "") if ($this->errmsg != "")
$this->errmsg .= "\\n"; $this->errmsg .= "\\n";
@@ -1698,7 +1639,7 @@ class searchEngine_adapter_phrasea_queryParser
// ce mot n'est pas un opérateur // ce mot n'est pas un opérateur
$pnum = null; $pnum = null;
$nodetype = PHRASEA_KEYLIST; $nodetype = PHRASEA_KEYLIST;
if ($t["CLASS"] == "TOK_WORD" && isset($this->spw[$t["VALUE"]]) && ! $inquote) { if ($t["CLASS"] == "TOK_WORD" && isset($this->spw[$t["VALUE"]]) && !$inquote) {
// mais c'est un mot 'spécial' de phrasea ('last', 'all') // mais c'est un mot 'spécial' de phrasea ('last', 'all')
$type = $this->spw[$t["VALUE"]]["CLASS"]; $type = $this->spw[$t["VALUE"]]["CLASS"];
$nodetype = $this->spw[$t["VALUE"]]["NODETYPE"]; $nodetype = $this->spw[$t["VALUE"]]["NODETYPE"];
@@ -1727,7 +1668,7 @@ class searchEngine_adapter_phrasea_queryParser
$nok = 0; $nok = 0;
$w = $t["VALUE"]; $w = $t["VALUE"];
if ($w != "?" && $w != "*") { // on laisse passer les 'isolés' pour les traiter plus tard comme des mots vides if ($w != "?" && $w != "*") { // on laisse passer les 'isolés' pour les traiter plus tard comme des mots vides
for ($i = 0; $i < strlen($w); $i ++ ) { for ($i = 0; $i < strlen($w); $i++) {
$c = substr($w, $i, 1); $c = substr($w, $i, 1);
if ($c == "?" || $c == "*") { if ($c == "?" || $c == "*") {
if ($nok < $this->app['phraseanet.registry']->get('GV_min_letters_truncation')) { if ($nok < $this->app['phraseanet.registry']->get('GV_min_letters_truncation')) {
@@ -1739,10 +1680,10 @@ class searchEngine_adapter_phrasea_queryParser
} }
// $nok = 0; // $nok = 0;
} else } else
$nok ++; $nok++;
} }
} }
if ( ! $tree) { if (!$tree) {
return(array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth)); return(array("CLASS" => $type, "NODETYPE" => $nodetype, "VALUE" => array($t["VALUE"]), "PNUM" => $pnum, "DEPTH" => $depth));
} }
switch ($tree["CLASS"]) { switch ($tree["CLASS"]) {
@@ -1927,8 +1868,8 @@ class searchEngine_adapter_phrasea_queryParser
$l = mb_strlen($this->phq, 'UTF-8'); $l = mb_strlen($this->phq, 'UTF-8');
$t = ""; $t = "";
$c_utf8 = ""; $c_utf8 = "";
for ($i = 0; $i < $l; $i ++ ) { for ($i = 0; $i < $l; $i++) {
if ( ! $this->unicode->has_indexer_bad_char(($c_utf8 = mb_substr($this->phq, $i, 1, 'UTF-8')))) { if (!$this->unicode->has_indexer_bad_char(($c_utf8 = mb_substr($this->phq, $i, 1, 'UTF-8')))) {
// $c = mb_strtolower($c); // $c = mb_strtolower($c);
// $t .= isset($this->noaccent[$c]) ? $this->noaccent[$c] : $c; // $t .= isset($this->noaccent[$c]) ? $this->noaccent[$c] : $c;
$t .= $this->unicode->remove_diacritics(mb_strtolower($c_utf8)); $t .= $this->unicode->remove_diacritics(mb_strtolower($c_utf8));

View File

@@ -105,7 +105,7 @@
<input type="hidden" name="ssttid" value="{{ssttid}}"/> <input type="hidden" name="ssttid" value="{{ssttid}}"/>
{% for name, values in download.get_display_download() %} {% for name, values in download.get_display_download() %}
{% if values.available > 0 %} {% if values.available > 0 %}
<div style="margin: 10px 0 20px 0; padding: 0 10px;"> <div class="well-small">
<label for="download_{{name}}" class="checkbox"> <label for="download_{{name}}" class="checkbox">
<input class="{{values.class}}" type="checkbox" id="download_{{name}}" name="obj[]" value="{{name}}" /> <input class="{{values.class}}" type="checkbox" id="download_{{name}}" name="obj[]" value="{{name}}" />
<input type="hidden" name="download_{{name}}" value="{{values.size}}" /> <input type="hidden" name="download_{{name}}" value="{{values.size}}" />
@@ -119,7 +119,7 @@
{% endif %} {% endif %}
</label> </label>
{% if values.refused|length > 0 %} {% if values.refused|length > 0 %}
<div style="display:none;" class="undisposable"> <div style="display:none;" class="undisposable well-small">
<div>{% trans 'Les documents ne peuvent pas etre exportes' %}</div> <div>{% trans 'Les documents ne peuvent pas etre exportes' %}</div>
{% for datas in values.refused%} {% for datas in values.refused%}
{{ thumbnail.format(datas, 80, 80,'', true, false) }} {{ thumbnail.format(datas, 80, 80,'', true, false) }}
@@ -130,7 +130,7 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% if download.has_business_fields_access() %} {% if download.has_business_fields_access() %}
<div class="businessfields" style="margin-left:20px;display:none;"> <div class="businessfields well-small" style="margin-left:20px;display:none;">
<label for="business_download" class="checkbox"> <label for="business_download" class="checkbox">
<input type="checkbox" name="businessfields" id="business_download" value="1" /> <input type="checkbox" name="businessfields" id="business_download" value="1" />
{% trans 'Include Business-fields in caption' %} {% trans 'Include Business-fields in caption' %}
@@ -140,7 +140,7 @@
{{ _self.choose_title('download', choose_export_title, default_export_title) }} {{ _self.choose_title('download', choose_export_title, default_export_title) }}
{% if registry.get('GV_requireTOUValidationForExport') == true %} {% if registry.get('GV_requireTOUValidationForExport') == true %}
<div style="margin:0 20px;"> <div class="well-small">
<label for="TOU_acceptDL" class="checkbox"> <label for="TOU_acceptDL" class="checkbox">
<input type="checkbox" name="TOU_accept" id="TOU_acceptDL" value="1" /> <input type="checkbox" name="TOU_accept" id="TOU_acceptDL" value="1" />
{% set beginning_link = '<a href="/prod/TOU/" class="TOUview">' %} {% set beginning_link = '<a href="/prod/TOU/" class="TOUview">' %}

View File

@@ -613,6 +613,7 @@ var p4 = p4 || {};
function(){ function(){
answerSizer(); answerSizer();
linearize(); linearize();
$('#answers').trigger('resize');
}); });
frame.addClass('closed'); frame.addClass('closed');
$('.escamote', frame).hide(); $('.escamote', frame).hide();