<?php //Log ini_set("log_errors", "1"); ini_set("error_log", "errors.log"); ini_set("display_errors", "0"); require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php'; require_once __ROOT__ . '/php/utils/db_sql.php'; try { if (PDO_DRIVER == 'sqlite') { $db = new PDO(PDO_DSN); } else { $db = new PDO(PDO_DSN, PDO_USER, PDO_PASSWORD); } if (PDO_DRIVER == 'pgsql') { install_pgsql($db, DB_PREFIX); } elseif (PDO_DRIVER == 'sqlite') { install_sqlite($db, DB_PREFIX); } else { install_mysql($db, DB_PREFIX); } print "Success!"; } catch (Exception $e) { print "Connection failed : " . $e->getMessage(); }
function selectauth() { global $HTTP_POST_VARS, $INSTALLDIR, $CONFIGFILE; //lets test our db access. if ($HTTP_POST_VARS['dbtype'] == "mysql") { $cont = install_mysql(); } elseif ($HTTP_POST_VARS['dbtype'] == "pgsql") { $cont = install_pgsql(); } else { die("ERROR: UNKNOWN DBMS SELECTED."); } //if ($cont != 0) we will draw the selectauth form. if ($cont != 0) { //now we will create the config file contents printf("Writing config file: "); $config_contents = "<?\r\n"; $config_contents .= "//****************************************************************************\r\n"; $config_contents .= "//* This file was generated by the fishCMS installer.\r\n"; $config_contents .= "//* PLEASE DO NOT EDIT THE CONTENTS OF THIS FILE UNLESS YOU ARE 100% SURE!\r\n"; $config_contents .= "//****************************************************************************\r\n"; $config_contents .= "\$db_type='" . $HTTP_POST_VARS['dbtype'] . "';\r\n"; $config_contents .= "\$db_host='" . $HTTP_POST_VARS['db_host'] . "';\r\n"; $config_contents .= "\$db_username='******'db_username'] . "';\r\n"; $config_contents .= "\$db_password='******'db_password'] . "';\r\n"; $config_contents .= "\$db_database='" . $HTTP_POST_VARS['db_database'] . "';\r\n"; $config_contents .= "\$list_prefix='" . $HTTP_POST_VARS['list_prefix'] . "';\r\n"; $config_contents .= "?>\r\n"; if ($file = @fopen($INSTALLDIR . $CONFIGFILE, "w")) { fwrite($file, $config_contents); fclose($file); printf("<font color='#00ff00'>OK</font><br>\r\n"); } else { printf("<font color='#ff0000'>ERROR</font><br>\r\n"); printf("Please copy and paste the following text in your FishCMS directory as %s<BR>\r\n", $CONFIGFILE); printf("<pre>%s</pre>\r\n", htmlspecialchars($config_contents)); printf("<BR><BR>"); } //now we will draw the authentication table printf("<h2>Authentication module selection.</h2>\r\n"); printf("<form method='post' action='install.php?mode=siteconfig'>\r\n"); printf("<table border=0>\r\n"); printf("<tr><td>Authentication type:</td><td><select name='authtype'>\r\n"); printf(" <option value='fishauth'>FishCMS</option>\r\n"); printf(" <option value='phpbbauth'>phpBB2</option>\r\n"); printf("</select></td></tr>\r\n"); printf("</table>\r\n"); printf("<input type='submit' value='Next >>'>\r\n"); printf("</form>\r\n"); } }