[Kolab-devel] server/kolab/kolab/admin/service head.php,1.4,1.5 index.php,1.6,1.7 by martin at doto.intevation.de
root at intevation.de
root at intevation.de
Sat Jun 14 15:51:41 CEST 2003
- Previous message: [Kolab-devel] server/kolab/kolab/admin/server head.php,1.4,1.5 index.php,1.6,1.7 by martin at doto.intevation.de
- Next message: [Kolab-devel] server/kolab/kolab/admin/sharedfolder create_sharedfolder.php,1.5,1.6 head.php,1.4,1.5 index.php,1.6,1.7 by martin at doto.intevation.de
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /kolabrepository/server/kolab/kolab/admin/service
In directory doto:/tmp/cvs-serv20674
Modified Files:
head.php index.php
Log Message:
Martin K.: New CCS version
Index: head.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/service/head.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- head.php 22 May 2003 17:50:35 -0000 1.4
+++ head.php 14 Jun 2003 13:51:39 -0000 1.5
@@ -17,6 +17,5 @@
global $title;
idxPrefix("../");
Mainhead("- Services".$title);
- print("<IMG SRC=\"../pics/kolab_logo.gif\">");
}
?>
Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/service/index.php,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- index.php 22 May 2003 18:49:51 -0000 1.6
+++ index.php 14 Jun 2003 13:51:39 -0000 1.7
@@ -5,25 +5,24 @@
This program is Free Software under the GNU General Public License (>=v2).
Read the file COPYING that comes with this packages for details.
*/
- include("head.php");
- This("service/");
- Head();
+
+ // checks if this file is openend by another file
+ include_once("head.php");
+ This("service/");
+ Head();
?>
-<TABLE ALIGN=CENTER WIDTH=90%>
-<TR><TD HEIGHT=20></TD></TR>
-<TR><TD><CENTER><H1>Enable or Disable individual Services</H1></CENTER></TD></TR>
-<TR><TD>
+<div class="maintitle">Enable or Disable individual Services</div>
+<div class="contentsimple">
<p>Using legacy services poses a security thread due to leakage of cleartext passwords, lack of authenticity and privacy.</p>
<p>The legacy Freebusy Support (FTP and HTTP) is only required for Outlook2000 clients.
Under all other circumstances it is advised to use the secure <a href="http://www.webdav.org">WebDAV</a>
over TLS instead (WebDAV is enabled by default and may not be deactivated).</p>
<p>Further details with regards to security considerations are available on the
-internet at the <a href="http://kolab.kde.org">Kolab</a> webserver. </p></TD></TR>
-<TR><TD HEIGHT=20></TD></TR>
-<TD><CENTER>
-
+internet at the <a href="http://kolab.kde.org">Kolab</a> webserver.</p>
+</div>
<?
+
function debug ($a) {
// print "debug: $a<br>\n";
}
@@ -106,50 +105,50 @@
ldap_free_result($result);
}
?>
-
-<TABLE WIDTH=75% BORDER=1 CELLSPACING=0 bgcolor="#dcdcdc" CELLPADDING=3 nosave align=center>
-<tr><th> Service </th><th> Status </th><th> Action </th></tr>
-<tr><center><td> POP3 service </td><td>
+<div class="contenttable">
+<TABLE class="content" nosave>
+<tr><th class="border"> Service </th><th class="border"> Status </th><th class="border"> Action </th></tr>
+<tr><td class="content"> POP3 service </td><td class="content">
<? if ($pop3=="TRUE")
- print("<span style=\"color:#00FF00\">active</span></td><td><a href=\"index.php?pop3=FALSE\">disable pop3</a>");
- else print("<span style=\"color:#FF0000\">disabled</span></td><td><a href=\"index.php?pop3=TRUE\">activate pop3</a>");
-?></td></center></tr>
+ print("<span class=\"active\">active</span></td><td class=\"content\"><a href=\"index.php?pop3=FALSE\">disable pop3</a>");
+ else print("<span class=\"inactive\">disabled</span></td><td class=\"content\"><a href=\"index.php?pop3=TRUE\">activate pop3</a>");
+?></td></tr>
-<tr><center><td> POP3/SSL service (TCP port 995) </td><td>
+<tr><td class="content"> POP3/SSL service (TCP port 995) </td><td class="content">
<? if ($pop3s=="TRUE")
- print("<span style=\"color:#00FF00\">active</span></td><td><a href=\"index.php?pop3s=FALSE\">disable pop3s</a>");
- else print("<span style=\"color:#FF0000\">disabled</span></td><td><a href=\"index.php?pop3s=TRUE\">activate pop3s</a>");
-?></td></center></tr>
+ print("<span class=\"active\">active</span></td><td class=\"content\"><a href=\"index.php?pop3s=FALSE\">disable pop3s</a>");
+ else print("<span class=\"inactive\">disabled</span></td><td class=\"content\"><a href=\"index.php?pop3s=TRUE\">activate pop3s</a>");
+?></td></tr>
-<tr><center><td> IMAP service </td><td>
+<tr><td class="content"> IMAP service </td><td class="content">
<? if ($imap=="TRUE")
- print("<span style=\"color:#00FF00\">active</span></td><td>(may not be deactivated)");
-?></td></center></tr>
+ print("<span class=\"active\">active</span></td><td class=\"content\"><em class=\"unuseable\">(may not be deactivated)</em>");
+?></td></tr>
-<tr><center><td> IMAP/SSL service (TCP port 993) </td><td>
+<tr><td class="content"> IMAP/SSL service (TCP port 993) </td><td class="content">
<? if ($imaps=="TRUE")
- print("<span style=\"color:#00FF00\">active</span></td><td><a href=\"index.php?imaps=FALSE\">disable imaps</a>");
- else print("<span style=\"color:#FF0000\">disabled</span></td><td><a href=\"index.php?imaps=TRUE\">activate imaps</a>");
-?> </td></center></tr>
+ print("<span class=\"active\">active</span></td><td class=\"content\"><a href=\"index.php?imaps=FALSE\">disable imaps</a>");
+ else print("<span class=\"inactive\">disabled</span></td><td class=\"content\"><a href=\"index.php?imaps=TRUE\">activate imaps</a>");
+?></td></tr>
-<tr><center><td> Sieve service (TCP port 2000) </td><td>
+<tr><td class="content"> Sieve service (TCP port 2000) </td><td class="content">
<? if ($sieve=="TRUE")
- print("<span style=\"color:#00FF00\">active</span></td><td><a href=\"index.php?sieve=FALSE\">disable sieve</a>");
- else print("<span style=\"color:#FF0000\">disabled</span></td><td><a href=\"index.php?sieve=TRUE\">activate sieve</a>");
-?> </td></center></tr>
+ print("<span class=\"active\">active</span></td><td class=\"content\"><a href=\"index.php?sieve=FALSE\">disable sieve</a>");
+ else print("<span class=\"inactive\">disabled</span></td><td class=\"content\"><a href=\"index.php?sieve=TRUE\">activate sieve</a>");
+?></td></tr>
-<tr><center><td> FTP free-busy service </td><td>
+<tr><td class="content"> FTP free-busy service </td><td class="content">
<? if ($ftp=="TRUE")
- print("<span style=\"color:#00FF00\">active</span></td><td><a href=\"index.php?ftp=FALSE\">disable ftp</a>");
- else print("<span style=\"color:#FF0000\">disabled</span></td><td><a href=\"index.php?ftp=TRUE\">activate ftp</a>");
-?></td></center></tr>
+ print("<span class=\"active\">active</span></td><td class=\"content\"><a href=\"index.php?ftp=FALSE\">disable ftp</a>");
+ else print("<span class=\"inactive\">disabled</span></td><td class=\"content\"><a href=\"index.php?ftp=TRUE\">activate ftp</a>");
+?></td></tr>
-<tr><center><td> HTTP free-busy service </td><td>
+<tr><td class="content"> HTTP free-busy service </td><td class="content">
<? if ($http=="TRUE")
- print("<span style=\"color:#00FF00\">active</span></td><td><a href=\"index.php?http=FALSE\">disable http</a>");
- else print("<span style=\"color:#FF0000\">disabled</span></td><td><a href=\"index.php?http=TRUE\">activate http</a>");
+ print("<span class=\"active\">active</span></td><td class=\"content\"><a href=\"index.php?http=FALSE\">disable http</a>");
+ else print("<span class=\"inactive\">disabled</span></td><td class=\"content\"><a href=\"index.php?http=TRUE\">activate http</a>");
?>
-</td></center></tr>
+</td></tr>
<!-- <tr><center><td> HTTPS service (TCP port 443) </td>
<td> <span style="color:#00FF00">active</span></td><td> (informational) </td></center></tr>
@@ -162,18 +161,132 @@
-->
</table>
-
+</div>
+<? echo "\n\n"; ?>
+<div class="server">
<?
+// server configuration
+?>
+<div class="maintitle">Server Settings</div>
+<?
+
+$hostname = "";
+$mydomain = "";
+$change = "";
+
+// print_r($HTTP_GET_VARS);
+
+if (isset($HTTP_GET_VARS['change'])) $change = trim(urldecode($HTTP_GET_VARS['change']));
+if (isset($HTTP_GET_VARS['hostname'])) $hostname = trim(urldecode($HTTP_GET_VARS['hostname']));
+if (isset($HTTP_GET_VARS['mydomain'])) $mydomain = trim(urldecode($HTTP_GET_VARS['mydomain']));
+if (!($uid = $_SERVER["PHP_AUTH_USER"]) ||
+ !($password=$_SERVER['PHP_AUTH_PW']) ||
+ !($bind_dn = uid2dn($uid)) ||
+ !($group = uid2group($uid)))
+ array_push($errors, "Internal Error: could not read credentials");
+
+if ($group != "admin") array_push($errors, "Error: invalid permissions");
+
+if (isset($_SESSION['ldap_server'])) $ldap_server=$_SESSION['ldap_server'];
+ else $ldap_server = "127.0.0.1";
+if (isset($_SESSION['ldap_port'])) $ldap_port=$_SESSION['ldap_port'];
+ else $ldap_port = 389;
+if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
+ else $base_dn = 'k=kolab' ;
+
+$myself=$_SERVER['PHP_SELF'];
+
+if (!($link=ldap_connect($ldap_server,$ldap_port)) ||
+ !ldap_bind($link, $bind_dn, $password) ) {
+ array_push($errors, "LDAP Error: could not connect to ldap://$ldap_server:$ldap_port ".ldap_error($link));
+}
+
+if (!$errors) {
+
+ switch ($change) {
+ case "change":
+ $attrs = array();
+ if ($hostname) $attrs['fqhostname'][0] = $hostname;
+ if ($mydomain) {
+ if (($result = ldap_read($link, "k=kolab,".$base_dn, "(objectclass=*)")) &&
+ ($entry = ldap_first_entry($link,$result)) &&
+ ($dattrs = ldap_get_attributes($link,$entry))) {
+ $domain = $dattrs['postfix-mydomain'][0];
+ ldap_free_result($result);
+ }
+ $attrs['postfix-mydomain'][0] = $mydomain;
+ # now we go through the whole LDAP tree and change the email domain
+ $result = ldap_search($link, $base_dn, "(|(mail=*)(alias=*))");
+ if ($result) {
+ $entry = ldap_first_entry($link, $result);
+ if ($entry) {
+ $dn = ldap_get_dn($link,$entry);
+ do {
+ $newattrs = array();
+ $person = ldap_get_attributes($link,$entry);
+ if (!empty($person['mail']) && stristr($person['mail'][0], $domain)) {
+ $newattrs['mail'] =
+ substr($person['mail'][0], 0, strpos($person['mail'][0],'@'))."@".$mydomain;
+ }
+ if (!empty($person['alias'])) {
+ for ($i=0; $i < $person['alias']['count']; $i++) {
+ if (!empty($person['alias'][$i]) &&
+ stristr($person['alias'][$i], $domain)) {
+ $newattrs['alias'][$i] =
+ substr($person['alias'][$i], 0, strpos($person['alias'][$i],'@'))."@".$mydomain;
+ }
+ }
+ }
+ if (!ldap_modify($link, $dn, $newattrs))
+ array_push($errors, "LDAP Error: could not modify object $dn ".ldap_error($link));
+ $entry = ldap_next_entry($link, $entry);
+ } while ($entry);
+ }
+ ldap_free_result($result);
+ }
+ }
+
+ if (!ldap_modify ($link,"k=kolab,".$_SESSION['base_dn'],$attrs))
+ array_push($errors, "LDAP Error: failed to modify kolab config object ".ldap_error($link));
+ break;
+ }
+
+ if (($result = ldap_read($link, "k=kolab,".$_SESSION['base_dn'], "(objectclass=*)")) &&
+ ($entry = ldap_first_entry($link, $result)) &&
+ ($attrs = ldap_get_attributes($link, $entry))) {
+ $hostname = $attrs['fqhostname'][0];
+ $mydomain = $attrs['postfix-mydomain'][0];
+ ldap_free_result($result);
+ } else array_push($errors, "LDAP Error: could not kolab configuration object ".ldap_error($link));
+
+ ldap_close($link);
+ print("<div class=\"contenttable\"><form method=\"GET\" action=\"$myself\">\n");
+ print("<TABLE class=\"contentform\" nosave>\n");
+ print("<tr><th> Attribute </th><th> Value </th><th> Comment </th></tr>\n");
+ print("<tr><td> Hostname</td>\n");
+ print("<td><input type=\"text\" name=\"hostname\" size=25 maxlength=80 value=\"$hostname\"></td>\n");
+ print("<td> This hostname will be given by the Mail Server and the IMAP Server to the clients </td></tr>\n");
+ print("<tr><td> E-Mail Domain</td>\n");
+ print("<td><input type=\"text\" name=\"mydomain\" size=25 maxlength=80 value=\"$mydomain\"></td>\n");
+ print("<td> Be advised that renaming the E-Mail Domain affects all E-Mail Addresses! </td></tr>\n");
+ print("</table>\n");
+ print("<input type=\"hidden\" name=\"change\" value=\"change\">\n");
+
+ print("<table class=\"button\"><tr>\n");
+ printf("<td><input type=\"image\" src=\"../pics/button_ok.png\" name=\"change\"></td>");
+ printf("<td><a href=\"../index.php\"> <img src=\"../pics/button_cancel.png\" alt=\"cancel\"></a></td></tr>\n");
+ printf("</table></form></div>\n");
+}
+print("</div");
+
if ($errors) {
- print("<TABLE WIDTH=\"100%\" CELLSPACING=20 CELLPADDING=0 BORDER=0>\n");
- print("<TR><TD HEIGHT=20></TD></TR>\n");
- print("<TR><TD><H3> There were Errors : </H3></TD></TR>\n");
- print("<TR><TD>\n");
- foreach ($errors as $message) print("<span style=\"color:#FF0000\">".$message."</span><br>");
+ print("<TABLE style=\"errors\">\n");
+ print("<TR><TD class=\"head\"> There were Errors : </TD></TR>\n");
+ print("<TR><TD class=\"body\">\n");
+ foreach ($errors as $message) print($message);
print("</TD></TR>\n");
print("</TABLE>\n");
}
+
?>
-</CENTER></TD></TR></TABLE>
-</FONT>
<? Foot(); ?>
- Previous message: [Kolab-devel] server/kolab/kolab/admin/server head.php,1.4,1.5 index.php,1.6,1.7 by martin at doto.intevation.de
- Next message: [Kolab-devel] server/kolab/kolab/admin/sharedfolder create_sharedfolder.php,1.5,1.6 head.php,1.4,1.5 index.php,1.6,1.7 by martin at doto.intevation.de
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the devel
mailing list