@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | return; // not found, should not happen |
| 673 | 673 | } |
| 674 | 674 | if ($type && (($type == 'd') == !($stat['mode'] & Vfs\Sqlfs\StreamWrapper::MODE_DIR) || // != is_dir() which can be true for symlinks |
| 675 | - $type == 'F' && is_dir($path))) // symlink to a directory |
|
| 675 | + $type == 'F' && is_dir($path))) // symlink to a directory |
|
| 676 | 676 | { |
| 677 | 677 | return; // wrong type |
| 678 | 678 | } |
@@ -1621,13 +1621,13 @@ discard block |
||
| 1621 | 1621 | { |
| 1622 | 1622 | return false; |
| 1623 | 1623 | } |
| 1624 | - // remove the lock info evtl. set in the cache |
|
| 1625 | - unset(self::$lock_cache[$path]); |
|
| 1624 | + // remove the lock info evtl. set in the cache |
|
| 1625 | + unset(self::$lock_cache[$path]); |
|
| 1626 | 1626 | |
| 1627 | - if ($timeout < 1000000) // < 1000000 is a relative timestamp, so we add the current time |
|
| 1628 | - { |
|
| 1629 | - $timeout += time(); |
|
| 1630 | - } |
|
| 1627 | + if ($timeout < 1000000) // < 1000000 is a relative timestamp, so we add the current time |
|
| 1628 | + { |
|
| 1629 | + $timeout += time(); |
|
| 1630 | + } |
|
| 1631 | 1631 | |
| 1632 | 1632 | if ($update) // Lock Update |
| 1633 | 1633 | { |
@@ -1688,32 +1688,32 @@ discard block |
||
| 1688 | 1688 | return $ret; |
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | - /** |
|
| 1692 | - * unlock a ressource/path |
|
| 1693 | - * |
|
| 1694 | - * @param string $path path to unlock |
|
| 1695 | - * @param string $token locktoken |
|
| 1691 | + /** |
|
| 1692 | + * unlock a ressource/path |
|
| 1693 | + * |
|
| 1694 | + * @param string $path path to unlock |
|
| 1695 | + * @param string $token locktoken |
|
| 1696 | 1696 | * @param boolean $check_writable =true should we check if the ressource is writable, before granting locks, default yes |
| 1697 | - * @return boolean true on success |
|
| 1698 | - */ |
|
| 1699 | - static function unlock($path,$token,$check_writable=true) |
|
| 1700 | - { |
|
| 1697 | + * @return boolean true on success |
|
| 1698 | + */ |
|
| 1699 | + static function unlock($path,$token,$check_writable=true) |
|
| 1700 | + { |
|
| 1701 | 1701 | // we require write rights to lock/unlock a resource |
| 1702 | 1702 | if ($check_writable && !self::is_writable($path)) |
| 1703 | 1703 | { |
| 1704 | 1704 | return false; |
| 1705 | 1705 | } |
| 1706 | - if (($ret = self::$db->delete(self::LOCK_TABLE,array( |
|
| 1707 | - 'lock_path' => $path, |
|
| 1708 | - 'lock_token' => $token, |
|
| 1709 | - ),__LINE__,__FILE__) && self::$db->affected_rows())) |
|
| 1710 | - { |
|
| 1711 | - // remove the lock from the cache too |
|
| 1712 | - unset(self::$lock_cache[$path]); |
|
| 1713 | - } |
|
| 1706 | + if (($ret = self::$db->delete(self::LOCK_TABLE,array( |
|
| 1707 | + 'lock_path' => $path, |
|
| 1708 | + 'lock_token' => $token, |
|
| 1709 | + ),__LINE__,__FILE__) && self::$db->affected_rows())) |
|
| 1710 | + { |
|
| 1711 | + // remove the lock from the cache too |
|
| 1712 | + unset(self::$lock_cache[$path]); |
|
| 1713 | + } |
|
| 1714 | 1714 | if (self::LOCK_DEBUG) error_log(__METHOD__."($path,$token,$check_writable) returns ".($ret ? 'true' : 'false')); |
| 1715 | 1715 | return $ret; |
| 1716 | - } |
|
| 1716 | + } |
|
| 1717 | 1717 | |
| 1718 | 1718 | /** |
| 1719 | 1719 | * checkLock() helper |
@@ -1741,13 +1741,13 @@ discard block |
||
| 1741 | 1741 | } |
| 1742 | 1742 | if ($result && $result['expires'] < time()) // lock is expired --> remove it |
| 1743 | 1743 | { |
| 1744 | - self::$db->delete(self::LOCK_TABLE,array( |
|
| 1745 | - 'lock_path' => $result['path'], |
|
| 1746 | - 'lock_token' => $result['token'], |
|
| 1747 | - ),__LINE__,__FILE__); |
|
| 1744 | + self::$db->delete(self::LOCK_TABLE,array( |
|
| 1745 | + 'lock_path' => $result['path'], |
|
| 1746 | + 'lock_token' => $result['token'], |
|
| 1747 | + ),__LINE__,__FILE__); |
|
| 1748 | 1748 | |
| 1749 | 1749 | if (self::LOCK_DEBUG) error_log(__METHOD__."($path) lock is expired at ".date('Y-m-d H:i:s',$result['expires'])." --> removed"); |
| 1750 | - $result = false; |
|
| 1750 | + $result = false; |
|
| 1751 | 1751 | } |
| 1752 | 1752 | if (self::LOCK_DEBUG) error_log(__METHOD__."($path) returns ".($result?array2string($result):'false')); |
| 1753 | 1753 | return self::$lock_cache[$path] = $result; |
@@ -1887,9 +1887,9 @@ discard block |
||
| 1887 | 1887 | $image = Image::find($mime_sub, 'navbar'); |
| 1888 | 1888 | } |
| 1889 | 1889 | else if ($file && $mime_main == 'image' && in_array($mime_sub, array('png','jpeg','jpg','gif','bmp')) && |
| 1890 | - (string)$GLOBALS['egw_info']['server']['link_list_thumbnail'] != '0' && |
|
| 1891 | - (string)$GLOBALS['egw_info']['user']['preferences']['common']['link_list_thumbnail'] != '0' && |
|
| 1892 | - ($stat = self::stat($file)) && $stat['size'] < 1500000) |
|
| 1890 | + (string)$GLOBALS['egw_info']['server']['link_list_thumbnail'] != '0' && |
|
| 1891 | + (string)$GLOBALS['egw_info']['user']['preferences']['common']['link_list_thumbnail'] != '0' && |
|
| 1892 | + ($stat = self::stat($file)) && $stat['size'] < 1500000) |
|
| 1893 | 1893 | { |
| 1894 | 1894 | if (substr($file, 0, 6) == '/apps/') |
| 1895 | 1895 | { |
@@ -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 | ), |
@@ -1367,14 +1367,14 @@ |
||
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | /** |
| 1370 | - * Get a default list of columns to search |
|
| 1371 | - * This is to be used as a fallback, for when the extending class does not define |
|
| 1372 | - * $this->columns_to_search. All the columns are considered, and any with $skip_columns_with in |
|
| 1373 | - * their name are discarded because these columns are expected to be foreign keys or other numeric |
|
| 1374 | - * values with no meaning to the user. |
|
| 1375 | - * |
|
| 1376 | - * @return array of column names |
|
| 1377 | - */ |
|
| 1370 | + * Get a default list of columns to search |
|
| 1371 | + * This is to be used as a fallback, for when the extending class does not define |
|
| 1372 | + * $this->columns_to_search. All the columns are considered, and any with $skip_columns_with in |
|
| 1373 | + * their name are discarded because these columns are expected to be foreign keys or other numeric |
|
| 1374 | + * values with no meaning to the user. |
|
| 1375 | + * |
|
| 1376 | + * @return array of column names |
|
| 1377 | + */ |
|
| 1378 | 1378 | protected function get_default_search_columns() |
| 1379 | 1379 | { |
| 1380 | 1380 | $skip_columns_with = array('_id', 'modified', 'modifier', 'status', 'cat_id', 'owner'); |
@@ -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 .... |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | function __construct($dbms=False, Api\Db $db=null) |
| 103 | 103 | { |
| 104 | - if(is_object($db)) |
|
| 104 | + if(is_object($db)) |
|
| 105 | 105 | { |
| 106 | 106 | $this->m_odb = $db; |
| 107 | - } |
|
| 108 | - else |
|
| 109 | - { |
|
| 107 | + } |
|
| 108 | + else |
|
| 109 | + { |
|
| 110 | 110 | $this->m_odb = isset($GLOBALS['egw']->db) && is_object($GLOBALS['egw']->db) ? $GLOBALS['egw']->db : $GLOBALS['egw_setup']->db; |
| 111 | - } |
|
| 112 | - if (!($this->m_odb instanceof Api\Db)) |
|
| 113 | - { |
|
| 114 | - throw new Api\Exception\AssertionFailed('no EGroupware\Api\Db object!'); |
|
| 115 | - } |
|
| 116 | - $this->m_odb->connect(); |
|
| 111 | + } |
|
| 112 | + if (!($this->m_odb instanceof Api\Db)) |
|
| 113 | + { |
|
| 114 | + throw new Api\Exception\AssertionFailed('no EGroupware\Api\Db object!'); |
|
| 115 | + } |
|
| 116 | + $this->m_odb->connect(); |
|
| 117 | 117 | $this->capabilities =& $this->m_odb->capabilities; |
| 118 | 118 | |
| 119 | 119 | $this->sType = $dbms ? $dbms : $this->m_odb->Type; |
@@ -828,79 +828,79 @@ discard block |
||
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | /** |
| 831 | - * Return the value of a column |
|
| 832 | - * |
|
| 833 | - * @param string|integer $value name of field or positional index starting from 0 |
|
| 834 | - * @param bool $strip_slashes string escape chars from field(optional), default false |
|
| 835 | - * @deprecated use result-set returned by query/select |
|
| 836 | - * @return string the field value |
|
| 837 | - */ |
|
| 831 | + * Return the value of a column |
|
| 832 | + * |
|
| 833 | + * @param string|integer $value name of field or positional index starting from 0 |
|
| 834 | + * @param bool $strip_slashes string escape chars from field(optional), default false |
|
| 835 | + * @deprecated use result-set returned by query/select |
|
| 836 | + * @return string the field value |
|
| 837 | + */ |
|
| 838 | 838 | function f($value,$strip_slashes=False) |
| 839 | 839 | { |
| 840 | 840 | if (!($this->m_odb instanceof Deprecated)) |
| 841 | 841 | { |
| 842 | - throw new Api\Exception\AssertionFailed(__METHOD__.' requires an EGroupware\Api\Db\Deprecated object!'); |
|
| 842 | + throw new Api\Exception\AssertionFailed(__METHOD__.' requires an EGroupware\Api\Db\Deprecated object!'); |
|
| 843 | 843 | } |
| 844 | 844 | return $this->m_odb->f($value,$strip_slashes); |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | /** |
| 848 | - * Number of rows in current result set |
|
| 849 | - * |
|
| 850 | - * @deprecated use result-set returned by query/select |
|
| 851 | - * @return int number of rows |
|
| 852 | - */ |
|
| 848 | + * Number of rows in current result set |
|
| 849 | + * |
|
| 850 | + * @deprecated use result-set returned by query/select |
|
| 851 | + * @return int number of rows |
|
| 852 | + */ |
|
| 853 | 853 | function num_rows() |
| 854 | 854 | { |
| 855 | 855 | if (!($this->m_odb instanceof Deprecated)) |
| 856 | 856 | { |
| 857 | - throw new Api\Exception\AssertionFailed(__METHOD__.' requires an EGroupware\Api\Db\Deprecated object!'); |
|
| 857 | + throw new Api\Exception\AssertionFailed(__METHOD__.' requires an EGroupware\Api\Db\Deprecated object!'); |
|
| 858 | 858 | } |
| 859 | 859 | return $this->m_odb->num_rows(); |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | - * Move to the next row in the results set |
|
| 864 | - * |
|
| 865 | - * @deprecated use result-set returned by query/select |
|
| 866 | - * @return bool was another row found? |
|
| 867 | - */ |
|
| 863 | + * Move to the next row in the results set |
|
| 864 | + * |
|
| 865 | + * @deprecated use result-set returned by query/select |
|
| 866 | + * @return bool was another row found? |
|
| 867 | + */ |
|
| 868 | 868 | function next_record() |
| 869 | 869 | { |
| 870 | 870 | if (!($this->m_odb instanceof Deprecated)) |
| 871 | 871 | { |
| 872 | - throw new Api\Exception\AssertionFailed(__METHOD__.' requires an EGroupware\Api\Db\Deprecated object!'); |
|
| 872 | + throw new Api\Exception\AssertionFailed(__METHOD__.' requires an EGroupware\Api\Db\Deprecated object!'); |
|
| 873 | 873 | } |
| 874 | 874 | return $this->m_odb->next_record(); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | 877 | /** |
| 878 | - * Execute a query |
|
| 879 | - * |
|
| 880 | - * @param string $Query_String the query to be executed |
|
| 881 | - * @param mixed $line the line method was called from - use __LINE__ |
|
| 882 | - * @param string $file the file method was called from - use __FILE__ |
|
| 883 | - * @param int $offset row to start from |
|
| 884 | - * @param int $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] |
|
| 885 | - * @return ADORecordSet or false, if the query fails |
|
| 886 | - */ |
|
| 878 | + * Execute a query |
|
| 879 | + * |
|
| 880 | + * @param string $Query_String the query to be executed |
|
| 881 | + * @param mixed $line the line method was called from - use __LINE__ |
|
| 882 | + * @param string $file the file method was called from - use __FILE__ |
|
| 883 | + * @param int $offset row to start from |
|
| 884 | + * @param int $num_rows number of rows to return (optional), if unset will use $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] |
|
| 885 | + * @return ADORecordSet or false, if the query fails |
|
| 886 | + */ |
|
| 887 | 887 | function query($sQuery, $line='', $file='') |
| 888 | 888 | { |
| 889 | 889 | return $this->m_odb->query($sQuery, $line, $file); |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | - * Insert a row of data into a table or updates it if $where is given, all data is quoted according to it's type |
|
| 894 | - * |
|
| 895 | - * @param string $table name of the table |
|
| 896 | - * @param array $data with column-name / value pairs |
|
| 897 | - * @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 |
|
| 898 | - * if the row exists db::update is called else a new row with $date merged with $where gets inserted (data has precedence) |
|
| 899 | - * @param int $line line-number to pass to query |
|
| 900 | - * @param string $file file-name to pass to query |
|
| 901 | - * @param string $app=false string with name of app, this need to be set in setup anyway!!! |
|
| 902 | - * @return ADORecordSet or false, if the query fails |
|
| 903 | - */ |
|
| 893 | + * Insert a row of data into a table or updates it if $where is given, all data is quoted according to it's type |
|
| 894 | + * |
|
| 895 | + * @param string $table name of the table |
|
| 896 | + * @param array $data with column-name / value pairs |
|
| 897 | + * @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 |
|
| 898 | + * if the row exists db::update is called else a new row with $date merged with $where gets inserted (data has precedence) |
|
| 899 | + * @param int $line line-number to pass to query |
|
| 900 | + * @param string $file file-name to pass to query |
|
| 901 | + * @param string $app=false string with name of app, this need to be set in setup anyway!!! |
|
| 902 | + * @return ADORecordSet or false, if the query fails |
|
| 903 | + */ |
|
| 904 | 904 | function insert($table,$data,$where,$line,$file,$app=False,$use_prepared_statement=false) |
| 905 | 905 | { |
| 906 | 906 | return $this->m_odb->insert($table,$data,$where,$line,$file,$app,$use_prepared_statement); |
@@ -41,19 +41,19 @@ discard block |
||
| 41 | 41 | var $Query_ID = 0; |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * Execute a query |
|
| 45 | - * |
|
| 46 | - * @param string $Query_String the query to be executed |
|
| 47 | - * @param int $line the line method was called from - use __LINE__ |
|
| 48 | - * @param string $file the file method was called from - use __FILE__ |
|
| 49 | - * @param int $offset row to start from, default 0 |
|
| 50 | - * @param int $num_rows number of rows to return (optional), default -1 = all, 0 will use $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] |
|
| 51 | - * @param array|boolean $inputarr array for binding variables to parameters or false (default) |
|
| 52 | - * @param int $fetchmode =self::FETCH_BOTH self::FETCH_BOTH (default), self::FETCH_ASSOC or self::FETCH_NUM |
|
| 53 | - * @param boolean $reconnect =true true: try reconnecting if server closes connection, false: dont (mysql only!) |
|
| 54 | - * @return ADORecordSet or false, if the query fails |
|
| 55 | - * @throws EGroupware\Api\Db\Exception\InvalidSql with $this->Link_ID->ErrorNo() as code |
|
| 56 | - */ |
|
| 44 | + * Execute a query |
|
| 45 | + * |
|
| 46 | + * @param string $Query_String the query to be executed |
|
| 47 | + * @param int $line the line method was called from - use __LINE__ |
|
| 48 | + * @param string $file the file method was called from - use __FILE__ |
|
| 49 | + * @param int $offset row to start from, default 0 |
|
| 50 | + * @param int $num_rows number of rows to return (optional), default -1 = all, 0 will use $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] |
|
| 51 | + * @param array|boolean $inputarr array for binding variables to parameters or false (default) |
|
| 52 | + * @param int $fetchmode =self::FETCH_BOTH self::FETCH_BOTH (default), self::FETCH_ASSOC or self::FETCH_NUM |
|
| 53 | + * @param boolean $reconnect =true true: try reconnecting if server closes connection, false: dont (mysql only!) |
|
| 54 | + * @return ADORecordSet or false, if the query fails |
|
| 55 | + * @throws EGroupware\Api\Db\Exception\InvalidSql with $this->Link_ID->ErrorNo() as code |
|
| 56 | + */ |
|
| 57 | 57 | function query($Query_String, $line = '', $file = '', $offset=0, $num_rows=-1, $inputarr=false, $fetchmode=self::FETCH_BOTH, $reconnect=true) |
| 58 | 58 | { |
| 59 | 59 | // New query, discard previous result. |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | /** |
| 79 | - * Escape strings before sending them to the database |
|
| 80 | - * |
|
| 81 | - * @deprecated use quote($value,$type='') instead |
|
| 82 | - * @param string $str the string to be escaped |
|
| 83 | - * @return string escaped sting |
|
| 84 | - */ |
|
| 79 | + * Escape strings before sending them to the database |
|
| 80 | + * |
|
| 81 | + * @deprecated use quote($value,$type='') instead |
|
| 82 | + * @param string $str the string to be escaped |
|
| 83 | + * @return string escaped sting |
|
| 84 | + */ |
|
| 85 | 85 | function db_addslashes($str) |
| 86 | 86 | { |
| 87 | 87 | if (!isset($str) || $str == '') |
@@ -107,14 +107,14 @@ discard block |
||
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | - * Move to the next row in the results set |
|
| 111 | - * |
|
| 112 | - * Specifying a fetch_mode only works for newly fetched rows, the first row always gets fetched by query!!! |
|
| 113 | - * |
|
| 114 | - * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
| 115 | - * @param int $fetch_mode self::FETCH_BOTH = numerical+assoc keys (eGW default), self::FETCH_ASSOC or self::FETCH_NUM |
|
| 116 | - * @return bool was another row found? |
|
| 117 | - */ |
|
| 110 | + * Move to the next row in the results set |
|
| 111 | + * |
|
| 112 | + * Specifying a fetch_mode only works for newly fetched rows, the first row always gets fetched by query!!! |
|
| 113 | + * |
|
| 114 | + * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
| 115 | + * @param int $fetch_mode self::FETCH_BOTH = numerical+assoc keys (eGW default), self::FETCH_ASSOC or self::FETCH_NUM |
|
| 116 | + * @return bool was another row found? |
|
| 117 | + */ |
|
| 118 | 118 | function next_record($fetch_mode=self::FETCH_BOTH) |
| 119 | 119 | { |
| 120 | 120 | if (!$this->Query_ID) |
@@ -164,12 +164,12 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | /** |
| 167 | - * Move to position in result set |
|
| 168 | - * |
|
| 169 | - * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 170 | - * @param int $pos required row (optional), default first row |
|
| 171 | - * @return boolean true if sucessful or false if not found |
|
| 172 | - */ |
|
| 167 | + * Move to position in result set |
|
| 168 | + * |
|
| 169 | + * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 170 | + * @param int $pos required row (optional), default first row |
|
| 171 | + * @return boolean true if sucessful or false if not found |
|
| 172 | + */ |
|
| 173 | 173 | function seek($pos = 0) |
| 174 | 174 | { |
| 175 | 175 | if (!$this->Query_ID || !$this->Query_ID->Move($this->Row = $pos)) |
@@ -180,74 +180,74 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
| 183 | - * Lock a table |
|
| 184 | - * |
|
| 185 | - * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
| 186 | - * @param string $table name of table to lock |
|
| 187 | - * @param string $mode type of lock required (optional), default write |
|
| 188 | - * @return bool True if sucessful, False if fails |
|
| 189 | - */ |
|
| 183 | + * Lock a table |
|
| 184 | + * |
|
| 185 | + * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
| 186 | + * @param string $table name of table to lock |
|
| 187 | + * @param string $mode type of lock required (optional), default write |
|
| 188 | + * @return bool True if sucessful, False if fails |
|
| 189 | + */ |
|
| 190 | 190 | function lock($table, $mode='write') |
| 191 | 191 | { |
| 192 | 192 | unset($table, $mode); // not used anymore |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | /** |
| 196 | - * Unlock a table |
|
| 197 | - * |
|
| 198 | - * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
| 199 | - * @return bool True if sucessful, False if fails |
|
| 200 | - */ |
|
| 196 | + * Unlock a table |
|
| 197 | + * |
|
| 198 | + * @deprecated not used anymore as it costs to much performance, use transactions if needed |
|
| 199 | + * @return bool True if sucessful, False if fails |
|
| 200 | + */ |
|
| 201 | 201 | function unlock() |
| 202 | 202 | {} |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | - * Number of rows in current result set |
|
| 206 | - * |
|
| 207 | - * @deprecated use the result-object returned by query/select()->NumRows(), so you can use the global db-object and not a clone |
|
| 208 | - * @return int number of rows |
|
| 209 | - */ |
|
| 205 | + * Number of rows in current result set |
|
| 206 | + * |
|
| 207 | + * @deprecated use the result-object returned by query/select()->NumRows(), so you can use the global db-object and not a clone |
|
| 208 | + * @return int number of rows |
|
| 209 | + */ |
|
| 210 | 210 | function num_rows() |
| 211 | 211 | { |
| 212 | 212 | return $this->Query_ID ? $this->Query_ID->RecordCount() : False; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
| 216 | - * Number of fields in current row |
|
| 217 | - * |
|
| 218 | - * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 219 | - * @return int number of fields |
|
| 220 | - */ |
|
| 216 | + * Number of fields in current row |
|
| 217 | + * |
|
| 218 | + * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 219 | + * @return int number of fields |
|
| 220 | + */ |
|
| 221 | 221 | function num_fields() |
| 222 | 222 | { |
| 223 | 223 | return $this->Query_ID ? $this->Query_ID->FieldCount() : False; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | /** |
| 227 | - * @deprecated use num_rows() |
|
| 228 | - */ |
|
| 227 | + * @deprecated use num_rows() |
|
| 228 | + */ |
|
| 229 | 229 | function nf() |
| 230 | 230 | { |
| 231 | 231 | return $this->num_rows(); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
| 235 | - * @deprecated use print num_rows() |
|
| 236 | - */ |
|
| 235 | + * @deprecated use print num_rows() |
|
| 236 | + */ |
|
| 237 | 237 | function np() |
| 238 | 238 | { |
| 239 | 239 | print $this->num_rows(); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | - * Return the value of a column |
|
| 244 | - * |
|
| 245 | - * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 246 | - * @param string|integer $Name name of field or positional index starting from 0 |
|
| 247 | - * @param bool $strip_slashes string escape chars from field(optional), default false |
|
| 248 | - * depricated param, as correctly quoted values dont need any stripslashes! |
|
| 249 | - * @return string the field value |
|
| 250 | - */ |
|
| 243 | + * Return the value of a column |
|
| 244 | + * |
|
| 245 | + * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 246 | + * @param string|integer $Name name of field or positional index starting from 0 |
|
| 247 | + * @param bool $strip_slashes string escape chars from field(optional), default false |
|
| 248 | + * depricated param, as correctly quoted values dont need any stripslashes! |
|
| 249 | + * @return string the field value |
|
| 250 | + */ |
|
| 251 | 251 | function f($Name, $strip_slashes = False) |
| 252 | 252 | { |
| 253 | 253 | if ($strip_slashes) |
@@ -258,26 +258,26 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | /** |
| 261 | - * Print the value of a field |
|
| 262 | - * |
|
| 263 | - * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 264 | - * @param string $Name name of field to print |
|
| 265 | - * @param bool $strip_slashes string escape chars from field(optional), default false |
|
| 266 | - * depricated param, as correctly quoted values dont need any stripslashes! |
|
| 267 | - */ |
|
| 261 | + * Print the value of a field |
|
| 262 | + * |
|
| 263 | + * @deprecated use the result-object returned by query() or select() direct, so you can use the global db-object and not a clone |
|
| 264 | + * @param string $Name name of field to print |
|
| 265 | + * @param bool $strip_slashes string escape chars from field(optional), default false |
|
| 266 | + * depricated param, as correctly quoted values dont need any stripslashes! |
|
| 267 | + */ |
|
| 268 | 268 | function p($Name, $strip_slashes = True) |
| 269 | 269 | { |
| 270 | 270 | print $this->f($Name, $strip_slashes); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | /** |
| 274 | - * Returns a query-result-row as an associative array (no numerical keys !!!) |
|
| 275 | - * |
|
| 276 | - * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
| 277 | - * @param bool $do_next_record should next_record() be called or not (default not) |
|
| 278 | - * @param string $strip ='' string to strip of the column-name, default '' |
|
| 279 | - * @return array/bool the associative array or False if no (more) result-row is availible |
|
| 280 | - */ |
|
| 274 | + * Returns a query-result-row as an associative array (no numerical keys !!!) |
|
| 275 | + * |
|
| 276 | + * @deprecated use foreach(query() or foreach(select() to loop over the query using the global db object |
|
| 277 | + * @param bool $do_next_record should next_record() be called or not (default not) |
|
| 278 | + * @param string $strip ='' string to strip of the column-name, default '' |
|
| 279 | + * @return array/bool the associative array or False if no (more) result-row is availible |
|
| 280 | + */ |
|
| 281 | 281 | function row($do_next_record=False,$strip='') |
| 282 | 282 | { |
| 283 | 283 | if ($do_next_record && !$this->next_record(self::FETCH_ASSOC) || !is_array($this->Record)) |
@@ -170,7 +170,7 @@ |
||
| 170 | 170 | * |
| 171 | 171 | * @param string/array $_contact_id contact_id or array with values for id or account_id |
| 172 | 172 | * @return array/boolean data if row could be retrived else False |
| 173 | - */ |
|
| 173 | + */ |
|
| 174 | 174 | function read($_contact_id) |
| 175 | 175 | { |
| 176 | 176 | if (is_array($_contact_id) && isset($_contact_id['account_id']) || |
@@ -41,33 +41,33 @@ discard block |
||
| 41 | 41 | var $contacts_id='id'; |
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | - * @var string $accountName holds the accountname of the current user |
|
| 45 | - */ |
|
| 44 | + * @var string $accountName holds the accountname of the current user |
|
| 45 | + */ |
|
| 46 | 46 | var $accountName; |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | - * @var object $ldapServerInfo holds the information about the current used ldap server |
|
| 50 | - */ |
|
| 49 | + * @var object $ldapServerInfo holds the information about the current used ldap server |
|
| 50 | + */ |
|
| 51 | 51 | var $ldapServerInfo; |
| 52 | 52 | |
| 53 | 53 | /** |
| 54 | - * @var int $ldapLimit how many rows to fetch from ldap server |
|
| 55 | - */ |
|
| 54 | + * @var int $ldapLimit how many rows to fetch from ldap server |
|
| 55 | + */ |
|
| 56 | 56 | var $ldapLimit = 2000; |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | - * @var string $personalContactsDN holds the base DN for the personal addressbooks |
|
| 60 | - */ |
|
| 59 | + * @var string $personalContactsDN holds the base DN for the personal addressbooks |
|
| 60 | + */ |
|
| 61 | 61 | var $personalContactsDN; |
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | - * @var string $sharedContactsDN holds the base DN for the shared addressbooks |
|
| 65 | - */ |
|
| 64 | + * @var string $sharedContactsDN holds the base DN for the shared addressbooks |
|
| 65 | + */ |
|
| 66 | 66 | var $sharedContactsDN; |
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | - * @var string $accountContactsDN holds the base DN for accounts addressbook |
|
| 70 | - */ |
|
| 69 | + * @var string $accountContactsDN holds the base DN for accounts addressbook |
|
| 70 | + */ |
|
| 71 | 71 | var $accountContactsDN; |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | var $accountsFilter = '(objectclass=posixaccount)'; |
| 78 | 78 | |
| 79 | 79 | /** |
| 80 | - * @var string $allContactsDN holds the base DN of all addressbook |
|
| 81 | - */ |
|
| 80 | + * @var string $allContactsDN holds the base DN of all addressbook |
|
| 81 | + */ |
|
| 82 | 82 | var $allContactsDN; |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | var $never_change_dn = false; |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * @var int $total holds the total count of found rows |
|
| 100 | - */ |
|
| 99 | + * @var int $total holds the total count of found rows |
|
| 100 | + */ |
|
| 101 | 101 | var $total; |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | * |
| 404 | 404 | * @param string|array $contact_id contact_id or array with values for id or account_id |
| 405 | 405 | * @return array/boolean data if row could be retrived else False |
| 406 | - */ |
|
| 406 | + */ |
|
| 407 | 407 | function read($contact_id) |
| 408 | 408 | { |
| 409 | 409 | if (is_array($contact_id) && isset($contact_id['account_id']) || |
@@ -858,9 +858,9 @@ |
||
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | /** |
| 861 | - * Deletes custom field data |
|
| 862 | - * Implemented to deal with LDAP backend, which saves CFs in SQL, but the account record is in LDAP |
|
| 863 | - */ |
|
| 861 | + * Deletes custom field data |
|
| 862 | + * Implemented to deal with LDAP backend, which saves CFs in SQL, but the account record is in LDAP |
|
| 863 | + */ |
|
| 864 | 864 | function delete_customfields($data) |
| 865 | 865 | { |
| 866 | 866 | $this->db->delete($this->extra_table,$data,__LINE__,__FILE__); |