]> git.mjollnir.org Git - s9y.git/commitdiff
Improve usability by removing possibly dangerous options from personal configuration...
authorgarvinhicking <garvinhicking>
Thu, 22 Mar 2007 10:27:18 +0000 (10:27 +0000)
committergarvinhicking <garvinhicking>
Thu, 22 Mar 2007 10:27:18 +0000 (10:27 +0000)
Thanks to lendulado from the forums for these suggestions.

docs/NEWS
include/admin/plugins.inc.php
include/admin/users.inc.php
include/functions_installer.inc.php
include/tpl/config_personal.inc.php

index 6d9f381b671b8e73df620bc97a403fa3cddd1d31..e80a37295a3b9d00b9ed587570892f4506a5f2bd 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,11 @@
 Version 1.2 ()
 ------------------------------------------------------------------------
 
+    * Move possible hazardous personal configuration options ("Rights:
+      Publishing entries", "Forbid creating entries", "Access level";
+      "Group memberships") to the user management section.
+      (garvinhicking)
+
     * Fix track exit url ids off by one when being used in conjunction
       with caching plugin (garvinhicking)
 
index baa669f5f0f3a20dc7c577a1d456c9f2bf537306..cfb0628002ae0a5368f95baf685cca6458d2b9be 100644 (file)
@@ -493,6 +493,10 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
     <?php serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity); ?>
     <?php show_plugins(true); ?>
 
+    <h3>Memory Usage</h3>
+    <div>
+        <pre><?php print_r($serendipity['memSnaps']); ?></pre>
+    </div>
 <?php
 }
 /* vim: set sts=4 ts=4 expandtab : */
index e4e610e365f42fbe73537ebe109b29ef5cb263f0..5df327123b7b31e7248f03ecfc36dea254843424 100644 (file)
@@ -201,7 +201,7 @@ foreach($users as $user) {
 <?php /* TODO: Add username to list once tom figures out how to fix uneven rowstyles */ ?>
         <td><img src="<?php echo $img ?>" alt="" style="border: 0px none ; vertical-align: bottom; display: inline;" /> <?php echo htmlspecialchars($user['realname']); ?></td>
         <td width="100" align="center"><?php echo $user['userlevel']; ?></td>
-        <td width="200" align="right"> [<a href="?serendipity[adminModule]=users&amp;serendipity[adminAction]=edit&amp;serendipity[userid]=<?php echo $user['authorid'] ?>"><?php echo EDIT ?></a>]
+        <td width="200" align="right"> [<a href="?serendipity[adminModule]=users&amp;serendipity[adminAction]=edit&amp;serendipity[userid]=<?php echo $user['authorid'] ?>#editform"><?php echo EDIT ?></a>]
                                      - [<a href="?serendipity[adminModule]=users&amp;serendipity[adminAction]=delete&amp;serendipity[userid]=<?php echo $user['authorid'] ?>"><?php echo DELETE ?></a>]</td>
     </tr>
 </table>
@@ -232,12 +232,13 @@ if ( ($serendipity['GET']['adminAction'] == 'edit' && serendipity_checkPermissio
 <br />
 <br />
 <hr noshade="noshade">
-<form action="?serendipity[adminModule]=users" method="post">
+<form action="?serendipity[adminModule]=users#editform" method="post">
 <?php echo serendipity_setFormToken(); ?>
     <div>
     <h3>
 <?php
 if ($serendipity['GET']['adminAction'] == 'edit') {
+    echo '<a id="editform"></a>';
     $user = serendipity_fetchUsers($serendipity['GET']['userid']);
     $group_intersect = serendipity_intersectGroup($user[0]['authorid']);
 
@@ -271,7 +272,7 @@ if (!empty($serendipity['GET']['userid'])) {
     $from['groups'] = array();
 }
 
-serendipity_printConfigTemplate($config, $from, true, false);
+serendipity_printConfigTemplate($config, $from, true, false, true, true);
 
 if ($serendipity['GET']['adminAction'] == 'edit') { ?>
         <input type="submit" name="SAVE_EDIT"   value="<?php echo SAVE; ?>" class="serendipityPrettyButton" />
index 08be1ba1cbc83498f1e2f3789293d174ee4447f5..897c34583757bf5271ade53954164a1c549ab94a 100644 (file)
@@ -451,9 +451,10 @@ function serendipity_guessInput($type, $name, $value='', $default='') {
  * @param   boolean     If true, no HTML FORM container will be emitted
  * @param   boolean     If true, the configuration sections will all be folded
  * @param   boolean     If true, the user can turn config sections on and off
+ * @param   boolean     If true, the user can NOT display possibly dangerous options
  * @return null
  */
-function serendipity_printConfigTemplate($config, $from = false, $noForm = false, $folded = true, $allowToggle = true) {
+function serendipity_printConfigTemplate($config, $from = false, $noForm = false, $folded = true, $allowToggle = true, $showDangerous = false) {
     global $serendipity;
     if ( $allowToggle ) {
 ?>
@@ -518,7 +519,7 @@ function showConfigAll(count) {
 ?>
             <tr>
                 <th align="left" colspan="2" style="padding-left: 15px;">
-<?php if ( $allowToggle ) { ?>
+<?php if ($allowToggle) { ?>
                     <a style="border:0; text-decoration: none;" href="#" onClick="showConfig('el<?php echo $el_count; ?>'); return false" title="<?php echo TOGGLE_OPTION; ?>"><img src="<?php echo serendipity_getTemplateFile('img/'. ($folded === true ? 'plus' : 'minus') .'.png') ?>" id="optionel<?php echo $el_count; ?>" alt="+/-" border="0" />&nbsp;<?php echo $category['title']; ?></a>
 <?php } else { ?>
                     <?php echo $category['title']; ?>
@@ -536,7 +537,7 @@ function showConfigAll(count) {
                         </tr>
 
 <?php
-        foreach ( $category['items'] as $item ) {
+        foreach ($category['items'] as $item) {
 
             $value = $from[$item['var']];
 
@@ -546,13 +547,17 @@ function showConfigAll(count) {
             }
 
             /* Check for installOnly flag */
-            if ( in_array('installOnly', $item['flags']) && IS_installed === true ) {
+            if (in_array('installOnly', $item['flags']) && IS_installed === true) {
                 continue;
             }
 
-            if ( in_array('hideValue', $item['flags']) ) {
+            if (in_array('hideValue', $item['flags'])) {
                 $value = '';
             }
+            
+            if (!$showDangerous && $item['view'] == 'dangerous') {
+                continue;
+            }
 
             if (in_array('config', $item['flags']) && isset($from['authorid'])) {
                 $value = serendipity_get_user_config_var($item['var'], $from['authorid'], $item['default']);
index c63b5999d63545361a64d34bc6ebe2008d5a53b8..ac51544ee137a3b91adaf8a6891c72c2ab3f64a6 100644 (file)
                                           'description' => USERCONF_USERLEVEL_DESC . "\n" . USERLEVEL_OBSOLETE,
                                           'type'        => 'list',
                                           'default'     => $serendipity['permissionLevels'],
-                                          'permission'  => 'personalConfigurationUserlevel'),
+                                          'permission'  => 'personalConfigurationUserlevel',
+                                          'view'        => 'dangerous'),
 
                                     array('var'         => 'groups',
                                           'title'       => USERCONF_GROUPS,
                                           'description' => USERCONF_GROUPS_DESC,
                                           'type'        => 'multilist',
                                           'permission'  => array('adminUsersMaintainOthers', 'adminUsersMaintainSame'),
-                                          'perm_mode'   => 'or', 
+                                          'perm_mode'   => 'or',
                                           'default'     => serendipity_getAllGroups(),
-                                          'flags'       => array('groups')),
+                                          'flags'       => array('groups'),
+                                          'view'        => 'dangerous'),
 
                                     array('var'         => 'email',
                                           'title'       => USERCONF_EMAIL,
                                           'permission'  => 'personalConfiguration',
                                           'flags'       => array('config')),
 
+                                    array('var'         => 'eyecandy',
+                                          'title'       => PREFERENCE_USE_JS,
+                                          'description' => PREFERENCE_USE_JS_DESC,
+                                          'type'        => 'bool',
+                                          'default'     => true,
+                                          'permission'  => 'personalConfiguration',
+                                          'flags'       => array('config')),
+
                                     array('var'         => 'mail_comments',
                                           'title'       => USERCONF_SENDCOMMENTS,
                                           'description' => USERCONF_SENDCOMMENTS_DESC,
                                           'type'        => 'bool',
                                           'default'     => false,
                                           'permission'  => 'personalConfigurationNoCreate',
-                                          'flags'       => array('config')),
+                                          'flags'       => array('config'),
+                                          'view'        => 'dangerous'),
 
                                     array('var'         => 'right_publish',
                                           'title'       => USERCONF_ALLOWPUBLISH,
                                           'description' => USERCONF_ALLOWPUBLISH_DESC,
                                           'type'        => 'bool',
                                           'default'     => true,
-                                          'permission'  => 'personalConfigurationRightPublish')
+                                          'permission'  => 'personalConfigurationRightPublish',
+                                          'view'        => 'dangerous')
                             ));
 
     $res['defaults'] =
                                           'default'     => array('publish' => PUBLISH, 'draft' => DRAFT),
                                           'permission'  => 'personalConfiguration',
                                           'flags'       => array('config')),
+
+                                    array('var'         => 'showMediaToolbar',
+                                          'title'       => SHOW_MEDIA_TOOLBAR,
+                                          'description' => '',
+                                          'type'        => 'bool',
+                                          'default'     => false,
+                                          'permission'  => 'personalConfiguration',
+                                          'flags'       => array('config')),
                             ));
 
     return $res;
-?>