Applied patch #460021 in a modified form.

This commit is contained in:
skeeter 2001-09-17 02:06:12 +00:00
parent b2f9d0c668
commit 4805243c8c
7 changed files with 67 additions and 34 deletions

View File

@ -34,6 +34,8 @@
'config_passwd' => '{CONFIG_PASS}' 'config_passwd' => '{CONFIG_PASS}'
); );
$phpgw_info['server']['db_persistent'] = {DB_PERSISTENT};
/* /*
** If you want to have your domains in a select box, change to True ** If you want to have your domains in a select box, change to True
** If not, users will have to login as user@domain ** If not, users will have to login as user@domain
@ -84,7 +86,7 @@
$phpgw_info["server"]["versions"]["phpgwapi"] = $setup_info['phpgwapi']['version']; $phpgw_info["server"]["versions"]["phpgwapi"] = $setup_info['phpgwapi']['version'];
$phpgw_info['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header']; $phpgw_info['server']['versions']['current_header'] = $setup_info['phpgwapi']['versions']['current_header'];
unset($setup_info); unset($setup_info);
$phpgw_info['server']['versions']['header'] = '1.17'; $phpgw_info['server']['versions']['header'] = '1.18';
/* This is a fix for NT */ /* This is a fix for NT */
if (!isset($phpgw_info['flags']['noapi']) || !$phpgw_info['flags']['noapi'] == True) if (!isset($phpgw_info['flags']['noapi']) || !$phpgw_info['flags']['noapi'] == True)
{ {

View File

@ -34,7 +34,6 @@ class db
var $Errno = 0; var $Errno = 0;
var $Error = ''; var $Error = '';
var $use_pconnect = false;
var $Auto_Free = 0; ## set this to 1 to automatically free results var $Auto_Free = 0; ## set this to 1 to automatically free results
var $Debug = false; var $Debug = false;
@ -42,7 +41,7 @@ class db
{ {
if ( 0 == $this->Link_ID ) if ( 0 == $this->Link_ID )
{ {
if ($this->use_pconnect) if ($GLOBALS['phpgw_info']['server']['db_persistent'])
{ {
$this->Link_ID=mssql_pconnect($this->Host, $this->User, $this->Password); $this->Link_ID=mssql_pconnect($this->Host, $this->User, $this->Password);
} }
@ -52,7 +51,7 @@ class db
} }
if (!$this->Link_ID) if (!$this->Link_ID)
{ {
$this->halt("Link-ID == false, mssql_pconnect failed"); $this->halt('Link-ID == false, mssql_'.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'').'connect failed');
} }
else else
{ {

View File

@ -23,7 +23,6 @@
var $Password = ''; var $Password = '';
/* public: configuration parameters */ /* public: configuration parameters */
var $use_pconnect = True;
var $auto_stripslashes = False; var $auto_stripslashes = False;
var $Auto_Free = 0; ## Set to 1 for automatic mysql_free_result() var $Auto_Free = 0; ## Set to 1 for automatic mysql_free_result()
var $Debug = 0; ## Set to 1 for debugging messages. var $Debug = 0; ## Set to 1 for debugging messages.
@ -86,7 +85,7 @@
/* establish connection, select database */ /* establish connection, select database */
if ( 0 == $this->Link_ID ) if ( 0 == $this->Link_ID )
{ {
if ($this->use_pconnect) if ($GLOBALS['phpgw_info']['server']['db_persistent'])
{ {
$this->Link_ID=mysql_pconnect($Host, $User, $Password); $this->Link_ID=mysql_pconnect($Host, $User, $Password);
} }
@ -97,7 +96,7 @@
if (!$this->Link_ID) if (!$this->Link_ID)
{ {
$this->halt("connect($Host, $User, \$Password) failed."); $this->halt(($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'')."connect($Host, $User, \$Password) failed.");
return 0; return 0;
} }

View File

@ -73,26 +73,42 @@ class db {
if($this->Debug) { if($this->Debug) {
printf("<br>connect() $this->User/******@$this->Database.world<br>\n"); printf("<br>connect() $this->User/******@$this->Database.world<br>\n");
} }
$this->Link_ID=ora_plogon if($GLOBALS['phpgw_info']['server']['db_persistent'])
("$this->User/$this->Password@$this->Database",""); {
/************** (comment by SSilk) $this->Link_ID=ora_plogon("$this->User/$this->Password@$this->Database","");
this dosn't work on my system: /************** (comment by SSilk)
$this->Link_ID=ora_plogon this dosn't work on my system:
("$this->User@$this->Database.world","$this->Password"); $this->Link_ID=ora_plogon("$this->User@$this->Database.world","$this->Password");
***************/ ***************/
}
else
{
$this->Link_ID=ora_logon("$this->User/$this->Password@$this->Database","");
/************** (comment by SSilk)
this dosn't work on my system:
$this->Link_ID=ora_logon("$this->User@$this->Database.world","$this->Password");
***************/
}
} else { } else {
if($this->Debug) { if($this->Debug) {
printf("<br>connect() $this->User, $this->Password <br>\n"); printf("<br>connect() $this->User, $this->Password <br>\n");
} }
$this->Link_ID=ora_plogon("$this->User","$this->Password"); if($GLOBALS['phpgw_info']['server']['db_persistent'])
/* (comment by SSilk: don't know how this could work, but I leave this untouched!) */ {
$this->Link_ID=ora_plogon("$this->User","$this->Password");
/* (comment by SSilk: don't know how this could work, but I leave this untouched!) */
}
else
{
$this->Link_ID=ora_logon("$this->User","$this->Password");
}
} }
if($this->Debug) { if($this->Debug) {
printf("<br>connect() Link_ID: $this->Link_ID<br>\n"); printf("<br>connect() Link_ID: $this->Link_ID<br>\n");
} }
if (!$this->Link_ID) { if (!$this->Link_ID) {
$this->halt("connect() Link-ID == false " . $this->halt("connect() Link-ID == false " .
"($this->Link_ID), ora_plogon failed"); "($this->Link_ID), ora_".($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'')."logon failed");
} else { } else {
//echo "commit on<p>"; //echo "commit on<p>";
ora_commiton($this->Link_ID); ora_commiton($this->Link_ID);

View File

@ -22,7 +22,6 @@
var $User = ''; var $User = '';
var $Password = ''; var $Password = '';
var $use_pconnect = False;
var $auto_stripslashes = False; var $auto_stripslashes = False;
/* "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning) */ /* "yes" (halt with message), "no" (ignore errors quietly), "report" (ignore errror, but spit a warning) */
@ -64,7 +63,7 @@
. $this->ifadd($this->Port, 'port=') . $this->ifadd($this->Port, 'port=')
. $this->ifadd($this->User, 'user=') . $this->ifadd($this->User, 'user=')
. $this->ifadd("'".$this->Password."'", 'password='); . $this->ifadd("'".$this->Password."'", 'password=');
if ($this->use_pconnect) if ($GLOBALS['phpgw_info']['server']['db_persistent'])
{ {
$this->Link_ID=pg_pconnect($cstr); $this->Link_ID=pg_pconnect($cstr);
} }
@ -75,7 +74,7 @@
if (! $this->Link_ID) if (! $this->Link_ID)
{ {
$this->halt('Link-ID == false, pconnect failed'); $this->halt('Link-ID == false, '.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'').'connect failed');
} }
else else
{ {

View File

@ -30,17 +30,28 @@ class db {
var $Auto_Free = 0; ## Set this to 1 for automatic sybase_free_result() var $Auto_Free = 0; ## Set this to 1 for automatic sybase_free_result()
function connect() { function connect()
if ( 0 == $this->Link_ID ) { {
$this->Link_ID=sybase_pconnect($this->Host,$this->User,$this->Password); if ( 0 == $this->Link_ID )
if (!$this->Link_ID) { {
$this->halt("Link-ID == false, pconnect failed"); if ($GLOBALS['phpgw_info']['server']['db_persistent'])
} {
if(!sybase_select_db($this->Database, $this->Link_ID)) { $this->Link_ID=sybase_pconnect($this->Host,$this->User,$this->Password);
$this->halt("cannot use database ".$this->Database); }
} else
} {
} $this->Link_ID=sybase_connect($this->Host,$this->User,$this->Password);
}
}
if (!$this->Link_ID)
{
$this->halt('Link-ID == false, '.($GLOBALS['phpgw_info']['server']['db_persistent']?'p':'')..'connect failed");
}
if(!sybase_select_db($this->Database, $this->Link_ID))
{
$this->halt("cannot use database ".$this->Database);
}
}
function query($Query_String) { function query($Query_String) {
$this->connect(); $this->connect();

View File

@ -274,6 +274,7 @@
$phpgw_info['server']['db_type'] = 'mysql'; //mysql, pgsql (for postgresql), or oracle $phpgw_info['server']['db_type'] = 'mysql'; //mysql, pgsql (for postgresql), or oracle
/* These are a few of the advanced settings */ /* These are a few of the advanced settings */
$phpgw_info['server']['db_persistent'] = True;
$phpgw_info['server']['config_passwd'] = 'changeme'; $phpgw_info['server']['config_passwd'] = 'changeme';
$phpgw_info['server']['mcrypt_enabled'] = False; $phpgw_info['server']['mcrypt_enabled'] = False;
$phpgw_info['server']['mcrypt_version'] = '2.6.3'; $phpgw_info['server']['mcrypt_version'] = '2.6.3';
@ -335,6 +336,12 @@
</td><td>What Database do you want to use with PHPGroupWare? </td><td>What Database do you want to use with PHPGroupWare?
<tr><td><b>Configuration Password</b><br><input type=text name="setting[config_pass]" value="<?php echo $phpgw_info['server']['config_passwd'] ?>"></td><td>Password needed for configuration</td></tr> <tr><td><b>Configuration Password</b><br><input type=text name="setting[config_pass]" value="<?php echo $phpgw_info['server']['config_passwd'] ?>"></td><td>Password needed for configuration</td></tr>
<tr><td><b>Persistent connection</b><br>
<select type="checkbox" name="setting[db_persistent]">
<option value="True"<?php echo ($phpgw_info['server']['db_persistent']?' selected':''); ?>>True</option>
<option value="False"<?php echo (! $phpgw_info['server']['db_persistent']?' selected':''); ?>>False</option>
</select></td>
<td>Do you want persistent connections (higher performance, but eats memory)</td></tr>
<tr><td colspan=2><b>Enable MCrypt</b><br> <tr><td colspan=2><b>Enable MCrypt</b><br>
<select name="setting[enable_mcrypt]"> <select name="setting[enable_mcrypt]">
<?php if($phpgw_info["server"]["mcrypt_enabled"] == True) { ?> <?php if($phpgw_info["server"]["mcrypt_enabled"] == True) { ?>
@ -346,13 +353,13 @@
<?php } ?> <?php } ?>
</select> </select>
</td></tr> </td></tr>
<tr><td><b>MCrypt version</b><br><input type="text" name="setting[mcrypt_version]" value="<?php echo $phpgw_info['server']['versions']['mcrypt'] ?>"></td><td>Set this to "old" for versions < 2.4, otherwise the exact mcrypt version you use</td></tr> <tr><td><b>MCrypt version</b><br><input type="text" name="setting[mcrypt_version]" value="<?php echo $phpgw_info['server']['versions']['mcrypt'] ?>"></td><td>Set this to "old" for versions &lt; 2.4, otherwise the exact mcrypt version you use</td></tr>
<tr><td><b>MCrypt initilazation vector</b><br><input type="text" name="setting[mcrypt_iv]" value="<?php echo $phpgw_info['server']['mcrypt_iv'] ?>" size="30"></td><td>It should be around 30 bytes in length.<br>Note: The default has been randomly generated.</td></tr> <tr><td><b>MCrypt initilazation vector</b><br><input type="text" name="setting[mcrypt_iv]" value="<?php echo $phpgw_info['server']['mcrypt_iv'] ?>" size="30"></td><td>It should be around 30 bytes in length.<br>Note: The default has been randomly generated.</td></tr>
<tr><td><b>Domain select box on login</b><br> <tr><td><b>Domain select box on login</b><br>
<select name="setting[domain_selectbox]"> <select name="setting[domain_selectbox]">
<option value="True"<?php echo ($phpgw_info['server']['domain_selectbox']?' selected':''); ?>>True</option> <option value="True"<?php echo ($phpgw_info['server']['domain_selectbox']?' selected':''); ?>>True</option>
<option value="False"<?php echo (! $phpgw_info['server']['domain_selectbox']?' selected':''); ?>>False</option> <option value="False"<?php echo (! $phpgw_info['server']['domain_selectbox']?' selected':''); ?>>False</option>
</select></td><td></td> </select></td><td>&nbsp;</td>
</tr> </tr>
</table> </table>
<?php <?php