[geeklog-cvs] geeklog: Effectively only an E_ALL fix: Need to display the deny...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Sep 14 06:51:45 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/586c7118e03a
changeset: 7310:586c7118e03a
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Sep 13 22:03:17 2009 +0200
description:
Effectively only an E_ALL fix: Need to display the deny_msg in staticpageeditor(), not in the form function

diffstat:

 public_html/admin/plugins/staticpages/index.php |  697 ++++++++++++++--------------
 1 files changed, 354 insertions(+), 343 deletions(-)

diffs (truncated from 770 to 300 lines):

diff -r 7b234d9cc294 -r 586c7118e03a public_html/admin/plugins/staticpages/index.php
--- a/public_html/admin/plugins/staticpages/index.php	Sun Sep 13 21:24:41 2009 +0200
+++ b/public_html/admin/plugins/staticpages/index.php	Sun Sep 13 22:03:17 2009 +0200
@@ -58,19 +58,19 @@
 
 
 /**
-* Displays the static page form
+* Displays the static page editor form
 *
-* @param    array   $A      Data to display
-* @param    string  $error  Error message to display
+* @param    array   $A  Data to display
+* @return   string      HTML for the static page editor
 *
 */
-function form ($A, $error = false)
+function staticpageeditor_form($A, $error = false)
 {
     global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $mode, $sp_id,
            $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG24,
            $LANG_postmodes, $MESSAGE;
 
-    $template_path = staticpages_templatePath ('admin');
+    $template_path = staticpages_templatePath('admin');
     if (!empty($sp_id) && $mode=='edit') {
         $access = SEC_hasAccess($A['owner_id'],$A['group_id'],$A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']);
     } else {
@@ -78,333 +78,328 @@
             $A['sp_inblock'] = $_SP_CONF['in_block'];
         }
         $A['owner_id'] = $_USER['uid'];
-        if (isset ($_GROUPS['Static Page Admin'])) {
+        if (isset($_GROUPS['Static Page Admin'])) {
             $A['group_id'] = $_GROUPS['Static Page Admin'];
         } else {
-            $A['group_id'] = SEC_getFeatureGroup ('staticpages.edit');
+            $A['group_id'] = SEC_getFeatureGroup('staticpages.edit');
         }
-        SEC_setDefaultPermissions ($A, $_SP_CONF['default_permissions']);
+        SEC_setDefaultPermissions($A, $_SP_CONF['default_permissions']);
         $access = 3;
-        if (isset ($_CONF['advanced_editor']) &&
+        if (isset($_CONF['advanced_editor']) &&
           ($_CONF['advanced_editor'] == 1) &&
-          file_exists ($template_path . '/editor_advanced.thtml'))
+          file_exists($template_path . '/editor_advanced.thtml'))
         {
              $A['advanced_editor_mode'] = 1;
         }
     }
     $retval = '';
 
-    if (empty ($A['owner_id'])) {
-        $error = COM_startBlock ($LANG_ACCESS['accessdenied'], '',
-                        COM_getBlockTemplate ('_msg_block', 'header'));
-        $error .= $LANG_STATIC['deny_msg'];
-        $error .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+    $sp_template = new Template($template_path);
+    if (isset($_CONF['advanced_editor']) &&
+        ($_CONF['advanced_editor'] == 1) &&
+        file_exists($template_path . '/editor_advanced.thtml'))
+    {
+        $sp_template->set_file('form', 'editor_advanced.thtml');
+        $sp_template->set_var('lang_expandhelp', $LANG24[67]);
+        $sp_template->set_var('lang_reducehelp', $LANG24[68]);
+        $sp_template->set_var('lang_toolbar', $LANG24[70]);
+        $sp_template->set_var('toolbar1', $LANG24[71]);
+        $sp_template->set_var('toolbar2', $LANG24[72]);
+        $sp_template->set_var('toolbar3', $LANG24[73]);
+        $sp_template->set_var('toolbar4', $LANG24[74]);
+        $sp_template->set_var('toolbar5', $LANG24[75]);
+        $sp_template->set_var('lang_nojavascript',$LANG24[77]);
+        $sp_template->set_var('lang_postmode', $LANG24[4]);
+        if (isset($A['postmode']) && ($A['postmode'] == 'adveditor')) {
+            $sp_template->set_var('show_adveditor','');
+            $sp_template->set_var('show_htmleditor','none');
+        } else {
+            $sp_template->set_var('show_adveditor','none');
+            $sp_template->set_var('show_htmleditor','');
+        }
+        $post_options = '<option value="html" selected="selected">'.$LANG_postmodes['html'].'</option>';
+        if (isset($A['postmode']) && ($A['postmode'] == 'adveditor')) {
+            $post_options .= '<option value="adveditor" selected="selected">'.$LANG24[86].'</option>';
+        } else {
+            $post_options .= '<option value="adveditor">'.$LANG24[86].'</option>';
+        }
+        $sp_template->set_var('post_options',$post_options );
+        $sp_template->set_var('change_editormode', 'onchange="change_editmode(this);"');
+    } else {
+        $sp_template->set_file('form', 'editor.thtml');
+    }
+    $sp_template->set_var('layout_url', $_CONF['layout_url']);
+    $sp_template->set_var('lang_mode', $LANG24[3]);
+    $sp_template->set_var(
+        'comment_options',
+        COM_optionList($_TABLES['commentcodes'],
+        'code,name',
+        $A['commentcode'])
+    );
+
+    $sp_template->set_var('lang_accessrights', $LANG_ACCESS['accessrights']);
+    $sp_template->set_var('lang_owner', $LANG_ACCESS['owner']);
+    $ownername = COM_getDisplayName($A['owner_id']);
+    $sp_template->set_var('owner_username', DB_getItem($_TABLES['users'],
+                          'username',"uid = {$A['owner_id']}"));
+    $sp_template->set_var('owner_name', $ownername);
+    $sp_template->set_var('owner', $ownername);
+    $sp_template->set_var('owner_id', $A['owner_id']);
+    $sp_template->set_var('lang_group', $LANG_ACCESS['group']);
+    $sp_template->set_var('group_dropdown',
+                          SEC_getGroupDropdown($A['group_id'], $access));
+    $sp_template->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']));
+    $sp_template->set_var('lang_permissions', $LANG_ACCESS['permissions']);
+    $sp_template->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
+    $sp_template->set_var('permissions_msg', $LANG_ACCESS['permmsg']);
+    $sp_template->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
+    $sp_template->set_var('site_url', $_CONF['site_url']);
+    $sp_template->set_var('site_admin_url', $_CONF['site_admin_url']);
+    $sp_template->set_var('start_block_editor',
+            COM_startBlock($LANG_STATIC['staticpageeditor']), '',
+                    COM_getBlockTemplate('_admin_block', 'header'));
+    $sp_template->set_var('lang_save', $LANG_ADMIN['save']);
+    $sp_template->set_var('lang_cancel', $LANG_ADMIN['cancel']);
+    $sp_template->set_var('lang_preview', $LANG_ADMIN['preview']);
+    if (SEC_hasRights('staticpages.delete') && ($mode != 'clone') &&
+            !empty($A['sp_old_id'])) {
+        $delbutton = '<input type="submit" value="' . $LANG_ADMIN['delete']
+                   . '" name="mode"%s' . XHTML . '>';
+        $jsconfirm = ' onclick="return confirm(\'' . $MESSAGE[76] . '\');"';
+        $sp_template->set_var('delete_option',
+                              sprintf($delbutton, $jsconfirm));
+        $sp_template->set_var('delete_option_no_confirmation',
+                              sprintf($delbutton, ''));
+    } else {
+        $sp_template->set_var('delete_option','');
+    }
+    $sp_template->set_var('lang_writtenby', $LANG_STATIC['writtenby']);
+    $sp_template->set_var('username', DB_getItem($_TABLES['users'],
+                          'username', "uid = {$A['sp_uid']}"));
+    $authorname = COM_getDisplayName($A['sp_uid']);
+    $sp_template->set_var('name', $authorname);
+    $sp_template->set_var('author', $authorname);
+    $sp_template->set_var('lang_url', $LANG_STATIC['url']);
+    $sp_template->set_var('lang_id', $LANG_STATIC['id']);
+    $sp_template->set_var('sp_uid', $A['sp_uid']);
+    $sp_template->set_var('sp_id', $A['sp_id']);
+    $sp_template->set_var('sp_old_id', $A['sp_old_id']);
+    $sp_template->set_var('example_url', COM_buildURL($_CONF['site_url']
+                          . '/staticpages/index.php?page=' . $A['sp_id']));
+
+    $sp_template->set_var('lang_centerblock', $LANG_STATIC['centerblock']);
+    $sp_template->set_var('lang_centerblock_help', $LANG_ADMIN['help_url']);
+    $sp_template->set_var('lang_centerblock_include', $LANG21[51]);
+    $sp_template->set_var('lang_centerblock_desc', $LANG21[52]);
+    $sp_template->set_var('centerblock_help', $A['sp_help']);
+    $sp_template->set_var('lang_centerblock_msg', $LANG_STATIC['centerblock_msg']);
+    if (isset($A['sp_centerblock']) && ($A['sp_centerblock'] == 1)) {
+        $sp_template->set_var('centerblock_checked', 'checked="checked"');
+    } else {
+        $sp_template->set_var('centerblock_checked', '');
+    }
+    $sp_template->set_var('lang_topic', $LANG_STATIC['topic']);
+    $sp_template->set_var('lang_position', $LANG_STATIC['position']);
+    $current_topic = '';
+    if (isset($A['sp_tid'])) {
+        $current_topic = $A['sp_tid'];
+    }
+    if (empty($current_topic)) {
+        $current_topic = 'none';
+    }
+    $topics = COM_topicList('tid,topic', $current_topic, 1, true);
+    $alltopics = '<option value="all"';
+    if ($current_topic == 'all') {
+        $alltopics .= ' selected="selected"';
+    }
+    $alltopics .= '>' . $LANG_STATIC['all_topics'] . '</option>' . LB;
+    $notopic = '<option value="none"';
+    if ($current_topic == 'none') {
+        $notopic .= ' selected="selected"';
+    }
+    $notopic .= '>' . $LANG_STATIC['no_topic'] . '</option>' . LB;
+    $sp_template->set_var('topic_selection', '<select name="sp_tid">'
+                          . $alltopics . $notopic . $topics . '</select>');
+    $position = '<select name="sp_where">';
+    $position .= '<option value="1"';
+    if ($A['sp_where'] == 1) {
+        $position .= ' selected="selected"';
+    }
+    $position .= '>' . $LANG_STATIC['position_top'] . '</option>';
+    $position .= '<option value="2"';
+    if ($A['sp_where'] == 2) {
+        $position .= ' selected="selected"';
+    }
+    $position .= '>' . $LANG_STATIC['position_feat'] . '</option>';
+    $position .= '<option value="3"';
+    if ($A['sp_where'] == 3) {
+        $position .= ' selected="selected"';
+    }
+    $position .= '>' . $LANG_STATIC['position_bottom'] . '</option>';
+    $position .= '<option value="0"';
+    if ($A['sp_where'] == 0) {
+        $position .= ' selected="selected"';
+    }
+    $position .= '>' . $LANG_STATIC['position_entire'] . '</option>';
+    $position .= '</select>';
+    $sp_template->set_var('pos_selection', $position);
+
+    if (($_SP_CONF['allow_php'] == 1) && SEC_hasRights('staticpages.PHP')) {
+        if (!isset($A['sp_php'])) {
+            $A['sp_php'] = 0;
+        }
+        $selection = '<select name="sp_php">' . LB;
+        $selection .= '<option value="0"';
+        if (($A['sp_php'] <= 0) || ($A['sp_php'] > 2)) {
+            $selection .= ' selected="selected"';
+        }
+        $selection .= '>' . $LANG_STATIC['select_php_none'] . '</option>' . LB;
+        $selection .= '<option value="1"';
+        if ($A['sp_php'] == 1) {
+            $selection .= ' selected="selected"';
+        }
+        $selection .= '>' . $LANG_STATIC['select_php_return'] . '</option>' . LB;
+        $selection .= '<option value="2"';
+        if ($A['sp_php'] == 2) {
+            $selection .= ' selected="selected"';
+        }
+        $selection .= '>' . $LANG_STATIC['select_php_free'] . '</option>' . LB;
+        $selection .= '</select>';
+        $sp_template->set_var('php_selector', $selection);
+        $sp_template->set_var('php_warn', $LANG_STATIC['php_warn']);
+    } else {
+        $sp_template->set_var('php_selector', '');
+        $sp_template->set_var('php_warn', $LANG_STATIC['php_not_activated']);
+    }
+    $sp_template->set_var('php_msg', $LANG_STATIC['php_msg']);
+
+    // old variables (for the 1.3-type checkbox)
+    $sp_template->set_var('php_checked', '');
+    $sp_template->set_var('php_type', 'hidden');
+
+    if (isset($A['sp_nf']) && ($A['sp_nf'] == 1)) {
+        $sp_template->set_var('exit_checked','checked="checked"');
+    } else {
+        $sp_template->set_var('exit_checked','');
+    }
+    $sp_template->set_var('exit_msg',$LANG_STATIC['exit_msg']);
+    $sp_template->set_var('exit_info',$LANG_STATIC['exit_info']);
+
+    if ($A['sp_inblock'] == 1) {
+        $sp_template->set_var('inblock_checked', 'checked="checked"');
+    } else {
+        $sp_template->set_var('inblock_checked', '');
+    }
+    $sp_template->set_var('inblock_msg', $LANG_STATIC['inblock_msg']);
+    $sp_template->set_var('inblock_info', $LANG_STATIC['inblock_info']);
+
+    $curtime = COM_getUserDateTimeFormat($A['unixdate']);
+    $sp_template->set_var('lang_lastupdated', $LANG_STATIC['date']);
+    $sp_template->set_var('sp_formateddate', $curtime[0]);
+    $sp_template->set_var('sp_date', $curtime[1]);
+
+    $sp_template->set_var('lang_title', $LANG_STATIC['title']);
+    $title = '';
+    if (isset($A['sp_title'])) {
+        $title = htmlspecialchars(stripslashes($A['sp_title']));
+    }
+    $sp_template->set_var('sp_title', $title);
+    $sp_template->set_var('lang_metadescription', $LANG_STATIC['meta_description']);
+    $sp_template->set_var('lang_metakeywords', $LANG_STATIC['meta_keywords']);
+    if (!empty($A['meta_description'])) {
+        $sp_template->set_var('meta_description', $A['meta_description']);
+    }
+    if (!empty($A['meta_keywords'])) {
+        $sp_template->set_var('meta_keywords', $A['meta_keywords']);        
+    }
+    $sp_template->set_var('lang_addtomenu', $LANG_STATIC['addtomenu']);
+    if (isset($A['sp_onmenu']) && ($A['sp_onmenu'] == 1)) {
+        $sp_template->set_var('onmenu_checked', 'checked="checked"');
+    } else {
+        $sp_template->set_var('onmenu_checked', '');
+    }
+    $sp_template->set_var('lang_label', $LANG_STATIC['label']);
+    if (isset($A['sp_label'])) {
+        $sp_template->set_var('sp_label', $A['sp_label']);
+    } else {
+        $sp_template->set_var('sp_label', '');
+    }
+    $sp_template->set_var('lang_pageformat', $LANG_STATIC['pageformat']);
+    $sp_template->set_var('lang_blankpage', $LANG_STATIC['blankpage']);
+    $sp_template->set_var('lang_noblocks', $LANG_STATIC['noblocks']);
+    $sp_template->set_var('lang_leftblocks', $LANG_STATIC['leftblocks']);
+    $sp_template->set_var('lang_leftrightblocks', $LANG_STATIC['leftrightblocks']);
+    if (!isset($A['sp_format'])) {
+        $A['sp_format'] = '';
+    }
+    if ($A['sp_format'] == 'noblocks') {
+        $sp_template->set_var('noblock_selected', 'selected="selected"');
+    } else {
+        $sp_template->set_var('noblock_selected', '');



More information about the geeklog-cvs mailing list