$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.";
$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.";
}
}
}
}
// Output start of HTML early, so we can see a nicely-formatted list of database queries when upgrading
// Output start of HTML early, so we can see a nicely-formatted list of database queries when upgrading
...
@@ -104,7 +103,7 @@
...
@@ -104,7 +103,7 @@
th,td{padding:2px;}
th,td{padding:2px;}
th{text-align:right;font-weight:normal;}
th{text-align:right;font-weight:normal;}
td{text-align:left;}
td{text-align:left;}
.msg-success{color:#080;}
.msg-success{color:#090;}
.msg-error{color:#b00;}
.msg-error{color:#b00;}
</style>
</style>
</head>
</head>
...
@@ -112,27 +111,29 @@
...
@@ -112,27 +111,29 @@
<?php
<?php
if(isset($pass_failure_type)){// this page was requested due to query failure, via the fail handler
if(isset($pass_failure_type)){
// this page was requested due to query failure, via the fail handler
switch($pass_failure_type){
switch($pass_failure_type){
case'connect':
case'connect':
$errorhtml.='Could not establish database connection. Please check the username, password and hostname in the config file, and if necessary set up the appropriate MySQL user and privileges.';
$errorhtml.='Could not establish database connection. Please check the username, password and hostname in the config file, and if necessary set up the appropriate MySQL user and privileges.';
break;
break;
case'select':
case'select':
$errorhtml.='Could not switch to the Question2Answer database. Please check the database name in the config file, and if necessary create the database in MySQL and grant appropriate user privileges.';
$errorhtml.='Could not switch to the Question2Answer database. Please check the database name in the config file, and if necessary create the database in MySQL and grant appropriate user privileges.';
break;
break;
case'query':
case'query':
global$pass_failure_from_install;
global$pass_failure_from_install;
if(@$pass_failure_from_install)
if(@$pass_failure_from_install)
$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");
$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
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.";
$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;
break;
}
}
}
}else{// this page was requested by user GET/POST, so handle any incoming clicks on buttons
else{
// this page was requested by user GET/POST, so handle any incoming clicks on buttons
$success.='Your Question2Answer database has been created and integrated with your WordPress site.';
$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.';
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')){
if(qa_clicked('nonuser')){
qa_db_install_tables();
qa_db_install_tables();
$success.='The additional Question2Answer database tables have been created.';
$success.='The additional Question2Answer database tables have been created.';
}
}
if(qa_clicked('upgrade')){
if(qa_clicked('upgrade')){
qa_db_upgrade_tables();
qa_db_upgrade_tables();
$success.='Your Question2Answer database has been updated.';
$success.='Your Question2Answer database has been updated.';
}
}
if(qa_clicked('repair')){
if(qa_clicked('repair')){
qa_db_install_tables();
qa_db_install_tables();
$success.='The Question2Answer database tables have been repaired.';
$success.='The Question2Answer database tables have been repaired.';
$check=qa_db_check_tables();// see where the database is at
$check=qa_db_check_tables();// see where the database is at
switch($check){
switch($check){
case'none':
case'none':
if(@$pass_failure_errno==1146)// don't show error if we're in installation process
if(@$pass_failure_errno==1146)// don't show error if we're in installation process
$errorhtml='';
$errorhtml='';
$errorhtml.='Welcome to Question2Answer. It\'s time to set up your database!';
$errorhtml.='Welcome to Question2Answer. It\'s time to set up your database!';
if(QA_FINAL_EXTERNAL_USERS){
if(QA_FINAL_EXTERNAL_USERS){
if(defined('QA_FINAL_WORDPRESS_INTEGRATE_PATH'))
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.";
$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.";
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.";
}
$buttons=array('create'=>'Create Database');
$buttons=array('create'=>'Create Database');
}else{
}
$errorhtml.="\n\nWhen you click below, your Question2Answer database will be set up to manage user identities and logins internally.\n\nIf you want to offer a single sign-on for an existing user base or website, please consult the online documentation before proceeding.";
else{
$buttons=array('create'=>'Create Database including User Management');
$errorhtml.="\n\nWhen you click below, your Question2Answer database will be set up to manage user identities and logins internally.\n\nIf you want to offer a single sign-on for an existing user base or website, please consult the online documentation before proceeding.";
$buttons=array('create'=>'Create Database including User Management');
}
}
break;
break;
case'old-version':
case'old-version':
// don't show error if we need to upgrade
if(!@$pass_failure_from_install)
if(!@$pass_failure_from_install)
$errorhtml='';// don't show error if we need to upgrade
$errorhtml='';
$errorhtml.='Your Question2Answer database needs to be upgraded for this version of the software.';// don't show error before this
// don't show error before this
$buttons=array('upgrade'=>'Upgrade Database');
$errorhtml.='Your Question2Answer database needs to be upgraded for this version of the software.';
$buttons=array('upgrade'=>'Upgrade Database');
break;
break;
case'non-users-missing':
case'non-users-missing':
$errorhtml='This Question2Answer site is sharing its users with another Q2A site, but it needs some additional database tables for its own content. Please click below to create them.';
$errorhtml='This Question2Answer site is sharing its users with another Q2A site, but it needs some additional database tables for its own content. Please click below to create them.';
$buttons=array('nonuser'=>'Create Tables');
$buttons=array('nonuser'=>'Create Tables');
break;
break;
case'table-missing':
case'table-missing':
$errorhtml.='One or more tables are missing from your Question2Answer database.';
$errorhtml.='One or more tables are missing from your Question2Answer database.';
$buttons=array('repair'=>'Repair Database');
$buttons=array('repair'=>'Repair Database');
break;
break;
case'column-missing':
case'column-missing':
$errorhtml.='One or more Question2Answer database tables are missing a column.';
$errorhtml.='One or more Question2Answer database tables are missing a column.';