Commit c88fb8ba by Scott

Replace version checks with predefined constant

parent f2e6f702
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
{ {
require_once QA_INCLUDE_DIR.'util/string.php'; require_once QA_INCLUDE_DIR.'util/string.php';
if (!qa_php_version_below('5.3.7')) { if (QA_PASSWORD_HASH) {
qa_db_query_sub( qa_db_query_sub(
'INSERT INTO ^users (created, createip, email, passhash, level, handle, loggedin, loginip) '. 'INSERT INTO ^users (created, createip, email, passhash, level, handle, loggedin, loginip) '.
'VALUES (NOW(), COALESCE(INET_ATON($), 0), $, $, #, $, NOW(), COALESCE(INET_ATON($), 0))', 'VALUES (NOW(), COALESCE(INET_ATON($), 0), $, $, #, $, NOW(), COALESCE(INET_ATON($), 0))',
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
require_once QA_INCLUDE_DIR.'util/string.php'; require_once QA_INCLUDE_DIR.'util/string.php';
if (!qa_php_version_below('5.3.7')) { if (QA_PASSWORD_HASH) {
qa_db_query_sub( qa_db_query_sub(
'UPDATE ^users SET passhash=$, passsalt=NULL, passcheck=NULL WHERE userid=$', 'UPDATE ^users SET passhash=$, passsalt=NULL, passcheck=NULL WHERE userid=$',
password_hash($password, PASSWORD_BCRYPT), $userid password_hash($password, PASSWORD_BCRYPT), $userid
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
$doconfirms = qa_opt('confirm_user_emails') && $useraccount['level'] < QA_USER_LEVEL_EXPERT; $doconfirms = qa_opt('confirm_user_emails') && $useraccount['level'] < QA_USER_LEVEL_EXPERT;
$isconfirmed = ($useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED) ? true : false; $isconfirmed = ($useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED) ? true : false;
if (!qa_php_version_below('5.3.7')) { if (QA_PASSWORD_HASH) {
$haspasswordold = isset($useraccount['passsalt']) && isset($useraccount['passcheck']); $haspasswordold = isset($useraccount['passsalt']) && isset($useraccount['passcheck']);
$haspassword = isset($useraccount['passhash']); $haspassword = isset($useraccount['passhash']);
} else { } else {
...@@ -211,7 +211,7 @@ ...@@ -211,7 +211,7 @@
else { else {
$errors = array(); $errors = array();
if (!qa_php_version_below('5.3.7')) { if (QA_PASSWORD_HASH) {
if ( if (
($haspasswordold && (strtolower(qa_db_calc_passcheck($inoldpassword, $useraccount['passsalt'])) != strtolower($useraccount['passcheck']))) || ($haspasswordold && (strtolower(qa_db_calc_passcheck($inoldpassword, $useraccount['passsalt'])) != strtolower($useraccount['passcheck']))) ||
(!$haspasswordold && $haspassword && !password_verify($inoldpassword,$useraccount['passhash'])) (!$haspasswordold && $haspassword && !password_verify($inoldpassword,$useraccount['passhash']))
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
$inuserid=$matchusers[0]; $inuserid=$matchusers[0];
$userinfo=qa_db_select_with_pending(qa_db_user_account_selectspec($inuserid, true)); $userinfo=qa_db_select_with_pending(qa_db_user_account_selectspec($inuserid, true));
if (!qa_php_version_below('5.3.7')) { if (QA_PASSWORD_HASH) {
$haspassword=isset($userinfo['passhash']); $haspassword=isset($userinfo['passhash']);
$haspasswordold=isset($userinfo['passsalt']) && isset($userinfo['passcheck']); $haspasswordold=isset($userinfo['passsalt']) && isset($userinfo['passcheck']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment