// First of all, no admin login is found
$ret = '404';
- // Then we need to lookup the login name by getting the admin hash
- $adminHash = getAdminHash($adminLogin);
-
- // If this is fine, we can continue
- if ($adminHash != '-1') {
- // Get admin id and set it as current
- setCurrentAdminId(getAdminId($adminLogin));
-
- // Now, we need to encode the password in the same way the one is encoded in database
- $testHash = generateHash($adminPassword, $adminHash);
-
- // If they both match, the login data is valid
- if ($testHash == $adminHash) {
- // All fine
- $ret = 'done';
- } else {
- // Set status
- $ret = 'pass';
- }
+ // Get admin id from login
+ $adminId = getAdminId($adminLogin);
+
+ // Continue only with found admin ids
+ if ($adminId > 0) {
+ // Then we need to lookup the login name by getting the admin hash
+ $adminHash = getAdminHash($adminId);
+
+ // If this is fine, we can continue
+ if ($adminHash != '-1') {
+ // Get admin id and set it as current
+ setCurrentAdminId($adminId);
+
+ // Now, we need to encode the password in the same way the one is encoded in database
+ $testHash = generateHash($adminPassword, $adminHash);
+
+ // If they both match, the login data is valid
+ if ($testHash == $adminHash) {
+ // All fine
+ $ret = 'done';
+ } else {
+ // Set status
+ $ret = 'pass';
+ }
+ } // END - if
} // END - if
// Prepare data array
$data = array(
+ 'id' => $adminId,
'login' => $adminLogin,
'plain_pass' => $adminPassword,
'pass_hash' => $adminHash
if ($adminHash != '-1') {
// Now, we need to encode the password in the same way the one is encoded in database
$testHash = encodeHashForCookie($adminHash);
- //* DEBUG: */ outputHtml('adminLogin='.$adminLogin.',<br />passHash='.$passHash.',<br />adminHash='.$adminHash.',<br />testHash='.$testHash.'<br />');
+ //* DEBUG: */ debugOutput('adminLogin=' . $adminLogin . ',passHash='.$passHash.',adminHash='.$adminHash.',testHash='.$testHash);
// If they both match, the login data is valid
if ($testHash == $passHash) {
} // END - if
// Return status
- //* DEBUG: */ outputHtml('ret='.$ret);
+ //* DEBUG: */ debugOutput('ret='.$ret);
return $ret;
}
// Get default what
$what = getWhat();
- //* DEBUG: */ outputHtml(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*<br />');
+ //* DEBUG: */ debugOutput(__LINE__.'*'.$what.'/'.getModule().'/'.getAction().'/'.getWhat().'*');
// Remove any spaces from variable
if (empty($what)) {
$action = getActionFromModuleWhat(getModule(), $what);
// Define admin login name and id number
- $content['login'] = getSession('admin_login');
+ $content['login'] = getAdminLogin(getSession('admin_id'));
$content['id'] = getCurrentAdminId();
// Preload templates
$OUT .= '[<a href="{%url=modules.php?module=admin&action=' . $menu . '%}">';
}
} else {
- $OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_ACTION_404--}">';
+ $OUT .= '<em style="cursor:help" class="admin_note" title="{%message,MENU_ACTION_404=' . $menu . '}">';
}
$OUT .= $title;
$OUT .= '[<a href="{%url=modules.php?module=admin&what=' . $what_sub . '%}">';
}
} else {
- $OUT .= '<em style="cursor:help" class="admin_note" title="{--MENU_WHAT_404--}">';
+ $OUT .= '<em style="cursor:help" class="admin_note" title="{%message,MENU_WHAT_404=' . $what_sub . '%}">';
}
$OUT .= $title_what;
$OUT .= '</select>';
} else {
// No menus???
- $OUT = getMessage('ADMIN_PROBLEM_NO_MENU');
+ $OUT = '{--ADMIN_PROBLEM_NO_MENU--}';
}
// Return output
rebuildCache('config', 'config');
// Settings saved, so display message?
- if ($displayMessage === true) loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+ if ($displayMessage === true) loadTemplate('admin_settings_saved', false, '{--SETTINGS_SAVED--}');
// Return affected rows
return $affected;
loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_STATUS_CHANGED'), $cnt, count($IDs)));
} else {
// Nothing selected!
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NOTHING_SELECTED_CHANGE'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_NOTHING_SELECTED_CHANGE--}');
}
}
// Is the raw userid set?
if (postRequestParameter($userid, $id) > 0) {
// Generate subject
- $subjectLine = getMessage('MEMBER_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
+ $subject = '{--MEMBER_' . strtoupper($subject) . '_' . strtoupper($table) . '_SUBJECT--}';
// Load email template
if (!empty($subjectPart)) {
}
// Send email out
- sendEmail(postRequestParameter($userid, $id), $subjectLine, $mail);
+ sendEmail(postRequestParameter($userid, $id), $subject, $mail);
} // END - if
// Generate subject
- $subjectLine = getMessage('ADMIN_'.strtoupper($subject).'_'.strtoupper($table).'_SUBJECT');
+ $subject = '{--ADMIN_' . strtoupper($subject) . '_' . strtoupper($table) . '_SUBJECT--}';
// Send admin notification out
if (!empty($subjectPart)) {
- sendAdminNotification($subjectLine, 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content, postRequestParameter($userid, $id));
+ sendAdminNotification($subject, 'admin_' . $mode . '_' . strtolower($subjectPart) . '_' . $table, $content, postRequestParameter($userid, $id));
} else {
- sendAdminNotification($subjectLine, 'admin_' . $mode . '_' . $table, $content, postRequestParameter($userid, $id));
+ sendAdminNotification($subject, 'admin_' . $mode . '_' . $table, $content, postRequestParameter($userid, $id));
}
}
// Build a special template list
function adminListBuilder ($listType, $IDs, $table, $columns, $filterFunctions, $extraValues, $idColumn, $userIdColumn, $userid = 'userid') {
- $OUT = ''; $SW = 2;
+ $OUT = '';
// "Walk" through all entries
foreach ($IDs as $id => $selected) {
} // END - if
// If the key matches the idColumn variable, we need to temporary remember it
- //* DEBUG: */ print 'key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value . '<br />';
+ //* DEBUG: */ debugOutput('key=' . $key . ',idColumn=' . $idColumn . ',value=' . $value);
if ($key == $idColumn) {
// Found, so remember it
$GLOBALS['admin_list_builder_id_value'] = $value;
} // END - if
// Handle the call in external function
- //* DEBUG: */ print 'key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value . '<br />';
+ //* DEBUG: */ debugOutput('key=' . $key . ',fucntion=' . $filterFunctions[$idx] . ',value=' . $value);
$content[$key] = handleExtraValues($filterFunctions[$idx], $value, $extraValues[$idx]);
} // END - foreach
- // Add color switching
- $content['sw'] = $SW;
-
// Then list it
$OUT .= loadTemplate(sprintf("admin_%s_%s_row",
$listType,
$table
), true, $content
);
-
- // Switch color
- $SW = 3 - $SW;
} // END - if
// Free the result
// Was this fine?
if (SQL_AFFECTEDROWS() == count($IDs)) {
// All deleted
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ALL_ENTRIES_REMOVED'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_ALL_ENTRIES_REMOVED--}');
} else {
// Some are still there :(
loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_DELETED'), SQL_AFFECTEDROWS(), count($IDs)));
// Was this fine?
if ($affected == count($IDs)) {
// All deleted
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ALL_ENTRIES_EDITED'));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_ALL_ENTRIES_EDITED--}');
} else {
// Some are still there :(
loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_SOME_ENTRIES_NOT_EDITED'), $affected, count($IDs)));
// Is there an account?
if (SQL_HASZERONUMS($result)) {
// No account found!
- return getMessage('ADMIN_NO_LOGIN_WITH_EMAIL');
+ return '{--ADMIN_NO_LOGIN_WITH_EMAIL--}';
} // END - if
// Load all data
$mailText = loadEmailTemplate('admin_reset_password', $content);
// Send it out
- sendEmail($email, getMessage('ADMIN_RESET_PASS_LINK_SUBJ'), $mailText);
+ sendEmail($email, '{--ADMIN_RESET_PASS_LINK_SUBJECT--}', $mailText);
// Prepare output
- return getMessage('ADMIN_RESET_LINK_SENT');
+ return '{--ADMIN_RESET_LINK_SENT--}';
}
// Validate hash and login for password reset
runFilterChain('post_admin_reset_pass', array('login' => $login, 'hash' => $passHash));
// Return output
- return getMessage('ADMIN_PASSWORD_RESET_DONE');
+ return '{--ADMIN_PASSWORD_RESET_DONE--}';
}
// Solves a task by given id number
// Output message for other status than ask/agreed
if (($return != 'ask') && ($return != 'agreed')) {
// Output message
- loadTemplate('admin_settings_saved', false, getMessage('ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return)));
+ loadTemplate('admin_settings_saved', false, '{--ADMIN_EXPERT_SETTINGS_STATUS_' . strtoupper($return) . '--}');
} // END - if
// Return status