Viewing file: install.php (26.08 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
// if pmnl is already installed, redirect to admin login
include("./admin/include/function.php");
if(file_exists("include/config.php")){
include("include/config.php");
include("include/db/db_".$db_type.".inc.php");
upgrade($hostname,$login ,$pass,$database,$table_global_config);
header("Location:./admin/index.php");
exit;
}
include("./include/lib/libconfig.php");
include("./include/interface.php");
include("./include/lib/libnewsletter.php");
$langfile = (isset($_POST['langfile']) ? $_POST['langfile'] : "");
$db_type = (isset($_POST['db_type']) ? $_POST['db_type'] : "");
$step = (isset($_POST['step']) ? $_POST['step'] : 1);
$op = (isset($_POST['op']) ? $_POST['op'] : "");
if(empty($langfile)){
if(empty($db_type)){
// in this case dberror() is not defined anywhere
// so let's add a dumb function
function dberror(){};
}
include("./include/lang/english.php");
} else {
if(empty($db_type)){
// in this case dberror() is not defined anywhere
// so let's add a dumb function
function dberror(){};
}
include_once("include/db/db_".$db_type.".inc.php");
include_once("./include/lang/".$langfile.".php");
}
html_header(translate("PHPMYNEWSLETTER_TITLE"));
echo "<div align=\"center\">
<img src=\"img/logo_phpmynewsletter.gif\" alt=\"logo\" border=\"0\" />";
echo "<h3>".translate("INSTALL_TITLE")." ".$step."/4</h3></div>";
if(empty($langfile)){
echo "<div class='subsection2'>";
echo "<div class='subtitle'>".translate("INSTALL_LANGUAGE")."</div>";
echo "<div class='subcontent' align='center'>";
echo "<FORM action='install.php' method='post' class='form-light'>";
echo "<input type='hidden' name='step' value=".($step+1)." />";
echo translate("INSTALL_LANGUAGE_LABEL")." : <SELECT name='langfile'>";
echo getLanguageList($langfile);
echo "</SELECT><br /><br /><INPUT TYPE='submit' value='".translate("OK_BTN")."'>";
echo "</form>";
echo "</div></div>";
}
elseif(empty($db_type) && isset($langfile)){
echo "<div class='subsection2'>";
echo "<div class='subtitle'>".translate("INSTALL_DB_TYPE")."</div>";
echo "<div class='subcontent' align='center'>";
echo "<FORM action='install.php' method='post' class='form-light'>";
echo translate("INSTALL_DB_TYPE")." : <SELECT name='db_type'>";
echo "<OPTION VALUE='mysql'>MySQL</OPTION>";
//echo "<OPTION VALUE='pgsql'>PostgreSQL</OPTION>";
echo "</SELECT><INPUT TYPE='submit' value='O K '>";
echo "<INPUT TYPE='hidden' NAME='langfile' VALUE='$langfile'>";
echo "<input type='hidden' name='step' value=".($step+1)." />";
echo "</form></div></div>";
}
elseif(isset($db_type) && empty($op) && isset($langfile))
{
include_once("include/db/db_".$db_type.".inc.php");
echo "<form method='post' name='global_config' action='install.php' class='form-simple'>";
echo " <SCRIPT language='javascript'>
function checkSMTP() {
if(document.global_config.elements['sending_method'].selectedIndex!=0){
document.global_config.elements['smtp_host'].disabled = true;
document.global_config.elements.smtp_auth[0].disabled = true;
document.global_config.elements.smtp_auth[1].disabled = true;
document.global_config.elements['smtp_login'].disabled = true;
document.global_config.elements['smtp_pass'].disabled = true;
} else {
document.global_config.elements['smtp_host'].disabled = false;
document.global_config.elements.smtp_auth[0].disabled = false;
document.global_config.elements.smtp_auth[1].disabled = false;
document.global_config.elements['smtp_login'].disabled = false;
document.global_config.elements['smtp_pass'].disabled = false;
}
}
</SCRIPT>";
echo "<div class='subsection'>";
echo "<div class='subtitle'>".translate("INSTALL_DB_TITLE")."</div>";
echo "<div class='subcontent'>";
echo "<table cellspacing=5>";
echo "<tr>";
echo "<td>".translate("INSTALL_DB_HOSTNAME")."</td>";
echo "<td><input type='hidden' name='file' value='1'><input type='text' name='db_host' value=''></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_DB_NAME")."</td>";
echo "<td><input type='text' name='db_name' value='phpMyNewsletter'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_DB_LOGIN")."</td>";
echo "<td><input type='text' name='db_login' value=''></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_DB_PASS")."</td>";
echo "<td><input type='password' name='db_pass' value=''></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_DB_TABLE_PREFIX")."</td>";
echo "<td><input type='text' name='table_prefix' value='pmnl_'></td>";
echo "</tr>";
/*
echo "<tr>";
echo "<td>".translate("INSTALL_DB_CONFIG_TABLE")."</td>";
echo "<td><input type='text' name='table_config' value='pmnl_globalconfig'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("Email address storing table")."</td>";
echo "<td><input type='text' name='table_email' value='pmnl_email'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("Temporary table")."</td>";
echo "<td><input type='text' name='table_temp' value='pmnl_temp'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("Newsletters config table")."</td>";
echo "<td><input type='text' name='table_listsconfig' value='pmnl_listsconfig'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("Archives table")."</td>";
echo "<td><input type='text' name='table_archives' value='pmnl_archives'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("Moderation waiting subscription table")."</td>";
echo "<td><input type='text' name='table_sub' value='pmnl_sub'></td>";
echo "</tr>";
*/
echo "<tr>";
echo "<td>".translate("INSTALL_DB_CREATE_DB")."</td>";
echo "<td><input type='checkbox' name='createdb' value='1'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_DB_CREATE_TABLES")."</td>";
echo "<td><input type='checkbox' CHECKED name='createtables' value='1'></td>";
echo "</tr>";
echo "</table>";
echo "</div></div>";
echo "<div class='subsection'>";
echo "<div class='subtitle'>".translate("INSTALL_GENERAL_SETTINGS")."</div>";
echo "<div class='subcontent'>";
echo "<table cellspacing=5>";
echo "<tr>";
echo "<td>".translate("INSTALL_ADMIN_PASS")."</td>";
echo "<td><input type='password' name='admin_pass' value=''></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_ADMIN_BASEURL")."</td>";
echo "<td><input type='text' name='base_url' size='30' value='http://".$_SERVER['HTTP_HOST']."/'><br>(".translate("EXAMPLE").": http://www.mydomain.com/</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_ADMIN_PATH_TO_PMNL")."</td>";
echo "<td><input type='text' name='path' size='30' value=''><br>(".translate("EXAMPLE")." : tools/newsletter/) </td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_LANGUAGE")."</td>";
echo "<td><SELECT NAME='language'>";
echo getLanguageList($langfile);
echo "</select></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_ADMIN_NAME")."</td>";
echo "<td><input type='text' name='admin_name' size='30' value='Admin'></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_ADMIN_EMAIL")."</td>";
echo "<td><input type='text' name='admin_email' size='30' value='admin@mydomain.com'></td>";
echo "</tr>";
echo "</table>";
echo "</div></div>";
echo "<div class='subsection'>";
echo "<div class='subtitle'>".translate("INSTALL_MESSAGE_SENDING_TITLE")."</div>";
echo "<div class='subcontent'>";
echo "<table cellspacing=5>";
echo "<tr>";
echo "<td colspan=2>".translate("INSTALL_MESSAGE_SENDING_LOOP", "<input type='text' name='sending_limit' size='3' value='50'>")."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_SENDING_METHOD")."</td>";
echo "<td><select name='sending_method' onChange='checkSMTP()'>";
echo "<option value='smtp'>smtp</option>";
echo "<option value='php_mail' SELECTED>".translate("INSTALL_PHP_MAIL_FONCTION")."</option>";
echo "<option value='online_mail'>".translate("INSTALL_PHP_MAIL_FONCTION_ONLINE")."</option>";
echo "</select></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_SMTP_HOST")."</td>";
echo "<td><input type='text' name='smtp_host' value='' disabled></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_SMTP_AUTH_NEEDED")."</td>";
echo "<td><input type='radio' name='smtp_auth' value='0' CHECKED disabled>".translate("NO")." ";
echo "<input type='radio' name='smtp_auth' value='1' disabled>".translate("YES")."</td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_SMTP_USERNAME")."</td>";
echo "<td><input type='text' name='smtp_login' value='' disabled></td>";
echo "</tr>";
echo "<tr>";
echo "<td>".translate("INSTALL_SMTP_PASSWORD")."</td>";
echo "<td><input type='text' name='smtp_pass' value='' disabled></td>";
echo "</tr>";
echo "</table>";
echo "</div></div>";
echo "<div class='subsection'>";
echo "<div class='subtitle'>".translate("GCONFIG_SUBSCRIPTION_TITLE")."</div>";
echo "<div class='subcontent'>";
echo "<table cellspacing=5>";
echo "<tr>";
echo "<td colspan=2>".translate("INSTALL_VALIDATION_PERIOD", "<input type='text' name='validation_period' size='3' value='6'>")."</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=2>".translate("INSTALL_SUB_CONFIRM");
echo "<input type='radio' name='sub_validation' value='0'> ".translate("NO");
echo "<input type='radio' name='sub_validation' value='1' CHECKED> ".translate("YES")."</td>";
echo "</tr>";
echo "<tr>";
echo "<td colspan=2>".translate("INSTALL_UNSUB_CONFIRM");
echo "<input type='radio' name='unsub_validation' value='0'> ".translate("NO");
echo "<input type='radio' name='unsub_validation' value='1'CHECKED> ".translate("YES")."</td>";
echo "</tr>";
echo "</table>";
echo "</div></div>";
echo "<input type='hidden' name='op' value='saveConfig'>";
echo "<input type='hidden' name='langfile' value='$langfile'>";
echo "<input type='hidden' name='db_type' value='$db_type'><br>";
echo "<input type='hidden' name='mod_sub' value='0'><br>";
echo "<input type='hidden' name='step' value=".($step+1)." />";
echo "<center><input type='submit' value='Go Go Go !!!'></center>";
echo "</form>";
}
elseif(isset($db_type) && $op=="saveConfig") {
include("include/db/db_".$db_type.".inc.php");
$createdb = (isset($_POST['createdb']) ? $_POST['createdb'] : 0);
$createtables = (isset($_POST['createtables']) ? $_POST['createtables'] : 0);
$smtp_host = (isset($_POST['smtp_host']) ? $_POST['smtp_host'] : "");
$smtp_auth = (isset($_POST['smtp_auth']) ? $_POST['smtp_auth'] : 0);
$smtp_login = (isset($_POST['smtp_login']) ? $_POST['smtp_login'] : "");
$smtp_pass = (isset($_POST['smtp_pass']) ? $_POST['smtp_pass'] : "");
$mod_sub = (isset($_POST['mod_sub']) ? $_POST['mod_sub'] : 0);
$db_host = (isset($_POST['db_host']) ? $_POST['db_host'] : "");
$db_login = (isset($_POST['db_login']) ? $_POST['db_login'] : "");
$db_pass = (isset($_POST['db_pass']) ? $_POST['db_pass'] : "");
$db_name = (isset($_POST['db_name']) ? $_POST['db_name'] : "");
$table_prefix = (isset($_POST['table_prefix']) ? $_POST['table_prefix'] : "");
$admin_pass = (isset($_POST['admin_pass']) ? $_POST['admin_pass'] : "");
$base_url = (isset($_POST['base_url']) ? $_POST['base_url'] : "");
$path = (isset($_POST['path']) ? $_POST['path'] : "");
$sending_method = (isset($_POST['sending_method']) ? $_POST['sending_method'] : "");
$language = (isset($_POST['language']) ? $_POST['language'] : "");
$sending_limit = (isset($_POST['sending_limit']) ? $_POST['sending_limit'] : "");
$validation_period = (isset($_POST['validation_period']) ? $_POST['validation_period'] : "");
$sub_validation = (isset($_POST['sub_validation']) ? $_POST['sub_validation'] : "");
$unsub_validation = (isset($_POST['unsub_validation']) ? $_POST['unsub_validation'] : "");
$admin_email = (isset($_POST['admin_email']) ? $_POST['admin_email'] : "");
$admin_name = (isset($_POST['admin_name']) ? $_POST['admin_name'] : "");
$sub_validation = (isset($_POST['sub_validation']) ? $_POST['sub_validation'] : "");
if($createdb==1)
{
echo "<li>".translate("INSTALL_SAVE_CREATE_DB", $db_name);
$db= new Db();
$db->DbConnect($db_host, $db_login, $db_pass);
echo $db->DbError();
if($db->DbCreate($db_name)) echo " OK</li>";
else "Erreur</li>";
}
if( $db_type == "mysql"){
if($createtables==1)
{
$db = new Db();
$db->DbConnect($db_host, $db_login, $db_pass, $db_name);
$sql = 'CREATE TABLE `'.$table_prefix.'archives` ('
. ' `id` int(65) NOT NULL default "0",'
. ' `date` datetime NOT NULL default "000-00-00 00:00:00",'
. ' `type` text NOT NULL,'
. ' `subject` text NOT NULL,'
. ' `message` text NOT NULL,'
. ' `list_id` int(11) NOT NULL default "0",'
. ' UNIQUE KEY `id` (`id`)'
. ' ) TYPE=MyISAM;';
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE", $table_prefix."archives")." : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError()."<br>Query:" .$sql)."</div>";
else echo translate("DONE")."</li>";
$sql= 'CREATE TABLE '.$table_prefix.'email ('
. ' `email` varchar(255) NOT NULL default "",'
. ' `list_id` int(11) NOT NULL default "0",'
. ' `hash` varchar(255) NOT NULL default "",'
. ' KEY `hash` (`hash`)'
. ' ) TYPE=MyISAM;';
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE", $table_prefix."email")." : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql= ' CREATE TABLE `'.$table_prefix.'config` ('
. ' `admin_pass` varchar(64) NOT NULL default "",'
. ' `archive_limit` varchar(64) NOT NULL default "",'
. ' `base_url` varchar(64) NOT NULL default "",'
. ' `path` varchar(64) NOT NULL default "",'
. ' `sending_method` enum("smtp","php_mail","online_mail","nexen_mail","sendmail") NOT NULL default "smtp",'
. ' `language` varchar(64) NOT NULL default "",'
. ' `table_email` varchar(255) NOT NULL default "",'
. ' `table_temp` varchar(255) NOT NULL default "",'
. ' `table_listsconfig` varchar(255) NOT NULL default "",'
. ' `table_archives` varchar(255) NOT NULL default "",'
. ' `smtp_host` varchar(255) NOT NULL default "",'
. ' `smtp_auth` enum("0","1") NOT NULL default "0",'
. ' `smtp_login` varchar(255) NOT NULL default "",'
. ' `smtp_pass` varchar(255) NOT NULL default "",'
. ' `sending_limit` int(4) NOT NULL default "30",'
. ' `validation_period` tinyint(4) NOT NULL default "0",'
. ' `sub_validation` enum("0","1") NOT NULL default "1",'
. ' `unsub_validation` enum("0","1") NOT NULL default "1",'
. ' `admin_email` varchar(255) NOT NULL default "",'
. ' `admin_name` varchar(255) NOT NULL default "",'
. ' `mod_sub` enum("0","1") NOT NULL default "0",'
. ' `mod_sub_table` varchar(255) NOT NULL default "",'
. ' charset varchar(255) NOT NULL default "utf-8"'
. ' ) TYPE=MyISAM;';
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE", $table_prefix."config")." : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql= 'CREATE TABLE '.$table_prefix.'listsconfig ('
. ' `list_id` tinyint(4) NOT NULL auto_increment,'
. ' `newsletter_name` varchar(255) NOT NULL default "",'
. ' `from_addr` varchar(255) NOT NULL default "",'
. ' `from_name` varchar(255) NOT NULL default "",'
. ' `subject` varchar(255) NOT NULL default "",'
. ' `header` text NOT NULL,'
. ' `footer` text NOT NULL,'
. ' `subscription_subject` varchar(255) NOT NULL default "",'
. ' `subscription_body` text NOT NULL,'
. ' `welcome_subject` varchar(255) NOT NULL default "",'
. ' `welcome_body` text NOT NULL,'
. ' `quit_subject` varchar(255) NOT NULL default "",'
. ' `quit_body` text NOT NULL,'
. ' PRIMARY KEY (`list_id`)'
. ' ) TYPE=MyISAM AUTO_INCREMENT=1 ';
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE", $table_prefix."listconfig")." : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql= ' CREATE TABLE '.$table_prefix.'sub ('
. ' `email` varchar(255) NOT NULL default "",'
. ' `list_id` varchar(64) NOT NULL default "",'
. ' KEY `list_id` (`list_id`)'
. ' ) TYPE=MyISAM';
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE", $table_prefix."sub")." : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql= 'CREATE TABLE '.$table_prefix.'temp ('
. ' `email` varchar(255) NOT NULL default "",'
. ' `list_id` varchar(64) NOT NULL default "",'
. ' `hash` varchar(255) NOT NULL default "",'
. ' `date` date NOT NULL default "0000-00-00"'
. ' ) TYPE=MyISAM';
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE", $table_prefix."temp")." : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
}
} elseif($db_type == "pgsql"){
if($createdb==1)
{
echo "<li>".translate("INSTALL_SAVE_CREATE_DB")." : </li>";
$db= new Db();
$db->DbConnect($db_host, $db_login, $db_pass);
if($db->DbError()){
echo error_msg(translate("ERROR_DBCONNECT_2", $db->DbError()));
exit();
} else {
if($db->DbCreate($db_name)) echo success_msg(translate("DONE"));
else echo error_msg($db->DbError())."</li>";
}
}
if($createtables==1)
{
$db = new Db();
$db->DbConnect($db_host, $db_login, $db_pass, $db_name);
if($db->DbError()){
echo error_msg(translate("ERROR_DBCONNECT_2", $db->DbError()));
exit();
}
$sql = "CREATE TABLE ".$table_prefix."archives (";
$sql.= "id serial NOT NULL,";
$sql.= "date date NOT NULL,"; //was datetime
$sql.= "type varchar(4) NOT NULL default '',";
$sql.= "subject text NOT NULL,";
$sql.= "message text NOT NULL,";
$sql.= "list_id serial NOT NULL,";
$sql.= "PRIMARY KEY (id)";
//$sql.= "UNIQUE KEY id (id),";
// $sql.= "KEY id_2 (id)";
$sql.= ")";
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE")." ".$table_prefix."archives : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError()."<br>Query:" .$sql)."</div>";
else echo translate("DONE")."</li>";
$sql = "CREATE TABLE ".$table_prefix."email (";
$sql.= "email varchar(255) NOT NULL default '',";
$sql.= "list_id varchar(64) NOT NULL default '',";
$sql.= "hash varchar(255) NOT NULL default ''";
$sql.= ") ";
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE")." ".$table_prefix."email : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql = "CREATE TABLE ".$table_prefix."config (";
$sql.= "admin_pass varchar(64) NOT NULL default '',";
$sql.= "archive_limit varchar(64) NOT NULL default '',";
$sql.= "base_url varchar(64) NOT NULL default '',";
$sql.= "path varchar(64) NOT NULL default '',";
$sql.= "sending_method varchar(64) NOT NULL default 'smtp',";
$sql.= "language varchar(64) NOT NULL default '',";
$sql.= "table_email varchar(255) NOT NULL default '',";
$sql.= "table_temp varchar(255) NOT NULL default '',";
$sql.= "table_listsconfig varchar(255) NOT NULL default '',";
$sql.= "table_archives varchar(255) NOT NULL default '',";
$sql.= "smtp_host varchar(255) NOT NULL default '',";
$sql.= "smtp_auth varchar(1) NOT NULL default '0',";
$sql.= "smtp_login varchar(255) NOT NULL default '',";
$sql.= "smtp_pass varchar(255) NOT NULL default '',";
$sql.= "sending_limit integer NOT NULL default 30,";
$sql.= "validation_period integer NOT NULL default 0,";
$sql.= "sub_validation varchar(1) NOT NULL default '1',";
$sql.= "unsub_validation varchar(1) NOT NULL default '1',";
$sql.= "admin_email varchar(255) NOT NULL default '',";
$sql.= "admin_name varchar(255) NOT NULL default '',";
//$sql.= "mod_post enum('0','1') NOT NULL default '0',";
$sql.= "mod_sub varchar(1) NOT NULL default '0',";
//$sql.= "mod_post_table varchar(255) NOT NULL default '',";
$sql.= "mod_sub_table varchar(255) NOT NULL default ''";
$sql.= "charset varchar(255) NOT NULL default 'utf-8',";
$sql.= ")";
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE")." ".$table_prefix."config : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql = "CREATE TABLE ".$table_prefix."listsconfig (";
$sql.= "list_id serial NOT NULL ,";
$sql.= "newsletter_name varchar(255) NOT NULL default '',";
$sql.= "from_addr varchar(255) NOT NULL default '',";
$sql.= "from_name varchar(255) NOT NULL default '',";
$sql.= "subject varchar(255) NOT NULL default '',";
$sql.= "header text NOT NULL,";
$sql.= "footer text NOT NULL,";
$sql.= "subscription_subject varchar(255) NOT NULL default '',";
$sql.= "subscription_body text NOT NULL,";
$sql.= "welcome_subject varchar(255) NOT NULL default '',";
$sql.= "welcome_body text NOT NULL,";
$sql.= "quit_subject varchar(255) NOT NULL default '',";
$sql.= "quit_body text NOT NULL,";
$sql.= "PRIMARY KEY (list_id)";
$sql.= ")";
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE")." ".$table_prefix."listconfig : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql = "CREATE TABLE ".$table_prefix."sub (";
$sql.= "email varchar(255) NOT NULL default '',";
$sql.= "list_id varchar(64) NOT NULL default ''";
$sql.= ")";
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE")." ".$table_prefix."sub : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
$sql = "CREATE TABLE ".$table_prefix."temp (";
$sql.= "email varchar(255) NOT NULL default '',";
$sql.= "list_id varchar(64) NOT NULL default '',";
$sql.= "hash varchar(255) NOT NULL default '',";
$sql.= "date date NOT NULL";
$sql.= ")";
echo "<li>".translate("INSTALL_SAVE_CREATE_TABLE")." ".$table_prefix."temp : ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
}
}
$db= new Db();
$db->DbConnect($db_host, $db_login, $db_pass, $db_name);
if(!get_magic_quotes_gpc()){
$table_prefix = escape_string($table_prefix);
$admin_pass = escape_string($admin_pass);
$base_url = escape_string($base_url);
$path = escape_string($path);
$smtp_host = escape_string($smtp_host);
$smtp_login = escape_string($smtp_login);
$smtp_pass = escape_string($smtp_pass);
$sending_limit = escape_string($sending_limit);
$validation_period = escape_string($validation_period);
$sub_validation = escape_string($sub_validation);
$unsub_validation = escape_string($unsub_validation);
$admin_email = escape_string($admin_email);
$admin_name = escape_string($admin_name);
$mod_sub = escape_string($mod_sub);
}
$admin_pass = md5($admin_pass);
$sql ="INSERT INTO ".$table_prefix."config VALUES (";
$sql.="'$admin_pass', '50', '$base_url', '$path', ";
$sql.="'$sending_method', '$language', '".$table_prefix."email', '".$table_prefix."temp', ";
$sql.="'".$table_prefix."listsconfig', '".$table_prefix."archives', '$smtp_host', '$smtp_auth', ";
$sql.="'$smtp_login', '$smtp_pass', '$sending_limit', '$validation_period', ";
$sql.="'$sub_validation', '$unsub_validation', '$admin_email', '$admin_name', ";
$sql.=" '$mod_sub', '".$table_prefix."sub', 'utf-8')";
echo "<li>".translate("INSTALL_SAVE_CONFIG").": ";
$db->DbQuery($sql);
if($db->DbError()) echo "</li><div class='error'>".translate("ERROR_SQL", $db->DbError())."</div>";
else echo translate("DONE")."</li>";
echo "<li>".translate("INSTALL_SAVE_CONFIG_FILE").":</li> ";
$configfile ="<?php\nif (!defined( '_CONFIG' ))\n\t{\n\n\t\tdefine('_CONFIG', 1);";
$configfile.="\n\n\n\t\t$"."db_type = '$db_type';";
$configfile.="\n\t\t$"."hostname = '$db_host';";
$configfile.="\n\t\t$"."login = '$db_login';";
$configfile.="\n\t\t$"."pass = '$db_pass';";
$configfile.="\n\t\t$"."database = '$db_name';";
$configfile.="\n\t\t$"."table_global_config='".$table_prefix."config';";
$configfile.="\n\t\t$"."pmnl_version ='0.8beta5';\n\n\t}\n\n?>";
if(is_writable("include/")){
$fc = fopen("include/config.php", "w");
$w = fwrite ($fc, $configfile );
echo " OK";
} else {
echo "<div class='error'>".translate("INSTALL_UNABLE_TO_SAVE_CONFIG_FILE")."</div>";
echo translate("INSTALL_CONFIG_MANUALLY");
echo"<TEXTAREA COLS=60 ROWS=18>".$configfile."</TEXTAREA>";
}
echo "<br><div align='center'><img src='img/puce.png'> <a href='admin'>".translate("INSTALL_FINISHED")."</a></div>";
}
echo "</td></tr>";
table_footer();
page_footer();
html_footer();
?>
|