phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi/inc class.schema_proc_mssql.inc.php, 1.2.2.7


From: Caeies
Subject: [Phpgroupware-cvs] phpgwapi/inc class.schema_proc_mssql.inc.php, 1.2.2.7 class.setup.inc.php, 1.15.2.19 functions.inc.php, 1.121.2.13.2.32 class.schema_proc.inc.php, 1.2.2.14 class.preferences.inc.php, 1.43.2.2.2.21 class.db_mssql.inc.php, 1.20.2.1.2.9 class.historylog.inc.php, 1.6.2.3.2.7 class.log.inc.php, 1.6.4.9 class.contacts_ldap.inc.php, 1.11.2.5.2.12
Date: Wed, 5 Oct 2005 14:37:00 +0200

Update of phpgwapi/inc

Modified Files:
     Branch: Version-0_9_16-branch
            class.schema_proc_mssql.inc.php lines: +7 -2
            class.setup.inc.php lines: +4 -39
            functions.inc.php lines: +2 -2
            class.schema_proc.inc.php lines: +5 -1
            class.preferences.inc.php lines: +4 -4
            class.db_mssql.inc.php lines: +14 -6
            class.historylog.inc.php lines: +2 -2
            class.log.inc.php lines: +3 -3
            class.contacts_ldap.inc.php lines: +8 -8

Log Message:
Applying patch #4039 (mssql support)

====================================================
Index: phpgwapi/inc/class.schema_proc_mssql.inc.php
diff -u phpgwapi/inc/class.schema_proc_mssql.inc.php:1.2.2.6 
phpgwapi/inc/class.schema_proc_mssql.inc.php:1.2.2.7
--- phpgwapi/inc/class.schema_proc_mssql.inc.php:1.2.2.6        Sat Nov  6 
15:34:26 2004
+++ phpgwapi/inc/class.schema_proc_mssql.inc.php        Wed Oct  5 12:37:20 2005
@@ -326,7 +326,7 @@
                function GetSequenceSQL($sTableName, &$sSequenceSQL)
                {
                        $sSequenceSQL = '';
-                       return true;
+                       return false;
                }

                function CreateTable($oProc, &$aTables, $sTableName, $aTableDef)
@@ -343,6 +343,11 @@
                                return !!($oProc->m_odb->query($query));
                        }

+                       return false;
+               }
+
+               function GetFKSQL($sFields)
+               {
                        return false;
                }
        }

====================================================
Index: phpgwapi/inc/class.setup.inc.php
diff -u phpgwapi/inc/class.setup.inc.php:1.15.2.18 
phpgwapi/inc/class.setup.inc.php:1.15.2.19
--- phpgwapi/inc/class.setup.inc.php:1.15.2.18  Sat Nov  6 15:34:26 2004
+++ phpgwapi/inc/class.setup.inc.php    Wed Oct  5 12:37:20 2005
@@ -320,27 +320,9 @@
                        }
                        $enable = intval($enable);

-                       /*
-                       Use old applications table if the currentver is less 
than 0.9.10pre8,
-                       but not if the currentver = '', which probably means 
new install.
-                       */
-                       
if($this->alessthanb($setup_info['phpgwapi']['currentver'],'0.9.10pre8') && 
($setup_info['phpgwapi']['currentver'] != ''))
-                       {
-                               $appstbl = 'applications';
-                       }
-                       else
-                       {
-                               $appstbl = 'phpgw_applications';
-                               
if($this->amorethanb($setup_info['phpgwapi']['currentver'],'0.9.13.014'))
-                               {
-                                       $use_appid = True;
-                               }
-                       }
-
                        if($GLOBALS['DEBUG'])
                        {
-                               echo '<br />register_app(): ' . $appname . ', 
version: ' . $setup_info[$appname]['version'] . ', table: ' . $appstbl . '<br 
/>';
-                               // _debug_array($setup_info[$appname]);
+                               echo '<br>register_app(): ' . $appname . ', 
version: ' . $setup_info[$appname]['version'] . ', table: 
phpgw_applications<br>';
                        }

                        if($setup_info[$appname]['version'])
@@ -360,26 +342,9 @@
                                                
.$appname."_tables_prefix','".$setup_info[$appname]['tables_prefix']."')";
                                        
$this->db->query($sql,__LINE__,__FILE__);
                                }
-                               if($use_appid)
-                               {
-                                       $this->db->query("SELECT MAX(app_id) 
FROM $appstbl",__LINE__,__FILE__);
-                                       $this->db->next_record();
-                                       if($this->db->f(0))
-                                       {
-                                               $app_id = ($this->db->f(0) + 1) 
. ',';
-                                               $app_idstr = 'app_id,';
-                                       }
-                                       else
-                                       {
-                                               srand(100000);
-                                               $app_id = rand(1,100000) . ',';
-                                               $app_idstr = 'app_id,';
-                                       }
-                               }
-                               $this->db->query("INSERT INTO $appstbl "
-                                       . "($app_idstr 
app_name,app_enabled,app_order,app_tables,app_version) "
+                               $this->db->query("INSERT INTO 
phpgw_applications "
+                                       . 
"(app_name,app_enabled,app_order,app_tables,app_version) "
                                        . "VALUES ("
-                                       . $app_id
                                        . "'" . $setup_info[$appname]['name'] . 
"',"
                                        . $enable . ","
                                        . 
intval($setup_info[$appname]['app_order']) . ","

====================================================
Index: phpgwapi/inc/functions.inc.php
diff -u phpgwapi/inc/functions.inc.php:1.121.2.13.2.31 
phpgwapi/inc/functions.inc.php:1.121.2.13.2.32
--- phpgwapi/inc/functions.inc.php:1.121.2.13.2.31      Fri Sep 30 09:38:11 2005
+++ phpgwapi/inc/functions.inc.php      Wed Oct  5 12:37:20 2005
@@ -207,7 +207,7 @@
                                
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
                        }
                        $cache_query = 'INSERT INTO 
phpgw_app_sessions(sessionid,loginid,app,location,content) VALUES('
-                               . 
"'0','0','phpgwapi','config','".addslashes(serialize($GLOBALS['phpgw_info']['server']))."')";
+                               . "'0','0','phpgwapi','config','". 
$GLOBALS['phpgw']->db->db_addslashes(serialize($GLOBALS['phpgw_info']['server']))."')";
                        
$GLOBALS['phpgw']->db->query($cache_query,__LINE__,__FILE__);
                }
        }

====================================================
Index: phpgwapi/inc/class.schema_proc.inc.php
diff -u phpgwapi/inc/class.schema_proc.inc.php:1.2.2.13 
phpgwapi/inc/class.schema_proc.inc.php:1.2.2.14
--- phpgwapi/inc/class.schema_proc.inc.php:1.2.2.13     Sat Nov  6 15:34:26 2004
+++ phpgwapi/inc/class.schema_proc.inc.php      Wed Oct  5 12:37:20 2005
@@ -425,6 +425,10 @@
                                {
                                        $sFieldSQL .= ' NOT NULL';
                                }
+                               else
+                               {
+                                       $sFieldSQL .= ' NULL';
+                               }

                                if($sDefault == '0')
                                {

====================================================
Index: phpgwapi/inc/class.preferences.inc.php
diff -u phpgwapi/inc/class.preferences.inc.php:1.43.2.2.2.20 
phpgwapi/inc/class.preferences.inc.php:1.43.2.2.2.21
--- phpgwapi/inc/class.preferences.inc.php:1.43.2.2.2.20        Sat Nov  6 
15:34:26 2004
+++ phpgwapi/inc/class.preferences.inc.php      Wed Oct  5 12:37:20 2005
@@ -464,7 +464,7 @@
                {
                        if (!is_array($arr))
                        {
-                               $arr = addslashes($arr);
+                               $arr = $this->db->db_addslashes($arr);
                                return;
                        }
                        foreach($arr as $key => $value)
@@ -475,7 +475,7 @@
                                }
                                else
                                {
-                                       $arr[$key] = addslashes($value);
+                                       $arr[$key] = 
$this->db->db_addslashes($value);
                                }
                        }
                }
@@ -517,7 +517,7 @@
                                {
                                        if (!is_array($value)) continue;
                                        $this->quote($value);
-                                       $value = addslashes(serialize($value)); 
// this addslashes is for the database
+                                       $value = 
$this->db->db_addslashes(serialize($value));   // this addslashes is for the 
database
                                        $app = $this->db->db_addslashes($app);

                                        $this->db->query($sql = "INSERT INTO 
phpgw_preferences".

====================================================
Index: phpgwapi/inc/class.db_mssql.inc.php
diff -u phpgwapi/inc/class.db_mssql.inc.php:1.20.2.1.2.8 
phpgwapi/inc/class.db_mssql.inc.php:1.20.2.1.2.9
--- phpgwapi/inc/class.db_mssql.inc.php:1.20.2.1.2.8    Sat Nov  6 15:34:26 2004
+++ phpgwapi/inc/class.db_mssql.inc.php Wed Oct  5 12:37:20 2005
@@ -65,6 +65,11 @@
                        }
                }

+               function disconnect()
+               {
+                       mssql_close($this->Link_ID);
+               }
+
                function db_addslashes($str)
                {
                        if (!IsSet($str) || $str == '')
@@ -121,6 +126,10 @@
                                $num_rows = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
                        }

+                       $Query_String = str_replace('SELECT ', 'SELECT TOP ', 
$Query_String);
+                       $Query_String = str_replace('SELECT TOP DISTINCT', 
'SELECT DISTINCT TOP ', $Query_String);
+                       $Query_String = str_replace('TOP ', 'TOP ' . ($offset + 
$num_rows) . ' ', $Query_String);
+
                        if ($this->Debug)
                        {
                                printf("Debug: limit_query = %s<br />offset=%d, 
num_rows=%d<br />\n", $Query_String, $offset, $num_rows);
@@ -253,7 +262,7 @@
                {
                        if($this->Query_ID)
                        {
-                               return mssql_num_rows($this->Query_ID);
+                               return $this->affected_rows();
                        }
                        else
                        {
@@ -270,11 +279,11 @@
                {
                if ($strip_slashes || ($this->auto_stripslashes && ! 
$strip_slashes))
                        {
-                               return str_replace("''", "'", 
$this->Record[$Name]);
+                               return str_replace("''", "'", 
$this->Record[$Field_Name]);
                        }
                        else
                        {
-                               return $this->Record[$Name];
+                               return $this->Record[$Field_Name];
                        }
                }

@@ -306,7 +315,7 @@

                function halt($msg, $line = '', $file = '')
                {
-                       $this->unlock();
+                       $this->transaction_abort();

                        $this->Errno = 1;
                        $this->Error = mssql_get_last_message();
@@ -335,7 +344,6 @@
                        if ($this->Halt_On_Error != "report")
                        {
                                echo "<p><b>Session halted.</b>";
-                               $this->transaction_abort();
                                $GLOBALS['phpgw']->common->phpgw_exit(True);
                        }
                }

====================================================
Index: phpgwapi/inc/class.historylog.inc.php
diff -u phpgwapi/inc/class.historylog.inc.php:1.6.2.3.2.6 
phpgwapi/inc/class.historylog.inc.php:1.6.2.3.2.7
--- phpgwapi/inc/class.historylog.inc.php:1.6.2.3.2.6   Thu Aug 19 06:48:57 2004
+++ phpgwapi/inc/class.historylog.inc.php       Wed Oct  5 12:37:20 2005
@@ -53,7 +53,7 @@
                                        . 
"history_appname,history_owner,history_status,history_new_value,history_old_value,history_timestamp)
 "
                                        . "values ('".intval($record_id)."','" 
. $this->appname . "','"
                                        . 
$GLOBALS['phpgw_info']['user']['account_id'] . "','$status','"
-                                       . addslashes($new_value) . "','" . 
addslashes($old_value) . "','" . $this->db->to_timestamp(time())
+                                       . $this->db->db_addslashes($new_value) 
. "','" . $this->db->db_addslashes($old_value) . "','" . 
$this->db->to_timestamp(time())
                                        . "')",__LINE__,__FILE__);
                        }
                }

====================================================
Index: phpgwapi/inc/class.log.inc.php
diff -u phpgwapi/inc/class.log.inc.php:1.6.4.8 
phpgwapi/inc/class.log.inc.php:1.6.4.9
--- phpgwapi/inc/class.log.inc.php:1.6.4.8      Thu Jul 15 04:21:25 2004
+++ phpgwapi/inc/class.log.inc.php      Wed Oct  5 12:37:20 2005
@@ -78,13 +78,13 @@
                        }

                        if (    ( 
isset($GLOBALS['phpgw_info']['flags']['currentapp']) )
-                            && ( array_key_exists( 
$GLOBALS['phpgw_info']['flags']['currentapp'] , 
$GLOBALS['phpgw_info']['server']['log_levels']['module']) )
+                            && ( @array_key_exists( 
$GLOBALS['phpgw_info']['flags']['currentapp'] , 
$GLOBALS['phpgw_info']['server']['log_levels']['module']) )
                             && ( 
$this->log_level_table[$GLOBALS['phpgw_info']['server']['log_levels']['module'][$GLOBALS['phpgw_info']['flags']['currentapp']]]
 >= $this->log_level_table[$level] ) ) {
                                        return true;
                        }

                        if (    ( 
isset($GLOBALS['phpgw_info']['user']['account_lid']) )
-                                && ( 
array_key_exists($GLOBALS['phpgw_info']['user']['account_lid'], 
$GLOBALS['phpgw_info']['server']['log_levels']['user']) )
+                                && ( 
@array_key_exists($GLOBALS['phpgw_info']['user']['account_lid'], 
$GLOBALS['phpgw_info']['server']['log_levels']['user']) )
                             && ( 
$this->log_level_table[$GLOBALS['phpgw_info']['server']['log_levels']['user'][$GLOBALS['phpgw_info']['user']['account_lid']]]
 >= $this->log_level_table[$level] ) ) {
                                return true;
                        }

====================================================
Index: phpgwapi/inc/class.contacts_ldap.inc.php
diff -u phpgwapi/inc/class.contacts_ldap.inc.php:1.11.2.5.2.11 
phpgwapi/inc/class.contacts_ldap.inc.php:1.11.2.5.2.12
--- phpgwapi/inc/class.contacts_ldap.inc.php:1.11.2.5.2.11      Sat Nov  6 
15:34:26 2004
+++ phpgwapi/inc/class.contacts_ldap.inc.php    Wed Oct  5 12:37:20 2005
@@ -649,7 +649,7 @@
                                while (list($name,$value) = each($extra_fields))
                                {
                                        $this->db->query("INSERT INTO 
$this->ext_table VALUES ('".$this->nextid."','" . $this->account_id . "','"
-                                               . addslashes($name) . "','" . 
addslashes($value) . "')",__LINE__,__FILE__);
+                                               . 
$this->db->db_addslashes($name) . "','" . $this->db->db_addslashes($value) . 
"')",__LINE__,__FILE__);
                                }
                        }
                        return $this->nextid;
@@ -658,21 +658,21 @@
                function field_exists($id,$field_name)
                {
                        $this->db->query("select count(*) from $this->ext_table 
where contact_id='$id' and contact_name='"
-                       . addslashes($field_name) . "'",__LINE__,__FILE__);
+                       . $this->db->db_addslashes($field_name) . 
"'",__LINE__,__FILE__);
                        $this->db->next_record();
                        return $this->db->f(0);
                }

                function 
add_single_extra_field($id,$owner,$field_name,$field_value)
                {
-                       $this->db->query("insert into $this->ext_table values 
($id,'$owner','" . addslashes($field_name)
-                       . "','" . addslashes($field_value) . 
"')",__LINE__,__FILE__);
+                       $this->db->query("insert into $this->ext_table values 
($id,'$owner','" . $this->db->db_addslashes($field_name)
+                       . "','" . $this->db->db_addslashes($field_value) . 
"')",__LINE__,__FILE__);
                }

                function delete_single_extra_field($id,$field_name)
                {
                        $this->db->query("delete from $this->ext_table where 
contact_id='$id' and contact_name='"
-                       . addslashes($field_name) . "'",__LINE__,__FILE__);
+                       . $this->db->db_addslashes($field_name) . 
"'",__LINE__,__FILE__);
                }

                function 
update($id,$owner,$fields,$access='private',$cat_id='0',$tid='n')
@@ -824,8 +824,8 @@
                                                }
                                                else
                                                {
-                                                       
$this->db->query("UPDATE $this->ext_table SET contact_value='" . 
addslashes($x_value)
-                                                       . 
"',contact_owner='$owner' WHERE contact_name='" . addslashes($x_name)
+                                                       
$this->db->query("UPDATE $this->ext_table SET contact_value='" . 
$this->db->db_addslashes($x_value)
+                                                       . 
"',contact_owner='$owner' WHERE contact_name='" . 
$this->db->db_addslashes($x_name)
                                                        . "' AND 
contact_id='$id'",__LINE__,__FILE__);
                                                }
                                        }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]