]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Extension ext-sql_patches continued:
[mailer.git] / inc / modules / admin / admin-inc.php
index 7e4e709c95d1b5a613bc474537a19e499fb8d194..a6a660a17cb99cbbdc8a17f4db88ead94777ed0b 100644 (file)
@@ -442,6 +442,15 @@ ORDER BY
 
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
+               // Default is none
+               $content['default'] = '';
+
+               // Is the id the same?
+               if ($content['id'] == $adminId) {
+                       // Set this as default
+                       $content['default'] = ' selected="selected"';
+               } // END - if
+
                // Add the entry
                $OUT .= loadTemplate('select_admins_option', TRUE, $content);
        } // END - if
@@ -559,6 +568,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
        $skip = FALSE;
 
        // Now, walk through all entries and prepare them for saving
+       //* BUG: */ reportBug(__FUNCTION__, __LINE__, '<pre>'.print_r(postRequestArray(), TRUE).'</pre>');
        foreach ($postData as $id => $val) {
                // Process only formular field but not submit buttons ;)
                if ($id == 'ok') {
@@ -577,8 +587,13 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
                                $val = convertCommaToDot($val);
                        } // END - if
 
-                       // Shall we add numbers or strings?
+                       // Test value on float
                        $test = (float) $val;
+
+                       // Debug message
+                       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'test=' . $test . ',val=' . $val . ',id=' . $id);
+
+                       // Shall we add numbers or strings?
                        if ('' . $val . '' == '' . $test . '') {
                                // Add numbers
                                array_push($tableData, sprintf("`%s`=%s", $id, $test));
@@ -630,7 +645,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
 
                // Add both in one line
                $keys   = implode('`, `', $keys);
-               $values = implode(', ' , $values);
+               $values = implode(', '  , $values);
 
                // Generate SQL string
                $sql = sprintf("INSERT INTO `{?_MYSQL_PREFIX?}%s` (%s) VALUES (%s)",
@@ -653,7 +668,10 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
        rebuildCache('config', 'config');
 
        // Settings saved, so display message?
-       if ($displayMessage === TRUE) displayMessage('{--SETTINGS_SAVED--}');
+       if ($displayMessage === TRUE) {
+               // Display a message
+               displayMessage('{--SETTINGS_SAVED--}');
+       } // END - if
 
        // Return affected rows
        return $affected;
@@ -714,8 +732,8 @@ function generateUserProfileLink ($userid, $title = '', $what = '') {
 
                // Is what set?
                if (empty($what)) {
-                       // Then get it
-                       $what = getWhat();
+                       // Then get it to 'list_user'
+                       $what = 'list_user';
                } // END - if
 
                if (($title == '0') && ($what == 'list_refs')) {
@@ -748,7 +766,7 @@ function adminGetMenuMode () {
        // Set the default menu mode as the mode for all admins
        $mode = 'global';
 
-       // If sql_patches is up-to-date enough, use the configuration
+       // If ext-sql_patches is up-to-date enough, use the configuration
        if (isExtensionInstalledAndNewer('sql_patches', '0.3.2')) {
                $mode = getAdminMenu();
        } // END - if
@@ -1067,6 +1085,12 @@ function adminUndeleteEntriesConfirm ($tableName, $columns = array(), $filterFun
 
 // Adds a given entry to the database
 function adminAddEntries ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $columnIndex = NULL) {
+       // Is the userid set?
+       if (!isPostRequestElementSet('userid')) {
+               // Then set NULL here
+               setPostRequestElement('userid', NULL);
+       } // END - if
+
        // Call inner function
        doGenericAddEntries($tableName, $columns, $filterFunctions, $extraValues, $timeColumns, $columnIndex);
 
@@ -1163,7 +1187,7 @@ function adminResetValidateHashLogin ($hash, $login) {
 
 // Reset the password for the login. Do NOT call this function without calling above function first!
 function doResetAdminPassword ($login, $password) {
-       // Generate hash (we already check for sql_patches in generateHash())
+       // Generate hash (we already check for ext-sql_patches in generateHash())
        $passHash = generateHash($password);
 
        // Prepare fake POST data