Ejemplo n.º 1
0
                $errorhtml .= "Question2Answer was unable to perform the installation query below. Please check the user in the config file has CREATE and ALTER permissions:\n\n" . qa_html($pass_failure_query . "\n\nError " . $pass_failure_errno . ": " . $pass_failure_error . "\n\n");
            } else {
                $errorhtml .= "A Question2Answer database query failed when generating this page.\n\nA full description of the failure is available in the web server's error log file.";
            }
            break;
    }
} else {
    // this page was requested by user GET/POST, so handle any incoming clicks on buttons
    qa_db_connect('qa_install_db_fail_handler');
    if (qa_clicked('create')) {
        qa_db_install_tables();
        if (QA_FINAL_EXTERNAL_USERS) {
            if (defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH')) {
                require_once QA_INCLUDE_DIR . 'qa-db-admin.php';
                require_once QA_INCLUDE_DIR . 'qa-app-format.php';
                qa_db_page_move(qa_db_page_create(get_option('blogname'), QA_PAGE_FLAGS_EXTERNAL, get_option('home'), null, null, null), 'O', 1);
                // create link back to WordPress home page
                $success .= 'Your Question2Answer database has been created and integrated with your WordPress site.';
            } else {
                $success .= 'Your Question2Answer database has been created for external user identity management. Please read the online documentation to complete integration.';
            }
        } else {
            $success .= 'Your Question2Answer database has been created.';
        }
    }
    if (qa_clicked('nonuser')) {
        qa_db_install_tables();
        $success .= 'The additional Question2Answer database tables have been created.';
    }
    if (qa_clicked('upgrade')) {
        qa_db_upgrade_tables();
                    $editpage = @$pages[$editpage['pageid']];
                }
            } else {
                // creating a new one
                if (empty($errors)) {
                    if ($isexternal) {
                        $pageid = qa_db_page_create($inname, QA_PAGE_FLAGS_EXTERNAL | ($innewwindow ? QA_PAGE_FLAGS_NEW_WINDOW : 0), $inurl, null, null, $inpermit);
                    } else {
                        $pageid = qa_db_page_create($inname, 0, $inslug, $inheading, $incontent, $inpermit);
                        $indextext = qa_viewer_text($incontent, 'html');
                        $searchmodules = qa_load_modules_with('search', 'index_page');
                        foreach ($searchmodules as $searchmodule) {
                            $searchmodule->index_page($pageid, $inslug, $inheading, $incontent, 'html', $indextext);
                        }
                    }
                    qa_db_page_move($pageid, substr($inposition, 0, 1), substr($inposition, 1));
                    $editpage = null;
                    $reloadpages = true;
                }
            }
            if (qa_clicked('dosaveview') && empty($errors) && !$isexternal) {
                qa_redirect($inslug);
            }
        }
        if ($reloadpages) {
            qa_db_flush_pending_result('navpages');
            $pages = qa_db_select_with_pending(qa_db_pages_selectspec());
        }
    }
}
//	Prepare content for theme