<!--
//***************************************************************************
//Copyright 2007 Johannes, Storm
//
//
//This file is part of FSG Free Web-Interface.
//
//FSG Free Web-Interface 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 3 of the License.
//
//FSG Free Web-Interface 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 FSG Free Web-Interface. If not, see <http://www.gnu.org/licenses/>.
//***************************************************************************
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>FSG - New Webinterface</title>
<link rel="stylesheet" type="text/css" href="styles/generell.css">
<link rel="stylesheet" type="text/css" href="styles/start.css">
</head>
<body class="generell">
<table class="All" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="middle">
<table class="Display_Box" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="Display_Links" valign="middle">
</td>
<td class="Display_Mitte" align="center" valign="middle">
<table class="StatusMsg" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="StatusMsg">
FSG Free Web-Interface is free software: you can redistribute it and/or modify<br>
it under the terms of the GNU General Public License as published by<br>
the Free Software Foundation, either version 3 of the License.<br>
<br>
FSG Free Web-Interface is distributed in the hope that it will be useful,<br>
but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
GNU General Public License for more details.<br>
<br>
You should have received a copy of the <a href="LICENSE">GNU General Public License</a><br>
along with FSG Free Web-Interface. If not, see http://www.gnu.org/licenses/.<br>
<br>
By installing and using this software you are agree with this License.<br><br>
</td>
</tr>
</tbody>
</table>
<br><br>
<?PHP
//installationsfunktion
function InstallWI($PATH, $ALIAS, $FiVersion) {
$Status=false;
$var=false;
$zaehler=0;
$BackPath="";
if (is_dir($PATH . '/NewWI')==false) {
//neuen cgi-unterordner erstellen
if (mkdir($PATH . '/NewWI', 0700)) {
$var=true; } }
else {
$var=true; }
if ($var) {
//cgi-files kopieren
$var=false;
// für firmware 3.x
if ($FiVersion==1 || $FiVersion==2 || $FiVersion==4) {
if (copy('./cgi-bin/index.cgi', $PATH . '/NewWI/index.cgi')) {
if (copy('./cgi-bin/config.cgi', $PATH . '/NewWI/config.cgi')) {
chmod($PATH . '/NewWI/index.cgi', 0755);
chmod($PATH . '/NewWI/config.cgi', 0755);
$var=true;
}
else echo "can't copy config.cgi to " . $PATH . "/NewWI/<br>";
}
else echo "can't copy index.cgi to " . $PATH . "/NewWI/<br>";
}
// für firmware 4.x
else if ($FiVersion==5) {
if (copy('./cgi-bin/index_4_x.cgi', $PATH . '/NewWI/index.cgi')) {
if (copy('./cgi-bin/config_4_x.cgi', $PATH . '/NewWI/config.cgi')) {
chmod($PATH . '/NewWI/index.cgi', 0755);
chmod($PATH . '/NewWI/config.cgi', 0755);
$var=true;
}
else echo "can't copy config.cgi to " . $PATH . "/NewWI/<br>";
}
else echo "can't copy index.cgi to " . $PATH . "/NewWI/<br>";
}
//wenn dateien richtig kopiert
if ($var) {
$var=false;
if (is_dir('./Config')==false) {
if (mkdir('./Config', 0700)) {
$var=true;
}
}
else $var=true;
if ($var) {
//config.cfg erzeugen
$BackPath=strchr($ALIAS, '/');
while ($BackPath!='') {
$zaehler++;
$BackPath=strchr($BackPath, $BackPath[2]);
$BackPath=strchr($BackPath, '/');
if ($zaehler>100) {
break;
}
}
$BackPath='';
for ($i=0; $i<$zaehler+1; $i++) {
$BackPath="../" . $BackPath;
}
$fp=fopen('./Config/config.cfg', "w");
if ($fp!=false) {
fputs($fp, "Config.Main.CGIAliasPath=". $ALIAS . "\n");
fputs($fp, "Config.Main.CGIAliasBackPath=" . $BackPath . "\n");
fclose($fp);
//cgiPath.cfg erzeugen
$fp=fopen("./cgiPath.cfg", "w");
if ($fp!=false) {
fputs($fp, $PATH . "\r\n");
fputs($fp, $ALIAS . "\r\n");
fclose($fp);
//Path.cfg für webfolderpath anlegen
$fp=fopen($PATH . "/NewWI/Path.cfg", "w");
if ($fp!=false) {
fputs($fp, "Config.Main.WebFolderPath=" . getcwd());
fclose($fp);
$Status=true;
}
else echo "can't create Path.cfg<br>";
}
else echo "can't create cgiPath.cfg<br>";
}
else echo "can't create config.cfg<br>";
}
else echo "can't create Folder: Config<br>";
}
}
else echo "can't create Folder: " . $PATH . "/NewWI<br>";
return $Status;
}
//starten der installation mit benutzerdefinierten angaben
if (empty($_POST["Ordner"])==false && empty($_POST["Alias"])==false) {
if (InstallWI($_POST["Ordner"], $_POST["Alias"], 3)) {
echo 'Install finished<br>';
echo '
<a href="' . $_POST["Alias"] . '/NewWI/config.cgi?CurrentPage=StandartAss">
<div class="Start_Links">
WI Config
</div>
</a>';
}
else {
echo 'Install failed<br>';
echo '
<a href="install.php">
<div class="Start_Links">
WI Install
</div>
</a>';
}
}
else if (empty($_POST["FirmwareVersion"])) {
//formular für installationsparameter
echo '<form action="install.php" method="POST">';
echo 'Firmware: ';
echo '<select name="FirmwareVersion"><option value="1">3.1.29</option>';
echo '<option value="4">3.3.9</option><option value="2">3.3.14</option>';
echo '<option value="5">4.3.8</option>';
//echo '<option value="3">custom</option>';
echo '</select> ';
echo '<button type="submit" value="Install" name="Aufgabe">Install</button>';
echo '</form>'; }
else {
//auswertung der installationsparameter und aufruf der installationsfunktion
if (strcmp($_POST["FirmwareVersion"], '1')==0 || strcmp($_POST["FirmwareVersion"], '2')==0
|| strcmp($_POST["FirmwareVersion"], '4')==0 || strcmp($_POST["FirmwareVersion"], '5')==0) {
$CgiPath="/var/www/admin/cgi-bin";
$Alias="/admin/cgi-bin";
$Version='';
if (InstallWI($CgiPath, $Alias, $_POST["FirmwareVersion"])) {
if ($_POST["FirmwareVersion"]==1) {
$Version='3.1.29'; }
else if ($_POST["FirmwareVersion"]==2) {
$Version='3.3.14'; }
else if ($_POST["FirmwareVersion"]==4) {
$Version='3.3.9'; }
else if ($_POST["FirmwareVersion"]==5) {
$Version='4.3.8'; }
echo 'Install finished<br>';
echo '
<a href="' . $Alias . '/NewWI/config.cgi?CurrentPage=StandartAss&Version=' . $Version . '">
<div class="Start_Links">
WI Config
</div>
</a>';
}
else {
echo 'Install failed<br>';
echo '
<a href="install.php">
<div class="Start_Links">
WI Install
</div>
</a>';
}
}
else if (strcmp($_POST["FirmwareVersion"], '3')==0) {
//formular für manuelle-installationsparameter
echo '<form action="install.php" method="POST">';
echo 'Path to CGI-folder related to Root-Dir: ';
echo '<input name="Ordner" type="text" size="30" value="/var/www/admin/cgi-bin"><br>';
echo 'CGI-Alias: ';
echo '<input name="Alias" type="text" size="30" value="/admin/cgi-bin"><br>';
echo '<button type="submit" value="Install" name="Aufgabe">Install</button>';
echo '</form>';
}
}
?>
</td>
<td class="Display_Rechts" valign="middle">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>