Heacy rewrite/cleanup:
[mailer.git] / inc / modules / admin / admin-inc.php
index b4f8ff20fabe14962fd67408d8124629cb4450d0..9360b73c8ae581708cb69e5f1327a36f3c1fa0d0 100644 (file)
@@ -42,6 +42,9 @@ if (!defined('__SECURITY')) {
 
 // Register an administrator account
 function addAdminAccount ($adminLogin, $passHash, $adminEmail, $accessLevel = 'deny') {
+       // Only let valid data pass
+       assert(in_array($accessLevel, array('allow', 'deny')));
+
        // Login does already exist
        $ret = 'already';
 
@@ -507,10 +510,10 @@ ORDER BY
        while ($content = sqlFetchArray($result)) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . intval($userid) . '/' . $content['userid']);
                $OUT .= '<option value="' . bigintval($content['userid']) . '"';
-               if (bigintval($userid, FALSE, FALSE) === bigintval($content['userid'])) {
+               if ($userid === $content['userid']) {
                        $OUT .= ' selected="selected"';
                } // END - if
-               $OUT .= '>' . $content['surname'] . ' ' . $content['family'] . ' (' . bigintval($content['userid']) . ')</option>';
+               $OUT .= '>' . $content['surname'] . ' ' . $content['family'] . ' (' . $content['userid'] . ')</option>';
        } // END - while
 
        // Free memory
@@ -1703,15 +1706,15 @@ function registerFirstAdmin () {
                        // No password 1 entered or to short?
                        if (!isPostRequestElementSet('admin_password1')) {
                                $password1Message = '{--ADMIN_NO_PASSWORD1--}';
-                       } elseif (strlen(postRequestElement('admin_password1')) < getConfig('minium_admin_pass_length')) {
-                               $password1Message = '{--ADMIN_SHORT_PASSWORD1--}';
+                       } elseif (!isStrongPassword(postRequestElement('admin_password1'))) {
+                               $password1Message = '{--ADMIN_WEAK_PASSWORD1--}';
                        }
 
                        // No password 2 entered or to short?
                        if (!isPostRequestElementSet('admin_password2')) {
                                $password2Message = '{--ADMIN_NO_PASSWORD2--}';
-                       } elseif (strlen(postRequestElement('admin_password2')) < getConfig('minium_admin_pass_length')) {
-                               $password2Message = '{--ADMIN_SHORT_PASSWORD2--}';
+                       } elseif (!isStrongPassword(postRequestElement('admin_password2'))) {
+                               $password2Message = '{--ADMIN_WEAK_PASSWORD2--}';
                        }
 
                        // Both didn't match?