VPN-Management-GUI 2.0.3 porting start
This commit is contained in:
42
Admin/Modules/Settings/change.php
Normal file
42
Admin/Modules/Settings/change.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
|
||||
$moduleurl = $_REQUEST["path"];
|
||||
|
||||
list($db,$conn) = db_connect();
|
||||
if (empty($db))
|
||||
{
|
||||
die ("Keine Verbindung zur Datenbank! [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
if(is_null($_REQUEST["withsquid"]))
|
||||
{
|
||||
$_REQUEST["withsquid"] = "0";
|
||||
}
|
||||
if(is_null($_REQUEST["withmail"]))
|
||||
{
|
||||
$_REQUEST["withmail"] = "0";
|
||||
}
|
||||
if(is_null($_REQUEST["withusersquid"]))
|
||||
{
|
||||
$_REQUEST["withusersquid"] = "0";
|
||||
}
|
||||
|
||||
// Daten eintragen
|
||||
while (list ($attr, $value) = each ($_REQUEST))
|
||||
{
|
||||
if($attr != "path")
|
||||
{
|
||||
// SQL-Anweisung erstellen
|
||||
$sql = "UPDATE ".
|
||||
"config SET value='".mysql_real_escape_string($value)."' WHERE attr = '".mysql_real_escape_string($attr)."'";
|
||||
mysql_query ($sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
header ("Location: ".$moduleurl."&uebergabe=1");
|
||||
|
||||
?>
|
242
Admin/Modules/Settings/index.php
Executable file
242
Admin/Modules/Settings/index.php
Executable file
@@ -0,0 +1,242 @@
|
||||
<?php
|
||||
$moduleurl = $_SERVER["REQUEST_URI"];
|
||||
$urlcut = strpos($moduleurl, "&");
|
||||
if($urlcut > 0)
|
||||
{
|
||||
$moduleurl = substr($moduleurl,0,$urlcut);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($moduleurl, "?") == 0)
|
||||
{
|
||||
$moduleurl = $_SERVER["REQUEST_URI"]."?site=1";
|
||||
}
|
||||
}
|
||||
$url = $moduleurl;
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
$status = $_REQUEST["uebergabe"];
|
||||
?>
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<h1><b>Settings</b></h1>
|
||||
<?php
|
||||
switch($status)
|
||||
{
|
||||
case 1:
|
||||
echo "<b>Settings saved successfully!</b>";
|
||||
break;
|
||||
case 2:
|
||||
echo "<b>Domain ACL saved successfully!</b>";
|
||||
break;
|
||||
case 3:
|
||||
echo "<b>Blocked Client ACL saved successfully!</b>";
|
||||
break;
|
||||
case 4:
|
||||
echo "<b>Allowed Client ACL saved successfully!</b>";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
echo "
|
||||
<form action=\"/Admin/Modules/Settings/change.php\" method=\"post\">
|
||||
<table>
|
||||
<br>
|
||||
<tr>
|
||||
<td>Sitename:</td>
|
||||
<td><input type=\"text\" name=\"sitename\" size=\"50\" value=\"".db_getconfval("sitename")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sitesubname</td>
|
||||
<td><input type=\"text\" name=\"subname\" size=\"50\" value=\"".db_getconfval("subname")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Siteinfo (Header Marquee)</td>
|
||||
<td><input type=\"text\" name=\"siteinfo\" size=\"50\" value=\"".db_getconfval("siteinfo")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Theme:</td>
|
||||
<td>
|
||||
<select name=\"sitetheme\" size=1> ";
|
||||
// Öffnet ein Unterverzeichnis mit dem Namen "daten"
|
||||
$verzeichnis = openDir($_SERVER["DOCUMENT_ROOT"]."/Themes");
|
||||
// Verzeichnis lesen
|
||||
while ($file = readDir($verzeichnis))
|
||||
{
|
||||
// Höhere Verzeichnisse nicht anzeigen!
|
||||
if ($file != "." && $file != "..")
|
||||
{
|
||||
$filecut = strpos($file, ".");
|
||||
if($filecut > 0)
|
||||
{
|
||||
$file = substr($file,0,$filecut);
|
||||
echo "<option "; if(db_getconfval("sitetheme")==$file) echo "selected "; echo "value=\"".$file."\">".$file."</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Verzeichnis schließen
|
||||
closeDir($verzeichnis);
|
||||
|
||||
echo "
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Config Directory (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"ovpnconfdir\" size=\"50\" value=\"".db_getconfval("ovpnconfdir")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Config File Name:</td>
|
||||
<td><input type=\"text\" name=\"ovpnconffile\" size=\"50\" value=\"".db_getconfval("ovpnconffile")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Key Directory (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"ovpnkeydir\" size=\"50\" value=\"".db_getconfval("ovpnkeydir")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Additional Download Directory (e.g. for client.ovpn, ca.crt, readme ...) (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" size=\"50\" name=\"publicdown\" value=\"".db_getconfval("publicdown")."\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Download Directory (for Explorer, WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"downdir\" size=\"50\" value=\"".db_getconfval("downdir")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Enable Mail Support:</td>
|
||||
<td><input type=\"checkbox\" name=\"withmail\" value=\"1\" "; if(db_getconfval("withmail")=="1") echo "checked"; echo"></td>
|
||||
</tr>";
|
||||
if(db_getconfval("withmail")=="1")
|
||||
{
|
||||
echo"
|
||||
<tr>
|
||||
<td>SMTP Server:</td>
|
||||
<td><input type=\"text\" name=\"mserv\" size=\"50\" value=\"".db_getconfval("mserv")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP User:</td>
|
||||
<td><input type=\"text\" name=\"muser\" size=\"50\" value=\"".db_getconfval("muser")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP Password:</td>
|
||||
<td><input type=\"password\" name=\"mpass\" size=\"50\" value=\"".db_getconfval("mpass")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP Sender Mail-Address:</td>
|
||||
<td><input type=\"text\" name=\"mname\" size=\"50\" value=\"".db_getconfval("mname")."\"><td>
|
||||
</tr>";
|
||||
}
|
||||
echo"
|
||||
<tr>
|
||||
<td>Enable Squid Repair:</td>
|
||||
<td><input type=\"checkbox\" name=\"withusersquid\" value=\"1\" "; if(db_getconfval("withusersquid")=="1") echo "checked"; echo"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Enable Squid Support:</td>
|
||||
<td><input type=\"checkbox\" name=\"withsquid\" value=\"1\" "; if(db_getconfval("withsquid")=="1") echo "checked"; echo"></td>
|
||||
</tr>";
|
||||
if(db_getconfval("withsquid")=="1")
|
||||
{
|
||||
echo"
|
||||
<tr>
|
||||
<td>SQUID Config Directory (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"sqdir\" size=\"50\" value=\"".db_getconfval("sqdir")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SQUID Config File Name:</td>
|
||||
<td><input type=\"text\" name=\"sqconf\" size=\"50\" value=\"".db_getconfval("sqconf")."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SQUID Dynamic Directory (WIHTOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"sqddir\" size=\"50\" value=\"".db_getconfval("sqddir")."\"><td>
|
||||
</tr>";
|
||||
}
|
||||
echo"
|
||||
</table>
|
||||
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\">
|
||||
<input type=\"submit\" value=\"Save settings\">
|
||||
</form> ";
|
||||
|
||||
if(db_getconfval("withsquid")=="1")
|
||||
{
|
||||
echo"
|
||||
<br />
|
||||
<hr/ >
|
||||
<form action=\"".$url."\" method =\"post\">
|
||||
<p>Squid Domain ACL (blocked Domains):</p>
|
||||
<textarea name=\"inhalt\" rows=5 cols=100 wrap=\"virtual\">";
|
||||
|
||||
include(db_getconfval("sqdir")."/denied_domains.acl");
|
||||
|
||||
echo "
|
||||
</textarea><br />
|
||||
<input name=\"submit\" type=\"submit\" id=\"submit\" value=\"Speichern\" />
|
||||
<input type=\"reset\" name=\"Submit2\" value=\"Reset\" />
|
||||
|
||||
</form>";
|
||||
|
||||
echo "
|
||||
<hr />
|
||||
<form action=\"".$url."\" method =\"post\">
|
||||
<p>Squid Client ACL (blocked Clients):</p>
|
||||
<textarea name=\"inhaltc\" rows=5 cols=100 wrap=\"virtual\">";
|
||||
|
||||
include(db_getconfval("sqdir")."/denied_clients.acl");
|
||||
|
||||
echo "
|
||||
</textarea><br>
|
||||
<input name=\"submitc\" type=\"submit\" id=\"submit\" value=\"Speichern\" />
|
||||
<input type=\"reset\" name=\"Submit2c\" value=\"Reset\" />
|
||||
|
||||
</form>";
|
||||
|
||||
echo "
|
||||
<hr />
|
||||
<form action=\"".$url."\" method =\"post\">
|
||||
<p>Squid Client ACL (allowed Clients):</p>
|
||||
<textarea name=\"inhalta\" rows=5 cols=100 wrap=\"virtual\">";
|
||||
|
||||
include(db_getconfval("sqdir")."/allowed_clients.acl");
|
||||
|
||||
echo "
|
||||
</textarea><br>
|
||||
<input name=\"submita\" type=\"submit\" id=\"submit\" value=\"Speichern\" />
|
||||
<input type=\"reset\" name=\"Submit2a\" value=\"Reset\" />
|
||||
|
||||
</form>";
|
||||
|
||||
if ($_REQUEST["submit"] == "Speichern")
|
||||
{
|
||||
$fp = fopen(db_getconfval("sqdir")."/denied_domains.acl","w");
|
||||
$data =$_REQUEST["inhalt"];
|
||||
$data = str_replace("\r","",$data);
|
||||
exec("touch /var/vpn/squid_restart");
|
||||
fputs($fp,$data);
|
||||
fclose($fp);
|
||||
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"1; ".$url."&uebergabe=2\">";
|
||||
}
|
||||
|
||||
if ($_REQUEST["submitc"] == "Speichern")
|
||||
{
|
||||
$fp = fopen(db_getconfval("sqdir")."/denied_clients.acl","w");
|
||||
$data =$_REQUEST["inhaltc"];
|
||||
$data = str_replace("\r","",$data);
|
||||
exec("touch /var/vpn/squid_restart");
|
||||
fputs($fp,$data);
|
||||
fclose($fp);
|
||||
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"1; ".$url."&uebergabe=3\">";
|
||||
}
|
||||
|
||||
if ($_REQUEST["submita"] == "Speichern")
|
||||
{
|
||||
$fp = fopen(db_getconfval("sqdir")."/allowed_clients.acl","w");
|
||||
$data =$_REQUEST["inhalta"];
|
||||
$data = str_replace("\r","",$data);
|
||||
exec("touch /var/vpn/squid_restart");
|
||||
fputs($fp,$data);
|
||||
fclose($fp);
|
||||
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"1; ".$url."&uebergabe=4\">";
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user