@@ -97,19 +97,19 @@ discard block |
||
97 | 97 | */ |
98 | 98 | function __construct($dbms=False,$db=null) |
99 | 99 | { |
100 | - if(is_object($db)) |
|
100 | + if(is_object($db)) |
|
101 | 101 | { |
102 | 102 | $this->m_odb = $db; |
103 | - } |
|
104 | - else |
|
105 | - { |
|
103 | + } |
|
104 | + else |
|
105 | + { |
|
106 | 106 | $this->m_odb = isset($GLOBALS['egw']->db) && is_object($GLOBALS['egw']->db) ? $GLOBALS['egw']->db : $GLOBALS['egw_setup']->db; |
107 | - } |
|
108 | - if (!($this->m_odb instanceof egw_db)) |
|
109 | - { |
|
110 | - throw new egw_exception_assertion_failed('no egw_db object!'); |
|
111 | - } |
|
112 | - $this->m_odb->connect(); |
|
107 | + } |
|
108 | + if (!($this->m_odb instanceof egw_db)) |
|
109 | + { |
|
110 | + throw new egw_exception_assertion_failed('no egw_db object!'); |
|
111 | + } |
|
112 | + $this->m_odb->connect(); |
|
113 | 113 | $this->capabilities =& $this->m_odb->capabilities; |
114 | 114 | |
115 | 115 | $this->sType = $dbms ? $dbms : $this->m_odb->Type; |
@@ -825,64 +825,64 @@ discard block |
||
825 | 825 | } |
826 | 826 | |
827 | 827 | /** |
828 | - * Return the value of a column |
|
829 | - * |
|
830 | - * @param string/integer $Name name of field or positional index starting from 0 |
|
831 | - * @param bool $strip_slashes string escape chars from field(optional), default false |
|
832 | - * @return string the field value |
|
833 | - */ |
|
828 | + * Return the value of a column |
|
829 | + * |
|
830 | + * @param string/integer $Name name of field or positional index starting from 0 |
|
831 | + * @param bool $strip_slashes string escape chars from field(optional), default false |
|
832 | + * @return string the field value |
|
833 | + */ |
|
834 | 834 | function f($value,$strip_slashes=False) |
835 | 835 | { |
836 | 836 | return $this->m_odb->f($value,$strip_slashes); |
837 | 837 | } |
838 | 838 | |
839 | 839 | /** |
840 | - * Number of rows in current result set |
|
841 | - * |
|
842 | - * @return int number of rows |
|
843 | - */ |
|
840 | + * Number of rows in current result set |
|
841 | + * |
|
842 | + * @return int number of rows |
|
843 | + */ |
|
844 | 844 | function num_rows() |
845 | 845 | { |
846 | 846 | return $this->m_odb->num_rows(); |
847 | 847 | } |
848 | 848 | |
849 | 849 | /** |
850 | - * Move to the next row in the results set |
|
851 | - * |
|
852 | - * @return bool was another row found? |
|
853 | - */ |
|
850 | + * Move to the next row in the results set |
|
851 | + * |
|
852 | + * @return bool was another row found? |
|
853 | + */ |
|
854 | 854 | function next_record() |
855 | 855 | { |
856 | 856 | return $this->m_odb->next_record(); |
857 | 857 | } |
858 | 858 | |
859 | 859 | /** |
860 | - * Execute a query |
|
861 | - * |
|
862 | - * @param string $Query_String the query to be executed |
|
863 | - * @param mixed $line the line method was called from - use __LINE__ |
|
864 | - * @param string $file the file method was called from - use __FILE__ |
|
865 | - * @param int $offset row to start from |
|
866 | - * @param int $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] |
|
867 | - * @return ADORecordSet or false, if the query fails |
|
868 | - */ |
|
860 | + * Execute a query |
|
861 | + * |
|
862 | + * @param string $Query_String the query to be executed |
|
863 | + * @param mixed $line the line method was called from - use __LINE__ |
|
864 | + * @param string $file the file method was called from - use __FILE__ |
|
865 | + * @param int $offset row to start from |
|
866 | + * @param int $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] |
|
867 | + * @return ADORecordSet or false, if the query fails |
|
868 | + */ |
|
869 | 869 | function query($sQuery, $line='', $file='') |
870 | 870 | { |
871 | 871 | return $this->m_odb->query($sQuery, $line, $file); |
872 | 872 | } |
873 | 873 | |
874 | 874 | /** |
875 | - * Insert a row of data into a table or updates it if $where is given, all data is quoted according to it's type |
|
876 | - * |
|
877 | - * @param string $table name of the table |
|
878 | - * @param array $data with column-name / value pairs |
|
879 | - * @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 |
|
880 | - * if the row exists db::update is called else a new row with $date merged with $where gets inserted (data has precedence) |
|
881 | - * @param int $line line-number to pass to query |
|
882 | - * @param string $file file-name to pass to query |
|
883 | - * @param string $app=false string with name of app, this need to be set in setup anyway!!! |
|
884 | - * @return ADORecordSet or false, if the query fails |
|
885 | - */ |
|
875 | + * Insert a row of data into a table or updates it if $where is given, all data is quoted according to it's type |
|
876 | + * |
|
877 | + * @param string $table name of the table |
|
878 | + * @param array $data with column-name / value pairs |
|
879 | + * @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 |
|
880 | + * if the row exists db::update is called else a new row with $date merged with $where gets inserted (data has precedence) |
|
881 | + * @param int $line line-number to pass to query |
|
882 | + * @param string $file file-name to pass to query |
|
883 | + * @param string $app=false string with name of app, this need to be set in setup anyway!!! |
|
884 | + * @return ADORecordSet or false, if the query fails |
|
885 | + */ |
|
886 | 886 | function insert($table,$data,$where,$line,$file,$app=False,$use_prepared_statement=false) |
887 | 887 | { |
888 | 888 | return $this->m_odb->insert($table,$data,$where,$line,$file,$app,$use_prepared_statement); |
@@ -38,10 +38,10 @@ |
||
38 | 38 | unset($d3); |
39 | 39 | |
40 | 40 | /** |
41 | - * eGroupWare datetime class that contains common date/time functions |
|
42 | - * |
|
43 | - * renamed to egw_datetime to support php5.2 |
|
44 | - */ |
|
41 | + * eGroupWare datetime class that contains common date/time functions |
|
42 | + * |
|
43 | + * renamed to egw_datetime to support php5.2 |
|
44 | + */ |
|
45 | 45 | class egw_datetime |
46 | 46 | { |
47 | 47 | var $zone_offset_list = array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $j = 0; |
120 | 120 | // Add newline |
121 | 121 | if ($i !== $len-1){ |
122 | - echo "\n"; |
|
122 | + echo "\n"; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -544,12 +544,12 @@ discard block |
||
544 | 544 | if(!empty($v[4])){ // + input text box |
545 | 545 | echo '<input type="radio" name="h', $k, '" value="', $j, '"', (((isset($_POST['h'. $k]) && $_POST['h'. $k] == $j) or (!isset($_POST['h'. $k]) && $j == $v[1])) ? ' checked="checked"' : ''), (isset($v['d']) ? ' disabled="disabled"' : ''), ' />'; |
546 | 546 | if(!is_array($v[4])){ |
547 | - echo $v[6], ': <input type="text" size="', $v[4], '" name="h', $k. $j, '" value="', htmlspecialchars(isset($_POST['h'. $k. $j][0]) ? $_POST['h'. $k. $j] : $v[5]), '"', (isset($v['d']) ? ' disabled="disabled"' : ''), ' />'; |
|
547 | + echo $v[6], ': <input type="text" size="', $v[4], '" name="h', $k. $j, '" value="', htmlspecialchars(isset($_POST['h'. $k. $j][0]) ? $_POST['h'. $k. $j] : $v[5]), '"', (isset($v['d']) ? ' disabled="disabled"' : ''), ' />'; |
|
548 | 548 | } |
549 | 549 | else{ |
550 | - foreach($v[4] as $z){ |
|
551 | - echo ' ', $z[3], ': <input type="text" size="', $z[0], '" name="h', $k. $j. $z[1], '" value="', htmlspecialchars(isset($_POST['h'. $k. $j. $z[1]][0]) ? $_POST['h'. $k. $j. $z[1]] : $z[2]), '"', (isset($v['d']) ? ' disabled="disabled"' : ''), ' />'; |
|
552 | - } |
|
550 | + foreach($v[4] as $z){ |
|
551 | + echo ' ', $z[3], ': <input type="text" size="', $z[0], '" name="h', $k. $j. $z[1], '" value="', htmlspecialchars(isset($_POST['h'. $k. $j. $z[1]][0]) ? $_POST['h'. $k. $j. $z[1]] : $z[2]), '"', (isset($v['d']) ? ' disabled="disabled"' : ''), ' />'; |
|
552 | + } |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | } |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | elseif($do < 3 or isset($ok['#pcdata'])){echo $x;} |
205 | 205 | elseif(strpos($x, "\x02\x04")){ |
206 | 206 | foreach(preg_split('`(\x01\x02[^\x01\x02]+\x02\x01)`', $x, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $v){ |
207 | - echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : '')); |
|
207 | + echo (substr($v, 0, 2) == "\x01\x02" ? $v : ($do > 4 ? preg_replace('`\S`', '', $v) : '')); |
|
208 | 208 | } |
209 | 209 | }elseif($do > 4){echo preg_replace('`\S`', '', $x);} |
210 | 210 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | preg_match('`^([a-zA-Z\d\-+.]+://[^/]+)(.*)`', $C['base_url'], $m); |
358 | 358 | $p = preg_replace('`(?<=/)\./`', '', $m[2]. $p); |
359 | 359 | while(preg_match('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', $p)){ |
360 | - $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p); |
|
360 | + $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p); |
|
361 | 361 | } |
362 | 362 | $p = $m[1]. $p; |
363 | 363 | } |
@@ -471,20 +471,20 @@ discard block |
||
471 | 471 | switch($mode){ |
472 | 472 | case 0: // Name |
473 | 473 | if(preg_match('`^[a-zA-Z][\-a-zA-Z:]+`', $a, $m)){ |
474 | - $nm = strtolower($m[0]); |
|
475 | - $w = $mode = 1; $a = ltrim(substr_replace($a, '', 0, strlen($m[0]))); |
|
474 | + $nm = strtolower($m[0]); |
|
475 | + $w = $mode = 1; $a = ltrim(substr_replace($a, '', 0, strlen($m[0]))); |
|
476 | 476 | } |
477 | 477 | break; case 1: |
478 | 478 | if($a[0] == '='){ // = |
479 | - $w = 1; $mode = 2; $a = ltrim($a, '= '); |
|
479 | + $w = 1; $mode = 2; $a = ltrim($a, '= '); |
|
480 | 480 | }else{ // No val |
481 | - $w = 1; $mode = 0; $a = ltrim($a); |
|
482 | - $aA[$nm] = ''; |
|
481 | + $w = 1; $mode = 0; $a = ltrim($a); |
|
482 | + $aA[$nm] = ''; |
|
483 | 483 | } |
484 | 484 | break; case 2: // Val |
485 | 485 | if(preg_match('`^((?:"[^"]*")|(?:\'[^\']*\')|(?:\s*[^\s"\']+))(.*)`', $a, $m)){ |
486 | - $a = ltrim($m[2]); $m = $m[1]; $w = 1; $mode = 0; |
|
487 | - $aA[$nm] = trim(($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m); |
|
486 | + $a = ltrim($m[2]); $m = $m[1]; $w = 1; $mode = 0; |
|
487 | + $aA[$nm] = trim(($m[0] == '"' or $m[0] == '\'') ? substr($m, 1, -1) : $m); |
|
488 | 488 | } |
489 | 489 | break; |
490 | 490 | } |
@@ -507,8 +507,8 @@ discard block |
||
507 | 507 | } |
508 | 508 | if($k == 'style' && !$C['style_pass']){ |
509 | 509 | if(false !== strpos($v, '&#')){ |
510 | - static $sC = array(' '=>' ', ' '=>' ', 'E'=>'e', 'E'=>'e', 'e'=>'e', 'e'=>'e', 'X'=>'x', 'X'=>'x', 'x'=>'x', 'x'=>'x', 'P'=>'p', 'P'=>'p', 'p'=>'p', 'p'=>'p', 'S'=>'s', 'S'=>'s', 's'=>'s', 's'=>'s', 'I'=>'i', 'I'=>'i', 'i'=>'i', 'i'=>'i', 'O'=>'o', 'O'=>'o', 'o'=>'o', 'o'=>'o', 'N'=>'n', 'N'=>'n', 'n'=>'n', 'n'=>'n', 'U'=>'u', 'U'=>'u', 'u'=>'u', 'u'=>'u', 'R'=>'r', 'R'=>'r', 'r'=>'r', 'r'=>'r', 'L'=>'l', 'L'=>'l', 'l'=>'l', 'l'=>'l', '('=>'(', '('=>'(', ')'=>')', ')'=>')', ' '=>':', ' '=>':', '"'=>'"', '"'=>'"', '''=>"'", '''=>"'", '/'=>'/', '/'=>'/', '*'=>'*', '*'=>'*', '\'=>'\\', '\'=>'\\'); |
|
511 | - $v = strtr($v, $sC); |
|
510 | + static $sC = array(' '=>' ', ' '=>' ', 'E'=>'e', 'E'=>'e', 'e'=>'e', 'e'=>'e', 'X'=>'x', 'X'=>'x', 'x'=>'x', 'x'=>'x', 'P'=>'p', 'P'=>'p', 'p'=>'p', 'p'=>'p', 'S'=>'s', 'S'=>'s', 's'=>'s', 's'=>'s', 'I'=>'i', 'I'=>'i', 'i'=>'i', 'i'=>'i', 'O'=>'o', 'O'=>'o', 'o'=>'o', 'o'=>'o', 'N'=>'n', 'N'=>'n', 'n'=>'n', 'n'=>'n', 'U'=>'u', 'U'=>'u', 'u'=>'u', 'u'=>'u', 'R'=>'r', 'R'=>'r', 'r'=>'r', 'r'=>'r', 'L'=>'l', 'L'=>'l', 'l'=>'l', 'l'=>'l', '('=>'(', '('=>'(', ')'=>')', ')'=>')', ' '=>':', ' '=>':', '"'=>'"', '"'=>'"', '''=>"'", '''=>"'", '/'=>'/', '/'=>'/', '*'=>'*', '*'=>'*', '\'=>'\\', '\'=>'\\'); |
|
511 | + $v = strtr($v, $sC); |
|
512 | 512 | } |
513 | 513 | $v = preg_replace_callback('`(url(?:\()(?: )*(?:\'|"|&(?:quot|apos);)?)(.+?)((?:\'|"|&(?:quot|apos);)?(?: )*(?:\)))`iS', 'hl_prot', $v); |
514 | 514 | $v = !$C['css_expression'] ? preg_replace('`expression`i', ' ', preg_replace('`\\\\\S|(/|(%2f))(\*|(%2a))`i', ' ', $v)) : $v; |
@@ -516,20 +516,20 @@ discard block |
||
516 | 516 | $v = str_replace("\xad", ' ', (strpos($v, '&') !== false ? str_replace(array('­', '­', '­'), ' ', $v) : $v)); |
517 | 517 | $v = hl_prot($v, $k); |
518 | 518 | if($k == 'href'){ // X-spam |
519 | - if($C['anti_mail_spam'] && strpos($v, 'mailto:') === 0){ |
|
520 | - $v = str_replace('@', htmlspecialchars($C['anti_mail_spam']), $v); |
|
521 | - }elseif($C['anti_link_spam']){ |
|
522 | - $r1 = $C['anti_link_spam'][1]; |
|
523 | - if(!empty($r1) && preg_match($r1, $v)){continue;} |
|
524 | - $r0 = $C['anti_link_spam'][0]; |
|
525 | - if(!empty($r0) && preg_match($r0, $v)){ |
|
526 | - if(isset($a['rel'])){ |
|
527 | - if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';} |
|
528 | - }elseif(isset($aA['rel'])){ |
|
529 | - if(!preg_match('`\bnofollow\b`i', $aA['rel'])){$nfr = 1;} |
|
530 | - }else{$a['rel'] = 'nofollow';} |
|
531 | - } |
|
532 | - } |
|
519 | + if($C['anti_mail_spam'] && strpos($v, 'mailto:') === 0){ |
|
520 | + $v = str_replace('@', htmlspecialchars($C['anti_mail_spam']), $v); |
|
521 | + }elseif($C['anti_link_spam']){ |
|
522 | + $r1 = $C['anti_link_spam'][1]; |
|
523 | + if(!empty($r1) && preg_match($r1, $v)){continue;} |
|
524 | + $r0 = $C['anti_link_spam'][0]; |
|
525 | + if(!empty($r0) && preg_match($r0, $v)){ |
|
526 | + if(isset($a['rel'])){ |
|
527 | + if(!preg_match('`\bnofollow\b`i', $a['rel'])){$a['rel'] .= ' nofollow';} |
|
528 | + }elseif(isset($aA['rel'])){ |
|
529 | + if(!preg_match('`\bnofollow\b`i', $aA['rel'])){$nfr = 1;} |
|
530 | + }else{$a['rel'] = 'nofollow';} |
|
531 | + } |
|
532 | + } |
|
533 | 533 | } |
534 | 534 | } |
535 | 535 | if(isset($rl[$k]) && is_array($rl[$k]) && ($v = hl_attrval($v, $rl[$k])) === 0){continue;} |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | $e = "<$e>"; |
686 | 686 | if(isset($d[$y])){ |
687 | 687 | if(!$x){ |
688 | - if($n){echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n);} |
|
689 | - else{++$N; ob_end_clean(); continue 2;} |
|
688 | + if($n){echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n);} |
|
689 | + else{++$N; ob_end_clean(); continue 2;} |
|
690 | 690 | } |
691 | 691 | else{echo "\n", str_repeat($s, $n), "$e\n", str_repeat($s, ($x != 1 ? ++$n : $n));} |
692 | 692 | echo $r; continue; |
@@ -214,7 +214,7 @@ |
||
214 | 214 | public function set_visible($val) |
215 | 215 | { |
216 | 216 | if ($this->visibility != EGW_COL_VISIBILITY_ALWAYS && |
217 | - $this->visibility != EGW_COL_VISIBILITY_ALWAYS_NOSELECT) |
|
217 | + $this->visibility != EGW_COL_VISIBILITY_ALWAYS_NOSELECT) |
|
218 | 218 | { |
219 | 219 | $this->visibility = $val ? EGW_COL_VISIBILITY_VISIBLE : EGW_COL_VISIBILITY_INVISIBLE; |
220 | 220 | } |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | } |
739 | 739 | |
740 | 740 | /** |
741 | - * provides centralization and compatibility to locate the lang files |
|
742 | - * |
|
743 | - * @param string $app application name |
|
744 | - * @param string $lang language code |
|
745 | - * @return the full path of the filename for the requested app and language |
|
746 | - */ |
|
741 | + * provides centralization and compatibility to locate the lang files |
|
742 | + * |
|
743 | + * @param string $app application name |
|
744 | + * @param string $lang language code |
|
745 | + * @return the full path of the filename for the requested app and language |
|
746 | + */ |
|
747 | 747 | static function get_lang_file($app,$lang) |
748 | 748 | { |
749 | 749 | if ($app == 'common') $app = 'phpgwapi'; |
@@ -1074,13 +1074,13 @@ discard block |
||
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | /** |
1077 | - * detect_encoding - try to detect the encoding |
|
1078 | - * only to be used if the string in question has no structure that determines his encoding |
|
1079 | - * |
|
1080 | - * @param string - to be evaluated |
|
1081 | - * @param string $verify =null encoding to verify, get checked first and have a match for only ascii or no detection available |
|
1082 | - * @return string - encoding |
|
1083 | - */ |
|
1077 | + * detect_encoding - try to detect the encoding |
|
1078 | + * only to be used if the string in question has no structure that determines his encoding |
|
1079 | + * |
|
1080 | + * @param string - to be evaluated |
|
1081 | + * @param string $verify =null encoding to verify, get checked first and have a match for only ascii or no detection available |
|
1082 | + * @return string - encoding |
|
1083 | + */ |
|
1084 | 1084 | static function detect_encoding($string, $verify=null) |
1085 | 1085 | { |
1086 | 1086 | if (function_exists('iconv')) |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | } |
481 | 481 | $ids = Link\Storage::get_links($app, $id, $only_app, $order, $deleted, $limit); |
482 | 482 | if (empty($only_app) || $only_app == self::VFS_APPNAME || |
483 | - ($only_app[0] == '!' && $only_app != '!'.self::VFS_APPNAME)) |
|
483 | + ($only_app[0] == '!' && $only_app != '!'.self::VFS_APPNAME)) |
|
484 | 484 | { |
485 | 485 | if (($vfs_ids = self::list_attached($app,$id))) |
486 | 486 | { |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $links = Link\Storage::get_links($app,$ids,$only_app,$order,$deleted); |
537 | 537 | |
538 | 538 | if (empty($only_app) || $only_app == self::VFS_APPNAME || |
539 | - ($only_app[0] == '!' && $only_app != '!'.self::VFS_APPNAME)) |
|
539 | + ($only_app[0] == '!' && $only_app != '!'.self::VFS_APPNAME)) |
|
540 | 540 | { |
541 | 541 | // todo do that in a single query, eg. directory listing, too |
542 | 542 | foreach($ids as $id) |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | |
794 | 794 | if (!isset($options['total'])) |
795 | 795 | { |
796 | - $options['total'] = count($result); |
|
796 | + $options['total'] = count($result); |
|
797 | 797 | } |
798 | 798 | if (is_array($result) && (isset($options['start']) || (isset($options['num_rows']) && count($result) > $options['num_rows']))) |
799 | 799 | { |
@@ -68,7 +68,7 @@ |
||
68 | 68 | @function version_check |
69 | 69 | @abstract check version of this wrapper with installed savant2 version and halts when version differs |
70 | 70 | @return void |
71 | - */ |
|
71 | + */ |
|
72 | 72 | function version_check() |
73 | 73 | { |
74 | 74 | $Sav2Version = @file_get_contents(EGW_INCLUDE_ROOT.'/phpgwapi/inc/savant2/VERSION',"rb"); |
@@ -266,7 +266,7 @@ |
||
266 | 266 | /** |
267 | 267 | * Add or/update a single application hook |
268 | 268 | * |
269 | - * setup file of app will be included and the hook required will be added/or updated |
|
269 | + * setup file of app will be included and the hook required will be added/or updated |
|
270 | 270 | * |
271 | 271 | * @param string $appname Application 'name' |
272 | 272 | * @param string $location is required, the hook itself |