[geeklog-cvs] geeklog: Source code cosmetics + document that [code] and [raw] ...

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


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/594babfaeddc
changeset: 7241:594babfaeddc
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Aug 08 21:57:44 2009 +0200
description:
Source code cosmetics + document that [code] and [raw] may sometimes be listed even though they won't work (e.g. in comments on stories)

diffstat:

 public_html/docs/history   |   2 +
 public_html/lib-common.php |  61 ++++++++++++++----------------
 2 files changed, 31 insertions(+), 32 deletions(-)

diffs (109 lines):

diff -r e69fb3e301ae -r 594babfaeddc public_html/docs/history
--- a/public_html/docs/history	Sat Aug 08 21:42:16 2009 +0200
+++ b/public_html/docs/history	Sat Aug 08 21:57:44 2009 +0200
@@ -3,6 +3,8 @@
 ??? ??, 2009 (1.6.1)
 ------------
 
+- Only list [code], [raw] tags when story.* permissions are required [Dirk]
+- [page_break] was not listed when all HTML was allowed for Root users [Dirk]
 - Added support for meta tags and meta keywords, provided by Tom Homer
 - When an error occurs in bigdump.php (during migration) keep the language when
   sending the user back to migrate.php (bug #0000943) [Dirk]
diff -r e69fb3e301ae -r 594babfaeddc public_html/lib-common.php
--- a/public_html/lib-common.php	Sat Aug 08 21:42:16 2009 +0200
+++ b/public_html/lib-common.php	Sat Aug 08 21:57:44 2009 +0200
@@ -3867,56 +3867,53 @@
 *
 * @param    string  $permissions    comma-separated list of rights which identify the current user as an "Admin"
 * @param    boolean $list_only      true = return only the list of HTML tags
-* @return   string  HTML <span> enclosed string
-* @see function COM_checkHTML
-*/
-function COM_allowedHTML( $permissions = 'story.edit', $list_only = false )
+* @return   string                  HTML <div>/<span> enclosed string
+* @see      function COM_checkHTML
+* @todo     Bugs: The list always includes the [code], [raw], and [page_break]
+*           tags when story.* permissions are required, even when those tags
+*           are not actually available (e.g. in comments on stories).
+*
+*/
+function COM_allowedHTML($permissions = 'story.edit', $list_only = false)
 {
     global $_CONF, $LANG01;
 
     $retval = '';
 
-    if( isset( $_CONF['skip_html_filter_for_root'] ) &&
-             ( $_CONF['skip_html_filter_for_root'] == 1 ) &&
-            SEC_inGroup( 'Root' ))
-    {
-        if( !$list_only )
-        {
-            $retval .= '<span class="warningsmall">' . $LANG01[123] . ',</span> ';
+    if (isset($_CONF['skip_html_filter_for_root']) &&
+             ($_CONF['skip_html_filter_for_root'] == 1) &&
+            SEC_inGroup('Root')) {
+
+        if (!$list_only) {
+            $retval .= '<span class="warningsmall">' . $LANG01[123]
+                    . ',</span> ';
         }
         $retval .= '<div dir="ltr" class="warningsmall">';
-    }
-    else
-    {
-        if( !$list_only )
-        {
+
+    } else {
+
+        if (! $list_only) {
             $retval .= '<span class="warningsmall">' . $LANG01[31] . '</span> ';
         }
 
-        if( empty( $permissions ) || !SEC_hasRights( $permissions ) ||
-                empty( $_CONF['admin_html'] ))
-        {
+        if (empty($permissions) || !SEC_hasRights($permissions) ||
+                empty($_CONF['admin_html'])) {
             $html = $_CONF['user_html'];
-        }
-        else
-        {
-            $html = array_merge_recursive( $_CONF['user_html'],
-                                           $_CONF['admin_html'] );
+        } else {
+            $html = array_merge_recursive($_CONF['user_html'],
+                                          $_CONF['admin_html']);
         }
 
         $retval .= '<div dir="ltr" class="warningsmall">';
-        foreach( $html as $tag => $attr )
-        {
+        foreach ($html as $tag => $attr) {
             $retval .= '<' . $tag . '>, ';
         }
     }
 
     $with_story_perms = false;
-    $perms = explode( ',', $permissions );
-    foreach( $perms as $p )
-    {
-        if( substr( $p, 0, 6 ) == 'story.' )
-        {
+    $perms = explode(',', $permissions);
+    foreach ($perms as $p) {
+        if (substr($p, 0, 6) == 'story.') {
             $with_story_perms = true;
             break;
         }
@@ -3930,7 +3927,7 @@
         }
     }
 
-    // list autolink tags
+    // list autotags
     $autotags = array_keys(PLG_collectTags());
     $retval .= '[' . implode(':], [', $autotags) . ':]';
     $retval .= '</div>';



More information about the geeklog-cvs mailing list