[geeklog-cvs] geeklog: Blocks could not contain words in curly braces as they ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Wed Jan 6 12:43:57 EST 2010


changeset 7585:de8e3ba9f77e
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/de8e3ba9f77e
user: Dirk Haun <dirk at haun-online.de>
date: Wed Jan 06 10:56:00 2010 +0100
description:
Blocks could not contain words in curly braces as they were mistaken for template variables (bug #0001057)

diffstat:

 public_html/docs/history   |   2 ++
 public_html/lib-common.php |  29 ++++++++++++++---------------
 2 files changed, 16 insertions(+), 15 deletions(-)

diffs (60 lines):

diff -r 3922e2c5fce5 -r de8e3ba9f77e public_html/docs/history
--- a/public_html/docs/history	Wed Jan 06 10:36:17 2010 +0100
+++ b/public_html/docs/history	Wed Jan 06 10:56:00 2010 +0100
@@ -3,6 +3,8 @@
 ??? ??, 2010 (1.6.2)
 ------------
 
+- Blocks could not contain words in curly braces as they were mistaken for
+  template variables (bug #0001057) [Dirk]
 - Allow groups to be marked as a Default Group. New users will automatically be
   added to all default groups (feature request #0000798) [Dirk]
 - Make sure all onclick events in the Configuration return false (bug #0001054)
diff -r 3922e2c5fce5 -r de8e3ba9f77e public_html/lib-common.php
--- a/public_html/lib-common.php	Wed Jan 06 10:36:17 2010 +0100
+++ b/public_html/lib-common.php	Wed Jan 06 10:56:00 2010 +0100
@@ -3708,30 +3708,29 @@
         }
     }
 
-    if( !empty( $A['content'] ) && ( trim( $A['content'] ) != '' ) && !$noboxes )
-    {
-        $blockcontent = stripslashes( $A['content'] );
+    if (!empty($A['content']) && (trim($A['content']) != '') && !$noboxes) {
+        $blockcontent = stripslashes($A['content']);
 
         // Hack: If the block content starts with a '<' assume it
         // contains HTML and do not call nl2br() which would only add
         // unwanted <br> tags.
 
-        if( substr( $blockcontent, 0, 1 ) != '<' )
-        {
-            $blockcontent = nl2br( $blockcontent );
+        if (substr($blockcontent, 0, 1) != '<') {
+            $blockcontent = nl2br($blockcontent);
         }
 
         // autotags are only(!) allowed in normal blocks
-        if(( $A['allow_autotags'] == 1 ) && ( $A['type'] == 'normal' ))
-        {
-            $blockcontent = PLG_replaceTags( $blockcontent );
-        }
-        $blockcontent = str_replace( array( '<?', '?>' ), '', $blockcontent );
-
-        $retval .= COM_startBlock( $A['title'], $A['help'],
-                       COM_getBlockTemplate( $A['name'], 'header', $position ))
+        if (($A['allow_autotags'] == 1) && ($A['type'] == 'normal')) {
+            $blockcontent = PLG_replaceTags($blockcontent);
+        }
+        $blockcontent = str_replace(array('<?', '?>'), '', $blockcontent);
+        $blockcontent = str_replace(array('{', '}'), array('{', '}'),
+                                    $blockcontent);
+
+        $retval .= COM_startBlock($A['title'], $A['help'],
+                       COM_getBlockTemplate($A['name'], 'header', $position))
                 . $blockcontent . LB
-                . COM_endBlock( COM_getBlockTemplate( $A['name'], 'footer', $position ));
+                . COM_endBlock(COM_getBlockTemplate($A['name'], 'footer', $position));
     }
 
     return $retval;



More information about the geeklog-cvs mailing list