[dev] [forwards] patch.
Marc Jauvin
marc at register4less.com
Tue Oct 21 06:48:19 PDT 2003
This patch does the following:
- adds a $conf['default_realm'] config
- fix a bug where $keeplocal was tested against 'ON' instead of 'on' in
'lib/Driver/sql.php'
- adds "caching" to the sql query to avoid fetching info that was already
fetched
please, commit.
--
Marc Jauvin
http://register4less.com
450-441-5458
-------------- next part --------------
? lib/Driver/soap.php
Index: main.php
===================================================================
RCS file: /repository/forwards/main.php,v
retrieving revision 1.24
diff -u -r1.24 main.php
--- main.php 16 Sep 2003 23:04:15 -0000 1.24
+++ main.php 21 Oct 2003 13:13:15 -0000
@@ -19,7 +19,7 @@
$split = explode('@', Auth::getAuth());
$user = @$split[0]; $realm = @$split[1];
if (empty($realm)) {
- $realm = 'default';
+ $realm = $conf['default_realm'];
}
$submit = Util::getFormData('submit', false);
Index: config/conf.php.dist
===================================================================
RCS file: /repository/forwards/config/conf.php.dist,v
retrieving revision 1.10
diff -u -r1.10 conf.php.dist
--- config/conf.php.dist 11 Jul 2003 12:28:20 -0000 1.10
+++ config/conf.php.dist 21 Oct 2003 13:13:15 -0000
@@ -12,6 +12,12 @@
* $Horde: forwards/config/conf.php.dist,v 1.10 2003/07/11 12:28:20 opal Exp $
*/
+// The default realm to use if not provided (or if it can't be extracted from
+// the username
+
+$conf['default_realm'] = 'localhost';
+
+
// The driver to use. Valid values are:
//
// forwards: An ftp driven driver for dot-forward compliant mailers.
Index: lib/Driver/sql.php
===================================================================
RCS file: /repository/forwards/lib/Driver/sql.php,v
retrieving revision 1.10
diff -u -r1.10 sql.php
--- lib/Driver/sql.php 25 Aug 2003 18:28:42 -0000 1.10
+++ lib/Driver/sql.php 21 Oct 2003 13:13:16 -0000
@@ -26,7 +26,9 @@
/** boolean which contains state of sql connection */
var $_connected = false;
- var $params;
+ var $_params;
+
+ var $_row;
/**
* Constructs a new sql Forwards_Driver object.
@@ -114,7 +116,7 @@
$query .= ' AND ' . $this->_params['pass_col'] . ' = ' . $this->_db->quote(md5($password));
$query1 = 'UPDATE ' . $this->_params['table'];
- if ($keeplocal === 'ON') {
+ if ($keeplocal === 'on') {
if(!strstr($target,$local_target)) {
$query1 .= ' SET ' . $this->_params['altemail'] . ' = ' .
$this->_db->quote($target . ',' . $local_target);
@@ -271,6 +273,11 @@
*/
function _getUserDetails($user, $realm, $password)
{
+ # if we got the value already, don't fetch it again
+ if ($this->_row) {
+ return $this->_row;
+ }
+
/* _connect() will die with Horde::fatal() upon failure. */
$this->_connect();
@@ -287,6 +294,7 @@
if (is_array($row)) {
$this->_disconnect();
+ $this->_row = $row;
return $row;
} else {
$this->_disconnect();
Index: templates/main/main.inc
===================================================================
RCS file: /repository/forwards/templates/main/main.inc,v
retrieving revision 1.8
diff -u -r1.8 main.inc
--- templates/main/main.inc 16 Sep 2003 23:04:17 -0000 1.8
+++ templates/main/main.inc 21 Oct 2003 13:13:17 -0000
@@ -33,7 +33,7 @@
<input type="text" name="where" value="<?php echo $current_target ?>" size="63" maxlength="150">
<blockquote>
- <input type="checkbox" name="metoo">
+ <input type="checkbox" name="metoo" <?php if ($current_keeplocal) echo "checked"; ?>">
<?php echo _("Keep a copy in your local mailbox?") ?>
</blockquote>
More information about the dev
mailing list