Date: Mon, 25 Jun 2018 16:16:21 +0200
Subject: [PATCH 04/11] EZP-29033: [Legacy] Don't remove links user has no
access to (#1355)
* EZP-29033: [Legacy] Don't remove links user has no access to
* fixup! EZP-29033: [Legacy] Don't remove links user has no access to
(cherry picked from commit 7814827a396b7333d380cb324b5cb226af42ec93)
---
.../handlers/output/ezxhtmlxmloutput.php | 27 ++++++++++---------
settings/ezxml.ini | 3 +++
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php b/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
index 22990b3781b..ab2f46a7edf 100644
--- a/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
+++ b/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
@@ -187,6 +187,7 @@ function initHandlerHeader( $element, &$attributes, &$siblingParams, &$parentPar
function initHandlerLink( $element, &$attributes, &$siblingParams, &$parentParams )
{
$ret = array();
+ $ezxmlIni = eZINI::instance('ezxml.ini');
// Set link parameters for rendering children of link tag
$href='';
@@ -203,16 +204,16 @@ function initHandlerLink( $element, &$attributes, &$siblingParams, &$parentParam
if ( $node != null )
{
- if ( !$node->object()->canRead() )
+ $view = $element->getAttribute( 'view' );
+ if ( $view )
+ $href = 'content/view/' . $view . '/' . $nodeID;
+ else if ( !$node->object()->canRead() &&
+ $ezxmlIni->variable( 'ezxhtml', 'ShowURLAliasForProtectedLinks' ) !== 'enabled' )
{
eZDebug::writeWarning( "Current user does not have read access to the object of node #$nodeID",
'XML output handler: link' );
- return $ret;
+ $href = 'content/view/full/' . $nodeID;
}
-
- $view = $element->getAttribute( 'view' );
- if ( $view )
- $href = 'content/view/' . $view . '/' . $nodeID;
else
$href = $node->attribute( 'url_alias' );
}
@@ -227,13 +228,6 @@ function initHandlerLink( $element, &$attributes, &$siblingParams, &$parentParam
if ( isset( $this->ObjectArray["$objectID"] ) )
{
$object = $this->ObjectArray["$objectID"];
- if ( !$object->canRead() )
- {
- eZDebug::writeWarning( "Current user does not have read access to the object #$objectID",
- 'XML output handler: link' );
- return $ret;
- }
-
$node = $object->attribute( 'main_node' );
if ( $node )
{
@@ -242,6 +236,13 @@ function initHandlerLink( $element, &$attributes, &$siblingParams, &$parentParam
$view = $element->getAttribute( 'view' );
if ( $view )
$href = 'content/view/' . $view . '/' . $nodeID;
+ else if ( !$object->canRead() &&
+ $ezxmlIni->variable( 'ezxhtml', 'ShowURLAliasForProtectedLinks' ) !== 'enabled' )
+ {
+ eZDebug::writeWarning( "Current user does not have read access to the object #$objectID",
+ 'XML output handler: link' );
+ $href = 'content/view/full/' . $nodeID;
+ }
else
$href = $node->attribute( 'url_alias' );
}
diff --git a/settings/ezxml.ini b/settings/ezxml.ini
index 6d8ad0d7ab5..a7d35b1e094 100644
--- a/settings/ezxml.ini
+++ b/settings/ezxml.ini
@@ -50,3 +50,6 @@ TagPresets[]
# Determines to insert tag inside a table cell in the output or not
# if there is only one tag inside a cell.
RenderParagraphInTableCells=enabled
+# Show URL alias for links the current user does not have read access to.
+# If disabled (recommended) the link will be /content/view/full/[nodeID] instead.
+ShowURLAliasForProtectedLinks=disabled
From 3c9982a52ebed1eccb63d76e9e05779d2f679a15 Mon Sep 17 00:00:00 2001
From: Serhey Dolgushev
Date: Mon, 25 Jun 2018 10:21:23 -0400
Subject: [PATCH 05/11] Fix link source change (object => node) when editing a
version (#1291)
(cherry picked from commit 1e5fa83b8027e0536f897a580ff5e480e92af9c9)
---
.../design/standard/templates/ezoe/customattributes/link.tpl | 1 +
1 file changed, 1 insertion(+)
diff --git a/extension/ezoe/design/standard/templates/ezoe/customattributes/link.tpl b/extension/ezoe/design/standard/templates/ezoe/customattributes/link.tpl
index 423ca450ce0..c3c887031fb 100644
--- a/extension/ezoe/design/standard/templates/ezoe/customattributes/link.tpl
+++ b/extension/ezoe/design/standard/templates/ezoe/customattributes/link.tpl
@@ -90,6 +90,7 @@ eZOEPopupUtils.settings.onInitDoneArray.push( function( editorElement )
ezoeLinkAttribute.timeOut = setTimeout( eZOEPopupUtils.BIND( ezoeLinkAttribute.ajaxCheck, this, url[0] + '_' + id, lid ), 320 );
return true;
});
+ inp.keyup();
// setup navigation on bookmark / browse / search links to their 'boxes' (panels)
jQuery( 'a.atr_link_search_link, a.atr_link_browse_link, a.atr_link_bookmark_link' ).click( function(){
From 3f0b957fbb208834e965acad4ce5162e5f7cdcb3 Mon Sep 17 00:00:00 2001
From: Serhey Dolgushev
Date: Mon, 25 Jun 2018 10:22:01 -0400
Subject: [PATCH 06/11] Update search index in hide cronjob (#1348)
* Update search index in hide cronjob
(cherry picked from commit 6f4e99fcd12e0ef70d41b7a74eb92d226a5177ab)
---
cronjobs/hide.php | 3 +++
1 file changed, 3 insertions(+)
diff --git a/cronjobs/hide.php b/cronjobs/hide.php
index b4f71be915f..c831dd607df 100644
--- a/cronjobs/hide.php
+++ b/cronjobs/hide.php
@@ -49,6 +49,9 @@
{
$cli->output( 'Hiding node: "' . $node->attribute( 'name' ) . '" (' . $node->attribute( 'node_id' ) . ')' );
eZContentObjectTreeNode::hideSubTree( $node );
+
+ //call appropriate method from search engine
+ eZSearch::updateNodeVisibility( $node->attribute( 'node_id' ), 'hide' );
}
// clear memory after every batch
eZContentObject::clearCache();
From 4849deacd5bdea06d84eb6c38308259d4831f245 Mon Sep 17 00:00:00 2001
From: Serhey Dolgushev
Date: Thu, 28 Jun 2018 09:02:20 -0400
Subject: [PATCH 07/11] Force to use integer keys in
eZXMLOutputHandler->NodeArray (#1356)
(cherry picked from commit 4fcd80c575963097809df70539c99c46df4072b5)
---
kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php | 4 ++--
.../datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php b/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php
index d754dfbddb9..680cd474ca9 100644
--- a/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php
+++ b/kernel/classes/datatypes/ezxmltext/ezxmloutputhandler.php
@@ -275,14 +275,14 @@ function prefetch()
foreach( $nodes as $node )
{
$nodeID = $node->attribute( 'node_id' );
- $this->NodeArray["$nodeID"] = $node;
+ $this->NodeArray[$nodeID] = $node;
}
}
elseif ( $nodes )
{
$node = $nodes;
$nodeID = $node->attribute( 'node_id' );
- $this->NodeArray["$nodeID"] = $node;
+ $this->NodeArray[$nodeID] = $node;
}
}
}
diff --git a/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php b/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
index ab2f46a7edf..77ecf107b9d 100644
--- a/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
+++ b/kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php
@@ -199,7 +199,7 @@ function initHandlerLink( $element, &$attributes, &$siblingParams, &$parentParam
}
elseif ( $element->getAttribute( 'node_id' ) != null )
{
- $nodeID = $element->getAttribute( 'node_id' );
+ $nodeID = (int) $element->getAttribute( 'node_id' );
$node = isset( $this->NodeArray[$nodeID] ) ? $this->NodeArray[$nodeID] : null;
if ( $node != null )
@@ -289,7 +289,7 @@ function initHandlerEmbed( $element, &$attributes, &$siblingParams, &$parentPara
}
else
{
- $nodeID = $element->getAttribute( 'node_id' );
+ $nodeID = (int) $element->getAttribute( 'node_id' );
if ( $nodeID )
{
if ( isset( $this->NodeArray[$nodeID] ) )
From f1d144415e2a7545e4acfc08fc35028696ac357b Mon Sep 17 00:00:00 2001
From: vnivuahc <25658540+vnivuahc@users.noreply.github.com>
Date: Thu, 28 Jun 2018 15:03:42 +0200
Subject: [PATCH 08/11] Update index when adding/removing node assignment
(#1353)
In the back-end, when you add a new location to an existing content, or remove one, the search index is not updated.
(cherry picked from commit d1ed2aaada4b3e36c2a91539832394407445a7cf)
---
.../content/ezcontentoperationcollection.php | 27 ++++++++++++++++---
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/kernel/content/ezcontentoperationcollection.php b/kernel/content/ezcontentoperationcollection.php
index f1432aedc08..373d99371dd 100644
--- a/kernel/content/ezcontentoperationcollection.php
+++ b/kernel/content/ezcontentoperationcollection.php
@@ -823,6 +823,11 @@ static public function addAssignment( $nodeID, $objectID, $selectedNodeIDArray )
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
+ if ( !eZSearch::getEngine() instanceof eZSearchEngine )
+ {
+ eZContentOperationCollection::registerSearchObject( $objectID );
+ }
+
return array( 'status' => true );
}
@@ -902,6 +907,13 @@ static public function removeNodes( array $removeNodeIdList )
{
eZUser::purgeUserCacheByUserId( $object->attribute( 'id' ) );
}
+
+ // Give other search engines that the default one a chance to reindex
+ // when removing locations.
+ if ( !eZSearch::getEngine() instanceof eZSearchEngine )
+ {
+ eZContentOperationCollection::registerSearchObject( $objectId );
+ }
}
// Triggering content/cache filter for Http cache purge
@@ -1125,6 +1137,10 @@ static public function swapNode( $nodeID, $selectedNodeID, $nodeIdList = array()
// clear cache for new placement.
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
+ if ( !eZSearch::getEngine() instanceof eZSearchEngine )
+ {
+ eZContentOperationCollection::registerSearchObject( $objectID );
+ }
eZSearch::swapNode( $nodeID, $selectedNodeID, $nodeIdList = array() );
@@ -1256,11 +1272,14 @@ static public function updatePriority( $parentNodeID, $priorityArray = array(),
*
* @return array An array with operation status, always true
*/
- static public function updateMainAssignment( $mainAssignmentID, $ObjectID, $mainAssignmentParentID )
+ static public function updateMainAssignment( $mainAssignmentID, $objectID, $mainAssignmentParentID )
{
- eZContentObjectTreeNode::updateMainNodeID( $mainAssignmentID, $ObjectID, false, $mainAssignmentParentID );
- eZContentCacheManager::clearContentCacheIfNeeded( $ObjectID );
- eZContentOperationCollection::registerSearchObject( $ObjectID );
+ eZContentObjectTreeNode::updateMainNodeID( $mainAssignmentID, $objectID, false, $mainAssignmentParentID );
+ eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
+ if ( !eZSearch::getEngine() instanceof eZSearchEngine )
+ {
+ eZContentOperationCollection::registerSearchObject( $objectID );
+ }
return array( 'status' => true );
}
From 3b24b8aafe037e4876aa15c3432235b9eba73c1e Mon Sep 17 00:00:00 2001
From: Ole Morten Halvorsen
Date: Thu, 28 Jun 2018 15:03:58 +0200
Subject: [PATCH 09/11] Fixed fatal error (#1367)
`continue` used outside of loop.
(cherry picked from commit 582e393052c190812064a5fc91bcb848c80d789a)
---
update/common/scripts/5.4/fixtrashedimagereferences.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/update/common/scripts/5.4/fixtrashedimagereferences.php b/update/common/scripts/5.4/fixtrashedimagereferences.php
index 832a88734a3..031b05b88c5 100644
--- a/update/common/scripts/5.4/fixtrashedimagereferences.php
+++ b/update/common/scripts/5.4/fixtrashedimagereferences.php
@@ -64,7 +64,7 @@ function fixupTrashedImageXml( $imageAttribute, $optDryRun )
eZCLI::instance()->notice( "Processing image $contentId ($version) ..." );
if ( ( $doc = simplexml_load_string( $imageAttribute['data_text'] ) ) === false )
- continue;
+ return;
$doc['filename'] = '';
$doc['basename'] = '';
From 5e55dd92e32bf77244264c5c13833479ec810711 Mon Sep 17 00:00:00 2001
From: Elise Kristiansen
Date: Fri, 29 Jun 2018 09:00:31 +0200
Subject: [PATCH 10/11] Fixed php7 warning (#1370)
* Fixed php7 warning
ErrorException (E_WARNING)
Illegal string offset 'path'
* Moved declaration of $Result to top of case
(cherry picked from commit 69c2f36125f441a263194ac3ac9ab4e6d835ca75)
---
kernel/content/edit.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/content/edit.php b/kernel/content/edit.php
index 915f93b4135..4f729c43441 100644
--- a/kernel/content/edit.php
+++ b/kernel/content/edit.php
@@ -765,6 +765,7 @@ function computeRedirect( $module, $object, $version, $EditLanguage = false )
}
else if ( isset( $operationResult['result'] ) )
{
+ $Result = array();
$result = $operationResult['result'];
$resultContent = false;
if ( is_array( $result ) )
From 2cce17cd60f8ac391974c7287148396402736eb5 Mon Sep 17 00:00:00 2001
From: Ole Morten Halvorsen
Date: Fri, 29 Jun 2018 10:29:36 +0200
Subject: [PATCH 11/11] Make query compatible with strict MySQL (#1368)
MySQL 5.7 is strict by default and will error out on the incorrect GROUP BY.
(cherry picked from commit 28fadf953a37ae4b3e138d1b9141b0c7b78999fc)
---
update/common/scripts/5.4/cleanuntranslatablerelations.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/update/common/scripts/5.4/cleanuntranslatablerelations.php b/update/common/scripts/5.4/cleanuntranslatablerelations.php
index a5e8fed711b..7a4cde2b323 100644
--- a/update/common/scripts/5.4/cleanuntranslatablerelations.php
+++ b/update/common/scripts/5.4/cleanuntranslatablerelations.php
@@ -82,7 +82,7 @@ function parseRelationListIds( $relationListXml )
"FROM ezcontentobject_attribute attr ".
"INNER JOIN ezcontentclass_attribute classattr ON attr.contentclassattribute_id=classattr.id " .
"WHERE classattr.data_type_string IN ( 'ezobjectrelation', 'ezobjectrelationlist' ) AND can_translate=0 " .
- "GROUP BY contentobject_id, version, data_int"
+ "GROUP BY contentobject_id, version, data_int, attr_id, classattr.data_type_string, attr.data_text"
);
$count = count($rows);