OpenVPN_Management_GUI/Admin/Modules/Settings/index.php

243 lines
7.1 KiB
PHP
Raw Normal View History

2012-07-16 21:30:19 +02:00
<?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"];
?>
2012-07-17 21:15:23 +02:00
<!-- MAIN CONTENT BEGINN ################################################################################ -->
<!-- MAIN -->
<div id="main">
<div class="wrapper">
<h1><b>Settings</b></h1>
2012-07-16 21:30:19 +02:00
<?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 != "..")
{
2012-07-17 21:22:21 +02:00
echo "<option "; if(db_getconfval("sitetheme")==$file) echo "selected "; echo "value=\"".$file."\">".$file."</option>";
2012-07-16 21:30:19 +02:00
}
}
// 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\">";
}
}
?>
2012-07-17 21:15:23 +02:00
</div>
</div>