Remove commented code

This commit is contained in:
Romain Neutron
2013-11-20 16:04:20 +01:00
parent 8663f49228
commit cae61dfe1e
11 changed files with 5 additions and 131 deletions

View File

@@ -517,7 +517,6 @@ class Thesaurus implements ControllerProviderInterface
foreach ($t_sort as $i => $query) {
$topic = $topics->appendChild($dom->createElement('topic'));
// $topic->setAttribute('id', $n->getAttribute('id'));
if ($opened_display != '' && in_array($t_node[$i]['node']->getAttribute('id'), $obr)) {
$topic->setAttribute('view', $opened_display);
}
@@ -902,10 +901,8 @@ class Thesaurus implements ControllerProviderInterface
if (in_array($fieldname, $request->get('field', [])) != $ck) {
if ($ck) {
// print("il etait lie a la branche, il ne l'est plus<br/>\n");
unset($tids[$request->get('tid')]);
} else {
// print("il n'etait pas lie a la branche, il l'est maintenant<br/>\n");
$tids[$request->get('tid')] = $xpathth->query("/thesaurus//te[@id='" . \thesaurus::xquery_escape($request->get('tid')) . "']")->item(0);
}
$newtbranch = "";
@@ -1782,7 +1779,6 @@ class Thesaurus implements ControllerProviderInterface
$delsy = $delte->appendChild($domct->createElement("sy"));
$delsy->setAttribute("id", $newid = ($delid . "." . $delteid . ".0"));
// $delsy->setAttribute("id", $newid = ($delid . "." . $delteid));
$delsy->setAttribute("lng", $sy0->getAttribute("lng"));
$delsy->setAttribute("v", $sy0->getAttribute("v"));
$delsy->setAttribute("w", $sy0->getAttribute("w"));
@@ -2127,7 +2123,6 @@ class Thesaurus implements ControllerProviderInterface
$fp = $root->appendchild($ret->createElement("fullpath_html"));
$fp->appendChild($ret->createTextNode($fullpath_html));
// $id = "S" . str_replace(".", "d", substr($nodes->item(0)->getAttribute("id"), 1)) . "d";
$id = str_replace(".", "d", $nodes->item(0)->getAttribute("id")) . "d";
$hits = "0";
@@ -2251,10 +2246,6 @@ class Thesaurus implements ControllerProviderInterface
$lng = $n2->getAttribute("lng");
$t = $n2->getAttribute("v");
$ksy = $n2->getAttribute("w");
if ($k = $n2->getAttribute("k")) {
// $t .= " ($k)";
// $ksy .= " ($k)";
}
if (! $firstksy) {
$firstksy = $ksy;
}
@@ -2314,7 +2305,6 @@ class Thesaurus implements ControllerProviderInterface
$sy->setAttribute("lng", $lng = $n->getAttribute("lng"));
if (($k = $n->getAttribute("k"))) {
$sy->setAttribute("k", $k);
// $t .= " (" . $k . ")";
}
$sy->setAttribute("t", $t);
if ($n->getAttribute("id") == $sel) {
@@ -3005,7 +2995,6 @@ class Thesaurus implements ControllerProviderInterface
}
$q = "/cterms//te[./sy[$q]]";
// $root->appendChild($ret->createCDATASection( $q ));
$nodes = $xpathct->query($q);
// le terme peut etre present dans plusieurs candidats
for ($i = 0; $i < $nodes->length; $i ++) {

View File

@@ -577,7 +577,6 @@ class Xmlhttp implements ControllerProviderInterface
$t = $n2->getAttribute("v");
$ksy = $n2->getAttribute("w");
if ($k = $n2->getAttribute("k")) {
// $t .= " ($k)";
$ksy .= " ($k)";
}
if (!$firstksy) {
@@ -1379,7 +1378,6 @@ class Xmlhttp implements ControllerProviderInterface
try {
$databox = $appbox->get_databox($sbas['sbas_id']);
$connbas = $databox->get_connection();
// $domth = $databox->get_dom_thesaurus();
$tsbas[$ksbas]['domct'] = $databox->get_dom_cterms();
} catch (\Exception $e) {
continue;

View File

@@ -13,12 +13,6 @@ namespace Alchemy\Phrasea\SearchEngine\Phrasea;
use Alchemy\Phrasea\Application;
/**
*
* @package searchEngine
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class PhraseaEngineQueryParser
{
public $ops = [
@@ -53,8 +47,6 @@ class PhraseaEngineQueryParser
"last" => [
"CLASS" => "PHRASEA_KW_LAST", "NODETYPE" => PHRASEA_KW_LAST, "CANNUM" => true
],
// "first" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true),
// "premiers" => array("CLASS"=>PHRASEA_KW_FIRST, "CANNUM"=>true),
"tout" => [
"CLASS" => "PHRASEA_KW_ALL", "NODETYPE" => PHRASEA_KW_ALL, "CANNUM" => false
],
@@ -268,12 +260,6 @@ class PhraseaEngineQueryParser
else
printf(str_repeat("\t", $depth) . "<b><font color='blue'>%s</font></b>\n", $tree["VALUE"][0]);
break;
// case PHRASEA_KW_FIRST:
// if($tree["PNUM"]!==null)
// printf("<b><font color='blue'>%s <i>%s</i></font></b>", $tree["VALUE"], $tree["PNUM"]);
// else
// printf("<b><font color='blue'>%s</font></b>", $tree["VALUE"]);
// break;
case "OPS":
case "OPK":
print(str_repeat("\t", $depth) . "<div>\n");
@@ -319,12 +305,6 @@ class PhraseaEngineQueryParser
else
printf("<b><font color='blue'>%s</font></b>", $tree["VALUE"][0]);
break;
// case PHRASEA_KW_FIRST:
// if($tree["PNUM"]!==null)
// printf("<b><font color='blue'>%s <i>%s</i></font></b>", $tree["VALUE"], $tree["PNUM"]);
// else
// printf("<b><font color='blue'>%s</font></b>", $tree["VALUE"]);
// break;
case "OPS":
case "OPK":
print("<table border='1'>");
@@ -409,27 +389,12 @@ class PhraseaEngineQueryParser
$tids[] = $tid["pid"];
}
if (count($tids) >= 1) {
/*
if (count($tids)==1) {
// on cherche un id simple, on utilisera la syntaxe sql 'like' (l'extension repérera elle méme la syntaxe car la value finit par '%')
$val = str_replace(".", "d", $tids[0]) . "d%";
$tree["VALUE"] = array($val);
} else {
// on cherche plusieurs id's, on utilisera la syntaxe 'regexp' (l'extension repérera elle méme la syntaxe car la value finit par '$'
$val = "";
foreach($tids as $tid)
$val .= ($val?"|":"") . "(" . str_replace(".", "d", $tid) . "d.*)";
$tree["VALUE"] = array("^" . $val);
}
*/
$tree["VALUE"] = [];
foreach ($tids as $tid)
$tree["VALUE"][] = str_replace(".", "d", $tid) . "d%";;
} else {
// le mot n'est pas dans le thesaurus
}
/*
*/
}
if ($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") {
$this->thesaurus2_apply($tree["LB"], $bid);
@@ -502,7 +467,6 @@ class PhraseaEngineQueryParser
$context = null;
if (isset($simple["CONTEXT"])) {
$context = $simple["CONTEXT"];
// unset($simple["CONTEXT"]);
}
if ($keepFullText) {
// on fait un OU entre la recherche ft et une recherche th
@@ -753,7 +717,6 @@ class PhraseaEngineQueryParser
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 '$')
foreach ($nodes as $node) {
@@ -810,14 +773,6 @@ class PhraseaEngineQueryParser
continue;
if ($ztid["pid"] == $pid) {
$found = true;
} else {
// if($ztid["w"]==$w && $ztid["k"]==$k && $ztid["lng"]==$lng)
// {
// // FATAL : il y a un doublon réel dans le thesaurus de cette base (méme terme, méme contexte)
// // printf("<font color='red'>FATAL doublon on base %d (%s[%s])</font>\n", $bid, $w, $k);
// $found = true;
// break;
// }
}
}
if (!$found)
@@ -825,15 +780,12 @@ class PhraseaEngineQueryParser
// on liste les propositions de thésaurus pour ce node (dans l'arbre simple)
if (!isset($this->proposals["BASES"]["b$bid"]["TERMS"][$path])) {
// $this->proposals["TERMS"][$path] = array("TERM"=>implode(" ", $extendednode["VALUE"]), "PROPOSALS"=>[]);
$term = implode(" ", $extendednode["VALUE"]);
if (isset($extendednode["CONTEXT"]) && $extendednode["CONTEXT"]) {
$term .= " (" . $extendednode["CONTEXT"] . ")";
}
$this->proposals["BASES"]["b$bid"]["TERMS"][$path] = ["TERM" => $term]; // , "PROPOSALS"=>[] ); //, "PROPOSALS_TREE"=>new DOMDocument("1.0", "UTF-8"));
}
// printf("<%s id='%s'><br/>\n", $DOMnode->tagName, $DOMnode->getAttribute("id"));
// printf("<b>found node &lt;%s id='%s' w='%s' k='%s'></b><br/>\n", $DOMnode->nodeName, $DOMnode->getAttribute('id'), $DOMnode->getAttribute('w'), $DOMnode->getAttribute('k'));
// on commence par marquer les fils directs. rappel:$DOMnode pointe sur un sy
for ($node = $DOMnode->parentNode->firstChild; $node; $node = $node->nextSibling) {
if ($node->nodeName == "te") {
@@ -1020,8 +972,9 @@ class PhraseaEngineQueryParser
public function factor_or(&$tree)
{
do
$n = $this->factor_or2($tree); while ($n > 0);
do {
$n = $this->factor_or2($tree);
} while ($n > 0);
}
public function factor_or2(&$tree, $depth = 0)
@@ -1092,8 +1045,6 @@ class PhraseaEngineQueryParser
public function changeNodeEquals2($oneBranch)
{
## creation branche gauche avec ">="
// print("changeNodeEquals2\n");
// print("creation branche gauche ( '>=' ) \n");
$newTreeLB = ["CLASS" => "OPK",
"VALUE" => ">=",
"NODETYPE" => PHRASEA_OP_GEQT,
@@ -1119,7 +1070,6 @@ class PhraseaEngineQueryParser
"PNUM" => NULL,
"DEPTH" => 0]
];
// print("fin creation branche droite avec '<=' \n");
## fin creation branche droite ( "<=" )
$tree = ["CLASS" => "OPS",
@@ -1316,7 +1266,6 @@ class PhraseaEngineQueryParser
"RB" => $tree["RB"]];
$tree["LB"]["RB"] = $tree["RB"]["RB"];
// return;
}
if ($tree["RB"]["CLASS"] == "OPS" && in_array($tree["RB"]["NODETYPE"], $opdistrib)) {
@@ -1394,7 +1343,6 @@ class PhraseaEngineQueryParser
public function maketree($depth, $inquote = false)
{
// printf("<!-- PARSING $depth -->\n\n");
$tree = null;
while ($t = $this->nexttoken($inquote)) {
if ($this->debug)
@@ -1499,11 +1447,6 @@ class PhraseaEngineQueryParser
break;
default:
$tree = $this->addtotree($tree, $t, $depth, $inquote);
if ($this->debug) {
// print("---- après addtotree ----\n");
// var_dump($tree);
// print("-------------------------\n");
}
if (!$tree) {
return(null);
}
@@ -1522,23 +1465,12 @@ class PhraseaEngineQueryParser
public function addtotree($tree, $t, $depth, $inquote)
{
if ($this->debug) {
// printf("addtotree({tree}, \$t[CLASS]='%s', \$t[VALUE]='%s', \$depth=%d, inquote=%s)\n", $t["CLASS"], $t["VALUE"], $depth, $inquote ? "true" : "false");
// print("---- avant addtotree ----\n");
// var_dump($tree);
// print("-------------------------\n");
}
if (!$t) {
return($tree);
}
switch ($t["CLASS"]) {
case "TOK_CONTEXT":
// if($this->debug)
// {
// printf("addtotree({tree}, \$t='%s', \$depth=%d, inquote=%s)\n", $t["VALUE"], $depth, $inquote?"true":"false");
// }
if ($tree["CLASS"] == "SIMPLE" || $tree["CLASS"] == "QSIMPLE") {
// un [xxx] suit un terme : il introduit un contexte
$tree["CONTEXT"] = $t["VALUE"];
@@ -1571,7 +1503,6 @@ class PhraseaEngineQueryParser
case "TOK_CMP":
// < > <= >= <> = : sont des opérateurs de comparaison
if (!$tree) {
// printf("\nUne question ne peut commencer par '" . $t["VALUE"] . "'<br>");
if ($this->errmsg != "")
$this->errmsg .= "\\n";
$this->errmsg .= sprintf(_('qparser::erreur : une question ne peut commencer par %s'), $t["VALUE"]);
@@ -1579,7 +1510,6 @@ class PhraseaEngineQueryParser
return(null);
}
if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) {
// printf("'" . $t["VALUE"] . "' ne peut suivre un opérateur<br>");
if ($this->errmsg != "")
$this->errmsg .= "\\n";
$this->errmsg .= sprintf(_('qparser::Formulation incorrecte, ne peut suivre un operateur : %s'), $t["VALUE"]);
@@ -1593,7 +1523,6 @@ class PhraseaEngineQueryParser
if ($t["CLASS"] == "TOK_WORD" && isset($this->ops[$t["VALUE"]]) && !$inquote) {
// ce mot est un opérateur phrasea
if (!$tree) {
// printf("\n581 : Une question ne peut commencer par un opérateur<br>");
if ($this->errmsg != "")
$this->errmsg .= "\\n";
$this->errmsg .= sprintf(_('qparser::erreur : une question ne peut commencer par %s'), $t["VALUE"]);
@@ -1602,7 +1531,6 @@ class PhraseaEngineQueryParser
}
if (($tree["CLASS"] == "OPS" || $tree["CLASS"] == "OPK") && $tree["RB"] == null) {
// printf("\n586 : Un opérateur ne peut suivre un opérateur<br>");
if ($this->errmsg != "")
$this->errmsg .= "\\n";
$this->errmsg .= sprintf(_('qparser::Formulation incorrecte, %s ne peut suivre un operateur'), $t["VALUE"]);
@@ -1639,7 +1567,6 @@ class PhraseaEngineQueryParser
}
}
} else {
//printf("sdfsdfsdfsd<br>");
$type = $inquote ? "QSIMPLE" : "SIMPLE";
}
@@ -1666,7 +1593,6 @@ class PhraseaEngineQueryParser
return(null);
}
// $nok = 0;
} else
$nok++;
}
@@ -1817,11 +1743,6 @@ class PhraseaEngineQueryParser
return(["CLASS" => "TOK_RP", "VALUE" => ")"]);
break;
case "[":
// if($inquote)
// {
// $this->phq = ltrim(substr($this->phq, 1));
// return(array("CLASS"=>"TOK_VOID", "VALUE"=>$c));
// }
// un '[' introduit un contexte qu'on lit jusqu'au ']'
$closeb = mb_strpos($this->phq, "]", 1, 'UTF-8');
if ($closeb !== false) {
@@ -1835,18 +1756,6 @@ class PhraseaEngineQueryParser
return(["CLASS" => "TOK_CONTEXT", "VALUE" => $context]);
break;
/*
case "]":
// if($inquote)
// {
// $this->phq = ltrim(substr($this->phq, 1));
// return(array("CLASS"=>"TOK_VOID", "VALUE"=>$c));
// }
$this->phq = ltrim(substr($this->phq, 1));
return(array("CLASS"=>"TOK_RB", "VALUE"=>"]"));
break;
*/
case "\"":
$this->phq = $this->mb_ltrim(mb_substr($this->phq, 1, 99999, 'UTF-8'), 'UTF-8');
@@ -1858,13 +1767,10 @@ class PhraseaEngineQueryParser
$c_utf8 = "";
for ($i = 0; $i < $l; $i++) {
if (!$this->app['unicode']->has_indexer_bad_char(($c_utf8 = mb_substr($this->phq, $i, 1, 'UTF-8')))) {
// $c = mb_strtolower($c);
// $t .= isset($this->noaccent[$c]) ? $this->noaccent[$c] : $c;
$t .= $this->app['unicode']->remove_diacritics(mb_strtolower($c_utf8));
} else
break;
}
// if ($c_utf8 == "(" || $c_utf8 == ")" || $c_utf8 == "[" || $c_utf8 == "]" || $c_utf8 == "=" || $c_utf8 == ":" || $c_utf8 == "<" || $c_utf8 == ">" || $c_utf8 == "\"")
if (in_array($c_utf8, ["(", ")", "[", "]", "=", ":", "<", ">", "\""])) {
// ces caractéres sont des délimiteurs avec un sens, il faut les garder
$this->phq = $this->mb_ltrim(mb_substr($this->phq, $i, 99999, 'UTF-8'), 'UTF-8');

View File

@@ -644,17 +644,7 @@ class User_Query implements User_QueryInterface
*/
public function like($like_field, $like_value)
{
// if ($like_field == self::LIKE_NAME)
// {
// $this->like_field[self::LIKE_FIRSTNAME] = trim($like_value);
// $this->like_field[self::LIKE_LASTNAME] = trim($like_value);
// }
// else
// {
$this->like_field[trim($like_field)] = trim($like_value);
// }
$this->total = $this->page = $this->total_page = null;
return $this;

View File

@@ -247,9 +247,6 @@ class ftpclient
echo $e;
}
$ret = $this->nb_get($localfile, $remotefile, 0);
// if($this->debug)
// echo "On doit avoir a la fin $remotefile de size ".filesize($localfile)."\n<br>";
}
if ($ret != FTP_FINISHED) {
throw new Exception('Erreur lors du transfert de fichier');

View File

@@ -104,7 +104,6 @@ class patch_370alpha8a implements patchInterface
if ($task['class'] === 'task_period_workflow01') {
$t = $tasks->appendChild($dom->createElement('task'));
$t->setAttribute('active', '0');
// $t->setAttribute('name', 'imported from \'' . $task->getTitle() . '\'');
$t->setAttribute('name', 'imported from \'' . $task['name'] . '\'');
$t->setAttribute('action', 'update');

View File

@@ -32,7 +32,6 @@ class patchthesaurus_100 implements patchthesaurus_interface
foreach ($te1 as $tei) {
$th->appendChild($tei);
$this->fixThesaurus2($domth, $tei, 0, $unicode);
// $tei->parentNode->removeChild($tei);
}
$te0->parentNode->removeChild($te0);
}
@@ -58,9 +57,9 @@ class patchthesaurus_100 implements patchthesaurus_interface
$tenode->removeAttribute("v");
$tenode->removeAttribute("w");
$tenode->removeAttribute("k");
if ($tenode->getAttribute("nextid") == "")
if ($tenode->getAttribute("nextid") == "") {
$tenode->setAttribute("nextid", "0");
// $tenode->setAttribute("id", "0.".$tenode->getAttribute("id"));
}
$todel = [];
for ($n = $tenode->firstChild; $n; $n = $n->nextSibling) {
if ($n->nodeName == "ta")

View File

@@ -20,7 +20,6 @@ class patchthesaurus_201 implements patchthesaurus_interface
$xp = new DOMXPath($domth);
$te = $xp->query("/thesaurus//te");
for ($i = 0; $i < $te->length; $i ++) {
// $id = "S" . substr($te->item($i)->getAttribute("id"), 1);
$id = $te->item($i)->getAttribute("id");
$nid = (int) ($te->item($i)->getAttribute("nextid"));
for ($n = $te->item($i)->firstChild; $n; $n = $n->nextSibling) {

View File

@@ -134,7 +134,6 @@ class patchthesaurus_203 implements patchthesaurus_interface
if ($pid != "") {
$id = $node->getAttribute("id");
if (substr($id, 1, strlen($pid)) != substr($pid, "1") . ".") {
//printf("pid='%s', id='%s'\n", $pid, $id);
$nid = $node->parentNode->getAttribute("nextid");
$node->parentNode->setAttribute("nextid", $nid + 1);
$node->setAttribute("id", $newid = ($pid . "." . $nid));

View File

@@ -136,7 +136,6 @@ class patchthesaurus_204 implements patchthesaurus_interface
if ($pid != "") {
$id = $node->getAttribute("id");
if (substr($id, 1, strlen($pid)) != substr($pid, "1") . ".") {
//printf("pid='%s', id='%s'\n", $pid, $id);
$nid = $node->parentNode->getAttribute("nextid");
$node->parentNode->setAttribute("nextid", $nid + 1);
$node->setAttribute("id", $newid = ($pid . "." . $nid));

View File

@@ -364,7 +364,6 @@ class phraseadate
break;
default:
$n = 0;
// printf("format de date inconnu : %s\n", $format);
break;
}
if ($n > 0) {