if (!is_array($queries)) { $queries = array($queries); } foreach ($queries as $query) { qa_db_upgrade_query($query); } } $success .= 'The ' . $modulename . ' ' . $moduletype . ' module has completed database initialization.'; } if (qa_clicked('super')) { require_once QA_INCLUDE_DIR . 'qa-db-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php'; $inemail = qa_post_text('email'); $inpassword = qa_post_text('password'); $inhandle = qa_post_text('handle'); $fielderrors = array_merge(qa_handle_email_filter($inhandle, $inemail), qa_password_validate($inpassword)); if (empty($fielderrors)) { require_once QA_INCLUDE_DIR . 'qa-app-users.php'; $userid = qa_create_new_user($inemail, $inpassword, $inhandle, QA_USER_LEVEL_SUPER); qa_set_logged_in_user($userid, $inhandle); qa_set_option('feedback_email', $inemail); $success .= "Congratulations - Your Question2Answer site is ready to go!\n\nYou are logged in as the super administrator and can start changing settings.\n\nThank you for installing Question2Answer."; } } } if (is_resource(qa_db_connection(false)) && !@$pass_failure_from_install) { $check = qa_db_check_tables(); // see where the database is at switch ($check) { case 'none': if (@$pass_failure_errno == 1146) {
} // Process change password if clicked if (qa_clicked('dochangepassword')) { require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php'; $inoldpassword = qa_post_text('oldpassword'); $innewpassword1 = qa_post_text('newpassword1'); $innewpassword2 = qa_post_text('newpassword2'); if (!qa_check_form_security_code('password', qa_post_text('code'))) { $errors['page'] = qa_lang_html('misc/form_security_again'); } else { $errors = array(); if ($haspassword && strtolower(qa_db_calc_passcheck($inoldpassword, $useraccount['passsalt'])) != strtolower($useraccount['passcheck'])) { $errors['oldpassword'] = qa_lang('users/password_wrong'); } $useraccount['password'] = $inoldpassword; $errors = $errors + qa_password_validate($innewpassword1, $useraccount); // array union if ($innewpassword1 != $innewpassword2) { $errors['newpassword2'] = qa_lang('users/password_mismatch'); } if (empty($errors)) { qa_db_user_set_password($userid, $innewpassword1); qa_db_user_set($userid, 'sessioncode', ''); // stop old 'Remember me' style logins from still working qa_set_logged_in_user($userid, $useraccount['handle'], false, $useraccount['sessionsource']); // reinstate this specific session qa_report_event('u_password', $userid, $useraccount['handle'], qa_cookie_get()); qa_redirect('account', array('state' => 'password-changed')); } } }
if (empty($errors)) { qa_redirect('account', array('state' => 'profile-saved')); } qa_logged_in_user_flush(); } // Process change password if clicked if (qa_clicked('dochangepassword')) { require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php'; $inoldpassword = qa_post_text('oldpassword'); $innewpassword1 = qa_post_text('newpassword1'); $innewpassword2 = qa_post_text('newpassword2'); $errors = array(); if ($haspassword && strtolower(qa_db_calc_passcheck($inoldpassword, $useraccount['passsalt'])) != strtolower($useraccount['passcheck'])) { $errors['oldpassword'] = qa_lang_html('users/password_wrong'); } $errors = array_merge($errors, qa_password_validate($innewpassword1)); if ($innewpassword1 != $innewpassword2) { $errors['newpassword2'] = qa_lang_html('users/password_mismatch'); } if (empty($errors)) { qa_db_user_set_password($qa_login_userid, $innewpassword1); qa_db_user_set($qa_login_userid, 'sessioncode', ''); // stop old 'Remember me' style logins from still working qa_set_logged_in_user($qa_login_userid, $useraccount['handle'], false, $useraccount['sessionsource']); // reinstate this specific session qa_report_event('u_password', $qa_login_userid, $useraccount['handle'], $qa_cookieid); qa_redirect('account', array('state' => 'password-changed')); } } // Prepare content for theme $qa_content = qa_content_prepare();