/** * Return the number of rows affected by the last query. */ function qa_db_affected_rows() { $db = qa_db_connection(); return $db->affected_rows; }
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) { // don't show error if we're in installation process $errorhtml = ''; } $errorhtml .= 'Welcome to Question2Answer. It\'s time to set up your database!'; if (QA_FINAL_EXTERNAL_USERS) { if (defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH')) { $errorhtml .= "\n\nWhen you click below, your Question2Answer site will be set up to integrate with the users of your WordPress site <a href=\"" . qa_html(get_option('home')) . "\" target=\"_blank\">" . qa_html(get_option('blogname')) . "</a>. Please consult the online documentation for more information."; } else { $errorhtml .= "\n\nWhen you click below, your Question2Answer site will be set up to integrate with your existing user database and management. Users will be referenced with database column type " . qa_html(qa_get_mysql_user_column_type()) . ". Please consult the online documentation for more information."; }
$moduletype = qa_post_text('moduletype'); $modulename = qa_post_text('modulename'); $module = qa_load_module($moduletype, $modulename); $queries = $module->init_queries(qa_db_list_tables()); if (!empty($queries)) { 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_db_connection(false) !== null && !@$pass_failure_from_install) { $check = qa_db_check_tables(); // see where the database is at switch ($check) { case 'none': if (@$pass_failure_errno == 1146) { // don't show error if we're in installation process $errorhtml = ''; } $errorhtml .= 'Welcome to Question2Answer. It\'s time to set up your database!'; if (QA_FINAL_EXTERNAL_USERS) { if (defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH')) { $errorhtml .= "\n\nWhen you click below, your Question2Answer site will be set up to integrate with the users of your WordPress site <a href=\"" . qa_html(get_option('home')) . "\" target=\"_blank\">" . qa_html(get_option('blogname')) . "</a>. Please consult the online documentation for more information."; } else { $errorhtml .= "\n\nWhen you click below, your Question2Answer site will be set up to integrate with your existing user database and management. Users will be referenced with database column type " . qa_html(qa_get_mysql_user_column_type()) . ". Please consult the online documentation for more information."; }
function qa_db_insert_on_duplicate_inserted() { return mysql_affected_rows(qa_db_connection()) == 1; }
function qa_db_affected_rows() { return mysql_affected_rows(qa_db_connection()); }
function qa_get_user_email($userid) { // Until you edit this function, always return null // return null; /* Example 1 - suitable if: * Your database is shared with the Q2A site * Your database has a users table that contains emails */ $qa_db_connection = qa_db_connection(); $result = mysql_fetch_assoc(mysql_query("SELECT email FROM users WHERE id='" . mysql_real_escape_string($userid, $qa_db_connection) . "'", $qa_db_connection)); if (is_array($result)) { return $result['email']; } return null; }