Thread: SF.net SVN: postfixadmin:[579] trunk (Page 2)
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2009-03-13 21:48:43
|
Revision: 579 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=579&view=rev Author: GingerDog Date: 2009-03-13 21:48:38 +0000 (Fri, 13 Mar 2009) Log Message: ----------- add xmlrpc server support - TOTALLY NOT TESTED YET!!! Modified Paths: -------------- trunk/model/AliasHandler.php trunk/model/VacationHandler.php Added Paths: ----------- trunk/xmlrpc.php Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2009-03-13 20:49:54 UTC (rev 578) +++ trunk/model/AliasHandler.php 2009-03-13 21:48:38 UTC (rev 579) @@ -7,12 +7,15 @@ private $username = null; + /** + * @param string $username + */ public function __construct($username) { $this->username = $username; + } - } /** - * @return list of email addresses the user's mail is forwarded to. + * @return array - list of email addresses the user's mail is forwarded to. * (may be an empty list, especially if $CONF['alias_control'] is turned off... * @param boolean - by default we don't return special addresses (e.g. vacation and mailbox alias); pass in true here if you wish to. */ Modified: trunk/model/VacationHandler.php =================================================================== --- trunk/model/VacationHandler.php 2009-03-13 20:49:54 UTC (rev 578) +++ trunk/model/VacationHandler.php 2009-03-13 21:48:38 UTC (rev 579) @@ -79,7 +79,6 @@ return false; } /** - * @param string $username * @param string $subject * @param string $body */ Added: trunk/xmlrpc.php =================================================================== --- trunk/xmlrpc.php (rev 0) +++ trunk/xmlrpc.php 2009-03-13 21:48:38 UTC (rev 579) @@ -0,0 +1,146 @@ +<?php +/** + * Requires the Zend framework is installed and in the include path. + * + * Usage example: + * require_once('Zend/XmlRpc/Client.php'); + * $xmlrpc = new Zend_XmlRpc_Client('http://server/xmlrpc.php'); + * + * $http_client = $xmlrpc->getHttpClient(); + * $http_client->setCookieJar(); + * + * $login_object = $xmlrpc->getProxy('login'); + * $success = $login_object->login($username, $password); + * + * if($success) { + * echo "We're logged in"; + * } + * else { + * die("Auth failed"); + * } + * $user = $xmlrpc->getProxy('user'); + * $alias = $xmlrpc->getProxy('alias'); + * $vacation = $xmlrpc->getProxy('vacation'); + * + * if($vacation->isEnabled()) { + * echo "Vacation turned on for user"; + * } + * + * Note, the requirement that your XmlRpc client provides cookies with each request. + * If it does not do this, then your authentication details will not persist across requests. + */ + +require_once('Zend/XmlRpc/Server.php'); +$server = new Zend_XmlRpc_Server(); +session_start(); + +function login($username, $password) { + if(UserHandler::login($username, $password)) { + session_regenerate_id(); + $_SESSION['authenticated'] = true; + $_SESSION['username'] = $username; + } +} + +if(!isset($_SESSION['authenticated'])) { + $server->addFunction('login', 'login'); +} +else { + $server->addClass('user', 'UserProxy'); + $server->addClass('vacation', 'VacationProxy'); + $server->addClass('alias', 'AliasProxy'); +} +echo $server->handle(); + + +class UserProxy { + + /** + * @param string $old_password + * @param string $new_password + * @return boolean true on success + */ + public function changePassword($old_password, $new_password) { + $uh = new UserHandler($_SESSION['username']); + return $uh->change_pass($username, $old_password, $new_password); + } +} +class VacationProxy { + /** + * @return boolean true if the vacation is removed successfully. Else false. + */ + public function remove() { + $vh = new VacationHandler($_SESSION['username']); + return $vh->remove(); + } + + /** + * @return boolean true if vacation stuff is enabled in this instance of postfixadmin + * and the user has the ability to make changes to it. + */ + public function isVacationSupported() { + $vh = new VacationHandler($_SESSION['username']); + return $vh->vacation_supported(); + } + + /** + * @return boolean true if the user has an active vacation record etc. + */ + public function checkVacation() { + $vh = new VacationHandler($_SESSION['username']); + return $vh->check_vacation(); + } + + /** + * @return struct|boolean - either array of vacation details or boolean false if the user has none. + */ + public function getDetails() { + $vh = new VacationHandler($_SESSION['username']); + return $vh->get_details(); + } + + /** + * @param string $subject + * @param string $body + * @return boolean true on success. + */ + public function setAway($subject, $body) { + $vh = new VacationHandler($_SESSION['username']); + return $vh->set_away($subject, $body); + } + + +} +class AliasProxy { + /** + * @return array - array of aliases this user has. Array may be empty. + */ + public function get() { + $ah = new AliasHandler($_SESSION['username']); + /* I see no point in returning special addresses to the user. */ + return $ah->get(false); + } + + /** + * @param array of email addresses (Strings) + * @param string flag to set ('forward_and_store' or 'remote_only') + * @return boolean true + */ + public function update($addresses, $flags) { + $ah = new AliasHandler($_SESSION['username']); + /** + * if the user is on vacation, they should use VacationProxy stuff to remove it + * and we'll never return the vacation address from here anyway + */ + return $ah->update($addresses, $flags, true); + } + + /** + * @return boolean true if the user has 'store_and_forward' set. + * (i.e. their email address is also in the alias table). IF it returns false, then it's 'remote_only' + */ + public function hasStoreAndForward() { + $ah = new AliasHandler($_SESSION['username']); + return $ah->hasStoreAndForward(); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-03-13 23:32:44
|
Revision: 580 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=580&view=rev Author: christian_boltz Date: 2009-03-13 23:32:20 +0000 (Fri, 13 Mar 2009) Log Message: ----------- functions.inc.php, function pacrypt: - added dovecotpw encryption support (patch from cmuelle8 (trendypack) + some fixes from me, see tracker for details) https://sourceforge.net/tracker2/?func=detail&aid=2607332&group_id=191583&atid=937966 - replaced most "if" with "elseif" to be able to check for invalid $CONF[encrypt] settings - added error check/message for invalid $CONF[encrypt] settings config.inc.php: - $CONF[encrypt]: added description for dovecot:xy - added new $CONF['dovecotpw'] setting (path to dovecotpw binary) Modified Paths: -------------- trunk/config.inc.php trunk/functions.inc.php Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-03-13 21:48:38 UTC (rev 579) +++ trunk/config.inc.php 2009-03-13 23:32:20 UTC (rev 580) @@ -90,6 +90,7 @@ // cleartext = clear text passwords (ouch!) // mysql_encrypt = useful for PAM integration // authlib = support for courier-authlib style passwords +// dovecot:CRYPT-METHOD = use dovecotpw -s 'CRYPT-METHOD'. Example: dovecot:CRAM-MD5 $CONF['encrypt'] = 'md5crypt'; // In what flavor should courier-authlib style passwords be enrypted? @@ -98,6 +99,9 @@ // crypt = {crypt} + Standard UNIX DES-enrypted with 2-character salt $CONF['authlib_default_flavor'] = 'md5raw'; +// If you use the dovecot encryption method: where is the dovecotpw binary located? +$CONF['dovecotpw'] = "/usr/sbin/dovecotpw"; + // Minimum length required for passwords. Postfixadmin will not // allow users to set passwords which are shorter than this value. $CONF['min_password_length'] = 5; Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-03-13 21:48:38 UTC (rev 579) +++ trunk/functions.inc.php 2009-03-13 23:32:20 UTC (rev 580) @@ -1151,11 +1151,11 @@ $password = md5crypt ($pw, $salt); } - if ($CONF['encrypt'] == 'md5') { + elseif ($CONF['encrypt'] == 'md5') { $password = md5($pw); } - if ($CONF['encrypt'] == 'system') { + elseif ($CONF['encrypt'] == 'system') { if (ereg ("\$1\$", $pw_db)) { $split_salt = preg_split ('/\$/', $pw_db); $salt = $split_salt[2]; @@ -1171,13 +1171,13 @@ $password = crypt ($pw, $salt); } - if ($CONF['encrypt'] == 'cleartext') { + elseif ($CONF['encrypt'] == 'cleartext') { $password = $pw; } // See https://sourceforge.net/tracker/?func=detail&atid=937966&aid=1793352&group_id=191583 // this is apparently useful for pam_mysql etc. - if ($CONF['encrypt'] == 'mysql_encrypt') + elseif ($CONF['encrypt'] == 'mysql_encrypt') { if ($pw_db!="") { $salt=substr($pw_db,0,2); @@ -1189,7 +1189,7 @@ $password = $l[0]; } - if ($CONF['encrypt'] == 'authlib') { + elseif ($CONF['encrypt'] == 'authlib') { $flavor = $CONF['authlib_default_flavor']; $salt = substr(create_salt(), 0, 2); # courier-authlib supports only two-character salts if(ereg('^{.*}', $pw_db)) { @@ -1210,7 +1210,37 @@ } } - + elseif (preg_match("/^dovecot:/", $CONF['encrypt'])) { + $split_method = preg_split ('/:/', $CONF['encrypt']); + $method = strtoupper($split_method[1]); + if (! preg_match("/^[A-Z0-9-]+$/", $method)) { die("invalid dovecot encryption method"); } # TODO: check against a fixed list? + + $dovecotpw = "dovecotpw"; + if (!empty($CONF['dovecotpw'])) $dovecotpw = $CONF['dovecotpw']; + + // prevent showing plain password in process table + $prefix = "postfixadmin-"; + $tmpfile = tempnam('/tmp', $prefix); + $pipe = popen("'$dovecotpw' -s '$method' > '$tmpfile'", 'w'); # TODO: replace tempfile usage with proc_open call + + if (!$pipe) { + unlink($tmpfile); + } else { + // use dovecot's stdin, it uses getpass() twice + fwrite($pipe, $pw . "\n", 1+strlen($pw)); usleep(1000); + fwrite($pipe, $pw . "\n", 1+strlen($pw)); + pclose($pipe); + $password = file_get_contents($tmpfile); + if ( !preg_match('/^\{' . $method . '\}/', $password)) { die("can't encrypt password with dovecotpw"); } + $password = trim(str_replace('{' . $method . '}', '', $password)); + unlink($tmpfile); + } + } + + else { + die ('unknown/invalid $CONF["encrypt"] setting: ' . $CONF['encrypt']); + } + $password = escape_string ($password); return $password; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-03-18 19:55:08
|
Revision: 588 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=588&view=rev Author: GingerDog Date: 2009-03-18 19:54:34 +0000 (Wed, 18 Mar 2009) Log Message: ----------- 2.3rc1 Modified Paths: -------------- trunk/debian/changelog trunk/functions.inc.php Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-03-16 20:16:50 UTC (rev 587) +++ trunk/debian/changelog 2009-03-18 19:54:34 UTC (rev 588) @@ -1,3 +1,13 @@ +postfixadmin (2.3rc1) unstable; urgency=low + + * Subversion revision 587 + * New XmlRpc API for integration with 3rd party web mail clients. + * Various bug fixes + * Translation patches + * Addition of dovecotpw support + + -- David Goodwin <dav...@pa...> Wed, 18 Mar 2009 19:52:00 +0000 + postfixadmin (2.3beta) unstable; urgency=low * Subversion revision 533 Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-03-16 20:16:50 UTC (rev 587) +++ trunk/functions.inc.php 2009-03-18 19:54:34 UTC (rev 588) @@ -22,7 +22,7 @@ exit; } -$version = '2.3 beta'; +$version = '2.3 rc1'; /** * check_session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-03-19 20:06:03
|
Revision: 594 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=594&view=rev Author: GingerDog Date: 2009-03-19 20:05:52 +0000 (Thu, 19 Mar 2009) Log Message: ----------- svn revision numbers keep changing! Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/debian/changelog Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2009-03-19 20:04:26 UTC (rev 593) +++ trunk/CHANGELOG.TXT 2009-03-19 20:05:52 UTC (rev 594) @@ -11,7 +11,7 @@ # $Id$ -Version 2.3rc2 - 2009/02/03 - SVN r589 +Version 2.3rc2 - 2009/02/03 - SVN r593 -------------------------------------- - Refactor /users (see /model) and provide XmlRpc interface for remote mail clients Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-03-19 20:04:26 UTC (rev 593) +++ trunk/debian/changelog 2009-03-19 20:05:52 UTC (rev 594) @@ -1,6 +1,6 @@ postfixadmin (2.3rc2) unstable; urgency=low - * Subversion revision 587 + * Subversion revision 593 * Add model directory to .deb etc. * Updated ChangeLog This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-03-25 15:26:33
|
Revision: 603 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=603&view=rev Author: GingerDog Date: 2009-03-25 15:26:23 +0000 (Wed, 25 Mar 2009) Log Message: ----------- fix errors e.g. see https://sourceforge.net/tracker/?func=detail&aid=2711888&group_id=191583&atid=937964 Modified Paths: -------------- trunk/model/AliasHandler.php trunk/model/UserHandler.php trunk/users/edit-alias.php Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2009-03-25 14:51:12 UTC (rev 602) +++ trunk/model/AliasHandler.php 2009-03-25 15:26:23 UTC (rev 603) @@ -25,8 +25,7 @@ $sql = "SELECT * FROM $table_alias WHERE address='$username'"; $result = db_query($sql); - if ($result['rows'] == 1) - { + if($result['rows'] == 1) { $row = db_array ($result['result']); // At the moment Postfixadmin stores aliases in it's database in a comma seperated list; this may change one day. $list = explode(',', $row['goto']); Modified: trunk/model/UserHandler.php =================================================================== --- trunk/model/UserHandler.php 2009-03-25 14:51:12 UTC (rev 602) +++ trunk/model/UserHandler.php 2009-03-25 15:26:23 UTC (rev 603) @@ -57,9 +57,9 @@ if ($result['rows'] == 1) { $row = db_array ($result['result']); - $password = pacrypt ($password, $row['password']); + $crypt_password = pacrypt ($password, $row['password']); - if($row['password'] == $password) { + if($row['password'] == $crypt_password) { return true; } } Modified: trunk/users/edit-alias.php =================================================================== --- trunk/users/edit-alias.php 2009-03-25 14:51:12 UTC (rev 602) +++ trunk/users/edit-alias.php 2009-03-25 15:26:23 UTC (rev 603) @@ -41,14 +41,12 @@ $vacation_goto = preg_replace('/@/', '#', $USERID_USERNAME) . '@' . $vacation_domain; $ah = new AliasHandler($USERID_USERNAME); +$tGotoArray = $ah->get(); +$tStoreAndForward = $ah->hasStoreAndForward(); +$vacation_domain = $CONF['vacation_domain']; if ($_SERVER['REQUEST_METHOD'] == "GET") { - $vacation_domain = $CONF['vacation_domain']; - - $tGotoArray = $ah->get(); - $tStoreAndForward = $ah->hasStoreAndForward(); - include ("../templates/header.php"); include ("../templates/users_menu.php"); include ("../templates/users_edit-alias.php"); @@ -66,8 +64,9 @@ $pEdit_alias_goto = $PALANG['pEdit_alias_goto']; if (isset($_POST['fVacation'])) $fVacation = $_POST['fVacation']; - if (isset($_POST['fGoto'])) $fGoto = escape_string (trim($_POST['fGoto'])); - if (isset($_POST['fForward_and_store'])) $fForward_and_store = escape_string ($_POST['fForward_and_store']); + if (isset($_POST['fGoto'])) $fGoto = trim($_POST['fGoto']); + if (isset($_POST['fForward_and_store'])) $fForward_and_store = $_POST['fForward_and_store']; + $goto = strtolower ($fGoto); $goto = preg_replace ('/\\\r\\\n/', ',', $goto); $goto = preg_replace ('/\r\n/', ',', $goto); @@ -77,18 +76,23 @@ $goto = explode(",",$goto); $goto = array_merge(array_unique($goto)); - $good_goto = array(); - foreach($goto as $address) { - if(!check_email($address)) { - $error += 1; - $tMessage = $PALANG['pEdit_alias_goto_text_error1'] . "$address</font>"; + if($fForward_and_store == 'NO' && sizeof($goto) == 1 && $goto[0] == '') { + $tMessage = $PALANG['pEdit_alias_goto_text_error1']; + $error += 1; + } + if($error === 0) { + foreach($goto as $address) { + if(!check_email($address)) { + $error += 1; + $tMessage = $PALANG['pEdit_alias_goto_text_error2'] . " $address</font>"; + } + else { + $good_goto[] = $address; + } } - else { - $good_goto[] = $address; - } + $goto = $good_goto; } - $goto = $good_goto; if ($error == 0) { $flags = 'remote_only'; @@ -102,7 +106,9 @@ } $tMessage = $PALANG['pEdit_alias_result_error']; } - + else { + $tGotoArray = $goto; + } include ("../templates/header.php"); include ("../templates/users_menu.php"); include ("../templates/users_edit-alias.php"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-03-15 21:25:49
|
Revision: 581 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=581&view=rev Author: GingerDog Date: 2009-03-15 21:24:56 +0000 (Sun, 15 Mar 2009) Log Message: ----------- tests: add initial simpletest unit tests for the xmlrpc stuff Added Paths: ----------- trunk/tests/ trunk/tests/RemoteTest.php trunk/tests/RemoteVacationTest.php trunk/tests/common.php trunk/tests/run.php trunk/tests/simpletest/ trunk/tests/simpletest/BACKLOG trunk/tests/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE trunk/tests/simpletest/LICENSE trunk/tests/simpletest/README trunk/tests/simpletest/TODO trunk/tests/simpletest/VERSION trunk/tests/simpletest/authentication.php trunk/tests/simpletest/browser.php trunk/tests/simpletest/collector.php trunk/tests/simpletest/compatibility.php trunk/tests/simpletest/cookies.php trunk/tests/simpletest/detached.php trunk/tests/simpletest/docs/ trunk/tests/simpletest/docs/en/ trunk/tests/simpletest/docs/en/authentication_documentation.html trunk/tests/simpletest/docs/en/browser_documentation.html trunk/tests/simpletest/docs/en/docs.css trunk/tests/simpletest/docs/en/expectation_documentation.html trunk/tests/simpletest/docs/en/form_testing_documentation.html trunk/tests/simpletest/docs/en/group_test_documentation.html trunk/tests/simpletest/docs/en/index.html trunk/tests/simpletest/docs/en/mock_objects_documentation.html trunk/tests/simpletest/docs/en/overview.html trunk/tests/simpletest/docs/en/partial_mocks_documentation.html trunk/tests/simpletest/docs/en/reporter_documentation.html trunk/tests/simpletest/docs/en/unit_test_documentation.html trunk/tests/simpletest/docs/en/web_tester_documentation.html trunk/tests/simpletest/docs/fr/ trunk/tests/simpletest/docs/fr/docs.css trunk/tests/simpletest/docs/lastcraft/ trunk/tests/simpletest/docs/lastcraft/README trunk/tests/simpletest/docs/onpk/ trunk/tests/simpletest/docs/onpk/README trunk/tests/simpletest/docs/pkg/ trunk/tests/simpletest/docs/pkg/README trunk/tests/simpletest/docs/simpletest.org/ trunk/tests/simpletest/docs/simpletest.org/README trunk/tests/simpletest/docs/simpletest.org/images/ trunk/tests/simpletest/docs/simpletest.org/images/book-domain-driven-design.jpg trunk/tests/simpletest/docs/simpletest.org/images/book-guide-to-php-design-patterns.jpg trunk/tests/simpletest/docs/simpletest.org/images/book-the-php-anthology-object-oriented-php-solutions.jpg trunk/tests/simpletest/docs/simpletest.org/images/quote.png trunk/tests/simpletest/docs/simpletest.org/images/simpletest-download.png trunk/tests/simpletest/docs/simpletest.org/images/simpletest-logo.png trunk/tests/simpletest/docs/simpletest.org/images/simpletest-start-testing.png trunk/tests/simpletest/docs/simpletest.org/images/simpletest-support.png trunk/tests/simpletest/docs/simpletest.org/images/test-in-cli.png trunk/tests/simpletest/docs/simpletest.org/images/test-with-1-fail.png trunk/tests/simpletest/docs/simpletest.org/images/test-with-1-pass.png trunk/tests/simpletest/docs/simpletest.org/index.html trunk/tests/simpletest/docs/simpletest.org/simpletest.css trunk/tests/simpletest/docs/source/ trunk/tests/simpletest/docs/source/en/ trunk/tests/simpletest/docs/source/en/about.xml trunk/tests/simpletest/docs/source/en/authentication_documentation.xml trunk/tests/simpletest/docs/source/en/books_website.xml trunk/tests/simpletest/docs/source/en/boundary_classes_tutorial.xml trunk/tests/simpletest/docs/source/en/browser_documentation.xml trunk/tests/simpletest/docs/source/en/display_subclass_tutorial.xml trunk/tests/simpletest/docs/source/en/download_website.xml trunk/tests/simpletest/docs/source/en/expectation_documentation.xml trunk/tests/simpletest/docs/source/en/first_test_tutorial.xml trunk/tests/simpletest/docs/source/en/form_testing_documentation.xml trunk/tests/simpletest/docs/source/en/gain_control_tutorial.xml trunk/tests/simpletest/docs/source/en/group_test_documentation.xml trunk/tests/simpletest/docs/source/en/group_test_tutorial.xml trunk/tests/simpletest/docs/source/en/improving_design_tutorial.xml trunk/tests/simpletest/docs/source/en/index.xml trunk/tests/simpletest/docs/source/en/intro.xml trunk/tests/simpletest/docs/source/en/mock_objects_documentation.xml trunk/tests/simpletest/docs/source/en/mock_objects_tutorial.xml trunk/tests/simpletest/docs/source/en/overview.xml trunk/tests/simpletest/docs/source/en/partial_mocks_documentation.xml trunk/tests/simpletest/docs/source/en/reporter_documentation.xml trunk/tests/simpletest/docs/source/en/simple_test.xml trunk/tests/simpletest/docs/source/en/subclass_tutorial.xml trunk/tests/simpletest/docs/source/en/support_website.xml trunk/tests/simpletest/docs/source/en/unit_test_documentation.xml trunk/tests/simpletest/docs/source/en/web_tester_documentation.xml trunk/tests/simpletest/docs/source/fr/ trunk/tests/simpletest/docs/source/fr/authentication_documentation.xml trunk/tests/simpletest/docs/source/fr/books_website.xml trunk/tests/simpletest/docs/source/fr/boundary_classes_tutorial.xml trunk/tests/simpletest/docs/source/fr/browser_documentation.xml trunk/tests/simpletest/docs/source/fr/display_subclass_tutorial.xml trunk/tests/simpletest/docs/source/fr/download_website.xml trunk/tests/simpletest/docs/source/fr/expectation_documentation.xml trunk/tests/simpletest/docs/source/fr/first_test_tutorial.xml trunk/tests/simpletest/docs/source/fr/form_testing_documentation.xml trunk/tests/simpletest/docs/source/fr/gain_control_tutorial.xml trunk/tests/simpletest/docs/source/fr/group_test_documentation.xml trunk/tests/simpletest/docs/source/fr/group_test_tutorial.xml trunk/tests/simpletest/docs/source/fr/improving_design_tutorial.xml trunk/tests/simpletest/docs/source/fr/index.xml trunk/tests/simpletest/docs/source/fr/intro.xml trunk/tests/simpletest/docs/source/fr/mock_objects_documentation.xml trunk/tests/simpletest/docs/source/fr/mock_objects_tutorial.xml trunk/tests/simpletest/docs/source/fr/overview.xml trunk/tests/simpletest/docs/source/fr/partial_mocks_documentation.xml trunk/tests/simpletest/docs/source/fr/reporter_documentation.xml trunk/tests/simpletest/docs/source/fr/server_stubs_documentation.xml trunk/tests/simpletest/docs/source/fr/simple_test.xml trunk/tests/simpletest/docs/source/fr/subclass_tutorial.xml trunk/tests/simpletest/docs/source/fr/support_website.xml trunk/tests/simpletest/docs/source/fr/unit_test_documentation.xml trunk/tests/simpletest/docs/source/fr/web_tester_documentation.xml trunk/tests/simpletest/dumper.php trunk/tests/simpletest/eclipse.php trunk/tests/simpletest/encoding.php trunk/tests/simpletest/errors.php trunk/tests/simpletest/exceptions.php trunk/tests/simpletest/expectation.php trunk/tests/simpletest/extensions/ trunk/tests/simpletest/extensions/pear_test_case.php trunk/tests/simpletest/extensions/phpunit_test_case.php trunk/tests/simpletest/form.php trunk/tests/simpletest/frames.php trunk/tests/simpletest/http.php trunk/tests/simpletest/invoker.php trunk/tests/simpletest/mock_objects.php trunk/tests/simpletest/packages/ trunk/tests/simpletest/packages/README trunk/tests/simpletest/packages/build_tarball.sh trunk/tests/simpletest/packages/bundled_docs.xslt trunk/tests/simpletest/packages/bundled_map.xml trunk/tests/simpletest/packages/generate_package.php trunk/tests/simpletest/packages/lastcraft.xslt trunk/tests/simpletest/packages/make_bundled_docs.sh trunk/tests/simpletest/packages/make_bundled_docs_with_xalan.sh trunk/tests/simpletest/packages/make_lastcraft_docs.sh trunk/tests/simpletest/packages/make_phpdoc_docs.sh trunk/tests/simpletest/packages/onpk/ trunk/tests/simpletest/packages/onpk/map_onpk.xml trunk/tests/simpletest/packages/onpk/onpk.xslt trunk/tests/simpletest/packages/onpk/transform_all_onpk.php trunk/tests/simpletest/packages/package.xml trunk/tests/simpletest/packages/pear_package_create.php trunk/tests/simpletest/packages/phpdoc_docs.xslt trunk/tests/simpletest/packages/simpletest.ini trunk/tests/simpletest/packages/simpletest.org/ trunk/tests/simpletest/packages/simpletest.org/index.php trunk/tests/simpletest/packages/simpletest.org/map.xml trunk/tests/simpletest/packages/simpletest.org/package.php trunk/tests/simpletest/packages/simpletest.org/template.html trunk/tests/simpletest/packages/simpletest.org/test/ trunk/tests/simpletest/packages/simpletest.org/test/package/ trunk/tests/simpletest/packages/simpletest.org/test/package/content_without_section.xml trunk/tests/simpletest/packages/simpletest.org/test/package/here_download.xml trunk/tests/simpletest/packages/simpletest.org/test/package/here_overview.xml trunk/tests/simpletest/packages/simpletest.org/test/package/here_simpletest.xml trunk/tests/simpletest/packages/simpletest.org/test/package/here_start_testing.xml trunk/tests/simpletest/packages/simpletest.org/test/package/here_support.xml trunk/tests/simpletest/packages/simpletest.org/test/package/here_unit-tester.xml trunk/tests/simpletest/packages/simpletest.org/test/package/map.xml trunk/tests/simpletest/packages/simpletest.org/test/package/one_section_with_php_code.xml trunk/tests/simpletest/packages/simpletest.org/test/package_test.php trunk/tests/simpletest/packages/site_map.xml trunk/tests/simpletest/packages/transform_all_lastcraft.php trunk/tests/simpletest/page.php trunk/tests/simpletest/parser.php trunk/tests/simpletest/reflection_php4.php trunk/tests/simpletest/reflection_php5.php trunk/tests/simpletest/remote.php trunk/tests/simpletest/reporter.php trunk/tests/simpletest/scorer.php trunk/tests/simpletest/selector.php trunk/tests/simpletest/shell_tester.php trunk/tests/simpletest/simpletest.php trunk/tests/simpletest/socket.php trunk/tests/simpletest/tag.php trunk/tests/simpletest/test/ trunk/tests/simpletest/test/acceptance_test.php trunk/tests/simpletest/test/adapter_test.php trunk/tests/simpletest/test/all_tests.php trunk/tests/simpletest/test/authentication_test.php trunk/tests/simpletest/test/browser_test.php trunk/tests/simpletest/test/collector_test.php trunk/tests/simpletest/test/compatibility_test.php trunk/tests/simpletest/test/cookies_test.php trunk/tests/simpletest/test/detached_test.php trunk/tests/simpletest/test/dumper_test.php trunk/tests/simpletest/test/eclipse_test.php trunk/tests/simpletest/test/encoding_test.php trunk/tests/simpletest/test/errors_test.php trunk/tests/simpletest/test/exceptions_test.php trunk/tests/simpletest/test/expectation_test.php trunk/tests/simpletest/test/form_test.php trunk/tests/simpletest/test/frames_test.php trunk/tests/simpletest/test/http_test.php trunk/tests/simpletest/test/interfaces_test.php trunk/tests/simpletest/test/live_test.php trunk/tests/simpletest/test/mock_objects_test.php trunk/tests/simpletest/test/page_test.php trunk/tests/simpletest/test/parse_error_test.php trunk/tests/simpletest/test/parser_test.php trunk/tests/simpletest/test/reflection_php4_test.php trunk/tests/simpletest/test/reflection_php5_test.php trunk/tests/simpletest/test/remote_test.php trunk/tests/simpletest/test/shell_test.php trunk/tests/simpletest/test/shell_tester_test.php trunk/tests/simpletest/test/simpletest_test.php trunk/tests/simpletest/test/site/ trunk/tests/simpletest/test/site/1.html trunk/tests/simpletest/test/site/2.html trunk/tests/simpletest/test/site/3.html trunk/tests/simpletest/test/site/base_change_redirect.php trunk/tests/simpletest/test/site/cookie_based_counter.php trunk/tests/simpletest/test/site/counting_frameset.html trunk/tests/simpletest/test/site/double_base_change_redirect.php trunk/tests/simpletest/test/site/form.html trunk/tests/simpletest/test/site/form_data_encoded_form.html trunk/tests/simpletest/test/site/form_with_false_defaults.html trunk/tests/simpletest/test/site/form_with_mixed_post_and_get.html trunk/tests/simpletest/test/site/form_with_tricky_defaults.html trunk/tests/simpletest/test/site/form_with_unnamed_submit.html trunk/tests/simpletest/test/site/form_without_action.php trunk/tests/simpletest/test/site/frame_a.html trunk/tests/simpletest/test/site/frame_b.html trunk/tests/simpletest/test/site/frame_links.html trunk/tests/simpletest/test/site/frameset.html trunk/tests/simpletest/test/site/front_controller_style/ trunk/tests/simpletest/test/site/front_controller_style/a_page.php trunk/tests/simpletest/test/site/front_controller_style/index.php trunk/tests/simpletest/test/site/front_controller_style/show_request.php trunk/tests/simpletest/test/site/link_confirm.php trunk/tests/simpletest/test/site/local_redirect.php trunk/tests/simpletest/test/site/messy_frameset.html trunk/tests/simpletest/test/site/multiple_widget_form.html trunk/tests/simpletest/test/site/nested_frameset.html trunk/tests/simpletest/test/site/network_confirm.php trunk/tests/simpletest/test/site/one_page_frameset.html trunk/tests/simpletest/test/site/page_request.php trunk/tests/simpletest/test/site/path/ trunk/tests/simpletest/test/site/path/base_change_redirect.php trunk/tests/simpletest/test/site/path/network_confirm.php trunk/tests/simpletest/test/site/path/show_cookies.php trunk/tests/simpletest/test/site/protected/ trunk/tests/simpletest/test/site/protected/.htaccess trunk/tests/simpletest/test/site/protected/.htpasswd trunk/tests/simpletest/test/site/protected/1.html trunk/tests/simpletest/test/site/protected/2.html trunk/tests/simpletest/test/site/protected/3.html trunk/tests/simpletest/test/site/protected/htaccess trunk/tests/simpletest/test/site/protected/local_redirect.php trunk/tests/simpletest/test/site/protected/network_confirm.php trunk/tests/simpletest/test/site/redirect.php trunk/tests/simpletest/test/site/savant_style_form.html trunk/tests/simpletest/test/site/search.png trunk/tests/simpletest/test/site/self_form.php trunk/tests/simpletest/test/site/set_cookies.php trunk/tests/simpletest/test/site/slow_page.php trunk/tests/simpletest/test/site/timestamp.php trunk/tests/simpletest/test/site/upload_form.html trunk/tests/simpletest/test/site/upload_handler.php trunk/tests/simpletest/test/socket_test.php trunk/tests/simpletest/test/support/ trunk/tests/simpletest/test/support/collector/ trunk/tests/simpletest/test/support/collector/collectable.1 trunk/tests/simpletest/test/support/collector/collectable.2 trunk/tests/simpletest/test/support/latin1_sample trunk/tests/simpletest/test/support/spl_examples.php trunk/tests/simpletest/test/support/supplementary_upload_sample.txt trunk/tests/simpletest/test/support/test1.php trunk/tests/simpletest/test/support/upload_sample.txt trunk/tests/simpletest/test/tag_test.php trunk/tests/simpletest/test/test_groups.php trunk/tests/simpletest/test/test_with_parse_error.php trunk/tests/simpletest/test/unit_tester_test.php trunk/tests/simpletest/test/unit_tests.php trunk/tests/simpletest/test/url_test.php trunk/tests/simpletest/test/user_agent_test.php trunk/tests/simpletest/test/visual_test.php trunk/tests/simpletest/test/web_tester_test.php trunk/tests/simpletest/test/xml_test.php trunk/tests/simpletest/test_case.php trunk/tests/simpletest/ui/ trunk/tests/simpletest/ui/array_reporter/ trunk/tests/simpletest/ui/array_reporter/sample_test.php trunk/tests/simpletest/ui/array_reporter/test.php trunk/tests/simpletest/ui/array_reporter.php trunk/tests/simpletest/ui/colortext_reporter.php trunk/tests/simpletest/ui/css/ trunk/tests/simpletest/ui/css/webunit.css trunk/tests/simpletest/ui/img/ trunk/tests/simpletest/ui/img/wait.gif trunk/tests/simpletest/ui/js/ trunk/tests/simpletest/ui/js/tests/ trunk/tests/simpletest/ui/js/tests/TestOfWebunit.js.html trunk/tests/simpletest/ui/js/webunit.js trunk/tests/simpletest/ui/js/x.js trunk/tests/simpletest/ui/webunit_reporter.php trunk/tests/simpletest/unit_tester.php trunk/tests/simpletest/url.php trunk/tests/simpletest/user_agent.php trunk/tests/simpletest/web_tester.php trunk/tests/simpletest/xml.php Added: trunk/tests/RemoteTest.php =================================================================== --- trunk/tests/RemoteTest.php (rev 0) +++ trunk/tests/RemoteTest.php 2009-03-15 21:24:56 UTC (rev 581) @@ -0,0 +1,82 @@ +<?php + +require_once('common.php'); + +require_once('simpletest/unit_tester.php'); +require_once('Zend/XmlRpc/Client.php'); +require_once('Zend/Http/Client.php'); +require_once('Zend/Registry.php'); + +class RemoteTest extends UnitTestCase { + + protected $server_url = 'http://orange/david/postfixadmin/trunk/xmlrpc.php'; + protected $username = 'ro...@ex...'; + protected $password = 'patchthedog'; + + /* xmlrpc objects... */ + protected $user; + protected $vacation; + protected $alias; + + public function __construct() { + parent::__construct(); + + } + + public function setUp() { + parent::setUp(); + + // ensure a user exists as per the above... + + $table_vacation = table_by_key('vacation'); + $table_alias = table_by_key('alias'); + $table_mailbox = table_by_key('mailbox'); + $table_domain = table_by_key('domain'); + $username = escape_string($this->username); + $password = escape_string(pacrypt($this->password)); + + db_query("DELETE FROM $table_vacation WHERE email = '$username'"); + db_query("DELETE FROM $table_alias WHERE domain = 'example.com'"); + db_query("DELETE FROM $table_mailbox WHERE domain = 'example.com'"); + db_query("DELETE FROM $table_domain WHERE domain = 'example.com'"); + + // create new db records.. + $result = db_query("INSERT INTO $table_domain (domain, aliases, mailboxes) VALUES ('example.com', 100, 100)"); + if($result['rows'] != 1) { + die("Failed to add domain to db...."); + } + + $result = db_query("INSERT INTO $table_mailbox (username, password, name, local_part, domain) VALUES ('$username', '$password', 'test user', 'roger', 'example.com')"); + if($result['rows'] != 1) { + die("Failed to add user to db...."); + } + + $result = db_query("INSERT INTO $table_alias (address, goto, domain) VALUES ('$username', '$username', 'example.com')"); + if($result['rows'] != 1) { + die("Failed to add alias to db...."); + } + + try { + $this->xmlrpc_client = new Zend_XmlRpc_Client($this->server_url); + $http_client = $this->xmlrpc_client->getHttpClient(); + $http_client->setCookieJar(); + + $login_object = $this->xmlrpc_client->getProxy('login'); + $success = $login_object->login($this->username, $this->password); + + if(!$success) { + var_dump($success); + die("Failed to login to xmlrpc interface"); + } + + $this->user = $this->xmlrpc_client->getProxy('user'); + $this->alias = $this->xmlrpc_client->getProxy('alias'); + $this->vacation = $this->xmlrpc_client->getProxy('vacation'); + } + catch(Exception $e) { + var_dump($e); + var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody()); + die("Error setting up.."); + } + } +} Added: trunk/tests/RemoteVacationTest.php =================================================================== --- trunk/tests/RemoteVacationTest.php (rev 0) +++ trunk/tests/RemoteVacationTest.php 2009-03-15 21:24:56 UTC (rev 581) @@ -0,0 +1,81 @@ +<?php +/** + * Test for Postfixadmin - remote vacation stuff + * + * @package tests + */ + +require_once('RemoteTest.php'); + +class RemoteVacationTest extends RemoteTest { + + public function __construct() { + parent::__construct(); + global $CONF; + + // Ensure config.inc.php is vaguely correct. + if($CONF['vacation'] != 'YES' || $CONF['vacation_control'] != "YES") { + die("Cannot run tests; vacation not enabled - see config.inc.php"); + } + if($CONF['vacation_domain'] != 'autoreply.example.com') { + die("Cannot run tests; vacation_domain is not set to autoreply.example.com - see config.inc.php"); + } + } + + + /** + * Adds the test recipient data to the database. + */ + public function setUp() { + parent::setUp(); + } + public function tearDown() { + parent::tearDown(); + } + + public function testIsVacationSupported() { + try { + $this->assertTrue($this->vacation->isVacationSupported()); + } + catch(Exception $e){ + var_dump($e); + var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody()); + die("fail.."); + } + } + + public function testCheckVacation() { + $this->assertFalse($this->vacation->checkVacation()); + } + + + public function testGetDetails() { + $details = $this->vacation->getDetails(); + $this->assertFalse($details); // empty by default (thansk to tearDown/setUp); + } + + public function testSetAway() { + try { + $this->assertFalse($this->vacation->checkVacation()); + $this->assertTrue($this->vacation->setAway('zzzz', 'aaaa')); + $this->assertTrue($this->vacation->checkVacation()); + } + catch(Exception $e) { + var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody()); + } + $details = $this->vacation->getDetails(); + $this->assertEqual($details['subject'], 'zzzz'); + $this->assertEqual($details['body'], 'aaaa'); + + $this->vacation->remove(); + $details = $this->vacation->getDetails(); + $this->assertEqual($details['subject'], 'zzzz'); + $this->assertEqual($details['body'], 'aaaa'); + + $this->vacation->setAway('subject', 'body'); + $details = $this->vacation->getDetails(); + $this->assertEqual($details['subject'], 'subject'); + $this->assertEqual($details['body'], 'body'); + } + +} Added: trunk/tests/common.php =================================================================== --- trunk/tests/common.php (rev 0) +++ trunk/tests/common.php 2009-03-15 21:24:56 UTC (rev 581) @@ -0,0 +1,4 @@ +<?php + +ini_set('include_path', ini_get('include_path') . ':' . dirname(__FILE__) . '/../'); +require_once(dirname(__FILE__) . '/../common.php'); Added: trunk/tests/run.php =================================================================== --- trunk/tests/run.php (rev 0) +++ trunk/tests/run.php 2009-03-15 21:24:56 UTC (rev 581) @@ -0,0 +1,15 @@ +<?php +/** + * Responsible for test suite... + * @package tests + */ +require_once(dirname(__FILE__) . '/common.php'); + +require_once('simpletest/reporter.php'); +require_once('simpletest/unit_tester.php'); + +$test = new GroupTest('Postfixadmin XMLRPC Unit Tests'); + +$test->addTestFile('./RemoteVacationTest.php'); + +exit($test->run(new TextReporter()) ? 0 : 1); Added: trunk/tests/simpletest/BACKLOG =================================================================== --- trunk/tests/simpletest/BACKLOG (rev 0) +++ trunk/tests/simpletest/BACKLOG 2009-03-15 21:24:56 UTC (rev 581) @@ -0,0 +1,37 @@ +BACKLOG +This is backed up stuff that defines the 1.0.1 release. + +$Id: BACKLOG,v 1.10 2006/11/20 23:44:36 lastcraft Exp $ + +Unit tester +----------- + +Reporter +-------- + +Mock objects +------------ +Fix new type hinting bug in PHP 5.0.2 and above (1). + +Parser +------ +Add U flag to regexes to allow unicode (3). + +Browser +------- +Add a file() loading command (4). +Change getUrls() to return more information (2). + +Web tester +---------- + +Documentation +------------- +Extension docs (1). +Integrate SpikeSource docs (4). +Write Eclipse plug-in guide (4). +Add page for projects that use or extend SimpleTest (2). + +Build +----- +Integrate German documentation (2). Added: trunk/tests/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE =================================================================== --- trunk/tests/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE (rev 0) +++ trunk/tests/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE 2009-03-15 21:24:56 UTC (rev 581) @@ -0,0 +1,340 @@ +Simple Test interface changes +============================= +Because the SimpleTest tool set is still evolving it is likely that tests +written with earlier versions will fail with the newest ones. The most +dramatic changes are in the alpha releases. Here is a list of possible +problems and their fixes... + +Method setWildcard() removed in mocks +------------------------------------- +Even setWildcard() has been removed in 1.0.1beta now. +If you want to test explicitely for a '*' string, then +simply pass in new IdenticalExpectation('*') instead. + +No method _getTest() on mocks +----------------------------- +This has finally been removed. It was a pretty esoteric +flex point anyway. It was there to allow the mocks to +work with other test tools, but no one does this. + +No method assertError(), assertNoErrors(), swallowErrors() +---------------------------------------------------------- +These have been deprecated in 1.0.1beta in favour of +expectError() and expectException(). assertNoErrors() is +redundant if you use expectError() as failures are now reported +immediately. + +No method TestCase::signal() +---------------------------- +This has been deprecated in favour of triggering an error or +throwing an exception. Deprecated as of 1.0.1beta. + +No method TestCase::sendMessage() +--------------------------------- +This has been deprecated as of 1.0.1beta. + +Failure to connect now emits failures +------------------------------------- +It used to be that you would have to use the +getTransferError() call on the web tester to see if +there was a socket level error in a fetch. This check +is now always carried out by the WebTestCase unless +the fetch is prefaced with WebTestCase::ignoreErrors(). +The ignore directive only lasts for test case fetching +action such as get() and click(). + +No method SimpleTestOptions::ignore() +------------------------------------- +This is deprecated in version 1.0.1beta and has been moved +to SimpleTest::ignore() as that is more readable. In +addition, parent classes are also ignored automatically. +If you are using PHP5 you can skip this directive simply +by marking your test case as abstract. + +No method assertCopy() +---------------------- +This is deprecated in 1.0.1 in favour of assertClone(). +The assertClone() method is slightly different in that +the objects must be identical, but without being a +reference. It is thus not a strict inversion of +assertReference(). + +Constructor wildcard override has no effect in mocks +---------------------------------------------------- +As of 1.0.1beta this is now set with setWildcard() instead +of in the constructor. + +No methods setStubBaseClass()/getStubBaseClass() +------------------------------------------------ +As mocks are now used instead of stubs, these methods +stopped working and are now removed as of the 1.0.1beta +release. The mock objects may be freely used instead. + +No method addPartialMockCode() +------------------------------ +The ability to insert arbitrary partial mock code +has been removed. This was a low value feature +causing needless complications. It was removed +in the 1.0.1beta release. + +No method setMockBaseClass() +---------------------------- +The ability to change the mock base class has been +scheduled for removal and is deprecated since the +1.0.1beta version. This was a rarely used feature +except as a workaround for PHP5 limitations. As +these limitations are being resolved it's hoped +that the bundled mocks can be used directly. + +No class Stub +------------- +Server stubs are deprecated from 1.0.1 as the mocks now +have exactly the same interface. Just use mock objects +instead. + +No class SimpleTestOptions +-------------------------- +This was replced by the shorter SimpleTest in 1.0.1beta1 +and is since deprecated. + +No file simple_test.php +----------------------- +This was renamed test_case.php in 1.0.1beta to more accurately +reflect it's purpose. This file should never be directly +included in test suites though, as it's part of the +underlying mechanics and has a tendency to be refactored. + +No class WantedPatternExpectation +--------------------------------- +This was deprecated in 1.0.1alpha in favour of the simpler +name PatternExpectation. + +No class NoUnwantedPatternExpectation +------------------------------------- +This was deprecated in 1.0.1alpha in favour of the simpler +name NoPatternExpectation. + +No method assertNoUnwantedPattern() +----------------------------------- +This has been renamed to assertNoPattern() in 1.0.1alpha and +the old form is deprecated. + +No method assertWantedPattern() +------------------------------- +This has been renamed to assertPattern() in 1.0.1alpha and +the old form is deprecated. + +No method assertExpectation() +----------------------------- +This was renamed as assert() in 1.0.1alpha and the old form +has been deprecated. + +No class WildcardExpectation +---------------------------- +This was a mostly internal class for the mock objects. It was +renamed AnythingExpectation to bring it closer to JMock and +NMock in version 1.0.1alpha. + +Missing UnitTestCase::assertErrorPattern() +------------------------------------------ +This method is deprecated for version 1.0.1 onwards. +This method has been subsumed by assertError() that can now +take an expectation. Simply pass a PatternExpectation +into assertError() to simulate the old behaviour. + +No HTML when matching page elements +----------------------------------- +This behaviour has been switched to using plain text as if it +were seen by the user of the browser. This means that HTML tags +are suppressed, entities are converted and whitespace is +normalised. This should make it easier to match items in forms. +Also images are replaced with their "alt" text so that they +can be matched as well. + +No method SimpleRunner::_getTestCase() +-------------------------------------- +This was made public as getTestCase() in 1.0RC2. + +No method restartSession() +-------------------------- +This was renamed to restart() in the WebTestCase, SimpleBrowser +and the underlying SimpleUserAgent in 1.0RC2. Because it was +undocumented anyway, no attempt was made at backward +compatibility. + +My custom test case ignored by tally() +-------------------------------------- +The _assertTrue method has had it's signature changed due to a bug +in the PHP 5.0.1 release. You must now use getTest() from within +that method to get the test case. Mock compatibility with other +unit testers is now deprecated as of 1.0.1alpha as PEAR::PHPUnit2 +should soon have mock support of it's own. + +Broken code extending SimpleRunner +---------------------------------- +This was replaced with SimpleScorer so that I could use the runner +name in another class. This happened in RC1 development and there +is no easy backward compatibility fix. The solution is simply to +extend SimpleScorer instead. + +Missing method getBaseCookieValue() +----------------------------------- +This was renamed getCurrentCookieValue() in RC1. + +Missing files from the SimpleTest suite +--------------------------------------- +Versions of SimpleTest prior to Beta6 required a SIMPLE_TEST constant +to point at the SimpleTest folder location before any of the toolset +was loaded. This is no longer documented as it is now unnecessary +for later versions. If you are using an earlier version you may +need this constant. Consult the documentation that was bundled with +the release that you are using or upgrade to Beta6 or later. + +No method SimpleBrowser::getCurrentUrl() +-------------------------------------- +This is replaced with the more versatile showRequest() for +debugging. It only existed in this context for version Beta5. +Later versions will have SimpleBrowser::getHistory() for tracking +paths through pages. It is renamed as getUrl() since 1.0RC1. + +No method Stub::setStubBaseClass() +---------------------------------- +This method has finally been removed in 1.0RC1. Use +SimpleTestOptions::setStubBaseClass() instead. + +No class CommandLineReporter +---------------------------- +This was renamed to TextReporter in Beta3 and the deprecated version +was removed in 1.0RC1. + +No method requireReturn() +------------------------- +This was deprecated in Beta3 and is now removed. + +No method expectCookie() +------------------------ +This method was abruptly removed in Beta4 so as to simplify the internals +until another mechanism can replace it. As a workaround it is necessary +to assert that the cookie has changed by setting it before the page +fetch and then assert the desired value. + +No method clickSubmitByFormId() +------------------------------- +This method had an incorrect name as no button was involved. It was +renamed to submitByFormId() in Beta4 and the old version deprecated. +Now removed. + +No method paintStart() or paintEnd() +------------------------------------ +You should only get this error if you have subclassed the lower level +reporting and test runner machinery. These methods have been broken +down into events for test methods, events for test cases and events +for group tests. The new methods are... + +paintStart() --> paintMethodStart(), paintCaseStart(), paintGroupStart() +paintEnd() --> paintMethodEnd(), paintCaseEnd(), paintGroupEnd() + +This change was made in Beta3, ironically to make it easier to subclass +the inner machinery. Simply duplicating the code you had in the previous +methods should provide a temporary fix. + +No class TestDisplay +-------------------- +This has been folded into SimpleReporter in Beta3 and is now deprecated. +It was removed in RC1. + +No method WebTestCase::fetch() +------------------------------ +This was renamed get() in Alpha8. It is removed in Beta3. + +No method submit() +------------------ +This has been renamed clickSubmit() in Beta1. The old method was +removed in Beta2. + +No method clearHistory() +------------------------ +This method is deprecated in Beta2 and removed in RC1. + +No method getCallCount() +------------------------ +This method has been deprecated since Beta1 and has now been +removed. There are now more ways to set expectations on counts +and so this method should be unecessery. Removed in RC1. + +Cannot find file * +------------------ +The following public name changes have occoured... + +simple_html_test.php --> reporter.php +simple_mock.php --> mock_objects.php +simple_unit.php --> unit_tester.php +simple_web.php --> web_tester.php + +The old names were deprecated in Alpha8 and removed in Beta1. + +No method attachObserver() +-------------------------- +Prior to the Alpha8 release the old internal observer pattern was +gutted and replaced with a visitor. This is to trade flexibility of +test case expansion against the ease of writing user interfaces. + +Code such as... + +$test = &new MyTestCase(); +$test->attachObserver(new TestHtmlDisplay()); +$test->run(); + +...should be rewritten as... + +$test = &new MyTestCase(); +$test->run(new HtmlReporter()); + +If you previously attached multiple observers then the workaround +is to run the tests twice, once with each, until they can be combined. +For one observer the old method is simulated in Alpha 8, but is +removed in Beta1. + +No class TestHtmlDisplay +------------------------ +This class has been renamed to HtmlReporter in Alpha8. It is supported, +but deprecated in Beta1 and removed in Beta2. If you have subclassed +the display for your own design, then you will have to extend this +class (HtmlReporter) instead. + +If you have accessed the event queue by overriding the notify() method +then I am afraid you are in big trouble :(. The reporter is now +carried around the test suite by the runner classes and the methods +called directly. In the unlikely event that this is a problem and +you don't want to upgrade the test tool then simplest is to write your +own runner class and invoke the tests with... + +$test->accept(new MyRunner(new MyReporter())); + +...rather than the run method. This should be easier to extend +anyway and gives much more control. Even this method is overhauled +in Beta3 where the runner class can be set within the test case. Really +the best thing to do is to upgrade to this version as whatever you were +trying to achieve before should now be very much easier. + +Missing set options method +-------------------------- +All test suite options are now in one class called SimpleTestOptions. +This means that options are set differently... + +GroupTest::ignore() --> SimpleTestOptions::ignore() +Mock::setMockBaseClass() --> SimpleTestOptions::setMockBaseClass() + +These changed in Alpha8 and the old versions are now removed in RC1. + +No method setExpected*() +------------------------ +The mock expectations changed their names in Alpha4 and the old names +ceased to be supported in Alpha8. The changes are... + +setExpectedArguments() --> expectArguments() +setExpectedArgumentsSequence() --> expectArgumentsAt() +setExpectedCallCount() --> expectCallCount() +setMaximumCallCount() --> expectMaximumCallCount() + +The parameters remained the same. Added: trunk/tests/simpletest/LICENSE =================================================================== --- trunk/tests/simpletest/LICENSE (rev 0) +++ trunk/tests/simpletest/LICENSE 2009-03-15 21:24:56 UTC (rev 581) @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this Lic... [truncated message content] |
From: <Gin...@us...> - 2009-04-06 19:59:18
|
Revision: 613 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=613&view=rev Author: GingerDog Date: 2009-04-06 19:59:11 +0000 (Mon, 06 Apr 2009) Log Message: ----------- debian/changelog, function.inc.php, CHANGELOG.TXT : 2.3 rc3 is almost here Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/debian/changelog trunk/functions.inc.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2009-04-06 19:54:11 UTC (rev 612) +++ trunk/CHANGELOG.TXT 2009-04-06 19:59:11 UTC (rev 613) @@ -11,6 +11,13 @@ # $Id$ +Version 2.3rc3 - 2009/04/06 - SVN r611 +-------------------------------------- + + - Minor improvements to the Debian packaging, expect more soon + - Assorted bug fixes + - Partial support for per-user fetchmail.pl support + Version 2.3rc2 - 2009/02/03 - SVN r593 -------------------------------------- Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-04-06 19:54:11 UTC (rev 612) +++ trunk/debian/changelog 2009-04-06 19:59:11 UTC (rev 613) @@ -1,3 +1,10 @@ +postfixadmin (2.3rc3) unstable; urgency=low + + * Attempt at fixing Debian build issues (thanks to me...@so...) + * SVN revision 611 + + -- David Goodwin <dav...@pa...> Mon, 6 Apr 2009 20:56:00 +0000 + postfixadmin (2.3rc2) unstable; urgency=low * Subversion revision 593 Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-04-06 19:54:11 UTC (rev 612) +++ trunk/functions.inc.php 2009-04-06 19:59:11 UTC (rev 613) @@ -22,7 +22,7 @@ exit; } -$version = '2.3 rc2'; +$version = '2.3 rc3'; /** * check_session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-04-11 20:45:40
|
Revision: 625 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=625&view=rev Author: christian_boltz Date: 2009-04-11 20:45:38 +0000 (Sat, 11 Apr 2009) Log Message: ----------- xmlrpc.php: - remove session_start() - the session is already started in common.php model/UserHandler.php: - db_log() used undefined variable $USERID_USERNAME - use $username instead Modified Paths: -------------- trunk/model/UserHandler.php trunk/xmlrpc.php Modified: trunk/model/UserHandler.php =================================================================== --- trunk/model/UserHandler.php 2009-04-11 20:44:46 UTC (rev 624) +++ trunk/model/UserHandler.php 2009-04-11 20:45:38 UTC (rev 625) @@ -35,7 +35,7 @@ $result = db_query ("UPDATE $table_mailbox SET password='$new_db_password',modified=NOW() WHERE username='$username'"); - db_log ($username, $USERID_DOMAIN, 'edit_password', "$USERID_USERNAME"); + db_log ($username, $USERID_DOMAIN, 'edit_password', "$username"); return true; } Modified: trunk/xmlrpc.php =================================================================== --- trunk/xmlrpc.php 2009-04-11 20:44:46 UTC (rev 624) +++ trunk/xmlrpc.php 2009-04-11 20:45:38 UTC (rev 625) @@ -34,7 +34,6 @@ require_once('Zend/XmlRpc/Server.php'); $server = new Zend_XmlRpc_Server(); -session_start(); /** * @param string $username This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-04-15 21:54:34
|
Revision: 628 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=628&view=rev Author: christian_boltz Date: 2009-04-15 21:54:18 +0000 (Wed, 15 Apr 2009) Log Message: ----------- model/*, tests/*: - added a vim: comment for tab expansion etc. Modified Paths: -------------- trunk/model/AliasHandler.php trunk/model/UserHandler.php trunk/model/VacationHandler.php trunk/tests/RemoteAliasTest.php trunk/tests/RemoteTest.php trunk/tests/RemoteUserTest.php trunk/tests/RemoteVacationTest.php trunk/tests/common.php trunk/tests/run.php Modified: trunk/model/AliasHandler.php =================================================================== --- trunk/model/AliasHandler.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/model/AliasHandler.php 2009-04-15 21:54:18 UTC (rev 628) @@ -185,3 +185,5 @@ return false; } } + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/model/UserHandler.php =================================================================== --- trunk/model/UserHandler.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/model/UserHandler.php 2009-04-15 21:54:18 UTC (rev 628) @@ -66,3 +66,5 @@ return false; } } + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/model/VacationHandler.php =================================================================== --- trunk/model/VacationHandler.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/model/VacationHandler.php 2009-04-15 21:54:18 UTC (rev 628) @@ -124,3 +124,5 @@ return $vacation_goto; } } + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/tests/RemoteAliasTest.php =================================================================== --- trunk/tests/RemoteAliasTest.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/tests/RemoteAliasTest.php 2009-04-15 21:54:18 UTC (rev 628) @@ -59,3 +59,5 @@ $this->assertEqual($this->alias->get(), array()); } } + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/tests/RemoteTest.php =================================================================== --- trunk/tests/RemoteTest.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/tests/RemoteTest.php 2009-04-15 21:54:18 UTC (rev 628) @@ -80,3 +80,5 @@ } } } + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/tests/RemoteUserTest.php =================================================================== --- trunk/tests/RemoteUserTest.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/tests/RemoteUserTest.php 2009-04-15 21:54:18 UTC (rev 628) @@ -36,3 +36,5 @@ } } } + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/tests/RemoteVacationTest.php =================================================================== --- trunk/tests/RemoteVacationTest.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/tests/RemoteVacationTest.php 2009-04-15 21:54:18 UTC (rev 628) @@ -79,3 +79,5 @@ } } + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/tests/common.php =================================================================== --- trunk/tests/common.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/tests/common.php 2009-04-15 21:54:18 UTC (rev 628) @@ -2,3 +2,5 @@ ini_set('include_path', ini_get('include_path') . ':' . dirname(__FILE__) . '/../'); require_once(dirname(__FILE__) . '/../common.php'); + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/tests/run.php =================================================================== --- trunk/tests/run.php 2009-04-12 09:39:36 UTC (rev 627) +++ trunk/tests/run.php 2009-04-15 21:54:18 UTC (rev 628) @@ -15,3 +15,5 @@ $test->addTestFile('./RemoteAliasTest.php'); exit($test->run(new TextReporter()) ? 0 : 1); + +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-04-18 20:19:19
|
Revision: 634 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=634&view=rev Author: GingerDog Date: 2009-04-18 20:19:16 +0000 (Sat, 18 Apr 2009) Log Message: ----------- update documentation; get ready for a 2.3rc4 release Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/DOCUMENTS/UPGRADE.txt trunk/INSTALL.TXT trunk/config.inc.php trunk/debian/changelog trunk/functions.inc.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2009-04-18 19:56:24 UTC (rev 633) +++ trunk/CHANGELOG.TXT 2009-04-18 20:19:16 UTC (rev 634) @@ -11,6 +11,16 @@ # $Id$ +Version 2.3rc4 - 2009/04/18 - SVN r632 +-------------------------------------- + + - *Security fix* - on upgrade setup.php is restored; allowing a malicious + user to create their own superadmin account. We've removed the requirement to delete + setup.php, and instead a new config parameter (setup_password) is used to protect access + to this page. Password is encrypted, and setup.php can be used to generate the initial value. + - Fix undefined variables problem(s) + - Fix PostgreSQL date timestamp issues... + Version 2.3rc3 - 2009/04/06 - SVN r611 -------------------------------------- Modified: trunk/DOCUMENTS/UPGRADE.txt =================================================================== --- trunk/DOCUMENTS/UPGRADE.txt 2009-04-18 19:56:24 UTC (rev 633) +++ trunk/DOCUMENTS/UPGRADE.txt 2009-04-18 20:19:16 UTC (rev 634) @@ -43,7 +43,7 @@ Make sure that you are in your WWW directory and then unarchive the Postfix Admin archive (whatever the filename is): - $ tar -zxvf postfixadmin-2.2.tgz + $ tar -zxvf postfixadmin-X.X.tgz 3. Change permissions @@ -66,28 +66,32 @@ Comparing config.inc.php with your previous using "diff" might save you some time. +You can use a config.local.php file to contain your local settings - these will override any +defined in config.inc.php -5. Perform appropriate database upgrades +5. Run setup.php ---------------------------------------- +Access setup.php through a web browser. + +It will attempt to upgrade your database, and also allow you to create a superadmin user. + +From version 2.3, you need to specify a setup_password in config.inc.php - +setup.php should guide you through this process. If you do not have a setup_password, type one +into the form, and setup.php will echo out the hashed value (which needs to go into config.inc.php). +The setup_password removes the requirement for you to delete setup.php, and also closes a security hole. + Since version 2.2 of Postfixadmin, setup.php can perform the needed database updates automatically . -Open setup.php in your browser to update your database scheme. - If you update from 2.1 or older, also create a superadmin account using setup.php. Note that admin/ has been merged into the main directory. Login with the superadmin account to setup domains and domain admins. -6. Delete setup.php -------------------- -Delete setup.php - it allown non-authorized users to create a superadmin -account! - -7. Done +6. Done ------- This is all that is needed. Fire up your browser and go to the site that you specified to host Postfix Admin. Modified: trunk/INSTALL.TXT =================================================================== --- trunk/INSTALL.TXT 2009-04-18 19:56:24 UTC (rev 633) +++ trunk/INSTALL.TXT 2009-04-18 20:19:16 UTC (rev 634) @@ -104,14 +104,13 @@ The setup.php script will attempt to create the database structure (or upgrade it if you're coming from a previous version). -Assuming everything is OK you can create the admin user using the form displayed. +Assuming everything is OK you can specify a password (which you'll +need to use setup.php again in the future); when you submit the form, +the hashed value (which you need to enter into config.inc.php is echoed +out - with appropriate instructions on what to do with it). -Once you submit the form, all that's left to do is to delete "setup.php" +create the admin user using the form displayed. -e.g. - -mv setup.php setup.php.disabled - 5. Use PostfixAdmin ------------------- @@ -122,4 +121,7 @@ ------------------- As of March 2007, PostfixAdmin moved to SourceForge. For the forum posts and source updates, see: + https://sourceforge.net/projects/postfixadmin + +There is also #postfixadmin on irc.freenode.net. Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-04-18 19:56:24 UTC (rev 633) +++ trunk/config.inc.php 2009-04-18 20:19:16 UTC (rev 634) @@ -31,7 +31,9 @@ */ $CONF['configured'] = false; -// In order to setup Postfixadmin, you MUST change the password below. +// In order to setup Postfixadmin, you MUST specify a hashed password here. +// To create the hash, visit setup.php in a browser and type a password into the field, +// on submission it will be echoed out to you as a hashed value. $CONF['setup_password'] = 'changeme'; // Postfix Admin Path Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-04-18 19:56:24 UTC (rev 633) +++ trunk/debian/changelog 2009-04-18 20:19:16 UTC (rev 634) @@ -1,3 +1,11 @@ +postfixadmin (2.3rc4) unstable; urgency=low + + * Security fix for setup.php (issue occurs for those upgrading only; where + it's possible for a new admin user to get created by nasty.person) + * SVN revision 632 + + -- David Goodwin <dav...@pa...> Sat, 18 Apr 2009 21:00:00 +0000 + postfixadmin (2.3rc3) unstable; urgency=low * Attempt at fixing Debian build issues (thanks to me...@so...) Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-04-18 19:56:24 UTC (rev 633) +++ trunk/functions.inc.php 2009-04-18 20:19:16 UTC (rev 634) @@ -22,7 +22,7 @@ exit; } -$version = '2.3 rc3'; +$version = '2.3 rc4'; /** * check_session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-04-22 11:32:01
|
Revision: 640 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=640&view=rev Author: christian_boltz Date: 2009-04-22 11:31:53 +0000 (Wed, 22 Apr 2009) Log Message: ----------- login.php, index.php: - removed the $CONF['configured'] = 'I_know_the_risk_of_not_deleting_setup.php' developer hack (no longer needed since setup.php requires a password) - this also makes index.php redirecting to login.php again (the old check tested for file_exists(setup.php)...) common.php: - removed a superfluous check for $CONF[setup_password] (see mailinglist for details) config.inc.php: - removed a small outdated comment Modified Paths: -------------- trunk/common.php trunk/config.inc.php trunk/index.php trunk/login.php Modified: trunk/common.php =================================================================== --- trunk/common.php 2009-04-20 18:41:23 UTC (rev 639) +++ trunk/common.php 2009-04-22 11:31:53 UTC (rev 640) @@ -40,9 +40,6 @@ if($CONF['configured'] == FALSE) { die("Please edit config.inc.php - change \$CONF['configured'] to true after setting your database settings"); } - if(!isset($CONF['setup_password'])) { - die("You must have a \$CONF['setup_password'] defined - this allows authenticated access to setup.php"); - } } Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-04-20 18:41:23 UTC (rev 639) +++ trunk/config.inc.php 2009-04-22 11:31:53 UTC (rev 640) @@ -382,7 +382,7 @@ // that future updates work without problems, you can use a separate config // file (config.local.php) instead of editing this file and override some // settings there. -if (file_exists(dirname(__FILE__) . '/config.local.php')) { # for / +if (file_exists(dirname(__FILE__) . '/config.local.php')) { include(dirname(__FILE__) . '/config.local.php'); } Modified: trunk/index.php =================================================================== --- trunk/index.php 2009-04-20 18:41:23 UTC (rev 639) +++ trunk/index.php 2009-04-22 11:31:53 UTC (rev 640) @@ -23,7 +23,7 @@ $CONF['configured'] = FALSE; @include_once('config.inc.php'); # hide error message because only $CONF['configured'] is checked here -if (!file_exists (realpath ("./setup.php")) || $CONF['configured'] == 'I_know_the_risk_of_not_deleting_setup.php') +if ( $CONF['configured'] === TRUE ) { header ("Location: login.php"); exit; Modified: trunk/login.php =================================================================== --- trunk/login.php 2009-04-20 18:41:23 UTC (rev 639) +++ trunk/login.php 2009-04-22 11:31:53 UTC (rev 640) @@ -30,15 +30,10 @@ require_once('common.php'); -if (isset($CONF['configured']) && $CONF['configured'] == 'I_know_the_risk_of_not_deleting_setup.php') { +if($CONF['configured'] !== true) { + print "Installation not yet configured; please edit config.inc.php"; + exit; } -else -{ - if($CONF['configured'] !== true) { - print "Installation not yet configured; please edit config.inc.php"; - exit; - } -} if ($_SERVER['REQUEST_METHOD'] == "GET") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-04-25 13:11:19
|
Revision: 645 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=645&view=rev Author: GingerDog Date: 2009-04-25 13:11:16 +0000 (Sat, 25 Apr 2009) Log Message: ----------- alias editing - ensure template uses correct list of aliases Modified Paths: -------------- trunk/edit-alias.php trunk/templates/edit-alias.php Modified: trunk/edit-alias.php =================================================================== --- trunk/edit-alias.php 2009-04-25 11:46:37 UTC (rev 644) +++ trunk/edit-alias.php 2009-04-25 13:11:16 UTC (rev 645) @@ -123,6 +123,7 @@ { $new_aliases = explode(',', $goto); } + $new_aliases = array_unique($new_aliases); foreach($new_aliases as $address) { if (in_array($address, $CONF['default_aliases'])) continue; @@ -161,7 +162,6 @@ else { db_log ($SESSID_USERNAME, $fDomain, 'edit_alias', "$fAddress -> $goto"); - header ("Location: list-virtual.php?domain=$fDomain"); exit; } Modified: trunk/templates/edit-alias.php =================================================================== --- trunk/templates/edit-alias.php 2009-04-25 11:46:37 UTC (rev 644) +++ trunk/templates/edit-alias.php 2009-04-25 13:11:16 UTC (rev 645) @@ -1,4 +1,5 @@ <?php if( !defined('POSTFIXADMIN') ) die( "This file cannot be used standalone." ); ?> + <div id="edit_form"> <form name="alias" method="post"> <table> @@ -15,11 +16,9 @@ <td> <textarea class="flat" rows="10" cols="60" name="fGoto"> <?php -$array = preg_split ('/,/', $tGoto); -for ($i = 0 ; $i < sizeof ($array) ; $i++) -{ - if (empty ($array[$i])) continue; - print "$array[$i]\n"; + +foreach($alias_list as $alias) { + print "$alias\n"; } ?> </textarea> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-02 20:25:01
|
Revision: 648 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=648&view=rev Author: christian_boltz Date: 2009-05-02 20:24:58 +0000 (Sat, 02 May 2009) Log Message: ----------- setup.php: - added form to create setup password hash. It will be displayed if a) no setup password is defined yet b) the "lost password" link was clicked - moved checks for empty and too short passwort into check_setup_password() - added an optional $lostpw_mode parameter to check_setup_password() which causes slightly different behaviour (enforces generation of new hash, even if the password would match) - changed check_password_setup() return value to array($error, $message) - moved displaying $tMessage above the form - it is more useful there. - removed "see config.inc.php" notice from password field in "create superadmin" form - this hint doesn't help much with the hashed password ;-) - TODO: The if statements to decide which form to display is quite difficult (and will become unreadable in case we need another form ;-) We should think about a better way to select the form to display... (maybe flash_error / flash_info + redirect?) upgrade.php: - added missing <p> tag Modified Paths: -------------- trunk/setup.php trunk/upgrade.php Modified: trunk/setup.php =================================================================== --- trunk/setup.php 2009-04-30 12:00:26 UTC (rev 647) +++ trunk/setup.php 2009-05-02 20:24:58 UTC (rev 648) @@ -302,24 +302,28 @@ $pAdminCreate_admin_password_text = ""; $tUsername = ''; $tMessage = ''; + $lostpw_error = 0; + $setuppw = ""; + if (isset($CONF['setup_password'])) $setuppw = $CONF['setup_password']; - if ($_SERVER['REQUEST_METHOD'] == "POST") - { - # ensure setup password is correct - if (safepost('setup_password') == "" ) { - $error += 1; - $tMessage = "Setup password must be specified<br />If you didn't set up a setup password yet, enter the password you want to use."; - } elseif (strlen(safepost('setup_password')) < $CONF['min_password_length']) { - $error += 1; - $tMessage = "The setup password you entered is too short. Please choose a better one."; + if (safepost("form") == "setuppw") { + # "setup password" form submitted + if (safepost('setup_password') != safepost('setup_password2')) { + $tMessage = "The two passwords differ!"; + $lostpw_error = 1; } else { - $pw_check_result = check_setup_password(safepost('setup_password')); - if ($pw_check_result != 'pass_OK') { - $error += 1; - $tMessage = $pw_check_result; - } + list ($lostpw_error, $lostpw_result) = check_setup_password(safepost('setup_password'), 1); + $tMessage = $lostpw_result; + $setuppw = "changed"; } + } elseif (safepost("form") == "createadmin") { + # "create admin" form submitted + list ($pw_check_error, $pw_check_result) = check_setup_password(safepost('setup_password')); + if ($pw_check_result != 'pass_OK') { + $error += 1; + $tMessage = $pw_check_result; + } if($error == 0 && $pw_check_result == 'pass_OK') { if (isset ($_POST['fUsername'])) $fUsername = escape_string ($_POST['fUsername']); @@ -338,21 +342,52 @@ if (isset ($_POST['fUsername'])) $tUsername = escape_string ($_POST['fUsername']); } } - } + } - if ($_SERVER['REQUEST_METHOD'] == "GET" || $error != 0) - { -?> + if ( ($setuppw == "" || $setuppw == "changeme" || safeget("lostpw") == 1 || $lostpw_error != 0) /* && $_SERVER['REQUEST_METHOD'] != "POST" */ ) { +# show "create setup password" form + ?> +<div class="standout"><?php print $tMessage; ?></div> <div id="edit_form"> +<form name="setuppw" method="post" action="setup.php"> +<input type="hidden" name="form" value="setuppw" /> +<table> + <td colspan="3"><h3>Change setup password</h3></td> + </tr> + <tr> + <td>Setup password</td> + <td><input class="flat" type="password" name="setup_password" value="" /></td> + <td></td> + </tr> + <tr> + <td>Setup password (again)</td> + <td><input class="flat" type="password" name="setup_password2" value="" /></td> + <td></td> + </tr> + <tr> + <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="Generate password hash" /></td> + </tr> +</table> +</form> +</div> + +<?php + + } elseif ($_SERVER['REQUEST_METHOD'] == "GET" || $error != 0 || $lostpw_error == 0) { + ?> + +<div class="standout"><?php print $tMessage; ?></div> +<div id="edit_form"> <form name="create_admin" method="post"> +<input type="hidden" name="form" value="createadmin" /> <table> <td colspan="3"><h3>Create superadmin account</h3></td> </tr> <tr> - <td>Setup password (see config.inc.php)</td> + <td>Setup password</td> <td><input class="flat" type="password" name="setup_password" value="" /></td> - <td></td> + <td><a href="setup.php?lostpw=1">Lost password?</a></td> </tr> <tr> <td><?php print $PALANG['pAdminCreate_admin_username'] . ":"; ?></td> @@ -372,9 +407,6 @@ <tr> <td colspan="3" class="hlp_center"><input class="button" type="submit" name="submit" value="<?php print $PALANG['pAdminCreate_admin_button']; ?>" /></td> </tr> - <tr> - <td colspan="3" class="standout"><?php print $tMessage; ?></td> - </tr> </table> </form> </div> @@ -401,22 +433,42 @@ return $salt . ':' . sha1($salt . ':' . $password); } -function check_setup_password($password) { + +/* + returns: array( + 'error' => 0 (or 1), + 'message => text + ) +*/ +function check_setup_password($password, $lostpw_mode = 0) { global $CONF; + $error = 1; # be pessimistic + $setuppw = ""; if (isset($CONF['setup_password'])) $setuppw = $CONF['setup_password']; list($confsalt, $confpass, $trash) = explode(':', $setuppw . '::'); $pass = encrypt_setup_password($password, $confsalt); - if ($pass == $setuppw) { # correct passsword + + if ($password == "" ) { # no password specified? + $result = "Setup password must be specified<br />If you didn't set up a setup password yet, enter the password you want to use."; + } elseif (strlen($password) < $CONF['min_password_length']) { # password too short? + $result = "The setup password you entered is too short. Please choose a better one."; + } elseif ($pass == $setuppw && $lostpw_mode == 0) { # correct passsword (and not asking for a new password) $result = "pass_OK"; + $error = 0; } else { $pass = encrypt_setup_password($password, generate_setup_password_salt()); - $result = '<p><b>Setup password not specified correctly</b></p>'; + $result = ""; + if ($lostpw_mode == 1) { + $error = 0; # non-matching password is expected when the user asks for a new password + } else { + $result = '<p><b>Setup password not specified correctly</b></p>'; + } $result .= '<p>If you want to use the password you entered as setup password, edit config.inc.php and set</p>'; $result .= "<pre>\$CONF['setup_password'] = '$pass';</pre>"; } - return $result; + return array ($error, $result); } /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2009-04-30 12:00:26 UTC (rev 647) +++ trunk/upgrade.php 2009-05-02 20:24:58 UTC (rev 648) @@ -109,8 +109,8 @@ $target_version = preg_replace('/[^0-9]/', '', '$Revision$'); if ($current_version >= $target_version) { -# already up to date - echo "Database is up to date"; + # already up to date + echo "<p>Database is up to date</p>"; return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-03 17:23:57
|
Revision: 650 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=650&view=rev Author: christian_boltz Date: 2009-05-03 17:23:48 +0000 (Sun, 03 May 2009) Log Message: ----------- functions.inc.php: - gen_show_status(): add support for recipient_delimiter when checking aliases This implements part (8) of https://sourceforge.net/tracker/?func=detail&aid=1951926&group_id=191583&atid=937967 config.inc.php: - add new setting $CONF['recipient_delimiter'] Modified Paths: -------------- trunk/config.inc.php trunk/functions.inc.php Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-05-03 16:14:14 UTC (rev 649) +++ trunk/config.inc.php 2009-05-03 17:23:48 UTC (rev 650) @@ -301,6 +301,10 @@ // - add the corresponding color to show_custom_colors $CONF['show_custom_domains']=array("subdomain.domain.ext","domain2.ext"); $CONF['show_custom_colors']=array("lightgreen","lightblue"); +// If you use a recipient_delimiter in your postfix config, you can also honor it when aliases are checked. +// Example: $CONF['recipient_delimiter'] = "+"; +// Set to "" to disable this check. +$CONF['recipient_delimiter'] = ""; // Optional: Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-05-03 16:14:14 UTC (rev 649) +++ trunk/functions.inc.php 2009-05-03 17:23:48 UTC (rev 650) @@ -2140,7 +2140,13 @@ while ( ($g=array_pop($gotos)) && $stat_ok ) { $stat_catchall = substr($g,strpos($g,"@")); - $stat_result = db_query ("SELECT address FROM $table_alias WHERE address = '$g' OR address = '$stat_catchall'"); + $stat_delimiter = ""; + if (!empty($CONF['recipient_delimiter'])) { + $delimiter = preg_quote($CONF['recipient_delimiter'], "/"); + $stat_delimiter = preg_replace('/' .$delimiter. '[^' .$delimiter. ']*@/', "@", $g); + $stat_delimiter = "OR address = '$stat_delimiter'"; + } + $stat_result = db_query ("SELECT address FROM $table_alias WHERE address = '$g' OR address = '$stat_catchall' $stat_delimiter"); if ($stat_result['rows'] == 0) { $stat_ok = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-07 23:23:36
|
Revision: 652 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=652&view=rev Author: christian_boltz Date: 2009-05-07 23:23:21 +0000 (Thu, 07 May 2009) Log Message: ----------- reverting most changes from SVN r572 aka https://sourceforge.net/tracker/index.php?func=detail&aid=2567466&group_id=191583&atid=937966 because - it undermines the $CONF[*alias_control*] settings more or less - mailbox aliases with non-default targets are always shown in the "Aliases" section - see comment from 2009-05-04 on https://sourceforge.net/tracker/?func=detail&aid=1902476&group_id=191583&atid=937964 - it introduced some "funny" bugs - a nice example is http://sourceforge.net/tracker/?func=detail&aid=2786284&group_id=191583&atid=937964 Files / sections affected by the revert: - list-virtual.php: all numbers (alias count etc.) correct? (the changes in this file are the largest ones) - functions.inc.php: SQL queries in get_domain_properties() - delete.php: the only change since r572 affected code that was inserted in r572 (and is now deleted again) - nothing should break here - create-alias.php: had no changes since r572 - therefore nothing should break here Exceptions (not reverted): - edit-alias: this change looks useful (hide mailbox alias target from admins if they don't have permissions to change it). The actual code has changed in the meantime, but the functionality stays. Additionally, reverting this would be very hard or throw useful later changes away. BUT: shouldn't the page completely forbid to edit a mailbox alias if the admin doesn't have permissions for it? - functions.inc.php: comment for pacrypt() ;-) - linebreaks in long SQL queries Please check if everything is still working as expected (especially the domain list and the virtual list) - I did only some quick tests. Modified Paths: -------------- trunk/create-alias.php trunk/delete.php trunk/functions.inc.php trunk/list-virtual.php Modified: trunk/create-alias.php =================================================================== --- trunk/create-alias.php 2009-05-06 20:24:05 UTC (rev 651) +++ trunk/create-alias.php 2009-05-07 23:23:21 UTC (rev 652) @@ -117,15 +117,14 @@ $fAddress = "@" . escape_string ($_POST['fDomain']); } - $append_alias = false; - $result = db_query ("SELECT * FROM $table_alias WHERE address='$fAddress'"); if ($result['rows'] == 1) { - $append_alias = true; + $error = 1; $tAddress = escape_string ($_POST['fAddress']); $tGoto = $fGoto; $tDomain = $fDomain; + $pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error2']; } if ($fActive == "on") { @@ -135,29 +134,13 @@ $sqlActive = db_get_boolean(False); } - $success = false; - /* Alias (or mailbox) already present, let's add the destination to that row */ - if ($append_alias) { + if ($error != 1) { if (preg_match('/^\*@(.*)$/', $fGoto, $match)) { $fGoto = "@" . $match[1]; } - $array = db_array ($result['result']); - - $values ['goto'] = $array['goto'] . ',' . $fGoto; - $result = db_update ($table_alias, "address = '$fAddress'", $values, array ('modified')); - $success = ($result == 1); - - } elseif ($error != 1) { - if (preg_match('/^\*@(.*)$/', $fGoto, $match)) { - $fGoto = "@" . $match[1]; - } - $result = db_query ("INSERT INTO $table_alias (address,goto,domain,created,modified,active) VALUES ('$fAddress','$fGoto','$fDomain',NOW(),NOW(),'$sqlActive')"); - $success = ($result['rows'] == 1); - } - - if (! $success) { + if ($result['rows'] != 1) { $tDomain = $fDomain; $tMessage = $PALANG['pCreate_alias_result_error'] . "<br />($fAddress -> $fGoto)<br />\n"; } @@ -167,6 +150,7 @@ $tDomain = $fDomain; $tMessage = $PALANG['pCreate_alias_result_success'] . "<br />($fAddress -> $fGoto)<br />\n"; } + } } include ("templates/header.php"); Modified: trunk/delete.php =================================================================== --- trunk/delete.php 2009-05-06 20:24:05 UTC (rev 651) +++ trunk/delete.php 2009-05-07 23:23:21 UTC (rev 652) @@ -37,64 +37,12 @@ $SESSID_USERNAME = authentication_get_username(); $error = 0; -$fTable = escape_string(safeget('table')); # see the if blocks below for valid values -$fDelete = escape_string(safeget('delete')); -$fDomain = escape_string(safeget('domain')); +$fTable = escape_string (safeget('table') ); # see the if blocks below for valid values +$fDelete = escape_string (safeget('delete')); +$fDomain = escape_string (safeget('domain')); $error=0; -/** - * delete_alias - * Action: Delete an alias - * @param String $alias alias to delete. - * @param String $domain domain of the alias - * @param boolean $force_delete - deletes the alias from the table if true, - * checks if the alias is real and act accordlying if false. - * Default is false. - * @return String username (e.g. fo...@ex...) - */ -function delete_alias($alias, $domain, $force_delete = false) -{ - global $table_alias, $table_mailbox; - $SESSID_USERNAME = authentication_get_username(); - $real_alias = true; - - if (! $force_delete) - { - $result = db_query ("SELECT 1 FROM $table_mailbox - WHERE username='$alias' AND domain='$domain'"); - if ($result['rows'] != 0) - { - /* If the alias is a real mailbox as well, remove all its real aliases and keep - * only the address */ - $real_alias = false; - } - } - - if ($force_delete or $real_alias) - { - $result = db_query ("DELETE FROM $table_alias WHERE address='$alias' AND domain='$domain'"); - } - else - { - $result = db_query ("UPDATE $table_alias SET goto='$alias',modified=NOW() - WHERE address='$alias' AND domain='$domain'"); - } - - if ($result['rows'] != 1) - { - $tMessage = $PALANG['pDelete_delete_error'] . "<b>$alias</b> (alias)!</span>"; - - return false; - } - else - { - db_log ($SESSID_USERNAME, $domain, 'delete_alias', $alias); - } - - return true; -} - if ($fTable == "admin") { authentication_require_role('global-admin'); @@ -150,7 +98,7 @@ } } # ($fTable == "alias_domain") -elseif ($fTable == "mailbox") +elseif ($fTable == "alias" or $fTable == "mailbox") { if (!check_owner ($SESSID_USERNAME, $fDomain)) @@ -166,59 +114,50 @@ else { if ($CONF['database_type'] == "pgsql") db_query('BEGIN'); + /* there may be no aliases to delete */ + $result = db_query("SELECT * FROM $table_alias WHERE address = '$fDelete' AND domain = '$fDomain'"); + if($result['rows'] == 1) { + $result = db_query ("DELETE FROM $table_alias WHERE address='$fDelete' AND domain='$fDomain'"); + db_log ($SESSID_USERNAME, $fDomain, 'delete_alias', $fDelete); + } - $error = delete_alias ($fDelete, $fDomain, $force_delete = true) ? 0 : 1; - if (! $error) + /* is there a mailbox? if do delete it from orbit; it's the only way to be sure */ + $result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fDelete' AND domain='$fDomain'"); + if ($result['rows'] == 1) { - /* is there a mailbox? if do delete it from orbit; it's the only way to be sure */ - $result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fDelete' AND domain='$fDomain'"); - if ($result['rows'] == 1) + $result = db_query ("DELETE FROM $table_mailbox WHERE username='$fDelete' AND domain='$fDomain'"); + $postdel_res=mailbox_postdeletion($fDelete,$fDomain); + if ($result['rows'] != 1 || !$postdel_res) { - $result = db_query ("DELETE FROM $table_mailbox WHERE username='$fDelete' AND domain='$fDomain'"); - $postdel_res=mailbox_postdeletion($fDelete,$fDomain); - if ($result['rows'] != 1 || !$postdel_res) + $error = 1; + $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> ("; + if ($result['rows']!=1) { - $error = 1; - $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> ("; - if ($result['rows']!=1) - { - $tMessage.='mailbox'; - if (!$postdel_res) $tMessage.=', '; - } - if (!$postdel_res) - { - $tMessage.='post-deletion'; - } - $tMessage.=')</span>'; + $tMessage.='mailbox'; + if (!$postdel_res) $tMessage.=', '; } + if (!$postdel_res) + { + $tMessage.='post-deletion'; + } + $tMessage.=')</span>'; } - $result = db_query("SELECT * FROM $table_vacation WHERE email = '$fDelete' AND domain = '$fDomain'"); - if($result['rows'] == 1) { - db_query ("DELETE FROM $table_vacation WHERE email='$fDelete' AND domain='$fDomain'"); - db_query ("DELETE FROM $table_vacation_notification WHERE on_vacation ='$fDelete' "); /* should be caught by cascade, if PgSQL */ - } } - - if ($error != 1) - { - if ($CONF['database_type'] == "pgsql") db_query('COMMIT'); - header ("Location: list-virtual.php?domain=$fDomain"); - exit; - } else { - $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (physical mail)!</span>"; - if ($CONF['database_type'] == "pgsql") db_query('ROLLBACK'); + $result = db_query("SELECT * FROM $table_vacation WHERE email = '$fDelete' AND domain = '$fDomain'"); + if($result['rows'] == 1) { + db_query ("DELETE FROM $table_vacation WHERE email='$fDelete' AND domain='$fDomain'"); + db_query ("DELETE FROM $table_vacation_notification WHERE on_vacation ='$fDelete' "); /* should be caught by cascade, if PgSQL */ } - } # ($fTable == "mailbox") -} -elseif ($fTable == "alias") { - $error = delete_alias ($fDelete, $fDomain) ? 0 : 1; + } if ($error != 1) { + if ($CONF['database_type'] == "pgsql") db_query('COMMIT'); header ("Location: list-virtual.php?domain=$fDomain"); exit; } else { - $tMessage = $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (alias)!</span>"; + $tMessage .= $PALANG['pDelete_delete_error'] . "<b>$fDelete</b> (physical mail)!</span>"; + if ($CONF['database_type'] == "pgsql") db_query('ROLLBACK'); } } else Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-05-06 20:24:05 UTC (rev 651) +++ trunk/functions.inc.php 2009-05-07 23:23:21 UTC (rev 652) @@ -431,14 +431,7 @@ global $table_alias, $table_mailbox, $table_domain; $list = array (); - $result = db_query ("SELECT COUNT(*) FROM $table_alias - LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username - WHERE ($table_alias.domain='$domain' AND $table_mailbox.maildir IS NULL) - OR - ($table_alias.domain='$domain' - AND $table_alias.goto LIKE '%,%' - AND $table_mailbox.maildir IS NOT NULL)"); - + $result = db_query ("SELECT COUNT(*) FROM $table_alias WHERE domain='$domain'"); $row = db_row ($result['result']); $list['alias_count'] = $row[0]; @@ -449,7 +442,7 @@ $result = db_query ("SELECT SUM(quota) FROM $table_mailbox WHERE domain='$domain'"); $row = db_row ($result['result']); $list['quota_sum'] = $row[0]; - $list['alias_count'] = $list['alias_count']; + $list['alias_count'] = $list['alias_count'] - $list['mailbox_count']; $list['alias_pgindex']=array (); $list['mbox_pgindex']=array (); @@ -471,10 +464,6 @@ FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE ($table_alias.domain='$domain' AND $table_mailbox.maildir IS NULL) - OR - ($table_alias.domain='$domain' - AND $table_alias.goto LIKE '%,%' - AND $table_mailbox.maildir IS NOT NULL) ORDER BY $table_alias.address LIMIT $limitSql"; $result = db_query ("$query"); $row = db_array ($result['result']); @@ -487,10 +476,6 @@ FROM $table_alias LEFT JOIN $table_mailbox ON $table_alias.address=$table_mailbox.username WHERE ($table_alias.domain='$domain' AND $table_mailbox.maildir IS NULL) - OR - ($table_alias.domain='$domain' - AND $table_alias.goto LIKE '%,%' - AND $table_mailbox.maildir IS NOT NULL) ORDER BY $table_alias.address LIMIT $limitSql"; $result = db_query ("$query"); $row = db_array ($result['result']); Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-05-06 20:24:05 UTC (rev 651) +++ trunk/list-virtual.php 2009-05-07 23:23:21 UTC (rev 652) @@ -123,22 +123,15 @@ $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) - OR - ($table_alias.domain='$fDomain' - AND $table_alias.goto LIKE '%,%' - AND $table_mailbox.maildir IS NOT NULL) ORDER BY $table_alias.address LIMIT $fDisplay, $page_size"; - if ('pgsql'==$CONF['database_type']) { $query = "SELECT address, goto, - modified, + 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 - AND $table_alias.goto NOT LIKE '%,%') + FROM $table_alias + WHERE domain='$fDomain' AND NOT EXISTS(SELECT 1 FROM $table_mailbox WHERE username=$table_alias.address) ORDER BY address LIMIT $page_size OFFSET $fDisplay"; } $result = db_query ($query); @@ -147,20 +140,13 @@ while ($row = db_array ($result['result'])) { if ('pgsql'==$CONF['database_type']) - { + { //. at least in my database, $row['modified'] already looks like : 2009-04-11 21:38:10.75586+01, // while gmstrftime expects an integer value. strtotime seems happy though. //$row['modified']=gmstrftime('%c %Z',$row['modified']); $row['modified'] = date('Y-m-d H:i', strtotime($row['modified'])); $row['active']=('t'==$row['active']) ? 1 : 0; } - - /* Has a real mailbox as well? Remove the address from $row['goto'] in order to edit just the real aliases */ - if (strstr ($row['goto'], ',') != FALSE) - { - $row['goto'] = preg_replace ('/\s*,*\s*' . $row['address'] . '\s*,*\s*/', '', $row['goto']); - } - $tAlias[] = $row; } } @@ -213,7 +199,7 @@ } 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'])) { @@ -242,5 +228,5 @@ include ("templates/list-virtual.php"); include ("templates/footer.php"); -/* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */ +/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-12 22:19:42
|
Revision: 655 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=655&view=rev Author: christian_boltz Date: 2009-05-12 22:19:39 +0000 (Tue, 12 May 2009) Log Message: ----------- list-domain.php: - replace get_domain_properties() calls with two SQL queries that fetch the domain data and count the number of mailboxes and aliases per domain. This change speeds up list-domain extremely on setups with lots of domains, mailboxes and aliases. The old code took several minutes on my test data (that's about 55000 mailboxes and their aliases), the new code only needs some seconds. - $domain_properties now uses the domain name as index key instead of a serial number templates/admin_list-domain.php: - replace usage of $list_domains with $domain_properties - change main loop to use the domain name as $domain_properties array key instead of a serial number upgrade.php: - upgrade_655(): add index on domain column in mailbox and alias table. This speeds up list-domain from 14s to about 1s on my test data in MySQL (the 14s were _after_ the changes in list_domain.php) - added _add_index() function to hide the database specific details in upgrade functions This commit should fix the performance problems reported on http://sourceforge.net/forum/forum.php?thread_id=2343349&forum_id=676076 Modified Paths: -------------- trunk/list-domain.php trunk/templates/admin_list-domain.php trunk/upgrade.php Modified: trunk/list-domain.php =================================================================== --- trunk/list-domain.php 2009-05-11 19:39:28 UTC (rev 654) +++ trunk/list-domain.php 2009-05-12 22:19:39 UTC (rev 655) @@ -40,25 +40,60 @@ $fUsername = ""; } +$list_all_domains = 0; if (isset($admin_properties) && $admin_properties['domain_count'] == 'ALL') { # list all domains for superadmins - $list_domains = list_domains (); + $list_all_domains = 1; } elseif (!empty($fUsername)) { $list_domains = list_domains_for_admin ($fUsername); } elseif ($is_superadmin) { - $list_domains = list_domains (); + $list_all_domains = 1; } else { $list_domains = list_domains_for_admin(authentication_get_username()); } - if (!empty ($list_domains)) - { - for ($i = 0; $i < sizeof ($list_domains); $i++) - { - $domain_properties[$i] = get_domain_properties ($list_domains[$i]); - } - } -#} +if ($list_all_domains == 1) { + $where = " WHERE domain.domain != 'ALL' "; # TODO: the ALL dummy domain is annoying... +} else { + $list_domains = escape_string($list_domains); + $where = " WHERE domain.domain IN ('" . join("','", $list_domains) . "') "; +} +# fetch domain data and number of mailboxes +# (PgSQL requires the extensive GROUP BY statement, https://sourceforge.net/forum/message.php?msg_id=7386240) +$query = " + SELECT domain.* , COUNT( DISTINCT mailbox.username ) AS mailbox_count + FROM domain + LEFT JOIN mailbox ON domain.domain = mailbox.domain + $where + GROUP BY domain.domain, domain.description, domain.aliases, domain.mailboxes, + domain.maxquota, domain.quota, domain.transport, domain.backupmx, domain.created, + domain.modified, domain.active + ORDER BY domain.domain + "; +$result = db_query($query); + +while ($row = db_array ($result['result'])) { + $domain_properties[$row['domain']] = $row; +} + +# fetch number of aliases +# doing this separate is much faster than doing it in one "big" query +$query = " + SELECT domain.domain, COUNT( DISTINCT alias.address ) AS alias_count + FROM domain + LEFT JOIN alias ON domain.domain = alias.domain + $where + GROUP BY domain.domain + ORDER BY domain.domain + "; + +$result = db_query($query); + +while ($row = db_array ($result['result'])) { + # add number of aliases to $domain_properties array. mailbox aliases do not count. + $domain_properties [$row['domain']] ['alias_count'] = $row['alias_count'] - $domain_properties [$row['domain']] ['mailbox_count']; +} + include ("templates/header.php"); include ("templates/menu.php"); Modified: trunk/templates/admin_list-domain.php =================================================================== --- trunk/templates/admin_list-domain.php 2009-05-11 19:39:28 UTC (rev 654) +++ trunk/templates/admin_list-domain.php 2009-05-12 22:19:39 UTC (rev 655) @@ -27,7 +27,7 @@ </div> <?php -if (sizeof ($list_domains) > 0) +if (sizeof ($domain_properties) > 0) { print "<table id=\"admin_table\">\n"; print " <tr class=\"header\">\n"; @@ -43,12 +43,13 @@ print " <td colspan=\"2\"> </td>\n"; print " </tr>\n"; - for ($i = 0; $i < sizeof ($list_domains); $i++) +# for ($i = 0; $i < sizeof ($domain_properties); $i++) + foreach(array_keys($domain_properties) as $i) { - if ((is_array ($list_domains) and sizeof ($list_domains) > 0)) + if ((is_array ($domain_properties) and sizeof ($domain_properties) > 0)) { print " <tr class=\"hilightoff\" onMouseOver=\"className='hilighton';\" onMouseOut=\"className='hilightoff';\">\n"; - print "<td><a href=\"list-virtual.php?domain=" . $list_domains[$i] . "\">" . $list_domains[$i] . "</a></td>"; + print "<td><a href=\"list-virtual.php?domain=" . $domain_properties[$i]['domain'] . "\">" . $domain_properties[$i]['domain'] . "</a></td>"; print "<td>" . $domain_properties[$i]['description'] . "</td>"; print "<td>" . $domain_properties[$i]['alias_count'] . " / " . $domain_properties[$i]['aliases'] . "</td>"; print "<td>" . $domain_properties[$i]['mailbox_count'] . " / " . $domain_properties[$i]['mailboxes'] . "</td>"; @@ -74,9 +75,9 @@ print "<td>$backupmx</td>"; print "<td>" . $domain_properties[$i]['modified'] . "</td>"; $active = ($domain_properties[$i]['active'] == 1) ? $PALANG['YES'] : $PALANG['NO']; - print "<td><a href=\"edit-active-domain.php?domain=" . $list_domains[$i] . "\">" . $active . "</a></td>"; - print "<td><a href=\"edit-domain.php?domain=" . $list_domains[$i] . "\">" . $PALANG['edit'] . "</a></td>"; - print "<td><a href=\"delete.php?table=domain&delete=" . $list_domains[$i] . "\" onclick=\"return confirm ('" . $PALANG['confirm_domain'] . $PALANG['pAdminList_admin_domain'] . ": " . $list_domains[$i] . "')\">" . $PALANG['del'] . "</a></td>"; + print "<td><a href=\"edit-active-domain.php?domain=" . $domain_properties[$i]['domain'] . "\">" . $active . "</a></td>"; + print "<td><a href=\"edit-domain.php?domain=" . $domain_properties[$i]['domain'] . "\">" . $PALANG['edit'] . "</a></td>"; + print "<td><a href=\"delete.php?table=domain&delete=" . $domain_properties[$i]['domain'] . "\" onclick=\"return confirm ('" . $PALANG['confirm_domain'] . $PALANG['pAdminList_admin_domain'] . ": " . $domain_properties[$i]['domain'] . "')\">" . $PALANG['del'] . "</a></td>"; print "</tr>\n"; } } Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2009-05-11 19:39:28 UTC (rev 654) +++ trunk/upgrade.php 2009-05-12 22:19:39 UTC (rev 655) @@ -222,7 +222,22 @@ } } +function _add_index($table, $indexname, $fieldlist) { + global $CONF; + $tabe = table_by_key ($table); + if ($CONF['database_type'] == 'mysql' || $CONF['database_type'] == 'mysqli' ) { + return "ALTER TABLE $table ADD INDEX `$indexname` ( `$fieldlist` )"; + } elseif($CONF['database_type'] == 'pgsql') { + $pgindexname = $table . "_" . $indexname; + return "CREATE INDEX $pgindexname ON $table($fieldlist);"; # Index names are unique with a DB for PostgreSQL + } else { + echo "Sorry, unsupported database type " . $conf['database_type']; + exit; + } + +} + function upgrade_1_mysql() { // CREATE MYSQL DATABASE TABLES. $admin = table_by_key('admin'); @@ -1063,3 +1078,7 @@ db_query_parsed("ALTER TABLE `$table_mailbox` CHANGE `local_part` `local_part` VARCHAR( 255 ) {LATIN1} NOT NULL"); } +function upgrade_655() { + db_query_parsed(_add_index('mailbox', 'domain', 'domain')); + db_query_parsed(_add_index('alias', 'domain', 'domain')); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-05-20 20:24:35
|
Revision: 661 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=661&view=rev Author: GingerDog Date: 2009-05-20 20:24:23 +0000 (Wed, 20 May 2009) Log Message: ----------- lets try and get rc5 up and around Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/config.inc.php trunk/functions.inc.php trunk/list-virtual.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2009-05-18 12:57:05 UTC (rev 660) +++ trunk/CHANGELOG.TXT 2009-05-20 20:24:23 UTC (rev 661) @@ -11,6 +11,14 @@ # $Id$ +Version 2.3rc5 - 2009/05/20 - SVN r658 +-------------------------------------- + + - Improvements to the setup process + - Far better Debian packaging (we hope!) which should make installation much, much easier. + - Various bug fixes + - Performance enhancements (or we fixed the regressions ...) in domain listing etc. + Version 2.3rc4 - 2009/04/18 - SVN r632 -------------------------------------- Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-05-18 12:57:05 UTC (rev 660) +++ trunk/config.inc.php 2009-05-20 20:24:23 UTC (rev 661) @@ -29,12 +29,12 @@ * Doing this implies you have changed this file as required. * i.e. configuring database etc; specifying setup.php password etc. */ -$CONF['configured'] = false; +$CONF['configured'] = true; // In order to setup Postfixadmin, you MUST specify a hashed password here. // To create the hash, visit setup.php in a browser and type a password into the field, // on submission it will be echoed out to you as a hashed value. -$CONF['setup_password'] = 'changeme'; +$CONF['setup_password'] = 'hello'; // Postfix Admin Path // Set the location of your Postfix Admin installation here. @@ -52,10 +52,10 @@ // mysql = MySQL 3.23 and 4.0, 4.1 or 5 // mysqli = MySQL 4.1+ // pgsql = PostgreSQL -$CONF['database_type'] = 'mysql'; -$CONF['database_host'] = 'localhost'; -$CONF['database_user'] = 'postfix'; -$CONF['database_password'] = 'postfixadmin'; +$CONF['database_type'] = 'pgsql'; +$CONF['database_host'] = 'mysqlserver'; +$CONF['database_user'] = 'dg'; +$CONF['database_password'] = 'gingerdog'; $CONF['database_name'] = 'postfix'; $CONF['database_prefix'] = ''; @@ -156,7 +156,7 @@ // Quota // When you want to enforce quota for your mailbox users set this to 'YES'. -$CONF['quota'] = 'NO'; +$CONF['quota'] = 'YES'; // You can either use '1024000' or '1048576' $CONF['quota_multiplier'] = '1024000'; @@ -197,7 +197,7 @@ // The reason for this is that when you want catch-all and normal mailboxes // to work you need to have the mailbox replicated in the alias table. // If you want to take control of these aliases as well set this to 'YES'. -$CONF['alias_control'] = 'NO'; +$CONF['alias_control'] = 'YES'; // Alias Control for admins // Set to 'NO' if your domain admins shouldn't be able to edit user aliases. @@ -362,7 +362,7 @@ // See: DOCUMENTATION/DOVECOT.txt // http://wiki.dovecot.org/Quota/Dict // -// $CONF['used_quotas'] = 'YES'; +$CONF['used_quotas'] = 'YES'; // // Normally, the TCP port number does not have to be specified. Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-05-18 12:57:05 UTC (rev 660) +++ trunk/functions.inc.php 2009-05-20 20:24:23 UTC (rev 661) @@ -22,7 +22,7 @@ exit; } -$version = '2.3 rc4'; +$version = '2.3 rc5'; /** * check_session Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-05-18 12:57:05 UTC (rev 660) +++ trunk/list-virtual.php 2009-05-20 20:24:23 UTC (rev 661) @@ -154,9 +154,16 @@ if ($CONF['vacation_control_admin'] == 'YES') { if (boolconf('used_quotas')) - $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username WHERE $table_mailbox.domain='$fDomain' AND $table_quota.path='quota/storage' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; + $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox + LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email + LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username + WHERE $table_mailbox.domain='$fDomain' + ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; +// AND $table_quota.path='quota/storage' else - $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"; + $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 { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-05-31 20:31:10
|
Revision: 669 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=669&view=rev Author: christian_boltz Date: 2009-05-31 20:31:04 +0000 (Sun, 31 May 2009) Log Message: ----------- INSTALL.txt, UPGRADE.txt: - bumped PHP requirements to >= 5.1.2 BACKUP_MX.txt: - removed version requirements (no need to have them in 3 files) - added note about using reject_unverified_recipient or relay_recipient_maps Modified Paths: -------------- trunk/DOCUMENTS/BACKUP_MX.txt trunk/DOCUMENTS/UPGRADE.txt trunk/INSTALL.TXT Modified: trunk/DOCUMENTS/BACKUP_MX.txt =================================================================== --- trunk/DOCUMENTS/BACKUP_MX.txt 2009-05-30 09:23:42 UTC (rev 668) +++ trunk/DOCUMENTS/BACKUP_MX.txt 2009-05-31 20:31:04 UTC (rev 669) @@ -5,21 +5,16 @@ # Licensed under GPL for more info check GPL-LICENSE.TXT # -REQUIRED!! ----------- -- You are using Postfix 2.0 or higher. -- You are using Apache 1.3.27 / Lighttpd 1.3.15 or higher. -- You are using PHP 4.1 or higher. -- You are using MySQL 3.23 or higher. +Please follow these steps if your mailserver is used as a backup MX for some +(or all) of your domains. +Note: The setup described in this file only checks the domain, not the full +mail address. +You should use "reject_unverified_recipient" in your postfix config or setup +"relay_recipient_maps" with a list of valid mail adresses on the primary mx +to avoid that your backup MX accepts mails for non-existing recipient adresses. +Without this, your backup MX might become a backscatter source. -READ THIS FIRST! ----------------- -When this is an upgrade from Postfix Admin 1.5.4 please read UPGRADE.TXT!! - -More information is available on http://high5.net/howto/ - - 1. Modify main.cf ----------------- In order for Postfix to use MySQL for relay_domains add the following Modified: trunk/DOCUMENTS/UPGRADE.txt =================================================================== --- trunk/DOCUMENTS/UPGRADE.txt 2009-05-30 09:23:42 UTC (rev 668) +++ trunk/DOCUMENTS/UPGRADE.txt 2009-05-31 20:31:04 UTC (rev 669) @@ -9,7 +9,7 @@ ---------- - You are using Postfix 2.0 or higher. - You are using Apache 1.3.27 / Lighttpd 1.3.15 or higher. -- You are using PHP 4.1 or higher. +- You are using PHP 5.1.2 or higher. - You are using MySQL 3.23 or higher OR PostgreSQL v7.4+ Modified: trunk/INSTALL.TXT =================================================================== --- trunk/INSTALL.TXT 2009-05-30 09:23:42 UTC (rev 668) +++ trunk/INSTALL.TXT 2009-05-31 20:31:04 UTC (rev 669) @@ -9,7 +9,7 @@ ---------- - You are using Postfix 2.0 or higher. - You are using Apache 1.3.27 / Lighttpd 1.3.15 or higher. -- You are using PHP 5.X +- You are using PHP 5.1.2 or higher. - You are using MySQL 3.23 or higher (5.x recommended) OR PostgreSQL 7.4 (or higher) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-07-19 13:14:46
|
Revision: 687 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=687&view=rev Author: GingerDog Date: 2009-07-19 12:25:47 +0000 (Sun, 19 Jul 2009) Log Message: ----------- try and be a bit more intelligent over which domain is selected by default in list-virtual & the menu Modified Paths: -------------- trunk/list-virtual.php trunk/templates/create-alias.php trunk/templates/create-mailbox.php trunk/templates/menu.php Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-07-13 13:27:44 UTC (rev 686) +++ trunk/list-virtual.php 2009-07-19 12:25:47 UTC (rev 687) @@ -33,6 +33,7 @@ authentication_require_role('admin'); +$fDomain = false; $SESSID_USERNAME = authentication_get_username(); if (authentication_has_role('global-admin')) { @@ -59,6 +60,12 @@ if (isset ($_POST['limit'])) $fDisplay = intval ($_POST['limit']); } +// store fDomain in $_SESSION so after adding/editing aliases/mailboxes we can +// take the user back to the appropriate domain listing. (see templates/menu.php) +if($fDomain) { + $_SESSION['list_virtual_sticky_domain'] = $fDomain; +} + if (count($list_domains) == 0) { # die("no domains"); header("Location: list-domain.php"); # no domains (for this admin at least) - redirect to domain list Modified: trunk/templates/create-alias.php =================================================================== --- trunk/templates/create-alias.php 2009-07-13 13:27:44 UTC (rev 686) +++ trunk/templates/create-alias.php 2009-07-19 12:25:47 UTC (rev 687) @@ -1,4 +1,5 @@ <?php if( !defined('POSTFIXADMIN') ) die( "This file cannot be used standalone." ); ?> +<!-- 'breadcrumb' --> <div id="edit_form"> <form name="alias" method="post"> <table> Modified: trunk/templates/create-mailbox.php =================================================================== --- trunk/templates/create-mailbox.php 2009-07-13 13:27:44 UTC (rev 686) +++ trunk/templates/create-mailbox.php 2009-07-19 12:25:47 UTC (rev 687) @@ -1,4 +1,9 @@ <?php if( !defined('POSTFIXADMIN') ) die( "This file cannot be used standalone." ); ?> +<?php +if(isset($_SESSION['list_virtual_sticky_domain'])) { + echo "<a href='list-virtual.php?domain=" . htmlentities($_SESSION['list_virtual_sticky_domain'], ENT_QUOTES) . "'>" . $PALANG['pAdminMenu_list_virtual'] . "</a>"; +} +?> <div id="edit_form"> <form name="mailbox" method="post"> <table> Modified: trunk/templates/menu.php =================================================================== --- trunk/templates/menu.php 2009-07-13 13:27:44 UTC (rev 686) +++ trunk/templates/menu.php 2009-07-19 12:25:47 UTC (rev 687) @@ -41,8 +41,13 @@ } print _menulink("list-domain.php", $PALANG['pAdminMenu_list_domain'], $submenu_domain); -print _menulink("list-virtual.php", $PALANG['pAdminMenu_list_virtual'], $submenu_virtual); +$link = 'list-virtual.php'; +if(isset($_SESSION['list_virtual_sticky_domain'])) { + $link = "list-virtual.php?domain=" . htmlentities($_SESSION['list_virtual_sticky_domain'], ENT_QUOTES); +} +print _menulink($link, $PALANG['pAdminMenu_list_virtual'], $submenu_virtual); + if ($CONF['fetchmail'] == 'YES') { print _menulink("fetchmail.php", $PALANG['pMenu_fetchmail'], $submenu_fetchmail); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-07-20 19:08:50
|
Revision: 689 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=689&view=rev Author: GingerDog Date: 2009-07-20 19:08:43 +0000 (Mon, 20 Jul 2009) Log Message: ----------- ready for 2.3rc6 Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/debian/changelog trunk/functions.inc.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2009-07-19 17:32:58 UTC (rev 688) +++ trunk/CHANGELOG.TXT 2009-07-20 19:08:43 UTC (rev 689) @@ -11,6 +11,13 @@ # $Id$ +Version 2.3rc6 - 2009/07/20 - SVN r689 +-------------------------------------- + + - Updates to vacation.pl + - PHP 5.3 compatibility + - Easier dependencies for .debs - should work on Lenny/Ubuntu etc without issue now. + Version 2.3rc5 - 2009/05/20 - SVN r658 -------------------------------------- Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-07-19 17:32:58 UTC (rev 688) +++ trunk/debian/changelog 2009-07-20 19:08:43 UTC (rev 689) @@ -1,3 +1,9 @@ +postfixadmin (2.3rc6) unstable; urgency=low + + * Bump version number; etc. + + -- David Goodwin <dav...@pa...> Mon, 20 Jul 2009 19:56:26 +0100 + postfixadmin (2.3rc5) unstable; urgency=low * Initial release (Closes: #247225) Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-07-19 17:32:58 UTC (rev 688) +++ trunk/functions.inc.php 2009-07-20 19:08:43 UTC (rev 689) @@ -16,7 +16,7 @@ * Contains re-usable code. */ -$version = '2.3 rc5'; +$version = '2.3 rc6'; /** * check_session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Gin...@us...> - 2009-07-27 21:13:13
|
Revision: 694 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=694&view=rev Author: GingerDog Date: 2009-07-27 21:13:02 +0000 (Mon, 27 Jul 2009) Log Message: ----------- bump up to 2.3rc7 Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/debian/changelog trunk/functions.inc.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2009-07-27 21:06:05 UTC (rev 693) +++ trunk/CHANGELOG.TXT 2009-07-27 21:13:02 UTC (rev 694) @@ -11,6 +11,12 @@ # $Id$ +Version 2.3rc7 - 2009/07/27 - SVN r691 +-------------------------------------- + + - Fix bug with confd-link.sh debian thing (breakage on Lenny with wwwconfig-common 0.1.2) + - Fix crypt() issue (see https://sourceforge.net/tracker/?func=detail&aid=2814820&group_id=191583&atid=937964 ) + Version 2.3rc6 - 2009/07/20 - SVN r689 -------------------------------------- Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-07-27 21:06:05 UTC (rev 693) +++ trunk/debian/changelog 2009-07-27 21:13:02 UTC (rev 694) @@ -1,3 +1,10 @@ +postfixadmin (2.3rc7) unstable; urgency=low + + * Fix issue with pre.rm script + * New 'upstream' release. + + -- David Goodwin <dav...@pa...> Mon, 27 Jul 2009 22:08:26 +0100 + postfixadmin (2.3rc6) unstable; urgency=low * Bump version number; etc. Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-07-27 21:06:05 UTC (rev 693) +++ trunk/functions.inc.php 2009-07-27 21:13:02 UTC (rev 694) @@ -16,7 +16,7 @@ * Contains re-usable code. */ -$version = '2.3 rc6'; +$version = '2.3 rc7'; /** * check_session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-10-18 22:43:22
|
Revision: 730 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=730&view=rev Author: christian_boltz Date: 2009-10-18 22:43:13 +0000 (Sun, 18 Oct 2009) Log Message: ----------- support for displaying quota (dovecot 1.1 and 1.2 format) upgrade.php - create quota and quota2 table (upgrade_729) - create the triggers required by dovecot (upgrade_730_pgsql) list-virtual.php - updated to work with both quota tables Patch by Varren Volz, https://sourceforge.net/tracker/?func=detail&aid=2867629&group_id=191583&atid=937966 - changed query for 1.1 quota table to WHERE [...] AND ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL ) This fixes https://sourceforge.net/tracker/?func=detail&aid=2794247&group_id=191583&atid=937964 (users not shown when initial email is not sent) config.inc.php, functions.php - new config option $CONF['new_quota_table'] (YES means dovecot 1.2 format) - set variables for new quota2 table DOCUMENTS/DOVECOT.txt - added note that quota table is automatically created - added note about different quota tables for dovecot 1.0/1.1 and >= 1.2 Modified Paths: -------------- trunk/DOCUMENTS/DOVECOT.txt trunk/config.inc.php trunk/functions.inc.php trunk/list-virtual.php trunk/upgrade.php Modified: trunk/DOCUMENTS/DOVECOT.txt =================================================================== --- trunk/DOCUMENTS/DOVECOT.txt 2009-10-18 13:29:35 UTC (rev 729) +++ trunk/DOCUMENTS/DOVECOT.txt 2009-10-18 22:43:13 UTC (rev 730) @@ -117,16 +117,15 @@ Create database in Mysql: +(This is automatically done by postfixadmin's setup.php) -create table quota ( - username varchar(255) /*!40100 CHARACTER SET latin1 */ not null, - path varchar(100) /*!40100 CHARACTER SET latin1 */ not null, - current integer, - primary key (username, path) -) TYPE=MyISAM ; - - Enable quota support in Postfixadmin config.inc.php: $CONF['used_quotas'] = 'YES'; $CONF['quota'] = 'YES'; + +Note: The above text describes the configuration for dovecot 1.0 & 1.1 quota table format. + +If you use dovecot 1.2 or newer, +- use the 'quota2' table (also created by setup.php) +- set $CONF['new_quota_table'] = 'YES' Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-10-18 13:29:35 UTC (rev 729) +++ trunk/config.inc.php 2009-10-18 22:43:13 UTC (rev 730) @@ -74,6 +74,7 @@ 'vacation' => 'vacation', 'vacation_notification' => 'vacation_notification', 'quota' => 'quota', + 'quota2' => 'quota2', ); // Site Admin @@ -362,8 +363,12 @@ // See: DOCUMENTATION/DOVECOT.txt // http://wiki.dovecot.org/Quota/Dict // -// $CONF['used_quotas'] = 'YES'; +$CONF['used_quotas'] = 'NO'; +// if you use dovecot >= 1.2, set this to yes. +// Note about dovecot config: table "quota" is for 1.0 & 1.1, table "quota2" is for dovecot 1.2 and newer +$CONF['new_quota_table'] = 'NO'; + // // Normally, the TCP port number does not have to be specified. // $CONF['create_mailbox_subdirs_hostport']=143; Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-10-18 13:29:35 UTC (rev 729) +++ trunk/functions.inc.php 2009-10-18 22:43:13 UTC (rev 730) @@ -2352,4 +2352,5 @@ $table_vacation = table_by_key ('vacation'); $table_vacation_notification = table_by_key('vacation_notification'); $table_quota = table_by_key ('quota'); +$table_quota2 = table_by_key ('quota2'); /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */ Modified: trunk/list-virtual.php =================================================================== --- trunk/list-virtual.php 2009-10-18 13:29:35 UTC (rev 729) +++ trunk/list-virtual.php 2009-10-18 22:43:13 UTC (rev 730) @@ -158,29 +158,60 @@ } } +# TODO: reduce number of different queries by not depending on too much config options +# (it probably won't hurt to include a field in the resultset that is not displayed later) if ($CONF['vacation_control_admin'] == 'YES') { if (boolconf('used_quotas')) - $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox - LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email - LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username - WHERE $table_mailbox.domain='$fDomain' - ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; -// AND $table_quota.path='quota/storage' - else + { + if (boolconf('new_quota_table')) + { + $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota2.bytes FROM $table_mailbox + LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email + LEFT JOIN $table_quota2 ON $table_mailbox.username=$table_quota2.username + WHERE $table_mailbox.domain='$fDomain' + ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; + } + else + { + $query = "SELECT $table_mailbox.*, $table_vacation.active AS v_active, $table_quota.current FROM $table_mailbox + LEFT JOIN $table_vacation ON $table_mailbox.username=$table_vacation.email + LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username + WHERE $table_mailbox.domain='$fDomain' AND + ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL ) + ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; + } + } + else # $CONF[used_quotas] = NO + { $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 +else # $CONF['vacation_control_admin'] == 'NO' { - - $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $fDisplay, $page_size"; - if ('pgsql'==$CONF['database_type']) + if (boolconf('used_quotas')) { - $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"; + if (boolconf('new_quota_table')) + { + $query = "SELECT $table_mailbox.*, $table_quota2.bytes as current FROM $table_mailbox + LEFT JOIN $table_quota2 ON $table_mailbox.username=$table_quota2.username + WHERE $table_mailbox.domain='$fDomain' ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; + } + else + { + $query = "SELECT $table_mailbox.*, $table_quota.current FROM $table_mailbox + LEFT JOIN $table_quota ON $table_mailbox.username=$table_quota.username + WHERE $table_mailbox.domain='$fDomain' AND + ( $table_quota.path='quota/storage' OR $table_quota.path IS NULL ) + ORDER BY $table_mailbox.username LIMIT $page_size OFFSET $fDisplay"; + } + } + else # $CONF[used_quotas] = NO + { + $query = "SELECT * FROM $table_mailbox WHERE domain='$fDomain' ORDER BY username LIMIT $page_size OFFSET $fDisplay"; } - } $result = db_query ($query); if ($result['rows'] > 0) Modified: trunk/upgrade.php =================================================================== --- trunk/upgrade.php 2009-10-18 13:29:35 UTC (rev 729) +++ trunk/upgrade.php 2009-10-18 22:43:13 UTC (rev 730) @@ -171,6 +171,7 @@ '{RENAME_COLUMN}' => 'CHANGE COLUMN', '{MYISAM}' => 'ENGINE=MyISAM', '{INNODB}' => 'ENGINE=InnoDB', + '{BIGINT}' => 'bigint', ); $sql = "$sql $attach_mysql"; @@ -187,6 +188,7 @@ '{RENAME_COLUMN}' => 'ALTER COLUMN', # PgSQL : ALTER TABLE x RENAME x TO y '{MYISAM}' => '', '{INNODB}' => '', + '{BIGINT}' => 'bigint', 'int(1)' => 'int', 'int(10)' => 'int', 'int(11)' => 'int', @@ -1086,3 +1088,94 @@ db_query_parsed(_add_index('mailbox', 'domain', 'domain')); db_query_parsed(_add_index('alias', 'domain', 'domain')); } + +function upgrade_729() { + $table_quota = table_by_key('quota'); + $table_quota2 = table_by_key('quota2'); + + # table for dovecot v1.0 & 1.1 + db_query_parsed(" + CREATE TABLE {IF_NOT_EXISTS} $table_quota ( + username VARCHAR(255) {LATIN1} NOT NULL, + path VARCHAR(100) {LATIN1} NOT NULL, + current {BIGINT}, + PRIMARY KEY (username, path) + ) {MYISAM} ; + "); + + # table for dovecot >= 1.2 + db_query_parsed(" + CREATE TABLE {IF_NOT_EXISTS} $table_quota2 ( + username VARCHAR(100) {LATIN1} NOT NULL, + bytes {BIGINT} NOT NULL DEFAULT 0, + messages integer NOT NULL DEFAULT 0, + PRIMARY KEY (username) + ) {MYISAM} ; + "); +} + +function upgrade_730_pgsql() { + $table_quota = table_by_key('quota'); + $table_quota2 = table_by_key('quota2'); + + # trigger for dovecot v1.0 & 1.1 quota table + # taken from http://wiki.dovecot.org/Quota/Dict + db_query_parsed(" + CREATE OR REPLACE FUNCTION merge_quota() RETURNS TRIGGER AS \$merge_quota\$ + BEGIN + UPDATE $table_quota SET current = NEW.current + current WHERE username = NEW.username AND path = NEW.path; + IF found THEN + RETURN NULL; + ELSE + RETURN NEW; + END IF; + END; + \$merge_quota\$ LANGUAGE plpgsql; + "); + db_query_parsed(" + CREATE TRIGGER mergequota BEFORE INSERT ON $table_quota FOR EACH ROW EXECUTE PROCEDURE merge_quota(); + "); + + # trigger for dovecot >= 1.2 quota table + # taken from http://wiki.dovecot.org/Quota/Dict, table/trigger name changed to quota2 naming + db_query_parsed(" + CREATE OR REPLACE FUNCTION merge_quota2() RETURNS TRIGGER AS \$\$ + BEGIN + IF NEW.messages < 0 OR NEW.messages IS NULL THEN + -- ugly kludge: we came here from this function, really do try to insert + IF NEW.messages IS NULL THEN + NEW.messages = 0; + ELSE + NEW.messages = -NEW.messages; + END IF; + return NEW; + END IF; + + LOOP + UPDATE $table_quota2 SET bytes = bytes + NEW.bytes, + messages = messages + NEW.messages + WHERE username = NEW.username; + IF found THEN + RETURN NULL; + END IF; + + BEGIN + IF NEW.messages = 0 THEN + INSERT INTO $table_quota2 (bytes, messages, username) VALUES (NEW.bytes, NULL, NEW.username); + ELSE + INSERT INTO $table_quota2 (bytes, messages, username) VALUES (NEW.bytes, -NEW.messages, NEW.username); + END IF; + return NULL; + EXCEPTION WHEN unique_violation THEN + -- someone just inserted the record, update it + END; + END LOOP; + END; + \$\$ LANGUAGE plpgsql; +"); + + db_query_parsed(" + CREATE TRIGGER mergequota2 BEFORE INSERT ON $table_quota2 + FOR EACH ROW EXECUTE PROCEDURE merge_quota2(); + "); +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-10-20 19:25:26
|
Revision: 733 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=733&view=rev Author: christian_boltz Date: 2009-10-20 19:25:20 +0000 (Tue, 20 Oct 2009) Log Message: ----------- setup.php: - define('POSTFIXADMIN') to avoid session_start() call in common.php This avoids breakage if php5-session is not installed. Fixes https://sourceforge.net/tracker/?func=detail&aid=2855430&group_id=191583&atid=937964 common.php - only define('POSTFIXADMIN') if it is not yet defined (avoids a warning) Modified Paths: -------------- trunk/common.php trunk/setup.php Modified: trunk/common.php =================================================================== --- trunk/common.php 2009-10-19 16:45:08 UTC (rev 732) +++ trunk/common.php 2009-10-20 19:25:20 UTC (rev 733) @@ -17,10 +17,10 @@ * environment and ensures other functions are loaded. */ -if(!defined('POSTFIXADMIN')) { +if(!defined('POSTFIXADMIN')) { # already defined if called from setup.php session_start(); + define('POSTFIXADMIN', 1); # checked in included files } -define('POSTFIXADMIN', 1); # checked in included files $incpath = dirname(__FILE__); (ini_get('magic_quotes_gpc') ? ini_set('magic_quotes_runtime', '0') : '1'); Modified: trunk/setup.php =================================================================== --- trunk/setup.php 2009-10-19 16:45:08 UTC (rev 732) +++ trunk/setup.php 2009-10-20 19:25:20 UTC (rev 733) @@ -23,6 +23,8 @@ * Form POST \ GET Variables: -none- */ +define('POSTFIXADMIN', 1); # by defining it here, common.php will not start a session. + require_once('common.php'); $CONF['show_header_text'] = 'NO'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-10-24 00:11:17
|
Revision: 736 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=736&view=rev Author: christian_boltz Date: 2009-10-24 00:11:09 +0000 (Sat, 24 Oct 2009) Log Message: ----------- config.inc.php: - add comment about courier_authlib SHA passwords backup.php - also backup quota and quota2 table Modified Paths: -------------- trunk/backup.php trunk/config.inc.php Modified: trunk/backup.php =================================================================== --- trunk/backup.php 2009-10-21 20:13:56 UTC (rev 735) +++ trunk/backup.php 2009-10-24 00:11:09 UTC (rev 736) @@ -82,6 +82,8 @@ 'fetchmail', 'log', 'mailbox', + 'quota', + 'quota2', 'vacation', 'vacation_notification' ); Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-10-21 20:13:56 UTC (rev 735) +++ trunk/config.inc.php 2009-10-24 00:11:09 UTC (rev 736) @@ -102,6 +102,7 @@ // In what flavor should courier-authlib style passwords be enrypted? // md5 = {md5} + base64 encoded md5 hash // md5raw = {md5raw} + plain encoded md5 hash +// SHA = {SHA} + base64-encoded sha1 hash // crypt = {crypt} + Standard UNIX DES-enrypted with 2-character salt $CONF['authlib_default_flavor'] = 'md5raw'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <chr...@us...> - 2009-10-25 14:39:46
|
Revision: 739 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=739&view=rev Author: christian_boltz Date: 2009-10-25 14:39:28 +0000 (Sun, 25 Oct 2009) Log Message: ----------- postfixadmin 2.3 final(ly) :-) - updating version number in various places Modified Paths: -------------- trunk/CHANGELOG.TXT trunk/debian/changelog trunk/functions.inc.php Modified: trunk/CHANGELOG.TXT =================================================================== --- trunk/CHANGELOG.TXT 2009-10-24 19:44:32 UTC (rev 738) +++ trunk/CHANGELOG.TXT 2009-10-25 14:39:28 UTC (rev 739) @@ -10,8 +10,8 @@ # Last update: # $Id$ -Version ***svn*** - 2009/10/24 - SVN r***** --------------------------------------- +Version 2.3 - 2009/10/24 - SVN r739 +----------------------------------- - automatically create quota tables for dovecot (both 1.0/1.1 and >= 1.2) - list-virtual can now handle both table formats Modified: trunk/debian/changelog =================================================================== --- trunk/debian/changelog 2009-10-24 19:44:32 UTC (rev 738) +++ trunk/debian/changelog 2009-10-25 14:39:28 UTC (rev 739) @@ -1,3 +1,9 @@ +postfixadmin (2.3) unstable; urgency=low + + * New 'upstream' release. + + -- David Goodwin <dav...@pa...> Mon, 27 Jul 2009 22:08:26 +0100 + postfixadmin (2.3rc7) unstable; urgency=low * Fix issue with pre.rm script Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-10-24 19:44:32 UTC (rev 738) +++ trunk/functions.inc.php 2009-10-25 14:39:28 UTC (rev 739) @@ -16,7 +16,7 @@ * Contains re-usable code. */ -$version = '2.3 rc7'; +$version = '2.3'; /** * check_session This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |