postfixadmin-svn Mailing List for PostfixAdmin (Page 112)
Brought to you by:
christian_boltz,
gingerdog
You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(13) |
Oct
(63) |
Nov
(79) |
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(15) |
Feb
(8) |
Mar
(8) |
Apr
(44) |
May
(18) |
Jun
(20) |
Jul
(35) |
Aug
(21) |
Sep
(8) |
Oct
(9) |
Nov
(21) |
Dec
(14) |
2009 |
Jan
(53) |
Feb
(13) |
Mar
(36) |
Apr
(40) |
May
(22) |
Jun
(10) |
Jul
(18) |
Aug
(18) |
Sep
(7) |
Oct
(26) |
Nov
(32) |
Dec
(13) |
2010 |
Jan
(6) |
Feb
(7) |
Mar
(12) |
Apr
(2) |
May
(12) |
Jun
(8) |
Jul
(9) |
Aug
(12) |
Sep
(12) |
Oct
(7) |
Nov
(9) |
Dec
(42) |
2011 |
Jan
(10) |
Feb
(35) |
Mar
(43) |
Apr
(39) |
May
(8) |
Jun
(8) |
Jul
(83) |
Aug
(20) |
Sep
(20) |
Oct
(63) |
Nov
(33) |
Dec
(20) |
2012 |
Jan
(28) |
Feb
(3) |
Mar
(1) |
Apr
(37) |
May
(16) |
Jun
(7) |
Jul
(3) |
Aug
|
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(4) |
2013 |
Jan
(6) |
Feb
(16) |
Mar
(9) |
Apr
(11) |
May
(9) |
Jun
(30) |
Jul
(17) |
Aug
(6) |
Sep
(2) |
Oct
(30) |
Nov
(41) |
Dec
(26) |
2014 |
Jan
(16) |
Feb
(20) |
Mar
(5) |
Apr
(4) |
May
(14) |
Jun
(4) |
Jul
(1) |
Aug
|
Sep
(8) |
Oct
(18) |
Nov
(26) |
Dec
|
2015 |
Jan
(4) |
Feb
(9) |
Mar
(12) |
Apr
(26) |
May
(3) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
(15) |
Oct
(13) |
Nov
|
Dec
(1) |
2016 |
Jan
(1) |
Feb
(5) |
Mar
(4) |
Apr
(3) |
May
(19) |
Jun
|
Jul
|
Aug
(3) |
Sep
(16) |
Oct
(4) |
Nov
(5) |
Dec
(5) |
2017 |
Jan
(1) |
Feb
(8) |
Mar
|
Apr
(7) |
May
(3) |
Jun
(16) |
Jul
(13) |
Aug
(16) |
Sep
(6) |
Oct
(4) |
Nov
(10) |
Dec
(7) |
2018 |
Jan
(16) |
Feb
(17) |
Mar
(11) |
Apr
(13) |
May
(20) |
Jun
(3) |
Jul
(10) |
Aug
|
Sep
(3) |
Oct
(1) |
Nov
(6) |
Dec
(18) |
2019 |
Jan
(18) |
Feb
(31) |
Mar
(4) |
Apr
(4) |
May
(1) |
Jun
(8) |
Jul
(7) |
Aug
(10) |
Sep
(23) |
Oct
(6) |
Nov
(3) |
Dec
(5) |
2020 |
Jan
(10) |
Feb
(18) |
Mar
(34) |
Apr
(19) |
May
(6) |
Jun
(9) |
Jul
|
Aug
(10) |
Sep
(16) |
Oct
(6) |
Nov
(3) |
Dec
(11) |
2021 |
Jan
(118) |
Feb
(22) |
Mar
(13) |
Apr
(12) |
May
(48) |
Jun
(21) |
Jul
(17) |
Aug
(12) |
Sep
(19) |
Oct
(25) |
Nov
(16) |
Dec
(7) |
2022 |
Jan
(6) |
Feb
(7) |
Mar
(14) |
Apr
(4) |
May
|
Jun
(16) |
Jul
(18) |
Aug
(5) |
Sep
(12) |
Oct
(8) |
Nov
(10) |
Dec
(13) |
2023 |
Jan
|
Feb
(3) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(6) |
Jul
(3) |
Aug
(3) |
Sep
(3) |
Oct
(2) |
Nov
(7) |
Dec
(13) |
2024 |
Jan
(8) |
Feb
(6) |
Mar
(5) |
Apr
(10) |
May
(8) |
Jun
(6) |
Jul
(2) |
Aug
(1) |
Sep
(2) |
Oct
(4) |
Nov
(15) |
Dec
(10) |
2025 |
Jan
(3) |
Feb
(12) |
Mar
(3) |
Apr
(7) |
May
(18) |
Jun
(10) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <Gin...@us...> - 2007-11-04 19:46:33
|
Revision: 193 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=193&view=rev Author: GingerDog Date: 2007-11-04 11:46:37 -0800 (Sun, 04 Nov 2007) Log Message: ----------- search.php: remove dead code, fix for pgsql Modified Paths: -------------- trunk/search.php Modified: trunk/search.php =================================================================== --- trunk/search.php 2007-11-04 19:35:09 UTC (rev 192) +++ trunk/search.php 2007-11-04 19:46:37 UTC (rev 193) @@ -89,23 +89,14 @@ } -/* - - */ - if ($CONF['vacation_control_admin'] == 'YES') + if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == 'YES') { $query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.username LIKE '%$fSearch%' OR $table_mailbox.name LIKE '%$fSearch%' ORDER BY $table_mailbox.username"); - # TODO: special query for pgsql needed? + echo $query; } else { $query = "SELECT * FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username"; - /* TODO: special query for pgsql really needed? - if ('pgsql'==$CONF['database_type']) - { - $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE username LIKE '%$fSearch%' OR name LIKE '%$fSearch%' ORDER BY username"; - } - */ } $result = db_query ($query); @@ -117,15 +108,9 @@ { if ('pgsql'==$CONF['database_type']) { - $row['created']=gmstrftime('%c %Z',$row['created']); - $row['modified']=gmstrftime('%c %Z',$row['modified']); - # TODO: code from admin/search.php - # $row['created']=gmstrftime('%c %Z',$row['uts_created']); - # $row['modified']=gmstrftime('%c %Z',$row['uts_modified']); + $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); + $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); $row['active']=('t'==$row['active']) ? 1 : 0; - # TODO: code from admin/search.php - # unset($row['uts_created']); - # unset($row['uts_modified']); } $tMailbox[] = $row; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-04 19:35:15
|
Revision: 192 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=192&view=rev Author: GingerDog Date: 2007-11-04 11:35:09 -0800 (Sun, 04 Nov 2007) Log Message: ----------- list-virtual.tpl: only display vacation stuff if vacation support is enabled Modified Paths: -------------- trunk/templates/list-virtual.tpl Modified: trunk/templates/list-virtual.tpl =================================================================== --- trunk/templates/list-virtual.tpl 2007-11-04 19:34:45 UTC (rev 191) +++ trunk/templates/list-virtual.tpl 2007-11-04 19:35:09 UTC (rev 192) @@ -236,7 +236,7 @@ $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; - if ($CONF['vacation_control_admin'] == 'YES') + if ($CONF['vacation_control_admin'] == 'YES' && $CONF['vacation'] == 'YES') { $v_active_int = $tMailbox[$i]['v_active']; if($v_active_int !== -1) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-04 19:34:40
|
Revision: 191 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=191&view=rev Author: GingerDog Date: 2007-11-04 11:34:45 -0800 (Sun, 04 Nov 2007) Log Message: ----------- list-virtual.php: fix logic for display of vacation stuff Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2007-11-04 19:22:58 UTC (rev 190) +++ trunk/list-virtual.php 2007-11-04 19:34:45 UTC (rev 191) @@ -110,13 +110,14 @@ { if ('pgsql'==$CONF['database_type']) { + //var_dump($row); $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); $row['active']=('t'==$row['active']) ? 1 : 0; - $row['v_active'] = 1; // default to off... TODO: 1 is NOT off - if(isset($row['v_active'])) { /* key may not be present in results due to query from above */ - $row['v_active']=('t'==$row['v_active']) ? 1 : 0; + if($row['v_active'] == NULL) { + $row['v_active'] = 'f'; } + $row['v_active']=('t'==$row['v_active']) ? 1 : 0; } $tMailbox[] = $row; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-04 19:22:55
|
Revision: 190 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=190&view=rev Author: GingerDog Date: 2007-11-04 11:22:58 -0800 (Sun, 04 Nov 2007) Log Message: ----------- list-virtual.php: remove unnecessary todo Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2007-11-04 19:13:42 UTC (rev 189) +++ trunk/list-virtual.php 2007-11-04 19:22:58 UTC (rev 190) @@ -64,9 +64,6 @@ if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[0]; - -if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[1]; # TODO: should never happen?!? ($fDomain should already be filled by the line above) - if (!check_owner(authentication_get_username(), $fDomain)) { # die($PALANG['invalid_parameter']); header("Location: list-domain.php"); # domain not owned by this admin This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-04 19:14:26
|
Revision: 189 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=189&view=rev Author: GingerDog Date: 2007-11-04 11:13:42 -0800 (Sun, 04 Nov 2007) Log Message: ----------- list-virtual.php: fix unnecessary clause for psql query, that is not needed Modified Paths: -------------- trunk/list-virtual.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2007-11-04 16:46:43 UTC (rev 188) +++ trunk/list-virtual.php 2007-11-04 19:13:42 UTC (rev 189) @@ -94,12 +94,7 @@ if ($CONF['vacation_control_admin'] == 'YES') { - $query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $fDisplay, $page_size"); - if ('pgsql'==$CONF['database_type']) - { - //TODO/FIXME: postgres query needs to be rewrited - $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay"; - } + $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; } else { @@ -118,10 +113,10 @@ { if ('pgsql'==$CONF['database_type']) { - $row['created']=gmstrftime('%c %Z',$row['uts_created']); - $row['modified']=gmstrftime('%c %Z',$row['uts_modified']); + $row['created']=gmstrftime('%c %Z',strtotime($row['created'])); + $row['modified']=gmstrftime('%c %Z',strtotime($row['modified'])); $row['active']=('t'==$row['active']) ? 1 : 0; - $row['v_active'] = 1; // default to off... TODO: 1 is NOT off + $row['v_active'] = 1; // default to off... TODO: 1 is NOT off if(isset($row['v_active'])) { /* key may not be present in results due to query from above */ $row['v_active']=('t'==$row['v_active']) ? 1 : 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-04 16:46:41
|
Revision: 188 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=188&view=rev Author: GingerDog Date: 2007-11-04 08:46:43 -0800 (Sun, 04 Nov 2007) Log Message: ----------- debian: adding - initial support for creating .debs; run dpkg-buildpakcage -rfakeroot within the trunk dir Added Paths: ----------- trunk/debian/ trunk/debian/README.Debian trunk/debian/apache-conf trunk/debian/changelog trunk/debian/compat trunk/debian/conffiles trunk/debian/control trunk/debian/copyright trunk/debian/docs trunk/debian/files trunk/debian/postfixadmin.dirs trunk/debian/rules Added: trunk/debian/README.Debian =================================================================== --- trunk/debian/README.Debian (rev 0) +++ trunk/debian/README.Debian 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,30 @@ +PostfixAdmin for Debian +======================= + +After installing the package, you should find that : + +http://youserver/postfixadmin/setup.php works. This should +guide you through the appropriate process. + +You will need to create a database (either MySQL or PostgreSQL) +and know the username and password for it. The Database does not need +to be on the same server as the Postfixadmin install. + + + +Recommended and Suggested Packages +================================== + + - Postfix + - MySQL or PostgreSQL + - Courier or Dovecot + +Where to get help +================= + +The first stop would be the Postfixadmin Website, Forum or IRC channel. + +See : + - http://postfixadmin.sf.net + - #postfixadmin on irc.freenode.net + Added: trunk/debian/apache-conf =================================================================== --- trunk/debian/apache-conf (rev 0) +++ trunk/debian/apache-conf 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,6 @@ +# BEGIN FOR POSTFIXADMIN + +Alias /postfixadmin /usr/share/postfixadmin + + +# END FOR POSTFIXADMIN Added: trunk/debian/changelog =================================================================== --- trunk/debian/changelog (rev 0) +++ trunk/debian/changelog 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,6 @@ +postfixadmin (2.2.0-1rc1) unstable; urgency=low + + * Initial Release (via dpkg) + + -- David Goodwin <da...@co...> Sun, 04 Nov 2007 15:36:00 +0000 + Added: trunk/debian/compat =================================================================== --- trunk/debian/compat (rev 0) +++ trunk/debian/compat 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1 @@ +5 Added: trunk/debian/conffiles =================================================================== --- trunk/debian/conffiles (rev 0) +++ trunk/debian/conffiles 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,2 @@ +/etc/apache2/conf.d/postfixadmin +/etc/postfixadmin/config.inc.php Added: trunk/debian/control =================================================================== --- trunk/debian/control (rev 0) +++ trunk/debian/control 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,25 @@ +Source: postfixadmin +Section: web +Priority: optional +Maintainer: David Goodwin <da...@co...> +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.2 + +Package: postfixadmin +Architecture: all +Depends: apache2 | httpd, libapache2-mod-php4 | libapache-mod-php4 | php4 | php4-cgi | libapache2-mod-php5 | libapache-mod-php5 | php5-cgi | php5, ${misc:Depends} +Recommends: squirrelmail-locales, ispell | aspell | aspell-bin, perl, postfix, postgresql-server, mysql-server +Suggests: +Description: Virtual mail hosting interface for Postfix + Postfixadmin is a web interface to managing virtual users and domains + for a Postfix mailserver. The web interface is written in PHP. + Postfixadmin allows administrators to delegate handling a domain to domain + administrators. + Postfixadmin allows users to login and change their own settings (e.g. forward, + vacation, password etc). + Postfixadmin also includes support for virtual vacation support - + this requires Perl and various CPAN modules to be installed. + See vacation.pl for further details. + . + Homepage: http://postfixadmin.sf.net/ + Added: trunk/debian/copyright =================================================================== --- trunk/debian/copyright (rev 0) +++ trunk/debian/copyright 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,30 @@ +This package was debianized by David Goodwin <da...@co...> on +Sun, 04 Nov 2007 15:21:00 +0000. + +It was downloaded from subversion, via http://postfixadmin.sf.net + +Upstream Authors: The PostfixAdmin Development Team <pos...@li...> + +Copyright: + + Copyright (C) 2007 The Postfixadmin Project Team + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +On Debian GNU/Linux systems, the complete text of the GNU General Public +License can be found in the `/usr/share/common-licenses' directory. + +The Debian packaging of Postfixadmin is licensed under the same terms +as Postfixadmin itself. Added: trunk/debian/docs =================================================================== --- trunk/debian/docs (rev 0) +++ trunk/debian/docs 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,6 @@ +VIRTUAL_VACATION +DOCUMENTS +ADDITIONS +LICENSE.TXT +INSTALL.TXT +GPL-LICENSE.TXT Property changes on: trunk/debian/docs ___________________________________________________________________ Name: svn:executable + * Added: trunk/debian/files =================================================================== --- trunk/debian/files (rev 0) +++ trunk/debian/files 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1 @@ +postfixadmin_2.2.0-1rc1_all.deb web optional Added: trunk/debian/postfixadmin.dirs =================================================================== --- trunk/debian/postfixadmin.dirs (rev 0) +++ trunk/debian/postfixadmin.dirs 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,3 @@ +usr/share/postfixadmin +usr/share/doc/postfixadmin +etc/postfixadmin Added: trunk/debian/rules =================================================================== --- trunk/debian/rules (rev 0) +++ trunk/debian/rules 2007-11-04 16:46:43 UTC (rev 188) @@ -0,0 +1,57 @@ +#!/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 + touch build-stamp + +clean: + dh_testdir + dh_testroot + rm -f build-stamp + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + dh_install + cp *.php debian/postfixadmin/usr/share/postfixadmin + mv debian/postfixadmin/usr/share/postfixadmin/config.inc.php debian/postfixadmin/etc/postfixadmin/config.inc.php + ln -s /etc/postfixadmin/config.inc.php debian/postfixadmin/usr/share/postfixadmin/config.inc.php + cp -a admin debian/postfixadmin/usr/share/postfixadmin + cp -a images debian/postfixadmin/usr/share/postfixadmin + cp -a languages debian/postfixadmin/usr/share/postfixadmin + cp -a templates debian/postfixadmin/usr/share/postfixadmin + cp -a users debian/postfixadmin/usr/share/postfixadmin + mkdir -p debian/postfixadmin/etc/apache2/conf.d + cp debian/apache-conf debian/postfixadmin/etc/apache2/conf.d/postfixadmin + find debian/postfixadmin -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 Property changes on: trunk/debian/rules ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-04 01:00:45
|
Revision: 187 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=187&view=rev Author: christian_boltz Date: 2007-11-03 18:00:50 -0700 (Sat, 03 Nov 2007) Log Message: ----------- edit-vacation.php: - changed redirect targets to list-virtual.php Modified Paths: -------------- trunk/edit-vacation.php Modified: trunk/edit-vacation.php =================================================================== --- trunk/edit-vacation.php 2007-11-04 00:54:09 UTC (rev 186) +++ trunk/edit-vacation.php 2007-11-04 01:00:50 UTC (rev 187) @@ -38,7 +38,7 @@ require_once('common.php'); if($CONF['vacation'] == 'NO') { - header("Location: " . $CONF['postfix_admin_url'] . "/main.php"); # TODO + header("Location: " . $CONF['postfix_admin_url'] . "/list-virtual.php"); exit(0); } @@ -60,7 +60,7 @@ $vacation_goto = preg_replace('/@/', '#', $fUsername); $vacation_goto = $vacation_goto . '@' . $vacation_domain; -$fCanceltarget = $CONF['postfix_admin_url'] . '/main.php'; # TODO +$fCanceltarget = $CONF['postfix_admin_url'] . "/list-virtual.php?domain=$fDomain"; if ($_SERVER['REQUEST_METHOD'] == "GET") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-04 00:54:05
|
Revision: 186 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=186&view=rev Author: christian_boltz Date: 2007-11-03 17:54:09 -0700 (Sat, 03 Nov 2007) Log Message: ----------- OOps. Removed forgotten debugging code again. Modified Paths: -------------- trunk/functions.inc.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2007-11-04 00:53:13 UTC (rev 185) +++ trunk/functions.inc.php 2007-11-04 00:54:09 UTC (rev 186) @@ -1537,6 +1537,8 @@ */ function db_insert ($table, $values, $timestamp = array()) { + $table = table_by_key ($table); + foreach(array_keys($values) as $key) { $values[$key] = "'" . escape_string($values[$key]) . "'"; } @@ -1547,8 +1549,6 @@ $sql_values = "(" . implode(",",escape_string(array_keys($values))).") VALUES (".implode(",",$values).")"; - $table = table_by_key ($table); -echo "*** $sql_values ***"; exit; $result = db_query ("INSERT INTO $table $sql_values"); return $result['rows']; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-04 00:53:11
|
Revision: 185 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=185&view=rev Author: christian_boltz Date: 2007-11-03 17:53:13 -0700 (Sat, 03 Nov 2007) Log Message: ----------- - fix: password was always changed when editing a mailbox. Thanks to Ryan Wagoner for pointing this out. - first usage of db_update function ;-) Modified Paths: -------------- trunk/edit-mailbox.php Modified: trunk/edit-mailbox.php =================================================================== --- trunk/edit-mailbox.php 2007-11-04 00:50:09 UTC (rev 184) +++ trunk/edit-mailbox.php 2007-11-04 00:53:13 UTC (rev 185) @@ -96,7 +96,9 @@ if($fPassword != $user_details['password']){ if($fPassword == $fPassword2) { - $fPassword = pacrypt($fPassword); + if ($fPassword != "") { + $formvars['password'] = pacrypt($fPassword); + } } else { flash_error($PALANG['pEdit_mailbox_password_text_error']); @@ -137,8 +139,13 @@ $fActive = 0; } - $result = db_query ("UPDATE $table_mailbox SET name='$fName',password='$fPassword',quota=$quota,modified=NOW(),active=$sqlActive WHERE username='$fUsername' AND domain='$fDomain'"); - if ($result['rows'] != 1) { + $formvars['name'] = $fName; + $formvars['quota'] =$quota; + $formvars['active']=$sqlActive; + + $result = db_update ('mailbox', "username='$fUsername' AND domain='$fDomain'", $formvars, array('modified')); + + if ($result != 1) { $tMessage = $PALANG['pEdit_mailbox_result_error']; } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-04 00:50:05
|
Revision: 184 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=184&view=rev Author: christian_boltz Date: 2007-11-03 17:50:09 -0700 (Sat, 03 Nov 2007) Log Message: ----------- functions.php: - new function db_update ($table, $where, $values, $timestamp = array()) to update a database entry with the values given as array - added optional $timestamp parameter to db_insert() Modified Paths: -------------- trunk/functions.inc.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2007-11-03 23:32:36 UTC (rev 183) +++ trunk/functions.inc.php 2007-11-04 00:50:09 UTC (rev 184) @@ -675,7 +675,7 @@ // // check_owner -// Action: Checks if the admin is the owner of the domain. +// Action: Checks if the admin is the owner of the domain (or global-admin) // Call: check_owner (string admin, string domain) // function check_owner ($username, $domain) @@ -1532,21 +1532,54 @@ * Call: db_insert (string table, array values) * @param String $table - table name * @param array - key/value map of data to insert into the table. + * @param array (optional) - array of fields to set to now() + * @return int - number of inserted rows */ -function db_insert ($table, $values) +function db_insert ($table, $values, $timestamp = array()) { - $sql_values = "(" . implode(",",escape_string(array_keys($values))).") VALUES ('".implode("','",escape_string($values))."')"; + foreach(array_keys($values) as $key) { + $values[$key] = "'" . escape_string($values[$key]) . "'"; + } + + foreach($timestamp as $key) { + $values[$key] = "now()"; + } + + $sql_values = "(" . implode(",",escape_string(array_keys($values))).") VALUES (".implode(",",$values).")"; + $table = table_by_key ($table); +echo "*** $sql_values ***"; exit; + $result = db_query ("INSERT INTO $table $sql_values"); + return $result['rows']; +} - $result = db_query ("INSERT INTO $table $sql_values"); - if ($result['rows'] >= 1) - { - return $result['rows']; + +/** + * db_update + * Action: Updates a specified table + * Call: db_update (string table, array values, string where) + * @param String $table - table name + * @param String - WHERE condition + * @param array - key/value map of data to insert into the table. + * @param array (optional) - array of fields to set to now() + * @return int - number of updated rows + */ +function db_update ($table, $where, $values, $timestamp = array()) +{ + $table = table_by_key ($table); + + foreach(array_keys($values) as $key) { + $sql_values[$key] = escape_string($key) . "='" . escape_string($values[$key]) . "'"; } - else - { - return true; + + foreach($timestamp as $key) { + $sql_values[$key] = escape_string($key) . "=now()"; } + + $sql="UPDATE $table SET ".implode(",",$sql_values)." WHERE $where"; + + $result = db_query ($sql); + return $result['rows']; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-03 23:32:32
|
Revision: 183 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=183&view=rev Author: christian_boltz Date: 2007-11-03 16:32:36 -0700 (Sat, 03 Nov 2007) Log Message: ----------- - list all domains for superadmins (instead of none) Modified Paths: -------------- trunk/list-domain.php Modified: trunk/list-domain.php =================================================================== --- trunk/list-domain.php 2007-11-03 22:46:20 UTC (rev 182) +++ trunk/list-domain.php 2007-11-03 23:32:36 UTC (rev 183) @@ -30,23 +30,24 @@ authentication_require_role('admin'); if (authentication_has_role('global-admin')) { - $list_admins = list_admins (); - $is_superadmin = 1; + $list_admins = list_admins (); + $is_superadmin = 1; + $fUsername = safepost('fUsername', safeget('username')); # prefer POST over GET variable + if ($fUsername != "") $admin_properties = get_admin_properties($fUsername); } else { - $list_admins = array(authentication_get_username()); - $is_superadmin = 0; + $list_admins = array(authentication_get_username()); + $is_superadmin = 0; + $fUsername = ""; } -if ($_SERVER['REQUEST_METHOD'] == "POST" && $is_superadmin && isset ($_POST['fUsername'])) { - $fUsername = escape_string ($_POST['fUsername']); +if (isset($admin_properties) && $admin_properties['domain_count'] == 'ALL') { # list all domains for superadmins + $list_domains = list_domains (); +} elseif (!empty($fUsername)) { $list_domains = list_domains_for_admin ($fUsername); -} elseif ($_SERVER['REQUEST_METHOD'] == "GET" && $is_superadmin && isset ($_GET['username'])) { - $fUsername = escape_string ($_GET['username']); - $list_domains = list_domains_for_admin ($fUsername); } elseif ($is_superadmin) { $list_domains = list_domains (); } else { - $list_domains = list_domains_for_admin(authentication_get_username()); + $list_domains = list_domains_for_admin(authentication_get_username()); } if (!empty ($list_domains)) @@ -62,9 +63,11 @@ include ("templates/menu.tpl"); if ($is_superadmin) { - include ("templates/admin_list-domain.tpl"); + include ("templates/admin_list-domain.tpl"); } else { - include ("templates/overview-get.tpl"); + include ("templates/overview-get.tpl"); } include ("templates/footer.tpl"); + +/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-03 22:46:16
|
Revision: 182 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=182&view=rev Author: christian_boltz Date: 2007-11-03 15:46:20 -0700 (Sat, 03 Nov 2007) Log Message: ----------- - upgrade_90(): replace spaces with underscore in log.action (change was caused by translatable logging) Modified Paths: -------------- trunk/upgrade.php Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2007-11-03 22:24:34 UTC (rev 181) +++ trunk/upgrade.php 2007-11-03 22:46:20 UTC (rev 182) @@ -333,6 +333,13 @@ ); } +function upgrade_90() { + # translatable logging + # old format: "create alias" + # new format: "create_alias" + $result = db_query_parsed("UPDATE " . table_by_key ('log') . " SET action = REPLACE(action,' ','_')", TRUE); +} + function upgrade_169_mysql() { # MySQL only # allow quota > 2 GB This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-03 22:24:30
|
Revision: 181 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=181&view=rev Author: christian_boltz Date: 2007-11-03 15:24:34 -0700 (Sat, 03 Nov 2007) Log Message: ----------- merged overview.php into list-domain.php and list-virtual.php list-domain.php: - added several admin/superadmin switches and permission checks - merged GET and POST code - Note: still different templates for superadmins (admin_list-domain.tpl) and admins (overview-get.tpl) because of large layout difference list-virtual.php: - added several admin/superadmin switches and permission checks - added check for admins without any domains (redirects to domain list, which can handle this situation) - migrated FIXME from overview.php -> David, please review the query and remove the FIXME afterwards overview.php: - DELETED - no longer needed overview.tpl: - RENAMED overview.tpl to list-virtual.tpl - removed admin/superadmin filename switch - removed $incpath switch for images menu.tpl: - menu for domain admins now has "domain list" and "virtual list" instead of "overview" delete.php, edit-active.php, edit-alias.php, edit-mailbox.php, search.php: - changed redirect to list-virtual.php overview-get.tpl: - changed link to list-virtual.php main.tpl: - changed overview link to list-domain.php Modified Paths: -------------- trunk/delete.php trunk/edit-active.php trunk/edit-alias.php trunk/edit-mailbox.php trunk/list-domain.php trunk/list-virtual.php trunk/search.php trunk/templates/main.tpl trunk/templates/menu.tpl trunk/templates/overview-get.tpl Added Paths: ----------- trunk/templates/list-virtual.tpl Removed Paths: ------------- trunk/overview.php trunk/templates/overview.tpl Modified: trunk/delete.php =================================================================== --- trunk/delete.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/delete.php 2007-11-03 22:24:34 UTC (rev 181) @@ -149,9 +149,7 @@ if ($error != 1) { if ($CONF['database_type'] == "pgsql") db_query('COMMIT'); - $url = "overview.php"; - if (authentication_has_role('global-admin')) $url = "list-virtual.php"; - header ("Location: $url?domain=$fDomain"); + header ("Location: list-virtual.php?domain=$fDomain"); exit; } else { $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (physical mail)!</span>"; Modified: trunk/edit-active.php =================================================================== --- trunk/edit-active.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/edit-active.php 2007-11-03 22:24:34 UTC (rev 181) @@ -78,7 +78,6 @@ if ($error != 1) { if ( preg_match( "/^list-virtual.php.*/", $fReturn ) || - preg_match( "/^overview.php.*/", $fReturn ) || preg_match( "/^search.php.*/", $fReturn ) ) { //$fReturn appears OK, jump there @@ -86,11 +85,7 @@ } else { - if (authentication_has_role('global-admin')) { - header ("Location: list-virtual.php?domain=$fDomain"); - } else { - header ("Location: overview.php?domain=$fDomain"); - } + header ("Location: list-virtual.php?domain=$fDomain"); } exit; } Modified: trunk/edit-alias.php =================================================================== --- trunk/edit-alias.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/edit-alias.php 2007-11-03 22:24:34 UTC (rev 181) @@ -118,11 +118,7 @@ { db_log ($SESSID_USERNAME, $fDomain, 'edit_alias', "$fAddress -> $goto"); - if (authentication_has_role('global-admin')) { - header ("Location: list-virtual.php?domain=$fDomain"); - } else { - header ("Location: overview.php?domain=$fDomain"); - } + header ("Location: list-virtual.php?domain=$fDomain"); exit; } } Modified: trunk/edit-mailbox.php =================================================================== --- trunk/edit-mailbox.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/edit-mailbox.php 2007-11-03 22:24:34 UTC (rev 181) @@ -144,11 +144,7 @@ else { db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox', $fUsername); - if (authentication_has_role('global-admin')) { - header ("Location: list-virtual.php?domain=$fDomain"); - } else { - header ("Location: overview.php?domain=$fDomain"); - } + header ("Location: list-virtual.php?domain=$fDomain"); exit; } } Modified: trunk/list-domain.php =================================================================== --- trunk/list-domain.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/list-domain.php 2007-11-03 22:24:34 UTC (rev 181) @@ -27,41 +27,28 @@ require_once('common.php'); -authentication_require_role('global-admin'); +authentication_require_role('admin'); -$list_admins = list_admins (); +if (authentication_has_role('global-admin')) { + $list_admins = list_admins (); + $is_superadmin = 1; +} else { + $list_admins = array(authentication_get_username()); + $is_superadmin = 0; +} -if ($_SERVER['REQUEST_METHOD'] == "GET") { - if (isset ($_GET['username'])) { - $fUsername = escape_string ($_GET['username']); - $list_domains = list_domains_for_admin ($fUsername); - if ($list_domains != 0) - { - for ($i = 0; $i < sizeof ($list_domains); $i++) - { - $domain_properties[$i] = get_domain_properties ($list_domains[$i]); - } - } - } - else - { - $list_domains = list_domains (); - if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) - for ($i = 0; $i < sizeof ($list_domains); $i++) - { - $domain_properties[$i] = get_domain_properties ($list_domains[$i]); - } - } +if ($_SERVER['REQUEST_METHOD'] == "POST" && $is_superadmin && isset ($_POST['fUsername'])) { + $fUsername = escape_string ($_POST['fUsername']); + $list_domains = list_domains_for_admin ($fUsername); +} elseif ($_SERVER['REQUEST_METHOD'] == "GET" && $is_superadmin && isset ($_GET['username'])) { + $fUsername = escape_string ($_GET['username']); + $list_domains = list_domains_for_admin ($fUsername); +} elseif ($is_superadmin) { + $list_domains = list_domains (); +} else { + $list_domains = list_domains_for_admin(authentication_get_username()); } -if ($_SERVER['REQUEST_METHOD'] == "POST") -{ - if (isset ($_POST['fUsername'])) - { - $fUsername = escape_string ($_POST['fUsername']); - $list_domains = list_domains_for_admin ($fUsername); - } - if (!empty ($list_domains)) { for ($i = 0; $i < sizeof ($list_domains); $i++) @@ -69,10 +56,15 @@ $domain_properties[$i] = get_domain_properties ($list_domains[$i]); } } -} +#} include ("templates/header.tpl"); include ("templates/menu.tpl"); -include ("templates/admin_list-domain.tpl"); + +if ($is_superadmin) { + include ("templates/admin_list-domain.tpl"); +} else { + include ("templates/overview-get.tpl"); +} include ("templates/footer.tpl"); ?> Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/list-virtual.php 2007-11-03 22:24:34 UTC (rev 181) @@ -15,7 +15,7 @@ * File: list-virtual.php * List virtual users for a domain. * - * Template File: overview.tpl + * Template File: list-virtual.tpl * * Template Variables: * @@ -31,11 +31,16 @@ require_once('common.php'); -authentication_require_role('global-admin'); +authentication_require_role('admin'); -$list_domains = list_domains (); +if (authentication_has_role('global-admin')) { + $list_domains = list_domains (); + $is_superadmin = 1; +} else { + $list_domains = list_domains_for_admin(authentication_get_username()); + $is_superadmin = 0; +} - $tAlias = array(); $tMailbox = array(); $fDisplay = 0; @@ -52,12 +57,21 @@ if (isset ($_POST['limit'])) $fDisplay = intval ($_POST['limit']); } +if (count($list_domains) == 0) { +# die("no domains"); + header("Location: list-domain.php"); # no domains (for this admin at least) - redirect to domain list +} if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[0]; -if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[1]; +if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) if (empty ($fDomain)) $fDomain = $list_domains[1]; # TODO: should never happen?!? ($fDomain should already be filled by the line above) +if (!check_owner(authentication_get_username(), $fDomain)) { +# die($PALANG['invalid_parameter']); + header("Location: list-domain.php"); # domain not owned by this admin +} + $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$fDomain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $fDisplay, $page_size"; if ('pgsql'==$CONF['database_type']) { @@ -83,6 +97,7 @@ $query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $fDisplay, $page_size"); if ('pgsql'==$CONF['database_type']) { + //TODO/FIXME: postgres query needs to be rewrited $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay"; } } @@ -106,7 +121,7 @@ $row['created']=gmstrftime('%c %Z',$row['uts_created']); $row['modified']=gmstrftime('%c %Z',$row['uts_modified']); $row['active']=('t'==$row['active']) ? 1 : 0; - $row['v_active'] = 1; // default to off... + $row['v_active'] = 1; // default to off... TODO: 1 is NOT off if(isset($row['v_active'])) { /* key may not be present in results due to query from above */ $row['v_active']=('t'==$row['v_active']) ? 1 : 0; } @@ -157,7 +172,7 @@ include ("templates/header.tpl"); include ("templates/menu.tpl"); -include ("templates/overview.tpl"); +include ("templates/list-virtual.tpl"); include ("templates/footer.tpl"); /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ Deleted: trunk/overview.php =================================================================== --- trunk/overview.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/overview.php 2007-11-03 22:24:34 UTC (rev 181) @@ -1,249 +0,0 @@ -<?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$ - * @license GNU GPL v2 or later. - * - * File: overview.php - * Shows an overview for admins. - * - * Template File: overview.tpl - * - * Template Variables: - * - * tAlias - * tDomain - * tMailbox - * tDisplay_back - * tDisplay_next - * - * Form POST \ GET Variables: - * - * domain - * fDomain - * limit - */ - -require_once('common.php'); - -authentication_require_role('admin'); - -$SESSID_USERNAME = authentication_get_username(); - -if(authentication_has_role('global-admin')) { - $list_domains = list_domains (); -} -else { - $list_domains = list_domains_for_admin ($SESSID_USERNAME); -} - -$tAlias = array(); -$tMailbox = array(); - -if ($_SERVER['REQUEST_METHOD'] == "GET") -{ - $fDisplay = 0; - $page_size = $CONF['page_size']; - - if (isset ($_GET['domain'])) $fDomain = escape_string ($_GET['domain']); - if (isset ($_GET['limit'])) $fDisplay = escape_string ($_GET['limit']); - - $limit = get_domain_properties ($fDomain); - - $limitSql=('pgsql'==$CONF['database_type']) ? "$page_size OFFSET $fDisplay" : "$fDisplay, $page_size"; - - if (check_owner ($SESSID_USERNAME, $fDomain)) - { - $tCanAddAlias = 1; # TODO: workaround for undefined variable - $tCanAddMailbox = 1; # TODO: workaround for undefined variable - - $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$fDomain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $limitSql"; - if ('pgsql'==$CONF['database_type']) - { - $query = "SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) ORDER BY address LIMIT $limitSql"; - } - - $result = db_query ($query); - if ($result['rows'] > 0) - { - while ($row = db_array ($result['result'])) - { - if ('pgsql'==$CONF['database_type']) - { - $row['modified']=gmstrftime('%c %Z',$row['modified']); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tAlias[] = $row; - } - } - - if ($CONF['vacation_control_admin'] == 'YES') - { - $query = ("SELECT $table_mailbox.*, $table_vacation.active AS v_active FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $limitSql"); - if ('pgsql'==$CONF['database_type']) - { - //FIXME: postgres query needs to be rewrited - $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql"; - } - } - else - { - $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql"; - if ('pgsql'==$CONF['database_type']) - { - $query = "SELECT *,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql"; - } - } - - $result = db_query ($query); - if ($result['rows'] > 0) - { - while ($row = db_array ($result['result'])) - { - if ('pgsql'==$CONF['database_type']) - { - $row['created']=gmstrftime('%c %Z',$row['uts_created']); - $row['modified']=gmstrftime('%c %Z',$row['uts_modified']); - $row['active']=('t'==$row['active']) ? 1 : 0; - if(isset($row['v_active'])) { - $row['v_active']=('t'==$row['v_active']) ? 1 : 0; - } - else { - $row['v_active'] = -1 ; //unknown; broken query above.. - } - unset($row['uts_created']); - unset($row['uts_modified']); - } - $tMailbox[] = $row; - } - } - $template = "overview.tpl"; - } - else - { - $template = "overview-get.tpl"; - } - - $tDomain = $fDomain; - - if (isset ($limit)) - { - if ($fDisplay >= $page_size) - { - $tDisplay_back_show = 1; - $tDisplay_back = $fDisplay - $page_size; - } - if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size)) - { - $tDisplay_up_show = 1; - } - if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count'])) - { - $tDisplay_next_show = 1; - $tDisplay_next = $fDisplay + $page_size; - } - } - - include ("./templates/header.tpl"); - include ("./templates/menu.tpl"); - include ("./templates/$template"); - include ("./templates/footer.tpl"); -} - -if ($_SERVER['REQUEST_METHOD'] == "POST") -{ - $fDisplay = 0; - $page_size = $CONF['page_size']; - - if (isset ($_POST['limit'])) $fDisplay = escape_string ($_POST['limit']); - if (isset ($_POST['domain'])) $fDomain = escape_string ($_POST['fDomain']); - - if (check_owner ($SESSID_USERNAME, escape_string ($_POST['fDomain']))) - { - $limitSql=('pgsql'==$CONF['database_type']) ? "$page_size OFFSET $fDisplay" : "$fDisplay, $page_size"; - - if ($CONF['alias_control_admin'] == "YES") - { - $query = "SELECT address,goto,modified,active FROM $table_alias WHERE domain='$fDomain' ORDER BY address LIMIT $limitSql"; - if ('pgsql'==$CONF['database_type']) - { - $query = "SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' ORDER BY address LIMIT $limitSql"; - } - } - else - { - $query = "SELECT $table_alias.address,$table_alias.goto,$table_alias.modified,$table_alias.active FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE $table_alias.domain='$fDomain' AND $table_mailbox.maildir IS NULL ORDER BY $table_alias.address LIMIT $limitSql"; - if ('pgsql'==$CONF['database_type']) - { - $query="SELECT address,goto,extract(epoch from modified) as modified,active FROM $table_alias WHERE domain='$fDomain' AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) ORDER BY address LIMIT $limitSql"; - } - } - - $result = db_query ("$query"); - if ($result['rows'] > 0) - { - while ($row = db_array ($result['result'])) - { - if ('pgsql'==$CONF['database_type']) - { - $row['modified']=gmstrftime('%c %Z',$row['modified']); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tAlias[] = $row; - } - } - - $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql"; - if ('pgsql'==$CONF['database_type']) - { - $query = "SELECT *,,extract(epoch from created) as uts_created,extract(epoch from modified) as uts_modified FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $limitSql"; - } - $result = db_query ($query); - if ($result['rows'] > 0) - { - while ($row = db_array ($result['result'])) - { - if ('pgsql'==$CONF['database_type']) - { - $row['created']=gmstrftime('%c %Z',$row['uts_created']); - $row['modified']=gmstrftime('%c %Z',$row['uts_modified']); - $row['active']=('t'==$row['active']) ? 1 : 0; - } - $tMailbox[] = $row; - } - } - } - - if (isset ($limit)) - { - if ($fDisplay >= $page_size) - { - $tDisplay_back_show = 1; - $tDisplay_back = $fDisplay - $page_size; - } - if (($limit['alias_count'] > $page_size) or ($limit['mailbox_count'] > $page_size)) - { - $tDisplay_up_show = 1; - } - if ((($fDisplay + $page_size) < $limit['alias_count']) or (($fDisplay + $page_size) < $limit['mailbox_count'])) - { - $tDisplay_next_show = 1; - $tDisplay_next = $fDisplay + $page_size; - } - } - - include ("./templates/header.tpl"); - include ("./templates/menu.tpl"); - include ("./templates/overview.tpl"); - include ("./templates/footer.tpl"); -} -/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ -?> Modified: trunk/search.php =================================================================== --- trunk/search.php 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/search.php 2007-11-03 22:24:34 UTC (rev 181) @@ -59,14 +59,7 @@ if (empty ($fSearch) /* && !empty ($fGo) */) { - if (authentication_has_role('global-admin')) - { - header("Location: list-virtual.php?domain=" . $fDomain ) && exit; - } - else - { - header("Location: overview.php?domain=" . $fDomain ) && exit; - } + header("Location: list-virtual.php?domain=" . $fDomain ) && exit; } if ($CONF['alias_control_admin'] == "YES") Copied: trunk/templates/list-virtual.tpl (from rev 175, trunk/templates/overview.tpl) =================================================================== --- trunk/templates/list-virtual.tpl (rev 0) +++ trunk/templates/list-virtual.tpl 2007-11-03 22:24:34 UTC (rev 181) @@ -0,0 +1,317 @@ +<div id="overview"> +<form name="overview" method="post"> +<select name="fDomain" onChange="this.form.submit();"> +<?php + +$file = 'list-virtual.php'; + +if ($limit['aliases'] == 0) $limit['aliases'] = $PALANG['pOverview_unlimited']; +if ($limit['mailboxes'] == 0) $limit['mailboxes'] = $PALANG['pOverview_unlimited']; +if ($limit['maxquota'] == 0) $limit['maxquota'] = $PALANG['pOverview_unlimited']; +if ($limit['aliases'] < 0) $limit['aliases'] = $PALANG['pOverview_disabled']; +if ($limit['mailboxes'] < 0) $limit['mailboxes'] = $PALANG['pOverview_disabled']; +if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled']; + +for ($i = 0; $i < sizeof ($list_domains); $i++) +{ + if ($fDomain == $list_domains[$i]) + { + print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n"; + } + else + { + print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n"; + } +} +?> +</select> +<input type="hidden" name="limit" value="0" /> +<input class="button" type="submit" name="go" value="<?php print $PALANG['pOverview_button']; ?>" /> +</form> +<h4><?php print $PALANG['pOverview_welcome'] . $fDomain; ?></h4> +<p><?php print $PALANG['pOverview_alias_alias_count'] . ": " . $limit['alias_count'] . " / " . $limit['aliases']; ?></p> +<p><?php print $PALANG['pOverview_alias_mailbox_count'] . ": " . $limit['mailbox_count'] . " / " . $limit['mailboxes']; ?></p> +<form name="search" method="post" action="search.php"><?php print $PALANG['pSearch']; ?>: +<input type="textbox" name="search" size="10" /> +</form> +</div> + +<div id="nav_bar"> + <table width=730><colgroup span="1"><col width="550"></col></colgroup> + <tr><td align=left > +<?php +if ($limit['alias_pgindex_count'] ) print "<b>".$PALANG['pOverview_alias_title']."</b>  "; +($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0; +$current_limit=$highlight_at * $CONF['page_size']; +for ($i = 0; $i < $limit['alias_pgindex_count']; $i++) +{ + if ( $i == $highlight_at ) + { + print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\"><b>" . $limit['alias_pgindex'][$i] . "</b></a>\n"; + } + else + { + print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\">" . $limit['alias_pgindex'][$i] . "</a>\n"; + } +} +print "</td><td valign=middle align=right>"; + +if ($tDisplay_back_show == 1) +{ + print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n"; +} +if ($tDisplay_up_show == 1) +{ + print "<a href=\"$file?domain=$fDomain&limit=0\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n"; +} +if ($tDisplay_next_show == 1) +{ + print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n"; +} +print "</td></tr></table></div>\n"; + +if (sizeof ($tAlias) > 0) +{ + print "<table id=\"alias_table\">\n"; + print " <tr>\n"; + print " <td colspan=\"7\"><h3>" . $PALANG['pOverview_alias_title'] . "</h3></td>"; + print " </tr>"; + print " <tr class=\"header\">\n"; + if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; } + print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n"; + print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n"; + print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n"; + print " <td>" . $PALANG['pOverview_alias_active'] . "</td>\n"; + print " <td colspan=\"2\"> </td>\n"; + print " </tr>\n"; + + for ($i = 0; $i < sizeof ($tAlias); $i++) + { + if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) + { + print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; + if ($CONF['show_status'] == 'YES') + { + print " <td>" . gen_show_status($tAlias[$i]['address']) . "</td>\n"; + } + + print " <td>" . $tAlias[$i]['address'] . "</td>\n"; + if ($CONF['alias_goto_limit'] > 0) { + print " <td>" . ereg_replace (",", "<br>", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "</td>\n"; + } else { + print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n"; + } + print " <td>" . $tAlias[$i]['modified'] . "</td>\n"; + + +# TODO: merge superadmin / domain admin code + if (authentication_has_role('global-admin')) { +# superadmin code + $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; + print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain&return=$file?domain=$fDomain" . urlencode ("&limit=" . $current_limit) . "\">" . $active . "</a></td>\n"; + print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; + print " <td><a href=\"delete.php?table=alias" . "&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n"; + + } else { +# domain admin code + if ($CONF['special_alias_control'] == 'YES') + { + $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; + print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; + print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; + print " <td><a href=\"delete.php?table=alias&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n"; + } + else + { + if ( check_alias_owner ($SESSID_USERNAME, $tAlias[$i]['address'])) + { + $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; + print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; + print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; + print " <td><a href=\"delete.php?table=mailbox&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n"; + } + else + { + //this is a special alias, show status only, don't allow changes + $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; + print " <td>" . $active . "</td>\n"; + print " <td> </td>\n"; + print " <td> </td>\n"; + } + } +# end diff + } + + print " </tr>\n"; + } + } + print "</table>\n"; +} + +if($tCanAddAlias) { + print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n"; +} + + print "<div id=\"nav_bar\"><a name=\"MidArrow\"></a>\n<table width=730><colgroup span=\"1\"> <col width=\"550\"></col></colgroup> <tr><td align=left >"; + if ( $limit['mbox_pgindex_count'] ) print "<b>".$PALANG['pOverview_mailbox_title']."</b>  "; + ($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0; + for ($i = 0; $i < $limit['mbox_pgindex_count']; $i++) + { + if ( $i == $highlight_at ) + { + print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\"><b>" . $limit['mbox_pgindex'][$i] . "</b></a>\n"; + } + else + { + print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\">" . $limit['mbox_pgindex'][$i] . "</a>\n"; + } + } + print "</td><td valign=middle align=right>"; + +if ($tDisplay_back_show == 1) +{ + print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#MidArrow\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n"; +} +if ($tDisplay_up_show == 1) +{ + print "<a href=\"$file?domain=$fDomain&limit=0#MidArrow\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n"; +} +if ($tDisplay_next_show == 1) +{ + print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#MidArrow\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n"; +} +print "</td></tr></table></div>\n"; + +if (sizeof ($tMailbox) > 0) +{ + $colspan=8; + if ($CONF['vacation_control_admin'] == 'YES') $colspan=$colspan+1; + if ($CONF['alias_control_admin'] == 'YES') $colspan=$colspan+1; + print "<table id=\"mailbox_table\">\n"; + print " <tr>\n"; + print " <td colspan=\"$colspan\"><h3>" . $PALANG['pOverview_mailbox_title'] . "</h3></td>"; + print " </tr>"; + print " <tr class=\"header\">\n"; + if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; } + print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n"; + print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n"; + if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n"; + print " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n"; + print " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n"; + $colspan = $colspan - 6; + print " <td colspan=\"$colspan\"> </td>\n"; + print " </tr>\n"; + + for ($i = 0; $i < sizeof ($tMailbox); $i++) + { + if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) + { + print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; + + if ($CONF['show_status'] == 'YES') + { + print " <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n"; + } + + print " <td>" . $tMailbox[$i]['username'] . "</td>\n"; + print " <td>" . $tMailbox[$i]['name'] . "</td>\n"; + if ($CONF['quota'] == 'YES') + { + print " <td>"; + if ($tMailbox[$i]['quota'] == 0) + { + print $PALANG['pOverview_unlimited']; + } + elseif ($tMailbox[$i]['quota'] < 0) + { + print $PALANG['pOverview_disabled']; + } + else + { + print divide_quota ($tMailbox[$i]['quota']); + } + print "</td>\n"; + } + print " <td>" . $tMailbox[$i]['modified'] . "</td>\n"; + $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; + print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; + + if ($CONF['vacation_control_admin'] == 'YES') + { + $v_active_int = $tMailbox[$i]['v_active']; + if($v_active_int !== -1) { + if($v_active_int == 1) { + $v_active = $PALANG['pOverview_vacation_edit']; + } + else { + $v_active = $PALANG['pOverview_vacation_option']; + } + print "<td><a href=\"edit-vacation.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $v_active . "</a></td>\n"; + } + else { + // can't tell vacation state - broken pgsql query + echo "<td> </td>\n"; + } + } + + $edit_aliases=0; + if ( authentication_has_role('global-admin') && $CONF['alias_control_admin'] == 'YES') $edit_aliases = 1; + if ( (! authentication_has_role('global-admin')) && $CONF['alias_control'] == 'YES') $edit_aliases = 1; + + if ($edit_aliases == 1) + { + print " <td><a href=\"edit-alias.php?address=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['pOverview_alias_edit'] . "</a></td>\n"; + } + + print " <td><a href=\"edit-mailbox.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; + print " <td><a href=\"delete.php?table=mailbox" . "&delete=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n"; + print " </tr>\n"; + } + } + print "</table>\n"; + print "<div id=\"nav_bar\"><a name=\"LowArrow\" /a>\n"; + if ($tDisplay_back_show == 1) + { + print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#LowArrow\"><img border=\"0\" src=\"images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n"; + } + if ($tDisplay_up_show == 1) + { + print "<a href=\"$file?domain=$fDomain&limit=0#LowArrow\"><img border=\"0\" src=\"images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n"; + } + if ($tDisplay_next_show == 1) + { + print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#LowArrow\"><img border=\"0\" src=\"images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n"; + } + print "</div>\n"; + +} +if($tCanAddMailbox) { + print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n"; +} + +if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES') +{ + print "<br><br>"; + if ($CONF['show_undeliverable'] == 'YES') + { + print " <span style='background-color:" . $CONF['show_undeliverable_color'] . + "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_undeliverable'] . "\n"; + } + if ($CONF['show_popimap'] == 'YES') + { + print " <span style='background-color:" . $CONF['show_popimap_color'] . + "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_popimap'] . "\n"; + } + if ( $CONF['show_custom_count'] > 0 ) + { + for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++) + { + print " <span style='background-color:" . $CONF['show_custom_colors'][$i] . "'>" . + $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_custom'] . + $CONF['show_custom_domains'][$i] . "\n"; + } + } +} + +/* vim: set ft=php expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ +?> Modified: trunk/templates/main.tpl =================================================================== --- trunk/templates/main.tpl 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/templates/main.tpl 2007-11-03 22:24:34 UTC (rev 181) @@ -1,7 +1,7 @@ <div id="main_menu"> <table> <tr> - <td nowrap><a target="_top" href="overview.php"><?php print $PALANG['pMenu_overview']; ?></a></td> + <td nowrap><a target="_top" href="list-domain.php"><?php print $PALANG['pMenu_overview']; ?></a></td> <td><?php print $PALANG['pMain_overview']; ?></td> </tr> <tr> Modified: trunk/templates/menu.tpl =================================================================== --- trunk/templates/menu.tpl 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/templates/menu.tpl 2007-11-03 22:24:34 UTC (rev 181) @@ -26,15 +26,16 @@ $submenu_domain = ""; } + if (authentication_has_role('global-admin')) { print _menulink("list-admin.php", $PALANG['pAdminMenu_list_admin'], $submenu_admin); - print _menulink("list-domain.php", $PALANG['pAdminMenu_list_domain'], $submenu_domain); - print _menulink("list-virtual.php", $PALANG['pAdminMenu_list_virtual'], $submenu_virtual); } else { print _menulink("main.php", $PALANG['pMenu_main']); - print _menulink("overview.php", $PALANG['pMenu_overview'], $submenu_virtual); } +print _menulink("list-domain.php", $PALANG['pAdminMenu_list_domain'], $submenu_domain); +print _menulink("list-virtual.php", $PALANG['pAdminMenu_list_virtual'], $submenu_virtual); + if ($CONF['fetchmail'] == 'YES') { print _menulink("fetchmail.php", $PALANG['pMenu_fetchmail'], $submenu_fetchmail); } Modified: trunk/templates/overview-get.tpl =================================================================== --- trunk/templates/overview-get.tpl 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/templates/overview-get.tpl 2007-11-03 22:24:34 UTC (rev 181) @@ -48,7 +48,7 @@ if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled']; print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; - print " <td><a href=\"overview.php?domain=" . $list_domains[$i] . "\">" . $list_domains[$i] . "</a></td>\n"; + print " <td><a href=\"list-virtual.php?domain=" . $list_domains[$i] . "\">" . $list_domains[$i] . "</a></td>\n"; print " <td>" . $limit['alias_count'] . " / " . $limit['aliases'] . "</td>\n"; print " <td>" . $limit['mailbox_count'] . " / " . $limit['mailboxes'] . "</td>\n"; if ($CONF['quota'] == 'YES') print " <td>" . $limit['maxquota'] . "</td>\n"; Deleted: trunk/templates/overview.tpl =================================================================== --- trunk/templates/overview.tpl 2007-11-03 19:21:27 UTC (rev 180) +++ trunk/templates/overview.tpl 2007-11-03 22:24:34 UTC (rev 181) @@ -1,323 +0,0 @@ -<div id="overview"> -<form name="overview" method="post"> -<select name="fDomain" onChange="this.form.submit();"> -<?php - -if (authentication_has_role('global-admin')) { - $file = 'list-virtual.php'; - $incpath = '..'; # warning: overrides $incpath from common.php - TODO: fix common.php $incpath -} else { - $file = 'overview.php'; - $incpath = '.'; # warning: overrides $incpath from common.php - TODO: fix common.php $incpath -} - -if ($limit['aliases'] == 0) $limit['aliases'] = $PALANG['pOverview_unlimited']; -if ($limit['mailboxes'] == 0) $limit['mailboxes'] = $PALANG['pOverview_unlimited']; -if ($limit['maxquota'] == 0) $limit['maxquota'] = $PALANG['pOverview_unlimited']; -if ($limit['aliases'] < 0) $limit['aliases'] = $PALANG['pOverview_disabled']; -if ($limit['mailboxes'] < 0) $limit['mailboxes'] = $PALANG['pOverview_disabled']; -if ($limit['maxquota'] < 0) $limit['maxquota'] = $PALANG['pOverview_disabled']; - -for ($i = 0; $i < sizeof ($list_domains); $i++) -{ - if ($fDomain == $list_domains[$i]) - { - print "<option value=\"$list_domains[$i]\" selected>$list_domains[$i]</option>\n"; - } - else - { - print "<option value=\"$list_domains[$i]\">$list_domains[$i]</option>\n"; - } -} -?> -</select> -<input type="hidden" name="limit" value="0" /> -<input class="button" type="submit" name="go" value="<?php print $PALANG['pOverview_button']; ?>" /> -</form> -<h4><?php print $PALANG['pOverview_welcome'] . $fDomain; ?></h4> -<p><?php print $PALANG['pOverview_alias_alias_count'] . ": " . $limit['alias_count'] . " / " . $limit['aliases']; ?></p> -<p><?php print $PALANG['pOverview_alias_mailbox_count'] . ": " . $limit['mailbox_count'] . " / " . $limit['mailboxes']; ?></p> -<form name="search" method="post" action="search.php"><?php print $PALANG['pSearch']; ?>: -<input type="textbox" name="search" size="10" /> -</form> -</div> - -<div id="nav_bar"> - <table width=730><colgroup span="1"><col width="550"></col></colgroup> - <tr><td align=left > -<?php -if ($limit['alias_pgindex_count'] ) print "<b>".$PALANG['pOverview_alias_title']."</b>  "; -($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0; -$current_limit=$highlight_at * $CONF['page_size']; -for ($i = 0; $i < $limit['alias_pgindex_count']; $i++) -{ - if ( $i == $highlight_at ) - { - print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\"><b>" . $limit['alias_pgindex'][$i] . "</b></a>\n"; - } - else - { - print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "\">" . $limit['alias_pgindex'][$i] . "</a>\n"; - } -} -print "</td><td valign=middle align=right>"; - -if ($tDisplay_back_show == 1) -{ - print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back\"><img border=\"0\" src=\"$incpath/images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n"; -} -if ($tDisplay_up_show == 1) -{ - print "<a href=\"$file?domain=$fDomain&limit=0\"><img border=\"0\" src=\"$incpath/images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n"; -} -if ($tDisplay_next_show == 1) -{ - print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next\"><img border=\"0\" src=\"$incpath/images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n"; -} -print "</td></tr></table></div>\n"; - -if (sizeof ($tAlias) > 0) -{ - print "<table id=\"alias_table\">\n"; - print " <tr>\n"; - print " <td colspan=\"7\"><h3>" . $PALANG['pOverview_alias_title'] . "</h3></td>"; - print " </tr>"; - print " <tr class=\"header\">\n"; - if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; } - print " <td>" . $PALANG['pOverview_alias_address'] . "</td>\n"; - print " <td>" . $PALANG['pOverview_alias_goto'] . "</td>\n"; - print " <td>" . $PALANG['pOverview_alias_modified'] . "</td>\n"; - print " <td>" . $PALANG['pOverview_alias_active'] . "</td>\n"; - print " <td colspan=\"2\"> </td>\n"; - print " </tr>\n"; - - for ($i = 0; $i < sizeof ($tAlias); $i++) - { - if ((is_array ($tAlias) and sizeof ($tAlias) > 0)) - { - print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; - if ($CONF['show_status'] == 'YES') - { - print " <td>" . gen_show_status($tAlias[$i]['address']) . "</td>\n"; - } - - print " <td>" . $tAlias[$i]['address'] . "</td>\n"; - if ($CONF['alias_goto_limit'] > 0) { - print " <td>" . ereg_replace (",", "<br>", preg_replace('/^(([^,]+,){'.$CONF['alias_goto_limit'].'})[^,]+,.*/','$1[and '. (substr_count ($tAlias[$i]['goto'], ',') - $CONF['alias_goto_limit'] + 1) .' more...]',$tAlias[$i]['goto'])) . "</td>\n"; - } else { - print " <td>" . ereg_replace (",", "<br>", $tAlias[$i]['goto']) . "</td>\n"; - } - print " <td>" . $tAlias[$i]['modified'] . "</td>\n"; - - -# TODO: merge superadmin / domain admin code - if (authentication_has_role('global-admin')) { -# superadmin code - $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain&return=$file?domain=$fDomain" . urlencode ("&limit=" . $current_limit) . "\">" . $active . "</a></td>\n"; - print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; - print " <td><a href=\"delete.php?table=alias" . "&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n"; - - } else { -# domain admin code - if ($CONF['special_alias_control'] == 'YES') - { - $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; - print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; - print " <td><a href=\"delete.php?table=alias&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n"; - } - else - { - if ( check_alias_owner ($SESSID_USERNAME, $tAlias[$i]['address'])) - { - $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print " <td><a href=\"edit-active.php?alias=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; - print " <td><a href=\"edit-alias.php?address=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; - print " <td><a href=\"delete.php?table=mailbox&delete=" . urlencode ($tAlias[$i]['address']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_aliases'] . ": ". $tAlias[$i]['address'] . "')\">" . $PALANG['del'] . "</a></td>\n"; - } - else - { - //this is a special alias, show status only, don't allow changes - $active = ($tAlias[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print " <td>" . $active . "</td>\n"; - print " <td> </td>\n"; - print " <td> </td>\n"; - } - } -# end diff - } - - print " </tr>\n"; - } - } - print "</table>\n"; -} - -if($tCanAddAlias) { - print "<p><a href=\"create-alias.php?domain=$fDomain\">" . $PALANG['pMenu_create_alias'] . "</a>\n"; -} - - print "<div id=\"nav_bar\"><a name=\"MidArrow\" /a>\n<table width=730><colgroup span=\"1\"> <col width=\"550\"></col></colgroup> <tr><td align=left >"; - if ( $limit['mbox_pgindex_count'] ) print "<b>".$PALANG['pOverview_mailbox_title']."</b>  "; - ($tDisplay_back_show == 1) ? $highlight_at = $tDisplay_back / $CONF['page_size'] + 1 : $highlight_at = 0; - for ($i = 0; $i < $limit['mbox_pgindex_count']; $i++) - { - if ( $i == $highlight_at ) - { - print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\"><b>" . $limit['mbox_pgindex'][$i] . "</b></a>\n"; - } - else - { - print "<a href=\"$file?domain=$fDomain&limit=" . $i * $CONF['page_size'] . "#MidArrow\">" . $limit['mbox_pgindex'][$i] . "</a>\n"; - } - } - print "</td><td valign=middle align=right>"; - -if ($tDisplay_back_show == 1) -{ - print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#MidArrow\"><img border=\"0\" src=\"$incpath/images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n"; -} -if ($tDisplay_up_show == 1) -{ - print "<a href=\"$file?domain=$fDomain&limit=0#MidArrow\"><img border=\"0\" src=\"$incpath/images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n"; -} -if ($tDisplay_next_show == 1) -{ - print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#MidArrow\"><img border=\"0\" src=\"$incpath/images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n"; -} -print "</td></tr></table></div>\n"; - -if (sizeof ($tMailbox) > 0) -{ - $colspan=8; - if ($CONF['vacation_control_admin'] == 'YES') $colspan=$colspan+1; - if ($CONF['alias_control_admin'] == 'YES') $colspan=$colspan+1; - print "<table id=\"mailbox_table\">\n"; - print " <tr>\n"; - print " <td colspan=\"$colspan\"><h3>" . $PALANG['pOverview_mailbox_title'] . "</h3></td>"; - print " </tr>"; - print " <tr class=\"header\">\n"; - if ($CONF['show_status'] == 'YES') { print "<td></td>\n"; } - print " <td>" . $PALANG['pOverview_mailbox_username'] . "</td>\n"; - print " <td>" . $PALANG['pOverview_mailbox_name'] . "</td>\n"; - if ($CONF['quota'] == 'YES') print " <td>" . $PALANG['pOverview_mailbox_quota'] . "</td>\n"; - print " <td>" . $PALANG['pOverview_mailbox_modified'] . "</td>\n"; - print " <td>" . $PALANG['pOverview_mailbox_active'] . "</td>\n"; - $colspan = $colspan - 6; - print " <td colspan=\"$colspan\"> </td>\n"; - print " </tr>\n"; - - for ($i = 0; $i < sizeof ($tMailbox); $i++) - { - if ((is_array ($tMailbox) and sizeof ($tMailbox) > 0)) - { - print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; - - if ($CONF['show_status'] == 'YES') - { - print " <td>" . gen_show_status($tMailbox[$i]['username']) . "</td>\n"; - } - - print " <td>" . $tMailbox[$i]['username'] . "</td>\n"; - print " <td>" . $tMailbox[$i]['name'] . "</td>\n"; - if ($CONF['quota'] == 'YES') - { - print " <td>"; - if ($tMailbox[$i]['quota'] == 0) - { - print $PALANG['pOverview_unlimited']; - } - elseif ($tMailbox[$i]['quota'] < 0) - { - print $PALANG['pOverview_disabled']; - } - else - { - print divide_quota ($tMailbox[$i]['quota']); - } - print "</td>\n"; - } - print " <td>" . $tMailbox[$i]['modified'] . "</td>\n"; - $active = ($tMailbox[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print " <td><a href=\"edit-active.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $active . "</a></td>\n"; - - if ($CONF['vacation_control_admin'] == 'YES') - { - $v_active_int = $tMailbox[$i]['v_active']; - if($v_active_int !== -1) { - if($v_active_int == 1) { - $v_active = $PALANG['pOverview_vacation_edit']; - } - else { - $v_active = $PALANG['pOverview_vacation_option']; - } - print "<td><a href=\"edit-vacation.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $v_active . "</a></td>\n"; - } - else { - // can't tell vacation state - broken pgsql query - echo "<td> </td>\n"; - } - } - - $edit_aliases=0; - if ( authentication_has_role('global-admin') && $CONF['alias_control_admin'] == 'YES') $edit_aliases = 1; - if ( (! authentication_has_role('global-admin')) && $CONF['alias_control'] == 'YES') $edit_aliases = 1; - - if ($edit_aliases == 1) - { - print " <td><a href=\"edit-alias.php?address=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['pOverview_alias_edit'] . "</a></td>\n"; - } - - print " <td><a href=\"edit-mailbox.php?username=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\">" . $PALANG['edit'] . "</a></td>\n"; - print " <td><a href=\"delete.php?table=mailbox" . "&delete=" . urlencode ($tMailbox[$i]['username']) . "&domain=$fDomain" . "\"onclick=\"return confirm ('" . $PALANG['confirm'] . $PALANG['pOverview_get_mailboxes'] . ": ". $tMailbox[$i]['username'] . "')\">" . $PALANG['del'] . "</a></td>\n"; - print " </tr>\n"; - } - } - print "</table>\n"; - print "<div id=\"nav_bar\"><a name=\"LowArrow\" /a>\n"; - if ($tDisplay_back_show == 1) - { - print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_back#LowArrow\"><img border=\"0\" src=\"$incpath/images/arrow-l.png\" title=\"" . $PALANG['pOverview_left_arrow'] . "\" alt=\"" . $PALANG['pOverview_left_arrow'] . "\" /></a>\n"; - } - if ($tDisplay_up_show == 1) - { - print "<a href=\"$file?domain=$fDomain&limit=0#LowArrow\"><img border=\"0\" src=\"$incpath/images/arrow-u.png\" title=\"" . $PALANG['pOverview_up_arrow'] . "\" alt=\"" . $PALANG['pOverview_up_arrow'] . "\" /></a>\n"; - } - if ($tDisplay_next_show == 1) - { - print "<a href=\"$file?domain=$fDomain&limit=$tDisplay_next#LowArrow\"><img border=\"0\" src=\"$incpath/images/arrow-r.png\" title=\"" . $PALANG['pOverview_right_arrow'] . "\" alt=\"" . $PALANG['pOverview_right_arrow'] . "\" /></a>\n"; - } - print "</div>\n"; - -} -if($tCanAddMailbox) { - print "<p><a href=\"create-mailbox.php?domain=$fDomain\">" . $PALANG['pMenu_create_mailbox'] . "</a>\n"; -} - -if ($CONF['show_status'] == 'YES' && $CONF['show_status_key'] == 'YES') -{ - print "<br><br>"; - if ($CONF['show_undeliverable'] == 'YES') - { - print " <span style='background-color:" . $CONF['show_undeliverable_color'] . - "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_undeliverable'] . "\n"; - } - if ($CONF['show_popimap'] == 'YES') - { - print " <span style='background-color:" . $CONF['show_popimap_color'] . - "'>" . $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_popimap'] . "\n"; - } - if ( $CONF['show_custom_count'] > 0 ) - { - for ($i = 0; $i < sizeof ($CONF['show_custom_domains']); $i++) - { - print " <span style='background-color:" . $CONF['show_custom_colors'][$i] . "'>" . - $CONF['show_status_text'] . "</span>=" . $PALANG['pStatus_custom'] . - $CONF['show_custom_domains'][$i] . "\n"; - } - } -} - -/* vim: set ft=php expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ -?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-03 19:21:22
|
Revision: 180 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=180&view=rev Author: GingerDog Date: 2007-11-03 12:21:27 -0700 (Sat, 03 Nov 2007) Log Message: ----------- setup.php: try and make sure the "ALL" domain exists to start with when creating the super admin user; fix html so li elements are closed Modified Paths: -------------- trunk/setup.php Modified: trunk/setup.php =================================================================== --- trunk/setup.php 2007-11-03 19:03:43 UTC (rev 179) +++ trunk/setup.php 2007-11-03 19:21:27 UTC (rev 180) @@ -59,11 +59,11 @@ { if (phpversion() < 5) $phpversion = 4; if (phpversion() >= 5) $phpversion = 5; - print "<li>PHP version " . phpversion () . "\n"; + print "<li>PHP version " . phpversion () . "</li>\n"; } else { - print "<li><b>Unable to check for PHP version. (missing function: phpversion())</b>\n"; + print "<li><b>Unable to check for PHP version. (missing function: phpversion())</b></li>\n"; } // @@ -71,11 +71,11 @@ // if ($f_apache_get_version == 1) { - print "<li>" . apache_get_version() . "\n"; + print "<li>" . apache_get_version() . "</li>\n"; } else { - print "<li><b>Unable to check for Apache version. (missing function: apache_get_version())</b>\n"; + print "<li><b>Unable to check for Apache version. (missing function: apache_get_version())</b></li>\n"; } print "</ul>"; @@ -89,16 +89,16 @@ { if (get_magic_quotes_gpc () == 0) { - print "<li>Magic Quotes: Disabled - OK\n"; + print "<li>Magic Quotes: Disabled - OK</li>\n"; } else { - print "<li><b>Warning: Magic Quotes: ON (internal workaround used)</b>\n"; + print "<li><b>Warning: Magic Quotes: ON (internal workaround used)</b></li>\n"; } } else { - print "<li><b>Unable to check for Magic Quotes. (missing function: get_magic_quotes_gpc())</b>\n"; + print "<li><b>Unable to check for Magic Quotes. (missing function: get_magic_quotes_gpc())</b></li>\n"; } // @@ -107,16 +107,16 @@ $config_loaded = 0; if ($file_config == 1) { - print "<li>Depends on: presence config.inc.php - OK\n"; + print "<li>Depends on: presence config.inc.php - OK</li>\n"; require_once('config.inc.php'); $config_loaded = 1; } else { - print "<li><b>Error: Depends on: presence config.inc.php - NOT FOUND</b><br />\n"; - print "Create the file.<br />"; + print "<li><b>Error: Depends on: presence config.inc.php - NOT FOUND</b><br /></li>\n"; + print "Create the file, and edit as appropriate (e.g. select database type etc)<br />"; print "For example:<br />\n"; - print "<pre>% cp config.inc.php.sample config.inc.php</pre>\n"; + print "<code><pre>cp config.inc.php.sample config.inc.php</pre></code>\n"; $error =+ 1; } @@ -143,7 +143,7 @@ print "<pre>% cd /usr/ports/databases/php$phpversion-pgsql/\n"; print "% make clean install\n"; print " - or with portupgrade -\n"; - print "% portinstall php$phpversion-pgsql</pre>\n"; + print "% portinstall php$phpversion-pgsql</pre></li>\n"; $error =+ 1; } // @@ -151,7 +151,7 @@ // if ($f_mysql_connect == 1) { - print "<li>Depends on: MySQL 3.23, 4.0 - OK\n"; + print "<li>Depends on: MySQL 3.23, 4.0 - OK</li>\n"; } // @@ -165,6 +165,7 @@ if ( !($config_loaded && $CONF['database_type'] == 'mysqli') ) { print "(change the database_type to 'mysqli' in config.inc.php!!)\n"; } + print "</li>"; } } @@ -177,6 +178,7 @@ if ( !($config_loaded && $CONF['database_type'] == 'pgsql') ) { print "(change the database_type to 'pgsql' in config.inc.php!!)\n"; } + print "</li>"; } // @@ -185,11 +187,11 @@ if ($config_loaded) { list ($link, $error_text) = db_connect(TRUE); if ($error_text == "") { - print "<li>Testing database connection - OK"; + print "<li>Testing database connection - OK - {$CONF['database_type']}://{$CONF['database_user']}:xxxxx@{$CONF['database_host']}/{$CONF['database_name']}</li>"; } else { print "<li><b>Error: Can't connect to database</b><br />\n"; print "Please edit the \$CONF['database_*'] parameters in config.inc.php.\n"; - print "$error_text\n"; + print "$error_text</li>\n"; $error ++; } } @@ -199,7 +201,7 @@ // if ($f_session_start == 1) { - print "<li>Depends on: session - OK\n"; + print "<li>Depends on: session - OK</li>\n"; } else { @@ -208,7 +210,7 @@ print "<pre>% cd /usr/ports/www/php$phpversion-session/\n"; print "% make clean install\n"; print " - or with portupgrade -\n"; - print "% portinstall php$phpversion-session</pre>\n"; + print "% portinstall php$phpversion-session</pre></li>\n"; $error =+ 1; } @@ -217,7 +219,7 @@ // if ($f_preg_match == 1) { - print "<li>Depends on: pcre - OK\n"; + print "<li>Depends on: pcre - OK</li>\n"; } else { @@ -226,7 +228,7 @@ print "<pre>% cd /usr/ports/devel/php$phpversion-pcre/\n"; print "% make clean install\n"; print " - or with portupgrade -\n"; - print "% portinstall php$phpversion-pcre</pre>\n"; + print "% portinstall php$phpversion-pcre</pre></li>\n"; $error =+ 1; } @@ -252,6 +254,12 @@ if (isset ($_POST['fPassword'])) $fPassword = escape_string ($_POST['fPassword']); if (isset ($_POST['fPassword2'])) $fPassword2 = escape_string ($_POST['fPassword2']); + // XXX need to ensure domains table includes an 'ALL' entry. + $r = db_query("SELECT * FROM domain WHERE domain = 'ALL'"); + if($r['rows'] == 0) { + 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); if ($error != 0) { if (isset ($_POST['fUsername'])) $tUsername = escape_string ($_POST['fUsername']); @@ -301,7 +309,6 @@ print "<b>Make sure you delete this setup.php file!</b><br />\n"; print "Also check the config.inc.php file for any settings that you might need to change!<br />\n"; - print "Click here to go to the <a href=\"admin\">admin section</a> (make sure that your .htaccess is setup properly)\n"; } ?> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-03 19:03:41
|
Revision: 179 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=179&view=rev Author: GingerDog Date: 2007-11-03 12:03:43 -0700 (Sat, 03 Nov 2007) Log Message: ----------- functions.inc.php: change doc block formatting Modified Paths: -------------- trunk/functions.inc.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2007-11-03 18:46:32 UTC (rev 178) +++ trunk/functions.inc.php 2007-11-03 19:03:43 UTC (rev 179) @@ -1526,11 +1526,13 @@ } -// -// db_insert -// Action: Inserts a row from a specified table -// Call: db_insert (string table, array values) -// +/** + * db_insert + * Action: Inserts a row from a specified table + * Call: db_insert (string table, array values) + * @param String $table - table name + * @param array - key/value map of data to insert into the table. + */ function db_insert ($table, $values) { $sql_values = "(" . implode(",",escape_string(array_keys($values))).") VALUES ('".implode("','",escape_string($values))."')"; @@ -1549,22 +1551,19 @@ -// -// db_log -// Action: Logs actions from admin -// Call: db_log (string username, string domain, string action, string data) -/* - -Possible actions are: -'create_alias' -'delete_alias' -'delete_mailbox' -'edit_alias' -'edit_alias_state' -'edit_mailbox' -'edit_mailbox_state' -'edit_password' - +/** + * db_log + * Action: Logs actions from admin + * Call: db_log (string username, string domain, string action, string data) + * Possible actions are: + * 'create_alias' + * 'delete_alias' + * 'delete_mailbox' + * 'edit_alias' + * 'edit_alias_state' + * 'edit_mailbox' + * 'edit_mailbox_state' + * 'edit_password' */ function db_log ($username,$domain,$action,$data) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-03 18:46:28
|
Revision: 178 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=178&view=rev Author: GingerDog Date: 2007-11-03 11:46:32 -0700 (Sat, 03 Nov 2007) Log Message: ----------- SUPERADMIN.TXT: updating docs Modified Paths: -------------- trunk/DOCUMENTS/SUPERADMIN.TXT Modified: trunk/DOCUMENTS/SUPERADMIN.TXT =================================================================== --- trunk/DOCUMENTS/SUPERADMIN.TXT 2007-11-03 18:41:38 UTC (rev 177) +++ trunk/DOCUMENTS/SUPERADMIN.TXT 2007-11-03 18:46:32 UTC (rev 178) @@ -32,3 +32,6 @@ Bye Then you can log in as ne...@do...d, password: admin + + +(The domain 'ALL' should already exist in the domain table; if not you'll need to recreate it) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-03 18:41:33
|
Revision: 177 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=177&view=rev Author: GingerDog Date: 2007-11-03 11:41:38 -0700 (Sat, 03 Nov 2007) Log Message: ----------- SUPERADMIN.TXT: updating docs Modified Paths: -------------- trunk/DOCUMENTS/SUPERADMIN.TXT Modified: trunk/DOCUMENTS/SUPERADMIN.TXT =================================================================== --- trunk/DOCUMENTS/SUPERADMIN.TXT 2007-11-03 18:32:10 UTC (rev 176) +++ trunk/DOCUMENTS/SUPERADMIN.TXT 2007-11-03 18:41:38 UTC (rev 177) @@ -1,17 +1,16 @@ - - ------------------------------------ Recreating a superadmin account -The database scripts DATABASE_MYSQL.TXT and DATABASE_PGSQL.TXT create a super admin - of ad...@do...d, password: admin - +When you run setup.php you will be required to enter a super user name and password. +This user will be able to login and modify any domain or setting. Hence, superadmin!. + With that login you can create new superadmins (and you should delete or change the password of ad...@do...d). If that user is no longer there or you didn't use -the .TXT files, you could add another manually from the database. Just use the code -from one of the .TXT files. Do this as root on the MySQL machine: - +the .TXT files, you could add another manually from the database. + +(The example uses MySQL, the syntax will be similar for PostgreSQL) + # mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8186 to server version: 5.0.27 @@ -33,4 +32,3 @@ Bye Then you can log in as ne...@do...d, password: admin - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-11-03 18:32:07
|
Revision: 176 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=176&view=rev Author: GingerDog Date: 2007-11-03 11:32:10 -0700 (Sat, 03 Nov 2007) Log Message: ----------- DATABASE_PGSQL.TXT: schema typo fix; thanks to http://sourceforge.net/forum/forum.php?thread_id=1843123&forum_id=676076 and jpalmer on irc Modified Paths: -------------- trunk/DATABASE_PGSQL.TXT Modified: trunk/DATABASE_PGSQL.TXT =================================================================== --- trunk/DATABASE_PGSQL.TXT 2007-11-02 00:50:58 UTC (rev 175) +++ trunk/DATABASE_PGSQL.TXT 2007-11-03 18:32:10 UTC (rev 176) @@ -126,7 +126,7 @@ domain, domain_admins, log, - mailbox, + mailbox TO postfixadmin; GRANT SELECT ON alias,domain,mailbox TO postfix; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-02 00:50:53
|
Revision: 175 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=175&view=rev Author: christian_boltz Date: 2007-11-01 17:50:58 -0700 (Thu, 01 Nov 2007) Log Message: ----------- - fixed some SQL syntax errors - debug output now includes the query Modified Paths: -------------- trunk/upgrade.php Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2007-11-02 00:35:46 UTC (rev 174) +++ trunk/upgrade.php 2007-11-02 00:50:58 UTC (rev 175) @@ -92,7 +92,7 @@ '{PRIMARY}' => 'primary key', '{UNSIGNED}' => 'unsigned' , '{FULLTEXT}' => 'FULLTEXT', - '{BOOLEAN}' => '`active` tinyint(1) NOT NULL', + '{BOOLEAN}' => 'tinyint(1) NOT NULL', '{UTF_8}' => '/*!40100 CHARACTER SET utf8 COLLATE utf8_unicode_ci */', '{LATIN1}' => '/*!40100 CHARACTER SET latin1 COLLATE latin1_swedish_ci */', '{IF_NOT_EXISTS}' => 'IF NOT EXISTS', @@ -128,7 +128,8 @@ $query = trim(str_replace(array_keys($replace), $replace, $sql)); $result = db_query($query, $ignore_errors); if (safeget('debug') != "") { - print $result['error']; + print "<p style='color:#999'>$query"; + print "<div style='color:#f00'>" . $result['error'] . "</div>"; } return $result; } @@ -195,7 +196,7 @@ ALTER TABLE $table_vacation ADD COLUMN created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL AFTER domain; ALTER TABLE $table_vacation ADD COLUMN active TINYINT(1) DEFAULT '1' NOT NULL AFTER created; ALTER TABLE $table_vacation DROP PRIMARY KEY - ALTER TABLE $table_vacation ADD COLUMN PRIMARY KEY(email); + ALTER TABLE $table_vacation ADD PRIMARY KEY(email) UPDATE $table_vacation SET domain=SUBSTRING_INDEX(email, '@', -1) WHERE email=email; ")); @@ -286,10 +287,10 @@ function upgrade_79_mysql() { # MySQL only # drop useless indicies (already available as primary key) - $result = db_query_parsed(_drop_index('admin', 'username')); - $result = db_query_parsed(_drop_index('alias', 'address')); - $result = db_query_parsed(_drop_index('domain', 'domain')); - $result = db_query_parsed(_drop_index('mailbox', 'username')); + $result = db_query_parsed(_drop_index('admin', 'username'), True); + $result = db_query_parsed(_drop_index('alias', 'address'), True); + $result = db_query_parsed(_drop_index('domain', 'domain'), True); + $result = db_query_parsed(_drop_index('mailbox', 'username'), True); } function upgrade_81_mysql() { # MySQL only @@ -337,9 +338,9 @@ $table_domain = table_by_key ('domain'); $table_mailbox = table_by_key ('mailbox'); - $result = db_query_parsed("ALTER TABLE $table_domain ALTER COLUMN `quota` bigint(20) NOT NULL default '0'", TRUE); - $result = db_query_parsed("ALTER TABLE $table_mailbox ALTER COLUMN `maxquota` bigint(20) NOT NULL default '0'", TRUE); - $result = db_query_parsed("ALTER TABLE $table_mailbox ALTER COLUMN `quota` bigint(20) NOT NULL default '0'", TRUE); + $result = db_query_parsed("ALTER TABLE $table_domain MODIFY COLUMN `quota` bigint(20) NOT NULL default '0'", TRUE); + $result = db_query_parsed("ALTER TABLE $table_domain MODIFY COLUMN `maxquota` bigint(20) NOT NULL default '0'", TRUE); + $result = db_query_parsed("ALTER TABLE $table_mailbox MODIFY COLUMN `quota` bigint(20) NOT NULL default '0'", TRUE); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-02 00:35:42
|
Revision: 174 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=174&view=rev Author: christian_boltz Date: 2007-11-01 17:35:46 -0700 (Thu, 01 Nov 2007) Log Message: ----------- - next try to expand $Revision$ in upgrade.php :-/ Modified Paths: -------------- trunk/upgrade.php Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2007-11-02 00:27:32 UTC (rev 173) +++ trunk/upgrade.php 2007-11-02 00:35:46 UTC (rev 174) @@ -37,7 +37,7 @@ function _do_upgrade($current_version) { global $CONF; - $target_version = preg_replace('/[^0-9]/', '', '$Revision:42$'); + $target_version = preg_replace('/[^0-9]/', '', '$Revision$'); if ($current_version >= $target_version) { # already up to date This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-02 00:27:27
|
Revision: 173 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=173&view=rev Author: christian_boltz Date: 2007-11-01 17:27:32 -0700 (Thu, 01 Nov 2007) Log Message: ----------- fetchmail.php: - cancel button did not work on $new Modified Paths: -------------- trunk/fetchmail.php Modified: trunk/fetchmail.php =================================================================== --- trunk/fetchmail.php 2007-11-02 00:24:36 UTC (rev 172) +++ trunk/fetchmail.php 2007-11-02 00:27:32 UTC (rev 173) @@ -150,6 +150,7 @@ if ($cancel) { $edit=0; + $new=0; } elseif ($delete) { $result = db_query ("delete from fetchmail WHERE id=".$delete); if ($result['rows'] != 1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-02 00:24:32
|
Revision: 172 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=172&view=rev Author: christian_boltz Date: 2007-11-01 17:24:36 -0700 (Thu, 01 Nov 2007) Log Message: ----------- upgrade.php: - create config table at startup (not nice, but works) - changed _do_upgrade to use "for ($i = $current_version +1; $i <= $target_version; $i++)" loop and function_exists() - added support for upgrade_<number>>_mysql() and upgrade_<number>_pgsql() functions for database-specific changes - added function db_query_parsed(), idea taken from serendipity's include/db/*.php serendipity_db_schema_import() - added function _drop_index() - MySQL and PgSQL syntax differs too much on this - added pre-2.1 database updates (DOCUMENTS/TABLE_BACKUP_MX.TXT and DOCUMENTS/TABLE_CHANGES.TXT) - added all database changes between 2.1 and current SVN. Everything since the move to sourceforge has the revision number in the function name. (still several TODOs left) Modified Paths: -------------- trunk/upgrade.php Property Changed: ---------------- trunk/upgrade.php Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2007-11-01 23:58:12 UTC (rev 171) +++ trunk/upgrade.php 2007-11-02 00:24:36 UTC (rev 172) @@ -1,10 +1,27 @@ <?php require_once('common.php'); + +# Note: run with upgrade.php?debug=1 to see all SQL error messages + + +# Not nice, but works: +# We don't know if the config table exists, so we simply try to create it ;-) +# Better solution (TODO): query the db to see if the 'config' table exists + +$sql = " +CREATE TABLE {IF_NOT_EXISTS} " . table_by_key ('config') . "( + `id` {AUTOINCREMENT} {PRIMARY}, + `name` VARCHAR(20) {LATIN1} NOT NULL DEFAULT '', + `value` VARCHAR(20) {LATIN1} NOT NULL DEFAULT '', + UNIQUE name ( `name` ) +) +"; + +db_query_parsed($sql, 0, " ENGINE = MYISAM COMMENT = 'PostfixAdmin settings'"); + $sql = "SELECT * FROM config WHERE name = 'version'"; -// create table config (name varchar(20), value varchar(20)); // insert into config('version', '01'); -// Should really query the db to see if the 'config' table exists first! $r = db_query($sql); @@ -12,57 +29,334 @@ $rs = $r['result']; $row = db_array($rs); $version = $row['value']; - _do_upgrade($version); +} else { + $version = 0; } +_do_upgrade($version); function _do_upgrade($current_version) { - $all_functions = get_defined_functions(); - $upgrade_functions = array(); - foreach($all_functions['user'] as $function_name) { - if(preg_match('!upgrade_(\d+)!', $function_name, $matches)) { - $version = $matches[1]; - if($version <= $current_version) { - continue; - } - $upgrade_functions[$matches[1]] = $function_name; - } + global $CONF; + $target_version = preg_replace('/[^0-9]/', '', '$Revision:42$'); + + if ($current_version >= $target_version) { + # already up to date + echo "up to date"; + return true; } - ksort($upgrade_functions); - foreach($upgrade_functions as $version => $function) { - $function(); - } + echo "<p>Updating database:<p>old version: $current_version; target version: $target_version"; + + for ($i = $current_version +1; $i <= $target_version; $i++) { + $function = "upgrade_$i"; + $function_mysql = $function . "_mysql"; + $function_pgsql = $function . "_pgsql"; + if (function_exists($function)) { + echo "<p>updating to version $i (all databases)..."; + $function(); + echo " done"; + } + if ($CONF['database_type'] == 'mysql' || $CONF['database_type'] == 'mysqli' ) { + if (function_exists($function_mysql)) { + echo "<p>updating to version $i (MySQL)..."; + $function_mysql(); + echo " done"; + } + } elseif($CONF['database_type'] == 'pgsql') { + if (function_exists($function_pgsql)) { + echo "<p>updating to version $i (PgSQL)..."; + $function_pgsql(); + echo " done"; + } + } + # TODO: update version in config table after each change + # TODO: this avoids problems in case the script hits the max_execution_time, + # TODO: simply rerunning it will continue where it was stopped + }; } -function upgrade_00() { +/** + * Replaces database specific parts in a query + * @param String sql query with placeholders + * @param String (optional) MySQL specific code to attach, useful for COMMENT= on CREATE TABLE + * @return String sql query + */ + +function db_query_parsed($sql, $ignore_errors = 0, $attach_mysql = "") { global $CONF; - if($CONF['database_type'] == 'mysql') { - echo 'mysql 00'; + + if ($CONF['database_type'] == 'mysql' || $CONF['database_type'] == 'mysqli' ) { + + $replace = array( + '{AUTOINCREMENT}' => 'int(11) not null auto_increment', + '{PRIMARY}' => 'primary key', + '{UNSIGNED}' => 'unsigned' , + '{FULLTEXT}' => 'FULLTEXT', + '{BOOLEAN}' => '`active` tinyint(1) NOT NULL', + '{UTF_8}' => '/*!40100 CHARACTER SET utf8 COLLATE utf8_unicode_ci */', + '{LATIN1}' => '/*!40100 CHARACTER SET latin1 COLLATE latin1_swedish_ci */', + '{IF_NOT_EXISTS}' => 'IF NOT EXISTS', + '{RENAME_COLUMN}' => 'CHANGE COLUMN', + ); + $sql = "$sql $attach_mysql"; + + } elseif($CONF['database_type'] == 'pgsql') { + static $replace = array( + '{AUTOINCREMENT}' => 'SERIAL', + '{PRIMARY}' => 'primary key', + '{UNSIGNED}' => '', + '{FULLTEXT}' => '', + '{BOOLEAN}' => 'BOOLEAN NOT NULL', + '{UTF_8}' => '', # TODO: UTF_8 is simply ignored. + '{LATIN1}' => '', # TODO: same for latin1 + '{IF_NOT_EXISTS}' => 'IF NOT EXISTS', # TODO: does this work with PgSQL? + '{RENAME_COLUMN}' => 'CHANGE COLUMN', # TODO: probably wrong + 'int(1)' => 'int2', + 'int(10)' => 'int4', + 'int(11)' => 'int4', + 'int(4)' => 'int4', + ); + + } else { + echo "Sorry, unsupported database type " . $conf['database_type']; + exit; } - if($CONF['database_type'] == 'pgsql') { - echo 'pgsql 00'; + + $replace['{BOOL_TRUE}'] = db_get_boolean(True); + $replace['{BOOL_FALSE}'] = db_get_boolean(False); + + $query = trim(str_replace(array_keys($replace), $replace, $sql)); + $result = db_query($query, $ignore_errors); + if (safeget('debug') != "") { + print $result['error']; } + return $result; } -function upgrade_01() { +function _drop_index ($table, $index) { global $CONF; - if($CONF['database_type'] == 'mysql') { - echo 'mysql 01'; + $tabe = table_by_key ($table); + + if ($CONF['database_type'] == 'mysql' || $CONF['database_type'] == 'mysqli' ) { + return "ALTER TABLE $table DROP INDEX $index"; + } elseif($CONF['database_type'] == 'pgsql') { + return "DROP INDEX $index"; # TODO: on which table?! + } else { + echo "Sorry, unsupported database type " . $conf['database_type']; + exit; } - if($CONF['database_type'] == 'pgsql') { - echo 'pgsql 01'; - } } -function upgrade_02() { - global $CONF; - if($CONF['database_type'] == 'mysql') { - echo 'mysql 02'; + +function upgrade_1() { + # inserting the version number is a good start ;-) + db_insert( + 'config', + array( + 'name' => 'version', + 'value' => '1', + ) + ); + echo "upgrade_1"; +} + +function upgrade_2() { + # upgrade pre-2.1 database + # from TABLE_BACKUP_MX.TXT + $table_domain = table_by_key ('domain'); + $result = db_query_parsed("ALTER TABLE $table_domain ADD COLUMN transport VARCHAR(255) AFTER maxquota;", TRUE); + $result = db_query_parsed("ALTER TABLE $table_domain ADD COLUMN backupmx {BOOLEAN} DEFAULT {BOOL_FALSE} AFTER transport;", TRUE); +} + +function upgrade_3() { + # upgrade pre-2.1 database + # from TABLE_CHANGES.TXT + $table_admin = table_by_key ('admin'); + $table_alias = table_by_key ('alias'); + $table_domain = table_by_key ('domain'); + $table_mailbox = table_by_key ('mailbox'); + $table_vacation = table_by_key ('vacation'); + + $all_sql = split("\n", trim(" + ALTER TABLE $table_admin {RENAME_COLUMN} create_date created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_admin {RENAME_COLUMN} change_date modified DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_alias {RENAME_COLUMN} create_date created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_alias {RENAME_COLUMN} change_date modified DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_domain {RENAME_COLUMN} create_date created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_domain {RENAME_COLUMN} change_date modified DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_domain ADD COLUMN aliases INT(10) DEFAULT '-1' NOT NULL AFTER description; + ALTER TABLE $table_domain ADD COLUMN mailboxes INT(10) DEFAULT '-1' NOT NULL AFTER aliases; + ALTER TABLE $table_domain ADD COLUMN maxquota INT(10) DEFAULT '-1' NOT NULL AFTER mailboxes; + ALTER TABLE $table_domain ADD COLUMN transport VARCHAR(255) AFTER maxquota; + ALTER TABLE $table_domain ADD COLUMN backupmx TINYINT(1) DEFAULT '0' NOT NULL AFTER transport; + ALTER TABLE $table_mailbox {RENAME_COLUMN} create_date created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_mailbox {RENAME_COLUMN} change_date modified DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL; + ALTER TABLE $table_mailbox ADD COLUMN quota INT(10) DEFAULT '-1' NOT NULL AFTER maildir; + ALTER TABLE $table_vacation ADD COLUMN domain VARCHAR(255) DEFAULT '' NOT NULL AFTER cache; + ALTER TABLE $table_vacation ADD COLUMN created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL AFTER domain; + ALTER TABLE $table_vacation ADD COLUMN active TINYINT(1) DEFAULT '1' NOT NULL AFTER created; + ALTER TABLE $table_vacation DROP PRIMARY KEY + ALTER TABLE $table_vacation ADD COLUMN PRIMARY KEY(email); + UPDATE $table_vacation SET domain=SUBSTRING_INDEX(email, '@', -1) WHERE email=email; + ")); + + foreach ($all_sql as $sql) { + $result = db_query_parsed($sql, TRUE); } - if($CONF['database_type'] == 'pgsql') { - echo 'pgsql 02'; - } } -function upgrade_03() { - echo 'woof 03'; + +function upgrade_4_mysql() { # MySQL only + # changes between 2.1 and moving to sourceforge + $table_domain = table_by_key ('domain'); + $result = db_query_parsed("ALTER TABLE $table_domain ADD COLUMN quota int(10) NOT NULL default '0' AFTER maxquota", TRUE); } + +function upgrade_4_pgsql() { # PgSQL only + # changes between 2.1 and moving to sourceforge + +/* TODO + +Changes in DATABASE_PGSQL.TXT: (in diff format - "-" means removed, "+" means added) + +TABLE domain +- domain character varying(255) NOT NULL default '', ++ domain character varying(255) NOT NULL, ++ quota integer NOT NULL default 0, + ++CREATE INDEX domain_domain_active ON domain(domain,active); + + +TABLE "admin" +- "username" character varying(255) NOT NULL default '', ++ "username" character varying(255) NOT NULL, + + +TABLE alias +- address character varying(255) NOT NULL default '', ++ address character varying(255) NOT NULL, +- domain character varying(255) NOT NULL default '', ++ domain character varying(255) NOT NULL REFERENCES domain, + ++CREATE INDEX alias_address_active ON alias(address,active); + +TABLE domain_admins +- username character varying(255) NOT NULL default '', ++ username character varying(255) NOT NULL, +- domain character varying(255) NOT NULL default '', ++ domain character varying(255) NOT NULL REFERENCES domain, + +TABLE log +- data character varying(255) NOT NULL default '' ++ data text NOT NULL default '' + +TABLE mailbox +- username character varying(255) NOT NULL default '', ++ username character varying(255) NOT NULL, +- domain character varying(255) NOT NULL default '', ++ domain character varying(255) NOT NULL REFERENCES domain, + ++CREATE INDEX mailbox_username_active ON mailbox(username,active); + +TABLE vacation +- email character varying(255) NOT NULL default '', ++ email character varying(255) PRIMARY KEY, +- body text NOT NULL, ++ body text NOT NULL DEFAULT '', +- cache text NOT NULL, ++ cache text NOT NULL DEFAULT '', +- domain character varying(255) NOT NULL default '', ++ "domain" character varying(255) NOT NULL REFERENCES "domain", +- active boolean NOT NULL default true, ++ active boolean DEFAULT true NOT NULL +- Constraint "vacation_key" Primary Key ("email") + +-COMMENT ON TABLE vacation IS 'Postfix Admin - Virtual Vacation'; + ++CREATE INDEX vacation_email_active ON vacation(email,active); + ++CREATE TABLE vacation_notification ( ++ on_vacation character varying(255) NOT NULL REFERENCES vacation(email) ON DELETE CASCADE, ++ notified character varying(255) NOT NULL, ++ notified_at timestamp with time zone NOT NULL DEFAULT now(), ++ CONSTRAINT vacation_notification_pkey primary key(on_vacation,notified) ++); + + +*/ +} + +function upgrade_79_mysql() { # MySQL only + # drop useless indicies (already available as primary key) + $result = db_query_parsed(_drop_index('admin', 'username')); + $result = db_query_parsed(_drop_index('alias', 'address')); + $result = db_query_parsed(_drop_index('domain', 'domain')); + $result = db_query_parsed(_drop_index('mailbox', 'username')); +} + +function upgrade_81_mysql() { # MySQL only +/* TODO + +table vacation - +- all varchar + text fields changed to utf8 +- active was tinyint (1), now (4) +- ENGINE changed +- DEFAULT CHARSET changed +- COLLATE changed + +diff: + - `body` text NOT NULL default '', + - `cache` text NOT NULL default '', + + body text NOT NULL, + + cache text NOT NULL, + - `active` tinyint(1) NOT NULL default '1', + + active tinyint(4) NOT NULL default '1', -> boolean are usually tinyint(1) + -) TYPE=MyISAM COMMENT='Postfix Admin - Virtual Vacation'; + +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci TYPE=InnoDB COMMENT='Postfix Admin - Virtual Vacation' ; + + + + */ + + db_query_parsed( + " CREATE TABLE {IF_NOT_EXISTS} vacation_notification ( + on_vacation varchar(255) NOT NULL, + notified varchar(255) NOT NULL, + notified_at timestamp NOT NULL default now(), + CONSTRAINT vacation_notification_pkey PRIMARY KEY(on_vacation, notified), + FOREIGN KEY (on_vacation) REFERENCES vacation(email) ON DELETE CASCADE + ) + ", + TRUE, + " ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci TYPE=InnoDB + COMMENT='Postfix Admin - Virtual Vacation Notifications' + " + ); +} + +function upgrade_169_mysql() { # MySQL only + # allow quota > 2 GB + + $table_domain = table_by_key ('domain'); + $table_mailbox = table_by_key ('mailbox'); + $result = db_query_parsed("ALTER TABLE $table_domain ALTER COLUMN `quota` bigint(20) NOT NULL default '0'", TRUE); + $result = db_query_parsed("ALTER TABLE $table_mailbox ALTER COLUMN `maxquota` bigint(20) NOT NULL default '0'", TRUE); + $result = db_query_parsed("ALTER TABLE $table_mailbox ALTER COLUMN `quota` bigint(20) NOT NULL default '0'", TRUE); +} + + +/* +TODO + + Database changes that should be done: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +MySQL: +* vacation: DROP INDEX email +* vacation_notification: + - DEFAULT CHARSET and COLLATE should be changed + - change all varchar fields to latin1 (email addresses don't contain utf8 characters) +* remove all DROP TABLE statements from DATABASE_* + +*/ + + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Property changes on: trunk/upgrade.php ___________________________________________________________________ Name: svn:keywords + Revision This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2007-11-01 23:58:13
|
Revision: 171 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=171&view=rev Author: christian_boltz Date: 2007-11-01 16:58:12 -0700 (Thu, 01 Nov 2007) Log Message: ----------- - added function db_insert() - added optional $ignore_errors parameter to db_query() - db_query() now returns 'error' as additional key in the result array - renamed $setup to $ignore_errors in db_connect() - added fallback to $table_key to table_by_key() Modified Paths: -------------- trunk/functions.inc.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2007-10-31 20:18:53 UTC (rev 170) +++ trunk/functions.inc.php 2007-11-01 23:58:12 UTC (rev 171) @@ -1284,20 +1284,20 @@ * db_connect * Action: Makes a connection to the database if it doesn't exist * Call: db_connect () - * Optional parameter: $setup = TRUE, used by setup.php + * Optional parameter: $ignore_errors = TRUE, used by setup.php * * Return value: - * a) without $setup or $setup == 0 + * a) without $ignore_errors or $ignore_errors == 0 * - $link - the database connection -OR- * - call die() in case of connection problems - * b) with $setup == TRUE + * b) with $ignore_errors == TRUE * array($link, $error_text); */ -function db_connect ($setup = 0) +function db_connect ($ignore_errors = 0) { global $CONF; global $DEBUG_TEXT; - if ($setup != 0) $DEBUG_TEXT = ''; + if ($ignore_errors != 0) $DEBUG_TEXT = ''; $error_text = ''; $link = 0; @@ -1351,7 +1351,7 @@ $error_text = "<p />DEBUG INFORMATION:<br />Invalid \$CONF['database_type']! Please fix your config.inc.php! $DEBUG_TEXT"; } - if ($setup) + if ($ignore_errors) { return array($link, $error_text); } @@ -1406,43 +1406,53 @@ // db_query // Action: Sends a query to the database and returns query result and number of rows // Call: db_query (string query) +// Optional parameter: $ignore_errors = TRUE, used by upgrade.php // -function db_query ($query) +function db_query ($query, $ignore_errors = 0) { global $CONF; global $DEBUG_TEXT; $result = ""; $number_rows = ""; static $link; + $error_text = ""; + if ($ignore_errors) $DEBUG_TEXT = ""; if (!is_resource($link)) $link = db_connect (); - if ($CONF['database_type'] == "mysql") $result = @mysql_query ($query, $link) or die ("<p />DEBUG INFORMATION:<br />Invalid query: " . mysql_error($link) . "$DEBUG_TEXT"); - if ($CONF['database_type'] == "mysqli") $result = @mysqli_query ($link, $query) or die ("<p />DEBUG INFORMATION:<br />Invalid query: " . mysqli_error($link) . "$DEBUG_TEXT"); + if ($CONF['database_type'] == "mysql") $result = @mysql_query ($query, $link) + or $error_text = "<p />DEBUG INFORMATION:<br />Invalid query: " . mysql_error($link) . "$DEBUG_TEXT"; + if ($CONF['database_type'] == "mysqli") $result = @mysqli_query ($link, $query) + or $error_text = "<p />DEBUG INFORMATION:<br />Invalid query: " . mysqli_error($link) . "$DEBUG_TEXT"; if ($CONF['database_type'] == "pgsql") { - $result = @pg_query ($link, $query) or die ("<p />DEBUG INFORMATION:<br />Invalid query: " . pg_last_error() . "$DEBUG_TEXT"); + $result = @pg_query ($link, $query) + or $error_text = "<p />DEBUG INFORMATION:<br />Invalid query: " . pg_last_error() . "$DEBUG_TEXT"; } + if ($error_text != "" && $ignore_errors == 0) die($error_text); - if (eregi ("^SELECT", $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); - if ($CONF['database_type'] == "mysqli") $number_rows = mysqli_num_rows ($result); - if ($CONF['database_type'] == "pgsql") $number_rows = pg_num_rows ($result); + if ($error_text == "") { + if (eregi ("^SELECT", $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); + if ($CONF['database_type'] == "mysqli") $number_rows = mysqli_num_rows ($result); + if ($CONF['database_type'] == "pgsql") $number_rows = pg_num_rows ($result); + } + else + { + // if $query was something else, UPDATE, DELETE or INSERT check the number of rows with + // [database_type]_affected_rows (). + if ($CONF['database_type'] == "mysql") $number_rows = mysql_affected_rows ($link); + if ($CONF['database_type'] == "mysqli") $number_rows = mysqli_affected_rows ($link); + if ($CONF['database_type'] == "pgsql") $number_rows = pg_affected_rows ($result); + } } - else - { - // if $query was something else, UPDATE, DELETE or INSERT check the number of rows with - // [database_type]_affected_rows (). - if ($CONF['database_type'] == "mysql") $number_rows = mysql_affected_rows ($link); - if ($CONF['database_type'] == "mysqli") $number_rows = mysqli_affected_rows ($link); - if ($CONF['database_type'] == "pgsql") $number_rows = pg_affected_rows ($result); - } $return = array ( "result" => $result, - "rows" => $number_rows + "rows" => $number_rows, + "error" => $error_text ); return $return; } @@ -1516,7 +1526,29 @@ } +// +// db_insert +// Action: Inserts a row from a specified table +// Call: db_insert (string table, array values) +// +function db_insert ($table, $values) +{ + $sql_values = "(" . implode(",",escape_string(array_keys($values))).") VALUES ('".implode("','",escape_string($values))."')"; + $table = table_by_key ($table); + $result = db_query ("INSERT INTO $table $sql_values"); + if ($result['rows'] >= 1) + { + return $result['rows']; + } + else + { + return true; + } +} + + + // // db_log // Action: Logs actions from admin @@ -1571,6 +1603,7 @@ { global $CONF; $table = $CONF['database_prefix'].$CONF['database_tables'][$table_key]; + if (empty($table)) $table = $table_key; return $table; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-10-31 20:18:55
|
Revision: 170 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=170&view=rev Author: GingerDog Date: 2007-10-31 13:18:53 -0700 (Wed, 31 Oct 2007) Log Message: ----------- upgrade.php: test edition of a db upgrade script, based loosely around what Drupal uses Added Paths: ----------- trunk/upgrade.php Added: trunk/upgrade.php =================================================================== --- trunk/upgrade.php (rev 0) +++ trunk/upgrade.php 2007-10-31 20:18:53 UTC (rev 170) @@ -0,0 +1,68 @@ +<?php +require_once('common.php'); +$sql = "SELECT * FROM config WHERE name = 'version'"; + +// create table config (name varchar(20), value varchar(20)); +// insert into config('version', '01'); +// Should really query the db to see if the 'config' table exists first! + +$r = db_query($sql); + +if($r['rows'] == 1) { + $rs = $r['result']; + $row = db_array($rs); + $version = $row['value']; + _do_upgrade($version); +} + + +function _do_upgrade($current_version) { + $all_functions = get_defined_functions(); + $upgrade_functions = array(); + foreach($all_functions['user'] as $function_name) { + if(preg_match('!upgrade_(\d+)!', $function_name, $matches)) { + $version = $matches[1]; + if($version <= $current_version) { + continue; + } + $upgrade_functions[$matches[1]] = $function_name; + } + } + + ksort($upgrade_functions); + foreach($upgrade_functions as $version => $function) { + $function(); + } +} + +function upgrade_00() { + global $CONF; + if($CONF['database_type'] == 'mysql') { + echo 'mysql 00'; + } + if($CONF['database_type'] == 'pgsql') { + echo 'pgsql 00'; + } +} + +function upgrade_01() { + global $CONF; + if($CONF['database_type'] == 'mysql') { + echo 'mysql 01'; + } + if($CONF['database_type'] == 'pgsql') { + echo 'pgsql 01'; + } +} +function upgrade_02() { + global $CONF; + if($CONF['database_type'] == 'mysql') { + echo 'mysql 02'; + } + if($CONF['database_type'] == 'pgsql') { + echo 'pgsql 02'; + } +} +function upgrade_03() { + echo 'woof 03'; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2007-10-31 19:31:26
|
Revision: 169 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=169&view=rev Author: GingerDog Date: 2007-10-31 12:31:30 -0700 (Wed, 31 Oct 2007) Log Message: ----------- DATABASE_MYSQL.TXT: use bigints for quota - as suggested by xpoint on irc Modified Paths: -------------- trunk/DATABASE_MYSQL.TXT Modified: trunk/DATABASE_MYSQL.TXT =================================================================== --- trunk/DATABASE_MYSQL.TXT 2007-10-31 18:24:40 UTC (rev 168) +++ trunk/DATABASE_MYSQL.TXT 2007-10-31 19:31:30 UTC (rev 169) @@ -73,8 +73,8 @@ `description` varchar(255) NOT NULL default '', `aliases` int(10) NOT NULL default '0', `mailboxes` int(10) NOT NULL default '0', - `maxquota` int(10) NOT NULL default '0', - `quota` int(10) NOT NULL default '0', + `maxquota` bigint(20) NOT NULL default '0', + `quota` bigint(20) NOT NULL default '0', `transport` varchar(255) default NULL, `backupmx` tinyint(1) NOT NULL default '0', `created` datetime NOT NULL default '0000-00-00 00:00:00', @@ -114,7 +114,7 @@ `password` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '', `maildir` varchar(255) NOT NULL default '', - `quota` int(10) NOT NULL default '0', + `quota` bigint(20) NOT NULL default '0', `domain` varchar(255) NOT NULL default '', `created` datetime NOT NULL default '0000-00-00 00:00:00', `modified` datetime NOT NULL default '0000-00-00 00:00:00', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |