summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2hg <hg@kolab.org>2005-06-19 15:25:31 (GMT)
committercvs2hg <hg@kolab.org>2005-06-19 15:25:31 (GMT)
commiteb9d65d3e3c4af3414d8a981c17e69bd863f1f3e (patch)
tree2c45c7eeb8731cc4f01780d3997332998c63bca9
parentea599645290f2c1f5e9a7f2417965b94c1b135da (diff)
downloadkolab-webadmin-eb9d65d3e3c4af3414d8a981c17e69bd863f1f3e.tar.gz
fixup commit for tag '2.0-proko2_m2c'2.0-proko2_m2c
-rw-r--r--ChangeLog20
-rw-r--r--Makefile.am131
-rw-r--r--configure.ac2
-rw-r--r--kolab-webadmin.spec.in14
-rw-r--r--php/admin/include/auth.class.php239
-rw-r--r--php/admin/include/authenticate.php3
-rw-r--r--php/admin/include/debug.php65
-rw-r--r--php/admin/include/form.class.php220
-rw-r--r--php/admin/include/headers.php2
-rw-r--r--php/admin/include/ldap.class.php167
-rw-r--r--php/admin/include/menu.php30
-rw-r--r--php/admin/include/mysmarty.php.in57
-rw-r--r--php/admin/templates/en/addrdeleted.tpl12
-rw-r--r--php/admin/templates/en/addresslist.tpl24
-rw-r--r--php/admin/templates/en/addrlistall.tpl22
-rw-r--r--php/admin/templates/en/admindeleted.tpl12
-rw-r--r--php/admin/templates/en/adminlistall.tpl27
-rw-r--r--php/admin/templates/en/createuser.tpl107
-rw-r--r--php/admin/templates/en/distlistall.tpl26
-rw-r--r--php/admin/templates/en/erfrakon.tpl27
-rw-r--r--php/admin/templates/en/formcontainer.tpl8
-rw-r--r--php/admin/templates/en/forward.tpl15
-rw-r--r--php/admin/templates/en/intevation.tpl30
-rw-r--r--php/admin/templates/en/kdab.tpl24
-rw-r--r--php/admin/templates/en/kde.tpl22
-rw-r--r--php/admin/templates/en/kolab.tpl103
-rw-r--r--php/admin/templates/en/login.tpl22
-rw-r--r--php/admin/templates/en/maintainerdeleted.tpl12
-rw-r--r--php/admin/templates/en/maintainerlistall.tpl27
-rw-r--r--php/admin/templates/en/page.tpl89
-rw-r--r--php/admin/templates/en/service.tpl67
-rw-r--r--php/admin/templates/en/sflistall.tpl27
-rw-r--r--php/admin/templates/en/userdeleted.tpl12
-rw-r--r--php/admin/templates/en/userlistall.tpl27
-rw-r--r--php/admin/templates/en/vacation.tpl22
-rw-r--r--php/admin/templates/en/welcome.tpl9
-rw-r--r--www/admin/addressbook/addr.php88
-rw-r--r--www/admin/addressbook/index.php56
-rw-r--r--www/admin/administrator/admin.php59
-rw-r--r--www/admin/administrator/index.php57
-rw-r--r--www/admin/distributionlist/index.php42
-rw-r--r--www/admin/distributionlist/list.php66
-rw-r--r--www/admin/index.php45
-rw-r--r--www/admin/kolab/erfrakon.php26
-rw-r--r--www/admin/kolab/index.php3
-rw-r--r--www/admin/kolab/intevation.php1
-rw-r--r--www/admin/kolab/kdab.php1
-rw-r--r--www/admin/kolab/kde.php3
-rw-r--r--www/admin/logout.php28
-rw-r--r--www/admin/maintainer/index.php33
-rw-r--r--www/admin/maintainer/maintainer.php61
-rw-r--r--www/admin/pics/kde.jpgbin7185 -> 99149 bytes
-rw-r--r--www/admin/pics/kolab_logo.pngbin4902 -> 5421 bytes
-rw-r--r--www/admin/service/index.php153
-rw-r--r--www/admin/service/service.php294
-rw-r--r--www/admin/sharedfolder/index.php13
-rw-r--r--www/admin/sharedfolder/sf.php137
-rw-r--r--www/admin/style.css17
-rw-r--r--www/admin/user/forward.php42
-rw-r--r--www/admin/user/index.php95
-rw-r--r--www/admin/user/user.php447
-rw-r--r--www/admin/user/vacation.php86
62 files changed, 1792 insertions, 1784 deletions
diff --git a/ChangeLog b/ChangeLog
index 9885eb1..b1e1a5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,7 @@
2004-07-08 13:44 steffen
- * php/admin/include/form.class.php, www/admin/kolabsharedfolder/sf.php:
+ * php/admin/include/form.class.php, www/admin/sharedfolder/sf.php:
new permissions "read anon" and "read hidden" + allow special
usernames anyone and anonymous in ACLs
@@ -36,7 +36,7 @@
2004-07-07 13:45 steffen
* configure.ac, php/admin/include/ldap.class.php,
- www/admin/kolabsharedfolder/sf.php: fix for issue215
+ www/admin/sharedfolder/sf.php: fix for issue215
2004-07-01 01:40 steffen
@@ -50,7 +50,7 @@
2004-06-28 16:00 steffen
- * kolab-webadmin.spec.in, www/admin/kolabsharedfolder/sf.php: fix for
+ * kolab-webadmin.spec.in, www/admin/sharedfolder/sf.php: fix for
issues 204 and 205
2004-06-23 12:26 steffen
@@ -60,8 +60,8 @@
2004-06-21 03:46 steffen
- * configure.ac, www/admin/kolabsharedfolder/index.php,
- www/admin/kolabsharedfolder/sf.php: shared folder handling + multiple
+ * configure.ac, www/admin/sharedfolder/index.php,
+ www/admin/sharedfolder/sf.php: shared folder handling + multiple
bugfixes
2004-06-18 13:25 steffen
@@ -76,7 +76,7 @@
* php/admin/include/ldap.class.php,
www/admin/distributionlist/list.php, www/admin/user/user.php: fix
- for issue191 + "kolabdelegate"
+ for issue191 + "delegate"
2004-06-15 03:59 steffen
@@ -136,7 +136,7 @@
2004-05-26 01:12 steffen
* www/admin/user/user.php: removed a bit of debug output and made
- kolabhomeserver readonly when it should be
+ homeserver readonly when it should be
2004-05-25 05:25 steffen
@@ -145,7 +145,7 @@
2004-05-24 13:53 steffen
* php/admin/include/auth.class.php, www/admin/user/user.php:
- reasonable default for kolabhomeserver. Check IP address when
+ reasonable default for homeServer. Check IP address when
authenticating to make it more difficult to hijack a session
2004-05-21 15:03 steffen
@@ -155,7 +155,7 @@
2004-05-20 00:26 steffen
* php/admin/templates/en/vacation.tpl, www/admin/user/user.php:
- kolabhomeserver entry + escaping of vacation text + fix for buggy
+ homeServer entry + escaping of vacation text + fix for buggy
html-parser in mozilla 1.0
2004-05-19 13:20 steffen
@@ -205,7 +205,7 @@
www/admin/pics/intevation_logo.png, www/admin/pics/kdab.png,
www/admin/pics/kde.jpg, www/admin/pics/kolab_logo.png,
www/admin/service/index.php, www/admin/service/service.php,
- www/admin/kolabsharedfolder/index.php, www/admin/kolabsharedfolder/sf.php,
+ www/admin/sharedfolder/index.php, www/admin/sharedfolder/sf.php,
www/admin/user/forward.php, www/admin/user/index.php,
www/admin/user/user.php, www/admin/user/vacation.php: new
webinterface for the kolab server
diff --git a/Makefile.am b/Makefile.am
index 90126ea..208d4f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,14 +10,9 @@ do_subst = sed \
noinst_HEADERS = @PACKAGE@.spec
-WSTOPLEVEL_FILES = www/favicon.ico
-
-wstopleveldir = $(wsdocrootdir)
-wstoplevel_DATA = $(WSTOPLEVEL_FILES)
-
WSADMIN_FILES = www/admin/index.php \
www/admin/logout.php \
- www/admin/style.css
+ www/admin/style.css
wsadmindir = $(wsdocrootdir)/admin
wsadmin_DATA = $(WSADMIN_FILES)
@@ -42,9 +37,7 @@ wsdistributionlist_DATA = $(WSDISTRIBUTIONLIST_FILES)
WSKOLAB_FILES = www/admin/kolab/erfrakon.php \
www/admin/kolab/index.php \
- www/admin/kolab/versions.php \
www/admin/kolab/intevation.php \
- www/admin/kolab/codefusion.php \
www/admin/kolab/kdab.php \
www/admin/kolab/kde.php
@@ -58,7 +51,6 @@ wsmaintainerdir = $(wsadmindir)/maintainer
wsmaintainer_DATA = $(WSMAINTAINER_FILES)
WSPICS_FILES = www/admin/pics/erfrakon.png \
- www/admin/pics/codefusion.png \
www/admin/pics/intevation_logo.png \
www/admin/pics/kdab.png \
www/admin/pics/kde.jpg \
@@ -72,110 +64,71 @@ WSSERVICE_FILES = www/admin/service/index.php
wsservicedir = $(wsadmindir)/service
wsservice_DATA = $(WSSERVICE_FILES)
-WSsharedfolder_FILES = www/admin/sharedfolder/sf.php \
+WSSHAREDFOLDER_FILES = www/admin/sharedfolder/sf.php \
www/admin/sharedfolder/index.php
wssharedfolderdir = $(wsadmindir)/sharedfolder
-wssharedfolder_DATA = $(WSsharedfolder_FILES)
+wssharedfolder_DATA = $(WSSHAREDFOLDER_FILES)
WSUSER_FILES = www/admin/user/forward.php \
www/admin/user/index.php \
www/admin/user/user.php \
- www/admin/user/vacation.php \
- www/admin/user/deliver.php
+ www/admin/user/vacation.php
wsuserdir = $(wsadmindir)/user
wsuser_DATA = $(WSUSER_FILES)
phpadmindir = $(phpdir)/admin
-php/admin/include/config.php: Makefile php/admin/include/config.php.in
+php/admin/include/mysmarty.php: Makefile php/admin/include/mysmarty.php.in
$(mkinstalldirs) php/admin/include
- $(do_subst) <$(srcdir)/php/admin/include/config.php.in >$@
+ $(do_subst) <$(srcdir)/php/admin/include/mysmarty.php.in >$@
+CLEANFILES += php/admin/include/mysmarty.php
+EXTRA_DIST += php/admin/include/mysmarty.php.in
-CLEANFILES += php/admin/include/config.php
-EXTRA_DIST += php/admin/include/config.php.in
-
-PHP_INCLUDES = php/admin/include/config.php \
- php/admin/include/menu.php \
+PHP_INCLUDES = php/admin/include/menu.php \
php/admin/include/debug.php \
+ php/admin/include/Sieve.php \
php/admin/include/form.class.php \
php/admin/include/auth.class.php \
php/admin/include/ldap.class.php \
- php/admin/include/sieveutils.class.php \
php/admin/include/mysmarty.php \
php/admin/include/headers.php \
- php/admin/include/authenticate.php \
- php/admin/include/locale.php \
- php/admin/include/Sieve.php
+ php/admin/include/authenticate.php
phpincludesdir = $(phpadmindir)/include
phpincludes_DATA = $(PHP_INCLUDES)
-PHP_TEMPLATES = php/admin/templates/maintainerdeleted.tpl \
- php/admin/templates/kde.tpl \
- php/admin/templates/addrdeleted.tpl \
- php/admin/templates/userdeleted.tpl \
- php/admin/templates/page.tpl \
- php/admin/templates/addresslist.tpl \
- php/admin/templates/sflistall.tpl \
- php/admin/templates/erfrakon.tpl \
- php/admin/templates/codefusion.tpl \
- php/admin/templates/adminlistall.tpl \
- php/admin/templates/login.tpl \
- php/admin/templates/maintainerlistall.tpl \
- php/admin/templates/kolab.tpl \
- php/admin/templates/versions.tpl \
- php/admin/templates/addrlistall.tpl \
- php/admin/templates/forward.tpl \
- php/admin/templates/deliver.tpl \
- php/admin/templates/distlistall.tpl \
- php/admin/templates/kdab.tpl \
- php/admin/templates/userlistall.tpl \
- php/admin/templates/service.tpl \
- php/admin/templates/welcome.tpl \
- php/admin/templates/systemaliasnagscreen.tpl \
- php/admin/templates/intevation.tpl \
- php/admin/templates/vacation.tpl \
- php/admin/templates/createuser.tpl \
- php/admin/templates/formcontainer.tpl \
- php/admin/templates/admindeleted.tpl
+PHP_TEMPLATES_EN = php/admin/templates/en/maintainerdeleted.tpl \
+ php/admin/templates/en/kde.tpl \
+ php/admin/templates/en/addrdeleted.tpl \
+ php/admin/templates/en/userdeleted.tpl \
+ php/admin/templates/en/page.tpl \
+ php/admin/templates/en/addresslist.tpl \
+ php/admin/templates/en/sflistall.tpl \
+ php/admin/templates/en/erfrakon.tpl \
+ php/admin/templates/en/adminlistall.tpl \
+ php/admin/templates/en/login.tpl \
+ php/admin/templates/en/maintainerlistall.tpl \
+ php/admin/templates/en/kolab.tpl \
+ php/admin/templates/en/addrlistall.tpl \
+ php/admin/templates/en/forward.tpl \
+ php/admin/templates/en/distlistall.tpl \
+ php/admin/templates/en/kdab.tpl \
+ php/admin/templates/en/userlistall.tpl \
+ php/admin/templates/en/service.tpl \
+ php/admin/templates/en/welcome.tpl \
+ php/admin/templates/en/intevation.tpl \
+ php/admin/templates/en/vacation.tpl \
+ php/admin/templates/en/createuser.tpl \
+ php/admin/templates/en/formcontainer.tpl \
+ php/admin/templates/en/admindeleted.tpl
phptemplatesdir = $(phpadmindir)/templates
-phptemplates_DATA = $(PHP_TEMPLATES)
-
-
-### i18n stuff
-# gettextize didn't make much sense for a php project
-# so we install the .mo files "manually"
-# PENDING(steffen): Improve this
-
-MSGFMT=msgfmt
-
-.po.mo:
- $(MSGFMT) -o $@ $<
+phptemplatesendir = $(phptemplatesdir)/en
+phptemplatesen_DATA = $(PHP_TEMPLATES_EN)
-
-PHP_LOCALE_DE_PO = php/admin/locale/de/LC_MESSAGES/messages.po
-PHP_LOCALE_DE_MO = php/admin/locale/de/LC_MESSAGES/messages.mo
-PHP_LOCALE_FR_PO = php/admin/locale/fr/LC_MESSAGES/messages.po
-PHP_LOCALE_FR_MO = php/admin/locale/fr/LC_MESSAGES/messages.mo
-PHP_LOCALE_NL_PO = php/admin/locale/nl/LC_MESSAGES/messages.po
-PHP_LOCALE_NL_MO = php/admin/locale/nl/LC_MESSAGES/messages.mo
-
-localedir = $(phpadmindir)/locale
-
-phplocalededir = $(localedir)/de/LC_MESSAGES
-phplocalefrdir = $(localedir)/fr/LC_MESSAGES
-phplocalenldir = $(localedir)/nl/LC_MESSAGES
-
-phplocalede_DATA = $(PHP_LOCALE_DE_MO)
-phplocalefr_DATA = $(PHP_LOCALE_FR_MO)
-phplocalenl_DATA = $(PHP_LOCALE_NL_MO)
-
-
-EXTRA_DIST += $(WSTOPLEVEL_FILES) \
- $(WSADMIN_FILES) \
+EXTRA_DIST += $(WSADMIN_FILES) \
$(WSADDRESSBOOK_FILES) \
$(WSADMINISTRATOR_FILES) \
$(WSDISTRIBUTIONLIST_FILES) \
@@ -183,14 +136,12 @@ EXTRA_DIST += $(WSTOPLEVEL_FILES) \
$(WSMAINTAINER_FILES) \
$(WSPICS_FILES) \
$(WSSERVICE_FILES) \
- $(WSsharedfolder_FILES) \
+ $(WSSHAREDFOLDER_FILES) \
$(WSUSER_FILES) \
$(PHP_INCLUDES) \
- $(PHP_TEMPLATES) \
- $(PHP_LOCALE_DE_PO) \
- $(PHP_LOCALE_FR_PO) \
- $(PHP_LOCALE_NL_PO)
+ $(PHP_TEMPLATES_EN)
install-data-hook:
$(mkinstalldirs) $(DESTDIR)$(phpadmindir)/templates_c
test -z "$(webserver_usr)" || chown $(webserver_usr) $(DESTDIR)$(phpadmindir)/templates_c
+
diff --git a/configure.ac b/configure.ac
index ecc4559..2999cc7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
AC_PREREQ(2.57)
-m4_define(_VERSION,0.4.0)
+m4_define(_VERSION,0.2.8)
AC_INIT([kolab-webadmin],[_VERSION],[kolab-devel@kolab.org])
AC_CONFIG_SRCDIR(php/admin/include/ldap.class.php)
AC_CONFIG_AUX_DIR(.)
diff --git a/kolab-webadmin.spec.in b/kolab-webadmin.spec.in
index 3c58fe6..ec68b73 100644
--- a/kolab-webadmin.spec.in
+++ b/kolab-webadmin.spec.in
@@ -24,7 +24,7 @@
# package information
Name: @PACKAGE@
Summary: Kolab Groupware Server Web Administration Interface
-URL: http://www.kolab.org/
+URL: http://kolab.kde.org/
Vendor: Klaraelvdalens Datakonsult AB
Packager: Klaraelvdalens Datakonsult AB
Distribution: OpenPKG
@@ -41,22 +41,18 @@ Source0: kolab-webadmin-%{version}.tar.gz
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
-BuildPreReq: OpenPKG, openpkg >= 2.0.0
-PreReq: OpenPKG, openpkg >= 2.2.0, kolabd >= 1.9.4-20050606
-PreReq: apache >= 1.3.31-2.2.0, apache::with_gdbm_ndbm = yes, apache::with_mod_auth_ldap = yes, apache::with_mod_dav = yes, apache::with_mod_php = yes, apache::with_mod_php_gdbm = yes, apache::with_mod_php_gettext = yes, apache::with_mod_php_imap = yes, apache::with_mod_php_openldap = yes, apache::with_mod_php_xml = yes, apache::with_mod_ssl = yes
-PreReq: php-smarty >= 2.6.3
+BuildPreReq: OpenPKG, openpkg >= 20040216
+PreReq: OpenPKG, openpkg >= 20040216, kolab
+PreReq: apache >= 1.3.29-20031124, apache::with_gdbm_ndbm = yes, apache::with_mod_auth_ldap = yes, apache::with_mod_dav = yes, apache::with_mod_php = yes, apache::with_mod_php_gdbm = yes, apache::with_mod_php_gettext = yes, apache::with_mod_php_imap = yes, apache::with_mod_php_openldap = yes, apache::with_mod_php_xml = yes, apache::with_mod_php_pear = yes, apache::with_mod_ssl = yes
+PreReq: php-smarty >= 2.6.2
AutoReq: no
AutoReqProv: no
-%option kolab_version snapshot
-
%description
Web based administration interface for The Kolab Groupware Server
%prep
%setup -q
- %{l_shtool} subst -e 's;@kolab_version@;%{kolab_version};g' \
- www/admin/kolab/versions.php
%build
./configure -prefix=%{l_prefix}
diff --git a/php/admin/include/auth.class.php b/php/admin/include/auth.class.php
index e14ab69..9060183 100644
--- a/php/admin/include/auth.class.php
+++ b/php/admin/include/auth.class.php
@@ -1,6 +1,6 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ * Copyright (c) 2004 KlarÃ��¤lvdalens Datakonsult AB
*
* Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
*
@@ -21,148 +21,131 @@
require_once('ldap.class.php');
require_once('debug.php');
require_once('mysmarty.php');
-require_once('locale.php');
class KolabAuth {
- function KolabAuth( $do_auth = true, $params = array() ) {
- $this->params = $params;
- if( isset( $_GET['logout'] ) || isset( $_POST['logout'] ) ) {
- $this->logout();
- } else if( $do_auth ) {
- $this->authenticate();
- }
- }
+ function KolabAuth( $do_auth = true ) {
+ if( isset( $_GET['logout'] ) || isset( $_POST['logout'] ) ) {
+ $this->logout();
+ } else if( $do_auth ) {
+ $this->authenticate();
+ }
+ }
- function authenticate() {
- global $ldap;
- $this->error_string = false;
- if( !isset( $ldap ) ) {
- $this->error_string = _("Server error, no ldap object!");
- return false;
- }
- // Anon. bind first
- if( !$ldap->bind( $_SESSION['php_dn'], $_SESSION['php_pw'] ) ) {
- $this->error_string = _("Could not bind to LDAP server: ").$ldap->error();
+ function authenticate() {
+ global $ldap;
+ $this->error_string = false;
+ if( !isset( $ldap ) ) {
+ $this->error_string = _("Server error, no ldap object!");
+ return false;
+ }
+ // Anon. bind first
+ if( !$ldap->bind( $_SESSION['php_dn'], $_SESSION['php_pw'] ) ) {
+ $this->error_string = _("Could not bind to LDAP server: ").$ldap->error();
+ $this->gotoLoginPage();
+ }
+ if( $this->isAuthenticated() ) {
+ $bind_result = $ldap->bind( $_SESSION['auth_dn'], $_SESSION['auth_pw'] );
+ } else {
+ $bind_result = false;
+ }
+ if( !$bind_result ) {
+ // Anon. bind first
+ if( !$ldap->bind() ) {
+ $this->error_string = _("Could not bind to LDAP server");
+ $this->gotoLoginPage();
+ }
+ // User not logged in, check login/password
+ if( isset( $_POST['username'] ) && isset( $_POST['password'] ) ) {
+ $dn = $ldap->dnForUid( $_POST['username'] );
+ if( $dn ) {
+ $bind_result = $ldap->bind( $dn, $_POST['password'] );
+ if( $bind_result ) {
+ // All OK!
+ $_SESSION['auth_dn'] = $dn;
+ $_SESSION['auth_user'] = $_POST['username'];
+ $_SESSION['auth_pw'] = $_POST['password'];
+ $_SESSION['auth_group'] = $ldap->groupForUid($_POST['username']);
+ $_SESSION['remote_ip'] = $_SERVER['REMOTE_ADDR'];
+ return true;
+ } else {
+ $this->error_string = _("Wrong username or password");
$this->gotoLoginPage();
- }
- if( $this->isAuthenticated() ) {
- $bind_result = $ldap->bind( $_SESSION['auth_dn'], $_SESSION['auth_pw'] );
- } else {
- $bind_result = false;
- }
- if( !$bind_result ) {
- // Anon. bind first
- if( !$ldap->bind() ) {
- $this->error_string = _("Could not bind to LDAP server");
- $this->gotoLoginPage();
- }
- // User not logged in, check login/password
- if( isset( $_POST['username'] ) && isset( $_POST['password'] ) ) {
- $dn = $ldap->dnForUid( $_POST['username'] );
- if (!$dn) {
- $dn = $ldap->dnForMail( $_POST['username'] ); // try mail attribute
- }
- if( $dn ) {
- $auth_user = $ldap->uidForDn( $dn );
- $auth_group = $ldap->groupForUid( $auth_user );
- $tmp_group = ($auth_user=='manager')?'manager':$auth_group;
- if( !in_array( $tmp_group, $this->params['allow_user_classes'] ) ) {
- $this->error_string = _("User class '$tmp_group' is denied access");
- $this->gotoLoginPage();
- }
- $bind_result = $ldap->bind( $dn, $_POST['password'] );
- if( $bind_result ) {
- // All OK!
- $_SESSION['auth_dn'] = $dn;
- $_SESSION['auth_user'] = $auth_user;
- $_SESSION['auth_pw'] = $_POST['password'];
- $_SESSION['auth_group'] = $auth_group;
- $_SESSION['remote_ip'] = $_SERVER['REMOTE_ADDR'];
- return true;
- } else {
- $this->error_string = _("Wrong username or password");
- $this->gotoLoginPage();
- }
- } else {
- $this->error_string = _("Wrong username or password");
- //$this->error_string = "Dn not found";
- $this->gotoLoginPage();
- }
- } else {
- $this->error_string = _('Please log in as a valid user');
- $this->gotoLoginPage();
- }
+ }
} else {
- // All OK, user already logged in
- return true;
+ $this->error_string = _("Wrong username or password");
+ //$this->error_string = "Dn not found";
+ $this->gotoLoginPage();
}
- }
+ } else {
+ $this->error_string = _('Please log in as a valid user');
+ $this->gotoLoginPage();
+ }
+ } else {
+ // All OK, user already logged in
+ return true;
+ }
+ }
- function logout() {
- session_unset();
- session_destroy();
- $this->error_string = "";
- //$this->gotoLoginPage();
- Header("Location: /admin/");
- }
+ function logout() {
+ session_unset();
+ session_destroy();
+ $this->error_string = "";
+ //$this->gotoLoginPage();
+ Header("Location: /admin/");
+ }
- function handleLogin() {
- if( isset( $_POST['login'] ) ) {
- $this->authenticate();
- } else if( isset( $_POST['logout'] ) ) {
- $this->logout();
- }
- }
+ function handleLogin() {
+ if( isset( $_POST['login'] ) ) {
+ $this->authenticate();
+ } else if( isset( $_POST['logout'] ) ) {
+ $this->logout();
+ }
+ }
- function gotoLoginPage() {
- global $topdir;
- $smarty =& new MySmarty();
- $smarty->assign( 'topdir', $topdir );
- $smarty->assign( 'uid', '' );
- $smarty->assign( 'group', '' );
- $smarty->assign( 'page_title', _('Login') );
- $smarty->assign( 'menuitems', array() );
- $smarty->assign( 'errors', array( $this->error() ) );
- $smarty->assign( 'maincontent', 'login.tpl' );
- $smarty->display('page.tpl');
- exit();
- }
+ function gotoLoginPage() {
+ global $topdir;
+ $smarty =& new MySmarty();
+ $smarty->assign( 'topdir', $topdir );
+ $smarty->assign( 'uid', '' );
+ $smarty->assign( 'group', '' );
+ $smarty->assign( 'page_title', 'Login' );
+ $smarty->assign( 'menuitems', array() );
+ $smarty->assign( 'errors', array( $this->error() ) );
+ $smarty->assign( 'maincontent', 'login.tpl' );
+ $smarty->display('page.tpl');
+ exit();
+ }
- function isAuthenticated() {
- return isset( $_SESSION['auth_dn'] ) && $_SESSION['remote_ip'] == $_SERVER['REMOTE_ADDR'];
- }
+ function isAuthenticated() {
+ return isset( $_SESSION['auth_dn'] ) && $_SESSION['remote_ip'] == $_SERVER['REMOTE_ADDR'];
+ }
- function dn() {
- if( $this->isAuthenticated() ) return $_SESSION['auth_dn'];
- else return false;
- }
+ function dn() {
+ if( $this->isAuthenticated() ) return $_SESSION['auth_dn'];
+ else return false;
+ }
- function uid() {
- if( $this->isAuthenticated() ) return $_SESSION['auth_user'];
- else return false;
- }
+ function uid() {
+ if( $this->isAuthenticated() ) return $_SESSION['auth_user'];
+ else return false;
+ }
- function group() {
- if( $this->isAuthenticated() ) return $_SESSION['auth_group'];
- }
-
- function password() {
- if( $this->isAuthenticated() ) {
- return $_SESSION['auth_pw'];
- }
- else return false;
- }
+ function group() {
+ if( $this->isAuthenticated() ) return $_SESSION['auth_group'];
+ }
- function setDn( $dn ) {$_SESSION['auth_dn'] = $dn;}
- function setUid( $uid ) {$_SESSION['auth_user'] = $uid;}
- function setPassword( $pw ) {$_SESSION['auth_pw'] = $pw;}
+ function password() {
+ if( $this->isAuthenticated() ) {
+ return $_SESSION['auth_pw'];
+ }
+ else return false;
+ }
- function error() {
- return $this->error_string;
- }
+ function error() {
+ return $this->error_string;
+ }
- var $error_string = false;
- var $params;
+ var $error_string = false;
};
/*
Local variables:
@@ -172,4 +155,4 @@ class KolabAuth {
buffer-file-coding-system: utf-8
End:
*/
-?>
+?> \ No newline at end of file
diff --git a/php/admin/include/authenticate.php b/php/admin/include/authenticate.php
index 5c5721e..2e03b92 100644
--- a/php/admin/include/authenticate.php
+++ b/php/admin/include/authenticate.php
@@ -20,9 +20,8 @@
require_once('auth.class.php');
global $auth;
-global $params;
if( !isset($auth) ) {
- $auth =& new KolabAuth(true,$params);
+ $auth =& new KolabAuth;
}
/*
Local variables:
diff --git a/php/admin/include/debug.php b/php/admin/include/debug.php
index ba8c243..58aae0b 100644
--- a/php/admin/include/debug.php
+++ b/php/admin/include/debug.php
@@ -1,40 +1,21 @@
<?php
-/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
-
function getmicrotime() {
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function debug($str) {
- #print $str.'<br/>';
+ #print $str.'<br/>';
}
function debug_var_dump($var) {
- #print '<pre>';
- #var_dump($var);
- #print '</pre>';
+ #print '<pre>';
+ #var_dump($var);
+ #print '</pre>';
}
function backtrace() {
- $debug_array = debug_backtrace();
- $counter = count($debug_array);
- for($tmp_counter = 0; $tmp_counter != $counter; ++$tmp_counter) {
- ?>
+ $debug_array = debug_backtrace();
+ $counter = count($debug_array);
+ for($tmp_counter = 0; $tmp_counter != $counter; ++$tmp_counter) {
+ ?>
<table width="558" height="116" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
<tr>
<td height="38" bgcolor="#D6D7FC"><font color="#000000">function <font color="#FF3300"><?
@@ -44,13 +25,13 @@ function backtrace() {
$args_counter = count($debug_array[$tmp_counter]["args"]);
//print them
for($tmp_args_counter = 0; $tmp_args_counter != $args_counter; ++$tmp_args_counter) {
- echo($debug_array[$tmp_counter]["args"][$tmp_args_counter]);
+ echo($debug_array[$tmp_counter]["args"][$tmp_args_counter]);
- if(($tmp_args_counter + 1) != $args_counter) {
- echo(", ");
- } else {
- echo(" ");
- }
+ if(($tmp_args_counter + 1) != $args_counter) {
+ echo(", ");
+ } else {
+ echo(" ");
+ }
}
?></font><font color="#FF3300">)</font></font></td></tr><tr>
<td bgcolor="#5F72FA"><font color="#FFFFFF">{</font><br>
@@ -60,20 +41,10 @@ function backtrace() {
<?php echo($debug_array[$tmp_counter]["line"]);?></font><br>
<font color="#FFFFFF">}</font></td></tr></table>
<?php
- if(($tmp_counter + 1) != $counter) {
- echo("<br>was called by:<br>");
- }
+ if(($tmp_counter + 1) != $counter) {
+ echo("<br>was called by:<br>");
}
- //exit();
+ }
+ //exit();
}
-
-/*
- Local variables:
- mode: php
- indent-tabs-mode: t
- tab-width: 4
- buffer-file-coding-system: utf-8
- End:
- vim:encoding=utf-8:
- */
?>
diff --git a/php/admin/include/form.class.php b/php/admin/include/form.class.php
index 0fc1af0..e54405d 100644
--- a/php/admin/include/form.class.php
+++ b/php/admin/include/form.class.php
@@ -1,6 +1,6 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ * Copyright (c) 2004 KlarÃ��¿½ï¿½Â¤lvdalens Datakonsult AB
*
* Writen by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
*
@@ -18,8 +18,6 @@
* Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
*/
-require_once('mysmarty.php');
-
class KolabForm {
/*
* $entries should be an array of the form:
@@ -57,7 +55,7 @@ class KolabForm {
}*/
$str .= '<form name="'.$this->name.'" method="post">';
$str .= '<table class="contentformtable">';
- $str .= _('<tr><th>Attribute</th><th>Value</th><th>Comment</th></tr>')."\n";
+ $str .= _('<tr><th>Attribute</th><th>Value</th><th>Comment</th></tr>');
$size = 60;
foreach( $this->entries as $key => $value ) {
@@ -67,168 +65,85 @@ class KolabForm {
if( !isset( $value['value'] ) ) $value['value'] = '';
switch( $value['type'] ) {
case 'hidden': continue;
- case 'password':
- if( ereg( 'readonly', $value['attrs'] ) ) {
- // If readonly, skip it -- passwords are at most write-only
- break;
- }
case '':
// Default is text
$value['type'] = 'text';
case 'input':
case 'text':
+ case 'password':
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td><p class="ctrl">'.$value['value'].'</p><input name="'.$key.'" type="hidden" value="'.$value['value'].'" /></td>';
+ $str .= '<td>'.$value['value'].'<input name="'.$key.'" type="hidden" value="'.$value['value'].'" /></td>';
} else {
$str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="'.$value['value'].'" '.$value['attrs'].' size="'.$size.'" /></td>';
}
$str .= '<td>'.$value['comment'].'</td>';
- $str .= '</tr>'."\n";
- break;
- case 'comment':
- $str .= '<tr>';
- $str .= '<td>'.$value['name'].'</td>';
- $str .= '<td>'.$value['value'].'</td>';
- $str .= '<td>'.$value['comment'].'</td>';
- $str .= '</tr>'."\n";
+ $str .= '</tr>';
break;
case 'textarea':
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td><p class="ctrl">'.htmlentities($value['value']).'</p></td>';
+ $str .= '<td><p>'.htmlentities($value['value']).'</p></td>';
} else {
$str .= '<td><textarea name="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.$value['value'].'</textarea></td>';
}
$str .= '<td>'.$value['comment'].'</td>';
- $str .= '</tr>'."\n";
+ $str .= '</tr>';
break;
case 'checkbox':
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
- if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td><span class="ctrl">'.($value['value']?_('Yes'):_('No')).'</span></td>';
- } else {
- $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="on" '.($value['value']?'checked':'').' '.$value['attrs'].' /></td>';
- }
+ $str .= '<td><input name="'.$key.'" type="'.$value['type'].'" value="on" '.($value['value']?'checked':'').' '.$value['attrs'].' /></td>';
$str .= '<td>'.$value['comment'].'</td>';
- $str .= '</tr>'."\n";
+ $str .= '</tr>';
break;
case 'select':
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
- if( ereg( 'readonly', $value['attrs'] ) ) {
- $str .= '<td><p class="ctrl">'.htmlentities($value['options'][$value['value']]).
- '<input type="hidden" name="'.$key.'" value="'.$value['value'].'" /></p></td>';
- } else {
- $str .= '<td><select name="'.$key.'" '.$value['attrs'].' >'."\n";
+ $str .= '<td><select name="'.$key.'" '.$value['attrs'].' >';
- for( $i = 0; $i < count($value['options']); ++$i) {
- if( $i == $value['value'] ) $s = 'selected';
- else $s = '';
- $str .= '<option value="'.$i.'" '.$s.'>'.htmlentities($value['options'][$i]).'</option>'."\n";
- }
- $str .= '</select>';
- $str .= '</td>';
+ for( $i = 0; $i < count($value['options']); ++$i) {
+ if( $i == $value['value'] ) $s = 'selected';
+ else $s = '';
+ $str .= '<option value="'.$i.'" '.$s.'>'.htmlentities($value['options'][$i]).'</option>';
}
+ $str .= '</select>';
+ $str .= '</td>';
$str .= '<td>'.$value['comment'].'</td>';
- $str .= '</tr>'."\n";
+ $str .= '</tr>';
break;
- case 'aclselect': // Special Kolab entry for ACLs
+ case 'aclselect':
$str .= '<tr>';
$str .= '<td>'.$value['name'].'</td>';
- if( ereg( 'readonly', $value['attrs'] ) ) {
- if( $value['user'] ) $str .= '<td><span class="ctrl">'.htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
- } else {
- $str .= '<td><input name="user_'.$key.'" type="'.$value['type'].'" size="'.($size-15).'" value="'.$value['user'].'" '.$value['attrs'].' />';
- $str .= '<select name="perm_'.$key.'">'."\n";
- if( $value['perm'] ) $selected_perm = $value['perm'];
- else $selected_perm = 'all';
- foreach( array( 'none',
- 'post',
- 'read', 'read/post',
- 'append',
- 'write',
- 'read anon',
- 'read anon/post',
- 'read hidden',
- 'read hidden/post',
- 'all' ) as $perm ) {
- if( $perm == $selected_perm ) $s = 'selected';
- else $s = '';
- $str .= '<option value="'.$perm.'"'.$s.' >'.$perm.'</option>'."\n";
- }
- $str .= '</select>';
- $str .= '</td>';
- }
- $str .= '<td>'.$value['comment'].'</td>';
- $str .= '</tr>'."\n";
- break;
- case 'resourcepolicy': // Special Kolab entry for group/resource policies
- debug("resourcepolicy");
- $ro = ereg( 'readonly', $value['attrs'] );
- $str .= '<tr>';
- $str .= '<td>'.$value['name'].'</td>';
- $str .= '<td>';
- $str .= '<table>';
- $i = 0;
- $tmppol = $value['policies'];
- unset($tmppol['']);
- ksort($tmppol);
- $tmppol[''] = 0;
- $policies = array( _('Always accept'),
- _('Always reject'),
- _('Reject if conflicts'),
- _('Manual if conflicts'),
- _('Manual') );
- foreach( $tmppol as $user => $pol ) {
- debug("form: ".$user." => ".$pol);
- if( $ro ) {
- if( !$user ) continue;
- $str .= '<tr><td>';
- if( $user == 'anyone' ) $str .= '<p class="ctrl">'._('Anyone').'</p>';
- else $str .= '<p class="ctrl">'.htmlentities($user).'</p>';
- $str .= '</td><td><p class="ctrl">'.$policies[$pol].'</p></td></tr>'."\n";
- } else {
- $str .= '<tr><td>';
- if( $user == 'anyone' ) {
- $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.$user.'" '.$value['attrs'].' />';
- } else {
- $str .= '<input name="user_'.$key.'_'.$i.'" type="text" size="'.($size-20)
- .'" value="'.$user.'" '.$value['attrs'].' />';
- }
- $str .= '</td><td><select name="policy_'.$key.'_'.$i.'">'."\n";
- $j = 0;
- foreach( $policies as $p ) {
- if( $j == $pol ) {
- $str .= '<option value="'.$j++.'" selected>'.$p.'</option>'."\n";
- } else {
- $str .= '<option value="'.$j++.'">'.$p.'</option>'."\n";
- }
- }
- $i++;
- $str .= '</select></td></tr>'."\n";
- }
+ $str .= '<td><input name="user_'.$key.'" type="'.$value['type'].'" size="'.($size-15).'" value="'.$value['user'].'" '.$value['attrs'].' />';
+ $str .= '<select name="perm_'.$key.'">';
+ if( $value['perm'] ) $selected_perm = $value['perm'];
+ else $selected_perm = 'all';
+ foreach( array( 'none', 'read', 'post', 'append', 'write', 'read anon', 'read hidden', 'all' ) as $perm ) {
+ if( $perm == $selected_perm ) $s = 'selected';
+ else $s = '';
+ $str .= '<option value="'.$perm.'"'.$s.' >'.$perm.'</option>';
}
- $str .= '</table></td>';
+ $str .= '</select>';
+ $str .= '</td>';
$str .= '<td>'.$value['comment'].'</td>';
- $str .= '</tr>'."\n";
+ $str .= '</tr>';
break;
}
}
$str .= '<tr><td colspan="3" align="center"><input type="submit" name="submit_'.$this->name.'" value="'
.$this->submittext.'" '.$value['attrs'].' /></td></tr>';
- $str .= '</table>'."\n";
+ $str .= '</table>';
foreach( $this->entries as $key => $value ) {
if( !isset( $value['type'] ) ) $value['type'] = '';
if( !isset( $value['comment'] ) ) $value['comment'] = '';
if( !isset( $value['attrs'] ) ) $value['attrs'] = '';
if( $value['type'] == 'hidden' ) {
- $str .= '<input name="'.$key.'" type="hidden" value="'.$value['value'].'" '.$value['attrs'].' />';
- }
- }
+ $str .= '<input name="'.$key.'" type="hidden" value="'.$value['value'].'" '.$value['attrs'].' />';
+ }
+ }
$str .= '</form>';
$str .= '</div>';
return $str;
@@ -238,36 +153,26 @@ class KolabForm {
$this->errors = array();
foreach( $this->entries as $key => $value ) {
if( !empty( $value['validation'] ) && !ereg( 'readonly', $value['attrs'] ) ) {
- $vv = $value['validation'];
- if( !is_array($vv) ) $va = array($vv);
- else $va = $vv;
- foreach( $va as $v ) {
- //print "validating using $v <br/>";
- if( $v == 'notempty' ) {
- //print "checking nonemptiness of $key: ".$_REQUEST[$key]." len=".strlen(trim($_REQUEST[$key]))."<br/>";
- if( $value['type'] == 'aclselect' ) {
- // ignore
- } else if( strlen( trim($_REQUEST[$key]) ) == 0 ) {
- $this->errors[] = _('Required field ').$value['name']._(' is empty');
- }
- } else {
- if( $value['type'] == 'aclselect' ) {
- $data = $_REQUEST['user_'.$key].' '.$_REQUEST['perm_'.$key];
- } else if( $value['type'] == 'resourcepolicy' ) {
- $i = 0;
- $data = array();
- while( isset($_REQUEST['user_'.$key.'_'.$i] ) ) {
- $data[] = $_REQUEST['user_'.$key.'_'.$i++];
- }
- } else {
- $data = $_REQUEST[$key];
- }
- $errstr = $v( $this, $key, $data );
- if( !empty( $errstr ) ) {
- $this->errors[] = $errstr;
- }
- }
- }
+ $v = $value['validation'];
+ //print "validating using $v <br/>";
+ if( $v == 'notempty' ) {
+ //print "checking nonemptiness of $key: ".$_REQUEST[$key]." len=".strlen(trim($_REQUEST[$key]))."<br/>";
+ if( $value['type'] == 'aclselect' ) {
+ // ignore
+ } else if( strlen( trim($_REQUEST[$key]) ) == 0 ) {
+ $this->errors[] = _('Required field ').$value['name']._(' is empty');
+ }
+ } else {
+ if( $value['type'] == 'aclselect' ) {
+ $data = $_REQUEST['user_'.$key].' '.$_REQUEST['perm_'.$key];
+ } else {
+ $data = $_REQUEST[$key];
+ }
+ $errstr = $v( $this, $key, $data );
+ if( !empty( $errstr ) ) {
+ $this->errors[] = $errstr;
+ }
+ }
}
}
//print_r( $this->errors );
@@ -289,23 +194,12 @@ class KolabForm {
function setValues() {
foreach( $this->entries as $k => $v ) {
if( $this->entries[$k]['type'] == 'aclselect' ) {
- $this->entries[$k]['user'] = trim($this->value('user_'.$k));
- $this->entries[$k]['perm'] = $this->value('perm_'.$k);
- } else if( $this->entries[$k]['type'] == 'resourcepolicy' ) {
- $i = 0;
- $pols = array();
- while( isset($_REQUEST['user_'.$k.'_'.$i]) ) {
- $pols[trim($_REQUEST['user_'.$k.'_'.$i])]
- = trim($_REQUEST['policy_'.$k.'_'.$i]);
- $i++;
- }
- $this->entries[$k]['policies'] = $pols;
+ $this->entries[$k]['user'] = $this->value('user_'.$k);
+ $this->entries[$k]['perm'] = $this->value('perm_'.$k);
} else if( $this->entries[$k]['type'] == 'checkbox' ) {
- $this->entries[$k]['value'] = isset( $_REQUEST[$k] );
- } else if( $this->entries[$k]['type'] == 'password' ) {
- $this->entries[$k]['value'] = $this->value($k);
+ $this->entries[$k]['value'] = isset( $_REQUEST[$k] );
} else {
- $this->entries[$k]['value'] = trim($this->value($k));
+ $this->entries[$k]['value'] = $this->value($k);
}
}
}
diff --git a/php/admin/include/headers.php b/php/admin/include/headers.php
index bb9018d..8f3c614 100644
--- a/php/admin/include/headers.php
+++ b/php/admin/include/headers.php
@@ -1,6 +1,6 @@
<?php
/*
- * Copyright (c) 2004 Klaralvdalens Datakonsult AB
+ * Copyright (c) 2004 Klarälvdalens Datakonsult AB
*
* Writen by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
*
diff --git a/php/admin/include/ldap.class.php b/php/admin/include/ldap.class.php
index 7bc0e53..2407437 100644
--- a/php/admin/include/ldap.class.php
+++ b/php/admin/include/ldap.class.php
@@ -18,28 +18,9 @@
* Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
*/
-require_once('mysmarty.php');
require_once('session_vars.php');
require_once('debug.php');
-/* We dont have any better place to put this right now... */
-function str_rand($length = 8, $seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
- $str = '';
- $seeds_count = strlen($seeds);
-
- // Seed
- //list($usec, $sec) = explode(' ', microtime());
- //$seed = (float) $sec + ((float) $usec * 100000);
- //mt_srand($seed);
-
- // Generate
- for ($i = 0; $length > $i; $i++) {
- $str .= $seeds{mt_rand(0, $seeds_count - 1)};
- }
-
- return $str;
- }
-
class KolabLDAP {
function KolabLDAP() {
$this->is_bound = false;
@@ -47,12 +28,6 @@ class KolabLDAP {
$this->search_result = false;
// Always connect to master server
$this->connection=ldap_connect($_SESSION['ldap_master_uri']);
- if (ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3)) {
- // Good, we really neeed v3!
- } else {
- echo _("Error setting LDAP protocol to v3. Please contact your system administrator");
- return false;
- }
}
function close() {
@@ -95,20 +70,6 @@ class KolabLDAP {
return $str;
}
- function dn_escape( $str ) {
- /*
- DN component escaping as described in RFC-2253
- */
- $str = str_replace( '\\', '\\\\', $str );
- $str = str_replace( ',', '\\,', $str );
- $str = str_replace( '+', '\\,', $str );
- $str = str_replace( '<', '\\<', $str );
- $str = str_replace( '>', '\\>', $str );
- $str = str_replace( ';', '\\;', $str );
- if( $str[0] == '#' ) $str = '\\'.$str;
- // PENDING(steffen): Escape leading/trailing spaces
- return $str;
- }
function bind( $dn = false , $pw = '' ) {
if( !$dn ) {
@@ -195,7 +156,7 @@ class KolabLDAP {
function dnForUid( $uid ) {
if( $this->search( $_SESSION['base_dn'],
- '(&(objectclass=kolabInetOrgPerson)(uid='.$this->escape($uid).'))' ) ) {
+ '(&(objectclass=kInetOrgPerson)(uid='.$this->escape($uid).'))' ) ) {
$entry = $this->firstEntry();
if( $entry ) {
return ldap_get_dn( $this->connection, $entry );
@@ -206,79 +167,6 @@ class KolabLDAP {
return false;
}
- function mailForDn( $dn ) {
- global $errors;
- $res = ldap_read( $this->connection, $dn, '(objectclass=*)', array( 'mail' ) );
- if( $res ) {
- $entries = ldap_get_entries( $this->connection, $res );
- ldap_free_result( $res );
- if( $entries['count'] == 1 ) {
- return $entries[0]['mail'][0];
- } else {
- $errors[] = _("No such object $dn");
- }
- } else {
- $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection);
- }
- return false;
- }
-
- function dnForMail( $mail ) {
- if( $this->search( $_SESSION['base_dn'],
- '(&(objectclass=kolabInetOrgPerson)(mail='.$this->escape($mail).'))' ) ) {
- $entry = $this->firstEntry();
- if( $entry ) {
- return ldap_get_dn( $this->connection, $entry );
- }
- } else {
- echo _("Error searching for DN for Mail=$mail");
- }
- return false;
- }
-
- function aliasForDn( $dn ) {
- global $errors;
- $res = ldap_read( $this->connection, $dn, '(objectclass=*)', array( 'alias' ) );
- if( $res ) {
- $entries = ldap_get_entries( $this->connection, $res );
- ldap_free_result( $res );
- if( $entries['count'] == 1 ) {
- return $entries[0]['alias'][0];
- } else {
- $errors[] = _("No such object $dn");
- }
- } else {
- $errors[] = _("LDAP Error searching for DN $dn: ").ldap_error($this->connection);
- }
- return false;
- }
-
- function dnForAlias( $mail ) {
- if( $this->search( $_SESSION['base_dn'],
- '(&(objectclass=kolabInetOrgPerson)(alias='.$this->escape($mail).'))' ) ) {
- $entry = $this->firstEntry();
- if( $entry ) {
- return ldap_get_dn( $this->connection, $entry );
- }
- } else {
- $errors[] = _("Error searching for DN for alias=$mail: ").ldap_error($this->connection);
- }
- return false;
- }
-
- function dnForMailOrAlias( $mail ) {
- if( $this->search( $_SESSION['base_dn'],
- '(&(objectclass=kolabInetOrgPerson)(|(mail='.$this->escape($mail).')(alias='.$this->escape($mail).')))' ) ) {
- $entry = $this->firstEntry();
- if( $entry ) {
- return ldap_get_dn( $this->connection, $entry );
- }
- } else {
- $errors[] = _("Error searching for DN for mail_or_alias=$mail: ").ldap_error($this->connection);
- }
- return false;
- }
-
function groupForUid( $uid ) {
$group = false;
if( !$this->is_bound ) {
@@ -288,21 +176,21 @@ class KolabLDAP {
if ($dn) {
$group = 'user';
$filter = '(member='.$this->escape($dn).')';
- $result = $this->search( 'cn=maintainer,cn=internal,'.$_SESSION['base_dn'], $filter);
+ $result = $this->search( 'cn=maintainer,'.$_SESSION['base_dn'], $filter);
if (ldap_count_entries($this->connection, $result) > 0) $group = 'maintainer';
- $result = $this->search( 'cn=admin,cn=internal,'.$_SESSION["base_dn"], $filter);
+ $result = $this->search( 'cn=admin,'.$_SESSION["base_dn"], $filter);
if (ldap_count_entries($this->connection, $result) > 0) $group = 'admin';
if ($result) $this->freeSearchResult();
}
return $group;
}
- // Get members of a group as an array of DNs
+ // Get members as a group as an array of DNs
function groupMembers( $base, $group ) {
global $errors;
$privmembers = array();
$mybase = 'cn='.$group.','.$base;
- $filter = '(objectClass=kolabGroupOfNames)';
+ $filter = '(objectClass=groupOfNames)';
$res = ldap_search( $this->connection, $mybase, $filter, array('member') );
if( !$res ) {
array_push($errors, _("LDAP Error: Can't read maintainers group: ")
@@ -312,11 +200,11 @@ class KolabLDAP {
$entries = ldap_get_entries( $this->connection, $res );
foreach($entries as $key=>$val) {
if( $key === 'count' ) {
- // Do nothing
+ // Do nothing
} else if( is_array( $val ) && is_array($val['member']) ) {
- foreach( $val['member'] as $member ) {
- $privmembers[$member] = true;
- }
+ foreach( $val['member'] as $member ) {
+ $privmembers[$member] = true;
+ }
}
}
ldap_free_result( $res );
@@ -328,11 +216,7 @@ class KolabLDAP {
// This can be used to check for uniqueness etc.
function countMail( $base, $mail , $excludedn=false ) {
// First count users
- $filter = '(|(|(mail='.$this->escape($mail).')
- (alias='.$this->escape($mail).')
- )
- (uid='.$this->escape($mail).')
- )';
+ $filter = '(|(mail='.$this->escape($mail).')(alias='.$this->escape($mail).'))';
$res = $this->search( $base, $filter, array( 'dn' ) );
$count = 0;
@@ -346,16 +230,9 @@ class KolabLDAP {
}
} else $count += $entries['count'];
- /* Distribution lists have a mail attr now too,
- so it looks like we count them twice.
- For some reason I've not seen any problems
- with it though, so I dare not remove the code
- below... /steffen
- */
-
// Now count dist. lists
$cn = substr( $mail, 0, strpos( $mail, '@' ) );
- $filter = '(&(objectClass=kolabGroupOfNames)(cn='.$this->escape($cn).'))';
+ $filter = '(&(objectClass=groupOfNames)(cn='.$this->escape($cn).'))';
$res = $this->search( $base, $filter, array( 'dn' ) );
$entries = ldap_get_entries( $this->connection, $res );
@@ -367,7 +244,7 @@ class KolabLDAP {
$count++;
}
} else $count += $entries['count'];
-
+
debug("Got $count addresses");
$this->freeSearchResult();
@@ -377,15 +254,6 @@ class KolabLDAP {
// Set deleflag on object, or if $delete_now is
// true, just delete it
function deleteObject( $dn, $delete_now = false ) {
- return $this->_doDeleteObject( $dn, $delete_now, true );
- }
-
- function deleteSharedFolder( $dn, $delete_now = false ) {
- return $this->_doDeleteObject( $dn, $delete_now, false );
- }
-
- // Private
- function _doDeleteObject( $dn, $delete_now = false, $nuke_password = false ) {
if( $delete_now ) {
if( !ldap_delete( $this->connection, $dn ) ) {
return false;
@@ -395,13 +263,8 @@ class KolabLDAP {
$kolab_obj = $this->read( 'k=kolab,'.$_SESSION['base_dn'] );
if( !$kolab_obj ) return false;
$delete_template = array();
- $delete_template['kolabDeleteflag'] = $kolab_obj['kolabHost'];
- unset($delete_template['kolabDeleteflag']['count']);
- if( $nuke_password ) {
- // Write random garbage into passwd field to lock the user out
- $delete_template['userPassword'] = '{sha}'.base64_encode( pack('H*',
- sha1( str_rand( 32 ) )));
- }
+ $delete_template['deleteflag'] = $kolab_obj['kolabhost'];
+ unset($delete_template['deleteflag']['count']);
if( !ldap_modify($this->connection,$dn,$delete_template) ) {
return false;
}
@@ -426,4 +289,4 @@ $ldap =& new KolabLDAP;
End:
vim:encoding=utf-8:
*/
-?>
+?> \ No newline at end of file
diff --git a/php/admin/include/menu.php b/php/admin/include/menu.php
index 7ec363c..6981022 100644
--- a/php/admin/include/menu.php
+++ b/php/admin/include/menu.php
@@ -18,8 +18,6 @@
* Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
*/
-require_once('locale.php');
-
$menuitems = array();
if( $auth->group() == "admin" || $auth->group() == "maintainer" ) {
@@ -34,8 +32,6 @@ if( $auth->group() == "admin" || $auth->group() == "maintainer" ) {
'url' => $topdir.'/user/user.php?action=modify',
'title' => _('My User Settings'),
'submenu' => array(
- array( 'name' => _('Mail Delivery'),
- 'url' => 'deliver.php'),
array( 'name' => _('Forward Email'),
'url' => 'forward.php' ),
array( 'name' => _('Vacation'),
@@ -55,41 +51,30 @@ if( $auth->group() == "admin" || $auth->group() == "maintainer" ) {
array( 'name' => _('Add Shared Folder'),
'url' => 'sf.php?action=create' )));
}
-if( $auth->group() == 'admin' || $auth->group() == 'maintainer' ) {
+if( $auth->group() == "admin" ) {
$menuitems['distlist'] = array( 'name' => _('Distribution Lists'),
'url' => $topdir.'/distributionlist/',
'title' => _('Manage Distribution Lists'),
'submenu' => array(
array( 'name' => _('Create New List'),
- 'url' => 'list.php?action=create' ) ) );
-}
-if( $auth->group() == 'admin' ) {
+ 'url' => _('list.php?action=create') ) ) );
+
$menuitems['administrator'] = array( 'name' => _('Administrators'),
'url' => $topdir.'/administrator/',
'title' => _('Manage Administrators'),
'submenu' => array(
array( 'name' => _('Create New Administrator'),
'url' => 'admin.php?action=create' ) ) );
-}
-if( $auth->group() == 'admin' ) {
$menuitems['maintainer'] = array( 'name' => _('Maintainers'),
'url' => $topdir.'/maintainer/',
'title' => _('Manage Maintainers'),
'submenu' => array(
array( 'name' => _('Create New Maintainer'),
'url' => 'maintainer.php?action=create' ) ) );
-} else if( $auth->group() == 'maintainer' ) {
- $mdn = $auth->dn();
- $menuitems['maintainer'] = array( 'name' => _('Maintainers'),
- 'url' => $topdir.'/maintainer/maintainer.php?action=modify&dn='.urlencode($mdn),
- 'title' => _('Manage Maintainer') );
-}
-if( $auth->group() == 'admin' ) {
$menuitems['service'] = array( 'name' => _('Services'),
'url' => $topdir.'/service/',
'title' => _('Manage Services') );
}
-
$menuitems['about'] = array( 'name' => _('About Kolab'),
'url' => $topdir.'/kolab/',
'title' => _('About Kolab'),
@@ -98,18 +83,11 @@ $menuitems['about'] = array( 'name' => _('About Kolab'),
'url' => 'erfrakon.php' ),
array( 'name' => _('Intevation'),
'url' => 'intevation.php' ),
- array( 'name' => _('Klar&auml;lvdalens Datakonsult'),
+ array( 'name' => _('Klarälvdalens Datakonsult'),
'url' => 'kdab.php' ),
- array( 'name' => _('Code Fusion'),
- 'url' => 'codefusion.php' ),
array( 'name' => _('KDE'),
'url' => 'kde.php' )
));
-if( $auth->group() == 'admin' || $auth->group() == 'maintainer' ) {
- $menuitems['about']['submenu'][] = array( 'name' => _('<b>Versions</b>'),
- 'url' => 'versions.php' );
-}
-
/*
Local variables:
mode: php
diff --git a/php/admin/include/mysmarty.php.in b/php/admin/include/mysmarty.php.in
new file mode 100644
index 0000000..367cd4d
--- /dev/null
+++ b/php/admin/include/mysmarty.php.in
@@ -0,0 +1,57 @@
+<?php
+/*
+ * Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ *
+ * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
+ *
+ * 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, 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 can view the GNU General Public License, online, at the GNU
+ * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+ */
+
+require_once('Smarty/Smarty.class.php');
+
+$topdir = '/admin';
+$kolab_prefix = '@prefix@';
+
+// PENDING: Remove this before production(!)
+//function count_bytes($tpl_output, &$smarty) {
+// return $tpl_output.strlen($tpl_output);
+//}
+
+class MySmarty extends Smarty {
+ function MySmarty() {
+ global $topdir;
+ $this->Smarty();
+
+ $basedir = '@phpdir@/admin/';
+ $this->template_dir = $basedir.'templates/en/';
+ $this->compile_dir = $basedir.'templates_c/';
+ $this->config_dir = $basedir.'configs/';
+ $this->cache_dir = $basedir.'cache/';
+
+ //$this->register_outputfilter("count_bytes");
+
+ $this->assign( 'topdir', $topdir );
+ }
+};
+
+/*
+ Local variables:
+ mode: php
+ indent-tabs-mode: t
+ tab-width: 4
+ buffer-file-coding-system: utf-8
+ End:
+ vim:encoding=utf-8:
+ */
+?>
diff --git a/php/admin/templates/en/addrdeleted.tpl b/php/admin/templates/en/addrdeleted.tpl
new file mode 100644
index 0000000..5d6c6fa
--- /dev/null
+++ b/php/admin/templates/en/addrdeleted.tpl
@@ -0,0 +1,12 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>{$heading}</h1>
+
+<div content="contentsimple">
+<p>The address with DN {$dn|escape} has been deleted</p>
+<p><a href="index.php">Back to list of addresses</a></p>
+</div>
diff --git a/php/admin/templates/en/addresslist.tpl b/php/admin/templates/en/addresslist.tpl
new file mode 100644
index 0000000..33a4bce
--- /dev/null
+++ b/php/admin/templates/en/addresslist.tpl
@@ -0,0 +1,24 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+(only external addresses without a kolab user account)
+</div>
+
+<div class="contenttable">
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Name</th><th colspan="2">Action</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$entries[id].name|escape:"html"}</td>
+ <td class="actioncell"><a href="modify.php?dn={$entries[id].dn|escape:"url"}">Modify</a></td>
+ <td class="actioncell"><a href="delete.php?dn={$entries[id].dn|escape:"url"}">Delete</a></td>
+ </tr>
+{/section}
+</table>
+</div>
diff --git a/php/admin/templates/en/addrlistall.tpl b/php/admin/templates/en/addrlistall.tpl
new file mode 100644
index 0000000..382098b
--- /dev/null
+++ b/php/admin/templates/en/addrlistall.tpl
@@ -0,0 +1,22 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+<h3>(only external addresses without a kolab user account)</h3>
+</div>
+
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Name</th><th colspan="2">Action</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell"><a href="mailto:{$entries[id].mail|escape:"html"}" title="{$entries[id].sn|escape}, {$entries[id].fn|escape:"html"} &lt;{$entries[id].mail|escape:"html"}&gt;">{$entries[id].sn|escape:"html"}, {$entries[id].fn|escape:"html"}</a></td>
+ <td class="actioncell"><a href="addr.php?action=modify&dn={$entries[id].dn|escape:"url"}">Modify</a></td>
+ <td class="actioncell"><a href="addr.php?action=delete&dn={$entries[id].dn|escape:"url"}">Delete</a></td>
+ </tr>
+{/section}
+</table>
diff --git a/php/admin/templates/en/admindeleted.tpl b/php/admin/templates/en/admindeleted.tpl
new file mode 100644
index 0000000..dad5760
--- /dev/null
+++ b/php/admin/templates/en/admindeleted.tpl
@@ -0,0 +1,12 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>{$heading}</h1>
+
+<div content="contentsimple">
+<p>The administrator with DN {$dn|escape} has been deleted</p>
+<p><a href="index.php">Back to list of administrators</a></p>
+</div>
diff --git a/php/admin/templates/en/adminlistall.tpl b/php/admin/templates/en/adminlistall.tpl
new file mode 100644
index 0000000..d5e9fee
--- /dev/null
+++ b/php/admin/templates/en/adminlistall.tpl
@@ -0,0 +1,27 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+
+</div>
+
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Name</th><th>UID</th><th colspan="2">Action</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$entries[id].sn|escape:"html"}, {$entries[id].fn|escape:"html"}</td>
+ <td class="contentcell">{$entries[id].uid|escape:"html"}</td>
+ {if $entries[id].deleted neq "FALSE"}
+ <td class="actioncell" colspan="2">Object Deleted, awaiting cleanup...</td>
+ {else}
+ <td class="actioncell"><a href="admin.php?action=modify&dn={$entries[id].dn|escape:"url"}">Modify</a></td>
+ <td class="actioncell"><a href="admin.php?action=delete&dn={$entries[id].dn|escape:"url"}">Delete</a></td>
+ {/if}
+ </tr>
+{/section}
+</table>
diff --git a/php/admin/templates/en/createuser.tpl b/php/admin/templates/en/createuser.tpl
new file mode 100644
index 0000000..e83abcc
--- /dev/null
+++ b/php/admin/templates/en/createuser.tpl
@@ -0,0 +1,107 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<form name="user" method="post">
+<table class="contentform">
+<tr>
+ <th>Attribute</th>
+ <th>Value</th>
+ <th>Comment</th>
+</tr>
+<tr>
+ <td>First Name</td>
+ <td><input name="firstname" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td>Required</td>
+</tr>
+<tr>
+ <td>Last Name</td>
+ <td><input name="lastname" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td>Required</td>
+</tr>
+<tr>
+ <td>Password</td>
+ <td><input name="password_0" type="password" value="" size="50" onfocus="javascript:this.select()" />
+ </td><td>Required</td>
+</tr>
+<tr>
+ <td>Verify Password</td>
+ <td><input name="password_1" type="password" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td>Required</td>
+</tr>
+<tr>
+ <td>Primary Email Address</td>
+ <td><input name="mail_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td>Required, non volatile</td>
+</tr>
+<tr>
+ <td>Title</td><td><input name="title_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Email Alias</td>
+ <td><input name="alias_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Organisation</td>
+ <td><input name="o_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Organisational Unit</td>
+ <td><input name="ou_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Room Number</td>
+ <td><input name="roomNumber_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Street Address</td>
+ <td><input name="street_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Postbox</td>
+ <td><input name="postOfficeBox_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Postal Code</td><td><input name="postalCode_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>City</td>
+ <td><input name="l_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Country</td>
+ <td><input name="c_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Telephone Number</td>
+ <td><input name="telephoneNumber_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Fax Number</td>
+ <td><input name="facsimileTelephoneNumber_0" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td></td>
+</tr>
+<tr>
+ <td>Addressbook</td>
+ <td><input name="visible" type="checkbox" checked /></td>
+ <td>check here to make this users address <br> visible in the address book</td>
+</tr>
+<tr>
+ <td>User Quota in KB</td><td><input name="userquota" type="text" value="" size="50" onfocus="javascript:this.select()" /></td>
+ <td>Leave blank for unlimited</td>
+</tr>
+</table>
+<input type="submit" name="submit_user" value="Submit" /><input name="action" type="hidden" value="firstsave" /></form>
diff --git a/php/admin/templates/en/distlistall.tpl b/php/admin/templates/en/distlistall.tpl
new file mode 100644
index 0000000..238bbd3
--- /dev/null
+++ b/php/admin/templates/en/distlistall.tpl
@@ -0,0 +1,26 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+<h3>Distribution Lists</h3>
+</div>
+
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Listname</th><th colspan="2">Action</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$entries[id].cn|escape:"html"}</td>
+ {if $entries[id].deleted eq "TRUE"}
+ <td class="actioncell" colspan="2">Folder deleted, awaiting cleanup...</td>
+ {else}
+ <td class="actioncell"><a href="list.php?action=modify&dn={$entries[id].dn|escape:"url"}">Modify</a></td>
+ <td class="actioncell"><a href="list.php?action=delete&dn={$entries[id].dn|escape:"url"}">Delete</a></td>
+ {/if}
+ </tr>
+{/section}
+</table>
diff --git a/php/admin/templates/en/erfrakon.tpl b/php/admin/templates/en/erfrakon.tpl
new file mode 100644
index 0000000..2c892d3
--- /dev/null
+++ b/php/admin/templates/en/erfrakon.tpl
@@ -0,0 +1,27 @@
+{* Smarty Template *}
+{*
+ (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
+ (c) 2003 Martin Konold <martin.konold@erfrakon.de>
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*}
+<div class="contentsimple">
+<p>
+The Kolab server was designed and developed by <a href="http://www.erfrakon.com">erfrakon</a> contracted by the <a href="http://www.bsi.bund.de">BSI</a> (Bundesamt f&uuml;r Sicherheit in der Informationstechnik), Bonn - Germany.
+</p>
+<IMG SRC="../pics/erfrakon.png" ALT="erfrakon" align="middle" longdesc="http://www.erfrakon.com" usemap="#maperfrakon">
+<map name="maperfrakon">
+ <area shape="rect" coords="0,0,300,30" href="http://www.erfrakon.com">
+</map>
+
+<p>
+<a href="http://www.erfrakon.com">erfrakon</a> is a consulting company dedicated to opensource software and Linux. The main tasks of erfrakon within the Kolab project are design and architecure of the Kolab groupware solution and the creation of the Kolab server.
+</p>
+<p>
+The following people worked on Kolab for erfrakon:</p>
+<p>
+<a href="mailto:tassilo.erlewein@erfrakon.de?subject=Kolab Server 1.0">Tassilo Erlewein</a><br>
+<a href="mailto:achim.frank@erfrakon.de?subject=Kolab Server 1.0">Achim Frank</a><br>
+<a href="mailto:martin.konold@erfrakon.de?subject=Kolab Server 1.0">Martin Konold</a><br>
+</p>
+</div>
diff --git a/php/admin/templates/en/formcontainer.tpl b/php/admin/templates/en/formcontainer.tpl
new file mode 100644
index 0000000..cde0961
--- /dev/null
+++ b/php/admin/templates/en/formcontainer.tpl
@@ -0,0 +1,8 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>{$heading}</h1>
+{$form} \ No newline at end of file
diff --git a/php/admin/templates/en/forward.tpl b/php/admin/templates/en/forward.tpl
new file mode 100644
index 0000000..3faaedd
--- /dev/null
+++ b/php/admin/templates/en/forward.tpl
@@ -0,0 +1,15 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>Email Forwarding</h1>
+<div class="contentform">
+<form method="POST">
+<input type="checkbox" name="active" value="true" {if $active}checked{/if} /> Activate email forwarding<br />
+Forward mail to <input type="text" name="address" value="{$address}" /><br />
+<input type="checkbox" name="keep" value="true" {if $keep}checked{/if} /> Keep copy on server<br />
+<input type="submit" name="submit" value="Update"/><br />
+</form>
+</div> \ No newline at end of file
diff --git a/php/admin/templates/en/intevation.tpl b/php/admin/templates/en/intevation.tpl
new file mode 100644
index 0000000..b2ccd72
--- /dev/null
+++ b/php/admin/templates/en/intevation.tpl
@@ -0,0 +1,30 @@
+{* Smarty Template *}
+<div class="contentsimple">
+<p>
+The Intevation GmbH coordinated the Kroupware-Project. In addition to project
+management Intevation GmbH was heavily involved in quality assurance.
+</p>
+
+<a href="http://intevation.net/" border=0><IMG
+SRC="../pics/intevation_logo.png" ALT="Logo Intevation GmbH" height="91"
+align ="middle" longdesc="www.intevation.net" border="0"></a>
+
+<p>
+Intevation GmbH is a IT-company exclusively focusing on Free Software.
+Its business units are strategic consulting, project management and geographic
+information systems.
+</p>
+
+The following people worked on Kolab for Intevation:
+<P>
+Bernhard Reiter
+<a href="mailto:bernhard.reiter@intevation.de"><tt>&lt;Bernhard.Reiter@intevation.de&gt;</tt></a>
+<br>
+Jan-Oliver Wagner
+<a href="mailto:jan-oliver.wagner@intevation.de"><tt>&lt;Jan-Oliver.Wagner@intevation.de&gt;</tt></a>
+<br>
+Marc Mutz
+<a href="mailto:Marc.Mutz@intevation.de"><tt>&lt;Marc.Mutz@intevation.de&gt;</tt></a>
+<br>
+</p>
+</div>
diff --git a/php/admin/templates/en/kdab.tpl b/php/admin/templates/en/kdab.tpl
new file mode 100644
index 0000000..eec70d0
--- /dev/null
+++ b/php/admin/templates/en/kdab.tpl
@@ -0,0 +1,24 @@
+{* Smarty Template *}
+<a href="http://www.klaralvdalens-datakonsult.se/"><IMG SRC="../pics/kdab.png"
+ALT="KDAB" align="middle"
+longdesc="http://www.klaralvdalens-datakonsult.se" border="0"></a>
+
+<div class="contentsimple">
+<p>
+The Kolab KDE client and 2nd version of the server was designed and developed by <a href="http://www.klaralvdalens-datakonsult.se">Klar&auml;lvdalens Datakonsult AB</a> contracted by the <a href="http://www.bsi.bund.de">BSI</a> (Bundesamt fr Sicherheit in der Informationstechnik), Bonn - Germany.
+</p>
+<p>
+Klar&auml;lvdalens Datakonsult AB is a consulting company dedicated to opensource software, Linux, and the Qt library. The main tasks of KDAB within the kolab project are design and implementation of the kolab KDE client and the implementation of the 2nd. version of the server.
+</p>
+<p>
+The following people worked on Kolab for Klar&auml;lvdalens Datakonsult AB:</p>
+<p>
+<a href="mailto:bo@klaralvdalens-datakonsult.se?subject=Kolab Client 1.0">Bo Thorsen</a><br>
+<a href="mailto:michel@klaralvdalens-datakonsult.se?subject=Kolab Client 1.0">Michel Boyer de la Giroday</a><br>
+<a href="mailto:steffen@klaralvdalens-datakonsult.se?subject=Kolab Client 1.0">Steffen Hansen</a><br>
+<a href="mailto:kalle@klaralvdalens-datakonsult.se?subject=Kolab Client 1.0">Matthias Kalle Dalheimer</a><br>
+<a href="mailto:dfaure@klaralvdalens-datakonsult.se?subject=Kolab Client 1.0">David Faure</a><br>
+<a href="mailto:khz@klaralvdalens-datakonsult.se?subject=Kolab Client 1.0">Karl-Heinz Zimmer</a><br>
+<a href="mailto:lutz@klaralvdalens-datakonsult.se?subject=Kolab Client 1.0">Lutz Rogowski</a><br>
+</p>
+</div>
diff --git a/php/admin/templates/en/kde.tpl b/php/admin/templates/en/kde.tpl
new file mode 100644
index 0000000..b8e8a85
--- /dev/null
+++ b/php/admin/templates/en/kde.tpl
@@ -0,0 +1,22 @@
+{* Smarty Template *}
+<div class="contentsimple">
+<P>
+<a href="http://www.kde.org">KDE</a> is a powerful Open Source graphical desktop environment for Unix
+workstations. It combines ease of use, contemporary functionality, and
+outstanding graphical design with the technological superiority of the
+Unix operating system.
+</p>
+<IMG SRC="../pics/kde.jpg" ALT="KDE" height="190" align="middle" longdesc="http://www.kde.org">
+<p>
+<b>KDE</b> is an Internet project that is truly open in every sense.
+Development takes place on the Internet and is discussed on our
+<a href="http://www.kde.org/mailinglists.html">mailing lists</a>, USENET news groups, and
+IRC channels to which we invite and welcome everyone.
+</p>
+<p>
+<b>KDE</b> is a mature desktop suite providing a solid basis to an ever
+growing number of <a href="http://apps.kde.com">applications</a> for Unix
+workstations. KDE has developed a high quality development framework for
+Unix, which allows for the rapid and efficient creation of applications.
+</p>
+</div>
diff --git a/php/admin/templates/en/kolab.tpl b/php/admin/templates/en/kolab.tpl
new file mode 100644
index 0000000..8be7e2e
--- /dev/null
+++ b/php/admin/templates/en/kolab.tpl
@@ -0,0 +1,103 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+<p>
+ This is the Kolab2 Server. It is Free Software developed
+ by the <a href="http://www.kolab.org/">Kolab Project</a>
+ to bring groupware functionality to both Unix/KDE users
+ and Windows desktops.
+</p>
+
+<p>
+ Kolab builds upon many other Free Software projects, like:
+<ul>
+ <li><a href="http://www.apache.org/">Apache</a></li>
+ <li><a href="http://asg.web.cmu.edu/cyrus/imapd/">Cyrus</a></li>
+ <li><a href="http://www.openldap.org/">OpenLDAP</a></li>
+ <li><a href="http://www.perl.org/">Perl</a></li>
+ <li><a href="http://www.php.net/">PHP</a></li>
+ <li><a href="http://www.kde.org/">K Desktop Environment (KDE)</a></li>
+ <li><a href="http://www.openldap.org/">OpenLDAP</a></li>
+ <li><a href="http://www.perl.org/">Perl</a></li>
+ <li><a href="http://smarty.php.net/">PHP Smarty Template Engine</a></li>
+ <li><a href="http://www.postfix.org/">Postfix</a></li>
+ <li><a href="http://www.proftpd.org/">Proftpd</a></li>
+</ul>
+</p>
+
+<p>
+Special kudos to the helpful people at the
+<a href="http://www.openpkg.org/">OpenPKG</a> project.
+OpenPKG allow us to support many different platforms
+in a reliable and predictable manner.
+</p>
+
+<p>
+To use all Kolab features you need an interoperable client.
+The KDE Kolab Client has been the first and so far best supported one.
+Many thanks to the <a href="http://www.kde.org">KDE Project</a>
+for providing such a powerful base to build a solution on.
+</p>
+
+<p>
+User of Outlook on Microsoft Windows may use a proprietary Plugin
+to get a Kolab Windows Client. For Kolab2 the
+<a href="http://www.toltec.co.za/">Toltec Plug-in</a>
+by Radley Network Technologies CC is the designated plugin.
+Radley has worked with the Kolab community to develop the Kolab 2
+storage format.
+<p>
+Usually the Kolab Website has an
+<a href="www.kolab.org/kolab-plugins.html"
+>overview about other outlook-plugins</a>.
+</p>
+
+<p>
+Kolab is developed by a community.
+The project was started 2002 by by a joint-venture of <a href="http://www.erfrakon.com/">erfrakon</a>
+(design, architecture and server),
+
+<a href="http://www.intevation.de">Intevation</a> (project management and client quality assurance)
+
+and
+<a href="http://www.klaralvdalens-datakonsult.se/">Klar&auml;lvdalens Datakonsult</a>.
+</p>
+<p>
+Later <a href="http://www.codefusion.co.za/">Codefusion CC</a> (new kolab engine, horde webclient) joined.
+</p>
+<p>
+ Other contributors:<br/>
+<ul>
+<li> <a href="http://www.konsec.com">Konsec GmbH</a> CSSified the Kolab1 web admin GUI</li>
+</ul>
+</p>
+<p>
+ The prinicipal authors of the kolab client and server software are in alphabetical order:
+</p>
+
+<p>
+<ul>
+ <li><a href="mailto:s.binge@codefusion.co.za">Stuart Binge</a></li>
+ <li> <a href="mailto:s.buys@codefusion.co.za">Stephan Buys</a></li>
+ <li><a href="mailto:kalle@klaralvdalens-datakonsult.se?subject=Kolab Server 1.9">Matthias Kalle Dalheimer</a></li>
+ <li><a href="mailto:tassilo.erlewein@erfrakon.de?subject=Kolab Server 1.9">Tassilo Erlewein</a></li>
+ <li><a href="mailto:dfaure@klaralvdalens-datakonsult.se?subject=Kolab Client 1.9">David Faure</a></li>
+ <li><a href="mailto:achim.frank@erfrakon.de?subject=Kolab Server 1.9">Achim Frank</a></li>
+ <li><a href="mailto:michel@klaralvdalens-datakonsult.se?subject=Kolab Client 1.9">Michel Boyer de la Giroday</a></li>
+ <li><a href="mailto:steffen@klaralvdalens-datakonsult.se?subject=Kolab Client 1.9">Steffen Hansen</a></li>
+ <li><a href="mailto:bh@intevation.de?subject=Kolab Server 1.9">Bernhard Herzog
+ <li><a href="mailto:martin.konold@erfrakon.de?subject=Kolab Server 1.9">Martin Konold</a></li>
+ <li><a href="mailto:mutz@kde.org?subject=Kolab Server 1.9">Marc Mutz</a></li>
+ <li><a href="mailto:bernhard@intevation.de?subject=Kolab Server 1.9">Bernhard Reiter</a></li>
+ <li><a href="mailto:lutz@klaralvdalens-datakonsult.se?subject=Kolab Server 1.9">Lutz Rogowski</a></li>
+ <li><a href="mailto:bo@klaralvdalens-datakonsult.se?subject=Kolab Server 1.9">Bo Thorsen</a></li>
+ <li><a href="mailto:jan@intevation.de?subject=Kolab Server 1.9">Jan-Oliver Wagner</a></li>
+ <li><a href="mailto:khz@klaralvdalens-datakonsult.se?subject=Kolab Server 1.9">Karl-Heinz Zimmer</a></li>
+</ul>
+</p>
+
+</div>
diff --git a/php/admin/templates/en/login.tpl b/php/admin/templates/en/login.tpl
new file mode 100644
index 0000000..e1bb462
--- /dev/null
+++ b/php/admin/templates/en/login.tpl
@@ -0,0 +1,22 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>Enter UID and password to login</h1>
+<div class="contentform">
+<form method="POST">
+<table>
+<tr>
+ <td>Username:</td><td><input type="text" name="username"/></td>
+</tr>
+<tr>
+ <td>Password:</td><td><input type="password" name="password"/></td>
+</tr>
+<tr>
+ <td colspan="2" align="right"><input type="submit" name="login" value="Login"/></td>
+</tr>
+</table>
+</form>
+</div> \ No newline at end of file
diff --git a/php/admin/templates/en/maintainerdeleted.tpl b/php/admin/templates/en/maintainerdeleted.tpl
new file mode 100644
index 0000000..c8d195d
--- /dev/null
+++ b/php/admin/templates/en/maintainerdeleted.tpl
@@ -0,0 +1,12 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>{$heading}</h1>
+
+<div content="contentsimple">
+<p>The maintainer with DN {$dn|escape} has been deleted</p>
+<p><a href="index.php">Back to list of maintainers</a></p>
+</div>
diff --git a/php/admin/templates/en/maintainerlistall.tpl b/php/admin/templates/en/maintainerlistall.tpl
new file mode 100644
index 0000000..4111acc
--- /dev/null
+++ b/php/admin/templates/en/maintainerlistall.tpl
@@ -0,0 +1,27 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+
+</div>
+
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Name</th><th>UID</th><th colspan="2">Action</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$entries[id].sn|escape:"html"}, {$entries[id].fn|escape:"html"}</td>
+ <td class="contentcell">{$entries[id].uid|escape:"html"}</td>
+ {if $entries[id].deleted neq "FALSE"}
+ <td class="actioncell" colspan="2">Object Deleted, awaiting cleanup...</td>
+ {else}
+ <td class="actioncell"><a href="maintainer.php?action=modify&dn={$entries[id].dn|escape:"url"}">Modify</a></td>
+ <td class="actioncell"><a href="maintainer.php?action=delete&dn={$entries[id].dn|escape:"url"}">Delete</a></td>
+ {/if}
+ </tr>
+{/section}
+</table>
diff --git a/php/admin/templates/en/page.tpl b/php/admin/templates/en/page.tpl
new file mode 100644
index 0000000..9e0cebf
--- /dev/null
+++ b/php/admin/templates/en/page.tpl
@@ -0,0 +1,89 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<title>{$page_title}</title>
+<meta name="robots" content="noindex">
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<meta name="Content-Language" content="us">
+<meta name="description" content="Kolab Administration Webintefrace">
+<meta name="keywords" content="Linux, Unix, Groupware, Email, Calendar">
+<link rel="stylesheet" href="{$stylesheet|default:"$topdir/style.css"}" />
+</head>
+<body>
+<div id="topbar">
+ <div id="toplogo"></div>
+ <div id="toptitle">{$page_title}</div>
+</div>
+<div id="topuserinfo">
+{if $uid}
+User: {$uid} | Role: {$group} | <a id="logout" href="{$topdir}/logout.php">Logout</a>
+{else}
+Not logged in
+{/if}
+</div>
+{strip}
+<div id="topmenu">
+{foreach from=$menuitems item=menuitem}
+<a href="{$menuitem.url}">
+ <span class="topmenuitem{$menuitem.selected}">&nbsp;{$menuitem.name|escape:"html"}&nbsp;</span>
+</a>
+{/foreach}
+</div>
+{/strip}
+{if count($submenuitems) > 0}
+<div id="submenu">
+{strip}
+{section name=id loop=$submenuitems}
+<a href="{$submenuitems[id].url}">
+ <span class="submenuitem{$submenuitems[id].selected}">{$submenuitems[id].name|escape:"html"}</span>
+</a>&nbsp;|&nbsp;
+{/section}
+{/strip}
+</div>
+{/if}
+<div id="page">
+{if $errors}
+<div id="errorcontent">
+<div id="errorheader">Errors:</div>
+{section name=id loop=$errors}
+{$errors[id]}<br/>
+{/section}
+</div>
+{/if}
+{if $messages}
+<div id="messagecontent">
+<div id="messageheader">Message:</div>
+{section name=id loop=$messages}
+{$messages[id]}<br/>
+{/section}
+</div>
+{/if}
+<div id="maincontent">
+{include file=$maincontent}
+</div>
+<!--
+<div id="validators">
+<a href="http://validator.w3.org/check/referer">
+<img style="border:0;width:88px;height:31px"
+ src="http://www.w3.org/Icons/valid-xhtml10"
+ alt="Valid XHTML 1.0!" />
+</a>
+<a href="http://jigsaw.w3.org/css-validator/check/referer">
+<img style="border:0;width:88px;height:31px"
+ src="http://jigsaw.w3.org/css-validator/images/vcss"
+ alt="Valid CSS!" />
+</a>
+</div>
+-->
+</div>
+<br/>
+<br/>
+</body>
+</html> \ No newline at end of file
diff --git a/php/admin/templates/en/service.tpl b/php/admin/templates/en/service.tpl
new file mode 100644
index 0000000..adef530
--- /dev/null
+++ b/php/admin/templates/en/service.tpl
@@ -0,0 +1,67 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<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>
+</div>
+<h1>Services</h1>
+<form name="serviceform" method="POST">
+
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Service</th><th>Enabled</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$entries[id].name|escape:"html"}</td>
+ <td class="actioncell"><input type="checkbox" name="{$entries[id].service}" {if $entries[id].enabled == 'true' }checked{/if}></td>
+ </tr>
+{/section}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell"> </td><td class="actioncell"><input type="submit" name="submitservices" value="Update"></td>
+ </tr>
+</table>
+</form>
+<h1>Quota settings</h1>
+<div class="contentform">
+<form name="quotawarnform" method="POST">
+<br />
+Warn users when they have used <input name="quotawarn" size="3" value="{$quotawarn}" /> % of their quota<br />
+<div align="right"><input type="submit" name="submitquotawarn" value="Update" /></div>
+</form>
+</div>
+<br />
+<h1>Kolab Hosts</h1>
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Host</th><th>Action</th>
+ </tr>
+{section name=id loop=$kolabhost}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$kolabhost[id]|escape:"html"}</td>
+ <td class="actioncell">{strip}
+ <form method="POST">
+ <input type="hidden" name="akolabhost" value="{$kolabhost[id]}" />
+ <input type="submit" name="deletekolabhost" value="Delete" />
+ </form>
+ {/strip}</td>
+ </tr>
+{/section}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <form method="POST">
+ <td class="contentcell">
+ <input type="text" size="60" name="akolabhost" />
+ </td><td class="actioncell"><input type="submit" name="addkolabhost" value="Add" /></td>
+ </form>
+ </tr>
+</table>
+</div> \ No newline at end of file
diff --git a/php/admin/templates/en/sflistall.tpl b/php/admin/templates/en/sflistall.tpl
new file mode 100644
index 0000000..5acd87a
--- /dev/null
+++ b/php/admin/templates/en/sflistall.tpl
@@ -0,0 +1,27 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+<h3>Shared folders</h3>
+</div>
+
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Name</th><th>Server</th><th colspan="2">Action</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$entries[id].cn|escape:"html"}</td>
+ <td class="contentcell">{$entries[id].homeserver|escape:"html"}</td>
+ {if $entries[id].deleted neq "FALSE"}
+ <td class="actioncell" colspan="2">Folder deleted, awaiting cleanup...</td>
+ {else}
+ <td class="actioncell"><a href="sf.php?action=modify&dn={$entries[id].dn|escape:"url"}">Modify</a></td>
+ <td class="actioncell"><a href="sf.php?action=delete&dn={$entries[id].dn|escape:"url"}">Delete</a></td>
+ {/if}
+ </tr>
+{/section}
+</table>
diff --git a/php/admin/templates/en/userdeleted.tpl b/php/admin/templates/en/userdeleted.tpl
new file mode 100644
index 0000000..5e0b4d5
--- /dev/null
+++ b/php/admin/templates/en/userdeleted.tpl
@@ -0,0 +1,12 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>{$heading}</h1>
+
+<div content="contentsimple">
+<p>The user with DN {$dn|escape} has been deleted</p>
+<p><a href="index.php">Back to list of users</a></p>
+</div>
diff --git a/php/admin/templates/en/userlistall.tpl b/php/admin/templates/en/userlistall.tpl
new file mode 100644
index 0000000..da7e0dc
--- /dev/null
+++ b/php/admin/templates/en/userlistall.tpl
@@ -0,0 +1,27 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+
+</div>
+
+<table class="contenttable" cellpadding="0" cellspacing="1px">
+ <tr class="contentrow">
+ <th>Name</th><th>E-mail</th><th colspan="2">Action</th>
+ </tr>
+{section name=id loop=$entries}
+ <tr class="contentrow{cycle values="even,odd"}">
+ <td class="contentcell">{$entries[id].sn|escape:"html"}, {$entries[id].fn|escape:"html"}</td>
+ <td class="contentcell"><a href="mailto:{$entries[id].mail|escape:"html"}">{$entries[id].mail|escape:"html"}</a></td>
+ {if $entries[id].deleted neq "FALSE"}
+ <td class="actioncell" colspan="2">User Deleted, awaiting cleanup...</td>
+ {else}
+ <td class="actioncell"><a href="user.php?action=modify&dn={$entries[id].dn|escape:"url"}">Modify</a></td>
+ <td class="actioncell"><a href="user.php?action=delete&dn={$entries[id].dn|escape:"url"}">Delete</a></td>
+ {/if}
+ </tr>
+{/section}
+</table>
diff --git a/php/admin/templates/en/vacation.tpl b/php/admin/templates/en/vacation.tpl
new file mode 100644
index 0000000..b681207
--- /dev/null
+++ b/php/admin/templates/en/vacation.tpl
@@ -0,0 +1,22 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<h1>Vacation Notification</h1>
+<div class="contentform">
+<form method="POST">
+<input type="checkbox" name="active" value="true" {if $active}checked{/if} /> Activate vacation notification<br />
+<textarea name="text" cols="80" rows="10">{$text|escape}</textarea><br />
+Resend notification only after <input type="text" size="5" name="days" value="{$days}" /> days<br />
+Send responses for these addresses:<br />
+<textarea name="addresses" cols="80" rows="3">
+{section name="id" loop="$addresses"}
+{$addresses[id]}
+{/section}
+</textarea><br />
+(one address per line)<br />
+<input type="submit" name="submit" value="Update"/><br />
+</form>
+</div>
diff --git a/php/admin/templates/en/welcome.tpl b/php/admin/templates/en/welcome.tpl
new file mode 100644
index 0000000..afae88e
--- /dev/null
+++ b/php/admin/templates/en/welcome.tpl
@@ -0,0 +1,9 @@
+{* Smarty Template *}
+{*
+ Local variables:
+ buffer-file-coding-system: utf-8
+ End:
+*}
+<div class="contenttext">
+<h1>Welcome to the Kolab administration interface</h1>
+</div>
diff --git a/www/admin/addressbook/addr.php b/www/admin/addressbook/addr.php
index b2cfa84..884dd73 100644
--- a/www/admin/addressbook/addr.php
+++ b/www/admin/addressbook/addr.php
@@ -1,7 +1,6 @@
<?php
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
require_once('admin/include/form.class.php');
@@ -37,11 +36,11 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
$form->entries['lastname']['value'] = $lastname;
$form->entries['mail']['value'] = $mail_0;
- foreach( array( 'title', 'o', 'ou', 'roomNumber', 'street', 'postOfficeBox',
+ foreach( array( 'title', 'o', 'ou', 'street', 'postOfficeBox',
'postalCode', 'l', 'c', 'telephoneNumber',
- 'facsimileTelephoneNumber' ) as $attr ) {
- if (is_array($ldap_object[strtolower($attr)])) $v = $ldap_object[strtolower($attr)][0];
- else $v = $ldap_object[strtolower($attr)];
+ 'facsimileTelephoneNumber' ) as $attr ) {
+ if (is_array($ldap_object[$attr])) $v = $ldap_object[$attr][0];
+ else $v = $ldap_object[$attr];
$form->entries[$attr]['value'] = $v;
}
if (is_array($ldap_object['alias'])) {
@@ -49,47 +48,11 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
unset( $arr['count'] );
$v = join("\n", $arr );
}
- else $v = $ldap_object['alias'];
+ else $v = $ldap_object[$attr];
$form->entries['alias']['value'] = $v;
$form->entries['action']['value'] = 'save';
}
-$dn="";
-if (!empty($_REQUEST['dn'])) $dn = trim($_REQUEST['dn']);
-
-function checkuniquemail( $form, $key, $value ) {
- global $ldap;
- global $dn;
- global $action;
- $value = trim($value);
- if( $value == '' ) return ''; // OK
-
- $excludedn = false;
- if( $action == 'save' ) $excludedn = trim($dn);
-
- if( $ldap->countMail( $_SESSION['base_dn'], $value, $excludedn ) > 0 ) {
- return _('User, vCard or distribution list with this email address already exists');
- } else {
- return '';
- }
-}
-
-function checkuniquealias( $form, $key, $value ) {
- global $ldap;
- global $action;
- global $dn;
- $excludedn = false;
- if( $action == 'save' ) $excludedn = trim($dn);
- $lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
- $str = '';
- foreach( $lst as $alias ) {
- debug( "looking at $alias, exluding $dn" );
- if( $ldap->countMail( $_SESSION['base_dn'], $alias, $excludedn ) > 0 ) {
- $str .= _('Email address ').htmlentities($alias)._(' collision <br />');
- }
- }
- return $str;
-}
/**** Submenu for current page ***/
$menuitems[$sidx]['selected'] = 'selected';
@@ -100,6 +63,9 @@ if (!empty($_REQUEST['action']) &&
in_array($_REQUEST['action'],$valid_actions)) $action = trim($_REQUEST['action']);
else array_push($errors, _("Error: need valid action to proceed") );
+$dn="";
+if (!empty($_REQUEST['dn'])) $dn = trim($_REQUEST['dn']);
+
if (!$errors && $auth->group() != 'maintainer' && $auth->group() != 'admin')
array_push($errors, _("Error: You don't have the required Permissions") );
@@ -115,15 +81,13 @@ $entries = array( 'firstname' => array( 'name' => _('First Name'),
'validation' => 'notempty',
'comment' => _('Required') ),
'title' => array( 'name' => _('Title') ),
- 'mail' => array( 'name' => _('Primary E-Mail Address'),
- 'validation' => 'checkuniquemail' ),
+ 'mail' => array( 'name' => _('Primary E-Mail Address') ),
'alias' => array( 'name' => _('E-Mail Aliases'),
'type' => 'textarea',
- 'validation' => 'checkuniquealias',
'comment' => _('One address per line')),
'o' => array( 'name' => _('Organisation') ),
'ou' => array( 'name' => _('Organisational Unit') ),
- 'roomNumber' => array( 'name' => _('Room Number') ),
+ 'room' => array( 'name' => _('Room Number') ),
'street' => array( 'name' => _('Street Address') ),
'postOfficeBox' => array( 'name' => _('Post Box') ),
'postalCode' => array( 'name' => _('Postal Code') ),
@@ -134,9 +98,10 @@ $entries = array( 'firstname' => array( 'name' => _('First Name'),
$entries['action'] = array( 'name' => 'action',
'type' => 'hidden' );
-$dn = '';
-if( $action == 'modify' || $action == 'delete' || $action == 'save') {
- if( $_REQUEST['dn'] ) {
+if( $action == 'modify' || $action == 'delete' ) {
+ if( $_POST['dn'] ) {
+ $dn = $POST['dn'];
+ } else if( $_REQUEST['dn'] ) {
$dn = $_REQUEST['dn'];
} else {
array_push($errors, _("Error: DN required for $action operation") );
@@ -160,7 +125,7 @@ if( !$errors ) {
$content = $form->outputForm();
} else {
$addressbook_root = "cn=external,".$_SESSION['base_dn'];
- $ldap_object = array('objectClass' => array( 'top', 'inetOrgPerson', 'kolabInetOrgPerson' ) );
+ $ldap_object = array('objectClass' => 'inetOrgPerson');
$firstname = trim($_POST['firstname']);
$lastname = trim($_POST['lastname']);
$ldap_object['sn'] = trim($lastname);
@@ -172,26 +137,25 @@ if( !$errors ) {
$key = $attr;
$args = array();
while (!empty($_POST[$key])) {
- $args[$count] = $_POST[$key];
+ $args[$count] = trim($_POST[$key]);
$count++;
$key = $attr."_".$count;
}
if ($count > 0) $ldap_object[$attr] = $args;
- elseif (!empty($_POST[$key])) $ldap_object[$attr] = $_POST[$key];
- else $ldap_object[$attr] = array();
+ else if (!empty($_POST[$key])) $ldap_object[$attr] = $_POST[$key];
+ }
+ if( !empty( $_POST['alias'] ) ) {
+ $ldap_object['alias'] = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $_POST['alias'] ) ), 'strlen') );
}
- $ldap_object['alias'] = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $_POST['alias'] ) ), 'strlen') );
- if ($action == "save") {
+ if ($action == "save") {
if (!$errors) {
if (!empty($ldap_object['cn'])) $newdn = "cn=".$ldap_object['cn'].",".$addressbook_root;
else $newdn = $dn;
- debug("action=save, dn=$dn, newdn=$newdn<br/>\n");
if (strcmp($dn,$newdn) != 0) {
if (($result=ldap_read($ldap->connection,$dn,"(objectclass=*)")) &&
($entry=ldap_first_entry($ldap->connection,$result)) &&
($oldattrs=ldap_get_attributes($ldap->connection,$entry))) {
- foreach( $ldap_object as $k => $v ) if( $v == array() ) unset( $ldap_object[$k] );
if (!ldap_add($ldap->connection,$newdn, $ldap_object) || !ldap_delete($ldap->connection,$dn)) {
array_push($errors, _("LDAP Error: could not rename ").$dn.
" to ".$newdn." ".ldap_error($ldap->connection));
@@ -213,7 +177,6 @@ if( !$errors ) {
} else {
if (!$errors) {
$dn = "cn=".$ldap_object['cn'].",".$addressbook_root;
- foreach( $ldap_object as $k => $v ) if( $v == array() ) unset( $ldap_object[$k] );
if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object)) {
array_push($errors, _("LDAP Error: could not add object ").$dn.": ".ldap_error($ldap->connection));
} else {
@@ -255,16 +218,11 @@ if( !$errors ) {
}
break;
case 'delete':
- foreach( $form->entries as $k => $v ) {
- if( $v['type'] != 'hidden' ) {
- $form->entries[$k]['attrs'] = 'readonly';
- }
- }
$result = $ldap->search( $dn, '(objectClass=*)' );
if( $result ) {
$ldap_object = ldap_get_entries( $ldap->connection, $result );
if( $ldap_object['count'] == 1 ) {
- fill_form_for_modify( $form, $ldap_object[0] );
+ fill_form_for_modify( &$form, $ldap_object[0] );
$form->entries['action']['value'] = 'kill';
foreach( $form->entries as $key ) {
$form->entries[$key]['attrs'] = 'readonly';
@@ -293,7 +251,7 @@ if( !$errors ) {
/**** Insert into template and output ***/
$smarty =& new MySmarty();
-$smarty->assign( 'errors', array_merge($errors,$form->errors) );
+$smarty->assign( 'errors', $errors );
$smarty->assign( 'messages', $messages );
$smarty->assign( 'heading', $heading );
$smarty->assign( 'uid', $auth->uid() );
diff --git a/www/admin/addressbook/index.php b/www/admin/addressbook/index.php
index 378da7c..83ca00a 100644
--- a/www/admin/addressbook/index.php
+++ b/www/admin/addressbook/index.php
@@ -1,6 +1,6 @@
<?php
/*
- (c) 2004 Klar䬶dalens Datakonsult AB
+ (c) 2004 Klarlvdalens Datakonsult AB
(c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
(c) 2003 Martin Konold <martin.konold@erfrakon.de>
This program is Free Software under the GNU General Public License (>=v2).
@@ -9,7 +9,6 @@
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
$errors = array();
@@ -38,50 +37,17 @@ else $page = "1";
if( !$errors ) {
if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
else $base_dn = 'k=kolab';
- $userfilter = "cn=*";
- $filterattr = $_REQUEST['filterattr'];
- $filtertype = $_REQUEST['filtertype'];
- $filtervalue = $_REQUEST['filtervalue'];
- if( !in_array( $filterattr, array( 'cn', 'mail' ) ) ) $filterattr = 'cn';
- if( isset( $filtervalue ) && !empty( $filtervalue ) ) {
- switch( $filtertype ) {
- case 'contains': // contains
- $userfilter = "$filterattr=*".$ldap->escape($filtervalue).'*';
- break;
- case 'is': // is
- $userfilter = "$filterattr=".$ldap->escape($filtervalue);
- break;
- case 'begins': // begins with
- $userfilter = "$filterattr=".$ldap->escape($filtervalue).'*';
- break;
- case 'ends': // ends with
- $userfilter = "$filterattr=*".$ldap->escape($filtervalue);
- break;
- }
- }
- $alphalimit = '';
- if( isset( $_REQUEST['alphalimit']) ) {
- $ala='sn'; // alpha limit attibute
- switch( $_REQUEST['alphalimit'] ) {
- case a: $alphalimit = "(|($ala=a*)($ala=b*)($ala=c*)($ala=d*)($ala=e*)($ala=f*))"; break;
- case g: $alphalimit = "(|($ala=g*)($ala=h*)($ala=i*)($ala=j*)($ala=k*)($ala=l*))"; break;
- case m: $alphalimit = "(|($ala=m*)($ala=n*)($ala=o*)($ala=p*)($ala=q*)($ala=r*))"; break;
- case s: $alphalimit = "(|($ala=s*)($ala=t*)($ala=u*)($ala=v*)($ala=w*)($ala=x*)($ala=y*)($ala=z*))"; break;
- case other: $alphalimit = "(|($ala=æ*)($ala=ø*)($ala=å*)($ala=ä*)($ala=ö*)($ala=ü*)($ala=0*)($ala=1*)($ala=2*)($ala=3*)($ala=4*)($ala=5*)($ala=6*)($ala=7*)($ala=8*)($ala=9*))"; break;
- default: $alphalimit = '';
- }
- }
- $filter = "(&($userfilter)$alphalimit(objectclass=inetOrgPerson)(!(uid=*))(sn=*))";
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(!(uid=*))(sn=*))";
$result = ldap_search($ldap->connection, $base_dn, $filter);
if( $result ) {
$count = ldap_count_entries($ldap->connection, $result);
$title = "Manage Address Book ($count Addresses)";
// if there are more than 2000 entries, split in 26 categories for every letter,
// or if more than 50, put in groups, or else just show all.
- if ( false && $count > 2000) {
+ if ($count > 2000) {
// ... TODO
$template = 'addrlistalpha.tpl';
- } else if( false && $count > 50 ) {
+ } else if( $count > 50 ) {
// ... TODO
$template = 'addrlistgroup.tpl';
} else {
@@ -114,18 +80,6 @@ $smarty->assign( 'errors', $errors );
$smarty->assign( 'uid', $auth->uid() );
$smarty->assign( 'group', $auth->group() );
$smarty->assign( 'page_title', $menuitems[$sidx]['title'] );
-$smarty->assign( 'self_url', $PHP_SELF );
-
-$smarty->assign( 'filterattrs', array( 'cn' => _('Name'),
- 'mail' => _('Email') ) );
-$smarty->assign( 'filtertypes', array( 'contains' => _('contains'),
- 'is' => _('is'),
- 'begins' => _('begins with'),
- 'ends' => _('ends with') ) );
-$smarty->assign( 'filterattr', $filterattr );
-$smarty->assign( 'filtertype', $filtertype );
-$smarty->assign( 'filtervalue', $filtervalue );
-
$smarty->assign( 'entries', $entries );
$smarty->assign( 'menuitems', $menuitems );
$smarty->assign( 'submenuitems',
@@ -142,4 +96,4 @@ $smarty->display('page.tpl');
buffer-file-coding-system: utf-8
End:
*/
-?> \ No newline at end of file
+?>
diff --git a/www/admin/administrator/admin.php b/www/admin/administrator/admin.php
index 85aa5d5..340dd2c 100644
--- a/www/admin/administrator/admin.php
+++ b/www/admin/administrator/admin.php
@@ -1,26 +1,6 @@
<?php
-/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
-
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
require_once('admin/include/form.class.php');
@@ -48,7 +28,7 @@ function checkuniquemail( $form, $key, $value ) {
if( is_unique( 'uid', $value ) ) {
return '';
} else {
- return _('Account with this UID already exists');
+ return _('Administrator with this UID already exists');
}
}
@@ -91,13 +71,6 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
$form->entries['uid']['value'] = $uid;
$form->entries['uid']['attrs'] = 'readonly';
- // Block password change for manager
- if( $uid == 'manager' ) {
- unset($form->entries['password_1']);
- $form->entries['password_0']['type'] = 'comment';
- $form->entries['password_0']['value'] = _('Manager\'s password can\'t be changed from the webgui');
- }
-
/*
foreach( array( 'title', 'o', 'ou', 'street', 'postOfficeBox',
'postalCode', 'l', 'c', 'telephoneNumber',
@@ -201,7 +174,7 @@ switch( $action ) {
} else {
debug("Process...");
$ldap_object = array();
- $ldap_object['objectClass'] = array('top','inetOrgPerson', 'kolabInetOrgPerson');
+ $ldap_object['objectClass'] = 'inetOrgPerson';
$ldap_object['sn'] = trim($_POST['lastname']);
$ldap_object['cn'] = trim($_POST['firstname']).' '.$ldap_object['sn'];
if( !empty( $_POST['password_0'] ) ) {
@@ -210,13 +183,13 @@ switch( $action ) {
}
if( $action == 'firstsave' ) $ldap_object['uid'] = trim( strtolower( $_POST['uid'] ) );
- debug_var_dump( $ldap_object );
+ var_dump( $ldap_object );
$domain_dn = domain_dn();
if ($action == "save") {
if (!$errors) {
- if (!empty($ldap_object['cn'])) $newdn = "cn=".$ldap_object['cn'].",cn=internal,".$domain_dn;
+ if (!empty($ldap_object['cn'])) $newdn = "cn=".$ldap_object['cn'].",".$domain_dn;
else $newdn = $dn;
if (!$visible && !strstr($newdn,$dn_add)) {
list($cn,$rest) = split(',', $newdn, 2);
@@ -227,8 +200,6 @@ switch( $action ) {
($entry=ldap_first_entry($ldap->connection,$result)) &&
($oldattrs=ldap_get_attributes($ldap->connection,$entry))) {
$ldap_object['uid'] = $oldattrs['uid'][0];
- if( empty($ldap_object['userPassword']) )
- $ldap_object['userPassword'] = $oldattrs['userPassword'][0];
if (!ldap_add($ldap->connection,$newdn, $ldap_object) )
array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ").ldap_error($ldap->connection));
if( !$errors ) {
@@ -238,17 +209,17 @@ switch( $action ) {
}
if( !$errors ) {
// Update admin group
- $groupdn = 'cn=admin,cn=internal,'.$domain_dn;
- if( !ldap_mod_add( $ldap->connection,
+ $groupdn = 'cn=admin,'.$domain_dn;
+ if( !ldap_mod_delete($ldap->connection,$groupdn,
+ array( 'member' => $dn ) ) ) {
+ $errors[] = _("LDAP Error: Could not remove old group entry $dn: ")
+ .ldap_error($ldap->connection());
+ }
+ if( !$errors && ldap_mod_add( $ldap->connection,
$groupdn,
array( 'member' => $newdn ) ) ) {
$errors[] = _("LDAP Error: Could not add new group entry $newdn: ")
- .ldap_error($ldap->connection);
- }
- if( !$errors && !ldap_mod_del($ldap->connection,$groupdn,
- array( 'member' => $dn ) ) ) {
- $errors[] = _("LDAP Error: Could not remove old group entry $dn: ")
- .ldap_error($ldap->connection);
+ .ldap_error($ldap->connection());
}
}
$dn = $newdn;
@@ -270,14 +241,14 @@ switch( $action ) {
} else {
// firstsave
if (!$errors) {
- $dn = "cn=".$ldap_object['cn'].",cn=internal,".$domain_dn;
+ $dn = "cn=".$ldap_object['cn'].",".$domain_dn;
debug("Calling ldap_add with dn=$dn");
// Add object to db
if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object))
array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection));
// Add object to admin group
- if( $dn && !ldap_mod_add($ldap->connection, 'cn=admin,cn=internal,'.$domain_dn,
+ if( $dn && !ldap_mod_add($ldap->connection, 'cn=admin,'.$domain_dn,
array( 'member' => $dn ) ) ) {
array_push($errors, _("LDAP Error: could not add object $dn to maintainer group: ").ldap_error($ldap->connection));
}
@@ -332,7 +303,7 @@ switch( $action ) {
array_push($errors, _("Error: you need administrative permissions to delete administrators"));
if (!$errors) {
- if(!ldap_mod_del($ldap->connection, 'cn=admin,cn=internal,'.domain_dn(), array('member' => $dn ) )) {
+ if(!ldap_mod_del($ldap->connection, 'cn=admin,'.domain_dn(), array('member' => $dn ) )) {
$errors[] = _("LDAP Error: Could not remove $dn from admin group: ")
.ldap_error($ldap->connection);
}
diff --git a/www/admin/administrator/index.php b/www/admin/administrator/index.php
index 0cc30e1..c814acb 100644
--- a/www/admin/administrator/index.php
+++ b/www/admin/administrator/index.php
@@ -1,26 +1,6 @@
<?php
-/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
-
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
$errors = array();
@@ -50,14 +30,13 @@ if( !$errors ) {
if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
else $base_dn = 'k=kolab';
- $maintainers = $ldap->groupMembers( "cn=internal,$base_dn", 'admin' );
+ $maintainers = $ldap->groupMembers( $base_dn, 'admin' );
$filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
- $result = ldap_search($ldap->connection, $base_dn, $filter, array( 'uid', 'sn', 'cn', 'kolabdeleteflag' ));
+ $result = ldap_list($ldap->connection, $base_dn, $filter, array( 'uid', 'sn', 'cn', 'deleteflag' ));
if( $result ) {
- $count = count($maintainers)-1;
- $title = _('Manage Administrators (').$count._(' Administrators)');
+ $title = _('Manage Administrators (').count($maintainers)._(' Administrators)');
// if there are more than 2000 entries, split in 26 categories for every letter,
// or if more than 50, put in groups, or else just show all.
if (false && $count > 2000) {
@@ -76,25 +55,23 @@ if( !$errors ) {
while( $entry ) {
$attrs = ldap_get_attributes($ldap->connection, $entry);
$dn = ldap_get_dn($ldap->connection,$entry);
- $deleted = array_key_exists('kolabdeleteflag',$attrs)?$attrs['kolabdeleteflag'][0]:"FALSE";
+ $deleted = array_key_exists('deleteflag',$attrs)?$attrs['deleteflag'][0]:"FALSE";
$userid = $attrs['uid'][0];
- if( $userid != 'manager' ) {
- $sn = $attrs['sn'][0];
- $cn = $attrs['cn'][0];
- $a = strlen($sn);
- $b = strlen($cn);
- $fn = substr($cn, 0, $b - $a);
- // skip admins and maintainers
- if( array_key_exists( $dn, $maintainers ) ) {
- $entries[] = array( 'dn' => $dn,
- 'sn' => $sn,
- 'fn' => $fn,
- 'uid' => $userid,
- 'deleted' => $deleted );
- }
+ $sn = $attrs['sn'][0];
+ $cn = $attrs['cn'][0];
+ $a = strlen($sn);
+ $b = strlen($cn);
+ $fn = substr($cn, 0, $b - $a);
+ // skip admins and maintainers
+ if( array_key_exists( $dn, $maintainers ) ) {
+ $entries[] = array( 'dn' => $dn,
+ 'sn' => $sn,
+ 'fn' => $fn,
+ 'uid' => $userid,
+ 'deleted' => $deleted );
}
$entry = ldap_next_entry( $ldap->connection,$entry );
- }
+ }
}
}
}
diff --git a/www/admin/distributionlist/index.php b/www/admin/distributionlist/index.php
index e83d97c..e6ec0ac 100644
--- a/www/admin/distributionlist/index.php
+++ b/www/admin/distributionlist/index.php
@@ -1,28 +1,14 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- * Copyright (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
- * Copyright (c) 2003 Martin Konold <martin.konold@erfrakon.de>
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarälvdalens Datakonsult AB
+ (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
+ (c) 2003 Martin Konold <martin.konold@erfrakon.de>
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
$errors = array();
@@ -45,7 +31,7 @@ $menuitems[$sidx]['selected'] = 'selected';
if( !$errors ) {
if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
else $base_dn = 'k=kolab';
- $filter = "(&(cn=*)(objectclass=kolabGroupOfNames))";
+ $filter = "(&(cn=*)(objectclass=groupOfNames))";
$result = ldap_search($ldap->connection, $base_dn, $filter);
if( $result ) {
$count = ldap_count_entries($ldap->connection, $result);
@@ -57,15 +43,11 @@ if( !$errors ) {
$attrs = ldap_get_attributes($ldap->connection, $entry);
$dn = ldap_get_dn($ldap->connection,$entry);
$cn = $attrs['cn'][0];
- if( $cn != 'admin' && $cn != 'maintainer' ) {
- $kolabdeleteflag = $attrs['kolabdeleteflag'][0];
- $kolabhomeserver = _('not yet implemented');
- $internal = (strpos($dn,"cn=internal")!==false);
- $entries[] = array( 'dn' => $dn,
- 'cn' => $cn,
- 'deleted' => $kolabdeleteflag,
- 'internal' => $internal );
- }
+ $deleteflag = $attrs['deleteflag'][0];
+ $homeserver = _('not yet implemented');
+ $entries[] = array( 'dn' => $dn,
+ 'cn' => $cn,
+ 'deleted' => $deleteflag );
$entry = ldap_next_entry( $ldap->connection,$entry );
}
}
diff --git a/www/admin/distributionlist/list.php b/www/admin/distributionlist/list.php
index fed4407..92903d4 100644
--- a/www/admin/distributionlist/list.php
+++ b/www/admin/distributionlist/list.php
@@ -1,26 +1,13 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarälvdalens Datakonsult AB
+
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
require_once('admin/include/form.class.php');
@@ -39,26 +26,15 @@ if( $auth->group() != 'maintainer' && $auth->group() != 'admin') {
require_once('admin/include/menu.php');
function checkemaillist( $form, $key, $value ) {
- global $ldap;
if( $key == 'members' ) {
$lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
- if( count($lst) < 1 ) return _('Please add at least one member');
- foreach( $lst as $a ) {
- debug("Trying $a");
- ($dn = $ldap->dnForMail($a)) || ($dn = $ldap->dnForUid($a)) || ($dn = $ldap->dnForAlias($a));
- if( !$dn ) return _("No user with email address, UID or alias $a");
- }
+ /*foreach( $lst as $a ) {
+ if( !ereg('.*@.*', $a ) ) return 'Invalid email address syntax';
+ }*/
}
return '';
}
-function mail_domain()
-{
- global $ldap;
- $kolab = $ldap->read( 'k=kolab,'.$_SESSION['base_dn'] );
- return $kolab['postfix-mydomain'][0];
-}
-
function checkuniquemail( $form, $key, $value ) {
global $ldap;
if( $key == 'cn' ) {
@@ -90,10 +66,9 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
$form->entries['action']['value'] = 'save';
$m = $ldap_object['member'];
unset( $m['count'] );
- debug_var_dump( $m );
$form->entries['members']['value'] = join("\r\n",
array_map( create_function( '$dn',
- 'global $ldap; return $ldap->mailForDn($dn);' ), $m) );
+ 'global $ldap;return $ldap->uidForDn($dn);' ), $m) );
$internaldn = 'cn=internal,'.domain_dn();
debug("internaldn=\"$internaldn\"");
debug("dn=\"$dn\"");
@@ -126,10 +101,10 @@ $entries = array( 'cn' => array( 'name' => _('List Name'),
'comment' => _('Required') ),
'members' => array( 'name' => _('Members'),
'type' => 'textarea',
- 'comment' => _('One email address per line'),
+ 'comment' => _('One UID per line'),
'validation' => 'checkemaillist'));
-$entries['hidden'] = array( 'name' => _('Hidden'),
+$entries['hidden'] = array( 'name' => 'Hidden',
'type' => 'checkbox',
'value' => false,
'comment' => _('Check here to make this distribution list available only to authenticated users'));
@@ -169,23 +144,18 @@ if( !$errors ) {
else $visible = true;
if (!$visible) $dl_root = "cn=internal,".$dl_root;
- $ldap_object = array('objectClass' => 'kolabGroupOfNames');
- $cn = strtolower(trim($_POST['cn']));
-
- // Keep cn and mail in sync
+ $ldap_object = array('objectClass' => 'groupOfNames');
+ $cn = trim($_POST['cn']);
$ldap_object['cn'] = $cn;
- $ldap_object['mail'] = $cn.'@'.mail_domain();
-
+
$ldap_object['member'] = array();
$lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', trim($_POST['members']) ) ), 'strlen') );
foreach( $lst as $a ) {
- debug("Translating $a");
- ($memberdn = $ldap->dnForMail($a)) || ($memberdn = $ldap->dnForUid($a)) || ($memberdn = $ldap->dnForAlias($a));
- debug("Found $memberdn");
+ $memberdn = $ldap->dnForUid($a);
if( $memberdn ) {
$ldap_object['member'][] = $memberdn;
} else {
- $errors[] = _("No user with address $a");
+ $errors[] = _("No such UID $a");
break;
}
}
@@ -270,7 +240,7 @@ if( !$errors ) {
}
break;
case 'modify':
- $result = $ldap->search( $dn, '(objectClass=kolabGroupOfNames)' );
+ $result = $ldap->search( $dn, '(objectClass=groupOfNames)' );
if( $result ) {
$ldap_object = ldap_get_entries( $ldap->connection, $result );
if( $ldap_object['count'] == 1 ) {
@@ -286,7 +256,7 @@ if( !$errors ) {
}
break;
case 'delete':
- $result = $ldap->search( $dn, '(objectClass=kolabGroupOfNames)' );
+ $result = $ldap->search( $dn, '(objectClass=groupOfNames)' );
if( $result ) {
$ldap_object = ldap_get_entries( $ldap->connection, $result );
if( $ldap_object['count'] == 1 ) {
diff --git a/www/admin/index.php b/www/admin/index.php
index c189674..34bfeca 100644
--- a/www/admin/index.php
+++ b/www/admin/index.php
@@ -1,52 +1,19 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarlvdalens Datakonsult AB
+
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
/**** Authentication etc. ***/
require_once('admin/include/menu.php');
-function exists_group( $group ) {
- global $ldap;
- $filter = '(&(objectClass=kolabGroupOfNames)(cn='.$ldap->escape($group).'))';
- $res = $ldap->search( $_SESSION['base_dn'], $filter, array( 'dn' ) );
- return ( $ldap->count($res) > 0 );
-}
-
-/**** Check for system aliases ****/
-$maincontent = 'welcome.tpl';
-if( $auth->group() == 'admin' ) {
- if( !exists_group( 'hostmaster' ) ||
- !exists_group( 'postmaster' ) ||
- !exists_group( 'abuse' ) ||
- !exists_group( 'virusalert' ) ||
- !exists_group( 'MAILER-DAEMON' ) ) {
- // Ok, user did not set up system aliases
- $maincontent = 'systemaliasnagscreen.tpl';
- }
-}
-
/**** Insert into template and output ***/
$smarty = new MySmarty();
$smarty->assign( 'topdir', $topdir );
@@ -55,7 +22,7 @@ $smarty->assign( 'group', $auth->group() );
$smarty->assign( 'page_title', 'Kolab' );
$smarty->assign( 'menuitems', $menuitems );
$smarty->assign( 'submenuitems', array() );
-$smarty->assign( 'maincontent', $maincontent );
+$smarty->assign( 'maincontent', 'welcome.tpl' );
$smarty->display('page.tpl');
/*
diff --git a/www/admin/kolab/erfrakon.php b/www/admin/kolab/erfrakon.php
index 69aea9e..81502fb 100644
--- a/www/admin/kolab/erfrakon.php
+++ b/www/admin/kolab/erfrakon.php
@@ -1,28 +1,14 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- * Copyright (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
- * Copyright (c) 2003 Martin Konold <martin.konold@erfrakon.de>
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarlvdalens Datakonsult AB
+ (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
+ (c) 2003 Martin Konold <martin.konold@erfrakon.de>
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
/**** Authentication etc. ***/
diff --git a/www/admin/kolab/index.php b/www/admin/kolab/index.php
index ae00c51..5ce42d7 100644
--- a/www/admin/kolab/index.php
+++ b/www/admin/kolab/index.php
@@ -1,6 +1,6 @@
<?php
/*
- (c) 2004 Klarälvdalens Datakonsult AB
+ (c) 2004 Klarlvdalens Datakonsult AB
(c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
(c) 2003 Martin Konold <martin.konold@erfrakon.de>
This program is Free Software under the GNU General Public License (>=v2).
@@ -9,7 +9,6 @@
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
/**** Authentication etc. ***/
diff --git a/www/admin/kolab/intevation.php b/www/admin/kolab/intevation.php
index 5f0b9b5..a793435 100644
--- a/www/admin/kolab/intevation.php
+++ b/www/admin/kolab/intevation.php
@@ -9,7 +9,6 @@
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
/**** Authentication etc. ***/
diff --git a/www/admin/kolab/kdab.php b/www/admin/kolab/kdab.php
index 1ae3972..758a94e 100644
--- a/www/admin/kolab/kdab.php
+++ b/www/admin/kolab/kdab.php
@@ -9,7 +9,6 @@
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
/**** Authentication etc. ***/
diff --git a/www/admin/kolab/kde.php b/www/admin/kolab/kde.php
index 899aaaa..1e8fad3 100644
--- a/www/admin/kolab/kde.php
+++ b/www/admin/kolab/kde.php
@@ -1,6 +1,6 @@
<?php
/*
- (c) 2004 Klarälvdalens Datakonsult AB
+ (c) 2004 Klarlvdalens Datakonsult AB
(c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
(c) 2003 Martin Konold <martin.konold@erfrakon.de>
This program is Free Software under the GNU General Public License (>=v2).
@@ -9,7 +9,6 @@
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
/**** Authentication etc. ***/
diff --git a/www/admin/logout.php b/www/admin/logout.php
index d597ba1..a2311e1 100644
--- a/www/admin/logout.php
+++ b/www/admin/logout.php
@@ -1,34 +1,6 @@
<?php
-/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
-
session_start();
session_destroy();
session_unset();
header('Location: /admin/');
-
-/*
- Local variables:
- mode: php
- indent-tabs-mode: t
- tab-width: 4
- buffer-file-coding-system: utf-8
- End:
- */
?> \ No newline at end of file
diff --git a/www/admin/maintainer/index.php b/www/admin/maintainer/index.php
index 5fc7002..88ca79c 100644
--- a/www/admin/maintainer/index.php
+++ b/www/admin/maintainer/index.php
@@ -1,26 +1,13 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarälvdalens Datakonsult AB
+
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
$errors = array();
@@ -28,7 +15,7 @@ $errors = array();
/**** Authentication etc. ***/
$sidx = 'maintainer';
-if( $auth->group() != 'admin' ) {
+if( $auth->group() != 'admin') {
array_push($errors, _("Error: You don't have Permissions to access this Menu"));
}
@@ -50,10 +37,10 @@ if( !$errors ) {
if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
else $base_dn = 'k=kolab';
- $maintainers = $ldap->groupMembers( "cn=internal,$base_dn", 'maintainer' );
+ $maintainers = $ldap->groupMembers( $base_dn, 'maintainer' );
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(!(uid=manager))(sn=*))";
- $result = ldap_search($ldap->connection, $base_dn, $filter, array( 'uid', 'sn', 'cn', 'kolabdeleteflag' ));
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
+ $result = ldap_list($ldap->connection, $base_dn, $filter, array( 'uid', 'sn', 'cn', 'deleteflag' ));
if( $result ) {
$title = _('Manage Maintainers (').count($maintainers)._(' Maintainers)');
@@ -75,7 +62,7 @@ if( !$errors ) {
while( $entry ) {
$attrs = ldap_get_attributes($ldap->connection, $entry);
$dn = ldap_get_dn($ldap->connection,$entry);
- $deleted = array_key_exists('kolabdeleteflag',$attrs)?$attrs['kolabdeleteflag'][0]:"FALSE";
+ $deleted = array_key_exists('deleteflag',$attrs)?$attrs['deleteflag'][0]:"FALSE";
$userid = $attrs['uid'][0];
$sn = $attrs['sn'][0];
$cn = $attrs['cn'][0];
diff --git a/www/admin/maintainer/maintainer.php b/www/admin/maintainer/maintainer.php
index 30f7e13..05e56d6 100644
--- a/www/admin/maintainer/maintainer.php
+++ b/www/admin/maintainer/maintainer.php
@@ -1,26 +1,13 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarälvdalens Datakonsult AB
+
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
require_once('admin/include/form.class.php');
@@ -48,7 +35,7 @@ function checkuniquemail( $form, $key, $value ) {
if( is_unique( 'uid', $value ) ) {
return '';
} else {
- return _('Account with this UID already exists');
+ return _('User with this email address already exists');
}
}
@@ -139,7 +126,7 @@ $dn="";
if (!empty($_REQUEST['dn'])) $dn = trim(urldecode($_REQUEST['dn']));
// Check auth
-if (!$errors && $auth->group() != 'admin' && $auth->group() != 'maintainer' ) {
+if (!$errors && $auth->group() != "admin" ) {
array_push($errors, _("Error: You don't have the required Permissions"));
}
@@ -194,7 +181,7 @@ switch( $action ) {
} else {
debug("Process...");
$ldap_object = array();
- $ldap_object['objectClass'] = array( 'top', 'inetOrgPerson', 'kolabInetOrgPerson');
+ $ldap_object['objectClass'] = 'inetOrgPerson';
$ldap_object['sn'] = trim($_POST['lastname']);
$ldap_object['cn'] = trim($_POST['firstname']).' '.$ldap_object['sn'];
if( !empty( $_POST['password_0'] ) ) {
@@ -203,13 +190,13 @@ switch( $action ) {
}
if( $action == 'firstsave' ) $ldap_object['uid'] = trim( strtolower( $_POST['uid'] ) );
- debug_var_dump( $ldap_object );
+ var_dump( $ldap_object );
$domain_dn = domain_dn();
if ($action == "save") {
if (!$errors) {
- if (!empty($ldap_object['cn'])) $newdn = "cn=".$ldap_object['cn'].",cn=internal,".$domain_dn;
+ if (!empty($ldap_object['cn'])) $newdn = "cn=".$ldap_object['cn'].",".$domain_dn;
else $newdn = $dn;
if (!$visible && !strstr($newdn,$dn_add)) {
list($cn,$rest) = split(',', $newdn, 2);
@@ -220,8 +207,6 @@ switch( $action ) {
($entry=ldap_first_entry($ldap->connection,$result)) &&
($oldattrs=ldap_get_attributes($ldap->connection,$entry))) {
$ldap_object['uid'] = $oldattrs['uid'][0];
- if( empty($ldap_object['userPassword']) )
- $ldap_object['userPassword'] = $oldattrs['userPassword'][0];
if (!ldap_add($ldap->connection,$newdn, $ldap_object) )
array_push($errors, _("LDAP Error: could not rename $dn to $newdn: ")
.ldap_error($ldap->connection));
@@ -233,17 +218,17 @@ switch( $action ) {
}
if( !$errors ) {
// Update maintainer group
- $groupdn = 'cn=maintainer,cn=internal,'.$domain_dn;
- if( !ldap_mod_add( $ldap->connection,
+ $groupdn = 'cn=maintainer,'.$domain_dn;
+ if( !ldap_mod_delete($ldap->connection,$groupdn,
+ array( 'member' => $dn ) ) ) {
+ $errors[] = _("LDAP Error: Could not remove old group entry $dn: ")
+ .ldap_error($ldap->connection());
+ }
+ if( !$errors && ldap_mod_add( $ldap->connection,
$groupdn,
array( 'member' => $newdn ) ) ) {
$errors[] = _("LDAP Error: Could not add new group entry $newdn: ")
- .ldap_error($ldap->connection);
- }
- if( !$errors && !ldap_mod_del($ldap->connection,$groupdn,
- array( 'member' => $dn ) ) ) {
- $errors[] = _("LDAP Error: Could not remove old group entry $dn: ")
- .ldap_error($ldap->connection);
+ .ldap_error($ldap->connection());
}
}
$dn = $newdn;
@@ -265,11 +250,11 @@ switch( $action ) {
} else {
// firstsave
if (!$errors) {
- $dn = "cn=".$ldap_object['cn'].",cn=internal,".$domain_dn;
+ $dn = "cn=".$ldap_object['cn'].",".$domain_dn;
debug("Calling ldap_add with dn=$dn");
if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object))
- array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection));
- if( $dn && !ldap_mod_add($ldap->connection, 'cn=maintainer,cn=internal,'.$domain_dn,
+ array_push($errors, _("LDAP Error: could not add object $dn_ ").ldap_error($ldap->connection));
+ if( $dn && !ldap_mod_add($ldap->connection, 'cn=maintainer,'.$domain_dn,
array( 'member' => $dn ) ) ) {
array_push($errors, _("LDAP Error: could not add object $dn to maintainer group: ")
.ldap_error($ldap->connection));
@@ -325,12 +310,12 @@ switch( $action ) {
array_push($errors, _("Error: you need administrative permissions to delete users"));
if (!$errors) {
- if(!ldap_mod_del($ldap->connection, 'cn=maintainer,cn=internal,'.domain_dn(), array('member' => $dn ) )) {
+ if(!ldap_mod_del($ldap->connection, 'cn=maintainer,'.domain_dn(), array('member' => $dn ) )) {
$errors[] = _("LDAP Error: Could not remove $dn from maintainer group: ")
.ldap_error($ldap->connection);
}
if( !$errors ) {
- $delete_template['kolabdeleteflag'] = 'TRUE';
+ $delete_template['deleteflag'] = 'TRUE';
if( !$ldap->deleteObject($dn)) {
array_push($errors, _("LDAP Error: could not mark $dn for deletion ")
.ldap_error($ldap->connection));
diff --git a/www/admin/pics/kde.jpg b/www/admin/pics/kde.jpg
index a276a67..28fc982 100644
--- a/www/admin/pics/kde.jpg
+++ b/www/admin/pics/kde.jpg
Binary files differ
diff --git a/www/admin/pics/kolab_logo.png b/www/admin/pics/kolab_logo.png
index 27b7d12..a09acdd 100644
--- a/www/admin/pics/kolab_logo.png
+++ b/www/admin/pics/kolab_logo.png
Binary files differ
diff --git a/www/admin/service/index.php b/www/admin/service/index.php
index d9e2896..8b57f02 100644
--- a/www/admin/service/index.php
+++ b/www/admin/service/index.php
@@ -1,7 +1,6 @@
<?php
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
$errors = array();
@@ -37,19 +36,9 @@ function extract_ldap_values()
global $sieve;
global $ftp;
global $http;
- global $httpallowunauthfb;
global $amavis;
global $quotawarn;
- global $freebusypast;
- global $postfixmydomain;
- global $postfixmynetworks;
- global $postfixallowunauth;
- global $postfixrelayhost;
- global $postfixrelayhostmx;
global $kolabhost;
- global $kolabfilterverifyfrom;
- global $kolabfilterallowsender;
- global $kolabfilterrejectforgedfrom;
// Get values from LDAP
if (($result = ldap_read($ldap->connection, "k=kolab,".$_SESSION['base_dn'], '(objectclass=*)')) &&
@@ -62,28 +51,10 @@ function extract_ldap_values()
$sieve = $attrs['cyrus-sieve'][0];
$ftp = $attrs['proftpd-ftp'][0];
$http = $attrs['apache-http'][0];
- $httpallowunauthfb = $attrs['apache-allow-unauthenticated-fb'][0];
$amavis = $attrs['postfix-enable-virus-scan'][0];
$quotawarn = $attrs['cyrus-quotawarn'][0];
- $freebusypast = $attrs['kolabFreeBusyPast'][0];
- $postfixmydomain = $attrs['postfix-mydomain'][0];
- unset( $attrs['postfix-mynetworks']['count'] );
- $postfixmynetworks = join(', ',$attrs['postfix-mynetworks']);
- $postfixallowunauth = $attrs['postfix-allow-unauthenticated'][0];
- $postfixrelayhost = $attrs['postfix-relayhost'][0];
- if( ereg( '\\[(.+)\\]', $postfixrelayhost, $regs ) ) {
- $postfixrelayhost = $regs[1];
- $postfixrelayhostmx = 'false';
- } else if( $postfixrelayhost != '' ) {
- $postfixrelayhostmx = 'true';
- } else {
- $postfixrelayhostmx = 'false';
- }
- $kolabhost = $attrs['kolabHost'];
+ $kolabhost = $attrs['kolabhost'];
unset( $kolabhost['count'] );
- $kolabfilterverifyfrom = $attrs['kolabfilter-verify-from-header'][0];
- $kolabfilterallowsender = $attrs['kolabfilter-allow-sender-header'][0];
- $kolabfilterrejectforgedfrom = $attrs['kolabfilter-reject-forged-from-header'][0];
ldap_free_result($result);
}
}
@@ -94,26 +65,6 @@ function toboolstr( $b ) { return ( $b == 'TRUE' )?'true':'false'; }
extract_ldap_values();
// Write back to LDAP
-if( $_REQUEST['submitsystemalias'] ) {
- $mail = trim($_REQUEST['systemaliasmail']);
- $dn = $ldap->dnForMailOrAlias( $mail );
- if( !$dn ) {
- $errors[] = _("No account found for email address $mail");
- } else {
- foreach( array( 'postmaster', 'hostmaster', 'abuse', 'virusalert', 'MAILER-DAEMON' ) as $group ) {
- $attrs = array( 'objectClass' => array( 'top', 'kolabGroupOfNames' ),
- 'cn' => $group,
- 'mail' => $group.'@'.$postfixmydomain,
- 'member' => $dn );
- if( !ldap_add( $ldap->connection, "cn=$group,".$_SESSION['base_dn'], $attrs ) ) {
- $errors[] = _("LDAP Error: Failed to add distribution list $group: ").$ldap->error();
- } else {
- $messages[] = "Successfully created distribution list $group";
- }
- }
- }
-}
-
if( $_REQUEST['submitservices'] ) {
$attrs = array();
if( postvalue( 'pop3' ) != $pop3 ) $attrs['cyrus-pop3'] = postvalue( 'pop3' );
@@ -140,69 +91,6 @@ if( $_REQUEST['submitquotawarn'] ) {
}
}
-if( $_REQUEST['submithttpallowunauthfb'] ) {
- $attrs = array();
- $attrs['apache-allow-unauthenticated-fb'] = postvalue( 'httpallowunauthfb' );
- if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) {
- $errors[] = _("LDAP Error: failed to modify kolab configuration object: ")
- .ldap_error($ldap->connection);
- }
-}
-
-if( $_REQUEST['submitfreebusypast'] ) {
- $attrs = array();
- $attrs['kolabFreeBusyPast'] = trim( $_REQUEST['freebusypast'] );
- if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) {
- $errors[] = _("LDAP Error: failed to modify kolab configuration object: ")
- .ldap_error($ldap->connection);
- }
-}
-
-if( $_REQUEST['submitpostfixmynetworks'] ) {
- $attrs = array();
- $attrs['postfix-mynetworks'] = preg_split( "/[\s,]+/", trim( $_REQUEST['postfixmynetworks'] ) );
- //if( $attrs['postfix-mynetworks'] == '' ) $attrs['postfix-mynetworks'] = array();
- if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) {
- $errors[] = _("LDAP Error: failed to modify kolab configuration object: ")
- .ldap_error($ldap->connection);
- }
-}
-
-if( $_REQUEST['submitpostfixallowunauth'] ) {
- $attrs = array();
- $attrs['postfix-allow-unauthenticated'] = postvalue( 'postfixallowunauth' );
- if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) {
- $errors[] = _("LDAP Error: failed to modify kolab configuration object: ")
- .ldap_error($ldap->connection);
- }
-}
-
-if( $_REQUEST['submitkolabfilter'] ) {
- $attrs = array(
- 'kolabfilter-verify-from-header' => postvalue( 'kolabfilterverifyfrom' ),
- 'kolabfilter-allow-sender-header' => postvalue( 'kolabfilterallowsender' ),
- 'kolabfilter-reject-forged-from-header' => $_REQUEST['kolabfilterrejectforgedfrom']=='TRUE'?'TRUE':'FALSE' );
- if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) {
- $errors[] = _("LDAP Error: failed to modify kolab configuration object: ")
- .ldap_error($ldap->connection);
- }
- }
-
-if( $_REQUEST['submitpostfixrelayhost'] ) {
- $value = trim( $_REQUEST['postfixrelayhost'] );
- if( $value != '' && !isset( $_REQUEST['postfixrelayhostmx'] ) ) {
- $value = "[$value]";
- }
- if( $value == '' ) $value = array();
- $attrs = array();
- $attrs['postfix-relayhost'] = $value;
- if( !($result = ldap_modify($ldap->connection, "k=kolab,".$_SESSION['base_dn'], $attrs)) ) {
- $errors[] = _("LDAP Error: failed to modify kolab configuration object: ")
- .ldap_error($ldap->connection);
- }
-}
-
-
if( $_REQUEST['deletekolabhost'] ) {
extract_ldap_values();
$key = array_search($_REQUEST['akolabhost'],$kolabhost);
@@ -235,20 +123,9 @@ $entries = array( array( 'service' => 'pop3', 'name' => _('POP3 Service'), 'ena
array( 'service' => 'imap', 'name' => _('IMAP Service'), 'enabled' => toboolstr( $imap ) ),
array( 'service' => 'imaps', 'name' => _('IMAP/SSL Service (TCP port 993)'), 'enabled' => toboolstr( $imaps ) ),
array( 'service' => 'sieve', 'name' => _('Sieve service (TCP port 2000)'), 'enabled' => toboolstr( $sieve ) ),
- array( 'service' => 'ftp',
- 'name' => _('FTP FreeBusy Service (Legacy, not interoperable with Kolab2 FreeBusy)'),
- 'enabled' => toboolstr( $ftp ) ),
- array( 'service' => 'http', 'name' => _('HTTP FreeBusy Service (Legacy)'), 'enabled' => toboolstr( $http ) ),
- array( 'service' => 'amavis', 'name' => _('Amavis Email Scanning (Virus/Spam)'),
- 'enabled' => toboolstr( $amavis ) ) );
-
-/**** Check for system aliases ****/
-function exists_group( $group ) {
- global $ldap;
- $filter = '(&(objectClass=kolabGroupOfNames)(cn='.$ldap->escape($group).'))';
- $res = $ldap->search( $_SESSION['base_dn'], $filter, array( 'dn' ) );
- return ( $ldap->count($res) > 0 );
-}
+ array( 'service' => 'ftp', 'name' => _('FTP FreeBusy Service'), 'enabled' => toboolstr( $ftp ) ),
+ array( 'service' => 'http', 'name' => _('HTTP FreeBusy Service'), 'enabled' => toboolstr( $http ) ),
+ array( 'service' => 'amavis', 'name' => _('Amavis Virus Scanning'), 'enabled' => toboolstr( $amavis ) ) );
/**** Insert into template and output ***/
$smarty = new MySmarty();
@@ -258,34 +135,12 @@ $smarty->assign( 'group', $auth->group() );
$smarty->assign( 'page_title', $menuitems[$sidx]['title'] );
$smarty->assign( 'entries', $entries );
$smarty->assign( 'quotawarn', $quotawarn );
-$smarty->assign( 'httpallowunauthfb', toboolstr($httpallowunauthfb) );
-$smarty->assign( 'freebusypast', $freebusypast );
-$smarty->assign( 'postfixmynetworks', $postfixmynetworks );
-$smarty->assign( 'postfixallowunauth', toboolstr($postfixallowunauth) );
-$smarty->assign( 'postfixrelayhost', $postfixrelayhost );
-$smarty->assign( 'postfixrelayhostmx', $postfixrelayhostmx );
-$smarty->assign( 'kolabfilterverifyfrom', toboolstr($kolabfilterverifyfrom) );
-$smarty->assign( 'kolabfilterallowsender', toboolstr($kolabfilterallowsender) );
-$smarty->assign( 'kolabfilterrejectforgedfrom', toboolstr($kolabfilterrejectforgedfrom) );
$smarty->assign( 'kolabhost', $kolabhost );
$smarty->assign( 'menuitems', $menuitems );
$smarty->assign( 'submenuitems',
array_key_exists('submenu',
$menuitems[$sidx])?$menuitems[$sidx]['submenu']:array() );
$smarty->assign( 'maincontent', 'service.tpl' );
-
-$smarty->assign( 'systemaliasconf', false );
-if( $auth->group() == 'admin' ) {
- if( !exists_group( 'hostmaster' ) ||
- !exists_group( 'postmaster' ) ||
- !exists_group( 'abuse' ) ||
- !exists_group( 'virusalert' ) ||
- !exists_group( 'MAILER-DAEMON' ) ) {
- // Ok, user did not set up system aliases
- $smarty->assign( 'systemaliasconf', true );
- }
-}
-
$smarty->display('page.tpl');
/*
diff --git a/www/admin/service/service.php b/www/admin/service/service.php
new file mode 100644
index 0000000..f902d57
--- /dev/null
+++ b/www/admin/service/service.php
@@ -0,0 +1,294 @@
+<?php
+/*
+ (c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
+ (c) 2003 Martin Konold <martin.konold@erfrakon.de>
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
+require_once('admin/include/authenticate.php');
+
+// checks if this file is openend by another file
+include_once("head.php");
+This("service/");
+Head();
+?>
+<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>
+</div>
+<?php
+
+function debug ($a) {
+// print "debug: $a<br>\n";
+}
+
+debug("debug is on");
+$errors = array();
+
+// user authentication
+$uid = $auth->uid();
+$bind_dn = $auth->dn();
+$group = $auth->group();
+$link = $ldap->connection;
+
+if (!$errors && $group != "admin")
+ array_push($errors, "Error: You don't have the required Permissions");
+
+debug("givenuid=$uid, bind_dn=$bind_dn, group=$group");
+
+$myself = $_SERVER['PHP_SELF'];
+
+$allowed = array('TRUE','FALSE'); // implement LDAP Boolean Syntax
+$attrs = array();
+if (!empty($HTTP_GET_VARS['pop3'])) {
+ $pop3 = urldecode($HTTP_GET_VARS['pop3']);
+ if (in_array($pop3, $allowed)) $attrs['cyrus-pop3'] = $pop3;
+}
+
+if (!empty($HTTP_GET_VARS['pop3s'])) {
+ $pop3s = urldecode($HTTP_GET_VARS['pop3s']);
+ if (in_array($pop3s, $allowed)) $attrs['cyrus-pop3s'] = $pop3s;
+}
+
+if (!empty($HTTP_GET_VARS['imaps'])) {
+ $imaps = urldecode($HTTP_GET_VARS['imaps']);
+ if (in_array($imaps, $allowed)) $attrs['cyrus-imaps'] = $imaps;
+}
+
+if (!empty($HTTP_GET_VARS['ftp'])) {
+ $ftp= urldecode($HTTP_GET_VARS['ftp']);
+ if (in_array($ftp, $allowed)) $attrs['proftpd-ftp'] = $ftp;
+}
+
+if (!empty($HTTP_GET_VARS['http'])) {
+ $http= urldecode($HTTP_GET_VARS['http']);
+ if (in_array($http, $allowed)) $attrs['apache-http'] = $http;
+}
+
+if (!empty($HTTP_GET_VARS['sieve'])) {
+ $sieve = urldecode($HTTP_GET_VARS['sieve']);
+ if (in_array($sieve, $allowed)) $attrs['cyrus-sieve'] = $sieve;
+}
+
+if( !empty($HTTP_GET_VARS['amavis']) ) {
+ $amavis = urldecode($HTTP_GET_VARS['amavis']);
+ if (in_array($amavis, $allowed)) $attrs['postfix-enable-virus-scan'] = $amavis;
+}
+
+#array_push($errors, "http $http ftp $ftp imap $imap imaps $imaps pop3 $pop3 pop3s $pop3s sieve $sieve");
+
+if ( ( isset($http) || isset($ftp) || isset($imaps) ||
+ isset($pop3) || isset($pop3s) || isset($sieve) || isset($amavis) ) &&
+ !($result = ldap_modify($link, "k=kolab,".$_SESSION['base_dn'], $attrs)) )
+ array_push($errors, "LDAP Error: failed to modify kolab configuration object ".ldap_error($link));
+
+if (($result = ldap_read($link, "k=kolab,".$_SESSION['base_dn'], '(objectclass=*)')) &&
+ ($entry = ldap_first_entry($link, $result)) &&
+ ($attrs = ldap_get_attributes($link, $entry))) {
+ $pop3 = $attrs['cyrus-pop3'][0];
+ $pop3s = $attrs['cyrus-pop3s'][0];
+ $imap = $attrs['cyrus-imap'][0];
+ $imaps = $attrs['cyrus-imaps'][0];
+ $sieve = $attrs['cyrus-sieve'][0];
+ $ftp = $attrs['proftpd-ftp'][0];
+ $http = $attrs['apache-http'][0];
+ $amavis = $attrs['postfix-enable-virus-scan'][0];
+ ldap_free_result($result);
+}
+?>
+<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">
+<?php if ($pop3 == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><a href="index.php?pop3=FALSE">disable pop3</a>
+<?php else: ?>
+<span class="inactive">disabled</span></td><td class="content"><a href="index.php?pop3=TRUE">activate pop3</a>
+<?php endif; ?>
+</td></tr>
+
+<tr><td class="content"> POP3/SSL service (TCP port 995) </td><td class="content">
+<?php if ($pop3s == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><a href="index.php?pop3s=FALSE">disable pop3s</a>
+<?php else: ?>
+<span class="inactive">disabled</span></td><td class="content"><a href="index.php?pop3s=TRUE">activate pop3s</a>
+<?php endif; ?>
+</td></tr>
+
+<tr><td class="content"> IMAP service </td><td class="content">
+<?php if ($imap == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><em class="unuseable">(may not be deactivated)</em>
+<?php endif; ?>
+</td></tr>
+
+<tr><td class="content"> IMAP/SSL service (TCP port 993) </td><td class="content">
+<?php if ($imaps == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><a href="index.php?imaps=FALSE">disable imaps</a>
+<?php else: ?>
+<span class="inactive">disabled</span></td><td class="content"><a href="index.php?imaps=TRUE">activate imaps</a>
+<?php endif; ?>
+</td></tr>
+
+<tr><td class="content"> Sieve service (TCP port 2000) </td><td class="content">
+<?php if ($sieve == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><a href="index.php?sieve=FALSE">disable sieve</a>
+<?php else: ?>
+<span class="inactive">disabled</span></td><td class="content"><a href="index.php?sieve=TRUE">activate sieve</a>
+<?php endif; ?>
+</td></tr>
+
+<tr><td class="content"> FTP free-busy service </td><td class="content">
+<?php if ($ftp == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><a href="index.php?ftp=FALSE">disable ftp</a>
+<?php else: ?>
+<span class="inactive">disabled</span></td><td class="content"><a href="index.php?ftp=TRUE">activate ftp</a>
+<?php endif; ?>
+</td></tr>
+
+<tr><td class="content"> HTTP free-busy service </td><td class="content">
+<?php if ($http == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><a href="index.php?http=FALSE">disable http</a>
+<?php else: ?>
+<span class="inactive">disabled</span></td><td class="content"><a href="index.php?http=TRUE">activate http</a>
+<?php endif; ?>
+</td></tr>
+
+<tr><td class="content"> Amavis Virus Scanning </td><td class="content">
+<?php if ($amavis == "TRUE"): ?>
+<span class="active">active</span></td><td class="content"><a href="index.php?amavis=FALSE">disable amavis</a>
+<?php else: ?>
+<span class="inactive">disabled</span></td><td class="content"><a href="index.php?amavis=TRUE">activate amavis</a>
+<?php endif; ?>
+</td></tr>
+
+<!-- <tr><center><td> HTTPS service (TCP port 443) </td>
+<td> <span style="color:#00FF00">active</span></td><td> (informational) </td></center></tr>
+
+<tr><center><td> SMTP service (TCP port 25) </td>
+<td> <span style="color:#00FF00">active</span></td><td> (informational) </td></center></tr>
+
+<tr><center><td> LDAP service (TCP port 389) </td>
+<td> <span style="color:#00FF00">active</span></td><td> (informational) </td></center></tr>
+-->
+
+</table>
+</div>
+<?php echo "\n\n"; ?>
+<div class="server">
+<?php
+// server configuration
+?>
+<div class="maintitle">Server Settings</div>
+<?php
+
+$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 ($group != "admin") array_push($errors, "Error: invalid permissions");
+
+if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
+ else $base_dn = 'k=kolab' ;
+
+$myself=$_SERVER['PHP_SELF'];
+
+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 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");
+}
+
+?>
+<?php Foot(); ?>
diff --git a/www/admin/sharedfolder/index.php b/www/admin/sharedfolder/index.php
index 5733947..62065a2 100644
--- a/www/admin/sharedfolder/index.php
+++ b/www/admin/sharedfolder/index.php
@@ -1,6 +1,6 @@
<?php
/*
- (c) 2004 Klarälvdalens Datakonsult AB
+ (c) 2004 Klarlvdalens Datakonsult AB
(c) 2003 Tassilo Erlewein <tassilo.erlewein@erfrakon.de>
(c) 2003 Martin Konold <martin.konold@erfrakon.de>
This program is Free Software under the GNU General Public License (>=v2).
@@ -9,7 +9,6 @@
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
$errors = array();
@@ -32,7 +31,7 @@ $menuitems[$sidx]['selected'] = 'selected';
if( !$errors ) {
if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
else $base_dn = 'k=kolab';
- $filter = "(&(cn=*)(objectclass=kolabSharedFolder))";
+ $filter = "(&(cn=*)(objectclass=sharedfolder))";
$result = ldap_search($ldap->connection, $base_dn, $filter);
if( $result ) {
$count = ldap_count_entries($ldap->connection, $result);
@@ -44,12 +43,12 @@ if( !$errors ) {
$attrs = ldap_get_attributes($ldap->connection, $entry);
$dn = ldap_get_dn($ldap->connection,$entry);
$cn = $attrs['cn'][0];
- $deleted = array_key_exists('kolabDeleteflag',$attrs)?$attrs['kolabDeleteflag'][0]:"FALSE";
- $kolabhomeserver = $attrs['kolabHomeServer'][0];
+ $deleteflag = $attrs['deleteflag'][0];
+ $homeserver = $attrs['homeServer'][0];
$entries[] = array( 'dn' => $dn,
'cn' => $cn,
- 'kolabhomeserver' => $kolabhomeserver,
- 'deleted' => $deleted );
+ 'homeserver' => $homeserver,
+ 'deleted' => $deleteflag );
$entry = ldap_next_entry( $ldap->connection,$entry );
}
}
diff --git a/www/admin/sharedfolder/sf.php b/www/admin/sharedfolder/sf.php
index 9e27a1a..3b4b44b 100644
--- a/www/admin/sharedfolder/sf.php
+++ b/www/admin/sharedfolder/sf.php
@@ -1,15 +1,13 @@
<?php
/*
- * (c) 2004 Klarälvdalens Datakonsult AB
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * This program is Free Software under the GNU General Public License (>=v2).
- * Read the file COPYING that comes with this packages for details.
+ (c) 2004 Klarlvdalens Datakonsult AB
+
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
require_once('admin/include/form.class.php');
@@ -31,12 +29,12 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
else $cn = $ldap_object['cn'];
$form->entries['cn']['value'] = $cn;
- if (is_array($ldap_object['cyrus-userquota'])) $userquota = $ldap_object['cyrus-userquota'][0];
- else $userquota = $ldap_object['cyrus-userquota'];
- $form->entries['cyrus-userquota']['value'] = $userquota;
+ if (is_array($ldap_object['userquota'])) $userquota = $ldap_object['userquota'][0];
+ else $userquota = $ldap_object['userquota'];
+ $form->entries['userquota']['value'] = $userquota;
- if (is_array($ldap_object['kolabHomeServer'])) $kolabhomeserver = $ldap_object['kolabHomeServer'][0];
- $form->entries['kolabhomeserver']['value'] = $kolabhomeserver;
+ if (is_array($ldap_object['homeserver'])) $homeserver = $ldap_object['homeserver'][0];
+ $form->entries['homeserver']['value'] = $homeserver;
$form->entries['action']['value'] = 'save';
//debug("got userquota=$userquota<br/>cn=$cn<br/>");
@@ -47,14 +45,14 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
list($u, $p ) = split( ' ', $acl, 2 );
if( !strncmp( "group:", $u, 6 ) ) $u = substr( $u, 6 );
//debug( "u=$u, p=$p" );
- $form->entries['acl_'.$aclcount] = array( 'name' => _('Permission for UID/email/GID'),
+ $form->entries['acl_'.$aclcount] = array( 'name' => _('Permission for UID/GID'),
'type' => 'aclselect',
'user' => $u,
'perm' => $p
);
$aclcount++;
}
- $form->entries['acl_'.$aclcount] = array( 'name' => _('Permission for UID/email/GID'),
+ $form->entries['acl_'.$aclcount] = array( 'name' => _('Permission for UID/GID'),
'type' => 'aclselect',
'user' => '',
'perm' => 'all'
@@ -71,20 +69,18 @@ function process_acl( $uid, $perm )
// Special users allowed
return "$uid $perm";
}
- $res = $ldap->search( $_SESSION['base_dn'], '(&(|(uid='.$ldap->escape($uid).')(mail='.$ldap->escape($uid).')(alias='.$ldap->escape($uid).'))(objectClass=kolabInetOrgPerson))',
- array('dn', 'mail' ) );
+ $res = $ldap->search( $_SESSION['base_dn'], '(&(uid='.$ldap->escape($uid).')(objectClass=kInetOrgPerson))',
+ array('dn') );
if( $ldap->count($res) == 1 ) {
// Ok, we have a regular user
- $entries = $ldap->getEntries();
- $mail = $entries[0]['mail'][0];
$ldap->freeSearchResult();
- return "$mail $perm";
+ return "$uid $perm";
}
$regs = array();
- if( ereg('(.*)@(.*)', $uid, $regs ) ) {
+ if( ereg('(.*)@(.*)', $uid, &$regs ) ) {
$cn = $regs[1];
- $res = $ldap->search( $_SESSION['base_dn'], '(&(cn='.$ldap->escape($cn).')(objectClass=kolabGroupOfNames))',
+ $res = $ldap->search( $_SESSION['base_dn'], '(&(cn='.$ldap->escape($cn).')(objectClass=groupOfNames))',
array('dn') );
if( $ldap->count($res) == 1 ) {
$objects = $ldap->getEntries();
@@ -119,12 +115,12 @@ if (!$errors && $auth->group() != 'maintainer' && $auth->group() != 'admin')
$entries = array( 'cn' => array( 'name' => _('Folder Name'),
'validation' => 'notempty',
'comment' => _('Required') ),
- 'kolabhomeserver' => array( 'name' => _('Folder Location'),
+ 'homeserver' => array( 'name' => _('Folder Location'),
'validation' => 'notempty',
'comment' => ($action=='create')?_('Required, non volatile'):_('Non volatile'),
- 'value' => $_SESSION['fqdnhostname'] ),
- 'cyrus-userquota' => array( 'name' => _('Quota Limit'),
- 'comment' => _('MBytes (empty for unlimited)') ),
+ 'value' => $_SESSION['fqhostname'] ),
+ 'userquota' => array( 'name' => _('Quota Limit'),
+ 'comment' => _('KBytes (empty for unlimited)') ),
'acl_0' => array( 'name' => _('Permission for UID/GID'),
'type' => 'aclselect',
'user' => 'anyone',
@@ -159,24 +155,10 @@ if( !$errors ) {
$content = $form->outputForm();
} else {
$sf_root = $_SESSION['base_dn'];
- $ldap_object = array('objectClass' => 'kolabSharedFolder');
- // OK, we need to get the name down to lowercase ascii only
- // we handle a few common cases here
- // Really cheesy, but strtolower is latin1 only :-(
+ $ldap_object = array('objectClass' => 'sharedfolder');
$cn = trim($_POST['cn']);
- debug("cn=$cn");
- $cn = strtolower(utf8_decode($cn));
- debug("cn=$cn");
- $cn = str_replace( utf8_decode('æ'), 'ae', $cn );
- $cn = str_replace( utf8_decode('ø'), 'oe', $cn );
- $cn = str_replace( utf8_decode('å'), 'aa', $cn );
- $cn = str_replace( utf8_decode('ä'), 'ae', $cn );
- $cn = str_replace( utf8_decode('ö'), 'oe', $cn );
- $cn = str_replace( utf8_decode('ü'), 'ue', $cn );
- $cn = str_replace( utf8_decode('ß'), 'ss', $cn );
- debug("cn=$cn");
- $ldap_object['cn'] = utf8_encode($cn);
- foreach ( array( 'cyrus-userquota') as $attr) {
+ $ldap_object['cn'] = $cn;
+ foreach ( array( 'userquota') as $attr) {
$count = 0;
$key = $attr;
$args = array();
@@ -188,9 +170,9 @@ if( !$errors ) {
if ($count > 0) $ldap_object[$attr] = $args;
else if (!empty($_POST[$key])) $ldap_object[$attr] = $_POST[$key];
}
- if( $ldap_object['cyrus-userquota'] == '' ) unset($ldap_object['cyrus-userquota']);
+ if( $ldap_object['userquota'] == '' ) unset($ldap_object['userquota']);
$aclcount = 0;
- while( isset($_POST['user_acl_'.$aclcount] )) {
+ while( $_POST['user_acl_'.$aclcount] ) {
if( !empty( $_POST['user_acl_'.$aclcount] ) ) {
$acl = process_acl( $_POST['user_acl_'.$aclcount], $_POST['perm_acl_'.$aclcount] );
if( $acl ) {
@@ -230,7 +212,7 @@ if( !$errors ) {
} else {
if (!$errors) {
$dn = "cn=".$ldap_object['cn'].",".$sf_root;
- $ldap_object['kolabHomeServer'] = trim($_POST['kolabhomeserver']);
+ $ldap_object['homeserver'] = trim($_POST['homeserver']);
if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object))
array_push($errors, _("LDAP Error: could not add object $dn: ")
.ldap_error($ldap->connection));
@@ -245,53 +227,64 @@ if( !$errors ) {
$form->entries['action']['value'] = 'save';
$form->entries['dn'] = array( 'type' => 'hidden', 'value' => $dn );
$form->entries['cn']['attrs'] = 'readonly';
- $form->entries['kolabhomeserver']['attrs'] = 'readonly';
+ $form->entries['homeserver']['attrs'] = 'readonly';
$heading = _('Modify Shared Folder');
- $ldap_object = $ldap->read( $dn );
- if( $ldap_object ) {
- fill_form_for_modify( $form, $ldap_object );
+ $result = $ldap->search( $dn, '(objectClass=sharedfolder)' );
+ if( $result ) {
+ $ldap_object = ldap_get_entries( $ldap->connection, $result );
+ if( $ldap_object['count'] == 1 ) {
+ $ldap_object = $ldap_object[0];
+ fill_form_for_modify( $form, $ldap_object );
+ }
+ $ldap->freeSearchResult();
}
$content = $form->outputForm();
}
}
break;
case 'modify':
- $ldap_object = $ldap->read( $dn );
- if( $ldap_object ) {
- fill_form_for_modify( $form, $ldap_object );
- $form->entries['action']['value'] = 'save';
- $form->entries['dn'] = array( 'type' => 'hidden', 'value' => $dn );
- $form->entries['cn']['attrs'] = 'readonly';
- $form->entries['kolabhomeserver']['attrs'] = 'readonly';
- $heading = _('Modify Shared Folder');
- $content = $form->outputForm();
- } else {
- array_push($errors, _("Error: No results returned for DN $dn"));
+ $result = $ldap->search( $dn, '(objectClass=sharedfolder)' );
+ if( $result ) {
+ $ldap_object = ldap_get_entries( $ldap->connection, $result );
+ if( $ldap_object['count'] == 1 ) {
+ fill_form_for_modify( $form, $ldap_object[0] );
+ $form->entries['action']['value'] = 'save';
+ $form->entries['dn'] = array( 'type' => 'hidden', 'value' => $dn );
+ $form->entries['cn']['attrs'] = 'readonly';
+ $form->entries['homeserver']['attrs'] = 'readonly';
+ $heading = _('Modify Shared Folder');
+ $content = $form->outputForm();
+ } else {
+ array_push($errors, _("Error: Multiple results returned for DN $dn"));
+ }
}
break;
case 'delete':
- $ldap_object = $ldap->read( $dn );
- if( $ldap_object ) {
- fill_form_for_modify( $form, $ldap_object );
- $form->entries['action']['value'] = 'kill';
- foreach( $form->entries as $key => $val ) {
- $form->entries[$key]['attrs'] = 'readonly';
+ $result = $ldap->search( $dn, '(objectClass=sharedfolder)' );
+ if( $result ) {
+ $ldap_object = ldap_get_entries( $ldap->connection, $result );
+ if( $ldap_object['count'] == 1 ) {
+ fill_form_for_modify( $form, $ldap_object[0] );
+ $form->entries['action']['value'] = 'kill';
+ foreach( $form->entries as $key => $val ) {
+ $form->entries[$key]['attrs'] = 'readonly';
+ }
+ $form->submittext = _('Delete');
+ $heading = _('Delete Shared Folder');
+ $content = $form->outputForm();
+ } else {
+ array_push($errors, _("Error: Multiple results returned for DN $dn"));
}
- $form->submittext = _('Delete');
- $heading = _('Delete Shared Folder');
- $content = $form->outputForm();
- } else {
- array_push($errors, _("Error: No results returned for DN $dn"));
}
break;
case 'kill':
if (!$errors) {
- if( $ldap->deleteSharedFolder($dn) ) {
+ if( $ldap->deleteObject($dn) ) {
$messages[] = _('Shared folder ').$_REQUEST['cn']._(' marked for deletion');
$heading = _('Entry Deleted');
$contenttemplate = 'sfdeleted.tpl';
} else {
- array_push($errors, _("LDAP Error: Could not mark $dn for deletion: ").ldap_error($link));
+ array_push($errors, _("LDAP Error: could mark $dn for deletion: ").ldap_error($link));
}
}
break;
diff --git a/www/admin/style.css b/www/admin/style.css
index e8c6047..97d2d31 100644
--- a/www/admin/style.css
+++ b/www/admin/style.css
@@ -33,8 +33,8 @@ a:hover { color: #113399; }
display:block;
background-image: url(pics/kolab_logo.png);
background-color: #B0BCD0;
- width: 245px;
- height: 70px;
+ width: 236px;
+ height: 68px;
margin-left: 1em;
margin-top: 0.4em;
float: left;
@@ -87,9 +87,6 @@ a:hover { color: #113399; }
#logout {
color: red;
}
-#maintitle {
- font-size: 200%;
-}
#maincontent {
display:block;
padding: 1em;
@@ -154,7 +151,6 @@ a:hover { color: #113399; }
padding: .1em .5em .1em .5em;
width: 10%;
margin: 0px;
- text-align: center;
}
.contentform {
/*float: left;*/
@@ -165,9 +161,6 @@ a:hover { color: #113399; }
.contentformtable {
font-size: 90%;
}
-.langcombo {
- font-size: 80%;
-}
#validators {
text-align: right;
@@ -177,9 +170,3 @@ th {
background-color: #EEEEEE;
border: 0px;
}
-
-.ctrl {
- background-color: #E0E3E0;
- border: solid 1px black;
- padding: .2em .5em .2em .5em;
-}
diff --git a/www/admin/user/forward.php b/www/admin/user/forward.php
index 8813810..bc1dc0b 100644
--- a/www/admin/user/forward.php
+++ b/www/admin/user/forward.php
@@ -1,28 +1,14 @@
<?php
/*
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarälvdalens Datakonsult AB
+
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once 'admin/include/mysmarty.php';
require_once 'admin/include/headers.php';
-require_once('admin/include/locale.php');
require_once 'admin/include/authenticate.php';
-require_once 'admin/include/sieveutils.class.php';
// Funny multiline string escaping in Sieve
function dotstuff( $str ) {
@@ -49,10 +35,10 @@ $menuitems[$sidx]['selected'] = 'selected';
/**** Sieve handling ***/
// this is the name KDE client stores - so we can also change the setting from KDE client
-$scriptname = "kolab-forward.siv";
+$scriptname = "kmail-forward.siv";
if( !$errors ) {
- $obj = $ldap->read( $auth->dn() );
- $sieve =& new Net_Sieve( $auth->uid(), $auth->password(), $obj['kolabHomeServer'][0] );
+ $sieve =& new Net_Sieve( $auth->uid(), $auth->password() );
+
// Update sieve script on server in case we have submit data
if( $_REQUEST['submit'] ) {
@@ -64,7 +50,7 @@ if( !$errors ) {
$errors[] = _('Please enter an email address');
} else {
$script =
- "require \"fileinto\";\r\nredirect \"".addslashes($address)."\";".($keep?" keep;":"");
+ "redirect \"".addslashes($address)."\";".($keep?" keep;":"");
if( PEAR::isError( $res = $sieve->installScript( $scriptname, $script, $active ) ) ) {
$errors[] = $res->getMessage();
$errors[] = _('Script was:');
@@ -81,11 +67,14 @@ if( !$errors ) {
}
}
+ // Fetch script data from server
$scripts = $sieve->listScripts();
if( in_array( $scriptname, $scripts ) ) {
- $script = $sieve->getScript($scriptname);
- $address = SieveUtils::getForwardAddress( $script );
- $keep = SieveUtils::getKeepOnServer( $script );
+ $script = $sieve->getScript( $scriptname );
+ if( ereg('redirect "(.*)";', $script, $regs ) ) {
+ $address = $regs[1];
+ }
+ $keep = ereg('"; keep;', $script, $regs );
} else {
$address = '';
$keep = true;
@@ -117,6 +106,5 @@ $smarty->display('page.tpl');
tab-width: 4
buffer-file-coding-system: utf-8
End:
- vim:encoding=utf-8:
*/
?>
diff --git a/www/admin/user/index.php b/www/admin/user/index.php
index c6f5705..0a81d9c 100644
--- a/www/admin/user/index.php
+++ b/www/admin/user/index.php
@@ -1,27 +1,13 @@
<?php
/*
- * Copyright (c) 2005 Klarälvdalens Datakonsult AB
- * Copyright (c) 2004 Klarälvdalens Datakonsult AB
- *
- * Written by Steffen Hansen <steffen@klaralvdalens-datakonsult.se>
- *
- * 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, 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 can view the GNU General Public License, online, at the GNU
- * Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
- */
+ (c) 2004 Klarlvdalens Datakonsult AB
+
+ This program is Free Software under the GNU General Public License (>=v2).
+ Read the file COPYING that comes with this packages for details.
+*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
$errors = array();
@@ -51,44 +37,11 @@ if( !$errors ) {
if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
else $base_dn = 'k=kolab';
- $privmembers = array_merge( $ldap->groupMembers( "cn=internal,$base_dn", 'admin' ),
- $ldap->groupMembers( "cn=internal,$base_dn", 'maintainer' ) );
+ $privmembers = array_merge( $ldap->groupMembers( $base_dn, 'admin' ),
+ $ldap->groupMembers( $base_dn, 'maintainer' ) );
- $userfilter = "cn=*";
- $filterattr = $_REQUEST['filterattr'];
- $filtertype = $_REQUEST['filtertype'];
- $filtervalue = $_REQUEST['filtervalue'];
- if( !in_array( $filterattr, array( 'cn', 'uid', 'mail' ) ) ) $filterattr = 'cn';
- if( isset( $filtervalue ) && !empty( $filtervalue ) ) {
- switch( $filtertype ) {
- case 'contains': // contains
- $userfilter = "$filterattr=*".$ldap->escape($filtervalue).'*';
- break;
- case 'is': // is
- $userfilter = "$filterattr=".$ldap->escape($filtervalue);
- break;
- case 'begins': // begins with
- $userfilter = "$filterattr=".$ldap->escape($filtervalue).'*';
- break;
- case 'ends': // ends with
- $userfilter = "$filterattr=*".$ldap->escape($filtervalue);
- break;
- }
- }
- $alphalimit = '';
- if( isset( $_REQUEST['alphalimit']) ) {
- $ala='sn'; // alpha limit attibute
- switch( $_REQUEST['alphalimit'] ) {
- case a: $alphalimit = "(|($ala=a*)($ala=b*)($ala=c*)($ala=d*)($ala=e*)($ala=f*))"; break;
- case g: $alphalimit = "(|($ala=g*)($ala=h*)($ala=i*)($ala=j*)($ala=k*)($ala=l*))"; break;
- case m: $alphalimit = "(|($ala=m*)($ala=n*)($ala=o*)($ala=p*)($ala=q*)($ala=r*))"; break;
- case s: $alphalimit = "(|($ala=s*)($ala=t*)($ala=u*)($ala=v*)($ala=w*)($ala=x*)($ala=y*)($ala=z*))"; break;
- case other: $alphalimit = "(|($ala=æ*)($ala=ø*)($ala=å*)($ala=ä*)($ala=ö*)($ala=ü*)($ala=0*)($ala=1*)($ala=2*)($ala=3*)($ala=4*)($ala=5*)($ala=6*)($ala=7*)($ala=8*)($ala=9*))"; break;
- default: $alphalimit = '';
- }
- }
- $filter = "(&($userfilter)$alphalimit(objectclass=kolabInetOrgPerson)(uid=*)(mail=*)(sn=*))";
- $result = ldap_search($ldap->connection, $base_dn, $filter, array( 'uid', 'mail', 'sn', 'cn', 'kolabDeleteflag' ));
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(mail=*)(sn=*))";
+ $result = ldap_search($ldap->connection, $base_dn, $filter, array( 'uid', 'mail', 'sn', 'cn', 'deleteflag' ));
if( $result ) {
$count = ldap_count_entries($ldap->connection, $result);
@@ -111,33 +64,20 @@ if( !$errors ) {
while( $entry ) {
$attrs = ldap_get_attributes($ldap->connection, $entry);
$dn = ldap_get_dn($ldap->connection,$entry);
- $deleted = array_key_exists('kolabDeleteflag',$attrs)?$attrs['kolabDeleteflag'][0]:"FALSE";
- $uid = $attrs['uid'][0];
+ $deleted = array_key_exists('deleteflag',$attrs)?$attrs['deleteflag'][0]:"FALSE";
+ $userid = $attrs['uid'][0];
$mail = $attrs['mail'][0];
$sn = $attrs['sn'][0];
$cn = $attrs['cn'][0];
$a = strlen($sn);
$b = strlen($cn);
$fn = substr($cn, 0, $b - $a);
- $dncomp = split( ',', $dn );
- if( in_array('cn=groups',$dncomp) ) {
- $type = 'G';
- } else if( in_array('cn=resources',$dncomp) ) {
- $type = 'R';
- } else if( in_array('cn=internal',$dncomp) ) {
- $type = 'I';
- } else {
- $type = 'U';
- }
-
// skip admins and maintainers
if( !array_key_exists( $dn, $privmembers ) ) {
$entries[] = array( 'dn' => $dn,
'sn' => $sn,
'fn' => $fn,
- 'type' => $type,
'mail' => $mail,
- 'uid' => $uid,
'deleted' => $deleted );
}
$entry = ldap_next_entry( $ldap->connection,$entry );
@@ -152,19 +92,6 @@ $smarty->assign( 'errors', $errors );
$smarty->assign( 'uid', $auth->uid() );
$smarty->assign( 'group', $auth->group() );
$smarty->assign( 'page_title', $menuitems[$sidx]['title'] );
-$smarty->assign( 'self_url', $PHP_SELF );
-
-$smarty->assign( 'filterattrs', array( 'cn' => _('Name'),
- 'mail' => _('Email'),
- 'uid' => _('UID') ) );
-$smarty->assign( 'filtertypes', array( 'contains' => _('contains'),
- 'is' => _('is'),
- 'begins' => _('begins with'),
- 'ends' => _('ends with') ) );
-$smarty->assign( 'filterattr', $filterattr );
-$smarty->assign( 'filtertype', $filtertype );
-$smarty->assign( 'filtervalue', $filtervalue );
-
$smarty->assign( 'entries', $entries );
$smarty->assign( 'menuitems', $menuitems );
$smarty->assign( 'submenuitems',
diff --git a/www/admin/user/user.php b/www/admin/user/user.php
index 77b56b4..3c1461f 100644
--- a/www/admin/user/user.php
+++ b/www/admin/user/user.php
@@ -1,14 +1,13 @@
<?php
/*
(c) 2004 Klarlvdalens Datakonsult AB
- (c) 2004 Martin Konold erfrakon <martin.konold@erfrakon.de>
+
This program is Free Software under the GNU General Public License (>=v2).
Read the file COPYING that comes with this packages for details.
*/
require_once('admin/include/mysmarty.php');
require_once('admin/include/headers.php');
-require_once('admin/include/locale.php');
require_once('admin/include/authenticate.php');
require_once('admin/include/form.class.php');
@@ -45,28 +44,12 @@ function domain_dn()
return $_SESSION['base_dn'];
}
-// return tru if $str ends with $sub
-function endsWith( $str, $sub ) {
- return ( substr( $str, strlen( $str ) - strlen( $sub ) ) == $sub );
-}
-
// Check that a uid is unique
function checkuniquemail( $form, $key, $value ) {
debug("checkuniquemail( $form, $key, $value )");
global $ldap;
- $value = trim($value);
- if( $value == '' ) return _('Please enter an email address');
-
- // Check that we are in the domain
- $kolab = $ldap->read( 'k=kolab,'.$_SESSION['base_dn'] );
- $domain = trim($kolab['postfix-mydomain'][0]);
- debug("value=$value, domain=$domain");
- if( !endsWith( $value, '@'.$domain ) ) {
- return _("Email address $value not in domain $domain");
- }
-
if( $ldap->countMail( $_SESSION['base_dn'], $value ) > 0 ) {
- return _('User, vCard or distribution list with this email address already exists');
+ return _('User or distribution list with this email address already exists');
} else {
return '';
}
@@ -83,28 +66,12 @@ function checkuniquealias( $form, $key, $value ) {
foreach( $lst as $alias ) {
debug( "looking at $alias, exluding $dn" );
if( $ldap->countMail( $_SESSION['base_dn'], $alias, $excludedn ) > 0 ) {
- $str .= _('Email address ').htmlentities($alias)._(' collision <br />');
+ $str .= _('Mail address ').htmlentities($alias)._(' already exists<br />');
}
}
return $str;
}
-function checkuid( $form, $key, $value ) {
- global $ldap;
- global $action;
- global $dn;
- $excludedn = false;
- if( $action == 'save' ) $excludedn = trim($dn);
- $lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
- $str = '';
- foreach( $lst as $uid ) {
- if( $ldap->countMail( $_SESSION['base_dn'], $uid, $excludedn ) > 0 ) {
- $str .= _('UID ').htmlentities($uid)._(' collision <br />');
- }
- }
- return $str;
-}
-
function checkdelegate( $form, $key, $value ) {
global $ldap;
global $action;
@@ -113,26 +80,13 @@ function checkdelegate( $form, $key, $value ) {
$lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
$str = '';
foreach( $lst as $delegate ) {
- if( $ldap->count( $ldap->search( $_SESSION['base_dn'], '(mail='.$ldap->escape($delegate).')' ) ) == 0 ) {
+ if( $ldap->count( $ldap->search( $_SESSION['base_dn'], '(uid='.$ldap->escape($delegate).')' ) ) == 0 ) {
return _("Delegate $delegate does not exist");
}
}
return '';
}
-// Check uid/gid used in invitation policy
-// We're pretty relaxed about what is entered
-// here and only check some basic syntax
-function checkpolicy( $form, $key, $value ) {
- foreach( $value as $v ) {
- $v = trim($v);
- if( !empty($v) && !ereg('^([0-9a-zA-Z._@ ]|-)*$', $v ) ) {
- return _("Illegal user or group $v");
- }
- }
- return '';
-}
-
// Check that password match
function checkpw( $form, $key, $value ) {
global $action;
@@ -152,110 +106,49 @@ function checkpw( $form, $key, $value ) {
return '';
}
-function policy2number( $pol, $default = 3 )
-{
- // Translate policy to number
- switch ($pol) {
- case 'ACT_ALWAYS_ACCEPT': return 0;
- case 'ACT_ALWAYS_REJECT': return 1;
- case 'ACT_REJECT_IF_CONFLICTS': return 2;
- case 'ACT_MANUAL_IF_CONFLICTS': return 3;
- case 'ACT_MANUAL': return 4;
- default: return $default;
- }
-}
-
-function apply_attributeaccess( &$entries ) {
- global $params;
- $attributeaccess =& $params['attribute_access'];
- foreach( $entries as $key=>$value ) {
- if( ereg( '(.*)_[0-9]', $key, $regs ) ) {
- $akey = $regs[1];
- } else {
- $akey = $key;
- }
- if( isset($attributeaccess[$akey] ) ) {
- if( $attributeaccess[$akey] == 'ro' ) {
- $entries[$key]['attrs'] = 'readonly';
- } else if( $attributeaccess[$akey] == 'hidden' ) {
- unset($entries[$key]);
- } else if( $attributeaccess[$akey] == 'mandatory' ) {
- if( isset( $entries[$key]['validation'] ) ) {
- if( is_array( $entries[$key]['validation'] ) ) {
- $entries[$key]['validation'][] = 'notempty';
- } else {
- $entries[$key]['validation'][] = array( $entries[$key]['validation'], 'notempty' );
- }
- } else {
- $entries[$key]['validation'] = 'notempty';
- }
- }
- }
- }
-}
-
function fill_form_for_modify( &$form, $dn, &$ldap_object ) {
- global $auth;
- if (is_array($ldap_object['sn'])) $sn = $ldap_object['sn'][0];
- else $sn = $ldap_object['sn'];
+ if (is_array($ldap_object['sn'])) $lastname = $ldap_object['sn'][0];
+ else $lastname = $ldap_object['sn'];
if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
else $cn = $ldap_object['cn'];
- if ($sn) {
- $a = strlen($sn);
+ if ($lastname) {
+ $a = strlen($lastname);
if ($cn) {
$b = strlen($cn);
- $givenname = substr($cn, 0, $b - $a);
+ $firstname = substr($cn, 0, $b - $a);
}
}
- if (is_array($ldap_object['mail'])) $mail = $ldap_object['mail'][0];
- else $mail = $ldap_object['mail'];
+ if (is_array($ldap_object['mail'])) $mail_0 = $ldap_object['mail'][0];
+ else $mail_0 = $ldap_object['mail'];
if (is_array($ldap_object['uid'])) $uid = $ldap_object['uid'][0];
else $uid = $ldap_object['uid'];
- $form->entries['givenname']['value'] = $givenname;
- $form->entries['sn']['value'] = $sn;
+ $form->entries['firstname']['value'] = $firstname;
+ $form->entries['lastname']['value'] = $lastname;
$form->entries['password_0']['value'] = '';
$form->entries['password_1']['value'] = '';
- $form->entries['mail']['value'] = $mail;
- $form->entries['mail']['attrs'] = 'readonly';
+ $form->entries['mail_0']['value'] = $mail_0;
+ $form->entries['mail_0']['attrs'] = 'readonly';
$form->entries['uid']['value'] = $uid;
-
// accttype
$dncomp = split( ',', $dn );
if( in_array('cn=groups',$dncomp) ) {
- $form->entries['accttype']['value'] = 2;
+ $form->entries['accttype']['value'] = 1;
} else if( in_array('cn=resources',$dncomp) ) {
- $form->entries['accttype']['value'] = 3;
- } else if( in_array('cn=internal',$dncomp) ) {
- $form->entries['accttype']['value'] = 1;
+ $form->entries['accttype']['value'] = 2;
} else {
$form->entries['accttype']['value'] = 0;
}
- if( $auth->group() == 'user' ) $form->entries['accttype']['attrs'] = 'readonly';
-
- // Automatic invitation handling
- $policies = array();
- for( $i = 0; $i < $ldap_object['kolabInvitationPolicy']['count']; $i++ ) {
- $resact = $ldap_object['kolabInvitationPolicy'][$i];
- debug("resact=$resact");
- if( ereg( '(.*):(.*)', trim($resact), $regs ) ) {
- $user = trim($regs[1]);
- $pol = trim($regs[2]);
- if( empty($user) ) continue;
- } else {
- $user = 'anyone';
- $pol = trim($resact);
- }
- if( $form->entries['accttype']['value'] == 1 ) {
- // default for groups
- $pol = policy2number( $pol, 3 /*ACT_MANUAL_IF_CONFLICTS*/ );
- } else {
- // default for resources
- $pol = policy2number( $pol, 2 /*ACT_REJECT_IF_CONFLICTS*/ );
- }
- $policies[$user] = $pol;
+
+ // visible
+ $internaldn = 'cn=internal,'.domain_dn();
+ debug("<br/>internaldn=$internaldn");
+ debug("<br/>ldap_object['dn']=$dn");
+ debug("<br/>substr=".substr( $dn, strlen($dn)-strlen( $internaldn ) ));
+ if( substr( $dn, strlen($dn)-strlen( $internaldn ) ) === $internaldn ) {
+ $form->entries['visible']['value'] = false;
+ } else {
+ $form->entries['visible']['value'] = true;
}
- if( !isset( $policies['anyone'] ) ) $policies['anyone'] = 4 /*ACT_MANUAL*/;
- $form->entries['kolabinvitationpolicy']['policies'] = $policies;
foreach( array( 'title', 'o', 'ou', 'roomNumber', 'street',
'postOfficeBox', 'postalCode', 'l', 'c',
@@ -271,44 +164,36 @@ function fill_form_for_modify( &$form, $dn, &$ldap_object ) {
unset( $arr['count'] );
$v = join("\n", $arr );
}
- else $v = "";
+ else $v = $ldap_object[$attr];
$form->entries['alias']['value'] = $v;
- // kolabdelegate
- if (is_array($ldap_object['kolabDelegate'])) {
- $arr = $ldap_object['kolabDelegate'];
+ // delegate
+ if (is_array($ldap_object['delegate'])) {
+ $arr = $ldap_object['delegate'];
unset( $arr['count'] );
$v = join("\n", $arr );
}
- else $v = "";
- $form->entries['kolabdelegate']['value'] = $v;
+ else $v = $ldap_object[$attr];
+ $form->entries['delegate']['value'] = $v;
- // kolabhomeserver
- if( is_array($ldap_object['kolabHomeServer']) ) {
- $form->entries['kolabhomeserver']['value'] = $ldap_object['kolabHomeServer'][0];
+ // homeServer
+ if( is_array($ldap_object['homeServer']) ) {
+ $form->entries['homeserver']['value'] = $ldap_object['homeServer'][0];
}
- $form->entries['kolabhomeserver']['attrs'] = 'readonly';
+ $form->entries['homeserver']['attrs'] = 'readonly';
$form->entries['action']['value'] = 'save';
// userquota
- if( isset( $form->entries['cyrus-userquota'] ) ) {
- if (is_array($ldap_object['cyrus-userquota'])) $userquota = $ldap_object['cyrus-userquota'][0];
- else $userquota = $ldap_object['cyrus-userquota'];
+ if( isset( $form->entries['userquota'] ) ) {
+ if (is_array($ldap_object['userquota'])) $userquota = $ldap_object['userquota'][0];
+ else $userquota = $ldap_object['userquota'];
if( $userquota > 0 ) {
- $form->entries['cyrus-userquota']['value'] = $userquota;
+ $form->entries['userquota']['value'] = $userquota;
} else {
- $form->entries['cyrus-userquota']['value'] = '';
+ $form->entries['userquota']['value'] = '';
}
}
-
- // freebusyfuture
- if( isset( $form->entries['kolabFreeBusyFuture_0'] ) ) {
- if( is_array( $ldap_object['kolabFreeBusyFuture'] ) )
- $freebusyfuture = $ldap_object['kolabFreeBusyFuture'][0];
- else $freebusyfuture = $ldap_object['kolabFreeBusyFuture'];
- }
- $form->entries['kolabFreeBusyFuture_0']['value'] = $freebusyfuture;
}
/**** Authentication etc. ***/
@@ -325,10 +210,10 @@ $contenttemplate = 'formcontainer.tpl';
// Get request data
if (!empty($_REQUEST['action']) &&
- in_array($_REQUEST['action'],$valid_actions)) $action = trim($_REQUEST['action']);
+ in_array($_REQUEST['action'],$valid_actions)) $action = trim(urldecode($_REQUEST['action']));
else array_push($errors, _("Error: need valid action to proceed") );
$dn="";
-if (!empty($_REQUEST['dn'])) $dn = trim($_REQUEST['dn']);
+if (!empty($_REQUEST['dn'])) $dn = trim(urldecode($_REQUEST['dn']));
if( $auth->group() == 'user' ) {
$dn = $auth->dn();
@@ -346,19 +231,19 @@ if( !$errors && $auth->group() == 'user' && ($action == 'firstsave' || $action =
// Fill in data
if ($action == "create") {
- $comment_mail = _('Required, non volatile');
+ $comment_mail_0 = _('Required, non volatile');
$comment_password = _('Required');
- $comment_kolabhomeserver = _('Required, non volatile');
+ $comment_homeserver = _('Required, non volatile');
} else {
- $comment_mail = _('Non volatile');
+ $comment_mail_0 = _('Non volatile');
$comment_password = _('Leave blank to keep password unchanged');
- $comment_kolabhomeserver = _('Non volatile');
+ $comment_homeserver = _('Non volatile');
}
-$entries = array( 'givenname' => array( 'name' => _('First Name'),
+$entries = array( 'firstname' => array( 'name' => _('First Name'),
'validation' => 'notempty',
'comment' => _('Required') ),
- 'sn' => array( 'name' => _('Last Name'),
+ 'lastname' => array( 'name' => _('Last Name'),
'validation' => 'notempty',
'comment' => _('Required') ),
'password_0' => array( 'name' => _('Password'),
@@ -369,36 +254,29 @@ $entries = array( 'givenname' => array( 'name' => _('First Name'),
'type' => 'password',
'validation' => 'checkpw',
'comment' => $comment_password ),
- 'mail' => array( 'name' => _('Primary Email Address'),
+ 'mail_0' => array( 'name' => _('Primary Email Address'),
'validation' => 'notempty',
- 'comment' => $comment_mail ),
+ 'comment' => $comment_mail_0 ),
'uid' => array( 'name' => _('Unique Identity (UID)'),
- 'validation' => 'checkuid',
+ #'validation' => '',
'comment' => _('Optional - Defaults to Primary Email Address') ),
- 'kolabhomeserver' => array( 'name' => _('Mailbox Home Server'),
- 'validation' => 'notempty',
- 'comment' => $comment_kolabhomeserver,
- 'value' => $_SESSION['fqdnhostname'] ),
+ 'homeserver' => array( 'name' => _('Mailbox Home Server'),
+ 'validation' => 'notempty',
+ 'comment' => $comment_homeserver,
+ 'value' => $_SESSION['fqhostname'] ),
'accttype' => array( 'name' => _('Account Type'),
- 'type' => 'select',
- 'options' => array( _('User Account'), _('Internal User Account'), _('Group Account'), _('Resource Account') ),
- 'value' => 0,
- 'comment' => _('NOTE: An internal user is a user that will not be visible in the address book')),
- 'kolabinvitationpolicy' => array( 'name' => _('Invitation Policy'),
- 'type' => 'resourcepolicy',
- 'policies' => array('anyone' => 4),
- 'validation' => 'checkpolicy',
- 'comment' => _('For automatic invitation handling') . '<br/>' .
- _('NOTE: For regular accounts to use this feature, give the \'calendar\' user access to the Calendar folder') ),
+ 'type' => 'select',
+ 'options' => array( _('User Account'), _('Group Account'), _('Resource Account') ),
+ 'value' => 0 ),
'title_0' => array( 'name' => _('Title') ) );
$entries['alias'] = array( 'name' => _('Email Aliases'),
'type' => 'textarea',
'validation' => 'checkuniquealias',
'comment' => _('One address per line') );
-$entries['kolabdelegate'] =array( 'name' => _('Delegates'),
+$entries['delegate'] =array( 'name' => _('Delegates'),
'type' => 'textarea',
'validation' => 'checkdelegate',
- 'comment' => _('One Email address per line') );
+ 'comment' => _('One UID per line') );
$entries['o_0'] = array( 'name' => _('Organisation') );
$entries['ou_0'] = array( 'name' => _('Organisational Unit') );
$entries['roomNumber_0'] = array( 'name' => _('Room Number') );
@@ -409,21 +287,18 @@ $entries['l_0'] = array( 'name' => _('City') );
$entries['c_0'] = array( 'name' => _('Country') );
$entries['telephoneNumber_0'] = array( 'name' => _('Telephone Number') );
$entries['facsimileTelephoneNumber_0'] = array( 'name' => _('Fax Number') );
+$entries['visible'] = array( 'name' => _('Addressbook'),
+ 'type' => 'checkbox',
+ 'value' => true,
+ 'comment' => _('Check here to make this users address <br> visible in the address book'));
if( $auth->group() == "admin" || $auth->group() == "maintainer" ) {
- $entries['cyrus-userquota'] = array( 'name' => _('User Quota in MBytes'),
+ $entries['userquota'] = array( 'name' => _('User Quota in KB'),
'comment' => _('Leave blank for unlimited') );
} else {
- $entries['givenname']['attrs'] = 'readonly';
- $entries['sn']['attrs'] = 'readonly';
- $entries['givenname']['comment'] = '';
- $entries['sn']['comment'] = '';
$entries['alias']['attrs'] = 'readonly';
- $entries['kolabhomeserver']['attrs'] = 'readonly';
+ $entries['homeserver']['attrs'] = 'readonly';
$entries['accttype']['attrs'] = 'readonly';
- $entries['uid']['attrs'] = 'readonly';
}
-$entries['kolabFreeBusyFuture_0'] = array( 'name' => _('Free/Busy interval in days'),
- 'comment' => _('Leave blank for default (60 days)') );
$entries['action'] = array( 'name' => 'action',
'type' => 'hidden' );
@@ -434,15 +309,12 @@ if( $dn ) {
}
}
-if( $auth->group() == 'user' ) {
- apply_attributeaccess( $entries );
-}
$form =& new KolabForm( 'user', 'createuser.tpl', $entries );
/***************** Main action swicth **********************/
switch( $action ) {
case 'firstsave':
debug("adding checkuniquemail to validation");
- $form->entries['mail']['validation'] = 'checkuniquemail';
+ $form->entries['mail_0']['validation'] = 'checkuniquemail';
case 'save':
if( $form->isSubmitted() ) {
if( !$form->validate() ) {
@@ -450,18 +322,14 @@ switch( $action ) {
$content = $form->outputForm();
} else {
$ldap_object = array();
- $ldap_object['objectClass'] = array('top', 'inetOrgPerson','kolabInetOrgPerson');
- $ldap_object['sn'] = trim($_POST['sn']);
- $ldap_object['cn'] = trim($_POST['givenname']).' '.$ldap_object['sn'];
- $ldap_object['givenName'] = trim($_POST['givenname']);
+ $ldap_object['objectClass'] = 'kInetOrgPerson';
+ $ldap_object['sn'] = trim($_POST['lastname']);
+ $ldap_object['cn'] = trim($_POST['firstname']).' '.$ldap_object['sn'];
+ $ldap_object['givenName'] = trim($_POST['firstname']);
if( !empty( $_POST['password_0'] ) ) {
$ldap_object['userPassword'] = '{sha}'.base64_encode( pack('H*',
sha1( $_POST['password_0'])));
- if( $action == 'save' && $auth->dn() == $dn ) {
- // We are editing our own password, let's update the session!
- $auth->setPassword($_POST['password_0']);
- }
- if( isset( $_POST['accttype'] ) && $_POST['accttype'] > 1 ) {
+ if( $_POST['accttype'] > 0 ) {
// We have a group or resource, create encrypted pw
$pubkeydata=file_get_contents("$kolab_prefix/etc/kolab/res_pub.pem" );
$pkey = openssl_pkey_get_public( $pubkeydata );
@@ -477,23 +345,22 @@ switch( $action ) {
$sslerr .= $msg.' ';
$errors[] = $sslerr;
} else {
- $ldap_object['kolabEncryptedPassword'] = base64_encode( $encpw );
+ $ldap_object['encryptedPassword'] = base64_encode( $encpw );
}
openssl_free_key( $pkey );
}
}
}
- $ldap_object['mail'] = trim( strtolower( $_POST['mail'] ) );
+ $ldap_object['mail'] = trim( strtolower( $_POST['mail_0'] ) );
$ldap_object['uid'] = trim( strtolower( $_POST['uid'] ) );
if( $action == 'firstsave' ) {
- if ($ldap_object['uid'] == "") $ldap_object['uid'] = $ldap_object['mail'];
- $ldap_object['kolabHomeServer'] = trim($_POST['kolabhomeserver']);
- } else {
- unset($ldap_object['kolabHomeServer']);
+ $ldap_object['uid'] = $ldap_object['mail'];
+ if ($ldap_object['uid'] == "") $ldap_object['uid'] = $ldap_object['mail'];
+ $ldap_object['homeServer'] = trim($_POST['homeserver']);
}
foreach( array( 'title', 'o', 'ou', 'roomNumber', 'street', 'postOfficeBox',
'postalCode', 'l', 'c', 'telephoneNumber',
- 'facsimileTelephoneNumber', 'kolabFreeBusyFuture' ) as $attr ) {
+ 'facsimileTelephoneNumber' ) as $attr ) {
$count = 0;
$key = $attr."_0";
$args = array();
@@ -504,35 +371,14 @@ switch( $action ) {
}
if ($count > 0) $ldap_object[$attr] = $args;
elseif (!empty($_POST[$key])) $ldap_object[$attr] = $_POST[$key];
- else $ldap_object[$attr] = array();
}
- {
- // Handle group/resource policies
- $i = 0;
- $ldap_object['kolabInvitationPolicy'] = array();
- while( isset( $_POST['user_kolabinvitationpolicy_'.$i] ) ) {
- $user = $_POST['user_kolabinvitationpolicy_'.$i];
- $pol = (int)$_POST['policy_kolabinvitationpolicy_'.$i];
- debug("Looking at $user:$pol");
- $i++;
- if( !empty($user) && 0 <= $pol && $pol < 5 ) {
- $ra = array('ACT_ALWAYS_ACCEPT',
- 'ACT_ALWAYS_REJECT',
- 'ACT_REJECT_IF_CONFLICTS',
- 'ACT_MANUAL_IF_CONFLICTS',
- 'ACT_MANUAL' );
- if( $ra[$pol] ) {
- $ldap_object['kolabInvitationPolicy'][] = ($user=='anyone'?"":"$user:").$ra[$pol];
- }
- }
- }
- }
+
$dn_add = "";
- // kolabdelegate
- $ldap_object['kolabDelegate'] = array_unique( array_filter( array_map( 'trim',
- preg_split( '/\n/', $_POST['kolabdelegate'] ) ), 'strlen') );
- if( !$ldap_object['kolabDelegate'] && $action == 'firstsave' ) unset($ldap_object['kolabDelegate']);
+ // delegate
+ $ldap_object['delegate'] = array_unique( array_filter( array_map( 'trim',
+ preg_split( '/\n/', $_POST['delegate'] ) ), 'strlen') );
+ if( !$ldap_object['delegate'] && $action == 'firstsave' ) unset($ldap_object['delegate']);
if ($auth->group() == "maintainer" || $auth->group() == "admin") {
@@ -540,75 +386,50 @@ switch( $action ) {
$ldap_object['alias'] = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $_POST['alias'] ) ), 'strlen') );
if( !$ldap_object['alias'] && $action == 'firstsave' ) unset($ldap_object['alias']);
+ // visible
+ if (!empty($_POST['visible']) && $_POST['visible'] == "on")
+ $visible = true;
+ else $visible = false;
+
// userquota
- if( isset( $_POST['cyrus-userquota'] ) ) {
- $ldap_object['cyrus-userquota'] = trim($_POST['cyrus-userquota']);
- if( empty( $ldap_object['cyrus-userquota'] ) ) {
- $ldap_object['cyrus-userquota'] = array();
+ if( isset( $_POST['userquota'] ) ) {
+ $ldap_object['userquota'] = $_POST['userquota'];
+ if( empty( $ldap_object['userquota'] ) ) {
+ $ldap_object['userquota'] = array();
}
}
+ if (!$visible) $dn_add = ",cn=internal";
+ if( $_POST['accttype'] == 0 ) $dn_accttype='';
+ else if( $_POST['accttype'] == 1 ) $dn_accttype='cn=groups,';
+ else if( $_POST['accttype'] == 2 ) $dn_accttype='cn=resources,';
}
- if( $_POST['accttype'] == 0 ) $dn_accttype='';
- else if( $_POST['accttype'] == 1 ) $dn_accttype='cn=internal,';
- else if( $_POST['accttype'] == 2 ) $dn_accttype='cn=groups,';
- else if( $_POST['accttype'] == 3 ) $dn_accttype='cn=resources,';
$domain_dn = $dn_accttype.domain_dn();
if ($action == "save") {
if (!$errors) {
- if (!empty($ldap_object['cn'])) $newdn = "cn=".$ldap->dn_escape($ldap_object['cn']).",".$domain_dn;
+ if (!empty($ldap_object['cn'])) $newdn = "cn=".$ldap_object['cn'].",".$domain_dn;
else $newdn = $dn;
+ if (!$visible && !strstr($newdn,$dn_add)) {
+ list($cn,$rest) = split(',', $newdn, 2);
+ $newdn = $cn.$dn_add.','.$rest;
+ }
if (strcmp($dn,$newdn) != 0) {
- // Check for distribution lists with this user as member
- $ldap->search( $_SESSION['base_dn'],
- '(&(objectClass=kolabGroupOfNames)(member='.$ldap->escape($dn).'))',
- array( 'dn', 'mail' ) );
- $distlists = $ldap->getEntries();
- unset( $distlists['count'] );
- foreach( $distlists as $distlist ) {
- $dlcn = $distlist['mail'][0];
- $errors[] = _("Account DN could not be modified, distribution list <a href='/admin/distributionlist/list.php?action=modify&dn=")
- .urlencode($distlist['dn']).
- _("'>'$dlcn'</a> depends on it. To modify this account, first remove it from the distribution list.");
- }
-
if (($result=ldap_read($ldap->connection,$dn,"(objectclass=*)")) &&
($entry=ldap_first_entry($ldap->connection,$result)) &&
($oldattrs=ldap_get_attributes($ldap->connection,$entry))) {
$ldap_object['uid'] = $oldattrs['uid'][0];
$ldap_object['mail'] = $oldattrs['mail'][0];
- unset( $oldattrs['count'] );
- foreach( $oldattrs as $k => $v ) {
- if( is_int($k) ) continue;
- if( !$ldap_object[$k] ) {
- unset($v['count'] );
- if( count($v) > 1 ) {
- $ldap_object[$k] = $v;
- } else {
- $ldap_object[$k] = $v[0];
- }
- }
- }
if( !$ldap_object['userPassword'] ) $ldap_object['userPassword'] = $oldattrs['userPassword'][0];
- foreach( $ldap_object as $k => $v ) {
- if( $v == array() ) unset($ldap_object[$k]);
- }
- $tmprdn = "cn=".str_rand(16);
- $explodeddn = ldap_explode_dn( $dn, 0 );
- unset($explodeddn['count']);
- unset($explodeddn[0]);
- $tmpbasedn = join(",",$explodeddn);
- if ( !$errors && !ldap_rename($ldap->connection,$dn,$tmprdn,$tmpbasedn,false) ) {
- array_push($errors, _("LDAP Error: Could not rename $dn to $tmprdn: ")
- .ldap_error($ldap->connection));
- }
+ if( $ldap_object['userquota'] == array() ) unset( $ldap_object['userquota'] );
+ if( $ldap_object['delegate'] == array() ) unset( $ldap_object['delegate'] );
+ if( $ldap_object['alias'] == array() ) unset( $ldap_object['alias'] );
if ( !$errors && !ldap_add($ldap->connection,$newdn, $ldap_object) ) {
array_push($errors, _("LDAP Error: Could not rename $dn to $newdn: ")
.ldap_error($ldap->connection));
}
if( !$errors ) {
- if( !ldap_delete($ldap->connection,$tmprdn.','.$tmpbasedn)) {
- array_push($errors, _("LDAP Error: Could not remove old entry $tmprdn,$tmpbasedn: ")
+ if( !ldap_delete($ldap->connection,$dn)) {
+ array_push($errors, _("LDAP Error: Could not remove old entry $dn: ")
.ldap_error($ldap->connection));
}
}
@@ -621,10 +442,7 @@ switch( $action ) {
unset($ldap_object['sn']);
unset($ldap_object['cn']);
unset($ldap_object['mail']);
- unset($ldap_object['uid']);
- unset($ldap_object['kolabHomeServer']);
}
- debug_var_dump($ldap_object);
if (!ldap_modify($ldap->connection, $dn, $ldap_object)) {
array_push($errors, _("LDAP Error: Could not modify object $dn: ")
.ldap_error($ldap->connection));
@@ -647,8 +465,8 @@ switch( $action ) {
$heading = _('Modify User');
if( !$errors ) $messages[] = _("User '$dn' successfully modified");
$form->setValues();
- $form->entries['mail']['attrs'] = 'readonly';
- $form->entries['kolabhomeserver']['attrs'] = 'readonly';
+ $form->entries['mail_0']['attrs'] = 'readonly';
+ $form->entries['homeserver']['attrs'] = 'readonly';
$form->entries['action']['value'] = 'save';
$form->entries['dn'] = array( 'name' => 'dn',
'type' => 'hidden',
@@ -657,10 +475,8 @@ switch( $action ) {
} else {
// firstsave
if (!$errors) {
- $dn = "cn=".$ldap->dn_escape($ldap_object['cn']).$dn_add.",".$domain_dn;
- foreach( $ldap_object as $k => $v ) {
- if( $v == array() ) unset($ldap_object[$k]);
- }
+ $dn = "cn=".$ldap_object['cn'].$dn_add.",".$domain_dn;
+ if( $ldap_object['userquota'] == array() ) unset( $ldap_object['userquota'] );
debug("Calling ldap_add with dn=$dn");
if ($dn && !ldap_add($ldap->connection, $dn, $ldap_object))
array_push($errors, _("LDAP Error: could not add object $dn: ").ldap_error($ldap->connection));
@@ -740,40 +556,15 @@ switch( $action ) {
if (!$dn) array_push($errors, _("Error: need dn for delete operation"));
elseif ($auth->group() != "maintainer" && $auth->group() != "admin")
array_push($errors, _("Error: you need administrative permissions to delete users"));
-
- // Check for distribution lists with only this user as member
- $ldap->search( $_SESSION['base_dn'],
- '(&(objectClass=kolabGroupOfNames)(member='.$ldap->escape($dn).'))',
- array( 'dn', 'cn', 'member' ) );
- $distlists = $ldap->getEntries();
- foreach( $distlists as $distlist ) {
- if( $distlist['member']['count'] == 1 ) {
- $dlcn = $distlist['cn'][0];
- $errors[] = _("Account could not be deleted, distribution list '$dlcn' depends on it.");
- }
- }
-
- if( !$errors ) {
+
+ if (!$errors) {
if (!$ldap->deleteObject($dn)) {
- array_push($errors, _("LDAP Error: could not mark '$dn' for deletion: ").$ldap->error());
- } else {
- $heading = _("User Deleted");
+ array_push($errors, _("LDAP Error: could not mark '$dn' for deletion: ").$ldap->error());
+ } else {
+ $heading = _("User Deleted");
$contenttemplate = 'userdeleted.tpl';
- }
- }
-
- if( $errors ) {
- $heading = _('Delete User');
- foreach( $form->entries as $k => $v ) {
- if( $v['type'] != 'hidden' ) {
- $form->entries[$k]['attrs'] = 'readonly';
- }
- }
- fill_form_for_modify( $form, $dn, $ldap_object );
- $form->entries['action']['value'] = 'kill';
- $form->submittext = _('Delete');
- $content = $form->outputForm();
- }
+ }
+ }
break;
}
diff --git a/www/admin/user/vacation.php b/www/admin/user/vacation.php
index 0e3f3ca..0b17081 100644
--- a/www/admin/user/vacation.php
+++ b/www/admin/user/vacation.php
@@ -8,9 +8,16 @@
require_once 'admin/include/mysmarty.php';
require_once 'admin/include/headers.php';
-require_once('admin/include/locale.php');
require_once 'admin/include/authenticate.php';
-require_once 'admin/include/sieveutils.class.php';
+
+// Funny multiline string escaping in Sieve
+function dotstuff( $str ) {
+ return str_replace( "\n.", "\n..", $str );
+}
+
+function undotstuff( $str ) {
+ return str_replace( "\n..", "\n.", $str );
+}
$errors = array();
if( (@include_once 'admin/include/Sieve.php' ) === false ) {
@@ -27,24 +34,19 @@ require_once('admin/include/menu.php');
$menuitems[$sidx]['selected'] = 'selected';
/**** Sieve handling ***/
-$scriptname = 'kolab-vacation.siv';
+$scriptname = 'kmail-vacation.siv';
if( !$errors ) {
- $obj = $ldap->read( $auth->dn() );
- $sieve =& new Net_Sieve( $auth->uid(), $auth->password(), $obj['kolabHomeServer'][0] );
- //$sieve->setDebug(true);
-
+ $sieve =& new Net_Sieve( $auth->uid(), $auth->password() );
+
// Update sieve script on server in case we have submit data
if( $_REQUEST['submit'] ) {
- $addresses = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $_REQUEST['addresses'] ) ), 'strlen') );
- $maildomain = trim( $_REQUEST['maildomain'] );
- $reacttospam = isset( $_REQUEST['reacttospam'] );
+ $addresses = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $_POST['addresses'] ) ), 'strlen') );
+
$script =
"require \"vacation\";\r\n\r\n".
- (!empty($maildomain)?"if not address :domain :contains \"From\" \"".$maildomain."\" { keep; stop; }\r\n":"").
- ($reacttospam?"if header :contains \"X-Spam-Flag\" \"YES\" { keep; stop; }\r\n":"").
"vacation :addresses [ \"".join('", "', $addresses )."\" ] :days ".
$_REQUEST['days']." text:\r\n".
- SieveUtils::dotstuff($_REQUEST['text'])."\r\n.\r\n;\r\n\r\n";
+ dotstuff($_REQUEST['text'])."\r\n.\r\n;";
$active = isset($_REQUEST['active']);
if( PEAR::isError( $res = $sieve->installScript( $scriptname, $script, $active ) ) ) {
@@ -62,34 +64,40 @@ if( !$errors ) {
}
}
- $addresses = $days = $text = false;
+ // Fetch script data from server
$scripts = $sieve->listScripts();
if( in_array( $scriptname, $scripts ) ) {
- $script = $sieve->getScript($scriptname);
- $maildomain = SieveUtils::getMailDomain( $script );
- $reacttospam = SieveUtils::getReactToSpam( $script );
- debug("reacttospam=".($reacttospam?"true":"false"));
- $addresses = SieveUtils::getVacationAddresses( $script );
- $days = SieveUtils::getVacationDays( $script );
- $text = SieveUtils::getVacationText( $script );
- } else $reacttospam = true;
- if( $addresses === false ) {
- $object = $ldap->read( $auth->dn() );
- $addresses = array_merge( $object['mail'], $object['alias'] );
+ $script = $sieve->getScript( $scriptname );
+ //debug("<pre>".htmlentities($script)."</pre>");
+ if( ereg(':addresses \[(.*)\]', $script, $regs ) ) {
+ $tmp = split(',', $regs[1] );
+ $addresses = array();
+ foreach( $tmp as $a ) {
+ if( ereg('^ *"(.*)" *$', $a, $regs ) ) $addresses[] = $regs[1];
+ else $addresses[] = $a;
+ }
+ }
+ if( ereg(':days ([0-9]+)', $script, $regs ) ) {
+ $days = $regs[1];
+ }
+ if( ereg("text:\r\n(.*)\r\n\\.\r\n", $script, $regs ) ) {
+ $text = $regs[1];
+ $text = str_replace( '\n', "\r\n", $text );
+ $text = undotstuff($text);
+ }
}
- if( $days === false ) $days = 7;
- if( $text === false ) {
+ if( !$addresses ) $addresses = array( $auth->uid() );
+ if( !$days ) $days = 7;
+ if( !$text ) {
$date = strftime(_('%x'));
- $text = sprintf(
- _("I am out of office until %s.\r\n").
- _("In urgent cases, please contact Mrs. <vacation replacement>\r\n\r\n").
- _("email: <email address of vacation replacement>\r\n").
- _("phone: +49 711 1111 11\r\n").
- _("fax.: +49 711 1111 12\r\n\r\n").
- _("Yours sincerely,\r\n").
- _("-- \r\n").
- _("<enter your name and email address here>"),
- $date);
+ $text = _("I am out of office till $date.\r\n".
+ "In urgent cases, please contact Mrs. <vacation replacement>\r\n\r\n".
+ "email: <email address of vacation replacement>\r\n".
+ "phone: +49 711 1111 11\r\n".
+ "fax.: +49 711 1111 12\r\n\r\n".
+ "Yours sincerely,\r\n".
+ "-- \r\n".
+ "<enter your name and email address here>");
}
$active = ( $sieve->getActive() === $scriptname );
}
@@ -108,10 +116,7 @@ $smarty->assign( 'submenuitems',
$smarty->assign( 'active', $active );
$smarty->assign( 'text', $text );
$smarty->assign( 'addresses', $addresses );
-$smarty->assign( 'maildomain', $maildomain );
-$smarty->assign( 'reacttospam', $reacttospam );
$smarty->assign( 'days', $days );
-$smarty->assign( 'inbox', $inbox );
$smarty->assign( 'maincontent', 'vacation.tpl' );
$smarty->display('page.tpl');
@@ -122,6 +127,5 @@ $smarty->display('page.tpl');
tab-width: 4
buffer-file-coding-system: utf-8
End:
- vim:encoding=utf-8:
*/
?>