Ejemplo n.º 1
0
function qa_db_upgrade_table_columns($definitions, $table, $columns)
{
    $sqlchanges = array();
    foreach ($columns as $column) {
        $sqlchanges[] = 'CHANGE COLUMN ' . $column . ' ' . $column . ' ' . $definitions[$table][$column];
    }
    qa_db_upgrade_query('ALTER TABLE ^' . $table . ' ' . implode(', ', $sqlchanges));
}
Ejemplo n.º 2
0
 }
 if (qa_clicked('repair')) {
     qa_db_install_tables();
     $success .= 'The Question2Answer database tables have been repaired.';
 }
 if (qa_clicked('module')) {
     $moduletype = qa_post_text('moduletype');
     $modulename = qa_post_text('modulename');
     $module = qa_load_module($moduletype, $modulename);
     $queries = $module->init_queries(qa_db_list_tables_lc());
     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_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);