]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/admin-inc.php
Was missing :(
[mailer.git] / inc / modules / admin / admin-inc.php
index 860301125b7522138f9a0cc3320a303c37177bf2..505bcc0f82e90b90a9bd1a9ae52b4d4f9834a475 100644 (file)
@@ -133,12 +133,15 @@ function ifAdminCookiesAreValid ($adminLogin, $passHash) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash);
 
                // If they both match, the login data is valid
-               if ($testHash == $passHash) {
+               if ($testHash != $passHash) {
+                       // Passwords don't match
+                       $ret = 'password';
+               } elseif (!isAdmin()) {
+                       // Is not valid session
+                       $ret = 'session';
+               } else {
                        // All fine
                        $ret = 'done';
-               } else {
-                       // Set status
-                       $ret = 'password';
                }
        } // END - if
 
@@ -442,6 +445,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
@@ -483,7 +495,7 @@ ORDER BY
        while ($content = SQL_FETCHARRAY($result)) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . intval($userid) . '/' . $content['userid']);
                $OUT .= '<option value="' . bigintval($content['userid']) . '"';
-               if (bigintval($userid) === bigintval($content['userid'])) {
+               if (bigintval($userid, FALSE, FALSE) === bigintval($content['userid'])) {
                        $OUT .= ' selected="selected"';
                } // END - if
                $OUT .= '>' . $content['surname'] . ' ' . $content['family'] . ' (' . bigintval($content['userid']) . ')</option>';
@@ -559,10 +571,10 @@ 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>');
+       //* 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') {
+               if ($id =='save_config') {
                        // Skip this button
                        continue;
                } // END - if
@@ -723,8 +735,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')) {
@@ -853,9 +865,10 @@ function adminChangeActivationStatus ($IDs, $table, $row, $idRow = 'id') {
 }
 
 // Build a special template list
-function adminListBuilder ($listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid')) {
+// @TODO cacheFiles is not yet supported
+function adminListBuilder ($listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId = array('userid'), $content = array()) {
        // Call inner (general) function
-       doGenericListBuilder('admin', $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId);
+       doGenericListBuilder('admin', $listType, $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId, $content);
 }
 
 // Change status of "build" list
@@ -955,7 +968,7 @@ function adminBuilderStatusHandler ($mode, $tableName, $columns, $filterFunction
 }
 
 // Delete rows by given id numbers
-function adminDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $deleteNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array()) {
+function adminDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $deleteNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array(), $content = array()) {
        // $tableName must be an array
        if ((!is_array($tableName)) || (count($tableName) != 1)) {
                // No tableName specified
@@ -986,12 +999,12 @@ function adminDeleteEntriesConfirm ($tableName, $columns = array(), $filterFunct
                }
        } else {
                // List for deletion confirmation
-               adminListBuilder('delete', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+               adminListBuilder('delete', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId, $content);
        }
 }
 
 // Edit rows by given id numbers
-function adminEditEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $editNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array()) {
+function adminEditEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $timeColumns = array(), $editNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid'), $rawUserId = array('userid'), $cacheFiles = array(), $content = array()) {
        // $tableName must be an array
        if ((!is_array($tableName)) || (count($tableName) != 1)) {
                // No tableName specified
@@ -1022,11 +1035,12 @@ function adminEditEntriesConfirm ($tableName, $columns = array(), $filterFunctio
                }
        } else {
                // List for editing
-               adminListBuilder('edit', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn);
+               adminListBuilder('edit', $tableName, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $rawUserId, $content);
        }
 }
 
 // Un-/lock rows by given id numbers
+// @TODO rawUserId/content is not yet supported
 function adminLockEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $statusArray = array(), $lockNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid')) {
        // $tableName must be an array
        if ((!is_array($tableName)) || (count($tableName) != 1)) {
@@ -1051,6 +1065,7 @@ function adminLockEntriesConfirm ($tableName, $columns = array(), $filterFunctio
 }
 
 // Undelete rows by given id numbers
+// @TODO rawUserId/cacheFiles/content is not yet supported
 function adminUndeleteEntriesConfirm ($tableName, $columns = array(), $filterFunctions = array(), $extraValues = array(), $statusArray = array(), $undeleteNow = array(FALSE), $idColumn = array('id'), $userIdColumn = array('userid')) {
        // $tableName must be an array
        if ((!is_array($tableName)) || (count($tableName) != 1)) {