@@ -121,10 +121,13 @@ discard block |
||
| 121 | 121 | { |
| 122 | 122 | throw new Exception('next_record called with no query pending.'); |
| 123 | 123 | } |
| 124 | - if ($this->Row) // first row is already fetched |
|
| 124 | + if ($this->Row) |
|
| 125 | + { |
|
| 126 | + // first row is already fetched |
|
| 125 | 127 | { |
| 126 | 128 | $this->Query_ID->MoveNext(); |
| 127 | 129 | } |
| 130 | + } |
|
| 128 | 131 | ++$this->Row; |
| 129 | 132 | |
| 130 | 133 | $this->Record = $this->Query_ID->fields; |
@@ -133,12 +136,15 @@ discard block |
||
| 133 | 136 | { |
| 134 | 137 | return False; |
| 135 | 138 | } |
| 136 | - if ($this->capabilities[self::CAPABILITY_NAME_CASE] == 'upper') // maxdb, oracle, ... |
|
| 139 | + if ($this->capabilities[self::CAPABILITY_NAME_CASE] == 'upper') |
|
| 140 | + { |
|
| 141 | + // maxdb, oracle, ... |
|
| 137 | 142 | { |
| 138 | 143 | switch($fetch_mode) |
| 139 | 144 | { |
| 140 | 145 | case self::FETCH_ASSOC: |
| 141 | 146 | $this->Record = array_change_key_case($this->Record); |
| 147 | + } |
|
| 142 | 148 | break; |
| 143 | 149 | case self::FETCH_NUM: |
| 144 | 150 | $this->Record = array_values($this->Record); |
@@ -199,7 +205,8 @@ discard block |
||
| 199 | 205 | * @return bool True if sucessful, False if fails |
| 200 | 206 | */ |
| 201 | 207 | function unlock() |
| 202 | - {} |
|
| 208 | + { |
|
| 209 | +} |
|
| 203 | 210 | |
| 204 | 211 | /** |
| 205 | 212 | * Number of rows in current result set |
@@ -289,7 +296,10 @@ discard block |
||
| 289 | 296 | { |
| 290 | 297 | if (!is_numeric($column)) |
| 291 | 298 | { |
| 292 | - if ($strip) $column = str_replace($strip,'',$column); |
|
| 299 | + if ($strip) |
|
| 300 | + { |
|
| 301 | + $column = str_replace($strip,'',$column); |
|
| 302 | + } |
|
| 293 | 303 | |
| 294 | 304 | $result[$column] = $value; |
| 295 | 305 | } |
@@ -301,4 +311,6 @@ discard block |
||
| 301 | 311 | /** |
| 302 | 312 | * @deprecated use EGroupware\Api\Db\CallbackIterator |
| 303 | 313 | */ |
| 304 | -class egw_db_callback_iterator extends Api\Db\CallbackIterator {} |
|
| 314 | +class egw_db_callback_iterator extends Api\Db\CallbackIterator |
|
| 315 | +{ |
|
| 316 | +} |
|
@@ -95,7 +95,11 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | //error_log(__METHOD__."($name)".function_backtrace()); |
| 97 | 97 | |
| 98 | - if ($name == 'js') $name = 'framework'; // javascript class is integrated now into framework |
|
| 98 | + if ($name == 'js') |
|
| 99 | + { |
|
| 100 | + $name = 'framework'; |
|
| 101 | + } |
|
| 102 | + // javascript class is integrated now into framework |
|
| 99 | 103 | |
| 100 | 104 | if (isset($this->$name)) |
| 101 | 105 | { |
@@ -104,7 +108,10 @@ discard block |
||
| 104 | 108 | |
| 105 | 109 | if (!isset(self::$sub_objects[$name]) && !class_exists('EGroupware\\Api\\'.ucfirst($name)) && !class_exists($name)) |
| 106 | 110 | { |
| 107 | - if ($name != 'ADOdb') error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
|
| 111 | + if ($name != 'ADOdb') |
|
| 112 | + { |
|
| 113 | + error_log(__METHOD__.": There's NO $name object! ".function_backtrace()); |
|
| 114 | + } |
|
| 108 | 115 | return null; |
| 109 | 116 | } |
| 110 | 117 | switch($name) |
@@ -121,7 +128,10 @@ discard block |
||
| 121 | 128 | return $this->ldap = Api\Ldap::factory(false); |
| 122 | 129 | default: |
| 123 | 130 | $class = isset(self::$sub_objects[$name]) ? self::$sub_objects[$name] : 'EGroupware\\Api\\'.ucfirst($name); |
| 124 | - if (!class_exists($class)) $class = $name; |
|
| 131 | + if (!class_exists($class)) |
|
| 132 | + { |
|
| 133 | + $class = $name; |
|
| 134 | + } |
|
| 125 | 135 | break; |
| 126 | 136 | } |
| 127 | 137 | return $this->$name = new $class(); |
@@ -239,10 +239,13 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | // remove some columns, absolutly not necessary to search in sql |
| 241 | 241 | $this->columns_to_search = array_diff(array_values($this->somain->db_cols),$this->sql_cols_not_to_search); |
| 242 | - if ($this->customfields) // add custom fields, if configured |
|
| 242 | + if ($this->customfields) |
|
| 243 | + { |
|
| 244 | + // add custom fields, if configured |
|
| 243 | 245 | { |
| 244 | 246 | $this->columns_to_search[] = Sql::EXTRA_TABLE.'.'.Sql::EXTRA_VALUE; |
| 245 | 247 | } |
| 248 | + } |
|
| 246 | 249 | } |
| 247 | 250 | if ($this->user) |
| 248 | 251 | { |
@@ -319,7 +322,10 @@ discard block |
||
| 319 | 322 | */ |
| 320 | 323 | function get_grants($user, $contact_app='addressbook', $preferences=null) |
| 321 | 324 | { |
| 322 | - if (!isset($preferences)) $preferences = $GLOBALS['egw_info']['user']['preferences']; |
|
| 325 | + if (!isset($preferences)) |
|
| 326 | + { |
|
| 327 | + $preferences = $GLOBALS['egw_info']['user']['preferences']; |
|
| 328 | + } |
|
| 323 | 329 | |
| 324 | 330 | if ($user) |
| 325 | 331 | { |
@@ -347,12 +353,25 @@ discard block |
||
| 347 | 353 | $grants[0] = Api\Acl::READ; |
| 348 | 354 | } |
| 349 | 355 | // add account grants for admins (only for current user!) |
| 350 | - if ($user == $this->user && $this->is_admin()) // admin rights can be limited by ACL! |
|
| 356 | + if ($user == $this->user && $this->is_admin()) |
|
| 357 | + { |
|
| 358 | + // admin rights can be limited by ACL! |
|
| 351 | 359 | { |
| 352 | - $grants[0] = Api\Acl::READ; // admins always have read-access |
|
| 353 | - if (!$GLOBALS['egw']->acl->check('account_access',16,'admin')) $grants[0] |= Api\Acl::EDIT; |
|
| 354 | - if (!$GLOBALS['egw']->acl->check('account_access',4,'admin')) $grants[0] |= Api\Acl::ADD; |
|
| 355 | - if (!$GLOBALS['egw']->acl->check('account_access',32,'admin')) $grants[0] |= Api\Acl::DELETE; |
|
| 360 | + $grants[0] = Api\Acl::READ; |
|
| 361 | + } |
|
| 362 | + // admins always have read-access |
|
| 363 | + if (!$GLOBALS['egw']->acl->check('account_access',16,'admin')) |
|
| 364 | + { |
|
| 365 | + $grants[0] |= Api\Acl::EDIT; |
|
| 366 | + } |
|
| 367 | + if (!$GLOBALS['egw']->acl->check('account_access',4,'admin')) |
|
| 368 | + { |
|
| 369 | + $grants[0] |= Api\Acl::ADD; |
|
| 370 | + } |
|
| 371 | + if (!$GLOBALS['egw']->acl->check('account_access',32,'admin')) |
|
| 372 | + { |
|
| 373 | + $grants[0] |= Api\Acl::DELETE; |
|
| 374 | + } |
|
| 356 | 375 | } |
| 357 | 376 | // allow certain groups to edit contact-data of accounts |
| 358 | 377 | if (self::allow_account_edit($user)) |
@@ -422,12 +441,22 @@ discard block |
||
| 422 | 441 | } |
| 423 | 442 | foreach($ids as $key => $id) |
| 424 | 443 | { |
| 425 | - if (!is_numeric($id)) unset($ids[$key]); |
|
| 444 | + if (!is_numeric($id)) |
|
| 445 | + { |
|
| 446 | + unset($ids[$key]); |
|
| 447 | + } |
|
| 426 | 448 | } |
| 427 | - if (!$ids) return array(); // nothing to do, eg. all these contacts are in ldap |
|
| 449 | + if (!$ids) |
|
| 450 | + { |
|
| 451 | + return array(); |
|
| 452 | + } |
|
| 453 | + // nothing to do, eg. all these contacts are in ldap |
|
| 428 | 454 | $fields = array(); |
| 429 | 455 | $filter[$this->distri_id]=$ids; |
| 430 | - if (count($dl_allowed)) $filter[$this->distri_key]=$dl_allowed; |
|
| 456 | + if (count($dl_allowed)) |
|
| 457 | + { |
|
| 458 | + $filter[$this->distri_key]=$dl_allowed; |
|
| 459 | + } |
|
| 431 | 460 | $distri_view = str_replace(') d_view',' and '.$this->distri_id.' in ('.implode(',',$ids).')) d_view',$this->distributionlist_view); |
| 432 | 461 | #_debug_array($this->distributionlist_tabledef); |
| 433 | 462 | foreach($this->db->select($distri_view, '*', $filter, __LINE__, __FILE__, |
@@ -477,10 +506,16 @@ discard block |
||
| 477 | 506 | */ |
| 478 | 507 | function delete($contact,$check_etag=null) |
| 479 | 508 | { |
| 480 | - if (is_array($contact)) $contact = $contact['id']; |
|
| 509 | + if (is_array($contact)) |
|
| 510 | + { |
|
| 511 | + $contact = $contact['id']; |
|
| 512 | + } |
|
| 481 | 513 | |
| 482 | 514 | $where = array('id' => $contact); |
| 483 | - if ($check_etag) $where['etag'] = $check_etag; |
|
| 515 | + if ($check_etag) |
|
| 516 | + { |
|
| 517 | + $where['etag'] = $check_etag; |
|
| 518 | + } |
|
| 484 | 519 | |
| 485 | 520 | // delete mainfields |
| 486 | 521 | if ($this->somain->delete($where)) |
@@ -556,7 +591,10 @@ discard block |
||
| 556 | 591 | } |
| 557 | 592 | } |
| 558 | 593 | } |
| 559 | - if($error_nr) return $error_nr; |
|
| 594 | + if($error_nr) |
|
| 595 | + { |
|
| 596 | + return $error_nr; |
|
| 597 | + } |
|
| 560 | 598 | |
| 561 | 599 | return false; // no error |
| 562 | 600 | } |
@@ -580,7 +618,10 @@ discard block |
||
| 580 | 618 | return $contact; |
| 581 | 619 | } |
| 582 | 620 | $dl_list=$this->read_distributionlist(array($contact['id'])); |
| 583 | - if (count($dl_list)) $contact['distrib_lists']=implode("\n",$dl_list[$contact['id']]); |
|
| 621 | + if (count($dl_list)) |
|
| 622 | + { |
|
| 623 | + $contact['distrib_lists']=implode("\n",$dl_list[$contact['id']]); |
|
| 624 | + } |
|
| 584 | 625 | return $this->db2data($contact); |
| 585 | 626 | } |
| 586 | 627 | |
@@ -613,7 +654,10 @@ discard block |
||
| 613 | 654 | unset($filter['adr_one_countrycode']); |
| 614 | 655 | } |
| 615 | 656 | // Hide deleted items unless type is specifically deleted |
| 616 | - if(!is_array($filter)) $filter = $filter ? (array) $filter : array(); |
|
| 657 | + if(!is_array($filter)) |
|
| 658 | + { |
|
| 659 | + $filter = $filter ? (array) $filter : array(); |
|
| 660 | + } |
|
| 617 | 661 | |
| 618 | 662 | if (isset($filter['cols_to_search'])) |
| 619 | 663 | { |
@@ -624,10 +668,13 @@ discard block |
||
| 624 | 668 | // if no tid set or tid==='' do NOT return deleted entries ($tid === null returns all entries incl. deleted) |
| 625 | 669 | if(!array_key_exists('tid', $filter) || $filter['tid'] === '') |
| 626 | 670 | { |
| 627 | - if ($join && strpos($join,'RIGHT JOIN') !== false) // used eg. to search for groups |
|
| 671 | + if ($join && strpos($join,'RIGHT JOIN') !== false) |
|
| 672 | + { |
|
| 673 | + // used eg. to search for groups |
|
| 628 | 674 | { |
| 629 | 675 | $filter[] = '(contact_tid != \'' . self::DELETED_TYPE . '\' OR contact_tid IS NULL)'; |
| 630 | 676 | } |
| 677 | + } |
|
| 631 | 678 | else |
| 632 | 679 | { |
| 633 | 680 | $filter[] = 'contact_tid != \'' . self::DELETED_TYPE . '\''; |
@@ -675,7 +722,10 @@ discard block |
||
| 675 | 722 | unset($cols[$key]); |
| 676 | 723 | } |
| 677 | 724 | } |
| 678 | - if ($col=='contact_id') $col='egw_addressbook.contact_id'; |
|
| 725 | + if ($col=='contact_id') |
|
| 726 | + { |
|
| 727 | + $col='egw_addressbook.contact_id'; |
|
| 728 | + } |
|
| 679 | 729 | } |
| 680 | 730 | |
| 681 | 731 | $backend->columns_to_search = $cols; |
@@ -750,7 +800,11 @@ discard block |
||
| 750 | 800 | { |
| 751 | 801 | foreach($this->columns_to_search as $col) |
| 752 | 802 | { |
| 753 | - if ($col != 'contact_value') $param['search'][$col] = $search; // we dont search the customfields |
|
| 803 | + if ($col != 'contact_value') |
|
| 804 | + { |
|
| 805 | + $param['search'][$col] = $search; |
|
| 806 | + } |
|
| 807 | + // we dont search the customfields |
|
| 754 | 808 | } |
| 755 | 809 | } |
| 756 | 810 | } |
@@ -770,11 +824,17 @@ discard block |
||
| 770 | 824 | $rows = $this->somain->organisations($param); |
| 771 | 825 | $this->total = $this->somain->total; |
| 772 | 826 | |
| 773 | - if (!$rows) return array(); |
|
| 827 | + if (!$rows) |
|
| 828 | + { |
|
| 829 | + return array(); |
|
| 830 | + } |
|
| 774 | 831 | |
| 775 | 832 | foreach($rows as $n => $row) |
| 776 | 833 | { |
| 777 | - if (strpos($row['org_name'],'&')!==false) $row['org_name'] = str_replace('&','*AND*',$row['org_name']); |
|
| 834 | + if (strpos($row['org_name'],'&')!==false) |
|
| 835 | + { |
|
| 836 | + $row['org_name'] = str_replace('&','*AND*',$row['org_name']); |
|
| 837 | + } |
|
| 778 | 838 | $rows[$n]['id'] = 'org_name:'.$row['org_name']; |
| 779 | 839 | foreach(array( |
| 780 | 840 | 'org_unit' => lang('departments'), |
@@ -787,7 +847,10 @@ discard block |
||
| 787 | 847 | } |
| 788 | 848 | else |
| 789 | 849 | { |
| 790 | - if (strpos($row[$by],'&')!==false) $row[$by] = str_replace('&','*AND*',$row[$by]); |
|
| 850 | + if (strpos($row[$by],'&')!==false) |
|
| 851 | + { |
|
| 852 | + $row[$by] = str_replace('&','*AND*',$row[$by]); |
|
| 853 | + } |
|
| 791 | 854 | $rows[$n]['id'] .= '|||'.$by.':'.$row[$by]; |
| 792 | 855 | } |
| 793 | 856 | } |
@@ -847,7 +910,10 @@ discard block |
||
| 847 | 910 | */ |
| 848 | 911 | function get_backend($keys=null,$owner=null) |
| 849 | 912 | { |
| 850 | - if ($owner === '') $owner = null; |
|
| 913 | + if ($owner === '') |
|
| 914 | + { |
|
| 915 | + $owner = null; |
|
| 916 | + } |
|
| 851 | 917 | |
| 852 | 918 | $contact_id = !is_array($keys) ? $keys : |
| 853 | 919 | (isset($keys['id']) ? $keys['id'] : $keys['contact_id']); |
@@ -911,7 +977,10 @@ discard block |
||
| 911 | 977 | $ds = $GLOBALS['egw']->ldap->ldapConnect(); |
| 912 | 978 | $ldap_contacts = new Ldap(null, $ds); |
| 913 | 979 | |
| 914 | - if (!is_array($type)) $type = explode(',', $type); |
|
| 980 | + if (!is_array($type)) |
|
| 981 | + { |
|
| 982 | + $type = explode(',', $type); |
|
| 983 | + } |
|
| 915 | 984 | |
| 916 | 985 | $start = $n = 0; |
| 917 | 986 | $num = 100; |
@@ -927,7 +996,10 @@ discard block |
||
| 927 | 996 | { |
| 928 | 997 | foreach($contacts as $contact) |
| 929 | 998 | { |
| 930 | - if ($contact['account_id']) $contact['id'] = $GLOBALS['egw']->accounts->id2name($contact['account_id']); |
|
| 999 | + if ($contact['account_id']) |
|
| 1000 | + { |
|
| 1001 | + $contact['id'] = $GLOBALS['egw']->accounts->id2name($contact['account_id']); |
|
| 1002 | + } |
|
| 931 | 1003 | |
| 932 | 1004 | $ldap_contacts->data = $contact; |
| 933 | 1005 | $n++; |
@@ -955,10 +1027,13 @@ discard block |
||
| 955 | 1027 | false, $filter) as $contact) |
| 956 | 1028 | { |
| 957 | 1029 | //error_log(__METHOD__."(".array2string($type).") do=".array2string($type)." migrating ".array2string($contact)); |
| 958 | - if ($contact['jpegphoto']) // photo is NOT read by LDAP backend on search, need to do an extra read |
|
| 1030 | + if ($contact['jpegphoto']) |
|
| 1031 | + { |
|
| 1032 | + // photo is NOT read by LDAP backend on search, need to do an extra read |
|
| 959 | 1033 | { |
| 960 | 1034 | $contact = $ldap_contacts->read($contact['id']); |
| 961 | 1035 | } |
| 1036 | + } |
|
| 962 | 1037 | unset($contact['id']); // ldap uid/account_lid |
| 963 | 1038 | if ($contact['account_id'] && ($old = $sql_contacts->read(array('account_id' => $contact['account_id'])))) |
| 964 | 1039 | { |
@@ -992,7 +1067,10 @@ discard block |
||
| 992 | 1067 | */ |
| 993 | 1068 | function get_lists($required=Api\Acl::READ,$extra_labels=null) |
| 994 | 1069 | { |
| 995 | - if (!method_exists($this->somain,'get_lists')) return false; |
|
| 1070 | + if (!method_exists($this->somain,'get_lists')) |
|
| 1071 | + { |
|
| 1072 | + return false; |
|
| 1073 | + } |
|
| 996 | 1074 | |
| 997 | 1075 | $uids = array(); |
| 998 | 1076 | foreach($this->grants as $uid => $rights) |
@@ -1026,7 +1104,10 @@ discard block |
||
| 1026 | 1104 | function read_lists($keys,$member_attr=null,$limit_in_ab=false) |
| 1027 | 1105 | { |
| 1028 | 1106 | $backend = (string)$limit_in_ab === '0' && $this->so_accounts ? $this->so_accounts : $this->somain; |
| 1029 | - if (!method_exists($backend, 'get_lists')) return false; |
|
| 1107 | + if (!method_exists($backend, 'get_lists')) |
|
| 1108 | + { |
|
| 1109 | + return false; |
|
| 1110 | + } |
|
| 1030 | 1111 | |
| 1031 | 1112 | return $backend->get_lists($keys,null,$member_attr,$limit_in_ab); |
| 1032 | 1113 | } |
@@ -1043,7 +1124,10 @@ discard block |
||
| 1043 | 1124 | function add_list($keys,$owner,$contacts=array(),array &$data=array()) |
| 1044 | 1125 | { |
| 1045 | 1126 | $backend = (string)$owner === '0' && $this->so_accounts ? $this->so_accounts : $this->somain; |
| 1046 | - if (!method_exists($backend, 'add_list')) return false; |
|
| 1127 | + if (!method_exists($backend, 'add_list')) |
|
| 1128 | + { |
|
| 1129 | + return false; |
|
| 1130 | + } |
|
| 1047 | 1131 | |
| 1048 | 1132 | return $backend->add_list($keys,$owner,$contacts,$data); |
| 1049 | 1133 | } |
@@ -1058,7 +1142,10 @@ discard block |
||
| 1058 | 1142 | */ |
| 1059 | 1143 | function add2list($contact,$list,array $existing=null) |
| 1060 | 1144 | { |
| 1061 | - if (!method_exists($this->somain,'add2list')) return false; |
|
| 1145 | + if (!method_exists($this->somain,'add2list')) |
|
| 1146 | + { |
|
| 1147 | + return false; |
|
| 1148 | + } |
|
| 1062 | 1149 | |
| 1063 | 1150 | return $this->somain->add2list($contact,$list,$existing); |
| 1064 | 1151 | } |
@@ -1072,7 +1159,10 @@ discard block |
||
| 1072 | 1159 | */ |
| 1073 | 1160 | function remove_from_list($contact,$list=null) |
| 1074 | 1161 | { |
| 1075 | - if (!method_exists($this->somain,'remove_from_list')) return false; |
|
| 1162 | + if (!method_exists($this->somain,'remove_from_list')) |
|
| 1163 | + { |
|
| 1164 | + return false; |
|
| 1165 | + } |
|
| 1076 | 1166 | |
| 1077 | 1167 | return $this->somain->remove_from_list($contact,$list); |
| 1078 | 1168 | } |
@@ -1085,7 +1175,10 @@ discard block |
||
| 1085 | 1175 | */ |
| 1086 | 1176 | function delete_list($list) |
| 1087 | 1177 | { |
| 1088 | - if (!method_exists($this->somain,'delete_list')) return false; |
|
| 1178 | + if (!method_exists($this->somain,'delete_list')) |
|
| 1179 | + { |
|
| 1180 | + return false; |
|
| 1181 | + } |
|
| 1089 | 1182 | |
| 1090 | 1183 | return $this->somain->delete_list($list); |
| 1091 | 1184 | } |
@@ -1098,7 +1191,10 @@ discard block |
||
| 1098 | 1191 | */ |
| 1099 | 1192 | function read_list($list) |
| 1100 | 1193 | { |
| 1101 | - if (!method_exists($this->somain,'read_list')) return false; |
|
| 1194 | + if (!method_exists($this->somain,'read_list')) |
|
| 1195 | + { |
|
| 1196 | + return false; |
|
| 1197 | + } |
|
| 1102 | 1198 | |
| 1103 | 1199 | return $this->somain->read_list($list); |
| 1104 | 1200 | } |
@@ -1124,7 +1220,10 @@ discard block |
||
| 1124 | 1220 | */ |
| 1125 | 1221 | function lists_ctag($owner=null) |
| 1126 | 1222 | { |
| 1127 | - if (!method_exists($this->somain,'lists_ctag')) return 0; |
|
| 1223 | + if (!method_exists($this->somain,'lists_ctag')) |
|
| 1224 | + { |
|
| 1225 | + return 0; |
|
| 1226 | + } |
|
| 1128 | 1227 | |
| 1129 | 1228 | return $this->somain->lists_ctag($owner); |
| 1130 | 1229 | } |
@@ -116,7 +116,10 @@ discard block |
||
| 116 | 116 | if ($data['is_contactform']) |
| 117 | 117 | { |
| 118 | 118 | $copy = preg_split('/, ?/',$data['email_contactform']); |
| 119 | - if ($data['email_copytoreceiver']) $copy[] = $data['email']; |
|
| 119 | + if ($data['email_copytoreceiver']) |
|
| 120 | + { |
|
| 121 | + $copy[] = $data['email']; |
|
| 122 | + } |
|
| 120 | 123 | return $copy; |
| 121 | 124 | } |
| 122 | 125 | break; |
@@ -150,7 +153,10 @@ discard block |
||
| 150 | 153 | { |
| 151 | 154 | $changed_fields = self::changed_fields($data,$old); |
| 152 | 155 | } |
| 153 | - if (!$changed_fields) return 0; |
|
| 156 | + if (!$changed_fields) |
|
| 157 | + { |
|
| 158 | + return 0; |
|
| 159 | + } |
|
| 154 | 160 | |
| 155 | 161 | foreach(array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code) |
| 156 | 162 | { |
@@ -231,7 +237,10 @@ discard block |
||
| 231 | 237 | |
| 232 | 238 | foreach($this->contacts->contact_fields as $name => $label) |
| 233 | 239 | { |
| 234 | - if (!$data[$name] && $name != 'owner') continue; |
|
| 240 | + if (!$data[$name] && $name != 'owner') |
|
| 241 | + { |
|
| 242 | + continue; |
|
| 243 | + } |
|
| 235 | 244 | |
| 236 | 245 | switch($name) |
| 237 | 246 | { |
@@ -84,7 +84,11 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | function __construct(array $ldap_config=null, $ds=null) |
| 86 | 86 | { |
| 87 | - if (false) parent::__construct (); // quiten IDE warning, we are explicitly NOT calling parrent constructor! |
|
| 87 | + if (false) |
|
| 88 | + { |
|
| 89 | + parent::__construct (); |
|
| 90 | + } |
|
| 91 | + // quiten IDE warning, we are explicitly NOT calling parrent constructor! |
|
| 88 | 92 | |
| 89 | 93 | $this->accountName = $GLOBALS['egw_info']['user']['account_lid']; |
| 90 | 94 | |
@@ -202,10 +206,16 @@ discard block |
||
| 202 | 206 | $contact['id'] = $contact['uid'] = $this->accounts_ads->objectguid2str($data['objectguid']); |
| 203 | 207 | |
| 204 | 208 | // ignore system accounts |
| 205 | - if ($contact['account_id'] < Api\Accounts\Ads::MIN_ACCOUNT_ID) return false; |
|
| 209 | + if ($contact['account_id'] < Api\Accounts\Ads::MIN_ACCOUNT_ID) |
|
| 210 | + { |
|
| 211 | + return false; |
|
| 212 | + } |
|
| 206 | 213 | |
| 207 | 214 | // ignore deactivated or expired accounts |
| 208 | - if (!$this->accounts_ads->user_active($data)) return false; |
|
| 215 | + if (!$this->accounts_ads->user_active($data)) |
|
| 216 | + { |
|
| 217 | + return false; |
|
| 218 | + } |
|
| 209 | 219 | |
| 210 | 220 | $this->_inetorgperson2egw($contact, $data, 'displayname'); |
| 211 | 221 | } |
@@ -84,7 +84,10 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function calendar_replacements($id,$last_event_too=false) |
| 86 | 86 | { |
| 87 | - if (!class_exists('calendar_boupdate')) return array(); |
|
| 87 | + if (!class_exists('calendar_boupdate')) |
|
| 88 | + { |
|
| 89 | + return array(); |
|
| 90 | + } |
|
| 88 | 91 | |
| 89 | 92 | $calendar = new calendar_boupdate(); |
| 90 | 93 | |
@@ -118,11 +121,17 @@ discard block |
||
| 118 | 121 | foreach($events as $key => $event) |
| 119 | 122 | { |
| 120 | 123 | // Use -1 for previous key |
| 121 | - if($key < 0) $n = $key; |
|
| 124 | + if($key < 0) |
|
| 125 | + { |
|
| 126 | + $n = $key; |
|
| 127 | + } |
|
| 122 | 128 | |
| 123 | 129 | foreach($calendar->event2array($event) as $name => $data) |
| 124 | 130 | { |
| 125 | - if (substr($name,-4) == 'date') $name = substr($name,0,-4); |
|
| 131 | + if (substr($name,-4) == 'date') |
|
| 132 | + { |
|
| 133 | + $name = substr($name,0,-4); |
|
| 134 | + } |
|
| 126 | 135 | $replacements['$$calendar/'.$n.'/'.$name.'$$'] = is_array($data['data']) ? implode(', ',$data['data']) : $data['data']; |
| 127 | 136 | } |
| 128 | 137 | foreach(array('start','end') as $what) |
@@ -134,7 +143,10 @@ discard block |
||
| 134 | 143 | ) as $name => $format) |
| 135 | 144 | { |
| 136 | 145 | $value = $event[$what] ? date($format,$event[$what]) : ''; |
| 137 | - if ($format == 'l') $value = lang($value); |
|
| 146 | + if ($format == 'l') |
|
| 147 | + { |
|
| 148 | + $value = lang($value); |
|
| 149 | + } |
|
| 138 | 150 | $replacements['$$calendar/'.$n.'/'.$what.$name.'$$'] = $value; |
| 139 | 151 | } |
| 140 | 152 | } |
@@ -145,7 +157,8 @@ discard block |
||
| 145 | 157 | } |
| 146 | 158 | |
| 147 | 159 | // Need to set some keys if there is no previous event |
| 148 | - if($last_event_too && count($events['-1']) == 0) { |
|
| 160 | + if($last_event_too && count($events['-1']) == 0) |
|
| 161 | + { |
|
| 149 | 162 | $replacements['$$calendar/-1/start$$'] = ''; |
| 150 | 163 | $replacements['$$calendar/-1/end$$'] = ''; |
| 151 | 164 | $replacements['$$calendar/-1/owner$$'] = ''; |
@@ -170,22 +183,38 @@ discard block |
||
| 170 | 183 | $n = 0; |
| 171 | 184 | foreach($this->contacts->contact_fields as $name => $label) |
| 172 | 185 | { |
| 173 | - if (in_array($name,array('tid','label','geo'))) continue; // dont show them, as they are not used in the UI atm. |
|
| 186 | + if (in_array($name,array('tid','label','geo'))) |
|
| 187 | + { |
|
| 188 | + continue; |
|
| 189 | + } |
|
| 190 | + // dont show them, as they are not used in the UI atm. |
|
| 174 | 191 | |
| 175 | - if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) // main values, which should be in the first column |
|
| 192 | + if (in_array($name,array('email','org_name','tel_work','url')) && $n&1) |
|
| 193 | + { |
|
| 194 | + // main values, which should be in the first column |
|
| 176 | 195 | { |
| 177 | 196 | echo "</tr>\n"; |
| 197 | + } |
|
| 178 | 198 | $n++; |
| 179 | 199 | } |
| 180 | - if (!($n&1)) echo '<tr>'; |
|
| 200 | + if (!($n&1)) |
|
| 201 | + { |
|
| 202 | + echo '<tr>'; |
|
| 203 | + } |
|
| 181 | 204 | echo '<td>{{'.$name.'}}</td><td>'.$label.'</td>'; |
| 182 | 205 | if($name == 'cat_id') |
| 183 | 206 | { |
| 184 | - if ($n&1) echo "</tr>\n"; |
|
| 207 | + if ($n&1) |
|
| 208 | + { |
|
| 209 | + echo "</tr>\n"; |
|
| 210 | + } |
|
| 185 | 211 | echo '<td>{{categories}}</td><td>'.lang('Category path').'</td>'; |
| 186 | 212 | $n++; |
| 187 | 213 | } |
| 188 | - if ($n&1) echo "</tr>\n"; |
|
| 214 | + if ($n&1) |
|
| 215 | + { |
|
| 216 | + echo "</tr>\n"; |
|
| 217 | + } |
|
| 189 | 218 | $n++; |
| 190 | 219 | } |
| 191 | 220 | |
@@ -242,14 +271,23 @@ discard block |
||
| 242 | 271 | 'owner' => lang('Owner'), |
| 243 | 272 | ) as $name => $label) |
| 244 | 273 | { |
| 245 | - if (in_array($name,array('start','end')) && $n&1) // main values, which should be in the first column |
|
| 274 | + if (in_array($name,array('start','end')) && $n&1) |
|
| 275 | + { |
|
| 276 | + // main values, which should be in the first column |
|
| 246 | 277 | { |
| 247 | 278 | echo "</tr>\n"; |
| 279 | + } |
|
| 248 | 280 | $n++; |
| 249 | 281 | } |
| 250 | - if (!($n&1)) echo '<tr>'; |
|
| 282 | + if (!($n&1)) |
|
| 283 | + { |
|
| 284 | + echo '<tr>'; |
|
| 285 | + } |
|
| 251 | 286 | echo '<td>{{calendar/#/'.$name.'}}</td><td>'.$label.'</td>'; |
| 252 | - if ($n&1) echo "</tr>\n"; |
|
| 287 | + if ($n&1) |
|
| 288 | + { |
|
| 289 | + echo "</tr>\n"; |
|
| 290 | + } |
|
| 253 | 291 | $n++; |
| 254 | 292 | } |
| 255 | 293 | echo "</table>\n"; |
@@ -327,9 +327,12 @@ discard block |
||
| 327 | 327 | $this->ds = Api\Ldap::factory(); |
| 328 | 328 | } |
| 329 | 329 | // if ldap is NOT the contact repository, we only do accounts and need to use the account-data |
| 330 | - elseif (substr($GLOBALS['egw_info']['server']['contact_repository'],-4) != 'ldap') // not (ldap or sql-ldap) |
|
| 330 | + elseif (substr($GLOBALS['egw_info']['server']['contact_repository'],-4) != 'ldap') |
|
| 331 | + { |
|
| 332 | + // not (ldap or sql-ldap) |
|
| 331 | 333 | { |
| 332 | 334 | $this->ldap_config['ldap_contact_host'] = $this->ldap_config['ldap_host']; |
| 335 | + } |
|
| 333 | 336 | $this->allContactsDN = $this->ldap_config['ldap_context']; |
| 334 | 337 | $this->ds = Api\Ldap::factory(); |
| 335 | 338 | } |
@@ -413,7 +416,10 @@ discard block |
||
| 413 | 416 | } |
| 414 | 417 | else |
| 415 | 418 | { |
| 416 | - if (is_array($contact_id)) $contact_id = isset ($contact_id['id']) ? $contact_id['id'] : $contact_id['uid']; |
|
| 419 | + if (is_array($contact_id)) |
|
| 420 | + { |
|
| 421 | + $contact_id = isset ($contact_id['id']) ? $contact_id['id'] : $contact_id['uid']; |
|
| 422 | + } |
|
| 417 | 423 | $filter = $this->id_filter($contact_id); |
| 418 | 424 | } |
| 419 | 425 | $rows = $this->_searchLDAP($this->allContactsDN, |
@@ -517,7 +523,10 @@ discard block |
||
| 517 | 523 | // add for all supported objectclasses the objectclass and it's attributes |
| 518 | 524 | foreach($this->schema2egw as $objectclass => $mapping) |
| 519 | 525 | { |
| 520 | - if(!$this->ldapServerInfo->supportsObjectClass($objectclass)) continue; |
|
| 526 | + if(!$this->ldapServerInfo->supportsObjectClass($objectclass)) |
|
| 527 | + { |
|
| 528 | + continue; |
|
| 529 | + } |
|
| 521 | 530 | |
| 522 | 531 | if($objectclass != 'posixaccount' && !in_array($objectclass, $oldObjectclasses)) |
| 523 | 532 | { |
@@ -535,7 +544,10 @@ discard block |
||
| 535 | 544 | } |
| 536 | 545 | foreach($mapping as $egwFieldName => $ldapFieldName) |
| 537 | 546 | { |
| 538 | - if (is_int($egwFieldName)) continue; |
|
| 547 | + if (is_int($egwFieldName)) |
|
| 548 | + { |
|
| 549 | + continue; |
|
| 550 | + } |
|
| 539 | 551 | if(!empty($data[$egwFieldName])) |
| 540 | 552 | { |
| 541 | 553 | // dont convert the (binary) jpegPhoto! |
@@ -671,7 +683,10 @@ discard block |
||
| 671 | 683 | function delete($keys=null) |
| 672 | 684 | { |
| 673 | 685 | // single entry |
| 674 | - if($keys[$this->contacts_id]) $keys = array( 0 => $keys); |
|
| 686 | + if($keys[$this->contacts_id]) |
|
| 687 | + { |
|
| 688 | + $keys = array( 0 => $keys); |
|
| 689 | + } |
|
| 675 | 690 | |
| 676 | 691 | if(!is_array($keys)) |
| 677 | 692 | { |
@@ -760,7 +775,10 @@ discard block |
||
| 760 | 775 | |
| 761 | 776 | if((int)$filter['owner']) |
| 762 | 777 | { |
| 763 | - if (!($accountName = $GLOBALS['egw']->accounts->id2name($filter['owner']))) return false; |
|
| 778 | + if (!($accountName = $GLOBALS['egw']->accounts->id2name($filter['owner']))) |
|
| 779 | + { |
|
| 780 | + return false; |
|
| 781 | + } |
|
| 764 | 782 | |
| 765 | 783 | $searchDN = 'cn='. Api\Ldap::quote(strtolower($accountName)) .','; |
| 766 | 784 | |
@@ -856,7 +874,10 @@ discard block |
||
| 856 | 874 | $sort = 'ASC'; |
| 857 | 875 | foreach(explode(',',$order_by) as $o) |
| 858 | 876 | { |
| 859 | - if (substr($o,0,8) == 'contact_') $o = substr($o,8); |
|
| 877 | + if (substr($o,0,8) == 'contact_') |
|
| 878 | + { |
|
| 879 | + $o = substr($o,8); |
|
| 880 | + } |
|
| 860 | 881 | if (substr($o,-4) == ' ASC') |
| 861 | 882 | { |
| 862 | 883 | $sort = 'ASC'; |
@@ -898,12 +919,18 @@ discard block |
||
| 898 | 919 | */ |
| 899 | 920 | function _colFilter($filter) |
| 900 | 921 | { |
| 901 | - if (!is_array($filter)) return ''; |
|
| 922 | + if (!is_array($filter)) |
|
| 923 | + { |
|
| 924 | + return ''; |
|
| 925 | + } |
|
| 902 | 926 | |
| 903 | 927 | $filters = ''; |
| 904 | 928 | foreach($filter as $key => $value) |
| 905 | 929 | { |
| 906 | - if ($key != 'cat_id' && $key != 'account_id' && !$value) continue; |
|
| 930 | + if ($key != 'cat_id' && $key != 'account_id' && !$value) |
|
| 931 | + { |
|
| 932 | + continue; |
|
| 933 | + } |
|
| 907 | 934 | |
| 908 | 935 | switch((string) $key) |
| 909 | 936 | { |
@@ -935,19 +962,28 @@ discard block |
||
| 935 | 962 | $GLOBALS['egw']->categories = new Api\Categories(); |
| 936 | 963 | } |
| 937 | 964 | $cats = $GLOBALS['egw']->categories->return_all_children((int)$value); |
| 938 | - if (count($cats) > 1) $filters .= '(|'; |
|
| 965 | + if (count($cats) > 1) |
|
| 966 | + { |
|
| 967 | + $filters .= '(|'; |
|
| 968 | + } |
|
| 939 | 969 | foreach($cats as $cat) |
| 940 | 970 | { |
| 941 | 971 | $catName = Api\Translation::convert( |
| 942 | 972 | $GLOBALS['egw']->categories->id2name($cat),$this->charset,'utf-8'); |
| 943 | 973 | $filters .= '(category='.Api\Ldap::quote($catName).')'; |
| 944 | 974 | } |
| 945 | - if (count($cats) > 1) $filters .= ')'; |
|
| 975 | + if (count($cats) > 1) |
|
| 976 | + { |
|
| 977 | + $filters .= ')'; |
|
| 978 | + } |
|
| 946 | 979 | } |
| 947 | 980 | break; |
| 948 | 981 | |
| 949 | 982 | case 'carddav_name': |
| 950 | - if (!is_array($value)) $value = array($value); |
|
| 983 | + if (!is_array($value)) |
|
| 984 | + { |
|
| 985 | + $value = array($value); |
|
| 986 | + } |
|
| 951 | 987 | foreach($value as &$v) |
| 952 | 988 | { |
| 953 | 989 | $v = basename($v, '.vcf'); |
@@ -977,7 +1013,10 @@ discard block |
||
| 977 | 1013 | elseif (preg_match("/^([^ ]+) ".preg_quote($GLOBALS['egw']->db->capabilities[Api\Db::CAPABILITY_CASE_INSENSITIV_LIKE])." '(.*)%'$/",$value,$matches)) |
| 978 | 1014 | { |
| 979 | 1015 | list(,$name,$value) = $matches; |
| 980 | - if (strpos($name,'.') !== false) list(,$name) = explode('.',$name); |
|
| 1016 | + if (strpos($name,'.') !== false) |
|
| 1017 | + { |
|
| 1018 | + list(,$name) = explode('.',$name); |
|
| 1019 | + } |
|
| 981 | 1020 | foreach($this->schema2egw as $mapping) |
| 982 | 1021 | { |
| 983 | 1022 | if (isset($mapping[$name])) |
@@ -1028,13 +1067,20 @@ discard block |
||
| 1028 | 1067 | { |
| 1029 | 1068 | $result = @ldap_list($this->ds, $_ldapContext, $_filter, $_attributes, 0, $this->ldapLimit); |
| 1030 | 1069 | } |
| 1031 | - if(!$result || !$entries = ldap_get_entries($this->ds, $result)) return array(); |
|
| 1070 | + if(!$result || !$entries = ldap_get_entries($this->ds, $result)) |
|
| 1071 | + { |
|
| 1072 | + return array(); |
|
| 1073 | + } |
|
| 1032 | 1074 | //error_log(__METHOD__."('$_ldapContext', '$_filter', ".array2string($_attributes).", $_addressbooktype) result of $entries[count]"); |
| 1033 | 1075 | |
| 1034 | 1076 | $this->total = $entries['count']; |
| 1035 | 1077 | foreach($entries as $i => $entry) |
| 1036 | 1078 | { |
| 1037 | - if (!is_int($i)) continue; // eg. count |
|
| 1079 | + if (!is_int($i)) |
|
| 1080 | + { |
|
| 1081 | + continue; |
|
| 1082 | + } |
|
| 1083 | + // eg. count |
|
| 1038 | 1084 | |
| 1039 | 1085 | $contact = array( |
| 1040 | 1086 | 'id' => $entry['uid'][0] ? $entry['uid'][0] : $entry['entryuuid'][0], |
@@ -1254,11 +1300,17 @@ discard block |
||
| 1254 | 1300 | $contact['cat_id'] = array(); |
| 1255 | 1301 | foreach($data['category'] as $iii => $cat) |
| 1256 | 1302 | { |
| 1257 | - if (!is_int($iii)) continue; |
|
| 1303 | + if (!is_int($iii)) |
|
| 1304 | + { |
|
| 1305 | + continue; |
|
| 1306 | + } |
|
| 1258 | 1307 | |
| 1259 | 1308 | $contact['cat_id'][] = $GLOBALS['egw']->categories->name2id($cat); |
| 1260 | 1309 | } |
| 1261 | - if ($contact['cat_id']) $contact['cat_id'] = implode(',',$contact['cat_id']); |
|
| 1310 | + if ($contact['cat_id']) |
|
| 1311 | + { |
|
| 1312 | + $contact['cat_id'] = implode(',',$contact['cat_id']); |
|
| 1313 | + } |
|
| 1262 | 1314 | } |
| 1263 | 1315 | if ($data['primaryphone']) |
| 1264 | 1316 | { |
@@ -1313,7 +1365,10 @@ discard block |
||
| 1313 | 1365 | { |
| 1314 | 1366 | unset($contact); // not used, but required by function signature |
| 1315 | 1367 | static $shadowExpireNow=null; |
| 1316 | - if (!isset($shadowExpireNow)) $shadowExpireNow = floor((time()-date('Z'))/86400); |
|
| 1368 | + if (!isset($shadowExpireNow)) |
|
| 1369 | + { |
|
| 1370 | + $shadowExpireNow = floor((time()-date('Z'))/86400); |
|
| 1371 | + } |
|
| 1317 | 1372 | |
| 1318 | 1373 | // exclude expired or deactivated accounts |
| 1319 | 1374 | if (isset($data['shadowexpire']) && $data['shadowexpire'][0] <= $shadowExpireNow) |
@@ -1358,9 +1413,13 @@ discard block |
||
| 1358 | 1413 | elseif ($data['adr_one_countryname']) |
| 1359 | 1414 | { |
| 1360 | 1415 | $ldapContact['c'] = ExecMethod('phpgwapi.country.country_code',$data['adr_one_countryname']); |
| 1361 | - if ($ldapContact['c'] && strlen($ldapContact['c']) > 2) // Bad countryname when "custom" selected! |
|
| 1416 | + if ($ldapContact['c'] && strlen($ldapContact['c']) > 2) |
|
| 1417 | + { |
|
| 1418 | + // Bad countryname when "custom" selected! |
|
| 1362 | 1419 | { |
| 1363 | - $ldapContact['c'] = array(); // should return error... |
|
| 1420 | + $ldapContact['c'] = array(); |
|
| 1421 | + } |
|
| 1422 | + // should return error... |
|
| 1364 | 1423 | } |
| 1365 | 1424 | } |
| 1366 | 1425 | elseif ($isUpdate) |
@@ -1399,14 +1458,21 @@ discard block |
||
| 1399 | 1458 | if ($data['adr_one_countrycode']) |
| 1400 | 1459 | { |
| 1401 | 1460 | $ldapContact['c'] = $data['adr_one_countrycode']; |
| 1402 | - if ($isUpdate) $ldapContact['co'] = array(); |
|
| 1461 | + if ($isUpdate) |
|
| 1462 | + { |
|
| 1463 | + $ldapContact['co'] = array(); |
|
| 1464 | + } |
|
| 1403 | 1465 | } |
| 1404 | 1466 | elseif ($data['adr_one_countryname']) |
| 1405 | 1467 | { |
| 1406 | 1468 | $ldapContact['c'] = ExecMethod('phpgwapi.country.country_code',$data['adr_one_countryname']); |
| 1407 | - if ($ldapContact['c'] && strlen($ldapContact['c']) > 2) // Bad countryname when "custom" selected! |
|
| 1469 | + if ($ldapContact['c'] && strlen($ldapContact['c']) > 2) |
|
| 1408 | 1470 | { |
| 1409 | - $ldapContact['c'] = array(); // should return error... |
|
| 1471 | + // Bad countryname when "custom" selected! |
|
| 1472 | + { |
|
| 1473 | + $ldapContact['c'] = array(); |
|
| 1474 | + } |
|
| 1475 | + // should return error... |
|
| 1410 | 1476 | } |
| 1411 | 1477 | } |
| 1412 | 1478 | elseif ($isUpdate) |
@@ -111,11 +111,20 @@ discard block |
||
| 111 | 111 | { |
| 112 | 112 | $filter = is_array($param['col_filter']) ? $param['col_filter'] : array(); |
| 113 | 113 | $op = 'OR'; |
| 114 | - if (isset($param['op']) && !empty($param['op'])) $op = $param['op']; |
|
| 114 | + if (isset($param['op']) && !empty($param['op'])) |
|
| 115 | + { |
|
| 116 | + $op = $param['op']; |
|
| 117 | + } |
|
| 115 | 118 | $advanced_search = false; |
| 116 | - if (isset($param['advanced_search']) && !empty($param['advanced_search'])) $advanced_search = true; |
|
| 119 | + if (isset($param['advanced_search']) && !empty($param['advanced_search'])) |
|
| 120 | + { |
|
| 121 | + $advanced_search = true; |
|
| 122 | + } |
|
| 117 | 123 | $wildcard ='%'; |
| 118 | - if ($advanced_search || (isset($param['wildcard']) && !empty($param['wildcard']))) $wildcard = ($param['wildcard']?$param['wildcard']:''); |
|
| 124 | + if ($advanced_search || (isset($param['wildcard']) && !empty($param['wildcard']))) |
|
| 125 | + { |
|
| 126 | + $wildcard = ($param['wildcard']?$param['wildcard']:''); |
|
| 127 | + } |
|
| 119 | 128 | |
| 120 | 129 | // fix cat_id filter to search in comma-separated multiple cats and return subcats |
| 121 | 130 | if ((int)$filter['cat_id']) |
@@ -133,7 +142,11 @@ discard block |
||
| 133 | 142 | // we have no private grants in addressbook at the moment, they have then to be added here too |
| 134 | 143 | if ($param['owner']) |
| 135 | 144 | { |
| 136 | - if (!$this->grants[(int) $filter['owner']]) return false; // we have no access to that addressbook |
|
| 145 | + if (!$this->grants[(int) $filter['owner']]) |
|
| 146 | + { |
|
| 147 | + return false; |
|
| 148 | + } |
|
| 149 | + // we have no access to that addressbook |
|
| 137 | 150 | |
| 138 | 151 | $filter['owner'] = $param['owner']; |
| 139 | 152 | $filter['private'] = 0; |
@@ -196,7 +209,10 @@ discard block |
||
| 196 | 209 | $rows = parent::search($param['search'],array('org_name'),$append,$extra,$wildcard,false,$op/*'OR'*/, |
| 197 | 210 | array($param['start'],$param['num_rows']),$filter); |
| 198 | 211 | |
| 199 | - if (!$rows) return false; |
|
| 212 | + if (!$rows) |
|
| 213 | + { |
|
| 214 | + return false; |
|
| 215 | + } |
|
| 200 | 216 | |
| 201 | 217 | // query the values for *_count == 1, to display them instead |
| 202 | 218 | $filter['org_name'] = $orgs = array(); |
@@ -266,7 +282,10 @@ discard block |
||
| 266 | 282 | */ |
| 267 | 283 | function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='',$need_full_no_count=false) |
| 268 | 284 | { |
| 269 | - if ((int) $this->debug >= 4) echo '<p>'.__METHOD__.'('.array2string($criteria).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter).",'$join')</p>\n"; |
|
| 285 | + if ((int) $this->debug >= 4) |
|
| 286 | + { |
|
| 287 | + echo '<p>'.__METHOD__.'('.array2string($criteria).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter).",'$join')</p>\n"; |
|
| 288 | + } |
|
| 270 | 289 | //error_log(__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by', ".array2string($extra_cols).",'$wildcard','$empty','$op',$start,".array2string($filter).",'$join')"); |
| 271 | 290 | |
| 272 | 291 | $owner = isset($filter['owner']) ? $filter['owner'] : (isset($criteria['owner']) ? $criteria['owner'] : null); |
@@ -314,7 +333,10 @@ discard block |
||
| 314 | 333 | // no grants for selected owner/addressbook |
| 315 | 334 | if (!($filter['owner'] = array_intersect((array)$filter['owner'],array_keys($this->grants)))) |
| 316 | 335 | { |
| 317 | - if (!isset($groupmember_sql)) return false; |
|
| 336 | + if (!isset($groupmember_sql)) |
|
| 337 | + { |
|
| 338 | + return false; |
|
| 339 | + } |
|
| 318 | 340 | $filter[] = substr($groupmember_sql,4); |
| 319 | 341 | unset($filter['owner']); |
| 320 | 342 | } |
@@ -354,13 +376,16 @@ discard block |
||
| 354 | 376 | $join .= self::ACCOUNT_ACTIVE_JOIN; |
| 355 | 377 | $filter[] = str_replace('UNIX_TIMESTAMP(NOW())',time(),self::ACOUNT_ACTIVE_FILTER); |
| 356 | 378 | } |
| 357 | - if ($join || ($criteria && is_string($criteria)) || ($criteria && is_array($criteria) && $order_by)) // search also adds a join for custom fields! |
|
| 379 | + if ($join || ($criteria && is_string($criteria)) || ($criteria && is_array($criteria) && $order_by)) |
|
| 380 | + { |
|
| 381 | + // search also adds a join for custom fields! |
|
| 358 | 382 | { |
| 359 | 383 | switch(gettype($only_keys)) |
| 360 | 384 | { |
| 361 | 385 | case 'boolean': |
| 362 | 386 | // Correctly handled by parent class |
| 363 | 387 | break; |
| 388 | + } |
|
| 364 | 389 | case 'string': |
| 365 | 390 | $only_keys = explode(',',$only_keys); |
| 366 | 391 | // fall through |
@@ -370,13 +395,23 @@ discard block |
||
| 370 | 395 | if ($this->db->Type != 'mysql' && preg_match_all("/(#?[a-zA-Z_.]+) *(<> *''|IS NULL|IS NOT NULL)? *(ASC|DESC)?(,|$)/ui", |
| 371 | 396 | $order_by, $all_matches, PREG_SET_ORDER)) |
| 372 | 397 | { |
| 373 | - if (!is_array($extra_cols)) $extra_cols = $extra_cols ? explode(',',$extra_cols) : array(); |
|
| 398 | + if (!is_array($extra_cols)) |
|
| 399 | + { |
|
| 400 | + $extra_cols = $extra_cols ? explode(',',$extra_cols) : array(); |
|
| 401 | + } |
|
| 374 | 402 | foreach($all_matches as $matches) |
| 375 | 403 | { |
| 376 | 404 | $table = ''; |
| 377 | 405 | $column = $matches[1]; |
| 378 | - if ($column[0] == '#') continue; // order by custom field is handeled in so_sql_cf anyway |
|
| 379 | - if (($key = array_search($column, $this->db_cols)) !== false) $column = $key; |
|
| 406 | + if ($column[0] == '#') |
|
| 407 | + { |
|
| 408 | + continue; |
|
| 409 | + } |
|
| 410 | + // order by custom field is handeled in so_sql_cf anyway |
|
| 411 | + if (($key = array_search($column, $this->db_cols)) !== false) |
|
| 412 | + { |
|
| 413 | + $column = $key; |
|
| 414 | + } |
|
| 380 | 415 | if (strpos($column,'.') === false) |
| 381 | 416 | { |
| 382 | 417 | $table = $column == $this->extra_value ? $this->extra_table : $this->table_name; |
@@ -391,10 +426,13 @@ discard block |
||
| 391 | 426 | } |
| 392 | 427 | $extra_cols[] = $table.$column.' '.$matches[2]; |
| 393 | 428 | //_debug_array($matches); |
| 394 | - if (!empty($order_by) && $table) // postgres requires explizit order by |
|
| 429 | + if (!empty($order_by) && $table) |
|
| 430 | + { |
|
| 431 | + // postgres requires explizit order by |
|
| 395 | 432 | { |
| 396 | 433 | $order_by = str_replace($matches[0],$table.$column.' '.$matches[2].' '.$matches[3].$matches[4],$order_by); |
| 397 | 434 | } |
| 435 | + } |
|
| 398 | 436 | } |
| 399 | 437 | //_debug_array($order_by); _debug_array($extra_cols); |
| 400 | 438 | } |
@@ -420,7 +458,11 @@ discard block |
||
| 420 | 458 | } |
| 421 | 459 | $rows =& parent::search($criteria,$only_keys,$order_by,$extra_cols,$wildcard,$empty,$op,$start,$filter,$join,$need_full_no_count); |
| 422 | 460 | |
| 423 | - if ($start === false) $this->total = is_array($rows) ? count($rows) : 0; // so_sql sets total only for $start !== false! |
|
| 461 | + if ($start === false) |
|
| 462 | + { |
|
| 463 | + $this->total = is_array($rows) ? count($rows) : 0; |
|
| 464 | + } |
|
| 465 | + // so_sql sets total only for $start !== false! |
|
| 424 | 466 | |
| 425 | 467 | return $rows; |
| 426 | 468 | } |
@@ -462,7 +504,10 @@ discard block |
||
| 462 | 504 | $cat_filter = array(); |
| 463 | 505 | foreach(is_array($cats) ? $cats : (is_numeric($cats) ? array($cats) : explode(',',$cats)) as $cat) |
| 464 | 506 | { |
| 465 | - if (is_numeric($cat)) $cat_filter[] = $this->db->concat("','",cat_id,"','")." LIKE '%,$cat,%'"; |
|
| 507 | + if (is_numeric($cat)) |
|
| 508 | + { |
|
| 509 | + $cat_filter[] = $this->db->concat("','",cat_id,"','")." LIKE '%,$cat,%'"; |
|
| 510 | + } |
|
| 466 | 511 | } |
| 467 | 512 | return $cat_filter; |
| 468 | 513 | } |
@@ -475,10 +520,13 @@ discard block |
||
| 475 | 520 | */ |
| 476 | 521 | function change_owner($account_id,$new_owner) |
| 477 | 522 | { |
| 478 | - if (!$new_owner) // otherwise we would create an account (contact_owner==0) |
|
| 523 | + if (!$new_owner) |
|
| 524 | + { |
|
| 525 | + // otherwise we would create an account (contact_owner==0) |
|
| 479 | 526 | { |
| 480 | 527 | throw Api\Exception\WrongParameter(__METHOD__."($account_id, $new_owner) new owner must not be 0!"); |
| 481 | 528 | } |
| 529 | + } |
|
| 482 | 530 | // contacts |
| 483 | 531 | $this->db->update($this->table_name,array( |
| 484 | 532 | 'contact_owner' => $new_owner, |
@@ -523,7 +571,10 @@ discard block |
||
| 523 | 571 | foreach($this->db->select($this->lists_table,'*',$uid_column?array($uid_column=>$uids):$uids,__LINE__,__FILE__, |
| 524 | 572 | false,'ORDER BY list_owner<>'.(int)$GLOBALS['egw_info']['user']['account_id'].',list_name') as $row) |
| 525 | 573 | { |
| 526 | - if ($member_attr) $row['members'] = array(); |
|
| 574 | + if ($member_attr) |
|
| 575 | + { |
|
| 576 | + $row['members'] = array(); |
|
| 577 | + } |
|
| 527 | 578 | $lists[$row['list_id']] = $row; |
| 528 | 579 | } |
| 529 | 580 | if ($lists && $member_attr && in_array($member_attr,array('contact_id','contact_uid','caldav_name'))) |
@@ -564,9 +615,15 @@ discard block |
||
| 564 | 615 | function add_list($keys,$owner,$contacts=array(),array &$data=array()) |
| 565 | 616 | { |
| 566 | 617 | //error_log(__METHOD__.'('.array2string($keys).", $owner, ".array2string($contacts).', '.array2string($data).') '.function_backtrace()); |
| 567 | - if (!$keys && !$data || !(int)$owner) return false; |
|
| 618 | + if (!$keys && !$data || !(int)$owner) |
|
| 619 | + { |
|
| 620 | + return false; |
|
| 621 | + } |
|
| 568 | 622 | |
| 569 | - if ($keys && !is_array($keys)) $keys = array('list_name' => $keys); |
|
| 623 | + if ($keys && !is_array($keys)) |
|
| 624 | + { |
|
| 625 | + $keys = array('list_name' => $keys); |
|
| 626 | + } |
|
| 570 | 627 | if ($keys) |
| 571 | 628 | { |
| 572 | 629 | $keys['list_owner'] = $owner; |
@@ -586,9 +643,15 @@ discard block |
||
| 586 | 643 | } |
| 587 | 644 | $data['list_modified'] = time(); |
| 588 | 645 | $data['list_modifier'] = $GLOBALS['egw_info']['user']['account_id']; |
| 589 | - if (!$data['list_id']) unset($data['list_id']); |
|
| 646 | + if (!$data['list_id']) |
|
| 647 | + { |
|
| 648 | + unset($data['list_id']); |
|
| 649 | + } |
|
| 590 | 650 | |
| 591 | - if (!$this->db->insert($this->lists_table,$data,$keys,__LINE__,__FILE__)) return false; |
|
| 651 | + if (!$this->db->insert($this->lists_table,$data,$keys,__LINE__,__FILE__)) |
|
| 652 | + { |
|
| 653 | + return false; |
|
| 654 | + } |
|
| 592 | 655 | |
| 593 | 656 | if (!$list_id && ($list_id = $this->db->get_last_insert_id($this->lists_table,'list_id')) && |
| 594 | 657 | (!isset($data['list_uid']) || !isset($data['list_carddav_name']))) |
@@ -606,7 +669,10 @@ discard block |
||
| 606 | 669 | |
| 607 | 670 | $this->add2list($list_id,$contacts,array()); |
| 608 | 671 | } |
| 609 | - if ($keys) $data += $keys; |
|
| 672 | + if ($keys) |
|
| 673 | + { |
|
| 674 | + $data += $keys; |
|
| 675 | + } |
|
| 610 | 676 | //error_log(__METHOD__.'('.array2string($keys).", $owner, ...) data=".array2string($data).' returning '.array2string($list_id)); |
| 611 | 677 | return $list_id; |
| 612 | 678 | } |
@@ -621,7 +687,10 @@ discard block |
||
| 621 | 687 | */ |
| 622 | 688 | function add2list($contact,$list,array $existing=null) |
| 623 | 689 | { |
| 624 | - if (!(int)$list || !is_array($contact) && !(int)$contact) return false; |
|
| 690 | + if (!(int)$list || !is_array($contact) && !(int)$contact) |
|
| 691 | + { |
|
| 692 | + return false; |
|
| 693 | + } |
|
| 625 | 694 | |
| 626 | 695 | if (!is_array($existing)) |
| 627 | 696 | { |
@@ -663,7 +732,10 @@ discard block |
||
| 663 | 732 | */ |
| 664 | 733 | function remove_from_list($contact,$list=null) |
| 665 | 734 | { |
| 666 | - if (!(int)$list && !is_null($list) || !is_array($contact) && !(int)$contact) return false; |
|
| 735 | + if (!(int)$list && !is_null($list) || !is_array($contact) && !(int)$contact) |
|
| 736 | + { |
|
| 737 | + return false; |
|
| 738 | + } |
|
| 667 | 739 | |
| 668 | 740 | $where = array( |
| 669 | 741 | 'contact_id' => $contact, |
@@ -705,7 +777,10 @@ discard block |
||
| 705 | 777 | */ |
| 706 | 778 | function delete_list($list) |
| 707 | 779 | { |
| 708 | - if (!$this->db->delete($this->lists_table,array('list_id' => $list),__LINE__,__FILE__)) return false; |
|
| 780 | + if (!$this->db->delete($this->lists_table,array('list_id' => $list),__LINE__,__FILE__)) |
|
| 781 | + { |
|
| 782 | + return false; |
|
| 783 | + } |
|
| 709 | 784 | |
| 710 | 785 | $this->db->delete($this->ab2list_table,array('list_id' => $list),__LINE__,__FILE__); |
| 711 | 786 | |
@@ -720,7 +795,10 @@ discard block |
||
| 720 | 795 | */ |
| 721 | 796 | function lists_ctag($owner=null) |
| 722 | 797 | { |
| 723 | - if (is_null($owner)) $owner = array_keys($this->grants); |
|
| 798 | + if (is_null($owner)) |
|
| 799 | + { |
|
| 800 | + $owner = array_keys($this->grants); |
|
| 801 | + } |
|
| 724 | 802 | |
| 725 | 803 | if (!($modified = $this->db->select($this->lists_table,'MAX(list_modified)',array('list_owner'=>$owner), |
| 726 | 804 | __LINE__,__FILE__)->fetchColumn())) |
@@ -740,9 +818,12 @@ discard block |
||
| 740 | 818 | */ |
| 741 | 819 | function read($keys,$extra_cols='',$join='') |
| 742 | 820 | { |
| 743 | - if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) { |
|
| 821 | + if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) |
|
| 822 | + { |
|
| 744 | 823 | $minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']; |
| 745 | - } else { |
|
| 824 | + } |
|
| 825 | + else |
|
| 826 | + { |
|
| 746 | 827 | $minimum_uid_length = 8; |
| 747 | 828 | } |
| 748 | 829 | |
@@ -762,7 +843,8 @@ discard block |
||
| 762 | 843 | |
| 763 | 844 | // enforce a minium uid strength |
| 764 | 845 | if (is_array($contact) && (!isset($contact['uid']) |
| 765 | - || strlen($contact['uid']) < $minimum_uid_length)) { |
|
| 846 | + || strlen($contact['uid']) < $minimum_uid_length)) |
|
| 847 | + { |
|
| 766 | 848 | parent::update(array('uid' => Api\CalDAV::generate_uid('addressbook',$contact['id']))); |
| 767 | 849 | } |
| 768 | 850 | return $contact; |
@@ -779,19 +861,28 @@ discard block |
||
| 779 | 861 | { |
| 780 | 862 | unset($extra_where); // not used, but required by function signature |
| 781 | 863 | |
| 782 | - if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) { |
|
| 864 | + if (isset($GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length'])) |
|
| 865 | + { |
|
| 783 | 866 | $minimum_uid_length = $GLOBALS['egw_info']['user']['preferences']['syncml']['minimum_uid_length']; |
| 784 | - } else { |
|
| 867 | + } |
|
| 868 | + else |
|
| 869 | + { |
|
| 785 | 870 | $minimum_uid_length = 8; |
| 786 | 871 | } |
| 787 | 872 | |
| 788 | - if (is_array($keys) && count($keys)) $this->data_merge($keys); |
|
| 873 | + if (is_array($keys) && count($keys)) |
|
| 874 | + { |
|
| 875 | + $this->data_merge($keys); |
|
| 876 | + } |
|
| 789 | 877 | |
| 790 | 878 | $new_entry = !$this->data['id']; |
| 791 | 879 | |
| 792 | - if (isset($this->data['etag'])) // do we have an etag in the data to write |
|
| 880 | + if (isset($this->data['etag'])) |
|
| 881 | + { |
|
| 882 | + // do we have an etag in the data to write |
|
| 793 | 883 | { |
| 794 | 884 | $etag = $this->data['etag']; |
| 885 | + } |
|
| 795 | 886 | unset($this->data['etag']); |
| 796 | 887 | if (!($err = parent::save(array('contact_etag=contact_etag+1'),array('contact_etag' => $etag)))) |
| 797 | 888 | { |
@@ -839,7 +930,10 @@ discard block |
||
| 839 | 930 | */ |
| 840 | 931 | function read_list($list) |
| 841 | 932 | { |
| 842 | - if (!$list) return false; |
|
| 933 | + if (!$list) |
|
| 934 | + { |
|
| 935 | + return false; |
|
| 936 | + } |
|
| 843 | 937 | |
| 844 | 938 | return $this->db->select($this->lists_table,'*',array('list_id'=>$list),__LINE__,__FILE__)->fetch(); |
| 845 | 939 | } |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | 'config_app' => 'phpgwapi', |
| 119 | 119 | 'config_name' => array('system_charset','install_id','temp_dir'), |
| 120 | 120 | ),__LINE__,__FILE__) as $row) |
| 121 | - { |
|
| 121 | + { |
|
| 122 | 122 | $GLOBALS['egw_info']['server'][$row['config_name']] = $row['config_value']; |
| 123 | 123 | } |
| 124 | 124 | if ($GLOBALS['egw_info']['server']['system_charset'] && $GLOBALS['egw_info']['server']['system_charset'] != 'utf-8') |
@@ -131,11 +131,14 @@ discard block |
||
| 131 | 131 | // if no server timezone set, use date_default_timezone_get() to determine it once |
| 132 | 132 | // it fills to log with deprecated warnings under 5.3 otherwise |
| 133 | 133 | if (empty($GLOBALS['egw_info']['server']['server_timezone']) || |
| 134 | - $GLOBALS['egw_info']['server']['server_timezone'] == 'System/Localtime') // treat invalid tz like empty! |
|
| 134 | + $GLOBALS['egw_info']['server']['server_timezone'] == 'System/Localtime') |
|
| 135 | + { |
|
| 136 | + // treat invalid tz like empty! |
|
| 135 | 137 | { |
| 136 | 138 | try |
| 137 | 139 | { |
| 138 | 140 | $tz = new \DateTimeZone(date_default_timezone_get()); |
| 141 | + } |
|
| 139 | 142 | Config::save_value('server_timezone',$GLOBALS['egw_info']['server']['server_timezone'] = $tz->getName(),'phpgwapi'); |
| 140 | 143 | error_log(__METHOD__."() stored server_timezone=".$GLOBALS['egw_info']['server']['server_timezone']); |
| 141 | 144 | } |
@@ -301,14 +304,20 @@ discard block |
||
| 301 | 304 | exit; |
| 302 | 305 | } |
| 303 | 306 | // check if we have a session, if not try to automatic create one |
| 304 | - if ($this->session->verify()) return true; |
|
| 307 | + if ($this->session->verify()) |
|
| 308 | + { |
|
| 309 | + return true; |
|
| 310 | + } |
|
| 305 | 311 | |
| 306 | 312 | $account = null; |
| 307 | 313 | if (($account_callback = $GLOBALS['egw_info']['flags']['autocreate_session_callback']) && is_callable($account_callback) && |
| 308 | - ($sessionid = call_user_func_array($account_callback,array(&$account))) === true) // $account_call_back returns true, false or a session-id |
|
| 314 | + ($sessionid = call_user_func_array($account_callback,array(&$account))) === true) |
|
| 315 | + { |
|
| 316 | + // $account_call_back returns true, false or a session-id |
|
| 309 | 317 | { |
| 310 | 318 | $sessionid = $this->session->create($account); |
| 311 | 319 | } |
| 320 | + } |
|
| 312 | 321 | if (!$sessionid) |
| 313 | 322 | { |
| 314 | 323 | //echo "<p>account_callback='$account_callback', account=".print_r($account,true).", sessionid=$sessionid</p>\n"; exit; |
@@ -337,9 +346,15 @@ discard block |
||
| 337 | 346 | { |
| 338 | 347 | $redirect = '/login.php?'; |
| 339 | 348 | // only add "your session could not be verified", if a sessionid is given (cookie or on url) |
| 340 | - if (Session::get_sessionid()) $redirect .= 'cd=10&'; |
|
| 349 | + if (Session::get_sessionid()) |
|
| 350 | + { |
|
| 351 | + $redirect .= 'cd=10&'; |
|
| 352 | + } |
|
| 353 | + } |
|
| 354 | + if ($relpath) |
|
| 355 | + { |
|
| 356 | + $redirect .= 'phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : '')); |
|
| 341 | 357 | } |
| 342 | - if ($relpath) $redirect .= 'phpgw_forward='.urlencode($relpath.(!empty($query) ? '?'.$query : '')); |
|
| 343 | 358 | self::redirect_link($redirect); |
| 344 | 359 | } |
| 345 | 360 | } |
@@ -357,7 +372,9 @@ discard block |
||
| 357 | 372 | { |
| 358 | 373 | $this->currentapp = $GLOBALS['egw_info']['flags']['currentapp']; // some apps change it later |
| 359 | 374 | |
| 360 | - if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('api','about'))) // give everyone implicit api rights |
|
| 375 | + if (!in_array($GLOBALS['egw_info']['flags']['currentapp'], array('api','about'))) |
|
| 376 | + { |
|
| 377 | + // give everyone implicit api rights |
|
| 361 | 378 | { |
| 362 | 379 | // This will need to use ACL in the future |
| 363 | 380 | if (!$GLOBALS['egw_info']['user']['apps'][$currentapp = $GLOBALS['egw_info']['flags']['currentapp']] || |
@@ -370,6 +387,7 @@ discard block |
||
| 370 | 387 | if (($sessionid = Session::get_sessionid(true))) |
| 371 | 388 | { |
| 372 | 389 | $GLOBALS['egw']->session->destroy($sessionid); |
| 390 | + } |
|
| 373 | 391 | } |
| 374 | 392 | throw new Exception\Redirect(self::link('/logout.php')); |
| 375 | 393 | } |
@@ -555,7 +573,10 @@ discard block |
||
| 555 | 573 | try { |
| 556 | 574 | //error_log(__METHOD__."() running ".array2string($data)); |
| 557 | 575 | $callback = array_shift($data); |
| 558 | - if (!is_array($callback) || strpos($callback[1], 'session') === false) continue; |
|
| 576 | + if (!is_array($callback) || strpos($callback[1], 'session') === false) |
|
| 577 | + { |
|
| 578 | + continue; |
|
| 579 | + } |
|
| 559 | 580 | call_user_func_array($callback, $data); |
| 560 | 581 | } |
| 561 | 582 | catch (\Exception $ex) { |
@@ -565,7 +586,10 @@ discard block |
||
| 565 | 586 | } |
| 566 | 587 | // now we can close the session |
| 567 | 588 | // without closing the session fastcgi_finish_request() will NOT send output to user |
| 568 | - if (isset($GLOBALS['egw']->session) && is_object($GLOBALS['egw']->session)) $GLOBALS['egw']->session->commit_session(); |
|
| 589 | + if (isset($GLOBALS['egw']->session) && is_object($GLOBALS['egw']->session)) |
|
| 590 | + { |
|
| 591 | + $GLOBALS['egw']->session->commit_session(); |
|
| 592 | + } |
|
| 569 | 593 | |
| 570 | 594 | // flush all output to user |
| 571 | 595 | /* does NOT work on Apache :-( |
@@ -593,9 +617,12 @@ discard block |
||
| 593 | 617 | } |
| 594 | 618 | } |
| 595 | 619 | // call the asyncservice check_run function if it is not explicitly set to cron-only |
| 596 | - if (!$GLOBALS['egw_info']['server']['asyncservice']) // is default |
|
| 620 | + if (!$GLOBALS['egw_info']['server']['asyncservice']) |
|
| 621 | + { |
|
| 622 | + // is default |
|
| 597 | 623 | { |
| 598 | 624 | $async = new Asyncservice(); |
| 625 | + } |
|
| 599 | 626 | $async->check_run('fallback'); |
| 600 | 627 | } |
| 601 | 628 | $this->db->disconnect(); |