"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "install.php3" between
mythreads-links_1.2.0.tar.gz and mythreads-links_1.2.1.tar.gz

About: MyThreads-Links is a web based links manager (using PHP and MySQL).

install.php3  (mythreads-links_1.2.0):install.php3  (mythreads-links_1.2.1)
<?php <?php
# #
# $Id: install.php3,v 1.5 2010/05/04 18:32:41 ldrolez Exp $ # $Id: install.php,v 1.5 2010-05-04 18:32:41 ldrolez Exp $
# Website: http://mythreads.sourceforge.net # Website: http://mythreads.sourceforge.net
# #
# Desc: Install script, based on phpBB's script written by James Atkinson # Desc: Install script, based on phpBB's script written by James Atkinson
# #
# (C) 2002 by Ludovic Drolez # (C) 2002 by Ludovic Drolez
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or # the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. # (at your option) any later version.
skipping to change at line 36 skipping to change at line 36
?> ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<HTML> <HTML>
<HEAD> <HEAD>
<TITLE>myThreads - Installation</TITLE> <TITLE>myThreads - Installation</TITLE>
</HEAD> </HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#11C6BD" VLINK="#11C6BD"> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#11C6BD" VLINK="#11C6BD">
<?php <?php
$phpEx = "php3"; $phpEx = "php";
$next = $_POST['next']; $next = $_POST['next'];
$dbserver = $_POST['dbserver']; $dbserver = $_POST['dbserver'];
$dbname = $_POST['dbname']; $dbname = $_POST['dbname'];
$dbuser = $_POST['dbuser']; $dbuser = $_POST['dbuser'];
$dbpass = $_POST['dbpass']; $dbpass = $_POST['dbpass'];
$dbprefix = $_POST['dbprefix']; $dbprefix = $_POST['dbprefix'];
$sampledata = $_POST['sampledata']; $sampledata = $_POST['sampledata'];
$done = $_POST['done']; $done = $_POST['done'];
$username = $_POST['username']; $username = $_POST['username'];
$password = $_POST['password']; $password = $_POST['password'];
skipping to change at line 58 skipping to change at line 58
$self = $_SERVER['PHP_SELF']; $self = $_SERVER['PHP_SELF'];
if($f = @fopen("tmp/frontpage.cache", "r")) { if($f = @fopen("tmp/frontpage.cache", "r")) {
echo "<h2>Notice!</h2><br>"; echo "<h2>Notice!</h2><br>";
echo "The software has already been configured !\n"; echo "The software has already been configured !\n";
echo "<br><br>If you really want to reconfigure it, remove the fi le 'tmp/frontpage.cache', simply refresh this page and the install will proceed normally.<br>\n"; echo "<br><br>If you really want to reconfigure it, remove the fi le 'tmp/frontpage.cache', simply refresh this page and the install will proceed normally.<br>\n";
exit; exit;
} }
if(! $f=@fopen("config.php3", "a")) { if(! $f=@fopen("config.php", "a")) {
echo "<h2>Notice!</h2><br>"; echo "<h2>Notice!</h2><br>";
echo "The file config.php3 is not writeable by the web server. In order for the install to proceed this needs to be changed<br>\n"; echo "The file config.php is not writeable by the web server. In order for the install to proceed this needs to be changed<br>\n";
echo "You can do this on a Unix based system by issueing the foll owing command:<br>\n"; echo "You can do this on a Unix based system by issueing the foll owing command:<br>\n";
echo "<pre>chmod a+w config.php3</pre>\n"; echo "<pre>chmod a+w config.php</pre>\n";
echo "If you do not have command line access to your webserver yo ur FTP client should be able to change file permissions.<br>\n"; echo "If you do not have command line access to your webserver yo ur FTP client should be able to change file permissions.<br>\n";
echo "Once you have changed the permissions on this file simply r efresh this page and the install will proceed normally.<br>\n"; echo "Once you have changed the permissions on this file simply r efresh this page and the install will proceed normally.<br>\n";
echo "Also, don't forget to remove the writable attribute after r unning install.php3 !!\n"; echo "Also, don't forget to remove the writable attribute after r unning install.php !!\n";
exit; exit;
} }
fclose($f); fclose($f);
if(! $f=@fopen("tmp/frontpage.cache", "a")) { if(! $f=@fopen("tmp/frontpage.cache", "a")) {
echo "<h2>Notice!</h2><br>"; echo "<h2>Notice!</h2><br>";
echo "The 'tmp' directory is not writeable by the web server."; echo "The 'tmp' directory is not writeable by the web server.";
echo "Please change the directory rights and refresh this page.<b r>\n"; echo "Please change the directory rights and refresh this page.<b r>\n";
exit; exit;
} }
skipping to change at line 97 skipping to change at line 97
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%"> <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH="100%">
<TR BGCOLOR="#dddddd" ALIGN="CENTER"> <TR BGCOLOR="#dddddd" ALIGN="CENTER">
<TD COLSPAN="2"><h3>myThreads Installer</h3></TD> <TD COLSPAN="2"><h3>myThreads Installer</h3></TD>
</TR> </TR>
</TABLE></TD></TR> </TABLE></TD></TR>
</TABLE><BR> </TABLE><BR>
<? <?
echo "Testing DB Connection...<BR>"; echo "Testing DB Connection...<BR>";
flush(); flush();
if(!$db = mysql_connect("$dbserver", "$dbuser", "$dbpass")) if(!$db = mysqli_connect("$dbserver", "$dbuser", "$dbpass"))
die("<font color=\"#FF0000\">Error, I could not connect to the databas e at $dbserver. Using username $dbuser and password $dbpass.<BR>Please go back a nd try again."); die("<font color=\"#FF0000\">Error, I could not connect to the databas e at $dbserver. Using username $dbuser and password $dbpass.<BR>Please go back a nd try again.");
echo "<font color=\"#00FF00\">DB Connection Good!</FONT><BR>"; echo "<font color=\"#00FF00\">DB Connection Good!</FONT><BR>";
flush(); flush();
echo "Selected database $dbname..."; echo "Selected database $dbname...";
flush(); flush();
if(!@mysql_select_db("$dbname", $db)) { if(!$db->select_db("$dbname")) {
echo "<font color=\"#FF0000\">Database could not be found</font><BR>" ; echo "<font color=\"#FF0000\">Database could not be found</font><BR>" ;
flush(); flush();
echo "Attempting to create database $dbname..."; echo "Attempting to create database $dbname...";
flush(); flush();
if(!$r = mysql_query("CREATE DATABASE $dbname", $db)) if(!$r = $db->query("CREATE DATABASE $dbname"))
die("<font color=\"#FF0000\">Error, count not select or create data base $dbname, please create it manually or have your system administrator do it for you and try again."); die("<font color=\"#FF0000\">Error, count not select or create data base $dbname, please create it manually or have your system administrator do it for you and try again.");
mysql_select_db("$dbname", $db); $db->select_db("$dbname");
echo "<font color=\"#00FF00\">Database Created!</font><BR>"; echo "<font color=\"#00FF00\">Database Created!</font><BR>";
flush(); flush();
} }
else else
echo "<font color=\"#00FF00\">Database Selected!</font><BR>"; echo "<font color=\"#00FF00\">Database Selected!</font><BR>";
flush(); flush();
echo "Creating myThreads tables...<BR>"; echo "Creating myThreads tables...<BR>";
flush(); flush();
// read the queries from an external file // read the queries from an external file
$filename = "./docs_info/database.sql"; $filename = "./docs_info/database.sql";
if(!$fp = fopen($filename, "r")) if(!$fp = fopen($filename, "r"))
die("Error opening ./docs_info/database.sql, please check and make sur e it exists and then try again."); die("Error opening ./docs_info/database.sql, please check and make sur e it exists and then try again.");
$contents = fread( $fp, filesize( $filename ) ); $contents = fread( $fp, filesize( $filename ) );
fclose($fp); fclose($fp);
// remove comments // remove comments
$contents = ereg_replace("(\#[^\n\r]*)", "", $contents); $contents = preg_replace("/(\#[^\n\r]*)/i", "", $contents);
// add table prefix // add table prefix
if ($dbprefix != "") { if ($dbprefix != "") {
$contents = eregi_replace("(CREATE TABLE )", "\\1$dbprefix", $contents $contents = preg_replace("/(CREATE TABLE )/i", "\\1$dbprefix", $conten
); ts);
$contents = eregi_replace("(CREATE INDEX [a-zA-Z]+ ON )", "\\1$dbprefi $contents = preg_replace("/(CREATE INDEX [a-zA-Z]+ ON )/i", "\\1$dbpre
x", $contents); fix", $contents);
} }
$queries = explode(";", $contents); $queries = explode(";", $contents);
// execute the SQL queries // execute the SQL queries
echo "<TABLE BORDER=\"0\">\n"; echo "<TABLE BORDER=\"0\">\n";
while (list ($id, $query) = each($queries)) { while (list ($id, $query) = each($queries)) {
if (trim($query) == "") continue; if (trim($query) == "") continue;
$tmp = explode (" ", $query); $tmp = explode (" ", $query);
echo "<TR><TD>$tmp[0] $tmp[1] $tmp[2] ...</TD> "; echo "<TR><TD>$tmp[0] $tmp[1] $tmp[2] ...</TD> ";
if(!$r = mysql_query($query, $db)) if(!$r = $db->query($query))
die("<TD><font color=\"#FF0000\">ERROR! Could not create table. Reas die("<TD><font color=\"#FF0000\">ERROR! Could not create table. Reas
on: <b>". mysql_error()."</b></TD></TR></TABLE>"); on: <b>". $db->error()."</b></TD></TR></TABLE>");
echo "<TD><font color=\"#00FF00\">[OK]</FONT></TD></TR>"; echo "<TD><font color=\"#00FF00\">[OK]</FONT></TD></TR>";
flush(); flush();
} }
// default data // default data
if (isset ($sampledata)) { if (isset ($sampledata)) {
$filename = "./docs_info/sampledata.sql"; $filename = "./docs_info/sampledata.sql";
if(!$fp = fopen($filename, "r")) if(!$fp = fopen($filename, "r"))
die("Error opening ./docs_info/sampledata.sql, please check and make s ure it exists and then try again."); die("Error opening ./docs_info/sampledata.sql, please check and make s ure it exists and then try again.");
$contents = fread( $fp, filesize( $filename ) ); $contents = fread( $fp, filesize( $filename ) );
fclose($fp); fclose($fp);
// remove comments // remove comments
$contents = ereg_replace("(\#[^\n\r]*)", "", $contents); $contents = preg_replace("/(\#[^\n\r]*)/", "", $contents);
// add table prefix // add table prefix
if ($dbprefix != "") { if ($dbprefix != "") {
$contents = eregi_replace("(insert into )", "\\1$dbprefix", $content s); $contents = preg_replace("/(insert into )/i", "\\1$dbprefix", $conte nts);
} }
$queries = explode(";", $contents); $queries = explode(";", $contents);
// execute the SQL queries // execute the SQL queries
echo "<TR><TD>Inserting default data</TD>"; echo "<TR><TD>Inserting default data</TD>";
while (list ($id, $query) = each($queries)) { while (list ($id, $query) = each($queries)) {
if (trim($query) == "") continue; if (trim($query) == "") continue;
if(!$r = mysql_query($query, $db)) if(!$r = $db->query($query))
die("<TD><font color=\"#FF0000\">ERROR! Could not import data. Rea die("<TD><font color=\"#FF0000\">ERROR! Could not import data. Rea
son: <b>". mysql_error()."</b></TD></TR></TABLE>"); son: <b>". $db->error()."</b></TD></TR></TABLE>");
flush(); flush();
} }
echo "<TD><font color=\"#00FF00\">[OK]</FONT></TD></TR>"; echo "<TD><font color=\"#00FF00\">[OK]</FONT></TD></TR>";
} }
echo "</TABLE>"; echo "</TABLE>";
echo "<font color=\"#00FF00\">Database Created Successfully!</FONT><BR>< BR>"; echo "<font color=\"#00FF00\">Database Created Successfully!</FONT><BR>< BR>";
?> ?>
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN=" TOP" WIDTH="95%"> <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENTER" VALIGN=" TOP" WIDTH="95%">
<TR> <TR>
skipping to change at line 260 skipping to change at line 260
$username = addslashes($username); $username = addslashes($username);
// $passwd = md5($password); // $passwd = md5($password);
// read // read
$filename = "./config.$phpEx"; $filename = "./config.$phpEx";
if(!$fp = fopen($filename, "r")) if(!$fp = fopen($filename, "r"))
die("Error opening $filename, please check and make sure it exists and th en try again."); die("Error opening $filename, please check and make sure it exists and th en try again.");
$contents = fread( $fp, filesize( $filename ) ); $contents = fread( $fp, filesize( $filename ) );
fclose($fp); fclose($fp);
// replace // replace
$contents = ereg_replace ("\\\$host *=[^;]+", "\$host=\"".$dbserver."\"", $contents = preg_replace ("/\\\$host *=[^;]+/", "\$host=\"".$dbserver."\""
$contents); , $contents);
$contents = ereg_replace ("\\\$username *=[^;]+", "\$username=\"".$dbuser. $contents = preg_replace ("/\\\$username *=[^;]+/", "\$username=\"".$dbuse
"\"", $contents); r."\"", $contents);
$contents = ereg_replace ("\\\$database *=[^;]+", "\$database=\"".$dbname. $contents = preg_replace ("/\\\$database *=[^;]+/", "\$database=\"".$dbnam
"\"", $contents); e."\"", $contents);
$contents = ereg_replace ("\\\$password *=[^;]+", "\$password=\"".$dbpass. $contents = preg_replace ("/\\\$password *=[^;]+/", "\$password=\"".$dbpas
"\"", $contents); s."\"", $contents);
$contents = ereg_replace ("\\\$admin_username *=[^;]+", "\$admin_username= $contents = preg_replace ("/\\\$admin_username *=[^;]+/", "\$admin_usernam
\"".$username."\"", $contents); e=\"".$username."\"", $contents);
$contents = ereg_replace ("\\\$admin_password *=[^;]+", "\$admin_password= $contents = preg_replace ("/\\\$admin_password *=[^;]+/", "\$admin_passwor
\"".$password_rep."\"", $contents); d=\"".$password_rep."\"", $contents);
$contents = ereg_replace (" \"pre\" => \"[^\"]+\"", " \"pre\" => \"" $contents = preg_replace ("/ \"pre\" => \"[^\"]+\"/", " \"pre\" => \
.$dbprefix."\"", $contents); "".$dbprefix."\"", $contents);
$contents = ereg_replace ("\"security_code[^,]+", "\"security_code\" => \" $contents = preg_replace ("/\"security_code[^,]+/", "\"security_code\" =>
".Random_Password(16)."\"", $contents); \"".Random_Password(16)."\"", $contents);
// write // write
$filename = "./config.$phpEx"; $filename = "./config.$phpEx";
if(!$fp = fopen($filename, "w")) if(!$fp = fopen($filename, "w"))
die("Error opening $filename for writting, please check that write permis sions are set or make sure the file exists and, then try again."); die("Error opening $filename for writting, please check that write permis sions are set or make sure the file exists and, then try again.");
fputs($fp, $contents); fputs($fp, $contents);
fclose($fp); fclose($fp);
touch("tmp/frontpage.cache"); touch("tmp/frontpage.cache");
?> ?>
<FORM METHOD="POST" ACTION="<?php echo $self ?>"> <FORM METHOD="POST" ACTION="<?php echo $self ?>">
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENT ER" VALIGN="TOP" WIDTH="95%"> <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="0" ALIGN="CENT ER" VALIGN="TOP" WIDTH="95%">
<TR> <TR>
<TD BGCOLOR="#001100"> <TD BGCOLOR="#001100">
<TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH ="100%"> <TABLE BORDER="0" CELLPADDING="1" CELLSPACING="1" WIDTH ="100%">
<TR BGCOLOR="#dddddd" ALIGN="CENTER"> <TR BGCOLOR="#dddddd" ALIGN="CENTER">
<TD COLSPAN="2"><h3>myThreads Installer</h3></TD> <TD COLSPAN="2"><h3>myThreads Installer</h3></TD>
</TR> </TR>
<TR BGCOLOR="#ffffff" ALIGN="LEFT"> <TR BGCOLOR="#ffffff" ALIGN="LEFT">
<TD COLSPAN="2">Congratulations! You have now suc cessfully installed myThreads.<P>You may now proceed to the <a href="index.php3? mode=admin">Administration Area</a> and configure your forums and other settings .<P>Thank you for choosing myThreads<BR> - The myThreads <TD COLSPAN="2">Congratulations! You have now suc cessfully installed myThreads.<P>You may now proceed to the <a href="index.php?m ode=admin">Administration Area</a> and configure your forums and other settings. <P>Thank you for choosing myThreads<BR> - The myThreads
Team.<BR> Team.<BR>
</TR> </TR>
</TABLE></TD></TR></TABLE> </TABLE></TD></TR></TABLE>
<?php <?php
break; break;
} }
} }
else { // First screen else { // First screen
?> ?>
<FORM METHOD="POST" ACTION="<?php echo $self ?>"> <FORM METHOD="POST" ACTION="<?php echo $self ?>">
 End of changes. 18 change blocks. 
40 lines changed or deleted 40 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)