diff --git a/composer.json b/composer.json
index 26bf20444e..a4a0404968 100644
--- a/composer.json
+++ b/composer.json
@@ -39,7 +39,7 @@
"symfony/symfony" : "2.4.x-dev",
"alchemy-fr/tcpdf-clone" : "~6.0",
"themattharris/tmhoauth" : "~0.7",
- "twig/twig" : "~1.13.0",
+ "twig/twig" : "~1.14, >=1.14.2",
"twig/extensions" : "~1.0",
"zend/gdata" : "~1.12.1"
},
diff --git a/composer.lock b/composer.lock
index 5c93f99668..577d8a8f16 100644
--- a/composer.lock
+++ b/composer.lock
@@ -3,7 +3,7 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "4f95339f95a308e3ad5bef8f973bffa9",
+ "hash": "090224c87151fc64fac81c3e8d258481",
"packages": [
{
"name": "alchemy-fr/tcpdf-clone",
@@ -2821,12 +2821,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/symfony.git",
- "reference": "f7692beec7ad44e4b48c92d9936501ac235925b6"
+ "reference": "7fecfbce3e7ce87d3a04d8276fd835cd73979309"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/symfony/zipball/f7692beec7ad44e4b48c92d9936501ac235925b6",
- "reference": "f7692beec7ad44e4b48c92d9936501ac235925b6",
+ "url": "https://api.github.com/repos/symfony/symfony/zipball/7fecfbce3e7ce87d3a04d8276fd835cd73979309",
+ "reference": "7fecfbce3e7ce87d3a04d8276fd835cd73979309",
"shasum": ""
},
"require": {
@@ -2926,7 +2926,7 @@
"keywords": [
"framework"
],
- "time": "2013-10-31 11:15:14"
+ "time": "2013-10-31 14:00:33"
},
{
"name": "themattharris/tmhoauth",
@@ -3019,16 +3019,16 @@
},
{
"name": "twig/twig",
- "version": "v1.13.2",
+ "version": "v1.14.2",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig.git",
- "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755"
+ "reference": "ca445842fcea4f844d68203ffa2d00f5e3cdea64"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fabpot/Twig/zipball/6d6a1009427d1f398c9d40904147bf9f723d5755",
- "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755",
+ "url": "https://api.github.com/repos/fabpot/Twig/zipball/ca445842fcea4f844d68203ffa2d00f5e3cdea64",
+ "reference": "ca445842fcea4f844d68203ffa2d00f5e3cdea64",
"shasum": ""
},
"require": {
@@ -3037,7 +3037,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "1.13-dev"
+ "dev-master": "1.14-dev"
}
},
"autoload": {
@@ -3064,7 +3064,7 @@
"keywords": [
"templating"
],
- "time": "2013-08-03 15:35:31"
+ "time": "2013-10-30 08:20:53"
},
{
"name": "zend/gdata",
diff --git a/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php b/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php
index 28c9944ca9..b47c916291 100644
--- a/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php
+++ b/lib/Alchemy/Phrasea/Command/Upgrade/Step35.php
@@ -76,7 +76,7 @@ class Step35 implements DatasUpgraderInterface
$stmt->execute(array(':record_id' => $row['record_id']));
try {
- $record = new \record_adapter($app, $databox->get_sbas_id(), $row['record_id']);
+ $record = new \record_adapter($this->app, $databox->get_sbas_id(), $row['record_id']);
} catch (\Exception $e) {
$this->app['monolog']->addError(sprintf("Unable to load record %d on databox %d : %s", $record->get_record_id(), $record->get_sbas_id(), $record->get_sbas_id(), $e->getMessage()));
continue;
diff --git a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php
index a3730b9c4b..e1e52e3762 100644
--- a/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php
+++ b/lib/Alchemy/Phrasea/Controller/Thesaurus/Xmlhttp.php
@@ -28,11 +28,16 @@ class Xmlhttp implements ControllerProviderInterface
$controllers->before(function () use ($app) {
$app['firewall']->requireAuthentication();
- $app['firewall']->requireAccessToModule('thesaurus');
});
- $controllers->match('acceptcandidates.j.php', 'controller.thesaurus.xmlhttp:AcceptCandidatesJson');
- $controllers->match('checkcandidatetarget.j.php', 'controller.thesaurus.xmlhttp:CheckCandidateTargetJson');
+ $controllers->match('acceptcandidates.j.php', 'controller.thesaurus.xmlhttp:AcceptCandidatesJson')
+ ->before(function () use ($app) {
+ $app['firewall']->requireAccessToModule('thesaurus');
+ });
+ $controllers->match('checkcandidatetarget.j.php', 'controller.thesaurus.xmlhttp:CheckCandidateTargetJson')
+ ->before(function () use ($app) {
+ $app['firewall']->requireAccessToModule('thesaurus');
+ });
$controllers->match('editing_presets.j.php', 'controller.thesaurus.xmlhttp:EditingPresetsJson');
$controllers->match('getsy_prod.x.php', 'controller.thesaurus.xmlhttp:GetSynonymsXml');
$controllers->match('getterm_prod.h.php', 'controller.thesaurus.xmlhttp:GetTermHtml');
@@ -40,7 +45,10 @@ class Xmlhttp implements ControllerProviderInterface
$controllers->match('openbranch_prod.j.php', 'controller.thesaurus.xmlhttp:OpenBranchJson');
$controllers->match('openbranches_prod.h.php', 'controller.thesaurus.xmlhttp:OpenBranchesHtml');
$controllers->match('openbranches_prod.x.php', 'controller.thesaurus.xmlhttp:OpenBranchesXml');
- $controllers->match('replacecandidate.j.php', 'controller.thesaurus.xmlhttp:ReplaceCandidateJson');
+ $controllers->match('replacecandidate.j.php', 'controller.thesaurus.xmlhttp:ReplaceCandidateJson')
+ ->before(function () use ($app) {
+ $app['firewall']->requireAccessToModule('thesaurus');
+ });
$controllers->match('search_th_term_prod.j.php', 'controller.thesaurus.xmlhttp:SearchTermJson');
return $controllers;
@@ -75,6 +83,10 @@ class Xmlhttp implements ControllerProviderInterface
$q = "/thesaurus//te[@id='" . $request->get("tid") . "']";
}
+ if ($request->get("debug")) {
+ printf("qth: %s
\n", $q);
+ }
+
$parentnode = $xpathth->query($q)->item(0);
if (!$parentnode) {
throw new \Exception('Unable to find branch');
@@ -85,6 +97,9 @@ class Xmlhttp implements ControllerProviderInterface
foreach ($request->get("cid") as $cid) {
$q = "//te[@id='" . $cid . "']";
+ if ($request->get("debug")) {
+ printf("qct: %s
\n", $q);
+ }
$ct = $xpathct->query($q)->item(0);
if (!$ct) {
continue;
@@ -106,6 +121,10 @@ class Xmlhttp implements ControllerProviderInterface
$this->renumerate($request->get('piv'), $te, $pid, $chgids);
$te = $parentnode->appendChild($te);
+ if ($request->get("debug")) {
+ printf("newid=%s
\n", $te->getAttribute("id"));
+ }
+
$soldid = str_replace(".", "d", $oldid) . "d";
$snewid = str_replace(".", "d", $pid) . "d";
$l = strlen($soldid) + 1;
@@ -114,9 +133,13 @@ class Xmlhttp implements ControllerProviderInterface
SET value=CONCAT('$snewid', SUBSTRING(value FROM $l))
WHERE value LIKE :like";
- $stmt = $connbas->prepare($sql);
- $stmt->execute(array(':like' => $soldid . '%'));
- $stmt->closeCursor();
+ if ($request->get("debug")) {
+ printf("soldid=%s ; snewid=%s
\nsql=%s
\n", $soldid, $snewid, $sql);
+ } else {
+ $stmt = $connbas->prepare($sql);
+ $stmt->execute(array(':like' => $soldid . '%'));
+ $stmt->closeCursor();
+ }
$refreshid = $parentnode->getAttribute('id');
$refresh['T' . $refreshid] = array(
@@ -142,6 +165,9 @@ class Xmlhttp implements ControllerProviderInterface
if ($ct2->nodeType != XML_ELEMENT_NODE || $ct2->nodeName != 'sy') {
continue;
}
+ if ($request->get('debug')) {
+ printf("ct2:%s \n", var_export($ct2, true));
+ }
$nid = $parentnode->getAttribute("nextid");
$parentnode->setAttribute("nextid", (int) $nid + 1);
@@ -158,6 +184,10 @@ class Xmlhttp implements ControllerProviderInterface
$this->renumerate($request->get('piv'), $te, $pid, $chgids);
$te = $parentnode->appendChild($te);
+ if ($request->get("debug")) {
+ printf("newid=%s
\n", $te->getAttribute("id"));
+ }
+
$soldid = str_replace(".", "d", $oldid) . "d";
$snewid = str_replace(".", "d", $pid) . "d";
$l = strlen($soldid) + 1;
@@ -166,9 +196,13 @@ class Xmlhttp implements ControllerProviderInterface
SET value = CONCAT('$snewid', SUBSTRING(value FROM $l))
WHERE value LIKE :like";
- $stmt = $connbas->prepare($sql);
- $stmt->execute(array(':like' => $soldid . '%'));
- $stmt->closeCursor();
+ if ($request->get("debug")) {
+ printf("soldid=%s ; snewid=%s
\nsql=%s
\n", $soldid, $snewid, $sql);
+ } else {
+ $stmt = $connbas->prepare($sql);
+ $stmt->execute(array(':like' => $soldid . '%'));
+ $stmt->closeCursor();
+ }
$thchanged = true;
}
@@ -254,6 +288,10 @@ class Xmlhttp implements ControllerProviderInterface
$tbranch = $databox_field->get_tbranch();
$q = "(" . $tbranch . ")/descendant-or-self::te[@id='" . $request->get("id") . "']";
+ if ($request->get("debug")) {
+ printf("tbranch-q = \" $q \"
\n");
+ }
+
$nodes = $xpath->query($q);
$json['acceptable'] = ($nodes->length > 0);
@@ -267,6 +305,10 @@ class Xmlhttp implements ControllerProviderInterface
$q = "/thesaurus//te[@id='" . $request->get("id") . "']";
}
+ if ($request->get("debug")) {
+ print("q:" . $q . "
\n");
+ }
+
$nodes = $xpath->query($q);
$json['found'] = $nodes->length;
@@ -274,14 +316,23 @@ class Xmlhttp implements ControllerProviderInterface
$fullpath_html = $fullpath = "";
for ($depth = 0, $n = $nodes->item(0); $n; $n = $n->parentNode, $depth--) {
if ($n->nodeName == "te") {
+ if ($request->get("debug")) {
+ printf("parent:%s
\n", $n->nodeName);
+ }
$firstsy = $goodsy = null;
for ($n2 = $n->firstChild; $n2; $n2 = $n2->nextSibling) {
if ($n2->nodeName == "sy") {
$sy = $n2->getAttribute("v");
if (!$firstsy) {
$firstsy = $sy;
+ if ($request->get("debug")) {
+ printf("fullpath : firstsy='%s' in %s
\n", $firstsy, $n2->getAttribute("lng"));
+ }
}
if ($n2->getAttribute("lng") == $request->get("piv")) {
+ if ($request->get("debug")) {
+ printf("fullpath : found '%s' in %s
\n", $sy, $n2->getAttribute("lng"));
+ }
$goodsy = $sy;
break;
}
@@ -324,6 +375,7 @@ class Xmlhttp implements ControllerProviderInterface
'presetid' => $request->get('presetid'),
'title' => $request->get('title'),
'f' => $request->get('f'),
+ 'debug' => $request->get('debug'),
));
switch ($request->get('act')) {
@@ -474,6 +526,10 @@ class Xmlhttp implements ControllerProviderInterface
$xpath = $databox->get_xpath_thesaurus();
$q = "/thesaurus//sy[@id='" . $request->get('id') . "']";
+ if ($request->get('debug')) {
+ print("q:" . $q . "
\n");
+ }
+
$nodes = $xpath->query($q);
if ($nodes->length > 0) {
$n2 = $nodes->item(0);
@@ -508,6 +564,10 @@ class Xmlhttp implements ControllerProviderInterface
$q = "/thesaurus//te[@id='" . $request->get("id") . "']";
}
+ if ($request->get("debug")) {
+ print("q:" . $q . "
\n");
+ }
+
$nodes = $xpath->query($q);
if ($nodes->length > 0) {
$nts = 0;
@@ -582,6 +642,9 @@ class Xmlhttp implements ControllerProviderInterface
if ($request->get("sortsy") && $request->get("lng")) {
ksort($tts, SORT_STRING);
}
+ if ($request->get("debug")) {
+ printf("tts :
%s
%s
%s
%s