File "install.php"
Full path: /home/argothem/www/memo/site/site/CoolForum_0.8.4_beta/CoolForum_0.8.4_beta/install/install.php
File size: 13.27 KB
MIME-type: text/x-php
Charset: 8 bit
<?
//*********************************************************************************
//* *
//* CoolForum v.0.8 Beta : Forum de discussion *
//* Copyright 2001-2002 SORIANO Denis alias Cool Coyote *
//* *
//* *
//* 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 the Free Software Foundation; either version 2 *
//* of the License, or (at your option) any later version. *
//* *
//* This program is distributed in the hope that it will be useful, *
//* but WITHOUT ANY WARRANTY; without even the implied warranty of *
//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
//* GNU General Public License for more details. *
//* *
//* You should have received a copy of the GNU General Public License *
//* along with this program; if not, write to the Free Software *
//* Foundation, Inc., 59 Temple Place - Suite 330, *
//* Boston, MA 02111-1307, USA. *
//* *
//* *
//* Forum Cr par SORIANO Denis (Cool Coyote) *
//* contact : coyote@coolcoyote.net *
//* site web et tlchargement : http://www.coolforum.net *
//* *
//*********************************************************************************
// ################################################################################
// COMPATIBILITE GLOBALES
if(!isset($_SERVER))
{
$_SERVER = $HTTP_SERVER_VARS;
$_ENV = $HTTP_ENV_VARS;
$_COOKIE = $HTTP_COOKIE_VARS;
$_GET = $HTTP_GET_VARS;
$_POST = $HTTP_POST_VARS;
$_FILES = $HTTP_POST_FILES;
$_SESSION = $HTTP_SESSION_VARS;
$_REQUEST = array_merge($_GET,$_POST);
}
// ################################################################################
// DEFINITION DES FONCTIONS
function geterrorcode()
{
global $compteur,$_GET;
return($_GET['module']."-".$_GET['steps']."-".$compteur."<br>".mysql_error());
}
function exec_request()
{
global $update,$sql,$continue,$c, $compteur;
if($continue==true)
{
if($c <= $compteur)
{
$query=$sql->query($update['sql']);
if($query)
echo($update['ok']."<br>");
else
{
$error_code = geterrorcode();
echo("<font color=red>".$update['nok']."<br>");
echo("Votre code d'erreur : <font size=3>$error_code</font></font>");
$continue=false;
}
}
$compteur++;
}
}
function affseparate()
{
global $c, $compteur,$continue;
if(($c <= $compteur) && $continue)
echo("<p><font color=red>##########</font><p>");
}
function next_step()
{
global $_GET, $continue;
if($continue)
echo("<form action=\"install.php\" method=\"get\">
<input type=\"hidden\" name=\"action\" value=\"update\">
<input type=\"hidden\" name=\"module\" value=\"".$_GET['module']."\">
<input type=\"hidden\" name=\"steps\" value=\"".($_GET['steps']+1)."\">
<input type=\"submit\" value=\"Continuer ->>\">
</form>");
}
function end_maj()
{
global $start_key, $ForumDBVersion , $lastversion, $version;
if($ForumDBVersion==$lastversion)
echo("Votre forum a t mis jour correctement.<p>
Veuillez supprimer le dossier <i>install</i> de votre compte FTP avant de rutiliser votre forum.");
else
{
echo("Nous allons maintenant lancerla mise jour vers la version<br><font color=red>".$version[$start_key+1]."</font><p>
<form action=\"install.php\" method=\"get\">
<input type=\"hidden\" name=\"action\" value=\"update\">
<input type=\"hidden\" name=\"module\" value=\"".($_GET['module']+1)."\">
<input type=\"hidden\" name=\"steps\" value=\"1\">
<input type=\"submit\" value=\"Lancer la mise jour ->>\">
</form>");
}
}
// ################################################################################
// CONNEXION A MYSQL
require("../secret/connect.php");
class SQLConnect extends My_SQL
{
function SQLConnect()
{
@mysql_connect($this->host,$this->user,$this->pass) or die("Impossible de se connecter la base de donnes");
@mysql_select_db("$this->bdd") or die("Impossible de se connecter la base de donnes");
}
function query($query)
{
global $NBRequest;
$msql=mysql_query($query);
if($msql)
$NBRequest++;
/*else
{
echo(mysql_error()."<br>");
echo($query."<p>");
}*/
return($msql);
}
function list_tables()
{
$msql = mysql_list_tables($this->bdd);
return($msql);
}
}
$sql = new SQLConnect;
// ################################################################################
if(!isset($_REQUEST['c']))
$c = 0;
else
$c = intval($_REQUEST['c']);
$compteur = 1;
// #########################################
if(isset($_POST['errorcode']))
{
$tablarray = explode("-",$_POST['errorcode']);
$_GET['module'] = $tablarray[0];
$_GET['steps'] = $tablarray[1];
$c = $tablarray[2];
}
// #########################################
$versions = array();
$continue=true;
if(!isset($_REQUEST['action']))
$_REQUEST['action'] = "";
// ##### Dfinition des versions #####
$version[] = "0.6 beta";
$version[] = "0.7 beta";
$version[] = "0.8 beta";
// ################################################################################
?>
<html>
<head>
<title>Mise jour CoolForum</title>
<style type="text/css">
a.men:link{color: white; text-decoration:underline;}
a.men:visited{color: white; text-decoration:underline;}
a.men:hover{color: white; text-decoration:none;}
a.lien:link{color: black; text-decoration: underline;}
a.lien:visited{color: black; text-decoration: underline;}
a.lien:hover{color: black; text-decoration:none;}
.form{background:#265789; color:white; font: 8pt verdana; border-style:solid; border-color:black; border-width:1;}
.form2{background:#A4B6C9; color:black; font: 8pt ; border-style:solid; border-color:; border-width:1;}
.corp{font-family:verdana; color:white;}
.corp2{font-family:verdana; color:black;}
</style>
</head>
<body bgcolor=#909090>
<center>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<tr height="89">
<td width="30" nowrap><img src="images/bghautgauche.gif"></td>
<td width="273"><a href="index.php"><img src="images/logo.jpg" border=0></a></td>
<td background="images/bghaut.jpg"> </td>
<td width="30" nowrap><img src="images/bghautdroit.gif"></td>
</tr>
</table>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<tr>
<td width="30" nowrap background="images/bggauche.gif"> </td>
<td bgcolor="#C1C1C1">
<table border=1 bordercolor="black" style="border-collapse:collapse;" width=100% cellpadding=0 height="25" rules="none">
<tr height="25">
<td class="corp" background="images/bgdegrad.jpg" style="padding-left:10;">
<font size=2>
<b>Mise jour de CoolForum</b>
</font>
</td>
</tr>
</table>
<img src="images/blank.gif"><br>
</td>
<td width="30" nowrap background="images/bgdroite.gif"> </td>
</tr>
</table>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<tr>
<td width="30" nowrap background="images/bggauche.gif"> </td>
<td bgcolor="#C1C1C1">
<table border=1 bordercolor="black" width=100% cellpadding=0 cellspacing=0 style="border-collapse: collapse;">
<tr>
<td bgcolor="#A4B6C9" class="corp2" align=center>
<font size=2><b>
<br>
<?
if($_REQUEST['action']=="update")
{
$query = $sql->query("SELECT valeur FROM ".$_PRE."config WHERE options='ForumDBVersion'");
if(!$query)
echo(mysql_error());
$nb = mysql_numrows($query);
if($nb>0)
{
list($ForumDBVersion) = mysql_fetch_array($query);
$nbTotalVersions = count($version);
$lastversion = $version[$nbTotalVersions-1];
for($i = 0; $i < $nbTotalVersions; $i++)
if($version[$i] == $ForumDBVersion)
$start_key = $i;
}
?>
<?
if(!isset($_GET['module']))
{
if($nb>0)
{
echo("Nous avons dtect que la version <font color=red>".$ForumDBVersion."</font> est installe.<p>");
$nbSteps=$nbTotalVersions-$start_key-1;
if($nbSteps==0)
echo("La dernire version est dj installe. Aucune mise jour disponible");
else
{
if($nbSteps==1)
echo("Nous allons mettre jour votre forum la version <font color=red>".$lastversion."</font>.<p>");
else
{
echo("Pour mettre jour votre forum la dernire version, nous allons procder en $nbSteps tapes:<p>");
echo("<table border=1 bordercolor=\"black\" style=\"border-collapse:collapse;\">
<tr>
<td class=\"corp\" bgcolor=\"#537FAC\">
<font size=2>");
for($i=$start_key;$i<($nbTotalVersions-1);$i++)
{
echo("- Mise jour de la version <font color=silver><b>".$version[$i]."</b></font> la version <font color=silver><b>".$version[$i+1]."</b></font><br>");
}
echo("</font></td>
</tr>
</table><p>");
}
echo("<hr color=\"black\">
<center><font color=\"red\"><u>ATTENTION</u></font></center><p>
Nous vous rappelons qu'avant toute mise jour de votre base de donne, vous <u>DEVEZ</u> effectuer une sauvegarde de celle-ci.
En cas de problme lors de la mise jour, votre base de donne pourrait tre irrmdiablement endommage. Si vous ne savez pas comment
sauvegarder votre base de donne, un tutorial est disponible l'adresse suivante: <a href=\"http://www.coolforum.net/faqs/faq-bdd.html#bdd01\" target=\"_blank\" class=\"men\">http://www.coolforum.net/faqs/faq-bdd.html#bdd01</a><p>
<hr color=\"black\"><p>
Pour commencer la mise jour, cliquez sur le bouton ci-dessous:<p>
<form action=\"install.php\" method=\"get\">
<input type=\"hidden\" name=\"action\" value=\"update\">
<input type=hidden name=\"module\" value=\"".($start_key+1)."\">
<input type=hidden name=\"steps\" value=\"1\">
<input type=submit value=\"Commencer la mise jour\" class=\"form\">
</form>");
}
echo("<hr color=\"black\"><p>
Si pendant l'installation le script rencontre un problme lors d'une requte, il vous donnera un code d'erreur que vous devez noter.
Aprs avoir identifi et ventuellement rpar ce problme, insrez le code d'erreur ci-dessous et cliquez sur le bouton \"Continuer\",
cela vous permettra de reprendre la mise jour l o elle s'tait arrte.<p>
<form action=\"install.php\" method=\"post\">
Entrez le code d'erreur: <input type=\"text\" name=\"errorcode\" value=\"\" class=\"form\">
<input type=submit value=\"Reprendre la mise jour\" class=\"form\">
<input type=\"hidden\" name=\"action\" value=\"update\">
</form>");
}
}
else
{
$Module_Name=str_replace(" ","_",$version[$_GET['module']]);
include("./upd_$Module_Name.php");
}
}
//////////////////////////////////////////////////
// INSTALLATION //
if($_REQUEST['action']=="install")
{
include("mod_install.php");
}
//////////////////////////////////////////////////
// SUPPRESSION //
if($_REQUEST['action']=="delete")
{
include("mod_delete.php");
}
//////////////////////////////////////////////////
// ACCUEIL INSTALLATION //
if(empty($_REQUEST['action']))
{
?>
Bienvenue dans l'installation de <font color="red">CoolForum</font>.<p>
<hr color="red" width=250>
Ce script va vous permettre d'installer votre nouveau forum, de mettre jour votre forum actuel ou bien supprimer les tables MySQL du forum.<p>
Choisissez votre type d'installation:<br>
<form action="install.php" method="post">
<select name="action" class="form">
<option value="install">Installation complte
<option value="update">Mise jour
<option value="delete">Suppression des tables
</select>
<input type="submit" value="Valider" class="form">
</form>
<?
}
?>
</b></font><p>
</td>
</tr>
</table>
<br>
</td>
<td width="30" nowrap background="images/bgdroite.gif"> </td>
</tr>
</table>
<table border=0 width=100% cellpadding=0 cellspacing=0>
<tr height="21">
<td width="16" nowrap><img src="images/bgbasgauche.gif"></td>
<td bgcolor="#C1C1C1" valign="top" background="images/bgbas.gif">
<table border=0 height="20" cellspacing="0" width="100%">
<tr>
<td class="corp" align=center bgcolor="#265789">
</td>
</tr>
</table>
</td>
<td width="16" nowrap><img src="images/bgbasdroite.gif"></td>
</tr>
</table><p>
</center>
</body>
</html>