Extension ext-admins updated:
authorRoland Häder <roland@mxchange.org>
Wed, 10 Aug 2011 18:44:11 +0000 (18:44 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 10 Aug 2011 18:44:11 +0000 (18:44 +0000)
- We don't shortcut names of any columns, array elements et cetera. This may
  lead to misunderstandings of the code.
- More EL code used in ext-admins
- Function getAdminMenuMode() introduced
- Internal TODO closed (SQL_FETCHARRAY() shall be more used)
- TODOs.txt updated

14 files changed:
DOCS/TODOs.txt
inc/extensions-functions.php
inc/extensions/ext-admins.php
inc/filter/admins_filter.php
inc/functions.php
inc/libs/admins_functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-admins_mails.php
inc/modules/admin/what-list_admins_acls.php
inc/mysql-manager.php
templates/de/html/admin/admin_add_admins_acl.tpl
templates/de/html/admin/admin_config_session.tpl
templates/de/html/admin/admin_edit_admins_acls_row.tpl
templates/de/html/admin/admin_edit_admins_row.tpl

index 68ce899955a06987311b87724aecd18a2d88d83b..738b121c417cf9c1f2c28dae0df9d7e62bc14399 100644 (file)
@@ -52,7 +52,7 @@
 ./inc/functions.php:156:// @TODO Rewrite this to an extension 'smtp'
 ./inc/functions.php:1940:      // @TODO Find a way to cache this
 ./inc/functions.php:2041:      // @TODO This is still very static, rewrite it somehow
-./inc/functions.php:2233:      // @TODO Rename column data_type to e.g. mail_status
+./inc/functions.php:2236:      // @TODO Rename column data_type to e.g. mail_status
 ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:57:        // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestElement('omode'), 0);
 ./inc/language/de.php:1071:    // @TODO Rewrite these two constants
@@ -64,7 +64,7 @@
 ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings             *
 ./inc/language/refback_de.php:53:      // @TODO Rewrite these constants to one
 ./inc/language/sponsor_de.php:117:// @TODO Rewrite these four constants to one and use sprintf()
-./inc/libs/admins_functions.php:474:           // @TODO This can be, somehow, rewritten
+./inc/libs/admins_functions.php:505:           // @TODO This can be, somehow, rewritten
 ./inc/libs/bonus_functions.php:194:            // @TODO Move this HTML to a template
 ./inc/libs/doubler_functions.php:44:// @TODO Lame description
 ./inc/libs/doubler_functions.php:93:                   // @TODO Can't this be moved into EL?
 ./inc/mails/doubler_mails.php:53:// @TODO Can this be rewritten to a filter?
 ./inc/module-functions.php:267:                        // @TODO Nothing helped???
 ./inc/module-functions.php:308:                        // @TODO Rewrite this to a filter
-./inc/modules/admin/admin-inc.php:1373:                                // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
+./inc/modules/admin/admin-inc.php:1379:                                // @TODO If we can rewrite the EL sub-system to support more than one parameter, this call_user_func_array() can be avoided
 ./inc/modules/admin/admin-inc.php:171:         // @TODO This and the next getCurrentAdminId() call might be moved into the templates?
 ./inc/modules/admin/admin-inc.php:242:         // @TODO This can be rewritten into a filter
 ./inc/modules/admin/admin-inc.php:274:         // @TODO Rewrite this to $content = SQL_FETCHARRAY()
 ./inc/modules/admin/admin-inc.php:340:                                 // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/modules/admin/admin-inc.php:438:// @TODO Try to rewrite this to adminAddMenuSelectionBox()
+./inc/modules/admin/admin-inc.php:444:// @TODO Try to rewrite this to adminAddMenuSelectionBox()
 ./inc/modules/admin/overview-inc.php:162:                              // @TODO Rewrite this to a filter
 ./inc/modules/admin/overview-inc.php:275:                              // @TODO Rewrite this to something with include files and/or filter
 ./inc/modules/admin/overview-inc.php:309:                                              // @TODO This may also be rewritten to include files
 ./inc/modules/admin/what-admin_add.php:59:             // @TODO Cant this be rewritten?
 ./inc/modules/admin/what-admin_add.php:75:             // @TODO This can be somehow rewritten to a function
 ./inc/modules/admin/what-adminedit.php:56:     // @TODO Kill all constants in this file
-./inc/modules/admin/what-admins_mails.php:59:                          // @TODO Can this be rewritten to an API function?
+./inc/modules/admin/what-admins_mails.php:58:                          // @TODO Can this be rewritten to an API function?
 ./inc/modules/admin/what-bonus.php:46:// @TODO Unused at the moment
 ./inc/modules/admin/what-config_mods.php:55:                   // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function
 ./inc/modules/admin/what-config_points.php:110:                        // @TODO Rewrite this to a filter
 ./inc/modules/admin/what-guest_add.php:67:             // @TODO Cant this be rewritten?
 ./inc/modules/admin/what-guest_add.php:80:             // @TODO This can be somehow rewritten to a function
 ./inc/modules/admin/what-holiday_list.php:46:// @TODO Unused at the moment
-./inc/modules/admin/what-list_admins_acls.php:108:     // @TODO Rewrite this to a filter
-./inc/modules/admin/what-list_admins_acls.php:136:     // @TODO Rewrite this to filter 'run_sqls'
+./inc/modules/admin/what-list_admins_acls.php:101:     // @TODO Rewrite this to a filter
+./inc/modules/admin/what-list_admins_acls.php:129:     // @TODO Rewrite this to filter 'run_sqls'
 ./inc/modules/admin/what-list_autopurge.php:47:// @TODO Rewrite those lines to filter
 ./inc/modules/admin/what-list_bonus.php:136:           // @TODO Can't this be moved into our expression language?
 ./inc/modules/admin/what-list_cats.php:54:             // @TODO No longer needed? define('__CATEGORIES_BASE'   , '<a href="{%url=modules.php?module=admin&amp;userid=');
 ./inc/modules/member/what-unconfirmed.php:162: // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
 ./inc/modules/member/what-unconfirmed.php:227:                         // @TODO This 'userid' cannot be saved because of encapsulated EL code
 ./inc/modules/order.php:78:            // @TODO Unused: 2,4
-./inc/mysql-manager.php:1275:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1339:          // @TODO Rewrite these lines to a filter
-./inc/mysql-manager.php:1363:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1622:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1668:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1381:          // @TODO Rewrite these lines to a filter
+./inc/mysql-manager.php:1405:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1664:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1710:// @TODO Fix inconsistency between last_module and getWhat()
 ./inc/mysql-manager.php:387:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/purge/purge-inact.php:55:        // @TODO Rewrite these if() blocks to a filter
 ./inc/loader/load_cache-revision.php:2:// @DEPRECATED
 ./inc/loader/load_cache-them.php:2:// @DEPRECATED
 ./inc/loader/load-extensions.php:2:// @DEPRECATED
-./inc/modules/admin/admin-inc.php:439:// @DEPRECATED
+./inc/modules/admin/admin-inc.php:445:// @DEPRECATED
 ./inc/modules/admin/what-chk_regs.php:2:// @DEPRECATED
 ./inc/modules/admin/what-config_admins.php:2:// @DEPRECATED
 ./inc/modules/admin/what-config_email.php:2:// @DEPRECATED
index bb28fdce30f31841b3c050cd993a4a2b90def8e1..58e0560271cb2ff34fe9bf6268eb01928cd3eaf9 100644 (file)
@@ -158,7 +158,7 @@ function loadExtension ($ext_name, $ext_mode, $ext_ver = '0.0.0', $dry_run = fal
        loadCurrentExtensionInclude();
 
        // Is this extension deprecated?
-       if (isExtensionDeprecated()) {
+       if ((isExtensionDeprecated()) && (getExtensionMode() != 'test')) {
                // Deactivate the extension
                doDeactivateExtension($ext_name);
 
index a12fe03ea9a8a22b04b984e80ade3640cb3835d3..81b2234b82c13225e877a2f373db61128664dcbd 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version of this extension
-setThisExtensionVersion('0.7.7');
+setThisExtensionVersion('0.7.8');
 
 // Version history array (add more with , '0.0.1' and so on)
-setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.2.0', '0.3.0', '0.3.1', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7'));
+setExtensionVersionHistory(array('0.0.0', '0.1.0', '0.2.0', '0.3.0', '0.3.1', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7', '0.7.8'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
@@ -264,7 +264,7 @@ INDEX (`admin_id`)",
                                break;
 
                        case '0.6.7': // SQL queries for v0.6.7
-                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins` ADD la_mode ENUM('global','OLD','NEW') NOT NULL DEFAULT 'global'");
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins` ADD `la_mode` ENUM('global','OLD','NEW') NOT NULL DEFAULT 'global'");
 
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Namenskonflikt zwischen den Erweiterungen <strong>admins</strong> und (kommender) <strong>contact</strong>. Beseitigung eines Fehlers <strong>HTTP_POSR_VARS</strong> beim &Auml;ndern von Administratoren.");
@@ -349,6 +349,11 @@ INDEX (`admin_id`)",
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Ausgangswert ist nicht mehr 0000-00-00 00:00:00, sondern NULL.");
                                break;
+
+                       case '0.7.8': // SQL queries for v0.7.8
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Abgek&uuml;rzte Bezeichnungen k&ouml;nnen f&uuml;r Missverst&auml;ndnisse am Code sorgen. Daher wurde der Spaltenalias <strong>def_acl</strong> entfernt.");
+                               break;
                } // END - switch
                break;
 
index f7fab4603eb3b55a446ba679c6e379ed543424f7..7e5faa555716d506255063b18d16adf5679ebd26 100644 (file)
@@ -44,10 +44,10 @@ if (!defined('__SECURITY')) {
 function FILTER_ADD_EXTRA_SQL_DATA ($add = '') {
        // Is the admins extension updated? (should be!)
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Called!');
-       if (isExtensionInstalledAndNewer('admins', '0.3.0')) $add .= ', `default_acl` AS def_acl';
-       if (isExtensionInstalledAndNewer('admins', '0.6.7')) $add .= ', `la_mode`';
-       if (isExtensionInstalledAndNewer('admins', '0.7.2')) $add .= ', `login_failures`, UNIX_TIMESTAMP(`last_failure`) AS last_failure';
-       if (isExtensionInstalledAndNewer('admins', '0.7.3')) $add .= ', `expert_settings`,`expert_warning`';
+       if (isExtensionInstalledAndNewer('admins', '0.3.0')) $add .= ',`default_acl`';
+       if (isExtensionInstalledAndNewer('admins', '0.6.7')) $add .= ',`la_mode`';
+       if (isExtensionInstalledAndNewer('admins', '0.7.2')) $add .= ',`login_failures`,UNIX_TIMESTAMP(`last_failure`) AS `last_failure`';
+       if (isExtensionInstalledAndNewer('admins', '0.7.3')) $add .= ',`expert_settings`,`expert_warning`';
 
        // Return it
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Done!');
index 7885108fd2e4f0f0e1e966cb5e3334ca5441c48c..becc231d6bb8ac81e4d037009b5e5625b95248f6 100644 (file)
@@ -2185,13 +2185,16 @@ function makeZeroToNull ($number) {
        return $number;
 }
 
-// Converts NULL into number zero
+// Converts a NULL to zero
 function makeNullToZero ($number) {
-       // Is this a NULL?
-       if ((is_null($number)) || (empty($number))) {
-               // Simply set it
+       // Is it a valid username?
+       if ((!is_null($number)) && (!empty($number)) && ($number > 0)) {
+               // Always secure it
+               $number = bigintval($number);
+       } else {
+               // Is not valid or zero
                $number = '0';
-       } // END - if
+       }
 
        // Return it
        return $number;
index 31d1a4d44439aacfc74cd8455844e4bd3329fd79..27c0a104912ee3a3a3b4da0d0711f0014e1daddb 100644 (file)
@@ -337,35 +337,66 @@ function adminsEditAdminAccount ($postData) {
                $id = bigintval($id);
 
                // Get the admin's data
-               $result = SQL_QUERY_ESC("SELECT `login`,`email`,`default_acl` AS mode, `la_mode` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `login`,`email` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
                        array($id), __FUNCTION__, __LINE__);
                if ((SQL_NUMROWS($result) == 1) && ($selected == 1)) {
                        // Entry found
                        $content = SQL_FETCHARRAY($result);
-                       SQL_FREERESULT($result);
 
                        // Prepare some more data for the template
                        $content['id'] = $id;
 
                        // Shall we allow changing default ACL?
                        if ($currMode == 'allow') {
-                               // Allow chaning it
-                               $content['mode']    = generateOptionList('/ARRAY/', array('allow', 'deny'), array('{--ADMIN_ADMINS_ACCESS_MODE_ALLOW--}', '{--ADMIN_ADMINS_ACCESS_MODE_DENY--}'), $content['mode']);
+                               // Allow changing it
+                               $content['mode'] = '{%pipe,generateAdminAccessModeSelectionBox=' . $id . '%}';
                        } else {
                                // Don't allow it
                                $content['mode'] = '&nbsp;';
                        }
-                       $content['la_mode'] = generateOptionList('/ARRAY/', array('global', 'OLD', 'NEW'), array('{--ADMIN_ADMINS_LA_MODE_GLOBAL--}', '{--ADMIN_ADMINS_LA_MODE_OLD--}', '{--ADMIN_ADMINS_LA_MODE_NEW--}'), $content['la_mode']);
 
                        // Load row template and switch color
                        $OUT .= loadTemplate('admin_edit_admins_row', true, $content);
                } // END - if
+
+               // Free result
+               SQL_FREERESULT($result);
        } // END - foreach
 
        // Load template
        loadTemplate('admin_edit_admins', false, $OUT);
 }
 
+// Generate access mode selection box for given admin id
+function generateAdminAccessModeSelectionBox ($adminId = NULL) {
+       // Start the selection box
+       $OUT = '<select name="mode[' . $adminId . ']" size="1" class="form_select">';
+
+       // Add option list
+       $OUT .= generateOptionList('/ARRAY/', array('allow', 'deny'), array('{--ADMIN_ADMINS_ACCESS_MODE_ALLOW--}', '{--ADMIN_ADMINS_ACCESS_MODE_DENY--}'), getAdminDefaultAcl($adminId));
+
+       // Finish it
+       $OUT .= '</select>';
+
+       // Return content
+       return $OUT;
+}
+
+// Generate menu mode selection box for given admin it
+function generateAdminMenuModeSelectionBox ($adminId = NULL) {
+       // Start the selection box
+       $OUT = '<select name="la_mode[{%pipe,makeNullToZero=' . makeZeroToNull($adminId) . '%}]" size="1" class="form_select">';
+
+       // Add option list
+       $OUT .= generateOptionList('/ARRAY/', array('global', 'OLD', 'NEW'), array('{--ADMIN_ADMINS_LA_MODE_GLOBAL--}', '{--ADMIN_ADMINS_LA_MODE_OLD--}', '{--ADMIN_ADMINS_LA_MODE_NEW--}'), getAdminMenuMode($adminId));
+
+       // Finish it
+       $OUT .= '</select>';
+
+       // Return content
+       return $OUT;
+}
+
 // Delete given admin accounts
 function adminsDeleteAdminAccount ($postData) {
        // Check if this account is the last one which cannot be deleted...
index 546aebe01e944811ed4017f78c133e4d1a3bc9d2..14d65d059e27bea41ac2d2d196f45f970dcaa4f8 100644 (file)
@@ -400,10 +400,16 @@ ORDER BY
        }
 }
 
-// Create member selection box
-function addMemberSelectionBox ($def = 0, $add_all = false, $return = false, $none = false, $field = 'userid') {
+// Create an admin selection box
+function generateAdminSelectionBox ($adminId = NULL) {
+       // Return content
+       return $OUT;
+}
+
+// Create a member selection box
+function addMemberSelectionBox ($userid = NULL, $add_all = false, $return = false, $none = false, $field = 'userid') {
        // Output selection form with all confirmed user accounts listed
-       $result = SQL_QUERY("SELECT `userid`,`surname`,`family` FROM `{?_MYSQL_PREFIX?}_user_data` ORDER BY `userid` ASC", __FUNCTION__, __LINE__);
+       $result = SQL_QUERY('SELECT `userid`,`surname`,`family` FROM `{?_MYSQL_PREFIX?}_user_data` ORDER BY `userid` ASC', __FUNCTION__, __LINE__);
 
        // Default output
        $OUT = '';
@@ -414,7 +420,7 @@ function addMemberSelectionBox ($def = 0, $add_all = false, $return = false, $no
 
        while ($content = SQL_FETCHARRAY($result)) {
                $OUT .= '<option value="' . bigintval($content['userid']) . '"';
-               if ($def == $content['userid']) $OUT .= ' selected="selected"';
+               if ($userid == $content['userid']) $OUT .= ' selected="selected"';
                $OUT .= '>' . $content['surname'] . ' ' . $content['family'] . ' (' . bigintval($content['userid']) . ')</option>';
        } // END - while
 
@@ -424,7 +430,7 @@ function addMemberSelectionBox ($def = 0, $add_all = false, $return = false, $no
        if ($return === false) {
                // Remeber options in constant
                $content['form_selection'] = $OUT;
-               $content['what']             = getWhat();
+               $content['what']           = '{%pipe,getWhat%}';
 
                // Load template
                loadTemplate('admin_form_selection_box', false, $content);
index 990dac7dc6b66a03137c4b5159dd281f1017af12..39d7f99b38b05d000f2ccaf7f68d2d60002c7dd4 100644 (file)
@@ -47,7 +47,6 @@ if (isFormSent('edit')) {
        // Check if entires are checked
        if (ifPostContainsSelections()) {
                // Add option for events
-               $adminsList = generateOptionList('admins', 'id', 'login', '', 'email');
                $rows = '';
                foreach (postRequestElement('sel') as $template => $sel) {
                        // First of all load data from DB
@@ -59,13 +58,19 @@ if (isFormSent('edit')) {
                                // @TODO Can this be rewritten to an API function?
                                $OUT .= '<select name="admin_id[' . $content['id'] . ']" size="1" class="form_select">
 <option value="0"';
-                               if ($content['admin_id'] == '0') $OUT .= ' selected="selected"';
+                               if (is_null($content['admin_id'])) {
+                                       $OUT .= ' selected="selected"';
+                               } // END - if
                                $OUT .= '>{--ADMIN_TO_ALL_ADMINS--}</option>';
+
                                if (isExtensionActive('events')) {
                                        $OUT .= '<option value="-1"';
-                                       if ($content['admin_id'] == '-1') $OUT .= ' selected="selected"';
+                                       if ($content['admin_id'] == '-1') {
+                                               $OUT .= ' selected="selected"';
+                                       } // END - if
                                        $OUT .= '>{--ADMIN_ADMINS_TO_USER_EVENTS--}</option>';
-                               }
+                               } // END - if
+
                                $OUT .= generateOptionList('admins', 'id', 'login', $content['admin_id'], 'email');
                                $OUT .= '</select>';
 
@@ -80,7 +85,7 @@ if (isFormSent('edit')) {
                        // Prepare content
                        $content['id']            = $id;
                        $content['mail_template'] = $template;
-                       $content['admins']        = $adminsList;
+                       $content['admins']        = generateOptionList('admins', 'id', 'login', '', 'email');;
 
                        if ($adminId2 > 0) {
                                // Add form for an additional admin
index 942f33bdf004f5396dfb91fd83cc0b3d66c2046f..a6b9048e1e234b6d03b37e3e479e5afa296d1b03 100644 (file)
@@ -50,6 +50,8 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) {
                // Load data for the id
                $result = SQL_QUERY_ESC("SELECT `id`,`admin_id`,`action_menu`,`what_menu`,`access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `id`=%s LIMIT 1",
                        array(bigintval($id)), __FILE__, __LINE__);
+
+               // Load all data
                $content = SQL_FETCHARRAY($result);
 
                // Free result
@@ -61,15 +63,6 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) {
                        'admins_selection' => generateOptionList('admins', 'id', 'login', $content['admin_id'], 'default_acl'),
                        'action_selection' => adminMenuSelectionBox_DEPRECATED('action', $content['action_menu'], $content['id']),
                        'what_selection'   => adminMenuSelectionBox_DEPRECATED('what', $content['what_menu'], $content['id']),
-                       'mode_options'     => generateOptionList(
-                               '/ARRAY/',
-                               array('allow', 'deny'),
-                               array(
-                                       '{--ADMIN_ADMINS_ACCESS_MODE_ALLOW--}',
-                                       '{--ADMIN_ADMINS_ACCESS_MODE_DENY--}'
-                               ),
-                               $content['access_mode']
-                       ),
                );
 
                // Load row template
@@ -231,14 +224,6 @@ VALUES (%s,'%s','%s','%s')",
        $content['admins_selection'] = generateOptionList('admins', 'id', 'login', '', 'default_acl');
        $content['action_selection'] = adminMenuSelectionBox_DEPRECATED('action');
        $content['what_selection']   = adminMenuSelectionBox_DEPRECATED('what');
-       $content['mode_options']     = generateOptionList(
-               '/ARRAY/',
-               array('allow', 'deny'),
-               array(
-                       '{--ADMIN_ADMINS_ACCESS_MODE_ALLOW--}',
-                       '{--ADMIN_ADMINS_ACCESS_MODE_DENY--}'
-               )
-       );
 
        // Load template for adding new ACL
        loadTemplate('admin_add_admins_acl', false, $content);
index 35419355338adc3387f6e5ae719e61e8edc30cbc..8a8e3107097c2312264d057065bb92556227670c 100644 (file)
@@ -1186,7 +1186,7 @@ function getAdminEmail ($adminId) {
        return $data['email'];
 }
 
-// Get default ACL  of admin id
+// Get default ACL of admin id
 function getAdminDefaultAcl ($adminId) {
        // By default an invalid ACL value is returned
        $data['default_acl'] = 'NO-ACL';
@@ -1195,9 +1195,9 @@ function getAdminDefaultAcl ($adminId) {
        if (!isExtensionActive('sql_patches')) {
                // Not found, which is bad, so we need to allow all
                $data['default_acl'] =  'allow';
-       } elseif (isset($GLOBALS['cache_array']['admin']['def_acl'][$adminId])) {
+       } elseif (isset($GLOBALS['cache_array']['admin']['default_acl'][$adminId])) {
                // Use cache
-               $data['default_acl'] = $GLOBALS['cache_array']['admin']['def_acl'][$adminId];
+               $data['default_acl'] = $GLOBALS['cache_array']['admin']['default_acl'][$adminId];
 
                // Update cache hits
                incrementStatsEntry('cache_hits');
@@ -1212,7 +1212,7 @@ function getAdminDefaultAcl ($adminId) {
                        $data = SQL_FETCHARRAY($result_admin_id);
 
                        // Set cache
-                       $GLOBALS['cache_array']['admin']['def_acl'][$adminId] = $data['default_acl'];
+                       $GLOBALS['cache_array']['admin']['default_acl'][$adminId] = $data['default_acl'];
                }
 
                // Free result
@@ -1223,6 +1223,43 @@ function getAdminDefaultAcl ($adminId) {
        return $data['default_acl'];
 }
 
+// Get menu mode (la_mode) of admin id
+function getAdminMenuMode ($adminId) {
+       // By default an invalid mode
+       $data['la_mode'] = 'INVALID';
+
+       // Is sql_patches there and was it found in cache?
+       if (!isExtensionActive('sql_patches')) {
+               // Not found, which is bad, so we need to allow all
+               $data['la_mode'] =  'global';
+       } elseif (isset($GLOBALS['cache_array']['admin']['la_mode'][$adminId])) {
+               // Use cache
+               $data['la_mode'] = $GLOBALS['cache_array']['admin']['la_mode'][$adminId];
+
+               // Update cache hits
+               incrementStatsEntry('cache_hits');
+       } elseif (!isExtensionActive('cache')) {
+               // Load from database
+               $result_admin_id = SQL_QUERY_ESC("SELECT `la_mode` FROM `{?_MYSQL_PREFIX?}_admins` WHERE `id`=%s LIMIT 1",
+                       array(bigintval($adminId)), __FUNCTION__, __LINE__);
+
+               // Do we have an entry?
+               if (SQL_NUMROWS($result_admin_id) == 1) {
+                       // Fetch data
+                       $data = SQL_FETCHARRAY($result_admin_id);
+
+                       // Set cache
+                       $GLOBALS['cache_array']['admin']['la_mode'][$adminId] = $data['la_mode'];
+               }
+
+               // Free result
+               SQL_FREERESULT($result_admin_id);
+       }
+
+       // Return default ACL
+       return $data['la_mode'];
+}
+
 // Generates an option list from various parameters
 function generateOptionList ($table, $id, $name, $default = '', $special = '', $whereStatement = '', $disabled = array(), $callback = '') {
        $ret = '';
@@ -1257,11 +1294,11 @@ function generateOptionList ($table, $id, $name, $default = '', $special = '', $
                // Data from database
                $SPEC = ', `' . $id . '`';
                if (!empty($special)) {
-                       $SPEC = ', `' . $special . '`';
+                       $SPEC = ', `' . $special . '` AS `special`';
                } // END - if
 
                // Query the database
-               $result = SQL_QUERY_ESC("SELECT `%s`,`%s`".$SPEC." FROM `{?_MYSQL_PREFIX?}_%s` ".$whereStatement." ORDER BY `%s` ASC",
+               $result = SQL_QUERY_ESC("SELECT `%s` AS `id`,`%s` AS `name`".$SPEC." FROM `{?_MYSQL_PREFIX?}_%s` ".$whereStatement." ORDER BY `%s` ASC",
                        array(
                                $id,
                                $name,
@@ -1271,32 +1308,37 @@ function generateOptionList ($table, $id, $name, $default = '', $special = '', $
 
                // Do we have rows?
                if (!SQL_HASZERONUMS($result)) {
-                       // Found data so add them as OPTION lines: $id is the value and $name is the "name" of the option
-                       // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-                       while (list($value, $title, $add) = SQL_FETCHROW($result)) {
-                               if (empty($special)) $add = '';
-                               $ret .= '<option value="' . $value . '"';
-                               if ($default == $value) {
+                       // Found data so add them as OPTION lines
+                       while ($content = SQL_FETCHARRAY($result)) {
+                               // Is special set?
+                               if (!isset($content['special'])) {
+                                       // Set it to empty
+                                       $content['special'] = '';
+                               } // END - if
+
+                               $ret .= '<option value="' . $content['id'] . '"';
+
+                               if ($default == $content['id']) {
                                        // Selected by default
                                        $ret .= ' selected="selected"';
-                               } elseif (isset($disabled[$value])) {
+                               } elseif (isset($disabled[$content['id']])) {
                                        // Disabled!
                                        $ret .= ' disabled="disabled"';
                                }
 
                                // Add it, if set
-                               if (!empty($add)) {
-                                       $add = ' ('.$add.')';
+                               if (!empty($content['special'])) {
+                                       $content['special'] = ' (' . $content['special'] . ')';
                                } // END - if
 
                                // Is the call-back function set?
                                if (!empty($callback)) {
                                        // Call it
-                                       $title = call_user_func_array($callback, array($title));
+                                       $content['name'] = call_user_func_array($callback, array($content['name']));
                                } // END - if
 
                                // Finish option list
-                               $ret .= '>' . $title . $add . '</option>';
+                               $ret .= '>' . $content['name'] . $content['special'] . '</option>';
                        } // END - while
                } else {
                        // No data found
index 6b388f103c39cb7ab71df2bfcc8f887e1e7a7bf1..2200018423c7552a3c049cb73677f2ecaf22b3e8 100644 (file)
@@ -25,9 +25,7 @@
        <tr>
                <td class="bottom" align="right">{--ADMIN_ADMINS_SELECT_MODE--}:</td>
                <td class="bottom">
-                       <select name="mode" size="1" class="form_select">
-                               $content[mode_options]
-                       </select>
+                       {%pipe,generateAdminAccessModeSelectionBox%}
                </td>
        </tr>
        <tr>
index fd9937d09876e3363c5057f9374b5dafbb51cc8d..05d6b9c592570440eba911f36f0101045f73ff12 100644 (file)
@@ -1,5 +1,5 @@
 <div align="center">
-<form accept-charset="UTF-8" action="{%url=modules.php?module=admin&amp;what=config_proxy%}" method="post">
+<form accept-charset="UTF-8" action="{%url=modules.php?module=admin&amp;what=config_session%}" method="post">
 <table border="0" cellspacing="0" cellpadding="0" class="table dashed">
        <tr>
                <td colspan="2" align="center" class="table_header bottom">
index 59f18b7c81b954a74a703847cb3370554e2a662e..fdbc273f55dfcb106fd006dc8000bedbcea259b7 100644 (file)
@@ -15,8 +15,6 @@
                $content[what_selection]
        </td>
        <td class="{%template,ColorSwitch%} bottom" align="center">
-               <select name="mode[$content[id]]" size="1" class="form_select">
-                       $content[mode_options]
-               </select>
+               {%pipe,generateAdminAccessModeSelectionBox=$content[id]%}
        </td>
 </tr>
index c53a5e65e593bb9cc7e68e2614fcc08ea3bbc520..e333f9baa22313775a9e9b240158ff2d6b56f259 100644 (file)
                <input type="password" class="form_field" name="pass1[$content[id]]" size="10" maxlength="255" />
                <input type="password" class="form_field" name="pass2[$content[id]]" size="10" maxlength="255" />
        </td>
-       <td align="center" class="{%template,ColorSwitch%} bottom">
-               <select name="mode[$content[id]]" size="1" class="form_select">
-                       $content[mode]
-               </select>
+       <td align="center" class="{%template,ColorSwitch%} bottom right">
+               $content[mode]
        </td>
        <td align="center" class="{%template,ColorSwitch%} bottom">
-               <select name="la_mode[$content[id]]" size="1" class="form_select">
-                       $content[la_mode]
-               </select>
+               {%pipe,generateAdminMenuModeSelectionBox=$content[id]%}
        </td>
 </tr>