I've had one request for this, and figured there might be others
interested and who are fighting over this...the following patch is
supposed to be in the next snapshot of IMP (http://horde.org/imp)...
Marc G. Fournier
Systems Administrator @ hub.org
primary: [EMAIL PROTECTED] secondary: scrappy@{freebsd|postgresql}.org
---------- Forwarded message ----------
Date: Thu, 26 Nov 1998 00:59:48 -0400 (AST)
From: The Hermit Hacker <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Patch for pgsql.lib.php3 against 11-24 snapshot...
I'm not sure how patches are handled, but the following patches are
required to get IMP working with PostgreSQL v6.4, which is the current
stable release of PostgreSQL. The patch adds the 'lang' field and an
appropriate 'imp_set_lang{}' function, plus changes the 'user' field to be
'username', as user is a reserved word...
Marc G. Fournier
Systems Administrator @ hub.org
primary: [EMAIL PROTECTED] secondary: scrappy@{freebsd|postgresql}.org
*** pgsql.lib.php3.orig Wed Nov 25 23:28:50 1998
--- pgsql.lib.php3 Wed Nov 25 23:45:05 1998
***************
*** 34,48 ****
Preferences Table:
field: type: description:
! user text [EMAIL PROTECTED] format username
sig text signature
replyto text [EMAIL PROTECTED] for replyto/from lines
fullname text Joe Doe
(possibly more to be added later)
Address Table:
field: type: description:
! user text [EMAIL PROTECTED] identifier of who this entry belongs to
address text [EMAIL PROTECTED] - the actual address
nickname text any entered nickname - ie "bonnie".
fullname text full name - "My Bonnie".
--- 34,49 ----
Preferences Table:
field: type: description:
! username text [EMAIL PROTECTED] format username
sig text signature
replyto text [EMAIL PROTECTED] for replyto/from lines
fullname text Joe Doe
+ lang varchar(30) users's preferred language (en, es, ...)
(possibly more to be added later)
Address Table:
field: type: description:
! username text [EMAIL PROTECTED] identifier of who this entry belongs to
address text [EMAIL PROTECTED] - the actual address
nickname text any entered nickname - ie "bonnie".
fullname text full name - "My Bonnie".
***************
*** 57,63 ****
global $imp_db, $db_server, $db_user, $pref_table, $db_port, $db_options,
$db_tty;
! $sql="select user from $pref_table where user='$user@$server'";
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty,$imp_db))) {
if (($result = pg_Exec($db,$sql))) {
return true;
--- 58,64 ----
global $imp_db, $db_server, $db_user, $pref_table, $db_port, $db_options,
$db_tty;
! $sql="select username from $pref_table where username='$user@$server'";
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty,$imp_db))) {
if (($result = pg_Exec($db,$sql))) {
return true;
***************
*** 76,82 ****
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty,$imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select lang from $pref_table where
user='$user@$server'"))) { return false; }
return(pg_result($result, 0, "lang"));
}
--- 77,83 ----
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty,$imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select lang from $pref_table where
username='$user@$server'"))) { return false; }
return(pg_result($result, 0, "lang"));
}
***************
*** 89,95 ****
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select replyto from $pref_table where
user='$user@$server'"))) { return false; }
return(pg_result($result, 0, "replyto"));
}
--- 90,96 ----
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select replyto from $pref_table where
username='$user@$server'"))) { return false; }
return(pg_result($result, 0, "replyto"));
}
***************
*** 102,108 ****
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select fullname from $pref_table where
user='$user@$server'"))) { return false; }
return(pg_result($result, 0, "fullname"));
}
--- 103,109 ----
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select fullname from $pref_table where
username='$user@$server'"))) { return false; }
return(pg_result($result, 0, "fullname"));
}
***************
*** 115,121 ****
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select sig from $pref_table where
user='$user@$server'"))) { return false; }
return(pg_result($result, 0, "sig"));
}
--- 116,122 ----
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_exec($db, "select sig from $pref_table where
username='$user@$server'"))) { return false; }
return(pg_result($result, 0, "sig"));
}
***************
*** 129,135 ****
*/
if (imp_check_prefs($user,$server)) {
! $sql = "update $pref_table set sig='$signature' where user='$user@$server'";
} else {
$sql = "insert into $pref_table values ('$user@$server', '$signature')";
}
--- 130,136 ----
*/
if (imp_check_prefs($user,$server)) {
! $sql = "update $pref_table set sig='$signature' where
username='$user@$server'";
} else {
$sql = "insert into $pref_table values ('$user@$server', '$signature')";
}
***************
*** 147,155 ****
returns true on success and false on failure
*/
if (imp_check_prefs($user,$server)) {
! $sql = "update $pref_table set replyto='$from' where user='$user@$server'";
} else {
! $sql = "insert into $pref_table (user,replyto) values ('$user@$server',
'$signature')";
}
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
--- 148,156 ----
returns true on success and false on failure
*/
if (imp_check_prefs($user,$server)) {
! $sql = "update $pref_table set replyto='$from' where
username='$user@$server'";
} else {
! $sql = "insert into $pref_table (username,replyto) values ('$user@$server',
'$signature')";
}
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
***************
*** 158,163 ****
--- 159,182 ----
return true;
}
+ function imp_set_lang ($lang, $user, $server) {
+ global $imp_db, $db_server, $db_user, $pref_table, $db_port, $db_options,
+$db_tty;
+
+ /* post: sets the language to $lang for the database key $user@$server
+ returns true on success and false on failure
+ */
+
+ if (imp_check_prefs($user, $server)) {
+ $sql = "update $pref_table set lang='$lang' where username='$user@$server'";
+ } else {
+ $sql = "insert into $pref_table (username, lang) values ('$user@$server',
+'$lang')";
+ }
+
+ if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty,$imp_db))) {
+return false; }
+ if (!($result = pg_Exec($db,$sql))) { return false; }
+ return true;
+ }
+
function imp_set_fullname ($fullname, $user, $server) {
global $imp_db, $db_server, $db_user, $pref_table, $db_port, $db_options,
$db_tty;
***************
*** 165,173 ****
returns true on success and false on failure
*/
if (imp_check_prefs($user,$server)) {
! $sql = "update $pref_table set fullname='$fullname' where
user='$user@$server'";
} else {
! $sql = "insert into $pref_table (user,fullname) values ('$user@$server',
'$fullname')";
}
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
--- 184,192 ----
returns true on success and false on failure
*/
if (imp_check_prefs($user,$server)) {
! $sql = "update $pref_table set fullname='$fullname' where
username='$user@$server'";
} else {
! $sql = "insert into $pref_table (username,fullname) values ('$user@$server',
'$fullname')";
}
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
***************
*** 186,192 ****
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_Exec($db, "select address, nickname, fullname from
$address_table where user='$user@$server' order by nickname"))) { return false; }
if (($rowcount = pg_NumRows($result))==0) { return false; }
for ($i=0; $i<$rowcount; $i++) {
--- 205,211 ----
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_Exec($db, "select address, nickname, fullname from
$address_table where username='$user@$server' order by nickname"))) { return false; }
if (($rowcount = pg_NumRows($result))==0) { return false; }
for ($i=0; $i<$rowcount; $i++) {
***************
*** 204,210 ****
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_Exec($db, "delete from $address_table where
user='$user@$server' and address='$address'"))) { return false; }
return true;
}
--- 223,229 ----
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_Exec($db, "delete from $address_table where
username='$user@$server' and address='$address'"))) { return false; }
return true;
}
***************
*** 230,236 ****
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_Exec($db, "update $address_table set address='$address',
nickname='$nickname', fullname='$fullname' where user='$user@$server' and
address='$old_address'"))) { return false; }
return true;
}
--- 249,255 ----
*/
if (!($db = pg_pconnect($db_server,$db_port,$db_options,$db_tty, $imp_db))) {
return false; }
! if (!($result = pg_Exec($db, "update $address_table set address='$address',
nickname='$nickname', fullname='$fullname' where username='$user@$server' and
address='$old_address'"))) { return false; }
return true;
}