mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
list-virtual.php:
- hand over $search to smarty templates templates/list-virtual_alias.tpl, templates/list-virtual_alias_domain.tpl: - add search result highlighting templates/list-virtual_mailbox.tpl: - add search result highlighting - move output of "Mailbox" / "Forward only" outside the foreach loop (was displayed once per mailbox alias target) css/default.css: - add style for ".searchresult" git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@868 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
e85c0ab2b4
commit
4c912f1da8
8
ADDITIONS/cyrus/Changelog
Normal file
8
ADDITIONS/cyrus/Changelog
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
Version 0.1 -- 26/10/2009
|
||||
---------------------------
|
||||
|
||||
* Public Release.
|
||||
* Postcreation, Postdeletion and Postedit hooks.
|
||||
|
||||
|
7
ADDITIONS/cyrus/README-ES.txt
Normal file
7
ADDITIONS/cyrus/README-ES.txt
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
Configuración
|
||||
-------------
|
||||
|
||||
- Edita el fichero cyrus.conf y modifica las variables $cyrus_*. El usuario debe tener permisos sobre todas las cuentas.
|
||||
- Edita los ficheros cyrus-*.pl y cambia la ruta de cyrus.conf (linea require '/path/to/cyrus.conf';)
|
||||
|
7
ADDITIONS/cyrus/README.txt
Normal file
7
ADDITIONS/cyrus/README.txt
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
- Edit cyrus.conf and set $cyrus_* variables correctly. User must have permission over all accounts.
|
||||
- Edit cyrus-*.pl and change path to cyrus.conf (require '/path/to/cyrus.conf'; line)
|
||||
|
36
ADDITIONS/cyrus/cyrus-mailbox-postcreation.pl
Executable file
36
ADDITIONS/cyrus/cyrus-mailbox-postcreation.pl
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Cyrus Mailbox creation
|
||||
#
|
||||
# Iñaki Rodriguez (irodriguez@virtualminds.es / irodriguez@ackstorm.es)
|
||||
#
|
||||
# LICENSE
|
||||
# This source file is subject to the GPL license that is bundled with
|
||||
# this package in the file LICENSE.TXT.
|
||||
#
|
||||
# (26/10/2009)
|
||||
|
||||
use Cyrus::IMAP::Admin;
|
||||
require '/etc/mail/postfixadmin/cyrus.conf';
|
||||
use strict;
|
||||
use vars qw($cyrus_user $cyrus_password $cyrus_host);
|
||||
|
||||
my %opts;
|
||||
|
||||
my $mailbox = mailbox_name($ARGV[0]);
|
||||
|
||||
my $client = Cyrus::IMAP::Admin->new($cyrus_host);
|
||||
die_on_error($client);
|
||||
|
||||
$opts{-user} = $cyrus_user;
|
||||
$opts{-password} = $cyrus_password;
|
||||
|
||||
$client->authenticate(%opts);
|
||||
die_on_error($client);
|
||||
|
||||
$client->create($mailbox);
|
||||
die_on_error($client);
|
||||
|
||||
$client->setquota($mailbox,'STORAGE',scalar $ARGV[3]) if ($ARGV[3] > 0);
|
||||
die_on_error($client);
|
||||
|
36
ADDITIONS/cyrus/cyrus-mailbox-postdelete.pl
Executable file
36
ADDITIONS/cyrus/cyrus-mailbox-postdelete.pl
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Cyrus Mailbox deletion
|
||||
#
|
||||
# Iñaki Rodriguez (irodriguez@virtualminds.es / irodriguez@ackstorm.es)
|
||||
#
|
||||
# LICENSE
|
||||
# This source file is subject to the GPL license that is bundled with
|
||||
# this package in the file LICENSE.TXT.
|
||||
#
|
||||
# (26/10/2009)
|
||||
|
||||
use Cyrus::IMAP::Admin;
|
||||
require '/etc/mail/postfixadmin/cyrus.conf';
|
||||
use strict;
|
||||
use vars qw($cyrus_user $cyrus_password $cyrus_host);
|
||||
|
||||
my %opts;
|
||||
|
||||
my $mailbox = mailbox_name($ARGV[0]);
|
||||
|
||||
my $client = Cyrus::IMAP::Admin->new($cyrus_host);
|
||||
die_on_error($client);
|
||||
|
||||
$opts{-user} = $cyrus_user;
|
||||
$opts{-password} = $cyrus_password;
|
||||
|
||||
$client->authenticate(%opts);
|
||||
die_on_error($client);
|
||||
|
||||
$client->setacl($mailbox,$cyrus_user => 'all');
|
||||
die_on_error($client);
|
||||
|
||||
$client->deletemailbox($mailbox);
|
||||
die_on_error($client);
|
||||
|
33
ADDITIONS/cyrus/cyrus-mailbox-postedit.pl
Executable file
33
ADDITIONS/cyrus/cyrus-mailbox-postedit.pl
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Cyrus Mailbox edition
|
||||
#
|
||||
# Iñaki Rodriguez (irodriguez@virtualminds.es / irodriguez@ackstorm.es)
|
||||
#
|
||||
# LICENSE
|
||||
# This source file is subject to the GPL license that is bundled with
|
||||
# this package in the file LICENSE.TXT.
|
||||
#
|
||||
# (26/10/2009)
|
||||
|
||||
use Cyrus::IMAP::Admin;
|
||||
require '/etc/mail/postfixadmin/cyrus.conf';
|
||||
use strict;
|
||||
use vars qw($cyrus_user $cyrus_password $cyrus_host);
|
||||
|
||||
my %opts;
|
||||
|
||||
my $mailbox = mailbox_name($ARGV[0]);
|
||||
|
||||
my $client = Cyrus::IMAP::Admin->new($cyrus_host);
|
||||
die_on_error($client);
|
||||
|
||||
$opts{-user} = $cyrus_user;
|
||||
$opts{-password} = $cyrus_password;
|
||||
|
||||
$client->authenticate(%opts);
|
||||
die_on_error($client);
|
||||
|
||||
$client->setquota($mailbox,'STORAGE',scalar $ARGV[3]) if ($ARGV[3] > 0);
|
||||
die_on_error($client);
|
||||
|
31
ADDITIONS/cyrus/cyrus.conf
Normal file
31
ADDITIONS/cyrus/cyrus.conf
Normal file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# Config
|
||||
|
||||
$cyrus_user = 'cyrus';
|
||||
$cyrus_password = 'cyruspass';
|
||||
$cyrus_host = 'localhost';
|
||||
|
||||
# unixhierarchysep => 1 (yes) / 0 (no)
|
||||
$unixhierarchysep = 1;
|
||||
|
||||
# Common routines
|
||||
|
||||
sub mailbox_name {
|
||||
my $mailbox = shift;
|
||||
|
||||
if($unixhierarchysep) {
|
||||
$mailbox = 'user/'.$ARGV[0];
|
||||
} else {
|
||||
$mailbox = 'user.'.$ARGV[0];
|
||||
}
|
||||
|
||||
return $mailbox;
|
||||
}
|
||||
|
||||
sub die_on_error {
|
||||
my $cyradm = shift;
|
||||
if($cyradm->error) { die $cyradm->error; }
|
||||
}
|
||||
1;
|
||||
|
Binary file not shown.
37
ADDITIONS/squirrelmail-plugin/INSTALL
Normal file
37
ADDITIONS/squirrelmail-plugin/INSTALL
Normal file
@ -0,0 +1,37 @@
|
||||
Installing the postfixadmin Plugin
|
||||
======================================
|
||||
|
||||
Requirements:
|
||||
=============
|
||||
|
||||
- PHP 5.2.x with php5-xmlrpc installed (if available; it should be available by default anyway)
|
||||
- http access to a local/remote postfixadmin interface
|
||||
|
||||
|
||||
Installation :
|
||||
==============
|
||||
|
||||
- Check out this code (svn co http://squirrelmail-postfixadmin.palepurple.co.uk/svn/trunk postfixadmin)
|
||||
into the Squirrelmail plugins directory.
|
||||
|
||||
- Edit config.php and specify the remote URL for the Postfixadmin XmlRpc service. There isn't much more to change.
|
||||
|
||||
- Edit the remote Postfixadmin's XmlRpc service config file and ensure 'xmlrpc_enable' is set to boolean true.
|
||||
|
||||
- Enable the plugin through 'squirrelmail-configure' or 'config/conf.pl'.
|
||||
Choose option 8 and move the plugin from the "Available Plugins"
|
||||
category to the "Installed Plugins" category. Save and exit.
|
||||
|
||||
|
||||
Security :
|
||||
==========
|
||||
|
||||
- The XmlRpc client needs to get the user's mailbox password before it will be able to connect to the
|
||||
XmlRpc server (postfixadmin). The plugin prompts the user for their mailbox password, and caches it in their session
|
||||
($_SESSION['password']). This password is then sent once on every page load to the remote XmlRpc server.
|
||||
|
||||
- You should consider doing any of the following :
|
||||
|
||||
- Using https if the server and client are on seperate servers. This will probably require a signed certificate etc, and may require changes to the Zend_XmlRpc_Client's HttpClient.
|
||||
- Using something like stunnel to encrypt traffic between server(s).
|
||||
|
40
ADDITIONS/squirrelmail-plugin/LICENSE.txt
Normal file
40
ADDITIONS/squirrelmail-plugin/LICENSE.txt
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
2007/03/29 :
|
||||
Before I (David Goodwin) customised this plugin, it contained the following within all
|
||||
files as a header.
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
Author ......... Florian Kimmerl
|
||||
Contact ........ info@spacekoeln.de
|
||||
Home Site ...... http://www.spacekoeln.de/
|
||||
Program ........ postfixadmin
|
||||
Purpose ........ Allows you to change your postfixadmin settings within squirrelmail
|
||||
|
||||
*************************************************************************************
|
||||
|
||||
The Original Code is Postfix Admin.
|
||||
The Initial Developer of the Original Code is Mischa Peters .
|
||||
Portions created by Mischa Peters are Copyright (c) 2002, 2003, 2004.
|
||||
All Rights Reserved.
|
||||
Contributor(s):
|
||||
This project includes work by Mischa Peters and others that is:
|
||||
Copyright (c) 2002,2003,2004 Mischa Peters
|
||||
All rights reserved.
|
||||
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
Contacting the author provided no success, so I took over maintainership.
|
||||
|
||||
Please note:
|
||||
|
||||
1) Changes made by myself (David Goodwin) will be licensed under the GPL
|
||||
2) PostfixAdmin has itself been relicensed under the GPL; however this took place _after_
|
||||
this plugin was written.
|
||||
3) Squirrelmail itself is released under http://squirrelmail.org/wiki/SquirrelMailGPL (GPL)
|
||||
|
||||
|
||||
The GNU public license can be found online at :
|
||||
|
||||
http://www.gnu.org/licenses/gpl.txt
|
70
ADDITIONS/squirrelmail-plugin/README
Normal file
70
ADDITIONS/squirrelmail-plugin/README
Normal file
@ -0,0 +1,70 @@
|
||||
Squirrelmail Plugin Postfixadmin
|
||||
********************************
|
||||
|
||||
The Postfixadmin SquirrelMail plugin let users change their virtual alias,
|
||||
vacation status/message and password if you are using the great postfixadmin
|
||||
tool from http://high5.net/postfixadmin
|
||||
|
||||
Version 0.4.3 2007/08/14
|
||||
|
||||
Postfixadmin - Postfixadmin+MySQL/PgSQL plugin for Squirrelmail
|
||||
|
||||
|
||||
Author: Florian Kimmerl <info@spacekoeln.de>
|
||||
Author: Sam Brookes <sam at pale purple.co.uk>
|
||||
- Initial conversion to MDB2
|
||||
- Fix SQL Injections etc
|
||||
Author: David Goodwin <david at pale purple.co.uk>
|
||||
- Subsequent tidyup + testing etc
|
||||
Author: Krzysztof 'Mad Max' Laska - <madmax at riders.pl>
|
||||
- Polish Translation.
|
||||
|
||||
|
||||
|
||||
The Initial Developer of the Original postfixadmin Code is Mischa Peters.
|
||||
Portions created by Mischa Peters are Copyright (c) 2002, 2003, 2004.
|
||||
All Rights Reserved.
|
||||
|
||||
REQUIREMENTS
|
||||
|
||||
o SquirrelMail 1.4x
|
||||
|
||||
o A working Mail-System "Virtual Domains and Users with postfix+Courier-IMAP+MySQL" (or PostgreSQL) See http://high5.net/howto/
|
||||
|
||||
o POSTFIXADMIN version 2.2.0 or higher. See http://sf.net/projects/postfixadmin
|
||||
|
||||
o This plugin only uses the postfixadmin database
|
||||
|
||||
o Pear MDB2 database abstraction layer - see http://pear.php.net
|
||||
|
||||
o PHP installation with register globals TURNED OFF (huraren on IRC reports that the MDB2 driver isn't happy with it turned on)
|
||||
|
||||
INSTALLATION
|
||||
|
||||
See the included file INSTALL
|
||||
|
||||
BUGS
|
||||
|
||||
o Probably vulnerable to cross site scripting, certainly when setting the vacation message.
|
||||
|
||||
o There may be some remaining SQL injection holes.
|
||||
|
||||
TODO
|
||||
|
||||
-Code Cleanup
|
||||
-Tranlation
|
||||
|
||||
|
||||
TRANSLATIONS
|
||||
|
||||
Translations are welcome! Send the *.po-File to: david@NO.codepoets.SPAM.co.uk
|
||||
|
||||
|
||||
ACKNOWLEDGMENTS
|
||||
|
||||
Thanks to the SquirrelMail team for building such a great app and
|
||||
for all the work they do to keep it running.
|
||||
|
||||
Thanks to high5.net for writing the great Postfixadmin tool
|
||||
|
||||
|
39
ADDITIONS/squirrelmail-plugin/common.php
Normal file
39
ADDITIONS/squirrelmail-plugin/common.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
// vim:ts=4:sw=4:et
|
||||
ini_set('include_path', get_include_path() . ':' . dirname(__FILE__));
|
||||
chdir("..");
|
||||
|
||||
|
||||
if (!defined('SM_PATH'))
|
||||
{
|
||||
define('SM_PATH','../');
|
||||
}
|
||||
include_once(SM_PATH . 'plugins/postfixadmin/config.php');
|
||||
include_once(SM_PATH . 'plugins/postfixadmin/functions.inc.php');
|
||||
include_if_exists(SM_PATH . 'include/validate.php');
|
||||
if (file_exists(SM_PATH . 'include/validate.php'))
|
||||
{
|
||||
include_once(SM_PATH . 'include/validate.php');
|
||||
}
|
||||
else {
|
||||
include_if_exists(SM_PATH . 'src/validate.php');
|
||||
}
|
||||
include_once(SM_PATH . 'functions/page_header.php');
|
||||
include_once(SM_PATH . 'functions/display_messages.php');
|
||||
include_once(SM_PATH . 'functions/imap.php');
|
||||
include_if_exists(SM_PATH . 'functions/array.php');
|
||||
if (file_exists(SM_PATH . 'src/load_prefs.php'))
|
||||
{
|
||||
include_once(SM_PATH . 'src/load_prefs.php');
|
||||
}
|
||||
else {
|
||||
include_if_exists(SM_PATH . 'include/load_prefs.php');
|
||||
}
|
||||
// overwrite squirrelmail's content type to utf8...
|
||||
header("Content-Type: text/html; charset=utf8");
|
||||
|
||||
|
||||
//global $VACCONFMESSAGE;
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
|
22
ADDITIONS/squirrelmail-plugin/config.php.sample
Normal file
22
ADDITIONS/squirrelmail-plugin/config.php.sample
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
$CONF = array();
|
||||
$CONF['xmlrpc_url'] = 'http://postfixadmin.local/postfixadmin/xmlrpc.php';
|
||||
|
||||
// Virtual Vacation
|
||||
// If you use virtual vacation for you mailbox users set this to 'true'.
|
||||
// NOTE: Make sure that you install the vacation module!!
|
||||
|
||||
//$AllowVacation = true; // true or false
|
||||
global $AllowVacation;
|
||||
$AllowVacation = true;
|
||||
|
||||
// Change Password
|
||||
// Enables user to change the POP3/IMAP Password.
|
||||
//$AllowChangePass = true; // true or false
|
||||
global $AllowChangePass;
|
||||
$AllowChangePass = true;
|
||||
|
||||
// Minimum password length - set to Zero to not care, otherwise the number of
|
||||
// characters a password must be longer than.
|
||||
$CONF['min_password_length'] = 5;
|
20
ADDITIONS/squirrelmail-plugin/debian/README.Debian
Normal file
20
ADDITIONS/squirrelmail-plugin/debian/README.Debian
Normal file
@ -0,0 +1,20 @@
|
||||
Squirrelmail PostfixAdmin Plugin for Debian
|
||||
===========================================
|
||||
|
||||
After installing the package, you will need to :
|
||||
|
||||
1) Edit the config.inc.php file to point to the PostfixAdmin server.
|
||||
|
||||
2) Ensure the xmlrpc interface is available and enabled on the Postfixadmin server
|
||||
|
||||
3) Run the squirrelmail-configure script.
|
||||
|
||||
Where to get help
|
||||
=================
|
||||
|
||||
See http://squirrelmail-postfixadmin.palepurple.co.uk
|
||||
|
||||
Try also : david [at] pale purple dot co dot uk
|
||||
|
||||
Or #postfixadmin on irc.freenode.net might be a good bet.
|
||||
|
27
ADDITIONS/squirrelmail-plugin/debian/changelog
Normal file
27
ADDITIONS/squirrelmail-plugin/debian/changelog
Normal file
@ -0,0 +1,27 @@
|
||||
squirrelmail-postfixadmin (2.3.0) stable; urgency=low
|
||||
|
||||
* Using XMLRPC backend (no SQL here)
|
||||
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Mon, 01 Feb 2010 09:56:00 +0000
|
||||
|
||||
squirrelmail-postfixadmin (2.2.0) stable; urgency=low
|
||||
|
||||
* Changed DB backend to use prepared statements
|
||||
* Changed vacation handling to match that of Postfixadmin (vacation.active
|
||||
etc)
|
||||
* Changed vacation page to support UTF8
|
||||
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Wed, 20 Aug 2008 15:25:00 +0000
|
||||
|
||||
squirrelmail-postfixadmin (2.1.1-1) stable; urgency=low
|
||||
|
||||
* Add NL language support
|
||||
* Better db error logging (e.g. if wrong mdb2 driver specified etc)
|
||||
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Wed, 12 Dec 2007 16:00:00 +0000
|
||||
|
||||
squirrelmail-postfixadmin (2.1.0-1) stable; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Thu, 8 Nov 2007 20:00:00 +0000
|
1
ADDITIONS/squirrelmail-plugin/debian/conffiles
Normal file
1
ADDITIONS/squirrelmail-plugin/debian/conffiles
Normal file
@ -0,0 +1 @@
|
||||
/etc/squirrelmail/plugins/postfixadmin-config.php
|
19
ADDITIONS/squirrelmail-plugin/debian/control
Normal file
19
ADDITIONS/squirrelmail-plugin/debian/control
Normal file
@ -0,0 +1,19 @@
|
||||
Source: squirrelmail-postfixadmin
|
||||
Section: mail
|
||||
Priority: optional
|
||||
Maintainer: David Goodwin <david.goodwin@palepurple.co.uk>
|
||||
Standards-Version: 3.6.1
|
||||
|
||||
Package: squirrelmail-postfixadmin
|
||||
Architecture: all
|
||||
Depends: squirrelmail, php-pear
|
||||
Suggests: postfixadmin
|
||||
Description: Plugin for Squirrelmail to integrate with Postfixadmin
|
||||
Postfixadmin is a web based interface for managing mail domains
|
||||
and users. This package integrates Squirrelmail with it.
|
||||
Users can change their password, forwarding and vacation settings
|
||||
from within Squirrelmail when this package is installed, and
|
||||
enabled through the ./squirrelmail-configure command.
|
||||
.
|
||||
For further information see
|
||||
http://squirrelmail-postfixadmin.palepurple.co.uk
|
11
ADDITIONS/squirrelmail-plugin/debian/copyright
Normal file
11
ADDITIONS/squirrelmail-plugin/debian/copyright
Normal file
@ -0,0 +1,11 @@
|
||||
This package was debianized by David Goodwin <david@palepurple.co.uk>
|
||||
2007/11/08
|
||||
|
||||
It was downloaded from: http://squirremail-postfixadmin.palepurple.co.uk
|
||||
|
||||
Upstream Author(s): n/a
|
||||
|
||||
Copyright:
|
||||
Copyright (C) 2007+ by David Goodwin <david@palepurple.co.uk>
|
||||
|
||||
License: GPL v2+
|
4
ADDITIONS/squirrelmail-plugin/debian/docs
Executable file
4
ADDITIONS/squirrelmail-plugin/debian/docs
Executable file
@ -0,0 +1,4 @@
|
||||
LICENSE.txt
|
||||
README
|
||||
INSTALL
|
||||
debian/README.Debian
|
1
ADDITIONS/squirrelmail-plugin/debian/files
Normal file
1
ADDITIONS/squirrelmail-plugin/debian/files
Normal file
@ -0,0 +1 @@
|
||||
squirrelmail-postfixadmin_2.2.0_all.deb mail optional
|
@ -0,0 +1,3 @@
|
||||
usr/share/squirrelmail/plugins/postfixadmin
|
||||
usr/share/doc/squirrelmail-postfixadmin
|
||||
etc/squirrelmail/plugins
|
5
ADDITIONS/squirrelmail-plugin/debian/postinst
Normal file
5
ADDITIONS/squirrelmail-plugin/debian/postinst
Normal file
@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
echo "WARNING: You need to read /usr/share/doc/squirrelmail-postfixadmin/README.Debian!"
|
||||
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
56
ADDITIONS/squirrelmail-plugin/debian/rules
Executable file
56
ADDITIONS/squirrelmail-plugin/debian/rules
Executable file
@ -0,0 +1,56 @@
|
||||
#!/usr/bin/make -f
|
||||
# debian/rules makefile for squirrelmail
|
||||
|
||||
# Uncomment this to turn on verbose mode.
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
build: build-stamp
|
||||
build-stamp:
|
||||
dh_testdir
|
||||
|
||||
clean:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean
|
||||
|
||||
install: build
|
||||
$(checkdir)
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_clean -k
|
||||
dh_installdirs
|
||||
dh_install
|
||||
mkdir -p debian/tmp/usr/share/squirrelmail/plugins/postfixadmin
|
||||
cp -a *.php version debian/tmp/usr/share/squirrelmail/plugins/postfixadmin
|
||||
cp -a locale debian/tmp/usr/share/squirrelmail/plugins/postfixadmin
|
||||
cp -a po debian/tmp/usr/share/squirrelmail/plugins/postfixadmin
|
||||
mkdir -p debian/tmp/etc/squirrelmail/plugins/
|
||||
cp -a *.sample debian/tmp/etc/squirrelmail/plugins/postfixadmin-config.php
|
||||
mkdir -p debian/tmp/DEBIAN
|
||||
cp debian/postinst debian/tmp/DEBIAN/postinst
|
||||
chmod 555 debian/tmp/DEBIAN/postinst
|
||||
ln -s /etc/squirrelmail/plugins/postfixadmin-config.php debian/tmp/usr/share/squirrelmail/plugins/postfixadmin/config.php
|
||||
find debian/tmp -name .svn | xargs -r rm -r
|
||||
|
||||
# Build architecture-independent files here.
|
||||
binary-indep: build install
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdebconf
|
||||
dh_installdocs -X.svn
|
||||
dh_installexamples
|
||||
dh_installman
|
||||
dh_installcron
|
||||
dh_link
|
||||
dh_compress
|
||||
dh_fixperms -X/var
|
||||
dh_installdeb
|
||||
dh_gencontrol
|
||||
dh_md5sums
|
||||
dh_builddeb
|
||||
|
||||
# Build architecture-dependent files here.
|
||||
binary-arch:
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
.PHONY: build clean binary-indep binary-arch binary install
|
102
ADDITIONS/squirrelmail-plugin/functions.inc.php
Normal file
102
ADDITIONS/squirrelmail-plugin/functions.inc.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* Postfixadmin (http://postfixadmin.sf.net) integration with Squirrelmail.
|
||||
* See http://squirrelmail-postfixadmin.palepurple.co.uk
|
||||
* @author David Goodwin and many others
|
||||
*/
|
||||
|
||||
|
||||
function do_header() {
|
||||
global $color;
|
||||
displayPageHeader($color, 'None');
|
||||
}
|
||||
|
||||
function do_footer() {
|
||||
echo "</body></html>";
|
||||
}
|
||||
|
||||
function _display_password_form() {
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
do_header('Postfixadmin Squirrelmail - Login');
|
||||
echo _('The PostfixAdmin plugin needs your current mailbox password');
|
||||
echo "<form action='' method='post'>";
|
||||
echo _('Password for');
|
||||
echo " " . $_SESSION['username'] . " :";
|
||||
echo "<input type='password' name='password' value=''>";
|
||||
echo "<input type='submit' value='" . _('Submit') . "'></form>";
|
||||
do_footer();
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns a Zend_XmlRpc_Client instance - unless we can't log you in...
|
||||
*/
|
||||
function get_xmlrpc() {
|
||||
global $CONF;
|
||||
require_once('Zend/XmlRpc/Client.php');
|
||||
$client = new Zend_XmlRpc_Client($CONF['xmlrpc_url']);
|
||||
$http_client = $client->getHttpClient();
|
||||
$http_client->setCookieJar();
|
||||
|
||||
$login_object = $client->getProxy('login');
|
||||
|
||||
if(empty($_SESSION['password'])) {
|
||||
if(empty($_POST['password'])) {
|
||||
_display_password_form();
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
$success = $login_object->login($_SESSION['username'], $_POST['password']);
|
||||
}
|
||||
catch(Exception $e) {
|
||||
//var_dump($client->getHttpClient()->getLastResponse()->getBody());
|
||||
error_log("Failed to login to xmlrpc instance - " . $e->getMessage);
|
||||
die('Failed to login to xmlrpc instance');
|
||||
}
|
||||
if($success) {
|
||||
$_SESSION['password'] = $_POST['password'];
|
||||
// reload the current page as a GET request.
|
||||
header("Location: {$_SERVER['REQUEST_URI']}");
|
||||
exit(0);
|
||||
}
|
||||
else {
|
||||
_display_password_form();
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$success = $login_object->login($_SESSION['username'], $_SESSION['password']);
|
||||
}
|
||||
|
||||
if(!$success) {
|
||||
unset($_SESSION['password']);
|
||||
die("Invalid details cached... refresh this page and re-enter your mailbox password");
|
||||
}
|
||||
return $client;
|
||||
}
|
||||
|
||||
function include_if_exists($filename) {
|
||||
if(file_exists($filename)) {
|
||||
include_once($filename);
|
||||
}
|
||||
return;
|
||||
}
|
||||
global $optmode;
|
||||
$optmode = 'display';
|
||||
|
||||
//
|
||||
// check_email
|
||||
// Action: Checks if email is valid and returns TRUE if this is the case.
|
||||
// Call: check_email (string email)
|
||||
//
|
||||
function check_email ($email) {
|
||||
$return = filter_var('validate_email', $emai);
|
||||
if($return === false) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
27
ADDITIONS/squirrelmail-plugin/index.php
Normal file
27
ADDITIONS/squirrelmail-plugin/index.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/****************************************************************************************
|
||||
|
||||
Author ......... Florian Kimmerl
|
||||
Contact ........ info@spacekoeln.de
|
||||
Home Site ...... http://www.spacekoeln.de/
|
||||
Program ........ postfixadmin
|
||||
Version ........ 0.3-1.4
|
||||
Purpose ........ Allows you to change your postfixadmin settings within squirrelmail
|
||||
|
||||
/**
|
||||
* index.php
|
||||
*
|
||||
* Copyright (c) 1999-2003 The SquirrelMail Project Team
|
||||
* Licensed under the GNU GPL. For full terms see the file COPYING.
|
||||
*
|
||||
* This file simply takes any attempt to view source files and sends those
|
||||
* people to the login screen. At this point no attempt is made to see if
|
||||
* the person is logged or not.
|
||||
*
|
||||
*
|
||||
****************************************************************************************/
|
||||
|
||||
header("Location: ../../index.php");
|
||||
|
||||
?>
|
6
ADDITIONS/squirrelmail-plugin/locale/build.sh
Normal file
6
ADDITIONS/squirrelmail-plugin/locale/build.sh
Normal file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
for f in $(find . -name postfixadmin.po)
|
||||
do
|
||||
msgfmt -o $(dirname $f)/postfixadmin.mo $f
|
||||
done
|
Binary file not shown.
@ -0,0 +1,132 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2004-01-29 17:35+0100\n"
|
||||
"PO-Revision-Date: 2007-07-20 20:46+0100\n"
|
||||
"Last-Translator: Michael Heca <michael.heca@gmail.com>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=iso-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Pøesmìrování"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Zde mù¾ete vytvoøit a nastavit pøesmìrování"
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Zde mù¾ete nastavit automatickou odpovìd, pokud nebudete k zasti¾ení."
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Zmìnít heslo k Va¹emu e-mailovému úètu"
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr "Úèet"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Zmìnit heslo"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Zmìnít heslo k Va¹emu e-mailovému úètu"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Alias"
|
||||
msgstr "Editace adresy pro pøesmìrování"
|
||||
|
||||
msgid "Edit an alias* for your domain.<br />One entry per line."
|
||||
msgstr "Editace pøesmìrování pro Vá¹ úèet. <br/> Ka¾dá adresa na novém øádku."
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "Zadaná e-mailová adresa je chybná:"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Neni mo¾né nalézt úèet!"
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "Není mo¾né zmìnit úèet!"
|
||||
|
||||
msgid "*Additional forward-aliase always recieve messages BBC!"
|
||||
msgstr "Dal¹í aliasy dostanou e-mail jako BBC!"
|
||||
|
||||
msgid "Alias successfully changend!"
|
||||
msgstr "Pøesmìrování bylo zmìnìno!"
|
||||
|
||||
msgid "To remove an alias, simply delete it's line from the text box."
|
||||
msgstr "Pro odstranení pøesmìrování sma¾te v¹echny øádky v textovém boxu."
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Automatická odpovìï"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "Jsem mimo"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Jsem zpìt"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Nastavení"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr "Mimo kanceláø"
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Pøedmìt"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Tìlo mailu"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Va¹e automatická odpovìï byla odstranìna!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Va¹e automatická odpovìï byla nastavena!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "U¾ máte nastavenu automatickou odpovìï!"
|
||||
|
||||
#: postfixadmin_changepass.php:81
|
||||
#: postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "Zadaná hesla nejsou stejná a nebo jsou prázdná!"
|
||||
|
||||
#: postfixadmin_forward.php:70
|
||||
#: postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr "Komu"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "Není mo¾né zmìnit heslo!"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "Stávající heslo neodpovídá!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "Va¹e heslo bylo zmìnìno!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "Stávající heslo"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Nové heslo"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Nové heslo znovu"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Prosím odhla¹te se a pøihla¹te se s novým heslem!"
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr "Nebudy k zasti¾ení od <date> do <date>. Pro naléhané po¾adavky prosím kontaktujte <contact person>."
|
||||
|
Binary file not shown.
@ -0,0 +1,127 @@
|
||||
# Danish translation for Squirrelmail Plugin Postfixadmin.
|
||||
# Copyright (C) 2004 Florian Kimmerl, 2007 David Goodwin
|
||||
# This file is distributed under the same license as the Squirrelmail Plugin Postfixadmin package.
|
||||
# Jesper R. Meyer <jrm@upthere.dk>, 2007.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 0.4.3\n"
|
||||
"POT-Creation-Date: 2004-01-29 17:35+0100\n"
|
||||
"PO-Revision-Date: 2007-11-09 16:07+0100\n"
|
||||
"Last-Translator: JESPER MEYER <jrm@upthere.dk>\n"
|
||||
"Language-Team: DANISH <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Videresending"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Her kan du oprette og ændre email-videresendinger."
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Tilføj en 'ikke tilstede' besked eller et autosvar til din emailadresse."
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Ændre adgangskoden til din postboks"
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr "Alias"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Ændre adgangskode"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Ændre din login-adgangskode"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Alias"
|
||||
msgstr "Rediger alias"
|
||||
|
||||
msgid "Edit an alias* for your domain.<br />One entry per line."
|
||||
msgstr "Rediger et alias* for dit domæne.<br />En modtager pr. linje."
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "Emailadressen du angav er ugyldig"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Aliaset eksistere ikke!"
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "Kunne ikke ændre aliaset!"
|
||||
|
||||
msgid "*Additional forward-aliase always recieve messages BBC!"
|
||||
msgstr "*Eksta vidersendingsalias modtager altid meddelelser BCC!"
|
||||
|
||||
msgid "Alias successfully changend!"
|
||||
msgstr "Alias ændret!"
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Autosvar"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "Tager afsted"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Kommer tilbage"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Indstillinger"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr "Ikke tilstede"
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Emne"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Meddelelse"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Autosvar er fjernet!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Autosvar er aktiveret!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "Du har allerede et autosvar indstillet!"
|
||||
|
||||
#: postfixadmin_changepass.php:81 postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "Adgangskoderne er ikke ens!<br />Eller er tomme!"
|
||||
|
||||
#: postfixadmin_forward.php:70 postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr "Til"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "Kan ikke ændre adgangskoden!"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "Du glemte at skrive din nuværende adgangskode!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "Din adgangskode er ændret!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "Nuværende adgangskode"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Ny adgangskode"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Ny adgangskode (igen)"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Log af og log ind igen med din nye adgangskode!"
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr "Jeg er ikke tilstede i perioden <dato> til <dato>. I nødstilfælde kan <kontaktperson> kontaktes."
|
Binary file not shown.
@ -0,0 +1,127 @@
|
||||
# postfixadmin - Plugin for Squirrelmail.
|
||||
# Copyright (C) 2004 FLORIAN KIMMERL
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# Florian Kimmerl <info@spacekoeln.de>, 2004.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 0.3-1.4\n"
|
||||
"POT-Creation-Date: 2004-01-28 16:32+0100\n"
|
||||
"PO-Revision-Date: 2004-01-28 16:32+0100\n"
|
||||
"Last-Translator: FLORIAN KIMMERL <info@spacekoeln.de>\n"
|
||||
"Language-Team: GERMAN <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-1\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Weiterleitungen"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Hier können Sie E-Mail-Weiterleitungen erstellen und bearbeiten."
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Hier können Sie den Abwesenheits-Assistenten konfigurieren."
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Hier können Sie Passwort ändern. Nach der Änderung müssen Sie sich neu anmelden!"
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr "E-Mail"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Passwort ändern"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Ändern Sie Ihr Zugangspasswort für POP3/IMAP"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Alias"
|
||||
msgstr "E-Mail Weiterleitungen bearbeiten"
|
||||
|
||||
msgid "Edit an alias* for your domain.<br />One entry per line."
|
||||
msgstr "Bearbeiten Sie hier Ihre E-Mail Weiterleitungen*.<br />Ein Eintrag pro Zeile."
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "Die angegebene E-Mail-Adresse ist ungültig:"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Ihre Weiterleitungen können nicht angefordert werden! Versuchen Sie es später erneut."
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "Ihre Weiterleitungen können nicht modifiziert werden! Versuchen Sie es später erneut."
|
||||
|
||||
msgid "*Additional forward-aliase always recieve messages BBC!"
|
||||
msgstr "*Zusätzliche Weiterleitungen erhalten alle Nachrichten als Kopie (BCC)!"
|
||||
|
||||
msgid "Alias successfully changend!"
|
||||
msgstr "Weiterleitungen wurden erfolgreich geändert!"
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Abwesenheits-Assistent"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "Ich bin weg"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Ich bin zurück"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Optionen"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr ""
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Betreff"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Nachrichtentext"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Iher Abwesenheits-Nachricht wurde deaktiviert!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Ihre Abwesenheits-Nachricht wurde aktiviert!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "Ihre Abwesenheits-Nachricht ist bereits aktiviert!"
|
||||
|
||||
msgid "back"
|
||||
msgstr "zurück"
|
||||
|
||||
#: postfixadmin_changepass.php:81 postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "Die beiden neuen Passwörter stimmen nicht überein!<br />Oder die Felder wurden nicht ausgefüllt!"
|
||||
|
||||
#: postfixadmin_forward.php:70 postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr "An"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "Ihr Passwort kann nicht geändert werden!"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "Ihr aktuelles Passwort wurde nicht angegeben oder ist falsch!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "Ihr Passwort wurde ergolgreich geändert!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "Passwort aktuell"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Passwort neu"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Passwort neu nochmal"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Bitte melden Sie sich hier ab und loggen sich mit Ihrem neuen Passwort erneut ein! "
|
Binary file not shown.
@ -0,0 +1,135 @@
|
||||
# postfixadmin - Plugin for Squirrelmail.
|
||||
# Copyright (C) 2004 FLORIAN KIMMERL
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# Florian Kimmerl <info@spacekoeln.de>, 2004.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: 0.3-1.4\n"
|
||||
"POT-Creation-Date: 2004-01-28 16:32+0100\n"
|
||||
"PO-Revision-Date: 2004-01-28 16:32+0100\n"
|
||||
"Last-Translator: FLORIAN KIMMERL <info@spacekoeln.de>\n"
|
||||
"Language-Team: HUNGARIAN <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=ISO-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Levéltovábbítás"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Itt tudod létrehozni és szerkeszteni az E-mail továbbításokat."
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Itt lehet beállítani az automatikus válasz levél szövegét, ha az ember távol van."
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Itt tudod megváltoztatni a belépéshez szükséges jelszót."
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr "E-mail"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Jelszó megváltoztatása"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Bejelentkezési jelszó megváltoztatása"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Forward"
|
||||
msgstr "Levéltovábbítás szerkesztése"
|
||||
|
||||
msgid "Edit Alias"
|
||||
msgstr "Levéltovábbítás szerkesztése"
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "Az E-mail cím amit beírtál hibás:"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Hiba az e-mail címmel."
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "A módosítás sikertelen!"
|
||||
|
||||
msgid "Alias successfully changed!"
|
||||
msgstr "A módosítás sikeres!"
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Automatikus válasz"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "Házonkívül vagyok"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Visszajöttem"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Opciók"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr "Házonkívül"
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Tárgy"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Levéltörzs"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Az automatikus válasz törölve lett!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Az automatikus válasz be lett állítva!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "Már létezik egy automatikus válasz!"
|
||||
|
||||
#: postfixadmin_changepass.php:81 postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "A jelszavak nem egyeznek!<br />Vagy üresen hagytad a mezõket!"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "A jelszó megváltoztatása sikertelen!"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "Az aktuális jelszó nem megfelelõ!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "A jelszó változtatása sikeres volt!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "Aktuális jelszó"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Új jelszó"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Új jelszó mégegyszer"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Kérjük, jelentkezzen ki, majd újra be az új jelszavával!"
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr "Házonkívül leszek <date> és <date> között. Sürgõs esetben értesítendõ: <contact person>."
|
||||
|
||||
msgid "One copy always goes to"
|
||||
msgstr "Egy másolat mindig ide"
|
||||
|
||||
msgid "Another copy also goes to"
|
||||
msgstr "További másolatok ide"
|
||||
|
||||
msgid "Enter an email address (or addresses) where you would like an additional copy of messages addressed to you sent.<br> Enter only one address per line."
|
||||
msgstr "Sorolja fel azokat az e-mail címeket, amelyekre az Önhöz érkezõ leveleket továbbítani szeretné.<br>Soronként csak egy címet adjon meg!"
|
||||
|
||||
msgid "A copy of each message will go to both your mailbox and the forwarded address(es)."
|
||||
msgstr "Minden Önnek címzett levél meg fog érkezni a saját postafiókjába és a továbbított e-mail címekre is."
|
||||
|
||||
msgid "To remove a Forward, simply delete its line from the text box."
|
||||
msgstr "Ahhoz, hogy töröljön egy továbbítást, ki kell törölnie az adott sort a felsorolásból."
|
@ -0,0 +1,129 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2004-01-29 17:35+0100\n"
|
||||
"PO-Revision-Date: 2010-02-19 11:30+0100\n"
|
||||
"Last-Translator: valentina <ruggiolona@tiscali.it>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Inoltro E-MAIL"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Qui puoi creare e modificare l'inoltro dell' E-MAIL."
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Imposta un messaggio OUT OF OFFICE / ASSENTE o un risponditore automatico per la tua mail."
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Modifica la tua password di accesso alla mail"
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr "Alias"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Modifica password"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Modifica la tua password di accesso"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Alias"
|
||||
msgstr "Modifica Alias"
|
||||
|
||||
msgid "Edit an alias* for your domain.<br />One entry per line."
|
||||
msgstr "Modifica un Alias per il tuo dominio.<br />Un record per linea."
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "L'indirizzo email che hai inserito non è corretto:"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Impossibile trovare l'alias!"
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "Impossibile modificare l'alias!"
|
||||
|
||||
msgid "*Additional forward-aliase always recieve messages BBC!"
|
||||
msgstr "* L'inoltro ad un alias aggiuntivo comporta l'invio del messaggio in BCC!"
|
||||
|
||||
msgid "Alias successfully changend!"
|
||||
msgstr "Alias modificato correttamente!"
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Risponditore automatico"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "Going Away"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Coming Back"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Opzioni"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr "Out of Office/Assente"
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Oggetto"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Messaggio"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Il risponditore automatico è stato disattivato!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Il risponditore automatico è stato configurato!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "Hai gia configurato il risponditore automatico !"
|
||||
|
||||
#: postfixadmin_changepass.php:81
|
||||
#: postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "Le password inserite non coincidono!<br />O i campi sono vuoti!"
|
||||
|
||||
#: postfixadmin_forward.php:70
|
||||
#: postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr "A"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "Impossibile modificare la password"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "Non hai indicato la password attuale!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "La tua password è stata modificata!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "Password attuale"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Nuova password"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Insierisci nuovamente la nuova password"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Per favore fai log out e riaccedi alla tua mail con la nuova password!"
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr "Mi dispiace sarò assente dal <date> al <date>. Per richieste urgenti vi prego di contattare <nome e indirizzo email>. I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
|
Binary file not shown.
@ -0,0 +1,131 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: postfixadmin-squirrelmail 2.1.0\n"
|
||||
"POT-Creation-Date: 2007-11-16 17:35+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: Johan <johan@double-l.nl>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=iso-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Doorsturen"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Hier kunt u uw doorstuur adres bewerken"
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Configureer hier uw automatisch beantwoorden"
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Verander uw wachtwoord"
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr "Alias"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Verander wachtwoord"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Verander uw login wachtwoord"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Forwards"
|
||||
msgstr "Bewerk aliassen"
|
||||
|
||||
msgid "Edit an alias* for your email address.<br />One entry per line."
|
||||
msgstr "Bewerk uw alias(sen) voor uw emailadres.<br />1 alias per regel."
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "Het ingevoerde adres is geen geldig adres"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Niet in staat opgeven alias te vinden!"
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "Niet in staat de alias aan te passen"
|
||||
|
||||
msgid "*Additional forward-aliases always receive messages BBC!"
|
||||
msgstr "Aliassen ontvangen altijd per BCC! "
|
||||
|
||||
msgid "To remove an alias, simply delete its line from the text box."
|
||||
msgstr "Verwijder de regel om de alias(sen) te verwijderen."
|
||||
|
||||
msgid "Alias successfully changed!"
|
||||
msgstr "Alias succesvol aangepast"
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Automatisch beantwoorden"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "Ik ben weg, schakel Out of Office IN"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Ik ben terug, schakel Out of Office UIT"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Opties"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr "Out of office"
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Onderwerp"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Tekst"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Uw automatisch beantwoorden is verwijderd!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Uw automatisch beantwoorden is geactiveerd!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "Automatisch beantwoorden is al geconfigureerd!"
|
||||
|
||||
#: postfixadmin_changepass.php:81 postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "De wachtwoorden komen niet overeen!<br />Of er is geen wachtwoord opgegeven!"
|
||||
|
||||
#: postfixadmin_forward.php:70 postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr "Aan"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "Niet in staat uw wachtwoord te wijzigen!"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "U moet uw huidige wachtwoord opgeven!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "Uw wachtwoord is gewijzigd!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "Huidig wachtwoord"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Nieuw wachtwoord"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Nieuw wachtwoord nogmaals"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Log uit en opnieuw in met het nieuwe wachtwoord"
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr "Ik ben niet aanwezig van <datum> tot <datum>. Voor dringende zaken kunt u contact opnemen met <Contact persoon>."
|
||||
|
Binary file not shown.
@ -0,0 +1,132 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2004-01-29 17:35+0100\n"
|
||||
"PO-Revision-Date: 2007-07-20 20:46+0100\n"
|
||||
"Last-Translator: Krzysztof Laska <krzysiek@dip.pl>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=iso-8859-2\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Przekazywanie"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Tutaj mo¿esz ustawiæ i edytowaæ opcje przekazywania wiadomo¶ci"
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Ustaw wiadomo¶æ wysy³an± nadawcom podczas Twojej nieobecno¶ci (Vacation)"
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Zmieñ has³o do swojego konta pocztowego"
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr "Konto"
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Zmieñ has³o"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Zmieñ has³o do swojego konta pocztowego"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Alias"
|
||||
msgstr "Edytuj adresy do przekazywania"
|
||||
|
||||
msgid "Edit an alias* for your domain.<br />One entry per line."
|
||||
msgstr "Edytuj forward* dla swojego konta. <br/> Ka¿dy adres w nowym wierszu."
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "Adres e-mail jaki poda³e¶ jest niepoprawny:"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Nie mo¿na zlokalizowaæ aliasu!"
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "Nie mo¿na zmodyfikowaæ aliasu!"
|
||||
|
||||
msgid "*Additional forward-aliase always recieve messages BBC!"
|
||||
msgstr "*Wszystkie dodatkowe adresy zawsze odbieraj± wiadomo¶ci przesy³ane jako BCC! Ca³a poczta jest przekazywana i nie jest przechowywana na koncie podstawowym!"
|
||||
|
||||
msgid "Alias successfully changend!"
|
||||
msgstr "Zmiana zachowana!"
|
||||
|
||||
msgid "To remove an alias, simply delete it's line from the text box."
|
||||
msgstr "¯eby wy³±czyæ forward na dane konto po prostu usuñ liniê z adresem na który nie chcesz ju¿ przekazywaæ poczty."
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Autoodpowied¼"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "W³±cz autoodpowied¼"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Wy³±cz autoodpowied¼"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Opcje"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr "Autoodpowied¼"
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Temat"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Tre¶æ"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Twoja autoodpowied¼ zosta³a wy³±czona!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Twoja autoodpowied¼ zosta³a w³±czona!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "Masz ju¿ skonfigurowan± autoodpowied¼!"
|
||||
|
||||
#: postfixadmin_changepass.php:81
|
||||
#: postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "Has³a które poda³e¶ nie pasuj± lub s± puste!"
|
||||
|
||||
#: postfixadmin_forward.php:70
|
||||
#: postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr "Do"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "Nie mo¿na zmieniæ has³a!"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "Nie poda³e¶ aktualnego has³a!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "Twoje has³o zosta³o zmienione!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "Bie¿±ce has³o"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Nowe has³o"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Powtórz nowe has³o"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Wyloguj siê i zaloguj z nowym has³em!"
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr "Nie bêdê odbieraæ poczty pomiêdzy <data> a <data>. W sprawach pilnych proszê kontaktowaæ siê z <osoba kontaktowa>"
|
||||
|
Binary file not shown.
@ -0,0 +1,127 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2004-01-29 17:35+0100\n"
|
||||
"PO-Revision-Date: 2008-10-16 20:30+3\n"
|
||||
"Last-Translator: Julio Covolato <julio@psi.com.br>\n"
|
||||
"Language-Team: BRAZILIAN PORTUGUESE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr "Encaminhar"
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr "Aqui Você pode criar e editar alias."
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr "Configurar mensagem de férias para seu email."
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr "Troque a senha de seu email."
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr ""
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr "Mudar Senha"
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr "Mude sua senha de login"
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Alias"
|
||||
msgstr "Editar Alias"
|
||||
|
||||
msgid "Edit an alias* for your domain.<br />One entry per line."
|
||||
msgstr "Editar um alias* para seu domínio.<br /> Uma entrada por linha."
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr "Este endereço de email informado não é válido:"
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr "Alias não encontrado!"
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr "Impossível modificar o alias!"
|
||||
|
||||
msgid "*Additional forward-aliase always recieve messages BBC!"
|
||||
msgstr "*Alias adicionais sempre recebem mensagens em BCC"
|
||||
|
||||
msgid "Alias successfully changend!"
|
||||
msgstr "Alias alterado com sucesso!"
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr "Auto resposta"
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr "Ativar"
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr "Desativar"
|
||||
|
||||
msgid "Options"
|
||||
msgstr "Opções"
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr "Fora do escritório"
|
||||
|
||||
msgid "Subject"
|
||||
msgstr "Assunto"
|
||||
|
||||
msgid "Body"
|
||||
msgstr "Mensagem"
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr "Sua auto resporta foi removida!"
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr "Sua auto resposta foi ativada!"
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr "Você ainda tem uma auto resposta ativa"
|
||||
|
||||
#: postfixadmin_changepass.php:81 postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr "A senha digitada não confere!<br />Ou está vazia"
|
||||
|
||||
#: postfixadmin_forward.php:70 postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr "Para"
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr "Impossível alterar a sua senha!"
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr "Você não forneceu a sua senha atual!"
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr "Sua senha foi alterada com sucesso!"
|
||||
|
||||
msgid "Password current"
|
||||
msgstr "senha atual"
|
||||
|
||||
msgid "Password new"
|
||||
msgstr "Nova senha"
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr "Confirme a nova senha"
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr "Por favor, saia e entre novamente no webmail com a nova senha"
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr "Estarei fora do escritório entre os dias <data> e <data> do mês de <mês>.<br /> Qualquer mensagem urgente, favor enviar para o email <email>."
|
127
ADDITIONS/squirrelmail-plugin/po/postfixadmin.po
Normal file
127
ADDITIONS/squirrelmail-plugin/po/postfixadmin.po
Normal file
@ -0,0 +1,127 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||
# This file is distributed under the same license as the PACKAGE package.
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2004-01-29 17:35+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: setup.php
|
||||
msgid "Forwarding"
|
||||
msgstr ""
|
||||
|
||||
msgid "Here you can create and edit E-Mail forwards."
|
||||
msgstr ""
|
||||
|
||||
msgid "Set an OUT OF OFFICE message or auto responder for your mail."
|
||||
msgstr ""
|
||||
|
||||
msgid "Change your mailbox password."
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_changepass.php
|
||||
msgid "Alias"
|
||||
msgstr ""
|
||||
|
||||
msgid "Change Password"
|
||||
msgstr ""
|
||||
|
||||
msgid "Change your login password"
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_forward.php
|
||||
msgid "Edit Alias"
|
||||
msgstr ""
|
||||
|
||||
msgid "Edit an alias* for your domain.<br />One entry per line."
|
||||
msgstr ""
|
||||
|
||||
msgid "The email address that you have entered is not valid:"
|
||||
msgstr ""
|
||||
|
||||
msgid "Unable to locate alias!"
|
||||
msgstr ""
|
||||
|
||||
msgid "Unable to modify the alias!"
|
||||
msgstr ""
|
||||
|
||||
msgid "*Additional forward-aliase always recieve messages BBC!"
|
||||
msgstr ""
|
||||
|
||||
msgid "Alias successfully changend!"
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_vacation.php
|
||||
msgid "Auto Response"
|
||||
msgstr ""
|
||||
|
||||
msgid "Going Away"
|
||||
msgstr ""
|
||||
|
||||
msgid "Coming Back"
|
||||
msgstr ""
|
||||
|
||||
msgid "Options"
|
||||
msgstr ""
|
||||
|
||||
msgid "Out of Office"
|
||||
msgstr ""
|
||||
|
||||
msgid "Subject"
|
||||
msgstr ""
|
||||
|
||||
msgid "Body"
|
||||
msgstr ""
|
||||
|
||||
msgid "Your auto response has been removed!"
|
||||
msgstr ""
|
||||
|
||||
msgid "Your auto response has been set!"
|
||||
msgstr ""
|
||||
|
||||
msgid "You already have an auto response configured!"
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_changepass.php:81 postfixadmin_changepass.php:87
|
||||
msgid "The passwords that you supplied don't match!<br />Or are empty!"
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_forward.php:70 postfixadmin_forward.php:152
|
||||
msgid "To"
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_changepass.php:101
|
||||
msgid "Unable to change your password!"
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_changepass.php:75
|
||||
msgid "You didn't supply your current password!"
|
||||
msgstr ""
|
||||
|
||||
#: postfixadmin_changepass.php:96
|
||||
msgid "Your password has been changed!"
|
||||
msgstr ""
|
||||
|
||||
msgid "Password current"
|
||||
msgstr ""
|
||||
|
||||
msgid "Password new"
|
||||
msgstr ""
|
||||
|
||||
msgid "Password new again"
|
||||
msgstr ""
|
||||
|
||||
msgid "Please sign out and log back again with your new password!"
|
||||
msgstr ""
|
||||
|
||||
msgid "I will be away from <date> until <date>. For urgent matters you can contact <contact person>."
|
||||
msgstr ""
|
128
ADDITIONS/squirrelmail-plugin/postfixadmin_changepass.php
Normal file
128
ADDITIONS/squirrelmail-plugin/postfixadmin_changepass.php
Normal file
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
require_once(dirname(__FILE__) . '/common.php');
|
||||
|
||||
$xmlrpc = get_xmlrpc();
|
||||
$user = $xmlrpc->getProxy('user');
|
||||
|
||||
global $username;
|
||||
|
||||
do_header();
|
||||
|
||||
$USERID_USERNAME = $username;
|
||||
$tmp = preg_split ('/@/', $USERID_USERNAME);
|
||||
$USERID_DOMAIN = $tmp[1];
|
||||
|
||||
|
||||
$stMessage = '';
|
||||
$tMessage = '';
|
||||
$pPassword_admin_text = '';
|
||||
$pPassword_password_current_text = '';
|
||||
$pPassword_password_text = '';
|
||||
$error = 0;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
//$pPassword_password_text = _("pPassword_password_text");
|
||||
$fPassword_current = $_POST['fPassword_current'];
|
||||
$fPassword = $_POST['fPassword'];
|
||||
$fPassword2 = $_POST['fPassword2'];
|
||||
$username = $USERID_USERNAME;
|
||||
|
||||
if(!$user->login($_SESSION['username'], $_POST['fPassword_current'])) {
|
||||
$error = 1;
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$pPassword_password_current_text = _("You didn't supply your current password!");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
$min_length = 0;
|
||||
if(isset($CONF['min_password_length'])) {
|
||||
$min_length = $CONF['min_password_length'];
|
||||
}
|
||||
if (empty ($fPassword) or ($fPassword != $fPassword2) or ($min_length > 0 && strlen($fPassword) < $min_length)) {
|
||||
$error = 1;
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
if(empty($fPassword)) {
|
||||
$pPassword_password_text .= _("The passwords that you supplied are empty!");
|
||||
}
|
||||
if($fPassword != $fPassword2) {
|
||||
$pPassword_password_text .= _("The passwords that you supplied don't match!");
|
||||
}
|
||||
if($min_length > 0 && strlen($fPassword) < $min_length) {
|
||||
$pPassword_password_text .= _("The password you supplied is too short!");
|
||||
}
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
|
||||
if ($error != 1) {
|
||||
$success = $user->changePassword($fPassword_current, $fPassword);
|
||||
|
||||
if ($success) {
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("Your password has been changed!");
|
||||
$stMessage = _("Please sign out and log back again with your new password!");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
else {
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("Unable to change your password!");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
}
|
||||
}
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
|
||||
<tr>
|
||||
<td align=\"center\"><b>". _("Options") ." - ". _("Change Password")." </b>
|
||||
<table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
|
||||
<tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
|
||||
<table align=\"center\" width=\"95%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
|
||||
<td bgcolor=\"$color[3]\" align=\"center\"><b>" ._("Change your login password") ."\n
|
||||
</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor=\"$color[0]\" align=\"center\"><form name=\"mailbox\" method=\"post\">
|
||||
<b>$tMessage<b><font color=red><br>
|
||||
<a href=\"../../src/signout.php\" target=\"_top\">$stMessage</a>
|
||||
".$pPassword_admin_text."\n
|
||||
".$pPassword_password_current_text."\n
|
||||
".$pPassword_password_text."\n
|
||||
</b><table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
|
||||
<tr>
|
||||
<td width=\"37%\"><b>". _("Alias") . ":\n</td>
|
||||
<td width=\"63%\">{$_SESSION['username']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>". _("Password current"). ":\n</td>
|
||||
<td><input type=\"password\" name=\"fPassword_current\" size=\"30\" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>". _("Password new"). ":\n</td>
|
||||
<td><input type=\"password\" name=\"fPassword\" size=\"30\" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>". _("Password new again"). ":\n</td>
|
||||
<td><input type=\"password\" name=\"fPassword2\" size=\"30\" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type=\"submit\" name=\"submit\" value=\"" ._("Change Password") . "\" /></td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<TT></TT></FORM></td>
|
||||
</tr><tr><td bgcolor=\"$color[4]\" align=\"left\"> </td>
|
||||
</tr></table><BR>
|
||||
</td>
|
||||
</tr></table></td></tr></table>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
?>
|
161
ADDITIONS/squirrelmail-plugin/postfixadmin_forward.php
Normal file
161
ADDITIONS/squirrelmail-plugin/postfixadmin_forward.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__) . '/common.php');
|
||||
|
||||
|
||||
|
||||
$USERID_USERNAME = $username;
|
||||
$tmp = preg_split ('/@/', $USERID_USERNAME);
|
||||
$USERID_LOCALPART = $tmp[0];
|
||||
$USERID_DOMAIN = $tmp[1];
|
||||
|
||||
$xmlrpc = get_xmlrpc();
|
||||
$alias = $xmlrpc->getProxy('alias');
|
||||
do_header();
|
||||
// Normal page request (GET)
|
||||
if ($_SERVER['REQUEST_METHOD'] == "GET")
|
||||
{
|
||||
$row = $alias->get();
|
||||
if($row === false) {
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("Unable to locate alias!");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
$pEdit_alias_goto = _("To");
|
||||
|
||||
$fGoto = $_POST['fGoto'];
|
||||
|
||||
// reform string into a list...
|
||||
$goto = preg_replace ('/\r\n/', ',', $fGoto);
|
||||
$goto = preg_replace ('/[\s]+/i', '', $goto);
|
||||
$goto = preg_replace ('/\,*$/', '', $goto);
|
||||
$array = preg_split ('/,/', $goto);
|
||||
|
||||
$error = 0;
|
||||
// check that we have valid addresses in the list
|
||||
foreach($array as $email_address)
|
||||
{
|
||||
if (empty($email_address))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!check_email($email_address))
|
||||
{
|
||||
$error = 1;
|
||||
$tGoto = $goto;
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("The email address that you have entered is not valid:") . " $email_address</font>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
}
|
||||
if ($error != 1) {
|
||||
$flag = 'forward_and_store'; // goto = $USERID_USERNAME;
|
||||
|
||||
$success = $alias->update($array, $flag);
|
||||
if(!$success) {
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("Unable to modify the alias!");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
else {
|
||||
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "<p align=center><b>". _("Alias successfully changed!"). "\n</b></p>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
echo "<p align=center><a href=\"javascript:history.go(-1)\">". _("Click here to go back") ."</a></p>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
|
||||
<tr>
|
||||
<td align=\"center\" bgcolor=\"$color[0]\" colspan=\"2\">
|
||||
<b>". _("Options") ." - ". _("Edit Alias"). " </b>
|
||||
<table align=\"center\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
|
||||
<tr>
|
||||
<td bgcolor=\"$color[4]\" align=\"center\">
|
||||
<table align=\"center\" width=\"100%\">
|
||||
<tr>
|
||||
<td align=\"left\">". _("Edit an alias* for your email address.<br />One entry per line."). " </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=\"left\">". _("*Additional forward-aliases always receive messages BCC!"). "\n
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=\"left\">" . _("To remove an alias, simply delete its line from the text box.") . "</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table align=\"center\" width\"95%\" cellpadding=\"5\" cellspacing=\"1\">
|
||||
<form name=\"mailbox\" method=\"post\">
|
||||
<tr>
|
||||
<td bgcolor=\"$color[3]\" align=\"center\"><b>". _("Edit Forwards"). "</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td bgcolor=\"$color[5]\" align=\"center\">$tMessage
|
||||
<table cellpadding=\"5\" cellspacing=\"1\">
|
||||
<tr>
|
||||
<th align=\"left\">". _("Alias"). ":\n
|
||||
</th>
|
||||
<td align=\"left\">" . $_SESSION['username'] . "</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align=\"left\" valign=\"top\">". _("To"). ":\n</th>
|
||||
<td>
|
||||
<textarea rows=\"8\" cols=\"50\" name=\"fGoto\">";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
$aliases = $alias->get();
|
||||
foreach($aliases as $address) {
|
||||
if ($address == "" || $address == NULL) { continue; }
|
||||
print "$address\n";
|
||||
}
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "
|
||||
</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<td align=\"left\"colspan=\"2\">
|
||||
<input type=\"submit\" name=\"submit\" value=\"" . _("Edit Alias") . "\">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
?>
|
157
ADDITIONS/squirrelmail-plugin/postfixadmin_vacation.php
Normal file
157
ADDITIONS/squirrelmail-plugin/postfixadmin_vacation.php
Normal file
@ -0,0 +1,157 @@
|
||||
<?php
|
||||
|
||||
require_once(dirname(__FILE__) . '/common.php');
|
||||
|
||||
$xmlrpc = get_xmlrpc();
|
||||
$vacation = $xmlrpc->getProxy('vacation');
|
||||
|
||||
$VACCONFTXT = _("I will be away from <date> until <date>. For urgent matters you can contact <contact person>.");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
$VACCONF = <<<EOM
|
||||
$VACCONFTXT
|
||||
EOM;
|
||||
|
||||
do_header();
|
||||
|
||||
$USERID_USERNAME = $username;
|
||||
$tmp = preg_split ('/@/', $USERID_USERNAME);
|
||||
$USERID_DOMAIN = $tmp[1];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "GET")
|
||||
{
|
||||
$details = $vacation->getDetails();
|
||||
if($vacation->checkVacation()) {
|
||||
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("You already have an auto response configured!");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "<table bgcolor=\"#b8cbdc\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\"><tr>
|
||||
<td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ."</b>
|
||||
<table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
|
||||
<tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
|
||||
<table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
|
||||
<td bgcolor=\"$color[3]\" align=\"center\"><b>". _("Auto Response") ."\n
|
||||
</b></td></tr><tr>
|
||||
<td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">
|
||||
<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
|
||||
<tr>
|
||||
<td><center>$tMessage<p></center></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> <div align=\"center\">
|
||||
<input type=\"submit\" name=\"fBack\" value=\"" . _("Coming Back"). "\" />
|
||||
</div></td>
|
||||
</tr>
|
||||
</table>
|
||||
<TT></TT></FORM>
|
||||
</td>
|
||||
</tr><tr><td bgcolor=\"$color[4]\" align=\"left\"> </td>
|
||||
</tr></table><BR></td></tr></table></td></tr></table>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
else
|
||||
{
|
||||
$tSubject = "Out of Office";
|
||||
$tSubject = $details['subject'];
|
||||
$VACCONF = $details['body'];
|
||||
|
||||
$tMessage = '';
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "<table bgcolor=\"$color[0]\" align=\"center\" width=\"95%\" cellpadding=\"1\" cellspacing=\"0\" border=\"0\">
|
||||
<tr>
|
||||
<td align=\"center\"><b>". _("Options") ." - ". _("Auto Response") ." </b>
|
||||
<table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"0\" border=\"0\">
|
||||
<tr><td bgcolor=\"$color[4]\" align=\"center\"><br>
|
||||
<table align=\"center\" width=\"70%\" cellpadding=\"4\" cellspacing=\"0\" border=\"0\"><tr>
|
||||
<td bgcolor=\"$color[3]\" align=\"center\"><b>" . _("Auto Response") ."\n
|
||||
</b></td></tr><tr>
|
||||
<td bgcolor=\"$color[0]\" align=\"center\"><form name=\"vacation\" method=\"post\">$tMessage
|
||||
<table width=\"95%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\"><tr>
|
||||
<td width=\"23%\">". _("Subject") .":\n</td>
|
||||
<td width=\"2%\"> </td>
|
||||
<td width=\"69%\"><input type=\"text\" name=\"fSubject\" value=\"" . $tSubject . "\" /></td>
|
||||
<td width=\"2%\"> </td>
|
||||
<td width=\"4%\"> </td>
|
||||
</tr><tr>
|
||||
<td>". _("Body") .":\n</td>
|
||||
<td> </td>
|
||||
<td><textarea rows=\"10\" cols=\"80\" name=\"fBody\">$VACCONF\n
|
||||
</textarea></td><td> </td><td> </td></tr><tr><td> </td><td> </td>
|
||||
<td><input type=\"submit\" name=\"fAway\" value=\"" . _("Going Away") . "\" /></td>
|
||||
<td> </td><td> </td></tr>
|
||||
</table><TT></TT></FORM></td>
|
||||
</tr><tr><td bgcolor=\"$color[4]\" align=\"left\"> </td>
|
||||
</tr></table><BR></td></tr></table></td></tr></table>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
$fBack = null;
|
||||
$fAway = null;
|
||||
foreach(array('fBack', 'fAway', 'fSubject', 'fBody') as $key) {
|
||||
$$key = null;
|
||||
if(isset($_POST[$key])) {
|
||||
$$key = $_POST[$key];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($fBack))
|
||||
{
|
||||
$success = $vacation->remove();
|
||||
|
||||
if(!$success)
|
||||
{
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("Unable to update your auto response settings!");
|
||||
echo "<p>This may signify an error; please contact support (1)</p>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
else
|
||||
{
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "<p align=center><b>". _("Your auto response has been removed!") ."</b></p>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty ($fAway))
|
||||
{
|
||||
// add record into vacation
|
||||
$success = $vacation->setAway($fSubject, $fBody);
|
||||
|
||||
if(!$success) {
|
||||
$error = 1;
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$tMessage = _("Unable to update your auto response settings!");
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
else
|
||||
{
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
echo "<p align=center><b>". _("Your auto response has been set!") ."</b></p>";
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
62
ADDITIONS/squirrelmail-plugin/setup.php
Normal file
62
ADDITIONS/squirrelmail-plugin/setup.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// vim:ts=4:sw=4:et
|
||||
include_once(SM_PATH . 'functions/i18n.php');
|
||||
|
||||
function squirrelmail_plugin_init_postfixadmin() {
|
||||
include(SM_PATH.'plugins/postfixadmin/config.php');
|
||||
|
||||
global $squirrelmail_plugin_hooks;
|
||||
|
||||
$squirrelmail_plugin_hooks['optpage_register_block']['postfixadmin'] = 'postfixadmin_optpage_register_block';
|
||||
|
||||
}
|
||||
|
||||
function postfixadmin_version(){
|
||||
return '2.3.0';
|
||||
}
|
||||
|
||||
function postfixadmin_optpage_register_block () {
|
||||
// Gets added to the user's OPTIONS page.
|
||||
global $optpage_blocks;
|
||||
global $AllowVacation;
|
||||
global $AllowChangePass;
|
||||
|
||||
// if ( !soupNazi() ) {
|
||||
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
$optpage_blocks[] = array (
|
||||
'name' => _("Forwarding"),
|
||||
'url' => '../plugins/postfixadmin/postfixadmin_forward.php',
|
||||
'desc' => _("Here you can create and edit E-Mail forwards."),
|
||||
'js' => FALSE
|
||||
);
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
if($AllowVacation) {
|
||||
$optpage_blocks[] = array(
|
||||
'name' => _("Auto Response"),
|
||||
'url' => '../plugins/postfixadmin/postfixadmin_vacation.php',
|
||||
'desc' => _("Set an OUT OF OFFICE message or auto responder for your mail."),
|
||||
'js' => false
|
||||
);
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
bindtextdomain('postfixadmin', SM_PATH . 'plugins/postfixadmin/locale');
|
||||
textdomain('postfixadmin');
|
||||
if($AllowChangePass) {
|
||||
$optpage_blocks[] = array(
|
||||
'name' => _("Change Password"),
|
||||
'url' => '../plugins/postfixadmin/postfixadmin_changepass.php',
|
||||
'desc' => _("Change your mailbox password."),
|
||||
'js' => false
|
||||
);
|
||||
bindtextdomain('squirrelmail', SM_PATH . 'locale');
|
||||
textdomain('squirrelmail');
|
||||
}
|
||||
}
|
||||
?>
|
2
ADDITIONS/squirrelmail-plugin/version
Normal file
2
ADDITIONS/squirrelmail-plugin/version
Normal file
@ -0,0 +1,2 @@
|
||||
postfixadmin
|
||||
2.3.0
|
@ -10,7 +10,6 @@
|
||||
# Last update:
|
||||
# $Id$
|
||||
|
||||
|
||||
Version ***svn*** - 2009/12/26 - SVN r***
|
||||
-----------------------------------
|
||||
|
||||
@ -19,10 +18,65 @@ Version ***svn*** - 2009/12/26 - SVN r***
|
||||
- add ability to choose activation date for vacation message in user module
|
||||
- merge search functionality into list-virtual.php
|
||||
|
||||
Version ***svn 2.3 branch*** - 2009/12/26 - SVN r***
|
||||
-----------------------------------
|
||||
Version 2.3.2 - 2010/08/24 - SVN r860 (postfixadmin-2.3 branch)
|
||||
---------------------------------------------------------------
|
||||
|
||||
*** see 2.3 branch CHANGELOG.TXT, will be added here after 2.3.1 release ***
|
||||
- SUMMARY: PostfixAdmin 2.3.2 is a bugfix-only release for Postfix Admin 2.3.1
|
||||
- SECURITY: attackers could find out if a admin exists (login pre-filled the
|
||||
username after "only" a wrong password was entered)
|
||||
- SECURITY: fix sql injection in list-domain (only exploitable by superadmins)
|
||||
- alias targets in users/edit-alias are now validated
|
||||
- invalid alias targets in users/edit-alias are shown to the user again
|
||||
instead of dropping them
|
||||
- fix dovecot:* password encryption (was broken in 2.3.1)
|
||||
- fix displaying used quota for dovecot <= 1.1 (was broken in 2.3.1)
|
||||
- when deleting a domain that is an alias domain (on the "from" side), the
|
||||
alias domain is deleted
|
||||
|
||||
Version 2.3.1 - 2010/07/09 - SVN r847 (postfixadmin-2.3 branch)
|
||||
---------------------------------------------------------------
|
||||
|
||||
- SUMMARY: PostfixAdmin 2.3.1 is a bugfix-only release for Postfix Admin 2.3.
|
||||
The only visible change is displaying the alias target for mailboxes which
|
||||
was a longstanding issue/"missing feature".
|
||||
The ADDITIONS directory contains some new scripts.
|
||||
- SECURITY: users could bypass checking the old password when changing the
|
||||
password by entering a too short new password. Fortunately only
|
||||
"exploitable" by authentificated users.
|
||||
- merge in changes to /debain (thanks normes) from trunk
|
||||
- display alias targets for mailboxes (if $CONF['special_alias_control'] = YES)
|
||||
- add hook for custom maildir path generation
|
||||
- add import_users_from_csv.py script (by Simone Piccardi)
|
||||
- add mailbox_post* scripts for cyrus
|
||||
- handle dovecot passwords without any tempfile (prevents safe_mode issues)
|
||||
- fix MySQL 6.0 compatibility
|
||||
- fix quota display (for dovecot >= 1.2)
|
||||
- fix short open tags ("<?")
|
||||
- translation updates and fixes
|
||||
- documentation updates and fixes
|
||||
- document commandline parameters for $CONF[*_script] options in config.inc.php
|
||||
- list-virtual: added error message if the check_owner query returns more
|
||||
than one result (can happen with pre-2.3 databases and prevents access for
|
||||
superadmins)
|
||||
- add in_array() check to avoid that superadmins can enter invalid domains
|
||||
- fix delete link for alias domains (when on target domain)
|
||||
- delete values from quota and quota2 table when deleting a mailbox
|
||||
- fix hardcoded table names in list-domain.php
|
||||
- fixed edit-alias.php not to drop alias to the mailbox if
|
||||
special_alias_control = NO
|
||||
- fix alias handling for mailboxes (special_alias_control vs.
|
||||
alias_control_admin confusion)
|
||||
- fix typo in upgrade.php that broke index creation and deletion when using
|
||||
non-default table names
|
||||
- fix creating 'ALL' domain (dummy for superadmins) when using non-default
|
||||
table names
|
||||
- fix: db_query did not return number of SELECTed rows if query starts with
|
||||
with whitespace
|
||||
- check for $CONF['encrypt'] = 'dovecot:md5-crypt' (postfixadmin login not
|
||||
working because dovecotpw uses a new salt each time), recommend
|
||||
internal md5crypt instead
|
||||
- replaced terribly outdated, broken squirrelmail plugin with a fresh version.
|
||||
Note: The new plugin version requires the Zend framework.
|
||||
|
||||
Version 2.3 - 2009/10/24 - SVN r739
|
||||
-----------------------------------
|
||||
@ -99,8 +153,8 @@ Version 2.3 Beta - 2009/01/15 - SVN r527
|
||||
|
||||
- added support for domain aliases (from lenix) (can be disabled with $CONF['alias_domain'])
|
||||
Important: If you update from a previous version, you'll have to adapt your postfix
|
||||
configuration (see DOCUMENTS/POSTFIX_CONF.txt) - or just disable alias domain support,
|
||||
your postfix configuration will continue to work
|
||||
configuration (see DOCUMENTS/POSTFIX_CONF.txt) - or just disable alias domain support,
|
||||
your postfix configuration will continue to work
|
||||
- updated postfix example configuration for domain aliases and to use the new mysql map format
|
||||
- vacation.pl:
|
||||
- add option for re-notification after definable timeout (patch from Luxten)
|
||||
|
@ -23,6 +23,8 @@ be viewed real-time in Postfixadmin.
|
||||
|
||||
default_mail_env = maildir:/var/mail/vmail/%u/
|
||||
|
||||
(dovecot 1.0.7 calls this mail_location ... ie.. mail_location = maildir:/...../%u )
|
||||
|
||||
auth default {
|
||||
mechanisms plain
|
||||
userdb sql {
|
||||
@ -65,6 +67,11 @@ password_query = SELECT username AS user,password FROM mailbox WHERE username =
|
||||
|
||||
user_query = SELECT maildir, 1001 AS uid, 1001 AS gid FROM mailbox WHERE username = '%u' AND active='1'
|
||||
|
||||
for dovecot 1.2: (for PostgreSQL, replace 'CONCAT(a, b)' with 'a || b')
|
||||
user_query = SELECT CONCAT('/home/vmail/', maildir) AS home, 1001 AS uid, 1001 AS gid,
|
||||
CONCAT('*:bytes=', quota) AS quota_rule FROM mailbox WHERE username = '%u' AND active='1'
|
||||
|
||||
|
||||
NB! The GID and UID are for postfix user and group ID, NOT MySQL user and group ID.
|
||||
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
#!/bin/bash
|
||||
content="
|
||||
|
||||
Postfix configuration for use with PostfixAdmin
|
||||
|
||||
@ -21,10 +23,9 @@ virtual_mailbox_maps =
|
||||
# Additional for quota support
|
||||
virtual_create_maildirsize = yes
|
||||
virtual_mailbox_extended = yes
|
||||
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
|
||||
virtual_mailbox_limit_maps = mysql:/etc/postfix/sql/mysql_virtual_mailbox_limit_maps.cf
|
||||
virtual_mailbox_limit_override = yes
|
||||
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his
|
||||
diskspace quota, please try again later.
|
||||
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
|
||||
virtual_overquota_bounce = yes
|
||||
|
||||
Where you chose to store the .cf files doesn't really matter, but they will
|
||||
@ -44,6 +45,11 @@ customizations. You will also want to consider the config.inc.php
|
||||
settings for domain_path and domain_in_mailbox. These examples
|
||||
use values of domain_path=YES and domain_in_mailbox=NO
|
||||
|
||||
You can create these files (with your values for user, password, hosts and
|
||||
dbname) automatically by executing this file (sh POSTFIX_CONF.txt).
|
||||
Please note that the generated files are for use with MySQL. For PostgreSQL,
|
||||
you'll have to replace the CONCAT as described below.
|
||||
|
||||
mysql_virtual_alias_maps.cf:
|
||||
user = postfix
|
||||
password = password
|
||||
@ -116,4 +122,47 @@ query = SELECT quota FROM mailbox WHERE username='%s' AND active = '1'
|
||||
http://postfix.wiki.xs4all.nl/index.php?title=Virtual_Users_and_Domains_with_Courier-IMAP_and_MySQL
|
||||
http://wiki.dovecot.org/HowTo/DovecotLDAPostfixAdminMySQL
|
||||
|
||||
" # end content
|
||||
|
||||
# generate config files out of this file
|
||||
# to do this, run sh POSTFIX_CONF.txt
|
||||
|
||||
POSTFIX_CONF="$0"
|
||||
|
||||
map_files="`sed -n '/^mysql.*cf:/ s/://p' < \"$0\"`"
|
||||
|
||||
tmpdir="`mktemp -d /tmp/postfixadmin-XXXXXX`" || { echo "Error: could not create tempdir" >&2 ; exit 1; }
|
||||
echo $tmpdir
|
||||
|
||||
echo 'Database host? (often localhost)'
|
||||
read hosts
|
||||
test -z "$hosts" && hosts=localhost
|
||||
|
||||
echo 'Database name?'
|
||||
read dbname
|
||||
test -z "$dbname" && { echo "Error: you did not enter a database name" >&2 ; exit 1; }
|
||||
|
||||
echo Database user?
|
||||
read user
|
||||
test -z "$user" && { echo "Error: you did not enter a database username" >&2 ; exit 1; }
|
||||
|
||||
echo Database password?
|
||||
read password
|
||||
test -z "$password" && { echo "Error: you did not enter a database password" >&2 ; exit 1; }
|
||||
|
||||
for file in $map_files ; do
|
||||
(
|
||||
echo "# $file"
|
||||
sed -n "/$file:/,/^$/ p" < "$POSTFIX_CONF" | sed "
|
||||
1d ; # filename
|
||||
s/^user =.*/user = $user/ ;
|
||||
s/^password =.*/password = $password/ ;
|
||||
s/^hosts =.*/hosts = $hosts/ ;
|
||||
s/^dbname =.*/dbname = $dbname/ ;
|
||||
"
|
||||
) > "$tmpdir/$file"
|
||||
done
|
||||
|
||||
echo "Config files have been written to $tmpdir. Please check their content and move them to /etc/postfix/sql/."
|
||||
echo "Do not forget to edit /etc/postfix/main.cf as described in $POSTFIX_CONF."
|
||||
|
||||
|
14
INSTALL.TXT
14
INSTALL.TXT
@ -9,7 +9,7 @@ REQUIRED!!
|
||||
----------
|
||||
- You are using Postfix 2.0 or higher.
|
||||
- You are using Apache 1.3.27 / Lighttpd 1.3.15 or higher.
|
||||
- You are using PHP 5.X
|
||||
- You are using PHP 5.1.2 or higher.
|
||||
- You are using MySQL 3.23 or higher (5.x recommended) OR PostgreSQL 7.4 (or higher)
|
||||
|
||||
|
||||
@ -117,7 +117,17 @@ create the admin user using the form displayed.
|
||||
This is all that is needed. Fire up your browser and go to the site that you
|
||||
specified to host Postfix Admin.
|
||||
|
||||
6. More information
|
||||
6. Integration with Postfix, Dovecot etc.
|
||||
-----------------------------------------
|
||||
|
||||
Now that PostfixAdmin is working, you need to do some configuration in Postfix,
|
||||
Dovecot etc. so that they use the domains, mailboxes and aliases you setup in
|
||||
PostfixAdmin.
|
||||
|
||||
The files in the DOCUMENTS/ directory explain which settings you need to
|
||||
do/change.
|
||||
|
||||
7. More information
|
||||
-------------------
|
||||
As of March 2007, PostfixAdmin moved to SourceForge. For the
|
||||
forum posts and source updates, see:
|
||||
|
@ -50,7 +50,6 @@ $CONF['database_host'] = 'localhost';
|
||||
$CONF['database_user'] = 'postfix';
|
||||
$CONF['database_password'] = 'postfixadmin';
|
||||
$CONF['database_name'] = 'postfix';
|
||||
$CONF['database_prefix'] = '';
|
||||
// If you need to specify a different port for a MYSQL database connection, use e.g.
|
||||
// $CONF['database_host'] = '172.30.33.66:3308';
|
||||
// If you need to specify a different port for POSTGRESQL database connection
|
||||
@ -147,6 +146,36 @@ $CONF['domain_path'] = 'NO';
|
||||
// NO: /usr/local/virtual/domain.tld/username
|
||||
// Note: If $CONF['domain_path'] is set to NO, this setting will be forced to YES.
|
||||
$CONF['domain_in_mailbox'] = 'YES';
|
||||
// If you want to define your own function to generate a maildir path set this to the name of the function.
|
||||
// Notes:
|
||||
// - this configuration directive will override both domain_path and domain_in_mailbox
|
||||
// - the maildir_name_hook() function example is present below, commented out
|
||||
// - if the function does not exist the program will default to the above domain_path and domain_in_mailbox settings
|
||||
$CONF['maildir_name_hook'] = 'NO';
|
||||
|
||||
/*
|
||||
maildir_name_hook example function
|
||||
|
||||
Called by create-mailbox.php if $CONF['maildir_name_hook'] == '<name_of_the_function>'
|
||||
- allows for customized maildir paths determined by a custom function
|
||||
- the example below will prepend a single-character directory to the
|
||||
beginning of the maildir, splitting domains more or less evenly over
|
||||
36 directories for improved filesystem performance with large numbers
|
||||
of domains.
|
||||
|
||||
Returns: maildir path
|
||||
ie. I/example.com/user/
|
||||
*/
|
||||
/*
|
||||
function maildir_name_hook($domain, $user) {
|
||||
$chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
|
||||
$dir_index = hexdec(substr(md5($domain), 28)) % strlen($chars);
|
||||
$dir = substr($chars, $dir_index, 1);
|
||||
return sprintf("%s/%s/%s/", $dir, $domain, $user);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Default Domain Values
|
||||
// Specify your default values below. Quota in MB.
|
||||
|
@ -48,7 +48,7 @@ $form_fields = array(
|
||||
'fMailboxes' => array('type' => 'int', 'default' => $CONF['mailboxes']),
|
||||
'fMaxquota' => array('type' => 'int', 'default' => $CONF['maxquota']),
|
||||
'fTransport' => array('type' => 'str', 'default' => $CONF['transport_default'], 'options' => $CONF['transport_options']),
|
||||
'fDefaultaliases' => array('type' => 'str', 'default' => 'off', 'options' => array('on', 'off')),
|
||||
'fDefaultaliases' => array('type' => 'str', 'default' => 'on', 'options' => array('on', 'off')),
|
||||
'fBackupmx' => array('type' => 'str', 'default' => 'off', 'options' => array('on', 'off'))
|
||||
);
|
||||
|
||||
@ -78,7 +78,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
|
||||
$tAliases = $fAliases;
|
||||
$tMaxquota = $fMaxquota;
|
||||
$tMailboxes = $fMailboxes;
|
||||
$tDefaultAliases = $fDefaultaliases;
|
||||
$tDefaultaliases = $fDefaultaliases;
|
||||
$tBackupmx = $fBackupmx;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
$password = pacrypt ($fPassword);
|
||||
|
||||
if ($CONF['domain_path'] == "YES")
|
||||
if($CONF['maildir_name_hook'] != 'NO' && function_exists($CONF['maildir_name_hook'])) {
|
||||
$hook_func = $CONF['maildir_name_hook'];
|
||||
$maildir = $hook_func ($fDomain, $fUsername);
|
||||
}
|
||||
else if ($CONF['domain_path'] == "YES")
|
||||
{
|
||||
if ($CONF['domain_in_mailbox'] == "YES")
|
||||
{
|
||||
@ -207,7 +211,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
$fUsername = strtolower($fUsername);
|
||||
$local_part = '';
|
||||
if(preg_match('/^(.*)@/', $fUsername, $matches)) {
|
||||
$local_part = $matches[1];
|
||||
$local_part = $matches[1];
|
||||
}
|
||||
|
||||
$result = db_query ("INSERT INTO $table_mailbox (username,password,name,maildir,local_part,quota,domain,created,modified,active) VALUES ('$fUsername','$password','$fName','$maildir','$local_part','$quota','$fDomain',NOW(),NOW(),'$sqlActive')");
|
||||
@ -221,43 +225,43 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
db_query('COMMIT');
|
||||
db_log ($SESSID_USERNAME, $fDomain, 'create_mailbox', "$fUsername");
|
||||
$tDomain = $fDomain;
|
||||
$tDomain = $fDomain;
|
||||
|
||||
$tQuota = $CONF['maxquota'];
|
||||
$tQuota = $CONF['maxquota'];
|
||||
|
||||
if ($fMail == "on")
|
||||
{
|
||||
$fTo = $fUsername;
|
||||
$fFrom = $SESSID_USERNAME;
|
||||
$fHeaders = "To: " . $fTo . "\n";
|
||||
$fHeaders .= "From: " . $fFrom . "\n";
|
||||
|
||||
$fHeaders .= "Subject: " . encode_header ($PALANG['pSendmail_subject_text']) . "\n";
|
||||
$fHeaders .= "MIME-Version: 1.0\n";
|
||||
$fHeaders .= "Content-Type: text/plain; charset=utf-8\n";
|
||||
$fHeaders .= "Content-Transfer-Encoding: 8bit\n";
|
||||
|
||||
$fHeaders .= $CONF['welcome_text'];
|
||||
|
||||
if (!smtp_mail ($fTo, $fFrom, $fHeaders))
|
||||
if ($fMail == "on")
|
||||
{
|
||||
$tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />";
|
||||
$fTo = $fUsername;
|
||||
$fFrom = $SESSID_USERNAME;
|
||||
$fHeaders = "To: " . $fTo . "\n";
|
||||
$fHeaders .= "From: " . $fFrom . "\n";
|
||||
|
||||
$fHeaders .= "Subject: " . encode_header ($PALANG['pSendmail_subject_text']) . "\n";
|
||||
$fHeaders .= "MIME-Version: 1.0\n";
|
||||
$fHeaders .= "Content-Type: text/plain; charset=utf-8\n";
|
||||
$fHeaders .= "Content-Transfer-Encoding: 8bit\n";
|
||||
|
||||
$fHeaders .= $CONF['welcome_text'];
|
||||
|
||||
if (!smtp_mail ($fTo, $fFrom, $fHeaders))
|
||||
{
|
||||
$tMessage .= "<br />" . $PALANG['pSendmail_result_error'] . "<br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
$tMessage .= "<br />" . $PALANG['pSendmail_result_success'] . "<br />";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
$tShowpass = "";
|
||||
if ( $tPassGenerated == 1 || $CONF['show_password'] == "YES") $tShowpass = " / $fPassword";
|
||||
|
||||
if (create_mailbox_subfolders($fUsername,$fPassword))
|
||||
{
|
||||
$tMessage .= "<br />" . $PALANG['pSendmail_result_success'] . "<br />";
|
||||
$tMessage .= $PALANG['pCreate_mailbox_result_success'] . "<br />($fUsername$tShowpass)";
|
||||
} else {
|
||||
$tMessage .= $PALANG['pCreate_mailbox_result_succes_nosubfolders'] . "<br />($fUsername$tShowpass)";
|
||||
}
|
||||
}
|
||||
|
||||
$tShowpass = "";
|
||||
if ( $tPassGenerated == 1 || $CONF['show_password'] == "YES") $tShowpass = " / $fPassword";
|
||||
|
||||
if (create_mailbox_subfolders($fUsername,$fPassword))
|
||||
{
|
||||
$tMessage .= $PALANG['pCreate_mailbox_result_success'] . "<br />($fUsername$tShowpass)";
|
||||
} else {
|
||||
$tMessage .= $PALANG['pCreate_mailbox_result_succes_nosubfolders'] . "<br />($fUsername$tShowpass)";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ table {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
.button:hover, .button:focus {
|
||||
background: #BCFF36;
|
||||
color: #888888;
|
||||
}
|
||||
@ -311,6 +311,10 @@ div.setup li {
|
||||
padding-bottom:1em;
|
||||
}
|
||||
|
||||
.searchresult {
|
||||
background:lightgreen;
|
||||
}
|
||||
|
||||
div.nav_bar {
|
||||
text-align: left;
|
||||
width: 750px;
|
||||
|
27
debian/README.source
vendored
Normal file
27
debian/README.source
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
This package is using the quilt framework.
|
||||
All patches are located in debian/patches.
|
||||
|
||||
Adding a new patch: quilt new <date-patch_name>
|
||||
This will create a new file debian/patches/patch/date-patch_name.
|
||||
Please use the current date (e.g. 20100221 - YYYYMMDD) as prefix!
|
||||
|
||||
Editing a file to include it into the patch: quilt edit <filename>
|
||||
This will open your $EDITOR.
|
||||
|
||||
To write your changes into the new patchfile: quilt refresh.
|
||||
|
||||
quilt push:
|
||||
Apply patch(es) from the series file. Without options, the next
|
||||
patch in the series file is applied. When a number is specified,
|
||||
apply the specified number of patches. When a patch name is
|
||||
specified, apply all patches up to and including the specified patch.
|
||||
Patch names may include the patches/ prefix, which means that
|
||||
filename completion can be used.
|
||||
|
||||
quilt pop:
|
||||
Remove patch(es) from the stack of applied patches. Without options,
|
||||
the topmost patch is removed. When a number is specified, remove the
|
||||
specified number of patches. When a patch name is specified, remove
|
||||
patches until the specified patch end up on top of the stack.
|
||||
Patch names may include the patches/ prefix, which means that
|
||||
filename completion can be used.
|
18
debian/changelog
vendored
18
debian/changelog
vendored
@ -1,19 +1,19 @@
|
||||
postfixadmin (2.3rc7) unstable; urgency=low
|
||||
postfixadmin (2.3.2) unstable; urgency=low
|
||||
|
||||
* Fix issue with pre.rm script
|
||||
* New 'upstream' release.
|
||||
* New upstream release
|
||||
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Mon, 27 Jul 2009 22:08:26 +0100
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Mon, 23 Aug 2010 11:24:00 +0100
|
||||
|
||||
postfixadmin (2.3rc6) unstable; urgency=low
|
||||
postfixadmin (2.3.1) unstable; urgency=low
|
||||
|
||||
* Bump version number; etc.
|
||||
* New upstream release
|
||||
* Updated .deb standards (thanks normes)
|
||||
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Mon, 20 Jul 2009 19:56:26 +0100
|
||||
-- David Goodwin <david.goodwin@palepurple.co.uk> Thu, 08 Jul 2010 22:20:14 +0100
|
||||
|
||||
postfixadmin (2.3rc5) unstable; urgency=low
|
||||
postfixadmin (2.3) unstable; urgency=low
|
||||
|
||||
* Initial release (Closes: #247225)
|
||||
|
||||
-- Norman Messtorff <normes@normes.org> Sat, 09 May 2009 22:36:26 +0200
|
||||
-- Norman Messtorff <normes@normes.org> Sun, 21 Feb 2010 22:36:26 +0200
|
||||
|
||||
|
5
debian/control
vendored
5
debian/control
vendored
@ -3,14 +3,13 @@ Section: admin
|
||||
Priority: optional
|
||||
Maintainer: Norman Messtorff <normes@normes.org>
|
||||
Build-Depends: debhelper (>= 7), po-debconf, quilt (>= 0.46)
|
||||
Standards-Version: 3.8.2
|
||||
Standards-Version: 3.8.4
|
||||
Homepage: http://postfixadmin.sourceforge.net
|
||||
XS-Vcs-Svn: https://postfixadmin.svn.sourceforge.net/svnroot/postfixadmin/trunk
|
||||
XS-Vcs-Browse: http://postfixadmin.svn.sourceforge.net/viewvc/postfixadmin/trunk/
|
||||
|
||||
Package: postfixadmin
|
||||
Architecture: all
|
||||
Depends: debconf (>= 0.5), dbconfig-common, wwwconfig-common, apache2 | lighttpd, libapache2-mod-php5 | php5-cgi | php5, php5-imap, php5-mysql | php5-pgsql, mysql-client | postgresql-client, ${misc:Depends}
|
||||
Depends: debconf (>= 0.5), dbconfig-common, wwwconfig-common, apache2 | lighttpd | httpd, libapache2-mod-php5 | php5-cgi | php5, php5-imap, php5-mysql | php5-pgsql, mysql-client | postgresql-client, ${misc:Depends}
|
||||
Recommends: postfix-mysql | postfix-pgsql, mysql-server | postgresql-server
|
||||
Suggests: squirrelmail-postfixadmin, dovecot-common | courier-authlib-mysql | courier-authlib-postgresql
|
||||
Description: Virtual mail hosting interface for Postfix
|
||||
|
@ -1,7 +1,7 @@
|
||||
Index: config.inc.php
|
||||
Index: postfixadmin-trunk/config.inc.php
|
||||
===================================================================
|
||||
--- config.inc.php (revision 690)
|
||||
+++ config.inc.php (working copy)
|
||||
--- postfixadmin-trunk.orig/config.inc.php 2010-02-21 19:04:32.000000000 +0100
|
||||
+++ postfixadmin-trunk/config.inc.php 2010-02-21 19:05:26.000000000 +0100
|
||||
@@ -23,7 +23,7 @@
|
||||
* Doing this implies you have changed this file as required.
|
||||
* i.e. configuring database etc; specifying setup.php password etc.
|
||||
@ -11,7 +11,7 @@ Index: config.inc.php
|
||||
|
||||
// In order to setup Postfixadmin, you MUST specify a hashed password here.
|
||||
// To create the hash, visit setup.php in a browser and type a password into the field,
|
||||
@@ -46,11 +46,11 @@
|
||||
@@ -45,11 +45,12 @@
|
||||
// mysql = MySQL 3.23 and 4.0, 4.1 or 5
|
||||
// mysqli = MySQL 4.1+
|
||||
// pgsql = PostgreSQL
|
||||
@ -20,11 +20,12 @@ Index: config.inc.php
|
||||
-$CONF['database_user'] = 'postfix';
|
||||
-$CONF['database_password'] = 'postfixadmin';
|
||||
-$CONF['database_name'] = 'postfix';
|
||||
+
|
||||
+$CONF['database_type'] = '_DBC_DBTYPE_';
|
||||
+$CONF['database_host'] = '_DBC_DBSERVER_';
|
||||
+$CONF['database_user'] = '_DBC_DBUSER_';
|
||||
+$CONF['database_password'] = '_DBC_DBPASS_';
|
||||
+$CONF['database_name'] = '_DBC_DBNAME_';
|
||||
$CONF['database_prefix'] = '';
|
||||
|
||||
// Here, if you need, you can customize table names.
|
||||
// If you need to specify a different port for a MYSQL database connection, use e.g.
|
||||
// $CONF['database_host'] = '172.30.33.66:3308';
|
2
debian/patches/series
vendored
2
debian/patches/series
vendored
@ -1 +1 @@
|
||||
01-20090509_database-credentials -p0
|
||||
20100221_db-credentials
|
||||
|
3
debian/postfixadmin.docs
vendored
3
debian/postfixadmin.docs
vendored
@ -1,5 +1,2 @@
|
||||
DOCUMENTS
|
||||
CHANGELOG.TXT
|
||||
GPL-LICENSE.TXT
|
||||
INSTALL.TXT
|
||||
LICENSE.TXT
|
||||
|
16
debian/postfixadmin.examples
vendored
16
debian/postfixadmin.examples
vendored
@ -1,2 +1,16 @@
|
||||
ADDITIONS
|
||||
VIRTUAL_VACATION
|
||||
ADDITIONS/change_password.tgz
|
||||
ADDITIONS/import_users_from_csv.py
|
||||
ADDITIONS/postfixadmin-domain-postdeletion.sh
|
||||
ADDITIONS/cleanupdirs.pl
|
||||
ADDITIONS/mailbox_remover.pl
|
||||
ADDITIONS/postfixadmin-mailbox-postcreation.sh
|
||||
ADDITIONS/virtualmaildel.php
|
||||
ADDITIONS/convert-passwd-to-postfixadmin.pl
|
||||
ADDITIONS/mkeveryone.pl
|
||||
ADDITIONS/postfixadmin-mailbox-postdeletion.sh
|
||||
ADDITIONS/delete-mailq-by-domain.pl
|
||||
ADDITIONS/pfa_maildir_cleanup.pl
|
||||
ADDITIONS/quota_usage.pl
|
||||
ADDITIONS/fetchmail.pl
|
||||
ADDITIONS/README.TXT
|
||||
|
2
debian/postfixadmin.install
vendored
2
debian/postfixadmin.install
vendored
@ -4,8 +4,6 @@ css usr/share/postfixadmin
|
||||
images usr/share/postfixadmin
|
||||
languages usr/share/postfixadmin
|
||||
model usr/share/postfixadmin
|
||||
motd.txt usr/share/postfixadmin
|
||||
motd-users.txt usr/share/postfixadmin
|
||||
templates usr/share/postfixadmin
|
||||
users usr/share/postfixadmin
|
||||
debian/apache.conf etc/postfixadmin
|
||||
|
2
debian/watch
vendored
2
debian/watch
vendored
@ -1,2 +0,0 @@
|
||||
version=3
|
||||
http://sf.net/postfixadmin/postfixadmin-(.*)\.tar\.gz
|
@ -68,6 +68,7 @@ elseif ($fTable == "domain")
|
||||
$result_domain_admins = db_delete ($table_domain_admins,$fWhere,$fDelete);
|
||||
$result_alias = db_delete ($table_alias,$fWhere,$fDelete);
|
||||
$result_mailbox = db_delete ($table_mailbox,$fWhere,$fDelete);
|
||||
$result_alias_domain = db_delete($table_alias_domain,'alias_domain',$fDelete);
|
||||
$result_log = db_delete ($table_log,$fWhere,$fDelete);
|
||||
if ($CONF['vacation'] == "YES")
|
||||
{
|
||||
@ -148,6 +149,14 @@ elseif ($fTable == "alias" or $fTable == "mailbox")
|
||||
db_query ("DELETE FROM $table_vacation WHERE email='$fDelete' AND domain='$fDomain'");
|
||||
db_query ("DELETE FROM $table_vacation_notification WHERE on_vacation ='$fDelete' "); /* should be caught by cascade, if PgSQL */
|
||||
}
|
||||
$result = db_query("SELECT * FROM $table_quota WHERE username='$fDelete'");
|
||||
if($result['rows'] >= 1) {
|
||||
db_query ("DELETE FROM $table_quota WHERE username='$fDelete'");
|
||||
}
|
||||
$result = db_query("SELECT * FROM $table_quota2 WHERE username='$fDelete'");
|
||||
if($result['rows'] == 1) {
|
||||
db_query ("DELETE FROM $table_quota2 WHERE username='$fDelete'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($error != 1)
|
||||
|
@ -64,8 +64,8 @@ if ($fAddress == "") {
|
||||
$tGoto = $row['goto'];
|
||||
$orig_alias_list = explode(',', $tGoto);
|
||||
$alias_list = $orig_alias_list;
|
||||
//. if we are not a global admin, and special_alias_control is NO, hide the alias that's the mailbox name.
|
||||
if($CONF['special_alias_control'] == 'NO' && !authentication_has_role('global-admin')) {
|
||||
//. if we are not a global admin, and alias_control_admin is NO, hide the alias that's the mailbox name.
|
||||
if($CONF['alias_control_admin'] == 'NO' && !authentication_has_role('global-admin')) {
|
||||
|
||||
/* Has a mailbox as well? Remove the address from $tGoto in order to edit just the real aliases */
|
||||
$result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fAddress' AND domain='$fDomain'");
|
||||
@ -137,7 +137,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
if($CONF['alias_control_admin'] == 'NO' && !authentication_has_role('global-admin')) {
|
||||
// if original record had a mailbox alias, so ensure the updated one does too.
|
||||
if(in_array($orig_alias_list, $fAddress)) {
|
||||
if(in_array($fAddress, $orig_alias_list)) {
|
||||
$new_aliases[] = $fAddress;
|
||||
}
|
||||
}
|
||||
@ -165,15 +165,14 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$fAddress = htmlentities($fAddress, ENT_QUOTES);
|
||||
$fDomain = htmlentities($fDomain, ENT_QUOTES);
|
||||
// never used?
|
||||
//$fDomain = htmlentities($fDomain, ENT_QUOTES);
|
||||
|
||||
$array = preg_split ('/,/', $tGoto);
|
||||
// TOCHECK
|
||||
$array = $alias_list;
|
||||
|
||||
$smarty->assign ('fAddress', $fAddress, false);
|
||||
$smarty->assign ('fAddress', $fAddress);
|
||||
$smarty->assign ('array', $array, false);
|
||||
$smarty->assign ('tMessage', $tMessage, false);
|
||||
$smarty->assign ('smarty_template', 'edit-alias');
|
||||
|
@ -114,17 +114,15 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
}
|
||||
|
||||
$smarty->assign ('domain', $domain);
|
||||
$smarty->assign ('tDescription', htmlspecialchars($tDescription, ENT_QUOTES), false);
|
||||
$smarty->assign ('tDescription', $tDescription);
|
||||
$smarty->assign ('tAliases', $tAliases);
|
||||
$smarty->assign ('tMailboxes', $tMailboxes);
|
||||
$smarty->assign ('tMaxquota', $tMaxquota);
|
||||
$smarty->assign ('select_options', select_options ($CONF ['transport_options'], array ($tTransport)), false);
|
||||
$smarty->assign ('select_options', select_options($CONF['transport_options'], array($tTransport)), false);
|
||||
if ($tBackupmx) $smarty->assign ('tBackupmx', ' checked="checked"');
|
||||
if ($tActive) $smarty->assign ('tActive', ' checked="checked"');
|
||||
$smarty->assign ('tMessage', $tMessage,false);
|
||||
$smarty->assign ('smarty_template', 'admin_edit-domain');
|
||||
$smarty->display ('index.tpl');
|
||||
|
||||
|
||||
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
||||
?>
|
||||
|
@ -176,10 +176,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
}
|
||||
|
||||
$smarty->assign ('fUsername', $fUsername);
|
||||
$smarty->assign ('fPassword', $user_details ['password'], false);
|
||||
//$smarty->assign ('pEdit_mailbox_username_text', $pEdit_mailbox_username_text);
|
||||
$smarty->assign ('pEdit_mailbox_password_text', $pEdit_mailbox_password_text, false);
|
||||
//$smarty->assign ('tName', htmlspecialchars ($tName,ENT_QUOTES));
|
||||
$smarty->assign ('tName', $tName, false);
|
||||
$smarty->assign ('pEdit_mailbox_name_text', $pEdit_mailbox_name_text,false);
|
||||
$smarty->assign ('tMaxquota', $tMaxquota);
|
||||
|
@ -209,8 +209,8 @@ if (empty ($tActiveUntil))
|
||||
$tActiveUntil = date ("Y-m-d");
|
||||
|
||||
$smarty->assign ('tUseremail', $tUseremail);
|
||||
$smarty->assign ('tSubject', htmlentities(stripslashes($tSubject), ENT_QUOTES, 'UTF-8'),false);
|
||||
$smarty->assign ('tBody', htmlentities(stripslashes($tBody), ENT_QUOTES , 'UTF-8'),false);
|
||||
$smarty->assign ('tSubject', $tSubject);
|
||||
$smarty->assign ('tBody', $tBody ,false);
|
||||
$smarty->assign ('tMessage', $tMessage, false);
|
||||
$smarty->assign ('tActiveFrom', date ("d.m.Y", strtotime ($tActiveFrom)));
|
||||
$smarty->assign ('tActiveUntil', date ("d.m.Y", strtotime ($tActiveUntil)));
|
||||
|
@ -81,7 +81,12 @@ function authentication_require_role($role) {
|
||||
if(authentication_has_role($role)) {
|
||||
return True;
|
||||
}
|
||||
header("Location: " . $CONF['postfix_admin_url'] . "/login.php");
|
||||
if($role === 'user') {
|
||||
header("Location: " . $CONF['postfix_admin_url'] . '/users/login.php');
|
||||
}
|
||||
else {
|
||||
header("Location: " . $CONF['postfix_admin_url'] . "/login.php");
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
/**
|
||||
@ -445,7 +450,8 @@ function get_domain_properties ($domain)
|
||||
//while loop to figure index names. use page_size and loop of queries
|
||||
$i=0;
|
||||
$current=0;
|
||||
$page_size = $CONF['page_size'];
|
||||
$page_size = (int) $CONF['page_size'];
|
||||
if ($page_size < 1) die ("\$CONF['page_size'] = '$page_size' is invalid (it may only contain digits and must be >= 1)");
|
||||
$tmpstr="";
|
||||
$idxlabel="";
|
||||
$list['alias_pgindex_count'] = 0;
|
||||
@ -1200,6 +1206,7 @@ function pacrypt ($pw, $pw_db="")
|
||||
$split_method = preg_split ('/:/', $CONF['encrypt']);
|
||||
$method = strtoupper($split_method[1]);
|
||||
if (! preg_match("/^[A-Z0-9-]+$/", $method)) { die("invalid dovecot encryption method"); } # TODO: check against a fixed list?
|
||||
if (strtolower($method) == 'md5-crypt') die("\$CONF['encrypt'] = 'dovecot:md5-crypt' will not work because dovecotpw generates a random salt each time. Please use \$CONF['encrypt'] = 'md5crypt' instead.");
|
||||
|
||||
$dovecotpw = "dovecotpw";
|
||||
if (!empty($CONF['dovecotpw'])) $dovecotpw = $CONF['dovecotpw'];
|
||||
@ -1356,7 +1363,8 @@ function smtp_mail ($to, $from, $data)
|
||||
global $CONF;
|
||||
$smtpd_server = $CONF['smtp_server'];
|
||||
$smtpd_port = $CONF['smtp_port'];
|
||||
$smtp_server = $_SERVER["SERVER_NAME"];
|
||||
//$smtp_server = $_SERVER["SERVER_NAME"];
|
||||
$smtp_server = php_uname("n");
|
||||
$errno = "0";
|
||||
$errstr = "0";
|
||||
$timeout = "30";
|
||||
@ -1572,7 +1580,7 @@ function db_query ($query, $ignore_errors = 0)
|
||||
if ($error_text != "" && $ignore_errors == 0) die($error_text);
|
||||
|
||||
if ($error_text == "") {
|
||||
if (preg_match("/^SELECT/i", $query))
|
||||
if (preg_match("/^SELECT/i", trim($query)))
|
||||
{
|
||||
// if $query was a SELECT statement check the number of rows with [database_type]_num_rows ().
|
||||
if ($CONF['database_type'] == "mysql") $number_rows = mysql_num_rows ($result);
|
||||
@ -1730,12 +1738,15 @@ function db_update ($table, $where, $values, $timestamp = array())
|
||||
* Action: Logs actions from admin
|
||||
* Call: db_log (string username, string domain, string action, string data)
|
||||
* Possible actions are:
|
||||
* 'create_domain'
|
||||
* 'create_alias'
|
||||
* 'create_alias_domain'
|
||||
* 'create_mailbox'
|
||||
* 'delete_domain'
|
||||
* 'delete_alias'
|
||||
* 'delete_alias_domain'
|
||||
* 'delete_mailbox'
|
||||
* 'edit_domain'
|
||||
* 'edit_alias'
|
||||
* 'edit_alias_state'
|
||||
* 'edit_alias_domain_state'
|
||||
@ -1747,9 +1758,9 @@ function db_log ($username,$domain,$action,$data)
|
||||
{
|
||||
global $CONF;
|
||||
global $table_log;
|
||||
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
|
||||
$REMOTE_ADDR = getRemoteAddr();
|
||||
|
||||
$action_list = array('create_alias', 'create_alias_domain', 'delete_alias', 'delete_alias_domain', 'edit_alias', 'create_mailbox', 'delete_mailbox', 'edit_mailbox', 'edit_alias_state', 'edit_alias_domain_state', 'edit_mailbox_state', 'edit_password');
|
||||
$action_list = array( 'create_domain', 'create_alias', 'create_alias_domain','delete_domain', 'delete_alias', 'delete_alias_domain','edit_domain', 'edit_alias', 'create_mailbox', 'delete_mailbox', 'edit_mailbox', 'edit_alias_state', 'edit_alias_domain_state', 'edit_mailbox_state', 'edit_password');
|
||||
|
||||
if(!in_array($action, $action_list)) {
|
||||
die("Invalid log action : $action"); // could do with something better?
|
||||
@ -1788,9 +1799,13 @@ function db_in_clause($field, $values) {
|
||||
function table_by_key ($table_key)
|
||||
{
|
||||
global $CONF;
|
||||
$table = $CONF['database_prefix'].$CONF['database_tables'][$table_key];
|
||||
if (empty($table)) $table = $table_key;
|
||||
return $table;
|
||||
if (empty($CONF['database_tables'][$table_key])) {
|
||||
$table = $table_key;
|
||||
} else {
|
||||
$table = $CONF['database_tables'][$table_key];
|
||||
}
|
||||
|
||||
return $CONF['database_prefix'].$table;
|
||||
}
|
||||
|
||||
|
||||
@ -2103,6 +2118,7 @@ function create_mailbox_subfolders($login,$cleartext_password)
|
||||
$f='{'.$s_host.'}'.$s_prefix.$f;
|
||||
$res=imap_createmailbox($i,$f);
|
||||
if (!$res) {
|
||||
error_log('Could not create IMAP folder $f: '.imap_last_error());
|
||||
@imap_close($i);
|
||||
return FALSE;
|
||||
}
|
||||
@ -2339,6 +2355,12 @@ function create_admin($fUsername, $fPassword, $fPassword2, $fDomains, $no_genera
|
||||
|
||||
|
||||
}
|
||||
function getRemoteAddr() {
|
||||
$REMOTE_ADDR = 'localhost';
|
||||
if (isset($_SERVER['REMOTE_ADDR']))
|
||||
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
|
||||
return $REMOTE_ADDR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2362,8 +2384,6 @@ function boolconf($setting) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$table_admin = table_by_key ('admin');
|
||||
$table_alias = table_by_key ('alias');
|
||||
$table_alias_domain = table_by_key ('alias_domain');
|
||||
|
@ -194,6 +194,9 @@ $PALANG['pViewlog_domain'] = 'Domain';
|
||||
$PALANG['pViewlog_action'] = 'Aktion';
|
||||
$PALANG['pViewlog_data'] = 'Daten';
|
||||
|
||||
$PALANG['pViewlog_action_create_domain'] = 'Domain erstellen';
|
||||
$PALANG['pViewlog_action_edit_domain'] = 'Domain bearbeiten';
|
||||
$PALANG['pViewlog_action_delete_domain'] = 'Domain löschen';
|
||||
$PALANG['pViewlog_action_create_mailbox'] = 'Mailbox erstellen';
|
||||
$PALANG['pViewlog_action_delete_mailbox'] = 'Mailbox löschen';
|
||||
$PALANG['pViewlog_action_edit_mailbox'] = 'Mailbox bearbeiten';
|
||||
|
@ -196,6 +196,9 @@ $PALANG['pViewlog_domain'] = 'Domain';
|
||||
$PALANG['pViewlog_action'] = 'Action';
|
||||
$PALANG['pViewlog_data'] = 'Data';
|
||||
|
||||
$PALANG['pViewlog_action_create_domain'] = 'create domain';
|
||||
$PALANG['pViewlog_action_delete_domain'] = 'delete domain';
|
||||
$PALANG['pViewlog_action_edit_domain'] = 'edit domain';
|
||||
$PALANG['pViewlog_action_create_mailbox'] = 'create mailbox';
|
||||
$PALANG['pViewlog_action_delete_mailbox'] = 'delete mailbox';
|
||||
$PALANG['pViewlog_action_edit_mailbox'] = 'edit mailbox';
|
||||
|
@ -85,7 +85,7 @@ $PALANG['pOverview_get_quota'] = 'Mailbox Quota (MB)';
|
||||
$PALANG['pOverview_get_modified'] = 'Laatst bewerkt';
|
||||
|
||||
$PALANG['pDelete_delete_error'] = '<span class="error_msg">Mislukt te verwijderen ';
|
||||
$PALANG['pDelete_delete_success'] = '%s verwijdert.';
|
||||
$PALANG['pDelete_delete_success'] = '%s verwijderd.';
|
||||
$PALANG['pDelete_postdelete_error'] = '<span class="error_msg">Niet in staat mailbox te verwijderen ';
|
||||
$PALANG['pDelete_domain_error'] = '<span class="error_msg">Dit is niet uw domein ';
|
||||
$PALANG['pDelete_domain_alias_error'] = '<span class="error_msg">Dit is niet uw domein ';
|
||||
@ -191,12 +191,12 @@ $PALANG['pViewlog_domain'] = 'Domein';
|
||||
$PALANG['pViewlog_action'] = 'Actie';
|
||||
$PALANG['pViewlog_data'] = 'Aanpassing';
|
||||
$PALANG['pViewlog_action_create_mailbox'] = 'Mailbox toegevoegd';
|
||||
$PALANG['pViewlog_action_delete_mailbox'] = 'Mailbox verwijdert';
|
||||
$PALANG['pViewlog_action_delete_mailbox'] = 'Mailbox verwijderd';
|
||||
$PALANG['pViewlog_action_edit_mailbox'] = 'Mailbox bewerkt';
|
||||
$PALANG['pViewlog_action_edit_mailbox_state'] = 'status actieve mailbox bewerkt';
|
||||
$PALANG['pViewlog_action_create_alias'] = 'alias toegevoegd';
|
||||
$PALANG['pViewlog_action_create_alias_domain'] = 'maak domein alias';
|
||||
$PALANG['pViewlog_action_delete_alias'] = 'alias verwijdert';
|
||||
$PALANG['pViewlog_action_delete_alias'] = 'alias verwijderd';
|
||||
$PALANG['pViewlog_action_delete_alias_domain'] = 'verwijder alias domein';
|
||||
$PALANG['pViewlog_action_edit_alias'] = 'alias bewerkt';
|
||||
$PALANG['pViewlog_action_edit_alias_state'] = 'status actieve alias bewerkt';
|
||||
@ -331,7 +331,7 @@ $PALANG['pUsersMenu_edit_alias'] = 'Wijzig uw forward';
|
||||
$PALANG['pUsersMenu_password'] = 'Wijzig wachtwoord';
|
||||
|
||||
$PALANG['pUsersMain_vacation'] = 'Stel een "out of office" bericht of automatisch beantwoorden voor uw e-mail in.';
|
||||
$PALANG['pUsersMain_vacationSet'] = $PALANG['pUsersMenu_vacation'] . ' is actief, click \'' . $PALANG['pUsersMenu_vacation'] . '\' to ' . $PALANG['edit'] . '/verweideren';
|
||||
$PALANG['pUsersMain_vacationSet'] = $PALANG['pUsersMenu_vacation'] . ' is actief, click \'' . $PALANG['pUsersMenu_vacation'] . '\' to ' . $PALANG['edit'] . '/verwijderen';
|
||||
$PALANG['pUsersMain_edit_alias'] = 'Wijzig uw e-mail forwarding.';
|
||||
$PALANG['pUsersMain_password'] = 'Wijzig uw huidige wachtwoord.';
|
||||
|
||||
@ -353,8 +353,8 @@ $PALANG['pUsersVacation_activeuntil'] = 'Active until'; # XXX
|
||||
|
||||
$PALANG['pCreate_dbLog_createmailbox'] = 'mailbox aangemaakt';
|
||||
$PALANG['pCreate_dbLog_createalias'] = 'alias aangemaakt';
|
||||
$PALANG['pDelete_dbLog_deletealias'] = 'alias verwijdert';
|
||||
$PALANG['pDelete_dbLog_deletemailbox'] = 'mailbox verwijdert';
|
||||
$PALANG['pDelete_dbLog_deletealias'] = 'alias verwijderd';
|
||||
$PALANG['pDelete_dbLog_deletemailbox'] = 'mailbox verwijderd';
|
||||
|
||||
$PALANG['pEdit_dbLog_editactive'] = 'status verandert';
|
||||
$PALANG['pEdit_dbLog_editalias'] = 'bewerk alias';
|
||||
|
@ -5,6 +5,7 @@
|
||||
// by Jarek
|
||||
// updated by Piotr Meyer <aniou at smutek dot pl>
|
||||
// updated by Lukasz Wasikowski <lukasz@wasikowski.net>
|
||||
// updated by Michal Wojcik <michalw-snt @ SF>
|
||||
//
|
||||
|
||||
$PALANG['YES'] = 'Tak';
|
||||
@ -24,13 +25,13 @@ $PALANG['pLogin_welcome'] = 'Sekcja przeznaczona dla administratorów domen.';
|
||||
$PALANG['pLogin_username'] = 'Login (email)';
|
||||
$PALANG['pLogin_password'] = 'Hasło';
|
||||
$PALANG['pLogin_button'] = 'Zaloguj';
|
||||
$PALANG['pLogin_failed'] = 'Your email address or password are not correct.'; # XXX
|
||||
$PALANG['pLogin_failed'] = 'Twój adres Email lub hasło jest niepoprawne.';
|
||||
$PALANG['pLogin_login_users'] = 'Sekcja przeznaczona dla użytkowników.';
|
||||
|
||||
$PALANG['pMenu_main'] = 'Strona główna';
|
||||
$PALANG['pMenu_overview'] = 'Dane zbiorcze';
|
||||
$PALANG['pMenu_create_alias'] = 'Dodaj alias';
|
||||
$PALANG['pMenu_create_alias_domain'] = 'Add Alias Domain'; # XXX
|
||||
$PALANG['pMenu_create_alias_domain'] = 'Dodaj alias domeny';
|
||||
$PALANG['pMenu_create_mailbox'] = 'Dodaj konto';
|
||||
$PALANG['pMenu_fetchmail'] = 'Pobierz Email';
|
||||
$PALANG['pMenu_sendmail'] = 'Wyślij Email';
|
||||
@ -53,21 +54,21 @@ $PALANG['pOverview_title'] = ':: Zdefiniowane domeny';
|
||||
$PALANG['pOverview_up_arrow'] = 'Do góry';
|
||||
$PALANG['pOverview_right_arrow'] = 'Następna strona';
|
||||
$PALANG['pOverview_left_arrow'] = 'Poprzednia strona';
|
||||
$PALANG['pOverview_alias_domain_title'] = ':: Domain Aliases'; # XXX
|
||||
$PALANG['pOverview_alias_domain_title'] = ':: Aliasy domen';
|
||||
$PALANG['pOverview_alias_title'] = ':: Aliasy';
|
||||
$PALANG['pOverview_mailbox_title'] = ':: Konta pocztowe'; # XXX
|
||||
$PALANG['pOverview_mailbox_title'] = ':: Konta pocztowe';
|
||||
$PALANG['pOverview_button'] = 'Idź';
|
||||
$PALANG['pOverview_welcome'] = 'Dane zbiorcze dla domeny ';
|
||||
$PALANG['pOverview_alias_domain_aliases'] = 'Alias Domains'; # XXX
|
||||
$PALANG['pOverview_alias_domain_target'] = '%s is an Alias Domain for:'; # XXX
|
||||
$PALANG['pOverview_alias_domain_aliases'] = 'Domeny aliasowe';
|
||||
$PALANG['pOverview_alias_domain_target'] = '%s jest domeną aliasową dla:';
|
||||
$PALANG['pOverview_alias_alias_count'] = 'Alias';
|
||||
$PALANG['pOverview_alias_mailbox_count'] = 'Konta';
|
||||
$PALANG['pOverview_alias_address'] = 'Od';
|
||||
$PALANG['pOverview_alias_goto'] = 'Do';
|
||||
$PALANG['pOverview_alias_modified'] = 'Ostatnio zmodyfikowany';
|
||||
$PALANG['pOverview_alias_domain_modified'] = 'Last Modified'; # XXX
|
||||
$PALANG['pOverview_alias_domain_modified'] = 'Ostatnio zmodyfikowane';
|
||||
$PALANG['pOverview_alias_active'] = 'Aktywny';
|
||||
$PALANG['pOverview_alias_domain_active'] = 'Active'; # XXX
|
||||
$PALANG['pOverview_alias_domain_active'] = 'Aktywny';
|
||||
$PALANG['pOverview_alias_edit'] = 'Alias';
|
||||
$PALANG['and_x_more'] = '[i %s wiecej...]';
|
||||
$PALANG['pOverview_mailbox_username'] = 'Email';
|
||||
@ -76,11 +77,11 @@ $PALANG['pOverview_mailbox_quota'] = 'Udział (MB)';
|
||||
$PALANG['pOverview_mailbox_modified'] = 'Ostatnio zmodyfikowany';
|
||||
$PALANG['pOverview_mailbox_active'] = 'Aktywny';
|
||||
$PALANG['pOverview_vacation_edit'] = 'Auto odpowiedź';
|
||||
$PALANG['pOverview_vacation_option'] = 'Ustaw auto odpowiedź';
|
||||
$PALANG['pOverview_vacation_option'] = 'Ustaw automatyczną odpowiedź';
|
||||
|
||||
$PALANG['pOverview_get_domain'] = 'Domena';
|
||||
$PALANG['pOverview_get_aliases'] = 'Aliasy';
|
||||
$PALANG['pOverview_get_alias_domains'] = 'Domain Aliases'; # XXX
|
||||
$PALANG['pOverview_get_alias_domains'] = 'Aliasy domenowe';
|
||||
$PALANG['pOverview_get_mailboxes'] = 'Konta';
|
||||
$PALANG['pOverview_get_quota'] = 'Udział (MB)';
|
||||
$PALANG['pOverview_get_modified'] = 'Ostatnio zmodyfikowany';
|
||||
@ -89,20 +90,20 @@ $PALANG['pDelete_delete_error'] = '<span class="error_msg">Nie można usunąć t
|
||||
$PALANG['pDelete_delete_success'] = '%s usunięty.';
|
||||
$PALANG['pDelete_postdelete_error'] = '<span class="error_msg">Nie można usunąć konta ';
|
||||
$PALANG['pDelete_domain_error'] = '<span class="error_msg">Ta domena nie należy do Ciebie ';
|
||||
$PALANG['pDelete_domain_alias_error'] = '<span class="error_msg">This domain is not yours '; # XXX
|
||||
$PALANG['pDelete_domain_alias_error'] = '<span class="error_msg">Ten alias domeny nie należy do Ciebie ';
|
||||
$PALANG['pDelete_alias_error'] = '<span class="error_msg">Nie można usunąć aliasu ';
|
||||
$PALANG['pCreate_alias_domain_welcome'] = 'Mirror addresses of one of your domains to another.'; # XXX
|
||||
$PALANG['pCreate_alias_domain_alias'] = 'Alias Domain'; # XXX
|
||||
$PALANG['pCreate_alias_domain_alias_text'] = 'The domain that mails come in for.'; # XXX
|
||||
$PALANG['pCreate_alias_domain_target'] = 'Target Domain'; # XXX
|
||||
$PALANG['pCreate_alias_domain_target_text'] = 'The domain where mails should go to.'; # XXX
|
||||
$PALANG['pCreate_alias_domain_active'] = 'Active'; # XXX
|
||||
$PALANG['pCreate_alias_domain_button'] = 'Add Alias Domain'; # XXX
|
||||
$PALANG['pCreate_alias_domain_error1'] = 'You are not allowed to create the chosen configuration.'; # XXX
|
||||
$PALANG['pCreate_alias_domain_error2'] = 'The chosen configuration is invalid, please choose a different one!'; # XXX
|
||||
$PALANG['pCreate_alias_domain_error3'] = 'Database insert failed.'; # XXX
|
||||
$PALANG['pCreate_alias_domain_error4'] = 'All domains are already aliased.'; # XXX
|
||||
$PALANG['pCreate_alias_domain_success'] = 'The domain alias has been added to the alias domain table!'; # XXX
|
||||
$PALANG['pCreate_alias_domain_welcome'] = 'Duplikuj adresy z jednej Twojej domeny do innej.';
|
||||
$PALANG['pCreate_alias_domain_alias'] = 'Domena aliasowana/źródłowa';
|
||||
$PALANG['pCreate_alias_domain_alias_text'] = 'Domena do której przychodzą maile.';
|
||||
$PALANG['pCreate_alias_domain_target'] = 'Domena docelowa';
|
||||
$PALANG['pCreate_alias_domain_target_text'] = 'Domena do której powinny przychodzić maile.';
|
||||
$PALANG['pCreate_alias_domain_active'] = 'Aktywny';
|
||||
$PALANG['pCreate_alias_domain_button'] = 'Dodaj alias domeny';
|
||||
$PALANG['pCreate_alias_domain_error1'] = 'Nie masz uprawnień do tworzenia takiej konfiguracji.';
|
||||
$PALANG['pCreate_alias_domain_error2'] = 'Wybrana konfiguracja jest nieprawidłowa, proszę wybrać inną!';
|
||||
$PALANG['pCreate_alias_domain_error3'] = 'Dodanie do bazy nie powiodło się.';
|
||||
$PALANG['pCreate_alias_domain_error4'] = 'Wszystkie domeny są już aliasowane.';
|
||||
$PALANG['pCreate_alias_domain_success'] = 'Alias domeny został dodany do tabeli aliasów domen!';
|
||||
|
||||
$PALANG['pCreate_alias_welcome'] = 'Utwórz nowy alias dla Twojej domeny.';
|
||||
$PALANG['pCreate_alias_address'] = 'Alias';
|
||||
@ -125,7 +126,7 @@ $PALANG['pEdit_alias_active'] = 'Aktywny';
|
||||
$PALANG['pEdit_alias_goto_text_error1'] = '<span class="error_msg">Nie podałeś adresu odbiorcy (pole "To")</span>';
|
||||
$PALANG['pEdit_alias_goto_text_error2'] = '<span class="error_msg">Wpisany adres email jest niepoprawny: ';
|
||||
$PALANG['pEdit_alias_domain_error'] = '<span class="error_msg">Ta domena nie należy do Ciebie: ';
|
||||
$PALANG['pEdit_alias_domain_result_error'] = '<span class="error_msg">Unable to modify the alias domain!</span>'; # XXX
|
||||
$PALANG['pEdit_alias_domain_result_error'] = '<span class="error_msg">Nie można zmodyfikować aliasu domeny!</span>';
|
||||
$PALANG['pEdit_alias_forward_and_store'] = 'Dostarczaj do mojej skrzynki.';
|
||||
$PALANG['pEdit_alias_forward_only'] = 'Prześlij jedynie na podane adresy.';
|
||||
$PALANG['pEdit_alias_button'] = 'Edytuj alias';
|
||||
@ -179,9 +180,9 @@ $PALANG['pPassword_button'] = 'Zmień hasło';
|
||||
$PALANG['pPassword_result_error'] = '<span class="error_msg">Nie można zmienić Twojego hasła!</span>';
|
||||
$PALANG['pPassword_result_success'] = 'Twoje hasło zostało zmienione!';
|
||||
|
||||
$PALANG['pEdit_vacation_set'] = 'Zmień / Ustaw wiadomość auto odpowiedzi';
|
||||
$PALANG['pEdit_vacation_remove'] = 'Usuń wiadomość auto odpowiedzi';
|
||||
$PALANG['pVacation_result_error'] = '<span class="error_msg">Nie można ustawić wiadomości auto odpowiedzi!</span>';
|
||||
$PALANG['pEdit_vacation_set'] = 'Zmień / Ustaw wiadomość automatycznej odpowiedzi';
|
||||
$PALANG['pEdit_vacation_remove'] = 'Usuń wiadomość automatycznej odpowiedzi';
|
||||
$PALANG['pVacation_result_error'] = '<span class="error_msg">Nie można ustawić wiadomości automatycznej odpowiedzi!</span>';
|
||||
$PALANG['pVacation_result_removed'] = 'Auto odpowiedź została usunięta!';
|
||||
$PALANG['pVacation_result_added'] = 'Auto odpowiedź została dodana!';
|
||||
|
||||
@ -191,17 +192,17 @@ $PALANG['pViewlog_username'] = 'Administrator';
|
||||
$PALANG['pViewlog_domain'] = 'Domena';
|
||||
$PALANG['pViewlog_action'] = 'Działanie';
|
||||
$PALANG['pViewlog_data'] = 'Dane';
|
||||
$PALANG['pViewlog_action_create_mailbox'] = 'utwórz konto';
|
||||
$PALANG['pViewlog_action_delete_mailbox'] = 'usuń konto';
|
||||
$PALANG['pViewlog_action_edit_mailbox'] = 'edytuj konto';
|
||||
$PALANG['pViewlog_action_edit_mailbox_state'] = 'edytuj aktywne konto';
|
||||
$PALANG['pViewlog_action_create_alias'] = 'utwórz alias';
|
||||
$PALANG['pViewlog_action_create_alias_domain'] = 'create alias domain'; # XXX
|
||||
$PALANG['pViewlog_action_delete_alias'] = 'usuń alias';
|
||||
$PALANG['pViewlog_action_delete_alias_domain'] = 'delete alias domain'; # XXX
|
||||
$PALANG['pViewlog_action_edit_alias'] = 'edytuj alias';
|
||||
$PALANG['pViewlog_action_edit_alias_state'] = 'edytuj aktywny alias';
|
||||
$PALANG['pViewlog_action_edit_alias_domain_state'] = 'edit alias domain active'; # XXX
|
||||
$PALANG['pViewlog_action_create_mailbox'] = 'utworzenie konta';
|
||||
$PALANG['pViewlog_action_delete_mailbox'] = 'usunięcie konta';
|
||||
$PALANG['pViewlog_action_edit_mailbox'] = 'edycja konta';
|
||||
$PALANG['pViewlog_action_edit_mailbox_state'] = 'edycja statusu konta';
|
||||
$PALANG['pViewlog_action_create_alias'] = 'utworzenie aliasu';
|
||||
$PALANG['pViewlog_action_create_alias_domain'] = 'utworzenie aliasu domeny';
|
||||
$PALANG['pViewlog_action_delete_alias'] = 'usunięcie aliasu';
|
||||
$PALANG['pViewlog_action_delete_alias_domain'] = 'usunięcie aliasu domeny';
|
||||
$PALANG['pViewlog_action_edit_alias'] = 'edycja aliasu';
|
||||
$PALANG['pViewlog_action_edit_alias_state'] = 'edycja statusu aliasu';
|
||||
$PALANG['pViewlog_action_edit_alias_domain_state'] = 'edycja statusu aliasu domeny';
|
||||
$PALANG['pViewlog_action_edit_password'] = 'zmień hasło';
|
||||
|
||||
$PALANG['pViewlog_button'] = 'Idź';
|
||||
@ -220,7 +221,7 @@ $PALANG['pSendmail_result_success'] = 'Email wysłany!';
|
||||
|
||||
$PALANG['pAdminMenu_list_admin'] = 'Lista administratorów';
|
||||
$PALANG['pAdminMenu_list_domain'] = 'Lista domen';
|
||||
$PALANG['pAdminMenu_list_virtual'] = 'Virtual list'; # XXX
|
||||
$PALANG['pAdminMenu_list_virtual'] = 'Lista zbiorcza';
|
||||
$PALANG['pAdminMenu_viewlog'] = 'Logi';
|
||||
$PALANG['pAdminMenu_backup'] = 'Kopia bezpieczeństwa';
|
||||
$PALANG['pAdminMenu_create_domain_admins'] = 'Administratorzy domeny';
|
||||
@ -278,7 +279,7 @@ $PALANG['pAdminCreate_domain_button'] = 'Dodaj domenę';
|
||||
$PALANG['pAdminCreate_domain_result_error'] = '<span class="error_msg">Nie można dodać domeny!</span>';
|
||||
$PALANG['pAdminCreate_domain_result_success'] = 'Domena została dodana!';
|
||||
$PALANG['pAdminDelete_domain_error'] = '<span class="error_msg">Nie można usunąć domeny!</span>';
|
||||
$PALANG['pAdminDelete_alias_domain_error'] = '<span class="error_msg">Unable to remove domain alias!</span>'; # XXX
|
||||
$PALANG['pAdminDelete_alias_domain_error'] = '<span class="error_msg">Nie można usunąć aliasu domeny!</span>';
|
||||
|
||||
$PALANG['pAdminEdit_domain_welcome'] = 'Edytuj domenę';
|
||||
$PALANG['pAdminEdit_domain_domain'] = 'Domena';
|
||||
@ -331,18 +332,18 @@ $PALANG['pUsersMenu_vacation'] = 'Auto odpowiedź';
|
||||
$PALANG['pUsersMenu_edit_alias'] = 'Zmień przekierowania';
|
||||
$PALANG['pUsersMenu_password'] = 'Zmień hasło';
|
||||
|
||||
$PALANG['pUsersMain_vacation'] = 'Ustaw "out of office" wiadomość lub auto odpowiedź.';
|
||||
$PALANG['pUsersMain_vacation'] = 'Ustaw automatyczną odpowiedź.';
|
||||
$PALANG['pUsersMain_vacationSet'] = $PALANG['pUsersMenu_vacation'] . ' jest WŁACZONA,
|
||||
kliknij \'' . $PALANG['pUsersMenu_vacation'] . '\' aby ' . 'edytować/usunąć';
|
||||
$PALANG['pUsersMain_edit_alias'] = 'Zmień przekierowania wiadomości.';
|
||||
$PALANG['pUsersMain_password'] = 'Zmień aktualne hasło.';
|
||||
|
||||
|
||||
$PALANG['pUsersVacation_welcome'] = 'Auto odpowiedź.';
|
||||
$PALANG['pUsersVacation_welcome_text'] = 'Masz już skonfigurowaną auto odpowiedź!';
|
||||
$PALANG['pUsersVacation_welcome'] = 'Automatyczną odpowiedź.';
|
||||
$PALANG['pUsersVacation_welcome_text'] = 'Masz już skonfigurowaną automatyczną odpowiedź!';
|
||||
$PALANG['pUsersVacation_subject'] = 'Temat';
|
||||
$PALANG['pUsersVacation_subject_text'] = 'Poza biurem';
|
||||
$PALANG['pUsersVacation_body'] = 'Tekst'; # XXX text changed to 'Message'
|
||||
$PALANG['pUsersVacation_body'] = 'Wiadomość';
|
||||
|
||||
$PALANG['pUsersVacation_body_text'] = <<<EOM
|
||||
Będę nieobecny od <date> do <date>.
|
||||
@ -350,8 +351,8 @@ W pilnych sprawach proszę się kontaktować z <contact person>.
|
||||
EOM;
|
||||
$PALANG['pUsersVacation_button_away'] = 'Nieobecny/a';
|
||||
$PALANG['pUsersVacation_button_back'] = 'Zaraz wracam';
|
||||
$PALANG['pUsersVacation_result_error'] = '<span class="error_msg">Nie mogę zaktualizować ustawień Twojej auto odpowiedzi!</span>';
|
||||
$PALANG['pUsersVacation_result_success'] = 'Twoja auto odpowiedź została usunięta!';
|
||||
$PALANG['pUsersVacation_result_error'] = '<span class="error_msg">Nie mogę zaktualizować ustawień Twojej automatycznej odpowiedzi!</span>';
|
||||
$PALANG['pUsersVacation_result_success'] = 'Twoja automatyczna odpowiedź została usunięta!';
|
||||
$PALANG['pUsersVacation_activefrom'] = 'Active from'; # XXX
|
||||
$PALANG['pUsersVacation_activeuntil'] = 'Active until'; # XXX
|
||||
|
||||
@ -379,10 +380,10 @@ $PALANG['pBroadcast_error_empty'] = 'Pola Nazwa, Temat i Wiadomość nie powinny
|
||||
$PALANG['pStatus_undeliverable'] = 'może być NIEDOSTARCZALNA ';
|
||||
$PALANG['pStatus_custom'] = 'Dostarczyć do ';
|
||||
$PALANG['pStatus_popimap'] = 'POP/IMAP ';
|
||||
$PALANG['pPasswordTooShort'] = "Hasło jest za krótkie - musi mieć minimum %s znaków";
|
||||
$PALANG['pInvalidDomainRegex'] = "Invalid domain name %s, fails regexp check"; # XXX
|
||||
$PALANG['pInvalidDomainDNS'] = "Invalid domain %s, and/or not discoverable in DNS"; # XXX
|
||||
$PALANG['pInvalidMailRegex'] = "Invalid email address, fails regexp check"; # XXX
|
||||
$PALANG['pPasswordTooShort'] = 'Hasło jest za krótkie - musi mieć minimum %s znaków';
|
||||
$PALANG['pInvalidDomainRegex'] = 'Nieprawidłowa nazwa domeny %s';
|
||||
$PALANG['pInvalidDomainDNS'] = 'Nieprawidłowa domena %s, nie wykrywana w DNS';
|
||||
$PALANG['pInvalidMailRegex'] = 'Nieprawidłowy adres email';
|
||||
$PALANG['pFetchmail_welcome'] = 'Pobierz pocztę dla:';
|
||||
$PALANG['pFetchmail_new_entry'] = 'Nowy wpis';
|
||||
$PALANG['pFetchmail_database_save_error'] = 'Wpis nie może być zapisany w bazie danych!';
|
||||
@ -403,7 +404,7 @@ $PALANG['pFetchmail_field_poll_time'] = 'Sprawdzaj';
|
||||
$PALANG['pFetchmail_field_fetchall'] = 'Pobierz wszystkie';
|
||||
$PALANG['pFetchmail_field_keep'] = 'Pozostaw';
|
||||
$PALANG['pFetchmail_field_protocol'] = 'Protokół';
|
||||
$PALANG['pFetchmail_field_usessl'] = 'SSL active'; # XXX
|
||||
$PALANG['pFetchmail_field_usessl'] = 'Aktywne SSL';
|
||||
$PALANG['pFetchmail_field_extra_options'] = 'Dodatkowe opcje';
|
||||
$PALANG['pFetchmail_field_mda'] = 'MDA';
|
||||
$PALANG['pFetchmail_field_date'] = 'Data';
|
||||
@ -419,7 +420,7 @@ $PALANG['pFetchmail_desc_poll_time'] = 'Pobierz co ... minut';
|
||||
$PALANG['pFetchmail_desc_fetchall'] = 'Pobierz zarówno stare (przeczytane) jak i nowe wiadomości';
|
||||
$PALANG['pFetchmail_desc_keep'] = 'Pozostaw wiadomości na serwerze';
|
||||
$PALANG['pFetchmail_desc_protocol'] = 'Protokół';
|
||||
$PALANG['pFetchmail_desc_usessl'] = 'SSL encryption'; # XXX
|
||||
$PALANG['pFetchmail_desc_usessl'] = 'szyfrowanie SSL';
|
||||
$PALANG['pFetchmail_desc_extra_options'] = 'Dodatkowe opcje dla fetchmail';
|
||||
$PALANG['pFetchmail_desc_mda'] = 'Mail Delivery Agent';
|
||||
$PALANG['pFetchmail_desc_date'] = 'Data ostatniego sprawdzenia/zmiany konfiguracji';
|
||||
|
@ -32,7 +32,7 @@ if (authentication_has_role('global-admin')) {
|
||||
//if (authentication_has_role('admin')) {
|
||||
$list_admins = list_admins ();
|
||||
$is_superadmin = 1;
|
||||
$fUsername = safepost('fUsername', safeget('username')); # prefer POST over GET variable
|
||||
$fUsername = escape_string(safepost('fUsername', safeget('username'))); # prefer POST over GET variable
|
||||
if ($fUsername != "") $admin_properties = get_admin_properties($fUsername);
|
||||
} else {
|
||||
$list_admins = array(authentication_get_username());
|
||||
@ -51,24 +51,28 @@ if (isset($admin_properties) && $admin_properties['domain_count'] == 'ALL') { #
|
||||
$list_domains = list_domains_for_admin(authentication_get_username());
|
||||
}
|
||||
|
||||
$table_domain = table_by_key('domain');
|
||||
$table_mailbox = table_by_key('mailbox');
|
||||
$table_alias = table_by_key('alias');
|
||||
|
||||
if ($list_all_domains == 1) {
|
||||
$where = " WHERE domain.domain != 'ALL' "; # TODO: the ALL dummy domain is annoying...
|
||||
$where = " WHERE $table_domain.domain != 'ALL' "; # TODO: the ALL dummy domain is annoying...
|
||||
} else {
|
||||
$list_domains = escape_string($list_domains);
|
||||
$where = " WHERE domain.domain IN ('" . join("','", $list_domains) . "') ";
|
||||
$where = " WHERE $table_domain.domain IN ('" . join("','", $list_domains) . "') ";
|
||||
}
|
||||
|
||||
# fetch domain data and number of mailboxes
|
||||
# (PgSQL requires the extensive GROUP BY statement, https://sourceforge.net/forum/message.php?msg_id=7386240)
|
||||
$query = "
|
||||
SELECT domain.* , COUNT( DISTINCT mailbox.username ) AS mailbox_count
|
||||
FROM domain
|
||||
LEFT JOIN mailbox ON domain.domain = mailbox.domain
|
||||
SELECT $table_domain.* , COUNT( DISTINCT $table_mailbox.username ) AS mailbox_count
|
||||
FROM $table_domain
|
||||
LEFT JOIN $table_mailbox ON $table_domain.domain = $table_mailbox.domain
|
||||
$where
|
||||
GROUP BY domain.domain, domain.description, domain.aliases, domain.mailboxes,
|
||||
domain.maxquota, domain.quota, domain.transport, domain.backupmx, domain.created,
|
||||
domain.modified, domain.active
|
||||
ORDER BY domain.domain
|
||||
GROUP BY $table_domain.domain, $table_domain.description, $table_domain.aliases, $table_domain.mailboxes,
|
||||
$table_domain.maxquota, $table_domain.quota, $table_domain.transport, $table_domain.backupmx, $table_domain.created,
|
||||
$table_domain.modified, $table_domain.active
|
||||
ORDER BY $table_domain.domain
|
||||
";
|
||||
$result = db_query($query);
|
||||
|
||||
@ -79,12 +83,12 @@ while ($row = db_array ($result['result'])) {
|
||||
# fetch number of aliases
|
||||
# doing this separate is much faster than doing it in one "big" query
|
||||
$query = "
|
||||
SELECT domain.domain, COUNT( DISTINCT alias.address ) AS alias_count
|
||||
FROM domain
|
||||
LEFT JOIN alias ON domain.domain = alias.domain
|
||||
SELECT $table_domain.domain, COUNT( DISTINCT $table_alias.address ) AS alias_count
|
||||
FROM $table_domain
|
||||
LEFT JOIN $table_alias ON $table_domain.domain = $table_alias.domain
|
||||
$where
|
||||
GROUP BY domain.domain
|
||||
ORDER BY domain.domain
|
||||
GROUP BY $table_domain.domain
|
||||
ORDER BY $table_domain.domain
|
||||
";
|
||||
|
||||
$result = db_query($query);
|
||||
|
@ -196,10 +196,10 @@ if ($result['rows'] > 0)
|
||||
# mailboxes
|
||||
#
|
||||
|
||||
$display_mailbox_aliases = boolconf('special_alias_control'); # TODO: is this condition correct? - I'm slightly confused with alias_control, alias_control_admin and special_alias_control
|
||||
$display_mailbox_aliases = boolconf('alias_control_admin');
|
||||
|
||||
# build the sql query
|
||||
$sql_select = " SELECT $table_mailbox.* ";
|
||||
$sql_select = "SELECT $table_mailbox.* ";
|
||||
$sql_from = " FROM $table_mailbox ";
|
||||
$sql_join = "";
|
||||
$sql_where = " WHERE ";
|
||||
@ -234,7 +234,7 @@ if (boolconf('used_quotas') && boolconf('new_quota_table')) {
|
||||
if (boolconf('used_quotas') && ( ! boolconf('new_quota_table') ) ) {
|
||||
$sql_select .= ", $table_quota.current ";
|
||||
$sql_join .= " LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username ";
|
||||
$sql_where .= " ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL ) ";
|
||||
$sql_where .= " AND ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL ) ";
|
||||
}
|
||||
|
||||
$query = "$sql_select\n$sql_from\n$sql_join\n$sql_where\n$sql_order\n$sql_limit";
|
||||
@ -435,7 +435,9 @@ $smarty->assign ('select_options', select_options ($list_domains, array ($fDomai
|
||||
$smarty->assign ('nav_bar_alias', array ('top' => $nav_bar_alias->display_top (), 'bottom' => $nav_bar_alias->display_bottom ()), false);
|
||||
$smarty->assign ('nav_bar_mailbox', array ('top' => $nav_bar_mailbox->display_top (), 'bottom' => $nav_bar_mailbox->display_bottom ()), false);
|
||||
|
||||
$smarty->assign ('fDomain', $fDomain);
|
||||
$smarty->assign ('fDomain', $fDomain, false);
|
||||
|
||||
$smarty->assign ('search', $search);
|
||||
|
||||
$smarty->assign ('list_domains', $list_domains);
|
||||
$smarty->assign ('limit', $limit);
|
||||
@ -454,11 +456,11 @@ if(is_array($tTargetDomain))
|
||||
$smarty->assign ('PALANG_pOverview_alias_domain_target', sprintf($PALANG['pOverview_alias_domain_target'], $fDomain));
|
||||
}
|
||||
$smarty->assign ('tAlias', $tAlias);
|
||||
$smarty->assign ('gen_show_status', $gen_show_status);
|
||||
$smarty->assign ('gen_show_status', $gen_show_status, false);
|
||||
$smarty->assign ('check_alias_owner', $check_alias_owner);
|
||||
$smarty->assign ('tCanAddAlias', $tCanAddAlias);
|
||||
$smarty->assign ('tMailbox', $tMailbox);
|
||||
$smarty->assign ('gen_show_status_mailbox', $gen_show_status_mailbox);
|
||||
$smarty->assign ('gen_show_status_mailbox', $gen_show_status_mailbox, false);
|
||||
$smarty->assign ('boolconf_used_quotas', boolconf('used_quotas'));
|
||||
$smarty->assign ('divide_quota', $divide_quota);
|
||||
$smarty->assign ('tCanAddMailbox', $tCanAddMailbox);
|
||||
|
@ -19,7 +19,6 @@
|
||||
* Template Variables:
|
||||
*
|
||||
* tMessage
|
||||
* tUsername
|
||||
*
|
||||
* Form POST \ GET Variables:
|
||||
*
|
||||
@ -67,7 +66,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
{
|
||||
$error = 1;
|
||||
$tMessage = '<span class="error_msg">' . $PALANG['pLogin_failed'] . '</span>';
|
||||
$tUsername = $fUsername;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -96,7 +94,6 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$smarty->assign ('tUsername', $tUsername);
|
||||
$smarty->assign ('tMessage', $tMessage, false);
|
||||
|
||||
$smarty->assign ('smarty_template', 'login');
|
||||
|
@ -106,7 +106,7 @@ class VacationHandler {
|
||||
else {
|
||||
$tmp = preg_split ('/@/', $username);
|
||||
$domain = escape_string($tmp[1]);
|
||||
$result = db_query ("INSERT INTO $table_vacation (email,subject,body,domain,created,active,activefrom, activeuntil) VALUES ('$username','$subject','$body','$domain',NOW(),'$active','$activeFrom','$ativeUntil')");
|
||||
$result = db_query ("INSERT INTO $table_vacation (email,subject,body,domain,created,active,activefrom, activeuntil) VALUES ('$username','$subject','$body','$domain',NOW(),'$active','$activeFrom','$activeUntil')");
|
||||
}
|
||||
|
||||
$ah = new AliasHandler($this->username);
|
||||
|
389
scripts/common.php
Normal file
389
scripts/common.php
Normal file
@ -0,0 +1,389 @@
|
||||
<?php
|
||||
/**
|
||||
* Postfix Admin
|
||||
*
|
||||
* LICENSE
|
||||
* This source file is subject to the GPL license that is bundled with
|
||||
* this package in the file LICENSE.TXT.
|
||||
*
|
||||
* Further details on the project are available at :
|
||||
* http://www.postfixadmin.com or http://postfixadmin.sf.net
|
||||
*
|
||||
* @version $Id: common.php 733 2009-10-20 19:25:20Z christian_boltz $
|
||||
* @license GNU GPL v2 or later.
|
||||
*
|
||||
* File: common.php
|
||||
* All pages should include this file - which itself sets up the necessary
|
||||
* environment and ensures other functions are loaded.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$incpath = PATH;
|
||||
(ini_get('magic_quotes_gpc') ? ini_set('magic_quotes_runtime', '0') : '1');
|
||||
(ini_get('magic_quotes_gpc') ? ini_set('magic_quotes_sybase', '0') : '1');
|
||||
|
||||
if(ini_get('register_globals') == 'on') {
|
||||
die("Please turn off register_globals; edit your php.ini");
|
||||
}
|
||||
require_once("$incpath/variables.inc.php");
|
||||
/*
|
||||
if(!is_file("$incpath/config.inc.php")) {
|
||||
die("config.inc.php is missing!");
|
||||
}
|
||||
require_once("$incpath/config.inc.php");
|
||||
*/
|
||||
if(isset($CONF['configured'])) {
|
||||
if($CONF['configured'] == FALSE) {
|
||||
die("Please edit config.inc.php - change \$CONF['configured'] to true after setting your database settings");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
require_once("$incpath/languages/language.php");
|
||||
require_once("$incpath/functions.inc.php");
|
||||
require_once("$incpath/languages/en.lang");
|
||||
*/
|
||||
/**
|
||||
* @param string $class
|
||||
* __autoload implementation, for use with spl_autoload_register().
|
||||
*/
|
||||
function postfixadmin_autoload2($class) {
|
||||
$PATH = CORE_INCLUDE_PATH.'/models-ext/' . $class . '.php';
|
||||
|
||||
if(is_file($PATH)) {
|
||||
require_once($PATH);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
spl_autoload_register('postfixadmin_autoload2');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Convenience method for strtolower().
|
||||
*
|
||||
* @param string $str String to lowercase
|
||||
* @return string Lowercased string
|
||||
*/
|
||||
function low($str) {
|
||||
return strtolower($str);
|
||||
}
|
||||
/**
|
||||
* Convenience method for strtoupper().
|
||||
*
|
||||
* @param string $str String to uppercase
|
||||
* @return string Uppercased string
|
||||
*/
|
||||
function up($str) {
|
||||
return strtoupper($str);
|
||||
}
|
||||
/**
|
||||
* Convenience method for str_replace().
|
||||
*
|
||||
* @param string $search String to be replaced
|
||||
* @param string $replace String to insert
|
||||
* @param string $subject String to search
|
||||
* @return string Replaced string
|
||||
*/
|
||||
function r($search, $replace, $subject) {
|
||||
return str_replace($search, $replace, $subject);
|
||||
}
|
||||
/**
|
||||
* Print_r convenience function, which prints out <PRE> tags around
|
||||
* the output of given array. Similar to debug().
|
||||
*
|
||||
* @see debug()
|
||||
* @param array $var Variable to print out
|
||||
* @param boolean $showFrom If set to true, the method prints from where the function was called
|
||||
*/
|
||||
function pr($var) {
|
||||
if (Configure::read() > 0) {
|
||||
echo "<pre>";
|
||||
print_r($var);
|
||||
echo "</pre>";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class Config {
|
||||
/**
|
||||
* Determine if $__objects cache should be wrote
|
||||
*
|
||||
* @var boolean
|
||||
* @access private
|
||||
*/
|
||||
var $__cache = false;
|
||||
/**
|
||||
* Holds and key => value array of objects type
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $__objects = array();
|
||||
|
||||
/**
|
||||
* Return a singleton instance of Configure.
|
||||
*
|
||||
* @return Configure instance
|
||||
* @access public
|
||||
*/
|
||||
|
||||
function &getInstance() {
|
||||
static $instance = array();
|
||||
if (!$instance) {
|
||||
$instance[0] =& new Config();
|
||||
//$instance[0]->__loadBootstrap($boot);
|
||||
}
|
||||
return $instance[0];
|
||||
}
|
||||
/**
|
||||
* Used to write a dynamic var in the Configure instance.
|
||||
*
|
||||
* Usage
|
||||
* Configure::write('One.key1', 'value of the Configure::One[key1]');
|
||||
* Configure::write(array('One.key1' => 'value of the Configure::One[key1]'));
|
||||
* Configure::write('One', array('key1'=>'value of the Configure::One[key1]', 'key2'=>'value of the Configure::One[key2]');
|
||||
* Configure::write(array('One.key1' => 'value of the Configure::One[key1]', 'One.key2' => 'value of the Configure::One[key2]'));
|
||||
*
|
||||
* @param array $config Name of var to write
|
||||
* @param mixed $value Value to set for var
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function write($config, $value = null) {
|
||||
$_this =& Config::getInstance();
|
||||
|
||||
if (!is_array($config)) {
|
||||
$config = array($config => $value);
|
||||
}
|
||||
|
||||
foreach ($config as $names => $value) {
|
||||
$name = $_this->__configVarNames($names);
|
||||
|
||||
switch (count($name)) {
|
||||
case 3:
|
||||
$_this->{$name[0]}[$name[1]][$name[2]] = $value;
|
||||
break;
|
||||
case 2:
|
||||
$_this->{$name[0]}[$name[1]] = $value;
|
||||
break;
|
||||
case 1:
|
||||
$_this->{$name[0]} = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to read Configure::$var
|
||||
*
|
||||
* Usage
|
||||
* Configure::read('Name'); will return all values for Name
|
||||
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
|
||||
*
|
||||
* @param string $var Variable to obtain
|
||||
* @return string value of Configure::$var
|
||||
* @access public
|
||||
*/
|
||||
function read($var) {
|
||||
$_this =& Config::getInstance();
|
||||
|
||||
if ($var === 'all') {
|
||||
$return = array();
|
||||
foreach ($_this AS $key =>$var) {
|
||||
$return[$key] = $var;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
$name = $_this->__configVarNames($var);
|
||||
|
||||
switch (count($name)) {
|
||||
case 3:
|
||||
if (isset($_this->{$name[0]}[$name[1]][$name[2]])) {
|
||||
return $_this->{$name[0]}[$name[1]][$name[2]];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (isset($_this->{$name[0]}[$name[1]])) {
|
||||
return $_this->{$name[0]}[$name[1]];
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (isset($_this->{$name[0]})) {
|
||||
return $_this->{$name[0]};
|
||||
}
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function getAll() {
|
||||
$output = $this->config;
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* Checks $name for dot notation to create dynamic Configure::$var as an array when needed.
|
||||
*
|
||||
* @param mixed $name Name to split
|
||||
* @return array Name separated in items through dot notation
|
||||
* @access private
|
||||
*/
|
||||
function __configVarNames($name) {
|
||||
if (is_string($name)) {
|
||||
if (strpos($name, ".")) {
|
||||
return explode(".", $name);
|
||||
}
|
||||
return array($name);
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class Lang {
|
||||
/**
|
||||
* Determine if $__objects cache should be wrote
|
||||
*
|
||||
* @var boolean
|
||||
* @access private
|
||||
*/
|
||||
var $__cache = false;
|
||||
/**
|
||||
* Holds and key => value array of objects type
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
*/
|
||||
var $__objects = array();
|
||||
|
||||
/**
|
||||
* Return a singleton instance of Configure.
|
||||
*
|
||||
* @return Configure instance
|
||||
* @access public
|
||||
*/
|
||||
|
||||
function &getInstance() {
|
||||
static $instance = array();
|
||||
if (!$instance) {
|
||||
$instance[0] =& new Config();
|
||||
//$instance[0]->__loadBootstrap($boot);
|
||||
}
|
||||
return $instance[0];
|
||||
}
|
||||
/**
|
||||
* Used to write a dynamic var in the Configure instance.
|
||||
*
|
||||
* Usage
|
||||
* Configure::write('One.key1', 'value of the Configure::One[key1]');
|
||||
* Configure::write(array('One.key1' => 'value of the Configure::One[key1]'));
|
||||
* Configure::write('One', array('key1'=>'value of the Configure::One[key1]', 'key2'=>'value of the Configure::One[key2]');
|
||||
* Configure::write(array('One.key1' => 'value of the Configure::One[key1]', 'One.key2' => 'value of the Configure::One[key2]'));
|
||||
*
|
||||
* @param array $config Name of var to write
|
||||
* @param mixed $value Value to set for var
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function write($config, $value = null) {
|
||||
$_this =& Config::getInstance();
|
||||
|
||||
if (!is_array($config)) {
|
||||
$config = array($config => $value);
|
||||
}
|
||||
|
||||
foreach ($config as $names => $value) {
|
||||
$name = $_this->__configVarNames($names);
|
||||
|
||||
switch (count($name)) {
|
||||
case 3:
|
||||
$_this->{$name[0]}[$name[1]][$name[2]] = $value;
|
||||
break;
|
||||
case 2:
|
||||
$_this->{$name[0]}[$name[1]] = $value;
|
||||
break;
|
||||
case 1:
|
||||
$_this->{$name[0]} = $value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to read Configure::$var
|
||||
*
|
||||
* Usage
|
||||
* Configure::read('Name'); will return all values for Name
|
||||
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
|
||||
*
|
||||
* @param string $var Variable to obtain
|
||||
* @return string value of Configure::$var
|
||||
* @access public
|
||||
*/
|
||||
function read($var) {
|
||||
$_this =& Config::getInstance();
|
||||
|
||||
if ($var === 'all') {
|
||||
$return = array();
|
||||
foreach ($_this AS $key =>$var) {
|
||||
$return[$key] = $var;
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
$name = $_this->__configVarNames($var);
|
||||
|
||||
switch (count($name)) {
|
||||
case 3:
|
||||
if (isset($_this->{$name[0]}[$name[1]][$name[2]])) {
|
||||
return $_this->{$name[0]}[$name[1]][$name[2]];
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (isset($_this->{$name[0]}[$name[1]])) {
|
||||
return $_this->{$name[0]}[$name[1]];
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (isset($_this->{$name[0]})) {
|
||||
return $_this->{$name[0]};
|
||||
}
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
function getAll() {
|
||||
$output = $this->config;
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* Checks $name for dot notation to create dynamic Configure::$var as an array when needed.
|
||||
*
|
||||
* @param mixed $name Name to split
|
||||
* @return array Name separated in items through dot notation
|
||||
* @access private
|
||||
*/
|
||||
function __configVarNames($name) {
|
||||
if (is_string($name)) {
|
||||
if (strpos($name, ".")) {
|
||||
return explode(".", $name);
|
||||
}
|
||||
return array($name);
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
151
scripts/inflector.php
Normal file
151
scripts/inflector.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/**
|
||||
* -.
|
||||
*
|
||||
* Used by Cake's naming conventions throughout the framework.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
* Modified for Postfixadmin by Valkum
|
||||
*
|
||||
* Copyright 2010
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||
* @link http://postfixadmin.sourceforge.net/ Postfixadmin on Sourceforge
|
||||
* @package postfixadmin
|
||||
* @subpackage -
|
||||
* @since -
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
class Inflector {
|
||||
/**
|
||||
* Returns given $lower_case_and_underscored_word as a CamelCased word.
|
||||
*
|
||||
* @param string $lower_case_and_underscored_word Word to camelize
|
||||
* @return string Camelized word. LikeThis.
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function camelize($lowerCaseAndUnderscoredWord) {
|
||||
$replace = str_replace(" ", "", ucwords(str_replace("_", " ", $lowerCaseAndUnderscoredWord)));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns an underscore-syntaxed ($like_this_dear_reader) version of the $camel_cased_word.
|
||||
*
|
||||
* @param string $camel_cased_word Camel-cased word to be "underscorized"
|
||||
* @return string Underscore-syntaxed version of the $camel_cased_word
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function underscore($camelCasedWord) {
|
||||
$replace = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns a human-readable string from $lower_case_and_underscored_word,
|
||||
* by replacing underscores with a space, and by upper-casing the initial characters.
|
||||
*
|
||||
* @param string $lower_case_and_underscored_word String to be made more readable
|
||||
* @return string Human-readable string
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function humanize($lowerCaseAndUnderscoredWord) {
|
||||
$replace = ucwords(str_replace("_", " ", $lowerCaseAndUnderscoredWord));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns corresponding table name for given $class_name. ("posts" for the model class "Post").
|
||||
*
|
||||
* @param string $class_name Name of class to get database table name for
|
||||
* @return string Name of the database table for given class
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function tableize($className) {
|
||||
$replace = Inflector::pluralize(Inflector::underscore($className));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns Cake model class name ("Post" for the database table "posts".) for given database table.
|
||||
*
|
||||
* @param string $tableName Name of database table to get class name for
|
||||
* @return string Class name
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function classify($tableName) {
|
||||
$replace = Inflector::camelize(Inflector::singularize($tableName));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns camelBacked version of a string.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string in variable form
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function variable($string) {
|
||||
$string = Inflector::camelize(Inflector::underscore($string));
|
||||
$replace = strtolower(substr($string, 0, 1));
|
||||
$variable = preg_replace('/\\w/', $replace, $string, 1);
|
||||
return $variable;
|
||||
}
|
||||
/**
|
||||
* Returns a string with all spaces converted to $replacement and non word characters removed.
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $replacement
|
||||
* @return string
|
||||
* @access public
|
||||
* @static
|
||||
*/
|
||||
function slug($string, $replacement = '_') {
|
||||
if (!class_exists('String')) {
|
||||
require LIBS . 'string.php';
|
||||
}
|
||||
$map = array(
|
||||
'/à|á|å|â/' => 'a',
|
||||
'/è|é|ê|ẽ|ë/' => 'e',
|
||||
'/ì|í|î/' => 'i',
|
||||
'/ò|ó|ô|ø/' => 'o',
|
||||
'/ù|ú|ů|û/' => 'u',
|
||||
'/ç/' => 'c',
|
||||
'/ñ/' => 'n',
|
||||
'/ä|æ/' => 'ae',
|
||||
'/ö/' => 'oe',
|
||||
'/ü/' => 'ue',
|
||||
'/Ä/' => 'Ae',
|
||||
'/Ü/' => 'Ue',
|
||||
'/Ö/' => 'Oe',
|
||||
'/ß/' => 'ss',
|
||||
'/[^\w\s]/' => ' ',
|
||||
'/\\s+/' => $replacement,
|
||||
String::insert('/^[:replacement]+|[:replacement]+$/', array('replacement' => preg_quote($replacement, '/'))) => '',
|
||||
);
|
||||
$string = preg_replace(array_keys($map), array_values($map), $string);
|
||||
return $string;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Enclose a string for preg matching.
|
||||
*
|
||||
* @param string $string String to enclose
|
||||
* @return string Enclosed string
|
||||
*/
|
||||
function __enclose($string) {
|
||||
return '(?:' . $string . ')';
|
||||
}
|
190
scripts/models-ext/AliasHandler.php
Normal file
190
scripts/models-ext/AliasHandler.php
Normal file
@ -0,0 +1,190 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Handlers User level alias actions - e.g. add alias, get aliases, update etc.
|
||||
*/
|
||||
class AliasHandler {
|
||||
|
||||
private $username = null;
|
||||
|
||||
/**
|
||||
* @param string $username
|
||||
*/
|
||||
public function __construct($username) {
|
||||
$this->username = $username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array - list of email addresses the user's mail is forwarded to.
|
||||
* (may be an empty list, especially if $CONF['alias_control'] is turned off...
|
||||
* @param boolean - by default we don't return special addresses (e.g. vacation and mailbox alias); pass in true here if you wish to.
|
||||
*/
|
||||
public function get($alias, $all=false) {
|
||||
$alias = escape_string($alias);
|
||||
$table_alias = table_by_key('alias');
|
||||
|
||||
$sql = "SELECT * FROM $table_alias WHERE address='$alias'";
|
||||
$result = db_query($sql);
|
||||
if($result['rows'] == 1) {
|
||||
$row = db_array ($result['result']);
|
||||
// At the moment Postfixadmin stores aliases in it's database in a comma seperated list; this may change one day.
|
||||
$list = explode(',', $row['goto']);
|
||||
if($all) {
|
||||
return $list;
|
||||
}
|
||||
|
||||
$new_list = array();
|
||||
/* if !$all, remove vacation & mailbox aliases */
|
||||
foreach($list as $address) {
|
||||
if($address != '' ) {
|
||||
if($this->is_vacation_address($address) || $this->is_mailbox_alias($address)) {
|
||||
}
|
||||
else {
|
||||
$new_list[] = $address;
|
||||
}
|
||||
}
|
||||
}
|
||||
$list = $new_list;
|
||||
$this->return = $list;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $address
|
||||
* @param string $username
|
||||
* @return boolean true if the username is an alias for the mailbox AND we have alias_control turned off.
|
||||
*/
|
||||
public function is_mailbox_alias($address) {
|
||||
global $CONF;
|
||||
$username = $this->username;
|
||||
if($address == $username) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $address
|
||||
* @return boolean true if the address contains the vacation domain
|
||||
*/
|
||||
public function is_vacation_address($address) {
|
||||
global $CONF;
|
||||
if($CONF['vacation'] == 'YES') {
|
||||
if(stripos($address, '@' . $CONF['vacation_domain'])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* @return boolean true on success
|
||||
* @param string $username
|
||||
* @param array $addresses - list of aliases to set for the user.
|
||||
* @param string flags - forward_and_store or remote_only or ''
|
||||
* @param boolean $vacation_persist - set to false to stop the vacation address persisting across updates
|
||||
* Set the user's aliases to those provided. If $addresses ends up being empty the alias record is removed.
|
||||
*/
|
||||
public function update($addresses, $flags = '', $vacation_persist=true) {
|
||||
// find out if the user is on vacation or not; if they are,
|
||||
// then the vacation alias needs adding to the db (as we strip it out in the get method)
|
||||
// likewise with the alias_control address.
|
||||
|
||||
$valid_flags = array('', 'forward_and_store', 'remote_only');
|
||||
if(!in_array($flags, $valid_flags)) {
|
||||
die("Invalid flag passed into update()... : $flag - valid options are :" . implode(',', $valid_flags));
|
||||
}
|
||||
$addresses = array_unique($addresses);
|
||||
|
||||
$original = $this->get(true);
|
||||
$tmp = preg_split('/@/', $this->username);
|
||||
$domain = $tmp[1];
|
||||
|
||||
foreach($original as $address) {
|
||||
if($vacation_persist) {
|
||||
if($this->is_vacation_address($address)) {
|
||||
$addresses[] = $address;
|
||||
}
|
||||
}
|
||||
if($flags != 'remote_only') {
|
||||
if($this->is_mailbox_alias($address)) {
|
||||
$addresses[] = $address;
|
||||
}
|
||||
}
|
||||
}
|
||||
$addresses = array_unique($addresses);
|
||||
|
||||
$new_list = array();
|
||||
if($flags == 'remote_only') {
|
||||
foreach($addresses as $address) {
|
||||
// strip out our username... if it's in the list given.
|
||||
if($address != $this->username) {
|
||||
$new_list[] = $address;
|
||||
}
|
||||
}
|
||||
$addresses = $new_list;
|
||||
}
|
||||
|
||||
if($flags == 'forward_and_store') {
|
||||
if(!in_array($this->username, $addresses)) {
|
||||
$addresses[] = $this->username;
|
||||
}
|
||||
}
|
||||
$new_list = array();
|
||||
foreach($addresses as $address) {
|
||||
if($address != '') {
|
||||
$new_list[] = $address;
|
||||
}
|
||||
}
|
||||
$addresses = array_unique($new_list);
|
||||
$username = escape_string($this->username);
|
||||
$goto = escape_string(implode(',', $addresses));
|
||||
$table_alias = table_by_key('alias');
|
||||
if(sizeof($addresses) == 0) {
|
||||
$sql = "DELETE FROM $table_alias WHERE address = '$username'";
|
||||
}
|
||||
if($this->hasAliasRecord() == false) {
|
||||
$true = db_get_boolean(True);
|
||||
$sql = "INSERT INTO $table_alias (address, goto, domain, created, modified, active) VALUES ('$username', '$goto', '$domain', NOW(), NOW(), '$true')";
|
||||
}
|
||||
else {
|
||||
$sql = "UPDATE $table_alias SET goto = '$goto', modified = NOW() WHERE address = '$username'";
|
||||
}
|
||||
$result = db_query($sql);
|
||||
if($result['rows'] != 1) {
|
||||
return false;
|
||||
}
|
||||
db_log($username, $domain, 'edit_alias', "$username -> $goto");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a local delivery address is present. This is
|
||||
* stores as an alias with the same name as the mailbox name (username)
|
||||
* @return boolean true if local delivery is enabled
|
||||
*/
|
||||
public function hasStoreAndForward() {
|
||||
$aliases = $this->get(true);
|
||||
if(in_array($this->username, $aliases)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean true if the user has an alias record (i.e row in alias table); else false.
|
||||
*/
|
||||
public function hasAliasRecord() {
|
||||
$username = escape_string($this->username);
|
||||
$table_alias = table_by_key('alias');
|
||||
$sql = "SELECT * FROM $table_alias WHERE address = '$username'";
|
||||
$result = db_query($sql);
|
||||
if($result['rows'] == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
94
scripts/models-ext/DomainHandler.php
Normal file
94
scripts/models-ext/DomainHandler.php
Normal file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Handlers User level alias actions - e.g. add alias, get aliases, update etc.
|
||||
*/
|
||||
class DomainHandler {
|
||||
|
||||
private $username = null;
|
||||
|
||||
|
||||
public $errormsg = array();
|
||||
/**
|
||||
* @param string $username
|
||||
*/
|
||||
public function __construct($username) {
|
||||
$this->username = $username;
|
||||
}
|
||||
|
||||
public function getTransports() {
|
||||
return Config::read('transport_options');
|
||||
}
|
||||
|
||||
public function getTransport($id) {
|
||||
$transports = Config::read('transport_options');
|
||||
return $transports[$id-1];
|
||||
}
|
||||
|
||||
public function add($domain, $desc, $a, $m, $t, $q, $default, $backup){
|
||||
|
||||
$table_domain = table_by_key('domain');
|
||||
$table_alias = table_by_key('alias');
|
||||
|
||||
|
||||
($backup == true) ? $backup = db_get_boolean(true) : $backup = db_get_boolean(false);
|
||||
|
||||
$arr = array(
|
||||
'domain' => $domain,
|
||||
'description' => $desc,
|
||||
'aliases' => $a,
|
||||
'mailboxes' => $m,
|
||||
'maxquota' => $q,
|
||||
'transport' => $this->getTransport($t),
|
||||
'backupmx' => $backup,
|
||||
);
|
||||
|
||||
$result = db_insert($table_domain, $arr, array('created', 'modified') );
|
||||
if ($result != 1)
|
||||
{
|
||||
$this->errormsg[] = Lang::read('pAdminCreate_domain_result_error') . "\n($domain)\n";
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($default)
|
||||
{
|
||||
foreach (Config::read('default_aliases') as $address=>$goto)
|
||||
{
|
||||
$address = $address . "@" . $domain;
|
||||
$arr = array(
|
||||
'address' => $address,
|
||||
'goto' => $goto,
|
||||
'domain' => $domain,
|
||||
);
|
||||
$result = db_insert ($table_alias, $arr, array('created', 'modified') );
|
||||
}
|
||||
}
|
||||
$tMessage = Lang::read('pAdminCreate_domain_result_success') . "<br />($domain)</br />";
|
||||
}
|
||||
if (!domain_postcreation($domain))
|
||||
{
|
||||
$tMessage = Lang::read('pAdminCreate_domain_error');
|
||||
}
|
||||
db_log($this->username, $domain, 'create_domain', "");
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function view ($domain) {
|
||||
global $config;
|
||||
|
||||
|
||||
|
||||
$table_domain = table_by_key('domain');
|
||||
|
||||
$result = db_query("SELECT domain, description, aliases, mailboxes, maxquota, quota, transport, backupmx, DATE_FORMAT(created, '%d.%m.%y') AS created, DATE_FORMAT(modified, '%d.%m.%y') AS modified, active FROM $table_domain WHERE domain='$domain'");
|
||||
if ($result['rows'] != 0) {
|
||||
$this->return = db_array($result['result']);
|
||||
return 0;
|
||||
}
|
||||
$this->errormsg = $result['error'];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
308
scripts/models-ext/UserHandler.php
Normal file
308
scripts/models-ext/UserHandler.php
Normal file
@ -0,0 +1,308 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Simple class to represent a user.
|
||||
*/
|
||||
class UserHandler {
|
||||
|
||||
protected $username = null;
|
||||
|
||||
public $errormsg = array();
|
||||
|
||||
public function __construct($username) {
|
||||
$this->username = strtolower($username);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean true on success; false on failure
|
||||
* @param string $username
|
||||
* @param string $old_password
|
||||
* @param string $new_passwords
|
||||
*
|
||||
* All passwords need to be plain text; they'll be hashed appropriately
|
||||
* as per the configuration in config.inc.php
|
||||
*/
|
||||
public function change_pw($new_password, $old_password, $match = true) {
|
||||
global $config;
|
||||
$username = $this->username;
|
||||
$tmp = preg_split ('/@/', $username);
|
||||
$domain = $tmp[1];
|
||||
|
||||
$username = escape_string($username);
|
||||
$table_mailbox = table_by_key('mailbox');
|
||||
|
||||
$new_db_password = escape_string(pacrypt($new_password));
|
||||
|
||||
if ($match == true) {
|
||||
$active = db_get_boolean(True);
|
||||
$result = db_query("SELECT * FROM $table_mailbox WHERE username='$username' AND active='$active'");
|
||||
$result = $result['result'];
|
||||
if ($new_db_password != $result['password']) {
|
||||
$this->errormsg[] = 'Passwords do not Match';
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
$set = array(
|
||||
'password' => $new_db_password
|
||||
);
|
||||
|
||||
$result = db_update('mailbox', 'username=\''.$username.'\'', $set, array('modified') );
|
||||
|
||||
db_log ('CONSOLE', $domain, 'edit_password', "$username");
|
||||
if ($result != 1) {
|
||||
$this->errormsg[] = Lang::read('pEdit_mailbox_result_error');
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to log a user in.
|
||||
* @param string $username
|
||||
* @param string $password
|
||||
* @return boolean true on successful login (i.e. password matches etc)
|
||||
*/
|
||||
public static function login($username, $password) {
|
||||
global $config;
|
||||
$username = escape_string($username);
|
||||
|
||||
$table_mailbox = table_by_key('mailbox');
|
||||
$active = db_get_boolean(True);
|
||||
$query = "SELECT password FROM $table_mailbox WHERE username='$username' AND active='$active'";
|
||||
|
||||
$result = db_query ($query);
|
||||
if ($result['rows'] == 1)
|
||||
{
|
||||
$row = db_array ($result['result']);
|
||||
$crypt_password = pacrypt ($password, $row['password']);
|
||||
|
||||
if($row['password'] == $crypt_password) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Add mailbox
|
||||
* @param password string password of account
|
||||
* @param gen boolean
|
||||
* @param name string
|
||||
*
|
||||
*/
|
||||
public function add($password, $name = '', $quota = 0, $active = true, $mail = true ) {
|
||||
global $config;
|
||||
$username = $this->username;
|
||||
$tmp = preg_split ('/@/', $username);
|
||||
$domain = $tmp[1];
|
||||
$address = escape_string($username);
|
||||
$username = $tmp[0];
|
||||
|
||||
$table_mailbox = table_by_key('mailbox');
|
||||
$table_alias = table_by_key('alias');
|
||||
|
||||
$active = db_get_boolean($active);
|
||||
|
||||
if(!check_mailbox ($domain)) {
|
||||
$this->errormsg[] = Lang::read('pCreate_mailbox_username_text_error3');
|
||||
return 1;
|
||||
}
|
||||
$result = db_query ("SELECT * FROM $table_alias WHERE address='$address'");
|
||||
if ($result['rows'] == 1){
|
||||
$this->errormsg[] = Lang::read('pCreate_mailbox_username_text_error2');
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
$plain = $password;
|
||||
$password = pacrypt ($password);
|
||||
|
||||
if ( preg_match("/^dovecot:/", Config::read('encrypt')) ) {
|
||||
$split_method = preg_split ('/:/', Config::read('encrypt'));
|
||||
$method = strtoupper($split_method[1]);
|
||||
$password = '{' . $method . '}' . $password;
|
||||
}
|
||||
|
||||
if (Config::read('domain_path') == "YES")
|
||||
{
|
||||
if (Config::read('domain_in_mailbox') == "YES")
|
||||
{
|
||||
$maildir = $domain . "/" . $address . "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
$maildir = $domain . "/" . $username . "/";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$maildir = $address . "/";
|
||||
}
|
||||
|
||||
$quota = multiply_quota ($quota);
|
||||
|
||||
|
||||
if ('pgsql'== Config::read('database_type'))
|
||||
{
|
||||
db_query('BEGIN');
|
||||
}
|
||||
|
||||
//$result = db_query ("INSERT INTO $table_alias (address,goto,domain,created,modified,active) VALUES ('$address','$address','$domain',NOW(),NOW(),'$active')");
|
||||
$arr = array(
|
||||
'address' => $address,
|
||||
'goto' => $address,
|
||||
'domain' => $domain,
|
||||
'active' => $active,
|
||||
);
|
||||
|
||||
$result = db_insert($table_alias, $arr, array('created', 'modified') );
|
||||
if ($result != 1)
|
||||
{
|
||||
$this->errormsg[] = Lang::read('pAlias_result_error') . "\n($address -> $address)\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// apparently uppercase usernames really confuse some IMAP clients.
|
||||
$local_part = '';
|
||||
if(preg_match('/^(.*)@/', $address, $matches)) {
|
||||
$local_part = $matches[1];
|
||||
}
|
||||
|
||||
//$result = db_query ("INSERT INTO $table_mailbox (username,password,name,maildir,local_part,quota,domain,created,modified,active) VALUES ('$username','$password','$name','$maildir','$local_part','$quota','$domain',NOW(),NOW(),'$active')");
|
||||
|
||||
|
||||
$arr2 = array(
|
||||
'username' => $address,
|
||||
'password' => $password,
|
||||
'name' => $name,
|
||||
'maildir' => $maildir,
|
||||
'local_part' => $local_part,
|
||||
'quota' => $quota,
|
||||
'domain' => $domain,
|
||||
'active' => $active,
|
||||
);
|
||||
$result = db_insert($table_mailbox, $arr2, array('created', 'modified') );
|
||||
if ($result != 1 || !mailbox_postcreation($address,$domain,$maildir, $quota))
|
||||
{
|
||||
$this->errormsg[] = Lang::read('pCreate_mailbox_result_error') . "\n($address)\n";
|
||||
db_query('ROLLBACK');
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
db_query('COMMIT');
|
||||
db_log ('CONSOLE', $domain, 'create_mailbox', "$address");
|
||||
|
||||
|
||||
if ($mail == true)
|
||||
{
|
||||
$fTo = $address;
|
||||
$fFrom = Config::read('admin_email');
|
||||
$fHeaders = "To: " . $fTo . "\n";
|
||||
$fHeaders .= "From: " . $fFrom . "\n";
|
||||
|
||||
$fHeaders .= "Subject: " . encode_header (Lang::read('pSendmail_subject_text')) . "\n";
|
||||
$fHeaders .= "MIME-Version: 1.0\n";
|
||||
$fHeaders .= "Content-Type: text/plain; charset=utf-8\n";
|
||||
$fHeaders .= "Content-Transfer-Encoding: 8bit\n";
|
||||
|
||||
$fHeaders .= Config::read('welcome_text');
|
||||
|
||||
if (!smtp_mail ($fTo, $fFrom, $fHeaders))
|
||||
{
|
||||
$this->errormsg[] = Lang::read('pSendmail_result_error');
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
create_mailbox_subfolders($address,$plain);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function view() {
|
||||
global $config;
|
||||
|
||||
|
||||
|
||||
$username = $this->username;
|
||||
$table_mailbox = table_by_key('mailbox');
|
||||
|
||||
$result = db_query("SELECT username, name, maildir, quota, local_part, domain, DATE_FORMAT(created, '%d.%m.%y') AS created, DATE_FORMAT(modified, '%d.%m.%y') AS modified, active FROM $table_mailbox WHERE username='$username'");
|
||||
if ($result['rows'] != 0) {
|
||||
$this->return = db_array($result['result']);
|
||||
return 0;
|
||||
}
|
||||
$this->errormsg = $result['error'];
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
global $config;
|
||||
$username = $this->username;
|
||||
$tmp = preg_split ('/@/', $username);
|
||||
$domain = $tmp[1];
|
||||
$username = escape_string($username);
|
||||
|
||||
|
||||
|
||||
$table_mailbox = table_by_key('mailbox');
|
||||
$table_alias = table_by_key('alias');
|
||||
$table_vacation = table_by_key('vacation');
|
||||
$table_vacation_notification = table_by_key('vacation_notification');
|
||||
|
||||
if (Config::read('database_type') == "pgsql") db_query('BEGIN');
|
||||
/* there may be no aliases to delete */
|
||||
$result = db_query("SELECT * FROM $table_alias WHERE address = '$username' AND domain = '$domain'");
|
||||
if($result['rows'] == 1) {
|
||||
//$result = db_query ("DELETE FROM $table_alias WHERE address='$username' AND domain='$domain'");
|
||||
$result = db_delete($table_alias, 'address', $username);
|
||||
db_log ('CONSOLE', $domain, 'delete_alias', $username);
|
||||
}
|
||||
|
||||
/* is there a mailbox? if do delete it from orbit; it's the only way to be sure */
|
||||
$result = db_query ("SELECT * FROM $table_mailbox WHERE username='$username' AND domain='$domain'");
|
||||
if ($result['rows'] == 1)
|
||||
{
|
||||
//$result = db_query ("DELETE FROM $table_mailbox WHERE username='$username' AND domain='$domain'");
|
||||
$result = db_delete($table_mailbox, 'username', $username);
|
||||
$postdel_res=mailbox_postdeletion($username,$domain);
|
||||
if ($result != 1 || !$postdel_res)
|
||||
{
|
||||
|
||||
$tMessage = Lang::read('pDelete_delete_error') . "$username (";
|
||||
if ($result['rows']!=1)
|
||||
{
|
||||
$tMessage.='mailbox';
|
||||
if (!$postdel_res) $tMessage.=', ';
|
||||
}
|
||||
if (!$postdel_res)
|
||||
{
|
||||
$tMessage.='post-deletion';
|
||||
}
|
||||
$this->errormsg[] = $tMessage.')';
|
||||
return 1;
|
||||
}
|
||||
db_log ('CONSOLE', $domain, 'delete_mailbox', $username);
|
||||
}
|
||||
$result = db_query("SELECT * FROM $table_vacation WHERE email = '$username' AND domain = '$domain'");
|
||||
if($result['rows'] == 1) {
|
||||
//db_query ("DELETE FROM $table_vacation WHERE email='$username' AND domain='$domain'");
|
||||
db_delete($table_vacation, 'email', $username);
|
||||
//db_query ("DELETE FROM $table_vacation_notification WHERE on_vacation ='$username' "); /* should be caught by cascade, if PgSQL */
|
||||
db_delete($table_vacation_notification, 'on_vacation', $username);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
31
scripts/postfixadmin-cli
Normal file
31
scripts/postfixadmin-cli
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
################################################################################
|
||||
#
|
||||
# Bake is a shell script for running CakePHP bake script
|
||||
# PHP versions 4 and 5
|
||||
#
|
||||
# CakePHP(tm) : Rapid Development Framework (http://www.cakephp.org)
|
||||
# Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
#
|
||||
# Licensed under The MIT License
|
||||
# Redistributions of files must retain the above copyright notice.
|
||||
#
|
||||
# @filesource
|
||||
# @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
# @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
# @package cake
|
||||
# @subpackage cake.cake.console
|
||||
# @since CakePHP(tm) v 1.2.0.5012
|
||||
# @version $Revision$
|
||||
# @modifiedby $LastChangedBy$
|
||||
# @lastmodified $Date$
|
||||
# @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
#
|
||||
################################################################################
|
||||
clear
|
||||
|
||||
LIB=${0/%postfixadmin-cli/}
|
||||
|
||||
exec php -q ${LIB}postfixadmin-cli.php "$@"
|
||||
|
||||
exit;
|
580
scripts/postfixadmin-cli.php
Normal file
580
scripts/postfixadmin-cli.php
Normal file
@ -0,0 +1,580 @@
|
||||
#!/usr/bin/php
|
||||
<?php
|
||||
/**
|
||||
* Command-line code generation utility to automate administrator tasks.
|
||||
*
|
||||
* Shell dispatcher class
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
* Modified for Postfixadmin by Valkum
|
||||
*
|
||||
* Copyright 2010
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||
* @link http://postfixadmin.sourceforge.net/ Postfixadmin on Sourceforge
|
||||
* @package postfixadmin
|
||||
* @subpackage -
|
||||
* @since -
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
|
||||
class PostfixAdmin {
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @var string
|
||||
* @access protected
|
||||
*/
|
||||
var $version ='0.2';
|
||||
|
||||
/**
|
||||
* Standard input stream.
|
||||
*
|
||||
* @var filehandle
|
||||
* @access public
|
||||
*/
|
||||
var $stdin;
|
||||
/**
|
||||
* Standard output stream.
|
||||
*
|
||||
* @var filehandle
|
||||
* @access public
|
||||
*/
|
||||
var $stdout;
|
||||
/**
|
||||
* Standard error stream.
|
||||
*
|
||||
* @var filehandle
|
||||
* @access public
|
||||
*/
|
||||
var $stderr;
|
||||
/**
|
||||
* Contains command switches parsed from the command line.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $params = array();
|
||||
/**
|
||||
* Contains arguments parsed from the command line.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $args = array();
|
||||
/**
|
||||
* The file name of the shell that was invoked.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $shell = null;
|
||||
/**
|
||||
* The class name of the shell that was invoked.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $shellClass = null;
|
||||
/**
|
||||
* The command called if public methods are available.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $shellCommand = null;
|
||||
/**
|
||||
* The path locations of shells.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $shellPaths = array();
|
||||
/**
|
||||
* The path to the current shell location.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $shellPath = null;
|
||||
/**
|
||||
* The name of the shell in camelized.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $shellName = null;
|
||||
/**
|
||||
* Constructs this ShellDispatcher instance.
|
||||
*
|
||||
* @param array $args the argv.
|
||||
*/
|
||||
function PostfixAdmin($args = array()) {
|
||||
$this->__construct($args);
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $args the argv.
|
||||
*/
|
||||
function __construct($args = array()) {
|
||||
set_time_limit(0);
|
||||
$this->__initConstants();
|
||||
$this->parseParams($args);
|
||||
$this->__initEnvironment();
|
||||
/*$this->dispatch();
|
||||
die("\n");*/
|
||||
}
|
||||
/**
|
||||
* Defines core configuration.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __initConstants() {
|
||||
if (function_exists('ini_set')) {
|
||||
ini_set('display_errors', '1');
|
||||
ini_set('error_reporting', E_ALL);
|
||||
ini_set('html_errors', false);
|
||||
ini_set('implicit_flush', true);
|
||||
ini_set('max_execution_time', 0);
|
||||
}
|
||||
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
define('PHP5', (PHP_VERSION >= 5));
|
||||
define('CORE_INCLUDE_PATH', dirname(__FILE__));
|
||||
define('CORE_PATH', substr(CORE_INCLUDE_PATH, 0, -8) );
|
||||
|
||||
if(!defined('POSTFIXADMIN')) { # already defined if called from setup.php
|
||||
define('POSTFIXADMIN', 1); # checked in included files
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Defines current working environment.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __initEnvironment() {
|
||||
$this->stdin = fopen('php://stdin', 'r');
|
||||
$this->stdout = fopen('php://stdout', 'w');
|
||||
$this->stderr = fopen('php://stderr', 'w');
|
||||
|
||||
if (!$this->__bootstrap()) {
|
||||
$this->stderr("");
|
||||
$this->stderr("Unable to load.");
|
||||
$this->stderr("\tMake sure /config.inc.php exists in " . PATH);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
if (basename(__FILE__) != basename($this->args[0])) {
|
||||
$this->stderr("\nCakePHP Console: ");
|
||||
$this->stderr('Warning: the dispatcher may have been loaded incorrectly, which could lead to unexpected results...');
|
||||
if ($this->getInput('Continue anyway?', array('y', 'n'), 'y') == 'n') {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
$this->shiftArgs();
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Initializes the environment and loads the Cake core.
|
||||
*
|
||||
* @return boolean Success.
|
||||
* @access private
|
||||
*/
|
||||
function __bootstrap() {
|
||||
if ($this->params['webroot'] != '' ) {
|
||||
define('PATH', $this->params['webroot'] );
|
||||
} else {
|
||||
define('PATH', CORE_PATH);
|
||||
}
|
||||
if (!file_exists(PATH)) {
|
||||
$this->stderr( PATH . " don't exists");
|
||||
return false;
|
||||
|
||||
}
|
||||
$includes = array(
|
||||
PATH.'/config.inc.php',
|
||||
PATH.'/languages/language.php',
|
||||
PATH.'/functions.inc.php',
|
||||
PATH.'/languages/en.lang',
|
||||
CORE_INCLUDE_PATH.'/common.php',
|
||||
CORE_INCLUDE_PATH.'/inflector.php',
|
||||
);
|
||||
|
||||
foreach ($includes as $inc) {
|
||||
if (!require_once($inc)) {
|
||||
$this->stderr("Failed to load {$inc}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Config::getInstance();
|
||||
Config::write($CONF);
|
||||
|
||||
Lang::getInstance();
|
||||
Lang::write($PALANG);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatches a CLI request
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function dispatch() {
|
||||
$CONF = Config::read('all');
|
||||
if (isset($this->args[0])) {
|
||||
$plugin = null;
|
||||
$shell = $this->args[0];
|
||||
if (strpos($shell, '.') !== false) {
|
||||
list($plugin, $shell) = explode('.', $this->args[0]);
|
||||
}
|
||||
|
||||
$this->shell = $shell;
|
||||
$this->shiftArgs();
|
||||
$this->shellName = Inflector::camelize($this->shell);
|
||||
$this->shellClass = 'PostfixAdmin'.$this->shellName;
|
||||
|
||||
|
||||
if ($this->shell == 'help') {
|
||||
$this->help();
|
||||
} else {
|
||||
$loaded = false;
|
||||
$paths = array();
|
||||
|
||||
if ($plugin !== null) {
|
||||
$pluginPaths = Config::read('pluginPaths');
|
||||
$count = count($pluginPaths);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$paths[] = $pluginPaths[$i] . $plugin . DS . 'vendors' . DS . 'shells' . DS;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$paths[] = CORE_INCLUDE_PATH . DS . "shells" . DS;
|
||||
|
||||
$this->shellPaths = $paths;
|
||||
foreach ($this->shellPaths as $path) {
|
||||
$this->shellPath = $path . $this->shell . ".php";
|
||||
if (file_exists($this->shellPath)) {
|
||||
$loaded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($loaded) {
|
||||
if (!class_exists('Shell')) {
|
||||
require CORE_INCLUDE_PATH . DS . "shells" . DS . 'shell.php';
|
||||
}
|
||||
|
||||
require $this->shellPath;
|
||||
if (class_exists($this->shellClass)) {
|
||||
$command = null;
|
||||
if (isset($this->args[0])) {
|
||||
$command = $this->args[0];
|
||||
}
|
||||
$this->shellCommand = $command;
|
||||
$shell = new $this->shellClass($this);
|
||||
|
||||
if (strtolower(get_parent_class($shell)) == 'shell') {
|
||||
$shell->initialize();
|
||||
$shell->loadTasks();
|
||||
|
||||
foreach ($shell->taskNames as $task) {
|
||||
if (strtolower(get_parent_class($shell)) == 'shell') {
|
||||
$shell->{$task}->initialize();
|
||||
$shell->{$task}->loadTasks();
|
||||
}
|
||||
}
|
||||
|
||||
$task = Inflector::camelize($command);
|
||||
if (in_array($task, $shell->taskNames)) {
|
||||
$this->shiftArgs();
|
||||
$shell->{$task}->startup();
|
||||
if (isset($this->args[0]) && $this->args[0] == 'help') {
|
||||
if (method_exists($shell->{$task}, 'help')) {
|
||||
$shell->{$task}->help();
|
||||
exit();
|
||||
} else {
|
||||
$this->help();
|
||||
}
|
||||
}
|
||||
$shell->{$task}->execute();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$classMethods = get_class_methods($shell);
|
||||
|
||||
$privateMethod = $missingCommand = false;
|
||||
if ((in_array($command, $classMethods) || in_array(strtolower($command), $classMethods)) && strpos($command, '_', 0) === 0) {
|
||||
$privateMethod = true;
|
||||
}
|
||||
|
||||
if (!in_array($command, $classMethods) && !in_array(strtolower($command), $classMethods)) {
|
||||
$missingCommand = true;
|
||||
}
|
||||
|
||||
$protectedCommands = array(
|
||||
'initialize','in','out','err','hr',
|
||||
'createfile', 'isdir','copydir','object','tostring',
|
||||
'requestaction','log','cakeerror', 'shelldispatcher',
|
||||
'__initconstants','__initenvironment','__construct',
|
||||
'dispatch','__bootstrap','getinput','stdout','stderr','parseparams','shiftargs'
|
||||
);
|
||||
|
||||
if (in_array(strtolower($command), $protectedCommands)) {
|
||||
$missingCommand = true;
|
||||
}
|
||||
|
||||
if ($missingCommand && method_exists($shell, 'main')) {
|
||||
$shell->startup();
|
||||
$shell->main();
|
||||
} elseif (!$privateMethod && method_exists($shell, $command)) {
|
||||
$this->shiftArgs();
|
||||
$shell->startup();
|
||||
$shell->{$command}();
|
||||
} else {
|
||||
$this->stderr("Unknown {$this->shellName} command '$command'.\nFor usage, try 'cake {$this->shell} help'.\n\n");
|
||||
}
|
||||
} else {
|
||||
$this->stderr('Class '.$this->shellClass.' could not be loaded');
|
||||
}
|
||||
} else {
|
||||
$this->help();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->help();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompts the user for input, and returns it.
|
||||
*
|
||||
* @param string $prompt Prompt text.
|
||||
* @param mixed $options Array or string of options.
|
||||
* @param string $default Default input value.
|
||||
* @return Either the default value, or the user-provided input.
|
||||
* @access public
|
||||
*/
|
||||
function getInput($prompt, $options = null, $default = null) {
|
||||
if (!is_array($options)) {
|
||||
$print_options = '';
|
||||
} else {
|
||||
$print_options = '(' . implode('/', $options) . ')';
|
||||
}
|
||||
|
||||
if ($default == null) {
|
||||
$this->stdout($prompt . " $print_options \n" . '> ', false);
|
||||
} else {
|
||||
$this->stdout($prompt . " $print_options \n" . "[$default] > ", false);
|
||||
}
|
||||
$result = fgets($this->stdin);
|
||||
|
||||
if ($result === false){
|
||||
exit;
|
||||
}
|
||||
$result = trim($result);
|
||||
|
||||
if ($default != null && empty($result)) {
|
||||
return $default;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Outputs to the stdout filehandle.
|
||||
*
|
||||
* @param string $string String to output.
|
||||
* @param boolean $newline If true, the outputs gets an added newline.
|
||||
* @access public
|
||||
*/
|
||||
function stdout($string, $newline = true) {
|
||||
if ($newline) {
|
||||
fwrite($this->stdout, $string . "\n");
|
||||
} else {
|
||||
fwrite($this->stdout, $string);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Outputs to the stderr filehandle.
|
||||
*
|
||||
* @param string $string Error text to output.
|
||||
* @access public
|
||||
*/
|
||||
function stderr($string) {
|
||||
fwrite($this->stderr, 'Error: '. $string . "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses command line options
|
||||
*
|
||||
* @param array $params Parameters to parse
|
||||
* @access public
|
||||
*/
|
||||
function parseParams($params) {
|
||||
$this->__parseParams($params);
|
||||
|
||||
$defaults = array('webroot' => CORE_PATH);
|
||||
|
||||
$params = array_merge($defaults, array_intersect_key($this->params, $defaults));
|
||||
|
||||
$isWin = array_filter(array_map('strpos', $params, array('\\')));
|
||||
|
||||
$params = str_replace('\\', '/', $params);
|
||||
|
||||
|
||||
if (!empty($matches[0]) || !empty($isWin)) {
|
||||
$params = str_replace('/', '\\', $params);
|
||||
}
|
||||
|
||||
$this->params = array_merge($this->params, $params);
|
||||
}
|
||||
/**
|
||||
* Helper for recursively paraing params
|
||||
*
|
||||
* @return array params
|
||||
* @access private
|
||||
*/
|
||||
function __parseParams($params) {
|
||||
$count = count($params);
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
if (isset($params[$i])) {
|
||||
if ($params[$i]{0} === '-') {
|
||||
$key = substr($params[$i], 1);
|
||||
$this->params[$key] = true;
|
||||
unset($params[$i]);
|
||||
if (isset($params[++$i])) {
|
||||
if ($params[$i]{0} !== '-') {
|
||||
$this->params[$key] = str_replace('"', '', $params[$i]);
|
||||
unset($params[$i]);
|
||||
} else {
|
||||
$i--;
|
||||
$this->__parseParams($params);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->args[] = $params[$i];
|
||||
unset($params[$i]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Removes first argument and shifts other arguments up
|
||||
*
|
||||
* @return boolean False if there are no arguments
|
||||
* @access public
|
||||
*/
|
||||
function shiftArgs() {
|
||||
if (empty($this->args)) {
|
||||
return false;
|
||||
}
|
||||
unset($this->args[0]);
|
||||
$this->args = array_values($this->args);
|
||||
return true;
|
||||
}
|
||||
|
||||
function help() {
|
||||
$this->stdout("\nWelcome to Postfixadmin-CLI v" . $this->version);
|
||||
$this->stdout("---------------------------------------------------------------");
|
||||
$this->stdout("Options:");
|
||||
$this->stdout(" -webroot: " . $this->params['webroot']);
|
||||
$this->stdout("");
|
||||
$this->stdout("Changing Paths:");
|
||||
$this->stdout("your webroot should be the same as your postfixadmin path");
|
||||
$this->stdout("to change your path use the '-webroot' param.");
|
||||
$this->stdout("Example: -webroot r/absolute/path/to/postfixadmin");
|
||||
|
||||
$this->stdout("\nAvailable Commands:");
|
||||
foreach ($this->commands() AS $command => $desc) {
|
||||
if (is_array($desc)) {
|
||||
$this->stdout($command . ":");
|
||||
foreach($desc AS $command2 => $desc2) {
|
||||
$this->stdout(sprintf("%-20s %s", " ".$command2 .": ", $desc2));
|
||||
}
|
||||
$this->stdout("");
|
||||
} else {
|
||||
$this->stdout(sprintf("%-20s %s", $command .": ", $desc));
|
||||
}
|
||||
}
|
||||
$this->stdout("\nTo run a command, type 'postfixadmin-cli command [args]'");
|
||||
$this->stdout("To get help on a specific command, type 'postfixadmin-cli command help'");
|
||||
exit();
|
||||
|
||||
}
|
||||
/**
|
||||
* Removes first argument and shifts other arguments up
|
||||
*
|
||||
* @return array List of commands
|
||||
* @access public
|
||||
*/
|
||||
function commands() {
|
||||
|
||||
|
||||
|
||||
return array(
|
||||
'user' => array(
|
||||
'add'=> 'Adds a new user with mailbox.',
|
||||
'update'=> 'Updates a user.',
|
||||
'delete' => 'Deletes a user.',
|
||||
'pw' => 'Changes the PW for a user.',
|
||||
),
|
||||
'alias' => array(
|
||||
'add' => 'Adds a new alias.',
|
||||
'update' => 'Updates a alias.',
|
||||
'delete' => 'Deletes a alias.',
|
||||
),
|
||||
'version' => 'Prints version of Postfixadmin and Postfixadmin-CLI'
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$dispatcher = new PostfixAdmin($argv);
|
||||
|
||||
$CONF = Config::read('all');
|
||||
|
||||
//bugfix shitty globals and OOP.....
|
||||
|
||||
$table_admin = table_by_key ('admin');
|
||||
$table_alias = table_by_key ('alias');
|
||||
$table_alias_domain = table_by_key ('alias_domain');
|
||||
$table_domain = table_by_key ('domain');
|
||||
$table_domain_admins = table_by_key ('domain_admins');
|
||||
$table_log = table_by_key ('log');
|
||||
$table_mailbox = table_by_key ('mailbox');
|
||||
$table_vacation = table_by_key ('vacation');
|
||||
$table_vacation_notification = table_by_key('vacation_notification');
|
||||
$table_quota = table_by_key ('quota');
|
||||
$table_quota2 = table_by_key ('quota2');
|
||||
|
||||
$dispatcher->dispatch();
|
||||
?>
|
470
scripts/shells/alias.php
Normal file
470
scripts/shells/alias.php
Normal file
@ -0,0 +1,470 @@
|
||||
<?php
|
||||
|
||||
|
||||
class PostfixAdminAlias extends Shell {
|
||||
|
||||
/**
|
||||
* Contains tasks to load and instantiate
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $tasks = array('Add', 'Update', 'Delete', 'View');
|
||||
|
||||
|
||||
/**
|
||||
* Starts up the the Shell
|
||||
* allows for checking and configuring prior to command or main execution
|
||||
* can be overriden in subclasses
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startup() {
|
||||
$this->_welcome();
|
||||
$CONF = Config::read('all');
|
||||
}
|
||||
/**
|
||||
* Displays a header for the shell
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
function _welcome() {
|
||||
$this->out("\nWelcome to Postfixadmin-CLI v" . $this->Dispatch->version);
|
||||
$this->out("---------------------------------------------------------------");
|
||||
$this->out('Path: '. PATH);
|
||||
$this->hr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show help for this shell.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$head = "Usage: postfixadmin-cli alias <task> [<address>] [] [-m <method>]\n";
|
||||
$head .= "-----------------------------------------------\n";
|
||||
$head .= "Parameters:\n\n";
|
||||
|
||||
$commands = array(
|
||||
'task' => "\t<task>\n" .
|
||||
"\t\tAvailable values:\n\n".
|
||||
"\t\t".sprintf("%-20s %s", "view: ", "View an existing alias.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "add: ", "Adds an alias.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "update: ", "Updates an alias.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "delete: ", "Deletes an alias")."\n",
|
||||
'address' => "\t[<address>]\n" .
|
||||
"\t\tA address of recipient.\n",
|
||||
);
|
||||
|
||||
$this->out($head);
|
||||
if (!isset($this->args[1])) {
|
||||
foreach ($commands as $cmd) {
|
||||
$this->out("{$cmd}\n\n");
|
||||
}
|
||||
} elseif (isset($commands[low($this->args[1])])) {
|
||||
$this->out($commands[low($this->args[1])] . "\n\n");
|
||||
} else {
|
||||
$this->out("Command '" . $this->args[1] . "' not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class AddTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->__handle($this->args[0], $this->args[1]);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
while(0==0) {
|
||||
$question = "Enter address:";
|
||||
$address = $this->in($question);
|
||||
|
||||
if(preg_match("/^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/", $address) == 1)
|
||||
break;
|
||||
|
||||
$this->err("Invalid emailaddress");
|
||||
|
||||
}
|
||||
while(0==0) {
|
||||
$question = "Forward to:";
|
||||
$random = $this->in($question);
|
||||
|
||||
if(preg_match("/^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/", $address) == 1)
|
||||
break;
|
||||
|
||||
$this->err("Invalid emailaddress");
|
||||
}
|
||||
|
||||
$this->__handle($address, $goto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address, $goto) {
|
||||
|
||||
$handler = new AliasHandler($address);
|
||||
$return = $handler->add($goto);
|
||||
|
||||
if($return == 1) {
|
||||
$this->err(join("\n", $handler->errormsg));
|
||||
} else {
|
||||
$this->out("");
|
||||
$this->out("Alias ( $address -> $goto ) generated.");
|
||||
$this->hr();
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user add <address> [<password>] <name> <quota> [-g]");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tadd\n\t\tAdds mailbox in interactive mode.");
|
||||
$this->out("\n\tadd <address> [<password>] [-g] <name> <quota>\n\t\tAdds mailbox for <address> with password <password> of if -g with rand pw. <quota> in MB.");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class UpdateTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->help();
|
||||
//$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->help();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Not Implemented yet! If you want to change a password use the password command.");
|
||||
/*$this->out("Usage: postfixadmin-cli user update <args>");
|
||||
//$this->hr();
|
||||
//$this->out('Commands:');
|
||||
//$this->out("\n\tmodel\n\t\tbakes model in interactive mode.");
|
||||
//$this->out("\n\tmodel <name>\n\t\tbakes model file with no associations or validation");
|
||||
//$this->out("");*/
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class DeleteTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
|
||||
if (empty($this->args)) {
|
||||
$this->help();
|
||||
//$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->help();
|
||||
// $output = $this->__handle($this->args[0]);
|
||||
// $this->out($output);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
$question[] = "Which Address do you want to view?";
|
||||
|
||||
$address = $this->in(join("\n", $question));
|
||||
|
||||
|
||||
$question = "Do you really want to delete mailbox of '$address'?";
|
||||
|
||||
$create = $this->in($question, array('y','n'));
|
||||
|
||||
$create == 'y' ? $random = true : $random = false;
|
||||
|
||||
if ($create)
|
||||
$this->__handle($address);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address) {
|
||||
|
||||
|
||||
$handler = new UserHandler($address);
|
||||
$status = $handler->delete();
|
||||
if ($status == 0) {
|
||||
$this->out("Mailbox of '$address' was deleted.");
|
||||
|
||||
} else {
|
||||
$this->err(join("\n", $handler->errormsg));
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("NOT implemented yet.");
|
||||
//$this->out("Usage: postfixadmin-cli user model <arg1>");
|
||||
//$this->hr();
|
||||
//$this->out('Commands:');
|
||||
//$this->out("\n\tdelete\n\t\tdeletes mailbox in interactive mode.");
|
||||
//$this->out("\n\tdelete <address>\n\t\tdeletes mailbox with address <address>");
|
||||
//$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class PasswordTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
|
||||
$address = $this->args[0];
|
||||
|
||||
if (isset($this->params['g']) && $this->params['g'] == true ) {
|
||||
$random = true;
|
||||
$password = NULL;
|
||||
} elseif (isset($this->args[1]) && length($this->args[1]) > 8) {
|
||||
$password = $this->args[1];
|
||||
} else {
|
||||
|
||||
$this->Dispatch->stderr('Missing <newpw> or -g. Falling back to interactive mode.');
|
||||
$this->__interactive();
|
||||
}
|
||||
$this->__handle($address, $password, $random);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
|
||||
while(0==0) {
|
||||
$question = "Which address' password do you want to change?";
|
||||
$address = $this->in($question);
|
||||
|
||||
if(preg_match("/^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/", $address) == 1)
|
||||
break;
|
||||
|
||||
$this->err("Invalid emailaddress");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$question2[] = "Do you want to change the password?";
|
||||
$question2[] = "Are you really sure?";
|
||||
$sure = $this->in(join("\n", $question2), array('y','n'));
|
||||
|
||||
|
||||
if ($sure == 'n' ) {
|
||||
$this->out('You\'re not sure.');
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
$question = "Do you want to generate a random password?";
|
||||
$random = $this->in($question, array('y','n'));
|
||||
|
||||
$random == 'y' ? $random = true : $random = false;
|
||||
|
||||
|
||||
$password = NULL;
|
||||
if ($random == false) {
|
||||
$question = "Pleas enter the new password?";
|
||||
$password = $this->in($question);
|
||||
}
|
||||
var_dump($random);
|
||||
$this->__handle($address, $password, $random);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address, $password = NULL, $random = false) {
|
||||
|
||||
if ($random == true) {
|
||||
$password = generate_password();
|
||||
}
|
||||
if ($password != NULL) {
|
||||
$handler = new UserHandler($address);
|
||||
|
||||
if ($handler->change_pw($password, NULL, false) == 1){
|
||||
$this->error("Change Password",join("\n", $handler->errormsg));
|
||||
}
|
||||
}
|
||||
|
||||
$this->out("");
|
||||
$this->out("Password updated.");
|
||||
$this->hr();
|
||||
$this->out(sprintf('The Mail address is %20s', $address));
|
||||
$this->out(sprintf('The new password is %20s',$password));
|
||||
$this->hr();
|
||||
|
||||
return ;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->out("");
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user password <address> [<newpw>] [-g]");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tpassword\n\t\tchanges the password in interactive mode.");
|
||||
$this->out("\n\tpassword <address> [<newpw>] [-g]\n\t\tchanges the password to <newpw> or if -g genereate a new pw for <address>");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class ViewTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->__handle($this->args[0]);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
$question[] = "Which Alias do you want to view?";
|
||||
|
||||
$address = $this->in(join("\n", $question));
|
||||
|
||||
$this->__handle($address);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address) {
|
||||
|
||||
|
||||
$handler = new AliasHandler($address);
|
||||
$status = $handler->get($address);
|
||||
if ($status == 0) {
|
||||
$result = $handler->return;
|
||||
|
||||
$this->out(sprintf("Entries for: %s\n", $address));
|
||||
$this->out("Goto: \t");
|
||||
foreach($result AS $goto) {
|
||||
$this->out("\t -> ".$goto);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->out("");
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user view <address>");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tview\n\t\tView user. Select address in interactive mode.");
|
||||
$this->out("\n\tview <address>\n\t\tView user with address <address>");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
511
scripts/shells/domain.php
Normal file
511
scripts/shells/domain.php
Normal file
@ -0,0 +1,511 @@
|
||||
<?php
|
||||
|
||||
|
||||
class PostfixAdminDomain extends Shell {
|
||||
|
||||
/**
|
||||
* Contains tasks to load and instantiate
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $tasks = array('Add', 'Update', 'Delete', 'View');
|
||||
|
||||
|
||||
/**
|
||||
* Starts up the the Shell
|
||||
* allows for checking and configuring prior to command or main execution
|
||||
* can be overriden in subclasses
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startup() {
|
||||
$this->_welcome();
|
||||
$CONF = Config::read('all');
|
||||
}
|
||||
/**
|
||||
* Displays a header for the shell
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
function _welcome() {
|
||||
$this->out("\nWelcome to Postfixadmin-CLI v" . $this->Dispatch->version);
|
||||
$this->out("---------------------------------------------------------------");
|
||||
$this->out('Path: '. PATH);
|
||||
$this->hr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show help for this shell.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$head = "Usage: postfixadmin-cli domain <task> [<domain>] [-desc \"<description>\"] [-a <aliases>] [-m <mailboxes>] [-q <quota in MB>] [-t <transport>] [-default] [-backup]\n";
|
||||
$head .= "-----------------------------------------------\n";
|
||||
$head .= "Parameters:\n\n";
|
||||
|
||||
$commands = array(
|
||||
'task' => "\t<task>\n" .
|
||||
"\t\tAvailable values:\n\n".
|
||||
"\t\t".sprintf("%-20s %s", "view: ", "View an existing domain.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "add: ", "Adds a domain.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "update: ", "Updates an domain.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "delete: ", "Deletes a domain")."\n",
|
||||
'domain' => "\t[<domain>]\n" .
|
||||
"\t\tA address of recipient.\n",
|
||||
'a' => "\t[<aliaes>]\n" .
|
||||
"\t\tNumber of max aliases. -1 = disable | 0 = unlimited\n",
|
||||
'm' => "\t[<mailboxes>]\n" .
|
||||
"\t\tNumber of max mailboxes. -1 = disable | 0 = unlimited\n",
|
||||
'q' => "\t[<quota in MB>]\n" .
|
||||
"\t\tMax Quota in MB. -1 = disable | 0 = unlimited\n",
|
||||
't' => "\t[<transport>]\n" .
|
||||
"\t\tTransport options from config.inc.php.\n",
|
||||
'default' => "\t\tSet to add default Aliases.\n",
|
||||
'backup' => "\t\tSet if mailserver is backup MX.\n",
|
||||
);
|
||||
|
||||
$this->out($head);
|
||||
if (!isset($this->args[1])) {
|
||||
foreach ($commands as $cmd) {
|
||||
$this->out("{$cmd}\n\n");
|
||||
}
|
||||
} elseif (isset($commands[low($this->args[1])])) {
|
||||
$this->out($commands[low($this->args[1])] . "\n\n");
|
||||
} else {
|
||||
$this->out("Command '" . $this->args[1] . "' not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class AddTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->__handle($this->args[0], $this->args[1]);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
while(0==0) {
|
||||
$question = "Enter domain:";
|
||||
$domain = $this->in($question);
|
||||
|
||||
if(preg_match("/^((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/", $domain) == 1)
|
||||
break;
|
||||
|
||||
$this->err("Invalid domain");
|
||||
|
||||
}
|
||||
$question = "Description:";
|
||||
$desc = $this->in($question);
|
||||
|
||||
$question = "Number of Aliases:";
|
||||
$a = $this->in($question);
|
||||
|
||||
$question = "Numer of Mailboxes:";
|
||||
$m = $this->in($question);
|
||||
|
||||
$question = "Max Quota (in MB):";
|
||||
$q = $this->in($question);
|
||||
|
||||
$handler = new DomainHandler('CONSOLE');
|
||||
$transports = $handler->getTransports();
|
||||
$qt[] = 'Choose transport option';
|
||||
foreach ($transports AS $key => $val) {
|
||||
//workaround. $this->in hates number 0
|
||||
$key = $key + 1;
|
||||
$qt[] = '['.$key.'] - '.$val;
|
||||
}
|
||||
|
||||
$t = $this->in( join("\n", $qt) );
|
||||
|
||||
$question = "Add default Aliases:";
|
||||
$default = $this->in($question, array('y','n'));
|
||||
($default == 'y') ? $default = true : $default = false;
|
||||
|
||||
$question = "Use as Backup MX:";
|
||||
$backup = $this->in($question, array('y','n'));
|
||||
($backup == 'y') ? $backup = true : $backup = false;
|
||||
|
||||
|
||||
$this->__handle($domain, $desc, $a, $m, $t, $q, $default, $backup);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($domain, $desc, $a, $m, $t, $q, $default, $backup) {
|
||||
|
||||
|
||||
$handler = new DomainHandler('CONSOLE');
|
||||
$return = $handler->add($domain, $desc, $a, $m, $t, $q, $default, $backup);
|
||||
|
||||
if($return == 1) {
|
||||
$this->err(join("\n", $handler->errormsg));
|
||||
} else {
|
||||
$this->out("");
|
||||
$this->out("Domain ( $domain ) generated.");
|
||||
$this->hr();
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user add <address> [<password>] <name> <quota> [-g]");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tadd\n\t\tAdds mailbox in interactive mode.");
|
||||
$this->out("\n\tadd <address> [<password>] [-g] <name> <quota>\n\t\tAdds mailbox for <address> with password <password> of if -g with rand pw. <quota> in MB.");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class UpdateTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->help();
|
||||
//$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->help();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Not Implemented yet! ");
|
||||
/*$this->out("Usage: postfixadmin-cli user update <args>");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tmodel\n\t\tbakes model in interactive mode.");
|
||||
$this->out("\n\tmodel <name>\n\t\tbakes model file with no associations or validation");
|
||||
$this->out("");*/
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class DeleteTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
|
||||
if (empty($this->args)) {
|
||||
$this->help();
|
||||
//$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->help();
|
||||
//$output = $this->__handle($this->args[0]);
|
||||
//$this->out($output);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
$question[] = "Which Address do you want to view?";
|
||||
|
||||
$address = $this->in(join("\n", $question));
|
||||
|
||||
|
||||
$question = "Do you really want to delete mailbox of '$address'?";
|
||||
|
||||
$create = $this->in($question, array('y','n'));
|
||||
|
||||
$create == 'y' ? $random = true : $random = false;
|
||||
|
||||
if ($create)
|
||||
$this->__handle($address);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address) {
|
||||
|
||||
|
||||
$handler = new UserHandler($address);
|
||||
$status = $handler->delete();
|
||||
if ($status == 0) {
|
||||
$this->out("Mailbox of '$address' was deleted.");
|
||||
|
||||
} else {
|
||||
$this->err(join("\n", $handler->errormsg));
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->out("NOT Implemented yet.");
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user model <arg1>");
|
||||
$this->hr();
|
||||
//$this->out('Commands:');
|
||||
//$this->out("\n\tdelete\n\t\tdeletes mailbox in interactive mode.");
|
||||
//$this->out("\n\tdelete <address>\n\t\tdeletes mailbox with address <address>");
|
||||
//$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class PasswordTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->help();
|
||||
// $this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->help();
|
||||
//$address = $this->args[0];
|
||||
|
||||
//if (isset($this->params['g']) && $this->params['g'] == true ) {
|
||||
// $random = true;
|
||||
// $password = NULL;
|
||||
//} elseif (isset($this->args[1]) && length($this->args[1]) > 8) {
|
||||
// $password = $this->args[1];
|
||||
//} else {
|
||||
|
||||
// $this->Dispatch->stderr('Missing <newpw> or -g. Falling back to interactive mode.');
|
||||
// $this->__interactive();
|
||||
//}
|
||||
//$this->__handle($address, $password, $random);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
|
||||
while(0==0) {
|
||||
$question = "Which address' password do you want to change?";
|
||||
$address = $this->in($question);
|
||||
|
||||
if(preg_match("/^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/", $address) == 1)
|
||||
break;
|
||||
|
||||
$this->err("Invalid emailaddress");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$question2[] = "Do you want to change the password?";
|
||||
$question2[] = "Are you really sure?";
|
||||
$sure = $this->in(join("\n", $question2), array('y','n'));
|
||||
|
||||
|
||||
if ($sure == 'n' ) {
|
||||
$this->out('You\'re not sure.');
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
$question = "Do you want to generate a random password?";
|
||||
$random = $this->in($question, array('y','n'));
|
||||
|
||||
$random == 'y' ? $random = true : $random = false;
|
||||
|
||||
|
||||
$password = NULL;
|
||||
if ($random == false) {
|
||||
$question = "Pleas enter the new password?";
|
||||
$password = $this->in($question);
|
||||
}
|
||||
var_dump($random);
|
||||
$this->__handle($address, $password, $random);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address, $password = NULL, $random = false) {
|
||||
|
||||
if ($random == true) {
|
||||
$password = generate_password();
|
||||
}
|
||||
if ($password != NULL) {
|
||||
$handler = new UserHandler($address);
|
||||
|
||||
if ($handler->change_pw($password, NULL, false) == 1){
|
||||
$this->error("Change Password",join("\n", $handler->errormsg));
|
||||
}
|
||||
}
|
||||
|
||||
$this->out("");
|
||||
$this->out("Password updated.");
|
||||
$this->hr();
|
||||
$this->out(sprintf('The Mail address is %20s', $address));
|
||||
$this->out(sprintf('The new password is %20s',$password));
|
||||
$this->hr();
|
||||
|
||||
return ;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->out("NOT implemented yet.");
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user password <address> [<newpw>] [-g]");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tpassword\n\t\tchanges the password in interactive mode.");
|
||||
$this->out("\n\tpassword <address> [<newpw>] [-g]\n\t\tchanges the password to <newpw> or if -g genereate a new pw for <address>");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class ViewTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$output = $this->__handle($this->args[0]);
|
||||
$this->out($output);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
$question[] = "Which Domain do you want to view?";
|
||||
|
||||
$domain = $this->in(join("\n", $question));
|
||||
|
||||
$this->__handle($domain);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($domain) {
|
||||
|
||||
|
||||
$handler = new DomainHandler('CONSOLE');
|
||||
$status = $handler->view($domain);
|
||||
if ($status == 0) {
|
||||
$result = $handler->return;
|
||||
$this->out("Domain: \t".$result['domain']);
|
||||
$this->out("Description: \t".$result['description']);
|
||||
$this->out("Aliases: \t".$result['aliases']);
|
||||
$this->out("Mailboxes: \t".$result['mailboxes']);
|
||||
$this->out("Max. Quota: \t".$result['maxquota']);
|
||||
$this->out("Transport: \t".$result['transport']);
|
||||
$this->out("Backup MX: \t".$result['backupmx']);
|
||||
$this->out("Active: \t".$result['active']);
|
||||
$this->out("Modified: \t".$result['modified']);
|
||||
$this->out("Created: \t".$result['created']);
|
||||
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->out("");
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user view <address>");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tview\n\t\tView user. Select address in interactive mode.");
|
||||
$this->out("\n\tview <address>\n\t\tView user with address <address>");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
353
scripts/shells/shell.php
Normal file
353
scripts/shells/shell.php
Normal file
@ -0,0 +1,353 @@
|
||||
<?php
|
||||
/**
|
||||
* Base class for Shells
|
||||
*
|
||||
* Long description for file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
* Modified for Postfixadmin by Valkum
|
||||
*
|
||||
* Copyright 2010
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc.
|
||||
* @link http://postfixadmin.sourceforge.net/ Postfixadmin on Sourceforge
|
||||
* @package postfixadmin
|
||||
* @subpackage -
|
||||
* @since -
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
|
||||
class Shell {
|
||||
/**
|
||||
* An instance of the ShellDispatcher object that loaded this script
|
||||
*
|
||||
* @var object
|
||||
* @access public
|
||||
*/
|
||||
var $Dispatch = null;
|
||||
/**
|
||||
* If true, the script will ask for permission to perform actions.
|
||||
*
|
||||
* @var boolean
|
||||
* @access public
|
||||
*/
|
||||
var $interactive = true;
|
||||
/**
|
||||
* Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found,
|
||||
* or the app does not exist.
|
||||
*
|
||||
* @var object
|
||||
* @access public
|
||||
*/
|
||||
var $DbConfig = null;
|
||||
/**
|
||||
* Contains command switches parsed from the command line.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $params = array();
|
||||
/**
|
||||
* Contains arguments parsed from the command line.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $args = array();
|
||||
/**
|
||||
* The file name of the shell that was invoked.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $shell = null;
|
||||
/**
|
||||
* The class name of the shell that was invoked.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $className = null;
|
||||
/**
|
||||
* The command called if public methods are available.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $command = null;
|
||||
/**
|
||||
* The name of the shell in camelized.
|
||||
*
|
||||
* @var string
|
||||
* @access public
|
||||
*/
|
||||
var $name = null;
|
||||
/**
|
||||
* Contains tasks to load and instantiate
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $tasks = array();
|
||||
/**
|
||||
* Contains the loaded tasks
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $taskNames = array();
|
||||
/**
|
||||
* Contains models to load and instantiate
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $uses = array();
|
||||
/**
|
||||
* Constructs this Shell instance.
|
||||
*
|
||||
*/
|
||||
function __construct(&$dispatch) {
|
||||
$vars = array('params', 'args', 'shell', 'shellCommand'=> 'command');
|
||||
foreach ($vars as $key => $var) {
|
||||
if (is_string($key)) {
|
||||
$this->{$var} =& $dispatch->{$key};
|
||||
} else {
|
||||
$this->{$var} =& $dispatch->{$var};
|
||||
}
|
||||
}
|
||||
|
||||
$this->className = get_class($this);
|
||||
|
||||
if ($this->name == null) {
|
||||
$this->name = str_replace(array('shell', 'Shell', 'task', 'Task'), '', $this->className);
|
||||
}
|
||||
|
||||
$shellKey = Inflector::underscore($this->className);
|
||||
|
||||
if (!PHP5 && isset($this->args[0])) {
|
||||
if(strpos($this->className, low(Inflector::camelize($this->args[0]))) !== false) {
|
||||
$dispatch->shiftArgs();
|
||||
}
|
||||
if (low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
|
||||
$dispatch->shiftArgs();
|
||||
}
|
||||
}
|
||||
|
||||
$this->Dispatch =& $dispatch;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the Shell
|
||||
* acts as constructor for subclasses
|
||||
* allows configuration of tasks prior to shell execution
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function initialize() {
|
||||
}
|
||||
/**
|
||||
* Starts up the the Shell
|
||||
* allows for checking and configuring prior to command or main execution
|
||||
* can be overriden in subclasses
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startup() {
|
||||
$this->_welcome();
|
||||
}
|
||||
/**
|
||||
* Displays a header for the shell
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
function _welcome() {
|
||||
$this->out("\nWelcome to Postfixadmin-CLI v" . $this->Dispatch->version);
|
||||
$this->out("---------------------------------------------------------------");
|
||||
$this->out('Path: '. PATH);
|
||||
$this->hr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads tasks defined in var $tasks
|
||||
*
|
||||
* @return bool
|
||||
* @access public
|
||||
*/
|
||||
function loadTasks() {
|
||||
if ($this->tasks === null || $this->tasks === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->tasks !== true && !empty($this->tasks)) {
|
||||
|
||||
$tasks = $this->tasks;
|
||||
if (!is_array($tasks)) {
|
||||
$tasks = array($tasks);
|
||||
}
|
||||
|
||||
foreach ($tasks as $taskName) {
|
||||
$task = Inflector::underscore($taskName);
|
||||
$taskClass = Inflector::camelize($taskName.'Task');
|
||||
$taskKey = Inflector::underscore($taskClass);
|
||||
|
||||
if (!class_exists($taskClass)) {
|
||||
foreach ($this->Dispatch->shellPaths as $path) {
|
||||
$taskPath = $path . 'tasks' . DS . $task.'.php';
|
||||
if (file_exists($taskPath)) {
|
||||
require_once $taskPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->taskNames[] = $taskName;
|
||||
if (!PHP5) {
|
||||
$this->{$taskName} =& new $taskClass($this->Dispatch);
|
||||
} else {
|
||||
$this->{$taskName} = new $taskClass($this->Dispatch);
|
||||
}
|
||||
|
||||
|
||||
if (!isset($this->{$taskName})) {
|
||||
$this->err("Task '".$taskName."' could not be loaded");
|
||||
$this->_stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Prompts the user for input, and returns it.
|
||||
*
|
||||
* @param string $prompt Prompt text.
|
||||
* @param mixed $options Array or string of options.
|
||||
* @param string $default Default input value.
|
||||
* @return Either the default value, or the user-provided input.
|
||||
* @access public
|
||||
*/
|
||||
function in($prompt, $options = null, $default = null) {
|
||||
if (!$this->interactive) {
|
||||
return $default;
|
||||
}
|
||||
$in = $this->Dispatch->getInput($prompt, $options, $default);
|
||||
|
||||
if ($options && is_string($options)) {
|
||||
if (strpos($options, ',')) {
|
||||
$options = explode(',', $options);
|
||||
} elseif (strpos($options, '/')) {
|
||||
$options = explode('/', $options);
|
||||
} else {
|
||||
$options = array($options);
|
||||
}
|
||||
}
|
||||
if (is_array($options)) {
|
||||
while ($in == '' || ($in && (!in_array(low($in), $options) && !in_array(up($in), $options)) && !in_array($in, $options))) {
|
||||
$in = $this->Dispatch->getInput($prompt, $options, $default);
|
||||
}
|
||||
}
|
||||
if ($in) {
|
||||
return $in;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Outputs to the stdout filehandle.
|
||||
*
|
||||
* @param string $string String to output.
|
||||
* @param boolean $newline If true, the outputs gets an added newline.
|
||||
* @access public
|
||||
*/
|
||||
function out($string, $newline = true) {
|
||||
if (is_array($string)) {
|
||||
$str = '';
|
||||
foreach($string as $message) {
|
||||
$str .= $message ."\n";
|
||||
}
|
||||
$string = $str;
|
||||
}
|
||||
return $this->Dispatch->stdout($string, $newline);
|
||||
}
|
||||
/**
|
||||
* Outputs to the stderr filehandle.
|
||||
*
|
||||
* @param string $string Error text to output.
|
||||
* @access public
|
||||
*/
|
||||
function err($string) {
|
||||
if (is_array($string)) {
|
||||
$str = '';
|
||||
foreach($string as $message) {
|
||||
$str .= $message ."\n";
|
||||
}
|
||||
$string = $str;
|
||||
}
|
||||
return $this->Dispatch->stderr($string."\n");
|
||||
}
|
||||
/**
|
||||
* Outputs a series of minus characters to the standard output, acts as a visual separator.
|
||||
*
|
||||
* @param boolean $newline If true, the outputs gets an added newline.
|
||||
* @access public
|
||||
*/
|
||||
function hr($newline = false) {
|
||||
if ($newline) {
|
||||
$this->out("\n");
|
||||
}
|
||||
$this->out('---------------------------------------------------------------');
|
||||
if ($newline) {
|
||||
$this->out("\n");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Displays a formatted error message and exits the application
|
||||
*
|
||||
* @param string $title Title of the error message
|
||||
* @param string $msg Error message
|
||||
* @access public
|
||||
*/
|
||||
function error($title, $msg) {
|
||||
$out = "$title\n";
|
||||
$out .= "$msg\n";
|
||||
$out .= "\n";
|
||||
$this->err($out);
|
||||
$this->_stop();
|
||||
}
|
||||
/**
|
||||
* Outputs usage text on the standard output. Implement it in subclasses.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
if ($this->command != null) {
|
||||
$this->err("Unknown {$this->name} command '$this->command'.\nFor usage, try 'cake {$this->shell} help'.\n\n");
|
||||
} else {
|
||||
$this->Dispatch->help();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Stop execution of the current script
|
||||
*
|
||||
* @param $status see http://php.net/exit for values
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function _stop($status = 0) {
|
||||
exit($status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
508
scripts/shells/user.php
Normal file
508
scripts/shells/user.php
Normal file
@ -0,0 +1,508 @@
|
||||
<?php
|
||||
|
||||
|
||||
class PostfixAdminUser extends Shell {
|
||||
|
||||
/**
|
||||
* Contains tasks to load and instantiate
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
*/
|
||||
var $tasks = array('Add', 'Update', 'Delete', 'Password', 'View');
|
||||
|
||||
|
||||
/**
|
||||
* Starts up the the Shell
|
||||
* allows for checking and configuring prior to command or main execution
|
||||
* can be overriden in subclasses
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function startup() {
|
||||
$this->_welcome();
|
||||
$CONF = Config::read('all');
|
||||
}
|
||||
/**
|
||||
* Displays a header for the shell
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
function _welcome() {
|
||||
$this->out("\nWelcome to Postfixadmin-CLI v" . $this->Dispatch->version);
|
||||
$this->out("---------------------------------------------------------------");
|
||||
$this->out('Path: '. PATH);
|
||||
$this->hr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show help for this shell.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$head = "Usage: postfixadmin-cli user <task> [<address>] [] [-m <method>]\n";
|
||||
$head .= "-----------------------------------------------\n";
|
||||
$head .= "Parameters:\n\n";
|
||||
|
||||
$commands = array(
|
||||
'task' => "\t<task>\n" .
|
||||
"\t\tAvailable values:\n\n".
|
||||
"\t\t".sprintf("%-20s %s", "view: ", "View an existing user.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "add: ", "Adds a new user with mailbox.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "update: ", "Updates a user.")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "delete: ", "Deletes a user")."\n".
|
||||
"\t\t".sprintf("%-20s %s", "password: ", "Changes the PW for a user.")."\n",
|
||||
'address' => "\t[<address>]\n" .
|
||||
"\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n",
|
||||
);
|
||||
|
||||
$this->out($head);
|
||||
if (!isset($this->args[1])) {
|
||||
foreach ($commands as $cmd) {
|
||||
$this->out("{$cmd}\n\n");
|
||||
}
|
||||
} elseif (isset($commands[low($this->args[1])])) {
|
||||
$this->out($commands[low($this->args[1])] . "\n\n");
|
||||
} else {
|
||||
$this->out("Command '" . $this->args[1] . "' not found");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class AddTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
if ($this->params['g']) {
|
||||
$this->__handle($this->args[0], NULL, true, $this->args[1], $this->args[2]);
|
||||
} else {
|
||||
$this->__handle($this->args[0], $this->args[1], false, $this->args[2], $this->args[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
while(0==0) {
|
||||
$question = "Enter address:";
|
||||
$address = $this->in($question);
|
||||
|
||||
if(preg_match("/^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/", $address) == 1)
|
||||
break;
|
||||
|
||||
$this->err("Invalid emailaddress");
|
||||
|
||||
}
|
||||
$question = "Do you want to generate a random password?";
|
||||
$random = $this->in($question, array('y','n'));
|
||||
|
||||
$random == 'y' ? $random = true : $random = false;
|
||||
|
||||
|
||||
$password = NULL;
|
||||
if ($random == false) {
|
||||
$question = "Enter the password:";
|
||||
$password = $this->in($question);
|
||||
}
|
||||
|
||||
$question = "Enter name:";
|
||||
$name = $this->in($question);
|
||||
|
||||
$question = "Enter quota (MB):";
|
||||
$quota = $this->in($question);
|
||||
|
||||
$question1[] = "Do you reallywant to add mailbox with this options?";
|
||||
$question1[] = "Address: \t$address";
|
||||
if($random)
|
||||
$question1[] = "Random Password.";
|
||||
else
|
||||
$question1[] = "Password: \t$password";
|
||||
$question1[] = "Name: \t$name";
|
||||
$question1[] = "Quota: \t$quota MB";
|
||||
$create = $this->in(join("\n", $question1), array('y','n'));
|
||||
|
||||
$create == 'y' ? $random = true : $random = false;
|
||||
|
||||
if ($create)
|
||||
$this->__handle($address, $password, $random, $name, $quota);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address, $password, $gen = false, $name = '', $quota = 0) {
|
||||
$pw = NULL;
|
||||
if ($gen) {
|
||||
$pw = generate_password();
|
||||
} elseif ($password != NULL) {
|
||||
$pw = $password;
|
||||
}
|
||||
|
||||
$handler = new UserHandler($address);
|
||||
$return = $handler->add($pw, $name, $quota, true, true );
|
||||
|
||||
if($return == 1) {
|
||||
$this->err(join("\n", $handler->errormsg));
|
||||
} else {
|
||||
$this->out("");
|
||||
if ($name != '')
|
||||
$this->out("Mailbox for $name generated.");
|
||||
else
|
||||
$this->out("Mailbox generated.");
|
||||
$this->hr();
|
||||
$this->out(sprintf('Mailaddress: %-20s', $address));
|
||||
$this->out(sprintf('Password: %-20s',$pw));
|
||||
$this->out(sprintf('Quota: %-20sMB',$quota));
|
||||
$this->hr();
|
||||
}
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user add <address> [<password>] <name> <quota> [-g]");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tadd\n\t\tAdds mailbox in interactive mode.");
|
||||
$this->out("\n\tadd <address> [<password>] [-g] <name> <quota>\n\t\tAdds mailbox for <address> with password <password> of if -g with rand pw. <quota> in MB.");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class UpdateTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->help();
|
||||
//$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$this->help();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Not Implemented yet! If you want to change a password use the password command.");
|
||||
/*$this->out("Usage: postfixadmin-cli user update <args>");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tmodel\n\t\tbakes model in interactive mode.");
|
||||
$this->out("\n\tmodel <name>\n\t\tbakes model file with no associations or validation");
|
||||
$this->out("");*/
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class DeleteTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$output = $this->__handle($this->args[0]);
|
||||
$this->out($output);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
$question[] = "Which Address do you want to view?";
|
||||
|
||||
$address = $this->in(join("\n", $question));
|
||||
|
||||
|
||||
$question = "Do you really want to delete mailbox of '$address'?";
|
||||
|
||||
$create = $this->in($question, array('y','n'));
|
||||
|
||||
$create == 'y' ? $random = true : $random = false;
|
||||
|
||||
if ($create)
|
||||
$this->__handle($address);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address) {
|
||||
|
||||
|
||||
$handler = new UserHandler($address);
|
||||
$status = $handler->delete();
|
||||
if ($status == 0) {
|
||||
$this->out("Mailbox of '$address' was deleted.");
|
||||
|
||||
} else {
|
||||
$this->err(join("\n", $handler->errormsg));
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user model <arg1>");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tdelete\n\t\tdeletes mailbox in interactive mode.");
|
||||
$this->out("\n\tdelete <address>\n\t\tdeletes mailbox with address <address>");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class PasswordTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
|
||||
$address = $this->args[0];
|
||||
|
||||
if (isset($this->params['g']) && $this->params['g'] == true ) {
|
||||
$random = true;
|
||||
$password = NULL;
|
||||
} elseif (isset($this->args[1]) && length($this->args[1]) > 8) {
|
||||
$password = $this->args[1];
|
||||
} else {
|
||||
|
||||
$this->Dispatch->stderr('Missing <newpw> or -g. Falling back to interactive mode.');
|
||||
$this->__interactive();
|
||||
}
|
||||
$this->__handle($address, $password, $random);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
|
||||
while(0==0) {
|
||||
$question = "Which address' password do you want to change?";
|
||||
$address = $this->in($question);
|
||||
|
||||
if(preg_match("/^((?:(?:(?:[a-zA-Z0-9][\.\-\+_]?)*)[a-zA-Z0-9])+)\@((?:(?:(?:[a-zA-Z0-9][\.\-_]?){0,62})[a-zA-Z0-9])+)\.([a-zA-Z0-9]{2,6})$/", $address) == 1)
|
||||
break;
|
||||
|
||||
$this->err("Invalid emailaddress");
|
||||
|
||||
}
|
||||
|
||||
|
||||
$question2[] = "Do you want to change the password?";
|
||||
$question2[] = "Are you really sure?";
|
||||
$sure = $this->in(join("\n", $question2), array('y','n'));
|
||||
|
||||
|
||||
if ($sure == 'n' ) {
|
||||
$this->out('You\'re not sure.');
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
$question = "Do you want to generate a random password?";
|
||||
$random = $this->in($question, array('y','n'));
|
||||
|
||||
$random == 'y' ? $random = true : $random = false;
|
||||
|
||||
|
||||
$password = NULL;
|
||||
if ($random == false) {
|
||||
$question = "Pleas enter the new password?";
|
||||
$password = $this->in($question);
|
||||
}
|
||||
var_dump($random);
|
||||
$this->__handle($address, $password, $random);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address, $password = NULL, $random = false) {
|
||||
|
||||
if ($random == true) {
|
||||
$password = generate_password();
|
||||
}
|
||||
if ($password != NULL) {
|
||||
$handler = new UserHandler($address);
|
||||
|
||||
if ($handler->change_pw($password, NULL, false) == 1){
|
||||
$this->error("Change Password",join("\n", $handler->errormsg));
|
||||
}
|
||||
}
|
||||
|
||||
$this->out("");
|
||||
$this->out("Password updated.");
|
||||
$this->hr();
|
||||
$this->out(sprintf('The Mail address is %20s', $address));
|
||||
$this->out(sprintf('The new password is %20s',$password));
|
||||
$this->hr();
|
||||
|
||||
return ;
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->out("");
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user password <address> [<newpw>] [-g]");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tpassword\n\t\tchanges the password in interactive mode.");
|
||||
$this->out("\n\tpassword <address> [<newpw>] [-g]\n\t\tchanges the password to <newpw> or if -g genereate a new pw for <address>");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
||||
class ViewTask extends Shell {
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function execute() {
|
||||
|
||||
if (empty($this->args)) {
|
||||
$this->__interactive();
|
||||
}
|
||||
|
||||
if (!empty($this->args[0])) {
|
||||
$output = $this->__handle($this->args[0]);
|
||||
$this->out($output);
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __interactive() {
|
||||
$question[] = "Which Address do you want to view?";
|
||||
|
||||
$address = $this->in(join("\n", $question));
|
||||
|
||||
$this->__handle($address);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* Interactive
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
function __handle($address) {
|
||||
|
||||
|
||||
$handler = new UserHandler($address);
|
||||
$status = $handler->view();
|
||||
if ($status == 0) {
|
||||
$result = $handler->return;
|
||||
$this->out(sprintf("Entries for: %s\n", $address));
|
||||
$this->out("");
|
||||
$this->out(sprintf("+%'-25s+%'-15s+%'-10s+%'-20s+%'-8s+%'-8s+%'-6s+",'','','','','','',''));
|
||||
$this->out(sprintf('|%25s|%15s|%10s|%20s|%8s|%8s|%6s|', 'Address', 'Name', 'Quota', 'Dir', 'Created', 'Modified', 'Active'));
|
||||
$this->out(sprintf("+%'-25s+%'-15s+%'-10s+%'-20s+%'-8s+%'-8s+%'-6s+",'','','','','','',''));
|
||||
$this->out(sprintf('|%25s|%15s|%10s|%20s|%8s|%8s|%6s|', $result['username'], $result['name'], $result['quota'], $result['maildir'], $result['created'], $result['modified'], $result['active']));
|
||||
$this->out(sprintf("+%'-25s+%'-15s+%'-10s+%'-20s+%'-8s+%'-8s+%'-6s+",'','','','','','',''));
|
||||
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
/**
|
||||
* Displays help contents
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function help() {
|
||||
$this->out("");
|
||||
$this->hr();
|
||||
$this->out("Usage: postfixadmin-cli user view <address>");
|
||||
$this->hr();
|
||||
$this->out('Commands:');
|
||||
$this->out("\n\tview\n\t\tView user. Select address in interactive mode.");
|
||||
$this->out("\n\tview <address>\n\t\tView user with address <address>");
|
||||
$this->out("");
|
||||
$this->_stop();
|
||||
}
|
||||
|
||||
}
|
@ -349,7 +349,7 @@ else
|
||||
$table_domain = table_by_key('domain');
|
||||
$r = db_query("SELECT * FROM $table_domain WHERE domain = 'ALL'");
|
||||
if($r['rows'] == 0) {
|
||||
db_insert($table_domain, array('domain' => 'ALL')); // all other fields should default through the schema.
|
||||
db_insert('domain', array('domain' => 'ALL')); // all other fields should default through the schema.
|
||||
}
|
||||
|
||||
list ($error, $tMessage, $pAdminCreate_admin_username_text, $pAdminCreate_admin_password_text) = create_admin($fUsername, $fPassword, $fPassword2, array('ALL'), TRUE);
|
||||
|
@ -22,7 +22,7 @@ class PFASmarty extends Smarty {
|
||||
* */
|
||||
public function sanitise($data) {
|
||||
if(!is_array($data)) {
|
||||
return htmlentities($data, ENT_QUOTES, 'UTF-8');
|
||||
return htmlentities($data, ENT_QUOTES, 'UTF-8', false);
|
||||
}
|
||||
if(is_array($data)) {
|
||||
$clean = array();
|
||||
|
@ -10,11 +10,6 @@
|
||||
<td>{$fUsername}</td>
|
||||
<td>{$pEdit_mailbox_username_text}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$PALANG.pPassword_password_current}:</td>
|
||||
<td>{$fPassword}</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$PALANG.pEdit_mailbox_password}:</td>
|
||||
<td><input class="flat" type="password" name="fPassword" /></td>
|
||||
|
@ -47,7 +47,7 @@
|
||||
{/if}
|
||||
{if $tab=='mailbox'}
|
||||
{$nav_bar_mailbox.top}
|
||||
{assign var="colspan" value=8}
|
||||
{assign var="colspan" value=9}
|
||||
{if $CONF.vacation_control_admin===YES}{assign var="colspan" value="`$colspan+1`"}{/if}
|
||||
{if $CONF.alias_control_admin===YES}{assign var="colspan" value="`$colspan+1`"}{/if}
|
||||
<table id="mailbox_table">
|
||||
|
@ -13,14 +13,26 @@
|
||||
{if $CONF.show_status===YES}
|
||||
<td>{$gen_show_status[$i]}</td>
|
||||
{/if}
|
||||
<td>{$item.address}</td>
|
||||
<td>
|
||||
{if $search eq ""}
|
||||
{$item.address}
|
||||
{else}
|
||||
{$item.address|replace:$search:"<span class='searchresult'>$search</span>"}
|
||||
{/if}
|
||||
</td>
|
||||
{if $CONF.alias_goto_limit>0}
|
||||
<td><i>sorry, alias_goto_limit > 0 not handled</i></td>
|
||||
{else}
|
||||
<td>{$item.goto|replace:",":"<br/>"}</td>
|
||||
<td>
|
||||
{if $search eq ""}
|
||||
{$item.goto|replace:",":"<br/>"}
|
||||
{else}
|
||||
{$item.goto|replace:",":"<br/>"|replace:$search:"<span class='searchresult'>$search</span>"}
|
||||
{/if}
|
||||
</td>
|
||||
{/if}
|
||||
<td>{$item.modified}</td>
|
||||
{if $authentication_has_role.global_admin===true}
|
||||
{if $authentication_has_role.global_admin==true}
|
||||
{assign var="address" value=$item.address|escape:"url"}
|
||||
<td><a href="edit-active.php?alias={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}&return={$file|escape:"url"}?domain={$fDomain|escape:"url"}&limit={$current_limit|escape:"url"}">{if $item.active==1}{$PALANG.YES}{else}{$PALANG.NO}{/if}</a></td>
|
||||
<td><a href="edit-alias.php?address={$item.address|escape:"url"}&domain={$fDomain|escape:"url"}">{$PALANG.edit}</a></td>
|
||||
|
@ -13,7 +13,13 @@
|
||||
</tr>
|
||||
{foreach from=$tAliasDomains item=item}
|
||||
{#tr_hilightoff#}
|
||||
<td><a href="{$smarty.config.url_list_virtual}?domain={$item.alias_domain|escape:"url"}&limit={$current_limit|escape:"url"}">{$item.alias_domain}</a></td>
|
||||
<td><a href="{$smarty.config.url_list_virtual}?domain={$item.alias_domain|escape:"url"}&limit={$current_limit|escape:"url"}">
|
||||
{if $search eq ""}
|
||||
{$item.alias_domain}
|
||||
{else}
|
||||
{$item.alias_domain|replace:$search:"<span class='searchresult'>$search</span>"}
|
||||
{/if}
|
||||
</a></td>
|
||||
<td>{$item.modified}</td>
|
||||
<td><a href="{#url_edit_active#}?alias_domain=true&domain={$item.alias_domain|escape:"url"}&return={$smarty.config.url_list_virtual|escape:"url"}?domain={$fDomain|escape:"url"}&limit={$current_limit|escape:"url"}">{if $item.active==1}{$PALANG.YES}{else}{$PALANG.NO}{/if}</a></td>
|
||||
<td><a href="{#url_delete#}?table=alias_domain&delete={$item.alias_domain|escape:"url"}&domain={$item.alias_domain|escape:"url"}" onclick="return confirm ('{$PALANG.confirm}{$PALANG.pOverview_get_alias_domains}: {$item.alias_domain}');">{$PALANG.del}</a></td>
|
||||
|
@ -16,16 +16,27 @@
|
||||
{if $CONF.show_status===YES}
|
||||
<td>{$gen_show_status_mailbox[$i]}</td>
|
||||
{/if}
|
||||
<td>{$item.username}</td>
|
||||
<td>
|
||||
{if $search eq ""}
|
||||
{$item.username}
|
||||
{else}
|
||||
{$item.username|replace:$search:"<span class='searchresult'>$search</span>"}
|
||||
{/if}
|
||||
</td>
|
||||
{if $display_mailbox_aliases==true}
|
||||
<td>
|
||||
{if $item.goto_mailbox == 1}
|
||||
Mailbox<br/>
|
||||
{else}
|
||||
Forward only<br/>
|
||||
{/if}
|
||||
{foreach from=$item.goto_other item=item2 key=j}
|
||||
{if $item.goto_mailbox == 1}
|
||||
Mailbox<br/>
|
||||
{else}
|
||||
Forward only<br/>
|
||||
{/if}
|
||||
{$item2}<br/>
|
||||
{if $search eq ""}
|
||||
{$item2}
|
||||
{else}
|
||||
{$item2|replace:$search:"<span class='searchresult'>$search</span>"}
|
||||
{/if}
|
||||
<br/>
|
||||
{/foreach}
|
||||
</td>
|
||||
{/if}
|
||||
@ -48,9 +59,9 @@
|
||||
{if $CONF.vacation_control_admin===YES && $CONF.vacation===YES}
|
||||
{if $item.v_active!==-1}
|
||||
{if $item.v_active==1}
|
||||
{assign var="v_active" value=$PALANG.pOverview_vacation_edit"}
|
||||
{assign var="v_active" value=$PALANG.pOverview_vacation_edit}
|
||||
{else}
|
||||
{assign var="v_active" value=$PALANG.pOverview_vacation_option"}
|
||||
{assign var="v_active" value=$PALANG.pOverview_vacation_option}
|
||||
{/if}
|
||||
<td><a href="edit-vacation.php?username={$item.username|escape:"url"}&domain={$fDomain|escape:"url"}">{$v_active}</a></td>
|
||||
{/if}
|
||||
|
@ -6,7 +6,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$PALANG.pLogin_username}:</td>
|
||||
<td><input class="flat" type="text" name="fUsername" value="{$tUsername}" /></td>
|
||||
<td><input class="flat" type="text" name="fUsername" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{$PALANG.pLogin_password}:</td>
|
||||
|
@ -24,4 +24,3 @@
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{$smarty_template}
|
@ -79,14 +79,22 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
|
||||
$goto = explode(",",$goto);
|
||||
|
||||
$error = 0;
|
||||
$goto = array_merge(array_unique($goto));
|
||||
$good_goto = array();
|
||||
|
||||
if($fForward_and_store == 'NO' && sizeof($goto) == 1 && $goto[0] == '') {
|
||||
$tMessage = $PALANG['pEdit_alias_goto_text_error1'];
|
||||
$error += 1;
|
||||
}
|
||||
if($error === 0) {
|
||||
foreach($goto as $address) {
|
||||
if ($address != "") { # $goto[] may contain a "" element
|
||||
# TODO - from https://sourceforge.net/tracker/?func=detail&aid=3027375&group_id=191583&atid=937964
|
||||
# The not-so-good news is that some internals of edit-alias aren't too nice
|
||||
# - for example, $goto[] can contain an element with empty string. I added a
|
||||
# check for that in the 2.3 branch, but we should use a better solution
|
||||
# (avoid empty elements in $goto) in trunk ;-)
|
||||
if(!check_email($address)) {
|
||||
$error += 1;
|
||||
$tMessage = $PALANG['pEdit_alias_goto_text_error2'] . " $address</font>";
|
||||
@ -94,8 +102,8 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
else {
|
||||
$good_goto[] = $address;
|
||||
}
|
||||
}
|
||||
}
|
||||
$goto = $good_goto;
|
||||
}
|
||||
|
||||
if ($error == 0) {
|
||||
@ -103,7 +111,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
if($fForward_and_store == "YES" ) {
|
||||
$flags = 'forward_and_store';
|
||||
}
|
||||
$updated = $ah->update($goto, $flags);
|
||||
$updated = $ah->update($good_goto, $flags);
|
||||
if($updated) {
|
||||
header ("Location: main.php");
|
||||
exit;
|
||||
|
@ -28,4 +28,3 @@ header ("Location: login.php");
|
||||
exit;
|
||||
|
||||
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|
||||
?>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user