[geeklog-cvs] geeklog: Include [code], [raw] only when story.* permissions are...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Aug 8 15:58:26 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/e69fb3e301ae
changeset: 7240:e69fb3e301ae
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Aug 08 21:42:16 2009 +0200
description:
Include [code], [raw] only when story.* permissions are requested and available

diffstat:

 public_html/lib-common.php |  43 +++++++++++++++++++------------------------
 1 files changed, 19 insertions(+), 24 deletions(-)

diffs (63 lines):

diff -r 2b3961806070 -r e69fb3e301ae public_html/lib-common.php
--- a/public_html/lib-common.php	Sat Aug 08 21:26:43 2009 +0200
+++ b/public_html/lib-common.php	Sat Aug 08 21:42:16 2009 +0200
@@ -3876,7 +3876,6 @@
 
     $retval = '';
 
-    $allow_page_break = false;
     if( isset( $_CONF['skip_html_filter_for_root'] ) &&
              ( $_CONF['skip_html_filter_for_root'] == 1 ) &&
             SEC_inGroup( 'Root' ))
@@ -3912,32 +3911,28 @@
         }
     }
 
-    if( $_CONF['allow_page_breaks'] == 1 )
-    {
-        $perms = explode( ',', $permissions );
-        foreach( $perms as $p )
-        {
-            if( substr( $p, 0, 6 ) == 'story.' )
-            {
-                $allow_page_break = true;
-                break;
-            }
-        }
-    }
-
-    $retval .= '[code], [raw]';
-
-    if( $allow_page_break )
-    {
-        $retval .= ', [page_break]';
+    $with_story_perms = false;
+    $perms = explode( ',', $permissions );
+    foreach( $perms as $p )
+    {
+        if( substr( $p, 0, 6 ) == 'story.' )
+        {
+            $with_story_perms = true;
+            break;
+        }
+    }
+
+    if ($with_story_perms) {
+        $retval .= '[code], [raw], ';
+
+        if ($_CONF['allow_page_breaks'] == 1) {
+            $retval .= '[page_break], ';
+        }
     }
 
     // list autolink tags
-    $autotags = PLG_collectTags();
-    foreach( $autotags as $tag => $module )
-    {
-        $retval .= ', [' . $tag . ':]';
-    }
+    $autotags = array_keys(PLG_collectTags());
+    $retval .= '[' . implode(':], [', $autotags) . ':]';
     $retval .= '</div>';
 
     return $retval;



More information about the geeklog-cvs mailing list