@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | echo "<p>solink.link('$app1',$id1,'$app2',$id2,'$remark',$owner)</p>\n"; |
67 | 67 | } |
68 | 68 | if ($app1 == $app2 && $id1 == $id2 || |
69 | - $id1 == '' || $id2 == '' || $app1 == '' || $app2 == '') |
|
69 | + $id1 == '' || $id2 == '' || $app1 == '' || $app2 == '') |
|
70 | 70 | { |
71 | 71 | return False; // dont link to self or other nosense |
72 | 72 | } |
@@ -412,26 +412,26 @@ discard block |
||
412 | 412 | array('table'=>self::TABLE, |
413 | 413 | 'cols'=>'c.*,b.link_app1 AS app3,b.link_id1 AS id3,b.link_id AS link3', |
414 | 414 | 'where'=>'a.link_app1='.self::$db->quote($app).' AND c.link_app2='.self::$db->quote($target_app). |
415 | - (!$target_id ? '' : self::$db->expression(self::TABLE,' AND c.',array('link_id2' => $target_id))), |
|
416 | - 'join'=>" a |
|
415 | + (!$target_id ? '' : self::$db->expression(self::TABLE,' AND c.',array('link_id2' => $target_id))), |
|
416 | + 'join'=>" a |
|
417 | 417 | JOIN $table b ON a.link_id2=b.link_id1 AND a.link_app2=b.link_app1 |
418 | 418 | JOIN $table c ON a.link_id1=c.link_id1 AND a.link_app1=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app2 AND c.link_id2=b.link_id2", |
419 | 419 | ), |
420 | 420 | // retrieve the type of links, where the relation is realized as timesheet->infolog/tracker and projectmanager->timesheet |
421 | 421 | array('table'=>self::TABLE, |
422 | 422 | 'cols'=>'b.link_id, b.link_app2 as app1, b.link_id2 as id1, b.link_app1 as app2, b.link_id1 as id2, b.link_remark,b.link_lastmod,b.link_owner,b.deleted,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3', |
423 | - 'where'=>'a.link_app1='.self::$db->quote($app).' AND b.link_app1='.self::$db->quote($target_app). |
|
424 | - (!$target_id ? '' : self::$db->expression(self::TABLE,' AND b.',array('link_id1' => $target_id))), |
|
425 | - 'join'=>" a |
|
423 | + 'where'=>'a.link_app1='.self::$db->quote($app).' AND b.link_app1='.self::$db->quote($target_app). |
|
424 | + (!$target_id ? '' : self::$db->expression(self::TABLE,' AND b.',array('link_id1' => $target_id))), |
|
425 | + 'join'=>" a |
|
426 | 426 | JOIN $table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2 |
427 | 427 | JOIN $table c ON a.link_id2=c.link_id1 AND a.link_app2=c.link_app1 AND a.link_id!=c.link_id AND c.link_app2=b.link_app1 AND c.link_id2=b.link_id1", |
428 | 428 | ), |
429 | 429 | // retrieve the type of links, where the relation is realized as timesheet->projectmanager and infolog->timesheet |
430 | 430 | array('table'=>self::TABLE, |
431 | 431 | 'cols'=>'a.*,c.link_app1 AS app3,c.link_id1 AS id3,c.link_id AS link3', |
432 | - 'where'=>'a.link_app1='.self::$db->quote($app).' AND a.link_app2='.self::$db->quote($target_app). |
|
433 | - (!$target_id ? '' : self::$db->expression(self::TABLE,' AND a.',array('link_id2' => $target_id))), |
|
434 | - 'join'=>" a |
|
432 | + 'where'=>'a.link_app1='.self::$db->quote($app).' AND a.link_app2='.self::$db->quote($target_app). |
|
433 | + (!$target_id ? '' : self::$db->expression(self::TABLE,' AND a.',array('link_id2' => $target_id))), |
|
434 | + 'join'=>" a |
|
435 | 435 | JOIN $table b ON a.link_id1=b.link_id2 AND a.link_app1=b.link_app2 |
436 | 436 | JOIN $table c ON a.link_id2=c.link_id2 AND a.link_app2=c.link_app2 AND a.link_id!=c.link_id AND c.link_app1=b.link_app1 AND c.link_id1=b.link_id1", |
437 | 437 | ), |
@@ -38,13 +38,13 @@ |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | - * reads contacts matched by key and puts all cols in the data array |
|
42 | - * |
|
43 | - * reimplemented from bocontacts to call the old read function, if more then one param |
|
44 | - * |
|
45 | - * @param int/string $contact_id |
|
46 | - * @return array/boolean contact data or false on error |
|
47 | - */ |
|
41 | + * reads contacts matched by key and puts all cols in the data array |
|
42 | + * |
|
43 | + * reimplemented from bocontacts to call the old read function, if more then one param |
|
44 | + * |
|
45 | + * @param int/string $contact_id |
|
46 | + * @return array/boolean contact data or false on error |
|
47 | + */ |
|
48 | 48 | function read($contact_id) |
49 | 49 | { |
50 | 50 | if (func_num_args() > 1) // calling the old / depricated read function |
@@ -255,20 +255,20 @@ |
||
255 | 255 | */ |
256 | 256 | static public function parse_digest($txt) |
257 | 257 | { |
258 | - // protect against missing data |
|
259 | - $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1); |
|
260 | - $data = array(); |
|
261 | - $keys = implode('|', array_keys($needed_parts)); |
|
258 | + // protect against missing data |
|
259 | + $needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1); |
|
260 | + $data = array(); |
|
261 | + $keys = implode('|', array_keys($needed_parts)); |
|
262 | 262 | |
263 | 263 | $matches = null; |
264 | - preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER); |
|
264 | + preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER); |
|
265 | 265 | |
266 | - foreach ($matches as $m) |
|
267 | - { |
|
268 | - $data[$m[1]] = $m[3] ? $m[3] : $m[4]; |
|
269 | - unset($needed_parts[$m[1]]); |
|
270 | - } |
|
271 | - //error_log(__METHOD__."('$txt') returning ".array2string($needed_parts ? false : $data)); |
|
272 | - return $needed_parts ? false : $data; |
|
266 | + foreach ($matches as $m) |
|
267 | + { |
|
268 | + $data[$m[1]] = $m[3] ? $m[3] : $m[4]; |
|
269 | + unset($needed_parts[$m[1]]); |
|
270 | + } |
|
271 | + //error_log(__METHOD__."('$txt') returning ".array2string($needed_parts ? false : $data)); |
|
272 | + return $needed_parts ? false : $data; |
|
273 | 273 | } |
274 | 274 | } |
@@ -68,43 +68,43 @@ discard block |
||
68 | 68 | */ |
69 | 69 | const FETCH_BOTH = ADODB_FETCH_BOTH; |
70 | 70 | /** |
71 | - * @var string $type translated database type: mysqlt+mysqli ==> mysql, same for odbc-types |
|
72 | - */ |
|
71 | + * @var string $type translated database type: mysqlt+mysqli ==> mysql, same for odbc-types |
|
72 | + */ |
|
73 | 73 | var $Type = ''; |
74 | 74 | |
75 | 75 | /** |
76 | - * @var string $type database type as defined in the header.inc.php, eg. mysqlt |
|
77 | - */ |
|
76 | + * @var string $type database type as defined in the header.inc.php, eg. mysqlt |
|
77 | + */ |
|
78 | 78 | var $setupType = ''; |
79 | 79 | |
80 | 80 | /** |
81 | - * @var string $Host database host to connect to |
|
82 | - */ |
|
81 | + * @var string $Host database host to connect to |
|
82 | + */ |
|
83 | 83 | var $Host = ''; |
84 | 84 | |
85 | 85 | /** |
86 | - * @var string $Port port number of database to connect to |
|
87 | - */ |
|
86 | + * @var string $Port port number of database to connect to |
|
87 | + */ |
|
88 | 88 | var $Port = ''; |
89 | 89 | |
90 | 90 | /** |
91 | - * @var string $Database name of database to use |
|
92 | - */ |
|
91 | + * @var string $Database name of database to use |
|
92 | + */ |
|
93 | 93 | var $Database = ''; |
94 | 94 | |
95 | 95 | /** |
96 | - * @var string $User name of database user |
|
97 | - */ |
|
96 | + * @var string $User name of database user |
|
97 | + */ |
|
98 | 98 | var $User = ''; |
99 | 99 | |
100 | 100 | /** |
101 | - * @var string $Password password for database user |
|
102 | - */ |
|
101 | + * @var string $Password password for database user |
|
102 | + */ |
|
103 | 103 | var $Password = ''; |
104 | 104 | |
105 | 105 | /** |
106 | - * @var int $Debug enable debuging - 0 no, 1 yes |
|
107 | - */ |
|
106 | + * @var int $Debug enable debuging - 0 no, 1 yes |
|
107 | + */ |
|
108 | 108 | var $Debug = 0; |
109 | 109 | |
110 | 110 | /** |
@@ -115,23 +115,23 @@ discard block |
||
115 | 115 | var $log_updates = false; |
116 | 116 | |
117 | 117 | /** |
118 | - * @var array $Record current record |
|
119 | - */ |
|
118 | + * @var array $Record current record |
|
119 | + */ |
|
120 | 120 | var $Record = array(); |
121 | 121 | |
122 | 122 | /** |
123 | - * @var int row number for current record |
|
124 | - */ |
|
123 | + * @var int row number for current record |
|
124 | + */ |
|
125 | 125 | var $Row; |
126 | 126 | |
127 | 127 | /** |
128 | - * @var int $Errno internal rdms error number for last error |
|
129 | - */ |
|
128 | + * @var int $Errno internal rdms error number for last error |
|
129 | + */ |
|
130 | 130 | var $Errno = 0; |
131 | 131 | |
132 | 132 | /** |
133 | - * @var string descriptive text from last error |
|
134 | - */ |
|
133 | + * @var string descriptive text from last error |
|
134 | + */ |
|
135 | 135 | var $Error = ''; |
136 | 136 | |
137 | 137 | /** |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | /** |
280 | - * @param string $query query to be executed (optional) |
|
281 | - */ |
|
280 | + * @param string $query query to be executed (optional) |
|
281 | + */ |
|
282 | 282 | |
283 | 283 | function db($query = '') |
284 | 284 | { |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
289 | - * @return int current connection id |
|
290 | - */ |
|
289 | + * @return int current connection id |
|
290 | + */ |
|
291 | 291 | function link_id() |
292 | 292 | { |
293 | 293 | return $this->Link_ID; |
@@ -654,8 +654,8 @@ discard block |
||
654 | 654 | } |
655 | 655 | |
656 | 656 | /** |
657 | - * Close a connection to a database |
|
658 | - */ |
|
657 | + * Close a connection to a database |
|
658 | + */ |
|
659 | 659 | function disconnect() |
660 | 660 | { |
661 | 661 | if (!$this->privat_Link_ID) |
@@ -669,12 +669,12 @@ discard block |
||
669 | 669 | } |
670 | 670 | |
671 | 671 | /** |
672 | - * Escape strings before sending them to the database |
|
673 | - * |
|
674 | - * @deprecated use quote($value,$type='') instead |
|
675 | - * @param string $str the string to be escaped |
|
676 | - * @return string escaped sting |
|
677 | - */ |
|
672 | + * Escape strings before sending them to the database |
|
673 | + * |
|
674 | + * @deprecated use quote($value,$type='') instead |
|
675 | + * @param string $str the string to be escaped |
|
676 | + * @return string escaped sting |
|
677 | + */ |
|
678 | 678 | function db_addslashes($str) |
679 | 679 | { |
680 | 680 | if (!isset($str) || $str == '') |
@@ -689,11 +689,11 @@ discard block |
||
689 | 689 | } |
690 | 690 | |
691 | 691 | /** |
692 | - * Convert a unix timestamp to a rdms specific timestamp |
|
693 | - * |
|
694 | - * @param int unix timestamp |
|
695 | - * @return string rdms specific timestamp |
|
696 | - */ |
|
692 | + * Convert a unix timestamp to a rdms specific timestamp |
|
693 | + * |
|
694 | + * @param int unix timestamp |
|
695 | + * @return string rdms specific timestamp |
|
696 | + */ |
|
697 | 697 | function to_timestamp($epoch) |
698 | 698 | { |
699 | 699 | if (!$this->Link_ID && !$this->connect()) |
@@ -705,11 +705,11 @@ discard block |
||
705 | 705 | } |
706 | 706 | |
707 | 707 | /** |
708 | - * Convert a rdms specific timestamp to a unix timestamp |
|
709 | - * |
|
710 | - * @param string rdms specific timestamp |
|
711 | - * @return int unix timestamp |
|
712 | - */ |
|
708 | + * Convert a rdms specific timestamp to a unix timestamp |
|
709 | + * |
|
710 | + * @param string rdms specific timestamp |
|
711 | + * @return int unix timestamp |
|
712 | + */ |
|
713 | 713 | function from_timestamp($timestamp) |
714 | 714 | { |
715 | 715 | if (!$this->Link_ID && !$this->connect()) |
@@ -742,19 +742,19 @@ discard block |
||
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
745 | - * Execute a query |
|
746 | - * |
|
747 | - * @param string $Query_String the query to be executed |
|
748 | - * @param int $line the line method was called from - use __LINE__ |
|
749 | - * @param string $file the file method was called from - use __FILE__ |
|
750 | - * @param int $offset row to start from, default 0 |
|
751 | - * @param int $num_rows number of rows to return (optional), default -1 = all, 0 will use $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] |
|
752 | - * @param array|boolean $inputarr array for binding variables to parameters or false (default) |
|
753 | - * @param int $fetchmode =egw_db::FETCH_BOTH egw_db::FETCH_BOTH (default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
754 | - * @param boolean $reconnect =true true: try reconnecting if server closes connection, false: dont (mysql only!) |
|
755 | - * @return ADORecordSet or false, if the query fails |
|
756 | - * @throws egw_exception_db_invalid_sql with $this->Link_ID->ErrorNo() as code |
|
757 | - */ |
|
745 | + * Execute a query |
|
746 | + * |
|
747 | + * @param string $Query_String the query to be executed |
|
748 | + * @param int $line the line method was called from - use __LINE__ |
|
749 | + * @param string $file the file method was called from - use __FILE__ |
|
750 | + * @param int $offset row to start from, default 0 |
|
751 | + * @param int $num_rows number of rows to return (optional), default -1 = all, 0 will use $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] |
|
752 | + * @param array|boolean $inputarr array for binding variables to parameters or false (default) |
|
753 | + * @param int $fetchmode =egw_db::FETCH_BOTH egw_db::FETCH_BOTH (default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
754 | + * @param boolean $reconnect =true true: try reconnecting if server closes connection, false: dont (mysql only!) |
|
755 | + * @return ADORecordSet or false, if the query fails |
|
756 | + * @throws egw_exception_db_invalid_sql with $this->Link_ID->ErrorNo() as code |
|
757 | + */ |
|
758 | 758 | function query($Query_String, $line = '', $file = '', $offset=0, $num_rows=-1, $inputarr=false, $fetchmode=egw_db::FETCH_BOTH, $reconnect=true) |
759 | 759 | { |
760 | 760 | unset($line, $file); // not used anymore |
@@ -824,30 +824,30 @@ discard block |
||
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
827 | - * Execute a query with limited result set |
|
828 | - * |
|
829 | - * @param string $Query_String the query to be executed |
|
830 | - * @param int $offset row to start from, default 0 |
|
831 | - * @param int $line the line method was called from - use __LINE__ |
|
832 | - * @param string $file the file method was called from - use __FILE__ |
|
833 | - * @param int $num_rows number of rows to return (optional), default -1 = all, 0 will use $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] |
|
834 | - * @param array|boolean $inputarr array for binding variables to parameters or false (default) |
|
835 | - * @return ADORecordSet or false, if the query fails |
|
836 | - */ |
|
827 | + * Execute a query with limited result set |
|
828 | + * |
|
829 | + * @param string $Query_String the query to be executed |
|
830 | + * @param int $offset row to start from, default 0 |
|
831 | + * @param int $line the line method was called from - use __LINE__ |
|
832 | + * @param string $file the file method was called from - use __FILE__ |
|
833 | + * @param int $num_rows number of rows to return (optional), default -1 = all, 0 will use $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] |
|
834 | + * @param array|boolean $inputarr array for binding variables to parameters or false (default) |
|
835 | + * @return ADORecordSet or false, if the query fails |
|
836 | + */ |
|
837 | 837 | function limit_query($Query_String, $offset, $line = '', $file = '', $num_rows = '',$inputarr=false) |
838 | 838 | { |
839 | 839 | return $this->query($Query_String,$line,$file,$offset,$num_rows,$inputarr); |
840 | 840 | } |
841 | 841 | |
842 | 842 | /** |
843 | - * Move to the next row in the results set |
|
844 | - * |
|
845 | - * Specifying a fetch_mode only works for newly fetched rows, the first row always gets fetched by query!!! |
|
846 | - * |
|
847 | - * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
848 | - * @param int $fetch_mode egw_db::FETCH_BOTH = numerical+assoc keys (eGW default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
849 | - * @return bool was another row found? |
|
850 | - */ |
|
843 | + * Move to the next row in the results set |
|
844 | + * |
|
845 | + * Specifying a fetch_mode only works for newly fetched rows, the first row always gets fetched by query!!! |
|
846 | + * |
|
847 | + * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
848 | + * @param int $fetch_mode egw_db::FETCH_BOTH = numerical+assoc keys (eGW default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
849 | + * @return bool was another row found? |
|
850 | + */ |
|
851 | 851 | function next_record($fetch_mode=egw_db::FETCH_BOTH) |
852 | 852 | { |
853 | 853 | if (!$this->Query_ID) |
@@ -897,12 +897,12 @@ discard block |
||
897 | 897 | } |
898 | 898 | |
899 | 899 | /** |
900 | - * Move to position in result set |
|
901 | - * |
|
902 | - * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
903 | - * @param int $pos required row (optional), default first row |
|
904 | - * @return boolean true if sucessful or false if not found |
|
905 | - */ |
|
900 | + * Move to position in result set |
|
901 | + * |
|
902 | + * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
903 | + * @param int $pos required row (optional), default first row |
|
904 | + * @return boolean true if sucessful or false if not found |
|
905 | + */ |
|
906 | 906 | function seek($pos = 0) |
907 | 907 | { |
908 | 908 | if (!$this->Query_ID || !$this->Query_ID->Move($this->Row = $pos)) |
@@ -913,10 +913,10 @@ discard block |
||
913 | 913 | } |
914 | 914 | |
915 | 915 | /** |
916 | - * Begin Transaction |
|
917 | - * |
|
918 | - * @return int/boolean current transaction-id, of false if no connection |
|
919 | - */ |
|
916 | + * Begin Transaction |
|
917 | + * |
|
918 | + * @return int/boolean current transaction-id, of false if no connection |
|
919 | + */ |
|
920 | 920 | function transaction_begin() |
921 | 921 | { |
922 | 922 | if (!$this->Link_ID && !$this->connect()) |
@@ -928,10 +928,10 @@ discard block |
||
928 | 928 | } |
929 | 929 | |
930 | 930 | /** |
931 | - * Complete the transaction |
|
932 | - * |
|
933 | - * @return bool True if sucessful, False if fails |
|
934 | - */ |
|
931 | + * Complete the transaction |
|
932 | + * |
|
933 | + * @return bool True if sucessful, False if fails |
|
934 | + */ |
|
935 | 935 | function transaction_commit() |
936 | 936 | { |
937 | 937 | if (!$this->Link_ID && !$this->connect()) |
@@ -943,10 +943,10 @@ discard block |
||
943 | 943 | } |
944 | 944 | |
945 | 945 | /** |
946 | - * Rollback the current transaction |
|
947 | - * |
|
948 | - * @return bool True if sucessful, False if fails |
|
949 | - */ |
|
946 | + * Rollback the current transaction |
|
947 | + * |
|
948 | + * @return bool True if sucessful, False if fails |
|
949 | + */ |
|
950 | 950 | function transaction_abort() |
951 | 951 | { |
952 | 952 | if (!$this->Link_ID && !$this->connect()) |
@@ -958,12 +958,12 @@ discard block |
||
958 | 958 | } |
959 | 959 | |
960 | 960 | /** |
961 | - * Find the primary key of the last insertion on the current db connection |
|
962 | - * |
|
963 | - * @param string $table name of table the insert was performed on |
|
964 | - * @param string $field the autoincrement primary key of the table |
|
965 | - * @return int the id, -1 if fails |
|
966 | - */ |
|
961 | + * Find the primary key of the last insertion on the current db connection |
|
962 | + * |
|
963 | + * @param string $table name of table the insert was performed on |
|
964 | + * @param string $field the autoincrement primary key of the table |
|
965 | + * @return int the id, -1 if fails |
|
966 | + */ |
|
967 | 967 | function get_last_insert_id($table, $field) |
968 | 968 | { |
969 | 969 | if (!$this->Link_ID && !$this->connect()) |
@@ -986,32 +986,32 @@ discard block |
||
986 | 986 | } |
987 | 987 | |
988 | 988 | /** |
989 | - * Lock a table |
|
990 | - * |
|
991 | - * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
992 | - * @param string $table name of table to lock |
|
993 | - * @param string $mode type of lock required (optional), default write |
|
994 | - * @return bool True if sucessful, False if fails |
|
995 | - */ |
|
989 | + * Lock a table |
|
990 | + * |
|
991 | + * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
992 | + * @param string $table name of table to lock |
|
993 | + * @param string $mode type of lock required (optional), default write |
|
994 | + * @return bool True if sucessful, False if fails |
|
995 | + */ |
|
996 | 996 | function lock($table, $mode='write') |
997 | 997 | { |
998 | 998 | unset($table, $mode); // not used anymore |
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | /** |
1002 | - * Unlock a table |
|
1003 | - * |
|
1004 | - * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
1005 | - * @return bool True if sucessful, False if fails |
|
1006 | - */ |
|
1002 | + * Unlock a table |
|
1003 | + * |
|
1004 | + * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
1005 | + * @return bool True if sucessful, False if fails |
|
1006 | + */ |
|
1007 | 1007 | function unlock() |
1008 | 1008 | {} |
1009 | 1009 | |
1010 | 1010 | /** |
1011 | - * Get the number of rows affected by last update or delete |
|
1012 | - * |
|
1013 | - * @return int number of rows |
|
1014 | - */ |
|
1011 | + * Get the number of rows affected by last update or delete |
|
1012 | + * |
|
1013 | + * @return int number of rows |
|
1014 | + */ |
|
1015 | 1015 | function affected_rows() |
1016 | 1016 | { |
1017 | 1017 | if ($this->log_updates) return 0; |
@@ -1024,52 +1024,52 @@ discard block |
||
1024 | 1024 | } |
1025 | 1025 | |
1026 | 1026 | /** |
1027 | - * Number of rows in current result set |
|
1028 | - * |
|
1029 | - * @deprecated use the result-object returned by query/select()->NumRows(), so you can use the global db-object and not a clone |
|
1030 | - * @return int number of rows |
|
1031 | - */ |
|
1027 | + * Number of rows in current result set |
|
1028 | + * |
|
1029 | + * @deprecated use the result-object returned by query/select()->NumRows(), so you can use the global db-object and not a clone |
|
1030 | + * @return int number of rows |
|
1031 | + */ |
|
1032 | 1032 | function num_rows() |
1033 | 1033 | { |
1034 | 1034 | return $this->Query_ID ? $this->Query_ID->RecordCount() : False; |
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | /** |
1038 | - * Number of fields in current row |
|
1039 | - * |
|
1040 | - * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
1041 | - * @return int number of fields |
|
1042 | - */ |
|
1038 | + * Number of fields in current row |
|
1039 | + * |
|
1040 | + * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
1041 | + * @return int number of fields |
|
1042 | + */ |
|
1043 | 1043 | function num_fields() |
1044 | 1044 | { |
1045 | 1045 | return $this->Query_ID ? $this->Query_ID->FieldCount() : False; |
1046 | 1046 | } |
1047 | 1047 | |
1048 | 1048 | /** |
1049 | - * @deprecated use num_rows() |
|
1050 | - */ |
|
1049 | + * @deprecated use num_rows() |
|
1050 | + */ |
|
1051 | 1051 | function nf() |
1052 | 1052 | { |
1053 | 1053 | return $this->num_rows(); |
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | /** |
1057 | - * @deprecated use print num_rows() |
|
1058 | - */ |
|
1057 | + * @deprecated use print num_rows() |
|
1058 | + */ |
|
1059 | 1059 | function np() |
1060 | 1060 | { |
1061 | 1061 | print $this->num_rows(); |
1062 | 1062 | } |
1063 | 1063 | |
1064 | 1064 | /** |
1065 | - * Return the value of a column |
|
1066 | - * |
|
1067 | - * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
1068 | - * @param string|integer $Name name of field or positional index starting from 0 |
|
1069 | - * @param bool $strip_slashes string escape chars from field(optional), default false |
|
1070 | - * depricated param, as correctly quoted values dont need any stripslashes! |
|
1071 | - * @return string the field value |
|
1072 | - */ |
|
1065 | + * Return the value of a column |
|
1066 | + * |
|
1067 | + * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
1068 | + * @param string|integer $Name name of field or positional index starting from 0 |
|
1069 | + * @param bool $strip_slashes string escape chars from field(optional), default false |
|
1070 | + * depricated param, as correctly quoted values dont need any stripslashes! |
|
1071 | + * @return string the field value |
|
1072 | + */ |
|
1073 | 1073 | function f($Name, $strip_slashes = False) |
1074 | 1074 | { |
1075 | 1075 | if ($strip_slashes) |
@@ -1080,25 +1080,25 @@ discard block |
||
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | /** |
1083 | - * Print the value of a field |
|
1084 | - * |
|
1085 | - * @param string $Name name of field to print |
|
1086 | - * @param bool $strip_slashes string escape chars from field(optional), default false |
|
1087 | - * depricated param, as correctly quoted values dont need any stripslashes! |
|
1088 | - */ |
|
1083 | + * Print the value of a field |
|
1084 | + * |
|
1085 | + * @param string $Name name of field to print |
|
1086 | + * @param bool $strip_slashes string escape chars from field(optional), default false |
|
1087 | + * depricated param, as correctly quoted values dont need any stripslashes! |
|
1088 | + */ |
|
1089 | 1089 | function p($Name, $strip_slashes = True) |
1090 | 1090 | { |
1091 | 1091 | print $this->f($Name, $strip_slashes); |
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | /** |
1095 | - * Returns a query-result-row as an associative array (no numerical keys !!!) |
|
1096 | - * |
|
1097 | - * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
1098 | - * @param bool $do_next_record should next_record() be called or not (default not) |
|
1099 | - * @param string $strip ='' string to strip of the column-name, default '' |
|
1100 | - * @return array/bool the associative array or False if no (more) result-row is availible |
|
1101 | - */ |
|
1095 | + * Returns a query-result-row as an associative array (no numerical keys !!!) |
|
1096 | + * |
|
1097 | + * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
1098 | + * @param bool $do_next_record should next_record() be called or not (default not) |
|
1099 | + * @param string $strip ='' string to strip of the column-name, default '' |
|
1100 | + * @return array/bool the associative array or False if no (more) result-row is availible |
|
1101 | + */ |
|
1102 | 1102 | function row($do_next_record=False,$strip='') |
1103 | 1103 | { |
1104 | 1104 | if ($do_next_record && !$this->next_record(egw_db::FETCH_ASSOC) || !is_array($this->Record)) |
@@ -1119,14 +1119,14 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | /** |
1122 | - * Get description of a table |
|
1123 | - * |
|
1124 | - * Beside the column-name all other data depends on the db-type !!! |
|
1125 | - * |
|
1126 | - * @param string $table name of table to describe |
|
1127 | - * @param bool $full optional, default False summary information, True full information |
|
1128 | - * @return array table meta data |
|
1129 | - */ |
|
1122 | + * Get description of a table |
|
1123 | + * |
|
1124 | + * Beside the column-name all other data depends on the db-type !!! |
|
1125 | + * |
|
1126 | + * @param string $table name of table to describe |
|
1127 | + * @param bool $full optional, default False summary information, True full information |
|
1128 | + * @return array table meta data |
|
1129 | + */ |
|
1130 | 1130 | function metadata($table='',$full=false) |
1131 | 1131 | { |
1132 | 1132 | if (!$this->Link_ID && !$this->connect()) |
@@ -1208,10 +1208,10 @@ discard block |
||
1208 | 1208 | } |
1209 | 1209 | |
1210 | 1210 | /** |
1211 | - * Return a list of indexes in current database |
|
1212 | - * |
|
1213 | - * @return array list of indexes |
|
1214 | - */ |
|
1211 | + * Return a list of indexes in current database |
|
1212 | + * |
|
1213 | + * @return array list of indexes |
|
1214 | + */ |
|
1215 | 1215 | function index_names() |
1216 | 1216 | { |
1217 | 1217 | $indices = array(); |
@@ -1233,10 +1233,10 @@ discard block |
||
1233 | 1233 | } |
1234 | 1234 | |
1235 | 1235 | /** |
1236 | - * Returns an array containing column names that are the primary keys of $tablename. |
|
1237 | - * |
|
1238 | - * @return array of columns |
|
1239 | - */ |
|
1236 | + * Returns an array containing column names that are the primary keys of $tablename. |
|
1237 | + * |
|
1238 | + * @return array of columns |
|
1239 | + */ |
|
1240 | 1240 | function pkey_columns($tablename) |
1241 | 1241 | { |
1242 | 1242 | if (!$this->Link_ID && !$this->connect()) |
@@ -1247,13 +1247,13 @@ discard block |
||
1247 | 1247 | } |
1248 | 1248 | |
1249 | 1249 | /** |
1250 | - * Create a new database |
|
1251 | - * |
|
1252 | - * @param string $adminname name of database administrator user (optional) |
|
1253 | - * @param string $adminpasswd password for the database administrator user (optional) |
|
1254 | - * @param string $charset default charset for the database |
|
1255 | - * @param string $grant_host ='localhost' host/ip of the webserver |
|
1256 | - */ |
|
1250 | + * Create a new database |
|
1251 | + * |
|
1252 | + * @param string $adminname name of database administrator user (optional) |
|
1253 | + * @param string $adminpasswd password for the database administrator user (optional) |
|
1254 | + * @param string $charset default charset for the database |
|
1255 | + * @param string $grant_host ='localhost' host/ip of the webserver |
|
1256 | + */ |
|
1257 | 1257 | function create_database($adminname = '', $adminpasswd = '', $charset='', $grant_host='localhost') |
1258 | 1258 | { |
1259 | 1259 | $currentUser = $this->User; |
@@ -1509,12 +1509,12 @@ discard block |
||
1509 | 1509 | } |
1510 | 1510 | |
1511 | 1511 | /** |
1512 | - * Correctly Quote Identifiers like table- or colmnnames for use in SQL-statements |
|
1513 | - * |
|
1514 | - * This is mostly copy & paste from adodb's datadict class |
|
1515 | - * @param string $_name |
|
1516 | - * @return string quoted string |
|
1517 | - */ |
|
1512 | + * Correctly Quote Identifiers like table- or colmnnames for use in SQL-statements |
|
1513 | + * |
|
1514 | + * This is mostly copy & paste from adodb's datadict class |
|
1515 | + * @param string $_name |
|
1516 | + * @return string quoted string |
|
1517 | + */ |
|
1518 | 1518 | function name_quote($_name = NULL) |
1519 | 1519 | { |
1520 | 1520 | if (!is_string($_name)) |
@@ -1553,19 +1553,19 @@ discard block |
||
1553 | 1553 | } |
1554 | 1554 | |
1555 | 1555 | /** |
1556 | - * Escape values before sending them to the database - prevents SQL injection and SQL errors ;-) |
|
1557 | - * |
|
1558 | - * Please note that the quote function already returns necessary quotes: quote('Hello') === "'Hello'". |
|
1559 | - * Int and Auto types are casted to int: quote('1','int') === 1, quote('','int') === 0, quote('Hello','int') === 0 |
|
1560 | - * Arrays of id's stored in strings: quote(array(1,2,3),'string') === "'1,2,3'" |
|
1561 | - * |
|
1562 | - * @param mixed $value the value to be escaped |
|
1563 | - * @param string|boolean $type =false string the type of the db-column, default False === varchar |
|
1564 | - * @param boolean $not_null =true is column NOT NULL, default true, else php null values are written as SQL NULL |
|
1565 | - * @param int $length =null length of the varchar column, to truncate it if the database requires it (eg. Postgres) |
|
1566 | - * @param string $glue =',' used to glue array values together for the string type |
|
1567 | - * @return string escaped sting |
|
1568 | - */ |
|
1556 | + * Escape values before sending them to the database - prevents SQL injection and SQL errors ;-) |
|
1557 | + * |
|
1558 | + * Please note that the quote function already returns necessary quotes: quote('Hello') === "'Hello'". |
|
1559 | + * Int and Auto types are casted to int: quote('1','int') === 1, quote('','int') === 0, quote('Hello','int') === 0 |
|
1560 | + * Arrays of id's stored in strings: quote(array(1,2,3),'string') === "'1,2,3'" |
|
1561 | + * |
|
1562 | + * @param mixed $value the value to be escaped |
|
1563 | + * @param string|boolean $type =false string the type of the db-column, default False === varchar |
|
1564 | + * @param boolean $not_null =true is column NOT NULL, default true, else php null values are written as SQL NULL |
|
1565 | + * @param int $length =null length of the varchar column, to truncate it if the database requires it (eg. Postgres) |
|
1566 | + * @param string $glue =',' used to glue array values together for the string type |
|
1567 | + * @return string escaped sting |
|
1568 | + */ |
|
1569 | 1569 | function quote($value,$type=False,$not_null=true,$length=null,$glue=',') |
1570 | 1570 | { |
1571 | 1571 | if ($this->Debug) echo "<p>db::quote(".(is_null($value)?'NULL':"'$value'").",'$type','$not_null')</p>\n"; |
@@ -1645,27 +1645,27 @@ discard block |
||
1645 | 1645 | } |
1646 | 1646 | |
1647 | 1647 | /** |
1648 | - * Implodes an array of column-value pairs for the use in sql-querys. |
|
1649 | - * All data is run through quote (does either addslashes() or (int)) - prevents SQL injunction and SQL errors ;-). |
|
1650 | - * |
|
1651 | - * @author RalfBecker<at>outdoor-training.de |
|
1652 | - * |
|
1653 | - * @param string $glue in most cases this will be either ',' or ' AND ', depending you your query |
|
1654 | - * @param array $array column-name / value pairs, if the value is an array all its array-values will be quoted |
|
1655 | - * according to the type of the column, and the whole array with be formatted like (val1,val2,...) |
|
1656 | - * If $use_key == True, an ' IN ' instead a '=' is used. Good for category- or user-lists. |
|
1657 | - * If the key is numerical (no key given in the array-definition) the value is used as is, eg. |
|
1658 | - * array('visits=visits+1') gives just "visits=visits+1" (no quoting at all !!!) |
|
1659 | - * @param boolean|string $use_key If $use_key===True a "$key=" prefix each value (default), typically set to False |
|
1660 | - * or 'VALUES' for insert querys, on 'VALUES' "(key1,key2,...) VALUES (val1,val2,...)" is returned |
|
1661 | - * @param array|boolean $only if set to an array only colums which are set (as data !!!) are written |
|
1662 | - * typicaly used to form a WHERE-clause from the primary keys. |
|
1663 | - * If set to True, only columns from the colum_definitons are written. |
|
1664 | - * @param array|boolean $column_definitions this can be set to the column-definitions-array |
|
1665 | - * of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file). |
|
1666 | - * If its set, the column-type-data determinates if (int) or addslashes is used. |
|
1667 | - * @return string SQL |
|
1668 | - */ |
|
1648 | + * Implodes an array of column-value pairs for the use in sql-querys. |
|
1649 | + * All data is run through quote (does either addslashes() or (int)) - prevents SQL injunction and SQL errors ;-). |
|
1650 | + * |
|
1651 | + * @author RalfBecker<at>outdoor-training.de |
|
1652 | + * |
|
1653 | + * @param string $glue in most cases this will be either ',' or ' AND ', depending you your query |
|
1654 | + * @param array $array column-name / value pairs, if the value is an array all its array-values will be quoted |
|
1655 | + * according to the type of the column, and the whole array with be formatted like (val1,val2,...) |
|
1656 | + * If $use_key == True, an ' IN ' instead a '=' is used. Good for category- or user-lists. |
|
1657 | + * If the key is numerical (no key given in the array-definition) the value is used as is, eg. |
|
1658 | + * array('visits=visits+1') gives just "visits=visits+1" (no quoting at all !!!) |
|
1659 | + * @param boolean|string $use_key If $use_key===True a "$key=" prefix each value (default), typically set to False |
|
1660 | + * or 'VALUES' for insert querys, on 'VALUES' "(key1,key2,...) VALUES (val1,val2,...)" is returned |
|
1661 | + * @param array|boolean $only if set to an array only colums which are set (as data !!!) are written |
|
1662 | + * typicaly used to form a WHERE-clause from the primary keys. |
|
1663 | + * If set to True, only columns from the colum_definitons are written. |
|
1664 | + * @param array|boolean $column_definitions this can be set to the column-definitions-array |
|
1665 | + * of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file). |
|
1666 | + * If its set, the column-type-data determinates if (int) or addslashes is used. |
|
1667 | + * @return string SQL |
|
1668 | + */ |
|
1669 | 1669 | function column_data_implode($glue,$array,$use_key=True,$only=False,$column_definitions=False) |
1670 | 1670 | { |
1671 | 1671 | if (!is_array($array)) // this allows to give an SQL-string for delete or update |
@@ -1751,14 +1751,14 @@ discard block |
||
1751 | 1751 | } |
1752 | 1752 | |
1753 | 1753 | /** |
1754 | - * Sets the default column-definitions for use with column_data_implode() |
|
1755 | - * |
|
1756 | - * @author RalfBecker<at>outdoor-training.de |
|
1757 | - * |
|
1758 | - * @param array|boolean $column_definitions this can be set to the column-definitions-array |
|
1759 | - * of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file). |
|
1760 | - * If its set, the column-type-data determinates if (int) or addslashes is used. |
|
1761 | - */ |
|
1754 | + * Sets the default column-definitions for use with column_data_implode() |
|
1755 | + * |
|
1756 | + * @author RalfBecker<at>outdoor-training.de |
|
1757 | + * |
|
1758 | + * @param array|boolean $column_definitions this can be set to the column-definitions-array |
|
1759 | + * of your table ($tables_baseline[$table]['fd'] of the setup/tables_current.inc.php file). |
|
1760 | + * If its set, the column-type-data determinates if (int) or addslashes is used. |
|
1761 | + */ |
|
1762 | 1762 | function set_column_definitions($column_definitions=False) |
1763 | 1763 | { |
1764 | 1764 | $this->column_definitions=$column_definitions; |
@@ -1795,17 +1795,17 @@ discard block |
||
1795 | 1795 | } |
1796 | 1796 | |
1797 | 1797 | /** |
1798 | - * reads the table-definitions from the app's setup/tables_current.inc.php file |
|
1799 | - * |
|
1800 | - * The already read table-definitions are shared between all db-instances via a static var. |
|
1801 | - * |
|
1802 | - * @author RalfBecker<at>outdoor-training.de |
|
1803 | - * |
|
1804 | - * @param bool|string $app name of the app or default False to use the app set by db::set_app or the current app, |
|
1805 | - * true to search the already loaded table-definitions for $table and then search all existing apps for it |
|
1806 | - * @param bool|string $table if set return only defintions of that table, else return all defintions |
|
1807 | - * @return mixed array with table-defintions or False if file not found |
|
1808 | - */ |
|
1798 | + * reads the table-definitions from the app's setup/tables_current.inc.php file |
|
1799 | + * |
|
1800 | + * The already read table-definitions are shared between all db-instances via a static var. |
|
1801 | + * |
|
1802 | + * @author RalfBecker<at>outdoor-training.de |
|
1803 | + * |
|
1804 | + * @param bool|string $app name of the app or default False to use the app set by db::set_app or the current app, |
|
1805 | + * true to search the already loaded table-definitions for $table and then search all existing apps for it |
|
1806 | + * @param bool|string $table if set return only defintions of that table, else return all defintions |
|
1807 | + * @return mixed array with table-defintions or False if file not found |
|
1808 | + */ |
|
1809 | 1809 | function get_table_definitions($app=False,$table=False) |
1810 | 1810 | { |
1811 | 1811 | static $all_app_data = array(); |
@@ -1898,21 +1898,21 @@ discard block |
||
1898 | 1898 | } |
1899 | 1899 | |
1900 | 1900 | /** |
1901 | - * Insert a row of data into a table or updates it if $where is given, all data is quoted according to it's type |
|
1902 | - * |
|
1903 | - * @author RalfBecker<at>outdoor-training.de |
|
1904 | - * |
|
1905 | - * @param string $table name of the table |
|
1906 | - * @param array $data with column-name / value pairs |
|
1907 | - * @param mixed $where string with where clause or array with column-name / values pairs to check if a row with that keys already exists, or false for an unconditional insert |
|
1908 | - * if the row exists db::update is called else a new row with $date merged with $where gets inserted (data has precedence) |
|
1909 | - * @param int $line line-number to pass to query |
|
1910 | - * @param string $file file-name to pass to query |
|
1911 | - * @param string|boolean $app string with name of app or False to use the current-app |
|
1912 | - * @param bool $use_prepared_statement use a prepared statement |
|
1913 | - * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
1914 | - * @return ADORecordSet or false, if the query fails |
|
1915 | - */ |
|
1901 | + * Insert a row of data into a table or updates it if $where is given, all data is quoted according to it's type |
|
1902 | + * |
|
1903 | + * @author RalfBecker<at>outdoor-training.de |
|
1904 | + * |
|
1905 | + * @param string $table name of the table |
|
1906 | + * @param array $data with column-name / value pairs |
|
1907 | + * @param mixed $where string with where clause or array with column-name / values pairs to check if a row with that keys already exists, or false for an unconditional insert |
|
1908 | + * if the row exists db::update is called else a new row with $date merged with $where gets inserted (data has precedence) |
|
1909 | + * @param int $line line-number to pass to query |
|
1910 | + * @param string $file file-name to pass to query |
|
1911 | + * @param string|boolean $app string with name of app or False to use the current-app |
|
1912 | + * @param bool $use_prepared_statement use a prepared statement |
|
1913 | + * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
1914 | + * @return ADORecordSet or false, if the query fails |
|
1915 | + */ |
|
1916 | 1916 | function insert($table,$data,$where,$line,$file,$app=False,$use_prepared_statement=false,$table_def=False) |
1917 | 1917 | { |
1918 | 1918 | if ($this->Debug) echo "<p>db::insert('$table',".print_r($data,True).",".print_r($where,True).",$line,$file,'$app')</p>\n"; |
@@ -2009,20 +2009,20 @@ discard block |
||
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | /** |
2012 | - * Updates the data of one or more rows in a table, all data is quoted according to it's type |
|
2013 | - * |
|
2014 | - * @author RalfBecker<at>outdoor-training.de |
|
2015 | - * |
|
2016 | - * @param string $table name of the table |
|
2017 | - * @param array $data with column-name / value pairs |
|
2018 | - * @param array $where column-name / values pairs and'ed together for the where clause |
|
2019 | - * @param int $line line-number to pass to query |
|
2020 | - * @param string $file file-name to pass to query |
|
2021 | - * @param string|boolean $app string with name of app or False to use the current-app |
|
2022 | - * @param bool $use_prepared_statement use a prepared statement |
|
2023 | - * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
2024 | - * @return ADORecordSet or false, if the query fails |
|
2025 | - */ |
|
2012 | + * Updates the data of one or more rows in a table, all data is quoted according to it's type |
|
2013 | + * |
|
2014 | + * @author RalfBecker<at>outdoor-training.de |
|
2015 | + * |
|
2016 | + * @param string $table name of the table |
|
2017 | + * @param array $data with column-name / value pairs |
|
2018 | + * @param array $where column-name / values pairs and'ed together for the where clause |
|
2019 | + * @param int $line line-number to pass to query |
|
2020 | + * @param string $file file-name to pass to query |
|
2021 | + * @param string|boolean $app string with name of app or False to use the current-app |
|
2022 | + * @param bool $use_prepared_statement use a prepared statement |
|
2023 | + * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
2024 | + * @return ADORecordSet or false, if the query fails |
|
2025 | + */ |
|
2026 | 2026 | function update($table,$data,$where,$line,$file,$app=False,$use_prepared_statement=false,$table_def=False) |
2027 | 2027 | { |
2028 | 2028 | if ($this->Debug) echo "<p>db::update('$table',".print_r($data,true).','.print_r($where,true).",$line,$file,'$app')</p>\n"; |
@@ -2099,18 +2099,18 @@ discard block |
||
2099 | 2099 | } |
2100 | 2100 | |
2101 | 2101 | /** |
2102 | - * Deletes one or more rows in table, all data is quoted according to it's type |
|
2103 | - * |
|
2104 | - * @author RalfBecker<at>outdoor-training.de |
|
2105 | - * |
|
2106 | - * @param string $table name of the table |
|
2107 | - * @param array $where column-name / values pairs and'ed together for the where clause |
|
2108 | - * @param int $line line-number to pass to query |
|
2109 | - * @param string $file file-name to pass to query |
|
2110 | - * @param string|boolean $app string with name of app or False to use the current-app |
|
2111 | - * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
2112 | - * @return ADORecordSet or false, if the query fails |
|
2113 | - */ |
|
2102 | + * Deletes one or more rows in table, all data is quoted according to it's type |
|
2103 | + * |
|
2104 | + * @author RalfBecker<at>outdoor-training.de |
|
2105 | + * |
|
2106 | + * @param string $table name of the table |
|
2107 | + * @param array $where column-name / values pairs and'ed together for the where clause |
|
2108 | + * @param int $line line-number to pass to query |
|
2109 | + * @param string $file file-name to pass to query |
|
2110 | + * @param string|boolean $app string with name of app or False to use the current-app |
|
2111 | + * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
2112 | + * @return ADORecordSet or false, if the query fails |
|
2113 | + */ |
|
2114 | 2114 | function delete($table,$where,$line,$file,$app=False,$table_def=False) |
2115 | 2115 | { |
2116 | 2116 | if (!$table_def) $table_def = $this->get_table_definitions($app,$table); |
@@ -2176,25 +2176,25 @@ discard block |
||
2176 | 2176 | } |
2177 | 2177 | |
2178 | 2178 | /** |
2179 | - * Selects one or more rows in table depending on where, all data is quoted according to it's type |
|
2180 | - * |
|
2181 | - * @author RalfBecker<at>outdoor-training.de |
|
2182 | - * |
|
2183 | - * @param string $table name of the table |
|
2184 | - * @param array|string $cols string or array of column-names / select-expressions |
|
2185 | - * @param array|string $where string or array with column-name / values pairs AND'ed together for the where clause |
|
2186 | - * @param int $line line-number to pass to query |
|
2187 | - * @param string $file file-name to pass to query |
|
2188 | - * @param int|bool $offset offset for a limited query or False (default) |
|
2189 | - * @param string $append string to append to the end of the query, eg. ORDER BY ... |
|
2190 | - * @param string|boolean $app string with name of app or False to use the current-app |
|
2191 | - * @param int $num_rows number of rows to return if offset set, default 0 = use default in user prefs |
|
2192 | - * @param string $join =null sql to do a join, added as is after the table-name, eg. ", table2 WHERE x=y" or |
|
2193 | - * "LEFT JOIN table2 ON (x=y)", Note: there's no quoting done on $join! |
|
2194 | - * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
2195 | - * @param int $fetchmode =egw_db::FETCH_ASSOC egw_db::FETCH_BOTH (default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
2196 | - * @return ADORecordSet or false, if the query fails |
|
2197 | - */ |
|
2179 | + * Selects one or more rows in table depending on where, all data is quoted according to it's type |
|
2180 | + * |
|
2181 | + * @author RalfBecker<at>outdoor-training.de |
|
2182 | + * |
|
2183 | + * @param string $table name of the table |
|
2184 | + * @param array|string $cols string or array of column-names / select-expressions |
|
2185 | + * @param array|string $where string or array with column-name / values pairs AND'ed together for the where clause |
|
2186 | + * @param int $line line-number to pass to query |
|
2187 | + * @param string $file file-name to pass to query |
|
2188 | + * @param int|bool $offset offset for a limited query or False (default) |
|
2189 | + * @param string $append string to append to the end of the query, eg. ORDER BY ... |
|
2190 | + * @param string|boolean $app string with name of app or False to use the current-app |
|
2191 | + * @param int $num_rows number of rows to return if offset set, default 0 = use default in user prefs |
|
2192 | + * @param string $join =null sql to do a join, added as is after the table-name, eg. ", table2 WHERE x=y" or |
|
2193 | + * "LEFT JOIN table2 ON (x=y)", Note: there's no quoting done on $join! |
|
2194 | + * @param array|bool $table_def use this table definition. If False, the table definition will be read from tables_baseline |
|
2195 | + * @param int $fetchmode =egw_db::FETCH_ASSOC egw_db::FETCH_BOTH (default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
2196 | + * @return ADORecordSet or false, if the query fails |
|
2197 | + */ |
|
2198 | 2198 | function select($table,$cols,$where,$line,$file,$offset=False,$append='',$app=False,$num_rows=0,$join='',$table_def=False,$fetchmode=egw_db::FETCH_ASSOC) |
2199 | 2199 | { |
2200 | 2200 | if ($this->Debug) echo "<p>db::select('$table',".print_r($cols,True).",".print_r($where,True).",$line,$file,$offset,'$app',$num_rows,'$join')</p>\n"; |
@@ -2229,20 +2229,20 @@ discard block |
||
2229 | 2229 | } |
2230 | 2230 | |
2231 | 2231 | /** |
2232 | - * Does a union over multiple selects |
|
2233 | - * |
|
2234 | - * @author RalfBecker<at>outdoor-training.de |
|
2235 | - * |
|
2236 | - * @param array $selects array of selects, each select is an array with the possible keys/parameters: table, cols, where, append, app, join, table_def |
|
2237 | - * For further info about parameters see the definition of the select function, beside table, cols and where all other params are optional |
|
2238 | - * @param int $line line-number to pass to query |
|
2239 | - * @param string $file file-name to pass to query |
|
2240 | - * @param string $order_by ORDER BY statement for the union |
|
2241 | - * @param int|bool $offset offset for a limited query or False (default) |
|
2242 | - * @param int $num_rows number of rows to return if offset set, default 0 = use default in user prefs |
|
2243 | - * @param int $fetchmode =egw_db::FETCH_ASSOC egw_db::FETCH_BOTH (default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
2244 | - * @return ADORecordSet or false, if the query fails |
|
2245 | - */ |
|
2232 | + * Does a union over multiple selects |
|
2233 | + * |
|
2234 | + * @author RalfBecker<at>outdoor-training.de |
|
2235 | + * |
|
2236 | + * @param array $selects array of selects, each select is an array with the possible keys/parameters: table, cols, where, append, app, join, table_def |
|
2237 | + * For further info about parameters see the definition of the select function, beside table, cols and where all other params are optional |
|
2238 | + * @param int $line line-number to pass to query |
|
2239 | + * @param string $file file-name to pass to query |
|
2240 | + * @param string $order_by ORDER BY statement for the union |
|
2241 | + * @param int|bool $offset offset for a limited query or False (default) |
|
2242 | + * @param int $num_rows number of rows to return if offset set, default 0 = use default in user prefs |
|
2243 | + * @param int $fetchmode =egw_db::FETCH_ASSOC egw_db::FETCH_BOTH (default), egw_db::FETCH_ASSOC or egw_db::FETCH_NUM |
|
2244 | + * @return ADORecordSet or false, if the query fails |
|
2245 | + */ |
|
2246 | 2246 | function union($selects,$line,$file,$order_by='',$offset=false,$num_rows=0,$fetchmode=egw_db::FETCH_ASSOC) |
2247 | 2247 | { |
2248 | 2248 | if ($this->Debug) echo "<p>db::union(".print_r($selects,True).",$line,$file,$order_by,$offset,$num_rows)</p>\n"; |
@@ -470,11 +470,11 @@ |
||
470 | 470 | } |
471 | 471 | |
472 | 472 | /** |
473 | - * Allows for array and direct function params as well as sanatization. |
|
474 | - * |
|
475 | - * @author seek3r |
|
476 | - * This function is used to validate param data as well as offer flexible function usage. |
|
477 | - * |
|
473 | + * Allows for array and direct function params as well as sanatization. |
|
474 | + * |
|
475 | + * @author seek3r |
|
476 | + * This function is used to validate param data as well as offer flexible function usage. |
|
477 | + * |
|
478 | 478 | function somefunc() |
479 | 479 | { |
480 | 480 | $expected_args[0] = Array('name'=>'fname','default'=>'joe', 'type'=>'string'); |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $zip = NULL; |
382 | 382 | $_f = NULL; |
383 | 383 | if($type == 'zip') |
384 | - { |
|
384 | + { |
|
385 | 385 | // has already been verified to be available in fopen_backup |
386 | 386 | $zip = new ZipArchive; |
387 | 387 | if(($zip->open($filename)) !== TRUE) |
@@ -719,9 +719,9 @@ discard block |
||
719 | 719 | while($file = $list[0]) |
720 | 720 | { |
721 | 721 | if(is_dir($file) && $file != '.' && $file != '..') |
722 | - self::remove_dir_content($dir.'/'.$file); |
|
722 | + self::remove_dir_content($dir.'/'.$file); |
|
723 | 723 | if(is_file($file) && $file != '.' && $file != '..') |
724 | - unlink($dir.'/'.$file); |
|
724 | + unlink($dir.'/'.$file); |
|
725 | 725 | array_shift($list); |
726 | 726 | } |
727 | 727 | //rmdir($dir); // dont remove own dir |
@@ -967,8 +967,8 @@ discard block |
||
967 | 967 | echo '<center>'.lang("Cant open %1, needs ZipArchive", $name)."<br>\n".'</center>'; |
968 | 968 | } |
969 | 969 | |
970 | - fclose($f); |
|
971 | - if (file_exists($name)) unlink($name); |
|
970 | + fclose($f); |
|
971 | + if (file_exists($name)) unlink($name); |
|
972 | 972 | return TRUE; |
973 | 973 | } |
974 | 974 | // save files .... |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @param string $db_val stored value / hash (from database) |
408 | 408 | * @param string &$type detected crypt type on return |
409 | 409 | * @return boolean True on successful comparison |
410 | - */ |
|
410 | + */ |
|
411 | 411 | static function crypt_compare($form_val, $db_val, &$type) |
412 | 412 | { |
413 | 413 | // detect type of hash by salt part of $db_val |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | * @param string $form_val user input value for comparison |
707 | 707 | * @param string $db_val stored value (from database) |
708 | 708 | * @return boolean True on successful comparison |
709 | - */ |
|
709 | + */ |
|
710 | 710 | static function smd5_compare($form_val,$db_val) |
711 | 711 | { |
712 | 712 | /* Start with the first char after {SMD5} */ |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | * @param string $form_val user input value for comparison |
729 | 729 | * @param string $db_val stored value (from database) |
730 | 730 | * @return boolean True on successful comparison |
731 | - */ |
|
731 | + */ |
|
732 | 732 | static function sha_compare($form_val,$db_val) |
733 | 733 | { |
734 | 734 | /* Start with the first char after {SHA} */ |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | * @param string $form_val user input value for comparison |
746 | 746 | * @param string $db_val stored value (from database) |
747 | 747 | * @return boolean True on successful comparison |
748 | - */ |
|
748 | + */ |
|
749 | 749 | static function ssha_compare($form_val,$db_val) |
750 | 750 | { |
751 | 751 | /* Start with the first char after {SSHA} */ |
@@ -242,13 +242,13 @@ |
||
242 | 242 | if ($ret === false && ($err = json_last_error())) |
243 | 243 | { |
244 | 244 | static $json_err2str = array( |
245 | - JSON_ERROR_NONE => 'No errors', |
|
246 | - JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', |
|
247 | - JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', |
|
248 | - JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', |
|
249 | - JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', |
|
250 | - JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', |
|
251 | - ); |
|
245 | + JSON_ERROR_NONE => 'No errors', |
|
246 | + JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', |
|
247 | + JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', |
|
248 | + JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', |
|
249 | + JSON_ERROR_SYNTAX => 'Syntax error, malformed JSON', |
|
250 | + JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', |
|
251 | + ); |
|
252 | 252 | error_log(__METHOD__.'('.array2string($var).') json_last_error()='.$err.'='.$json_err2str[$err]); |
253 | 253 | |
254 | 254 | if (($var = self::fix_content($var))) |
@@ -615,15 +615,15 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
618 | - * Get the raw email data sent by this object. |
|
619 | - * |
|
618 | + * Get the raw email data sent by this object. |
|
619 | + * |
|
620 | 620 | * Reimplement to be able to call it for saveAsDraft by calling |
621 | 621 | * $this->send(new Horde_Mail_Transport_Null()), |
622 | 622 | * if no base-part is set, because send is not called before. |
623 | 623 | * |
624 | - * @param boolean $stream If true, return a stream resource, otherwise |
|
625 | - * @return stream|string The raw email data. |
|
626 | - */ |
|
624 | + * @param boolean $stream If true, return a stream resource, otherwise |
|
625 | + * @return stream|string The raw email data. |
|
626 | + */ |
|
627 | 627 | function getRaw($stream=true) |
628 | 628 | { |
629 | 629 | try { |
@@ -636,20 +636,20 @@ discard block |
||
636 | 636 | } |
637 | 637 | // code copied from Horde_Mime_Mail::getRaw(), as there is no way to inject charset in |
638 | 638 | // _headers->toString(), which is required to encode headers containing non-ascii chars correct |
639 | - if ($stream) { |
|
640 | - $hdr = new Horde_Stream(); |
|
641 | - $hdr->add($this->_headers->toString(array('charset' => 'utf-8', 'canonical' => true)), true); |
|
642 | - return Horde_Stream_Wrapper_Combine::getStream( |
|
643 | - array($hdr->stream, |
|
644 | - $this->getBasePart()->toString( |
|
645 | - array('stream' => true, 'canonical' => true, 'encode' => Horde_Mime_Part::ENCODE_7BIT | Horde_Mime_Part::ENCODE_8BIT | Horde_Mime_Part::ENCODE_BINARY)) |
|
646 | - ) |
|
647 | - ); |
|
648 | - } |
|
649 | - |
|
650 | - return $this->_headers->toString(array('charset' => 'utf-8', 'canonical' => true)) . |
|
639 | + if ($stream) { |
|
640 | + $hdr = new Horde_Stream(); |
|
641 | + $hdr->add($this->_headers->toString(array('charset' => 'utf-8', 'canonical' => true)), true); |
|
642 | + return Horde_Stream_Wrapper_Combine::getStream( |
|
643 | + array($hdr->stream, |
|
644 | + $this->getBasePart()->toString( |
|
645 | + array('stream' => true, 'canonical' => true, 'encode' => Horde_Mime_Part::ENCODE_7BIT | Horde_Mime_Part::ENCODE_8BIT | Horde_Mime_Part::ENCODE_BINARY)) |
|
646 | + ) |
|
647 | + ); |
|
648 | + } |
|
649 | + |
|
650 | + return $this->_headers->toString(array('charset' => 'utf-8', 'canonical' => true)) . |
|
651 | 651 | $this->getBasePart()->toString(array('canonical' => true)); |
652 | - } |
|
652 | + } |
|
653 | 653 | |
654 | 654 | /** |
655 | 655 | * Find body: 1. part with mimetype "text/$subtype" |