[geeklog-hg] geeklog: Fixed display [code], [raw], [page_break] for Allowed H...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Jun 22 14:06:49 EDT 2013


changeset 9120:4f8129e32a70
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/4f8129e32a70
user: dengen
date: Sun Jun 23 03:01:51 2013 +0900
description:
Fixed display [code], [raw], [page_break] for Allowed HTML Tags on the comment edit form (bug #0001362)

diffstat:

 public_html/admin/story.php |   6 +++++-
 public_html/lib-common.php  |  37 ++++++++++++-------------------------
 2 files changed, 17 insertions(+), 26 deletions(-)

diffs (79 lines):

diff -r 132fec38fea3 -r 4f8129e32a70 public_html/admin/story.php
--- a/public_html/admin/story.php	Sat Jun 22 17:53:18 2013 +0900
+++ b/public_html/admin/story.php	Sun Jun 23 03:01:51 2013 +0900
@@ -685,8 +685,12 @@
         }
     }
     $story_templates->set_var('post_options',$post_options );
+    $allowed_tags = array('code', 'raw');
+    if ($_CONF['allow_page_breaks'] == 1) {
+        $allowed_tags = array_merge($allowed_tags, array('page_break'));
+    }
     $story_templates->set_var('lang_allowed_html',
-                              COM_allowedHTML('story.edit'));
+                              COM_allowedHTML('story.edit', false, 1, $allowed_tags));
     $fileinputs = '';
     $saved_images = '';
     if ($_CONF['maximagesperarticle'] > 0) {
diff -r 132fec38fea3 -r 4f8129e32a70 public_html/lib-common.php
--- a/public_html/lib-common.php	Sat Jun 22 17:53:18 2013 +0900
+++ b/public_html/lib-common.php	Sun Jun 23 03:01:51 2013 +0900
@@ -4799,15 +4799,16 @@
 *
 * @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
-* @param    boolean $filter_html_flag   0 = returns allowed all html tags, 1 = returns allowed HTML tags only, 2 = returns No HTML Tags Allowed (this is used by plugins if they have a config that overrides Geeklogs filter html settings or do not have a post mode)
-* @return   string                  HTML <div>/<span> enclosed string
+* @param    int     $filter_html_flag   0 = returns allowed all html tags,
+                                        1 = returns allowed HTML tags only,
+                                        2 = returns No HTML Tags Allowed (this is used by plugins if they have a config
+                                               that overrides Geeklogs filter html settings or do not have a post mode)
+* @param    array   $allowed_tags       Array of allowed special tags ('code', 'raw', 'page_break' ...)
+* @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, $filter_html_flag = 1)
+*
+*/
+function COM_allowedHTML($permissions = 'story.edit', $list_only = false, $filter_html_flag = 1, $allowed_tags = '')
 {
     global $_CONF, $_PLUGINS, $LANG01;
 
@@ -4850,20 +4851,9 @@
         }
     }
 
-    $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], ';
+    if ($filter_html_flag !== 2 && is_array($allowed_tags)) {
+        foreach ($allowed_tags as $tag) {
+            $retval .= '[' . $tag . '], ';
         }
     }
 
@@ -4887,9 +4877,6 @@
     $retval .= '</div>';
 
     return $retval;
-    
-
-    return $retval;
 }
 
 /**



More information about the geeklog-cvs mailing list