Skip to content

Commit b71df0a

Browse files
committed
Merge branch 'before_1313'
2 parents cc3726d + 1968692 commit b71df0a

File tree

22 files changed

+454
-117
lines changed

22 files changed

+454
-117
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
eZ Publish 4 (Referred to as `legacy` in eZ Publish 5.x) [![Build Status](https://secure.travis-ci.org/netgen/ezpublish-legacy.png)](http://travis-ci.org/netgen/ezpublish-legacy)
1+
eZ Publish 4 (Referred to as `legacy` in eZ Publish 5.x)
22
=======================================================
33

4+
[![Build Status](https://img.shields.io/travis/ezsystems/ezpublish-legacy.svg?style=flat-square&branch=master)](https://travis-ci.org/ezsystems/ezpublish-legacy)
5+
[![Downloads](https://img.shields.io/packagist/dt/ezsystems/ezpublish-legacy.svg?style=flat-square)](https://packagist.org/packages/ezsystems/ezpublish-legacy)
6+
[![Latest version](https://img.shields.io/github/release/ezsystems/ezpublish-legacy.svg?style=flat-square)](https://github.com/ezsystems/ezpublish-legacy/releases)
7+
[![License](https://img.shields.io/packagist/l/ezsystems/ezpublish-legacy.svg?style=flat-square)](LICENSE)
8+
49
What is eZ Publish?
510
-------------------
611
eZ Publish is a professional PHP application framework with advanced CMS

cronjobs/indexcontent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
if ( $removeFromPendingActions )
115115
{
116116
$db->query( "DELETE FROM ezpending_actions WHERE action = '$action' AND param = '$objectID'" );
117+
eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
117118
}
118119
else
119120
{

design/standard/templates/class/datatype/edit/ezobjectrelation.tpl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
2-
{let content=$class_attribute.content}
2+
{let content=$class_attribute.content
3+
class_list=$content.class_constraint_list
4+
all_class_list=fetch( 'class', 'list', hash( 'sort_by', array( 'name', true() ) ) )}
35

46
<div class="block">
57
<label for="eccaor_selection_{$class_attribute.id}">{'Selection method'|i18n( 'design/standard/class/datatype' )}:</label>
@@ -11,6 +13,16 @@
1113
</select>
1214
</div>
1315

16+
<div class="block">
17+
<label for="eccaor_allowed_{$class_attribute.id}">{'Allowed classes'|i18n( 'design/standard/class/datatype' )}:</label>
18+
<select id="eccaor_allowed_{$class_attribute.id}" name="ContentClass_ezobjectrelation_class_list_{$class_attribute.id}[]" multiple="multiple" title="{'Select which classes user can create'|i18n( 'design/standard/class/datatype' )}" size="{min( 8, count( $all_class_list ) )}">
19+
<option value="" {if $class_list|lt(1)}selected="selected"{/if}>{'Any'|i18n( 'design/standard/class/datatype' )}</option>
20+
{section name=Class loop=$all_class_list}
21+
<option value="{$:item.identifier|wash}" {if $class_list|contains($:item.identifier)}selected="selected"{/if}>{$:item.name|wash}</option>
22+
{/section}
23+
</select>
24+
</div>
25+
1426
<div class="block">
1527
<fieldset>
1628
<legend>{'Default selection item'|i18n( 'design/standard/class/datatype' )}</legend>

design/standard/templates/class/datatype/view/ezobjectrelation.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
<p>{$content.selection_type|choose( 'Browse'|i18n( 'design/standard/class/datatype' ), 'Drop-down list'|i18n( 'design/standard/class/datatype' ), 'Drop-down tree'|i18n( 'design/standard/class/datatype' ) )}</p>
88
</div>
99

10+
{* Allowed classes. *}
11+
<div class="block">
12+
<label>{'Allowed classes'|i18n( 'design/standard/class/datatype' )}:</label>
13+
{section show=$content.class_constraint_list|count|lt( 1 )}
14+
<p>{'Any'|i18n( 'design/standard/class/datatype' )}</p>
15+
{section-else}
16+
<ul>
17+
{section var=Classes loop=$content.class_constraint_list}<li>{$Classes.item}</li>{/section}
18+
</ul>
19+
{/section}
20+
</div>
21+
1022
{* Selection item/node. *}
1123
<div class="block">
1224
<label>{'Default selection item'|i18n( 'design/standard/class/datatype' )}:</label>

design/standard/templates/content/datatype/edit/ezobjectrelation.tpl

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@
5555
{if $attribute.class_content.default_selection_node}
5656
<input type="hidden" name="{$attribute_base}_browse_for_object_start_node[{$attribute.id}]" value="{$attribute.class_content.default_selection_node|wash}" />
5757
{/if}
58+
{if is_set( $class_content.class_constraint_list[0] )}
59+
<input type="hidden" name="{$attribute_base}_browse_for_object_class_constraint_list[{$attribute.id}]" value="{$class_content.class_constraint_list|implode(',')}" />
60+
{/if}
5861
{if $attribute.content}
5962
<input class="button ezobject-relation-remove-button" type="submit" name="CustomActionButton[{$attribute.id}_remove_object]" value="{'Remove object'|i18n( 'design/standard/content/datatype' )}" />
6063
{else}
@@ -88,14 +91,27 @@
8891
{* Dropdown list. *}
8992
{case match=1}
9093
{let parent_node=fetch( content, node, hash( node_id, $class_content.default_selection_node ) )}
91-
94+
{def $nodesList=cond( and( is_set( $class_content.class_constraint_list ), $class_content.class_constraint_list|count|ne( 0 ) ),
95+
fetch( 'content', 'list',
96+
hash( 'parent_node_id', $parent_node.node_id,
97+
'class_filter_type','include',
98+
'class_filter_array', $class_content.class_constraint_list,
99+
'sort_by', $parent_node.sort_array
100+
) ),
101+
fetch( 'content', 'list',
102+
hash( 'parent_node_id', $parent_node.node_id,
103+
'sort_by', $parent_node.sort_array )
104+
) )
105+
)}
92106
<select id="ezcoa-{if ne( $attribute_base, 'ContentObjectAttribute' )}{$attribute_base}-{/if}{$attribute.contentclassattribute_id}_{$attribute.contentclass_attribute_identifier}" class="ezcc-{$attribute.object.content_class.identifier} ezcca-{$attribute.object.content_class.identifier}_{$attribute.contentclass_attribute_identifier}" name="{$attribute_base}_data_object_relation_id_{$attribute.id}">
93107
{if $attribute.contentclass_attribute.is_required|not}
94108
<option value="" {if eq( $attribute.data_int, '' )}selected="selected"{/if}>{'No relation'|i18n( 'design/standard/content/datatype' )}</option>
95109
{/if}
96-
{section var=Nodes loop=fetch( content, list, hash( parent_node_id, $parent_node.node_id, sort_by, $parent_node.sort_array ) )}
97-
<option value="{$Nodes.item.contentobject_id}" {if eq( $attribute.data_int, $Nodes.item.contentobject_id )}selected="selected"{/if}>{$Nodes.item.name|wash}</option>
98-
{/section}
110+
{if $nodesList}
111+
{foreach $nodesList as $nodeOption}
112+
<option value="{$nodeOption.contentobject_id}" {if eq( $attribute.data_int, $nodeOption.contentobject_id )}selected="selected"{/if}>{$nodeOption.name|wash()}</option>
113+
{/foreach}
114+
{/if}
99115
</select>
100116

101117
{if $class_content.fuzzy_match}

extension/ezoe/ezxmltext/handlers/input/ezoeinputparser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ function setAttributes( $element, $attributes )
262262
if ( isset( $this->Namespaces[$prefix] ) )
263263
{
264264
$URI = $this->Namespaces[$prefix];
265-
$element->setAttributeNS( $URI, $qualifiedName, $value );
265+
$element->setAttributeNS( $URI, $qualifiedName, htmlspecialchars_decode( $value ) );
266266
}
267267
else
268268
{
@@ -271,7 +271,7 @@ function setAttributes( $element, $attributes )
271271
}
272272
else
273273
{
274-
$element->setAttribute( $qualifiedName, $value );
274+
$element->setAttribute( $qualifiedName, htmlspecialchars_decode( $value ) );
275275
}
276276
}
277277
}

extension/ezoe/ezxmltext/handlers/input/ezoexmlinput.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,12 +1744,12 @@ public static function getCustomAttrPart( $tag, &$styleString )
17441744
if ( $customAttributePart === '' )
17451745
{
17461746
$customAttributePart = ' customattributes="';
1747-
$customAttributePart .= $attribute->name . '|' . $attribute->value;
1747+
$customAttributePart .= $attribute->name . '|' . htmlspecialchars( $attribute->value );
17481748
}
17491749
else
17501750
{
17511751
$customAttributePart .= 'attribute_separation' . $attribute->name . '|' .
1752-
$attribute->value;
1752+
htmlspecialchars( $attribute->value );
17531753
}
17541754
if ( isset( self::$customAttributeStyleMap[$attribute->name] ) )
17551755
{

extension/ezoe/tests/ezoexmltext_regression.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,37 @@ public function providerParsingGreaterThanAttribute()
3434
array(
3535
'<div type="custom" class="ezoeItemCustomTag factbox" customattributes="title|<a href=&quot;#test&quot;>Test</a>attribute_separationalign|right"><p>This is a fact</p></div>',
3636
'<?xml version="1.0" encoding="utf-8"?>
37-
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"><custom name="factbox" custom:title="&lt;a href=&amp;quot;#test&amp;quot;&gt;Test&lt;/a&gt;"><paragraph>This is a fact</paragraph></custom></paragraph></section>',
37+
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"><custom name="factbox" custom:title="&lt;a href=&quot;#test&quot;&gt;Test&lt;/a&gt;"><paragraph>This is a fact</paragraph></custom></paragraph></section>',
3838
),
3939
array(
4040
'<div type="custom" class="ezoeItemCustomTag factbox" customattributes="title|<a href=&quot;#test&quot;>Test</a>attribute_separationalign|right"><p>This is a fact</p></div><p>Text between</p><div type="custom" class="ezoeItemCustomTag factbox" customattributes="title|<a href=&quot;#test&quot;>Test</a>attribute_separationalign|right"><p>This is a fact</p></div>',
4141
'<?xml version="1.0" encoding="utf-8"?>
42-
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"><custom name="factbox" custom:title="&lt;a href=&amp;quot;#test&amp;quot;&gt;Test&lt;/a&gt;"><paragraph>This is a fact</paragraph></custom></paragraph><paragraph>Text between</paragraph><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"><custom name="factbox" custom:title="&lt;a href=&amp;quot;#test&amp;quot;&gt;Test&lt;/a&gt;"><paragraph>This is a fact</paragraph></custom></paragraph></section>',
42+
<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/"><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"><custom name="factbox" custom:title="&lt;a href=&quot;#test&quot;&gt;Test&lt;/a&gt;"><paragraph>This is a fact</paragraph></custom></paragraph><paragraph>Text between</paragraph><paragraph xmlns:tmp="http://ez.no/namespaces/ezpublish3/temporary/"><custom name="factbox" custom:title="&lt;a href=&quot;#test&quot;&gt;Test&lt;/a&gt;"><paragraph>This is a fact</paragraph></custom></paragraph></section>',
4343
),
4444
);
4545
}
4646

47+
/**
48+
* Test for proper escaping for custom tag attribute values
49+
*/
50+
public function testEscapeAttributeValue()
51+
{
52+
$xmlData = '<?xml version="1.0" encoding="utf-8"?>';
53+
$xmlData .= '<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/" xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/" xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">';
54+
$xmlData .= "<paragraph>";
55+
$xmlData .= '<custom name="factbox" custom:title="&quot;fipsfuchs&quot;" custom:align="&amp;quot;fipsfuchs&amp;quot;"></custom>';
56+
$xmlData .= "</paragraph>";
57+
$xmlData .= "</section>";
58+
59+
$folder = new ezpObject( 'folder', 2 );
60+
$folder->name = 'Escape Attribute Value';
61+
$folder->short_description = '';
62+
63+
$oeHandler = new eZOEXMLInput( $xmlData, false, $folder->short_description );
64+
$xhtml = $oeHandler->attribute( 'input_xml' );
65+
self::assertEquals( '&lt;div class=&quot;ezoeItemCustomTag factbox&quot; type=&quot;custom&quot; customattributes=&quot;title|&amp;quot;fipsfuchs&amp;quot;attribute_separationalign|&amp;amp;quot;fipsfuchs&amp;amp;quot;&quot;&gt;&lt;p&gt;factbox&lt;/p&gt;&lt;/div&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;', $xhtml );
66+
}
67+
4768
/**
4869
* Test for issue #16605: Online Editor adds a lot of Non Breaking spaces (nbsp)
4970
*

0 commit comments

Comments
 (0)