Performance hacks, encapsulation and more EL code usage:
authorRoland Häder <roland@mxchange.org>
Tue, 14 Dec 2010 06:10:00 +0000 (06:10 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 14 Dec 2010 06:10:00 +0000 (06:10 +0000)
- Performance hack in SQL_QUERY() to save some expensive str_replace() and other
  function calls
- Encapsulation of admin session data
- Some more usage of EL code in admin welcome templates
- TODOs.txt updated

17 files changed:
DOCS/TODOs.txt
inc/db/lib-mysql3.php
inc/extensions/ext-admins.php
inc/filters.php
inc/libs/admins_functions.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_admins.php
inc/modules/admin/what-list_rallyes.php
inc/modules/admin/what-list_unconfirmed.php
inc/mysql-manager.php
inc/pool/pool-bonus.php
inc/session-functions.php
inc/template-functions.php
inc/wrapper-functions.php
templates/de/html/admin/admin_welcome.tpl
templates/de/html/admin/admin_welcome_admins.tpl

index cdaf36a..f293a25 100644 (file)
@@ -59,7 +59,7 @@
 ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings             *
 ./inc/language/refback_de.php:44:// @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:433:           // @TODO This can be, somehow, rewritten
+./inc/libs/admins_functions.php:435:           // @TODO This can be, somehow, rewritten
 ./inc/libs/beg_functions.php:55:               // @TODO Try to rewrite the following unset()
 ./inc/libs/bonus_functions.php:199:            // @TODO Move this HTML to a template
 ./inc/libs/bonus_functions.php:287:            // @TODO This query isn't right, it will only update if the user was for a longer time away!
 ./inc/loader/load_cache-extension.php:13: * @TODO Rewrite this whole file to load_cache-extensions.php           *
 ./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:262:         // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/modules/admin/admin-inc.php:267:                         // @TODO ACL is 'allow'... hmmm
-./inc/modules/admin/admin-inc.php:333:                                 // @TODO Rewrite this to $content = SQL_FETCHARRAY()
-./inc/modules/admin/admin-inc.php:339:                                                 // @TODO ACL is 'allow'... hmmm
-./inc/modules/admin/admin-inc.php:439:// @TODO Try to rewrite this to adminAddMenuSelectionBox()
+./inc/modules/admin/admin-inc.php:170:         // @TODO This and the next getCurrentAdminId() call might be moved into the templates?
+./inc/modules/admin/admin-inc.php:259:         // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/modules/admin/admin-inc.php:264:                         // @TODO ACL is 'allow'... hmmm
+./inc/modules/admin/admin-inc.php:330:                                 // @TODO Rewrite this to $content = SQL_FETCHARRAY()
+./inc/modules/admin/admin-inc.php:336:                                                 // @TODO ACL is 'allow'... hmmm
+./inc/modules/admin/admin-inc.php:436:// @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-list_links.php:85:                            // @TODO Find a way to rewrite this. See some lines above for different queries
 ./inc/modules/admin/what-list_links.php:94:                                    // @TODO Rewrite this to includes/filter
 ./inc/modules/admin/what-list_refs.php:107:                                                            // @TODO Try to rewrite some to EL
-./inc/modules/admin/what-list_unconfirmed.php:77:      // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
-./inc/modules/admin/what-list_unconfirmed.php:96:      // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
+./inc/modules/admin/what-list_unconfirmed.php:80:      // @TODO This constant might be unused? define('__LIST_UNCON_TITLE', '{--ADMIN_LIST_UNCONFIRMED_BONUS_LINKS--}');
+./inc/modules/admin/what-list_unconfirmed.php:99:      // @TODO "Please do not call me directly." Should be rewritten to a nice selection depending on ext-bonus
 ./inc/modules/admin/what-list_user.php:149:            // @TODO Rewrite these to filters
 ./inc/modules/admin/what-list_user.php:255:            // @TODO Rewrite this into a filter
 ./inc/modules/admin/what-list_user.php:295:                    // @TODO Rewrite this into a filter
 ./inc/modules/order.php:74:            // @TODO Unused: 2,4
 ./inc/monthly/monthly_bonus.php:67:    // @TODO Rewrite this to a filter
 ./inc/mysql-manager.php:1183:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1438:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1544:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1915:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1959:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1441:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1547:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1918:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1962:// @TODO Fix inconsistency between last_module and getWhat()
 ./inc/mysql-manager.php:368:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:52:// @TODO This should be converted in a daily beg rallye
 ./inc/reset/reset_birthday.php:92:                     // @TODO 4 is hard-coded here, should we move it out in config?
 ./inc/revision-functions.php:169:// @TODO This function does also set and get in 'cache_array'
-./inc/template-functions.php:1041:                     // @TODO Deprecate this thing
-./inc/template-functions.php:1052:                     // @TODO Deprecate this thing
-./inc/template-functions.php:1139:     // @TODO This can be easily moved out after the merge from EL branch to this is complete
-./inc/template-functions.php:1172:             // @TODO Add a little more infos here
-./inc/template-functions.php:1460:// @TODO Lame description for this function
-./inc/template-functions.php:1482:                     // @TODO Move this in a filter
-./inc/template-functions.php:187:       * @TODO On some pages this is buggy
-./inc/template-functions.php:263:      // @TODO Remove this sanity-check if all is fine
-./inc/template-functions.php:576:// @TODO $simple/$constants are deprecated
-./inc/template-functions.php:600:      // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
+./inc/template-functions.php:1043:                     // @TODO Deprecate this thing
+./inc/template-functions.php:1054:                     // @TODO Deprecate this thing
+./inc/template-functions.php:1141:     // @TODO This can be easily moved out after the merge from EL branch to this is complete
+./inc/template-functions.php:1174:             // @TODO Add a little more infos here
+./inc/template-functions.php:1462:// @TODO Lame description for this function
+./inc/template-functions.php:1484:                     // @TODO Move this in a filter
+./inc/template-functions.php:189:       * @TODO On some pages this is buggy
+./inc/template-functions.php:265:      // @TODO Remove this sanity-check if all is fine
+./inc/template-functions.php:578:// @TODO $simple/$constants are deprecated
+./inc/template-functions.php:602:      // @TODO Do only use $content and deprecate $GLOBALS and $DATA in templates
 ./inc/wrapper-functions.php:130:// @TODO Implement $compress
 ./inc/wrapper-functions.php:137:// @TODO Implement $decompress
 ./inc/wrapper-functions.php:452:// @TODO Do some more sanity check here
 ./templates/de/html/member/member_unconfirmed_table_nopoints.tpl:11:           <!-- @TODO Nothing to say here? //-->
 ./templates/de/html/surfbar/surfbar_frame_textlinks.tpl:5:             <!-- @TODO These are static lines and should be replaced by a filter (see ext-sponsor) //-->
 ### ### DEPRECATION FOLLOWS: ### ###
-./inc/modules/admin/admin-inc.php:440:// @DEPRECATED
+./inc/modules/admin/admin-inc.php:437:// @DEPRECATED
 ### ### template-warnings.log follows: ### ###
 Warning: Not parsing JavaScript templates/de/html/js/js_order_send.tpl.
 Warning: Not parsing JavaScript templates/de/html/js/js_cookies_disabled.tpl.
index 7f1d99d..e982d87 100644 (file)
@@ -42,36 +42,42 @@ if (!defined('__SECURITY')) {
 
 // SQL queries
 function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) {
-       // Trim SQL string
-       $sqlString = trim($sqlString);
-
-       // Link is up?
-       if (!SQL_IS_LINK_UP()) {
-               // We should not quietly ignore this!
-               debug_report_bug(__FUNCTION__, __LINE__, sprintf("Cannot query database: sqlString=%s,file=%s,line=%s",
-                       $sqlString,
-                       basename($F),
-                       $L
-               ));
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__][$sqlString])) {
+               // Trim SQL string
+               $sqlStringModified = trim($sqlString);
+
+               // Empty query string or link is not up?
+               if (empty($sqlStringModified)) {
+                       // Empty SQL string!
+                       debug_report_bug(__FUNCTION__, __LINE__, sprintf("SQL string is empty. Please fix this. file=%s, line=%s",
+                               basename($F),
+                               $L
+                       ));
+               } elseif (!SQL_IS_LINK_UP()) {
+                       // We should not quietly ignore this
+                       debug_report_bug(__FUNCTION__, __LINE__, sprintf("Cannot query database: sqlString=%s,file=%s,line=%s",
+                               $sqlStringModified,
+                               basename($F),
+                               $L
+                       ));
+               }
 
-               // Return 'false' because it has failed
-               return false;
-       } elseif (empty($sqlString)) {
-               // Empty SQL string!
-               debug_report_bug(__FUNCTION__, __LINE__, sprintf("SQL string is empty. Please fix this. file=%s, line=%s",
-                       basename($F),
-                       $L
-               ));
+               // Remove \t, \n and \r from queries they may confuse some MySQL versions
+               $sqlStringModified = str_replace("\t", ' ', str_replace("\n", ' ', str_replace("\r", ' ', $sqlStringModified)));
 
-               // This is invalid, of course
-               return false;
-       }
+               // Compile config entries out
+               $sqlStringModified = SQL_PREPARE_SQL_STRING($sqlStringModified, $enableCodes);
 
-       // Remove \t, \n and \r from queries they may confuse some MySQL versions
-       $sqlString = str_replace("\t", ' ', str_replace("\n", ' ', str_replace("\r", ' ', $sqlString)));
+               // Cache it and remember as last SQL query
+               $GLOBALS[__FUNCTION__][$sqlString] = $sqlStringModified;
+               $GLOBALS['last_sql'] = $sqlStringModified;
+       }  else {
+               //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Cache used!');
 
-       // Compile config entries out
-       $GLOBALS['last_sql'] = SQL_PREPARE_SQL_STRING($sqlString, $enableCodes);
+               // Use cache (to save a lot function calls
+               $sqlString = $GLOBALS[__FUNCTION__][$sqlString];
+       }
 
        // Starting time
        $querytimeBefore = microtime(true);
index dc8c2a6..510ebf7 100644 (file)
@@ -101,7 +101,7 @@ switch (getExtensionMode()) {
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_admins` ADD default_acl ENUM('deny','allow') NOT NULL DEFAULT 'deny'");
 
                                // But allow current admin everything (THIS SHALL BE YOU!)
-                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `default_acl`='allow' WHERE `id`=".bigintval(getSession('admin_id'))." LIMIT 1");
+                               addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_admins` SET `default_acl`='allow' WHERE `id`=".bigintval(getCurrentAdminId())." LIMIT 1");
                                addExtensionSql('DROP TABLE IF EXISTS `{?_MYSQL_PREFIX?}_admins_acls`');
                                addExtensionSql("CREATE TABLE `{?_MYSQL_PREFIX?}_admins_acls` (
 `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
index c079bd6..a75f8dd 100644 (file)
@@ -959,11 +959,11 @@ LIMIT 1",
 function FILTER_DO_LOGIN_ADMIN ($data) {
        // Now set all session variables and store the result for later processing
        $GLOBALS['admin_login_success'] = ((
-               setSession('admin_md5', encodeHashForCookie($data['pass_hash']))
+               setAdminMd5(encodeHashForCookie($data['pass_hash']))
        ) && (
-               setSession('admin_id', $data['id'])
+               setAdminId($data['id'])
        ) && (
-               setSession('admin_last', time())
+               setAdminLast(time())
        ));
 
        // Return the data for further processing
index 2f084b8..3e650a1 100644 (file)
@@ -187,17 +187,19 @@ function adminsChangeAdminAccount ($postData, $element = '') {
                                // Rewrite cookie when it's own account
                                if ($adminId == $id) {
                                        // Set timeout cookie
-                                       setSession('admin_last', time());
+                                       setAdminLast(time());
 
-                                       if ($adminId != getSession('admin_id')) {
+                                       if ($adminId != getCurrentAdminId()) {
                                                // Update login cookie
-                                               setSession('admin_id', $adminId);
+                                               setAdminId($adminId);
 
                                                // Update password cookie as well?
-                                               if (!empty($add)) setSession('admin_md5', $hash);
-                                       } elseif (generateHash($postData['pass1'][$id], $salt) != getSession('admin_md5')) {
+                                               if (!empty($add)) {
+                                                       setAdminMd5($hash);
+                                               } // END - if
+                                       } elseif (generateHash($postData['pass1'][$id], $salt) != getAdminMd5()) {
                                                // Update password cookie
-                                               setSession('admin_md5', $hash);
+                                               setAdminMd5($hash);
                                        }
                                } // END - if
 
@@ -689,7 +691,7 @@ function FILTER_REHASH_ADMINS_PASSWORD ($data) {
        adminsChangeAdminAccount($postData);
 
        // Update cookie/session and data array
-       setSession('admin_md5', encodeHashForCookie($newHash));
+       setAdminMd5(encodeHashForCookie($newHash));
        $data['pass_hash'] = $newHash;
 
        // Always make sure the cache is destroyed
index 63334d6..284e3dd 100644 (file)
@@ -354,7 +354,7 @@ if (!isAdminRegistered()) {
        }
 } else {
        // Maybe an Admin want's to login?
-       $ret = ifAdminCookiesAreValid(getSession('admin_id'), getSession('admin_md5'));
+       $ret = ifAdminCookiesAreValid(getCurrentAdminId(), getAdminMd5());
 
        // Check status
        switch ($ret) {
@@ -384,7 +384,7 @@ if (!isAdminRegistered()) {
 
                case '404': // Administrator login not found
                        setPostRequestParameter('ok', $ret);
-                       loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_ACCOUNT_404', getSession('admin_id')));
+                       loadTemplate('admin_settings_saved', false, getMaskedMessage('ADMIN_ACCOUNT_404', getCurrentAdminId()));
                        destroyAdminSession();
                        break;
 
index 78d2469..bce95ac 100644 (file)
@@ -165,15 +165,12 @@ function doAdminAction () {
        // Get action value
        $action = getActionFromModuleWhat(getModule(), $what);
 
-       // Define admin login name and id number
-       $content['login'] = getAdminLogin(getSession('admin_id'));
-       $content['id']    = getCurrentAdminId();
-
-       // Preload templates
+       // Load welcome template
        if (isExtensionActive('admins')) {
-               $content['welcome'] = loadTemplate('admin_welcome_admins', true, $content);
+               // @TODO This and the next getCurrentAdminId() call might be moved into the templates?
+               $content['welcome'] = loadTemplate('admin_welcome_admins', true, getCurrentAdminId());
        } else {
-               $content['welcome'] = loadTemplate('admin_welcome', true, $content);
+               $content['welcome'] = loadTemplate('admin_welcome', true, getCurrentAdminId());
        }
 
        // Load header, footer, render menu
@@ -1312,7 +1309,7 @@ function doVerifyExpertSettings () {
                                        // Is the element set, then we need to change the admin
                                        if (isPostRequestParameterSet('expert_settings')) {
                                                // Get it and prepare final post data array
-                                               $postData['login'][getCurrentAdminId()] = getAdminLogin(getCurrentAdminId());
+                                               $postData['login'][getCurrentAdminId()] = getCurrentAdminLogin();
                                                $postData['expert_warning'][getCurrentAdminId()] = 'N';
 
                                                // Change it in the admin
index 48a768b..3599a1a 100644 (file)
@@ -153,7 +153,11 @@ if ((isFormSent('edit')) && (ifPostContainsSelections())) {
                if (((isPostRequestParameterSet('action_menu')) || (isPostRequestParameterSet('what_menu'))) && ($BOTH === false)) {
                        // Main or sub menu selected
                        $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `admin_id`=%s AND `action_menu`='%s' AND `what_menu`='%s' LIMIT 1",
-                               array(bigintval(postRequestParameter('admin_id')), postRequestParameter('action_menu'), postRequestParameter('what_menu')), __FILE__, __LINE__);
+                               array(
+                                       bigintval(postRequestParameter('admin_id')),
+                                       postRequestParameter('action_menu'),
+                                       postRequestParameter('what_menu')
+                               ), __FILE__, __LINE__);
                        if (SQL_HASZERONUMS($result)) {
                                // Finally add the new ACL
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_acls` (`admin_id`, `action_menu`, `what_menu`, `access_mode`)
index e796598..fda9a05 100644 (file)
@@ -300,9 +300,6 @@ ORDER BY
                // List found rallyes
                $OUT = '';
                while ($data = SQL_FETCHARRAY($result)) {
-                       // Load admin login
-                       $data['login'] = getAdminLogin($data['admin_id']);
-
                        // Count joined userids
                        $users = countSumTotalData($data['id'], 'rallye_users', 'id', 'rallye_id', true);
 
@@ -312,14 +309,10 @@ ORDER BY
                                $users = '<a href="{%url=modules.php?module=admin&amp;what=list_rallyes&amp;sub=users&amp;rallye=' . $data['id'] . '%}" title="{--RALLYE_LIST_USERS_TITLE--}">' . $users . '</a>';
                        } // END - if
 
-                       // Alter some variables
-                       if (empty($data['login']))    $data['login']     = '???';
-
                        // Transfer data into array for the template
                        $row = array(
                                'select'            => '<input type="checkbox" name="sel[' . $data['id'] . ']" class="form_field" value="1" />',
                                'admin_id'          => $data['admin_id'],
-                               'login'             => $data['login'],
                                'id'                => $data['id'],
                                'title'             => $data['title'],
                                'template'          => $data['template'],
index a68fe3b..2d57bc6 100644 (file)
@@ -51,6 +51,9 @@ if (!isExtensionActive('mailid')) {
 // Don't load the admin_list_unconfirmed template by default
 $listed = false;
 
+// Init query
+$sql = '';
+
 // List confirmation links from normal or bonus mails
 if (isGetRequestParameterSet('mid')) {
        // SQL query for mail data
@@ -98,7 +101,7 @@ LIMIT 1",
 }
 
 // Shall I display links or not?
-if ($listed === true) {
+if (($listed === true) && (!empty($sql))) {
        // Load mail data
        $result_master = SQL_QUERY($sql, __FILE__, __LINE__);
 
index 6a20170..bf1a9ba 100644 (file)
@@ -522,8 +522,8 @@ function isAdmin () {
        // If admin login is not given take current from cookies...
        if ((isSessionVariableSet('admin_id')) && (isSessionVariableSet('admin_md5'))) {
                // Get admin login and password from session/cookies
-               $adminId    = getSession('admin_id');
-               $passCookie = getSession('admin_md5');
+               $adminId    = getCurrentAdminId();
+               $passCookie = getAdminMd5();
        } // END - if
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $adminId.'/'.$passCookie);
 
@@ -1235,6 +1235,9 @@ function getAdminId ($adminLogin) {
 
 // "Getter" for current admin id
 function getCurrentAdminId () {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!');
+
        // Do we have cache?
        if (!isset($GLOBALS['current_admin_id'])) {
                // Get the admin login from session
index 5d36781..dc07cfd 100644 (file)
@@ -38,7 +38,7 @@
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
+} // END - if
 
 // Don't run on daily reset
 if (isResetModeEnabled()) {
index 226cad9..71f67ca 100644 (file)
@@ -117,12 +117,12 @@ function destroyMemberSession () {
 // Destroys the admin session
 function destroyAdminSession ($destroy = true) {
        // Kill maybe existing session variables including array elements
-       setSession('admin_id'  , '');
-       setSession('admin_md5' , '');
-       setSession('admin_last', '');
+       setAdminId('');
+       setAdminMd5('');
+       setAdminLast('');
 
-       // Destroy session and return status
-       if ($destroy) {
+       // Destroy session if requested and return status
+       if ($destroy === true) {
                return session_destroy();
        } // END - if
 
index c4d47e6..f5f1c25 100644 (file)
@@ -74,7 +74,9 @@ function fixEmptyContentToDashes ($str) {
        $str = trim($str);
 
        // Is the string empty?
-       if (empty($str)) $str = '---';
+       if (empty($str)) {
+               $str = '---';
+       } // END - if
 
        // Return string
        return $str;
@@ -279,7 +281,7 @@ function loadTemplate ($template, $return = false, $content = array()) {
 
                // Base directory
                $basePath = sprintf("%stemplates/%s/html/", getPath(), getLanguage());
-               $extraPath = detectExtraTemplatePath($template);;
+               $extraPath = detectExtraTemplatePath($template);
 
                // Generate FQFN
                $FQFN = $basePath . $extraPath . $template . '.tpl';
index 4bfcad2..4a6e0e0 100644 (file)
@@ -771,7 +771,7 @@ function isDemoModeActive () {
        // Is cache set?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Simply check it
-               $GLOBALS[__FUNCTION__] = ((isExtensionActive('demo')) && (getAdminLogin(getSession('admin_id')) == 'demo'));
+               $GLOBALS[__FUNCTION__] = ((isExtensionActive('demo')) && (getCurrentAdminLogin() == 'demo'));
        } // END - if
 
        // Return it
@@ -800,6 +800,69 @@ function setAdminHash ($adminId, $hash) {
        $GLOBALS['cache_array']['admin']['password'][$adminId] = $hash;
 }
 
+// Getter for current admin login
+function getCurrentAdminLogin () {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!');
+
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getAdminLogin(getCurrentAdminId());
+       } // END - if
+
+       // Return it
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Setter for admin id (and current)
+function setAdminId ($adminId) {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminId=' . $adminId);
+
+       // Set session
+       $status = setSession('admin_id', bigintval($adminId));
+
+       // Set current id
+       setCurrentAdminId($adminId);
+
+       // Return status
+       return $status;
+}
+
+// Setter for admin_last
+function setAdminLast ($adminLast) {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLast=' . $adminLast);
+
+       // Set session
+       $status = setSession('admin_last', $adminLast);
+
+       // Return status
+       return $status;
+}
+
+// Setter for admin_md5
+function setAdminMd5 ($adminMd5) {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminMd5=' . $adminMd5);
+
+       // Set session
+       $status = setSession('admin_md5', $adminMd5);
+
+       // Return status
+       return $status;
+}
+
+// Getter for admin_md5
+function getAdminMd5 () {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!');
+
+       // Get session
+       return getSession('admin_md5');
+}
+
 // Init user data array
 function initUserData () {
        // User id should not be zero
index e9914b7..205290a 100644 (file)
@@ -8,7 +8,7 @@
                </td>
                <td align="center" width="300" class="dashed tiny">
                        Aktueller Admin:
-                       [<span class="notice tiny" title="Erweiterung admins nicht installiert.">$content[login]</span>]
+                       [<span class="notice tiny" title="Erweiterung admins nicht installiert.">{%pipe,getAdminLogin=$content[id]%}</span>]
                </td>
                <td class="logout_box top bottom right" align="center" width="100">
                        <a class="logout_box tiny" href="{%url=modules.php?module=admin&amp;action=logout%}">Ausloggen</a>
index f52cc61..177f919 100644 (file)
@@ -8,7 +8,7 @@
                </td>
                <td align="center" width="300" class="dashed tiny">
                        Aktueller Admin:
-                       [<a class="tiny" href="{%url=modules.php?module=admin&amp;what=admins_edit&amp;admin=$content[id]%}"><strong>$content[login]</strong></a>]
+                       [<a class="tiny" href="{%url=modules.php?module=admin&amp;what=admins_edit&amp;admin=$content%}"><strong>{%pipe,getAdminLogin=$content%}</strong></a>]
                </td>
                <td align="center" width="100" class="logout_box top bottom right">
                        <a class="logout_box tiny" href="{%url=modules.php?module=admin&amp;action=logout%}">Ausloggen</a>