@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | /** |
| 33 | 33 | * @var array $data internal repository with acl rows for the given app and account-id (incl. memberships) |
| 34 | 34 | */ |
| 35 | - var $data = Array(); |
|
| 35 | + var $data = array(); |
|
| 36 | 36 | /** |
| 37 | 37 | * internal reference to global db-object |
| 38 | 38 | * |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | array_unshift($acl_acc_list,$this->account_id); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - $this->data = Array(); |
|
| 136 | + $this->data = array(); |
|
| 137 | 137 | foreach($this->db->select(self::TABLE,'*',array('acl_account' => $acl_acc_list ),__LINE__,__FILE__) as $row) |
| 138 | 138 | { |
| 139 | 139 | $this->data[$row['acl_appname'].'-'.$row['acl_location'].'-'.$row['acl_account']] = Db::strip_array_keys($row,'acl_'); |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | if ((int)$user > 0) $memberships = $GLOBALS['egw']->accounts->memberships($user, true); |
| 677 | 677 | $memberships[] = $user; |
| 678 | 678 | |
| 679 | - $grants = $accounts = Array(); |
|
| 679 | + $grants = $accounts = array(); |
|
| 680 | 680 | foreach($this->db->select(self::TABLE,array('acl_account','acl_rights','acl_location'),array( |
| 681 | 681 | 'acl_appname' => $app, |
| 682 | 682 | 'acl_location' => $memberships, |
@@ -47,15 +47,15 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * Constants for acl rights, like old EGW_ACL_* defines |
| 49 | 49 | */ |
| 50 | - const READ = 1; // EGW_ACL_READ |
|
| 51 | - const ADD = 2; // EGW_ACL_ADD |
|
| 52 | - const EDIT = 4; // EGW_ACL_EDIT |
|
| 53 | - const DELETE = 8; // EGW_ACL_DELETE |
|
| 54 | - const PRIVAT = 16; // EGW_ACL_PRIVATE can NOT use PRIVATE as it is a PHP keyword, using German PRIVAT instead! |
|
| 55 | - const GROUPMGRS = 32; // EGW_ACL_GROUP_MANAGERS |
|
| 56 | - const CUSTOM1 = 64; // EGW_ACL_CUSTOM_1 |
|
| 57 | - const CUSTOM2 = 128; // EGW_ACL_CUSTOM_2 |
|
| 58 | - const CUSTOM3 = 256; // EGW_ACL_CUSTOM_3 |
|
| 50 | + const READ = 1; // EGW_ACL_READ |
|
| 51 | + const ADD = 2; // EGW_ACL_ADD |
|
| 52 | + const EDIT = 4; // EGW_ACL_EDIT |
|
| 53 | + const DELETE = 8; // EGW_ACL_DELETE |
|
| 54 | + const PRIVAT = 16; // EGW_ACL_PRIVATE can NOT use PRIVATE as it is a PHP keyword, using German PRIVAT instead! |
|
| 55 | + const GROUPMGRS = 32; // EGW_ACL_GROUP_MANAGERS |
|
| 56 | + const CUSTOM1 = 64; // EGW_ACL_CUSTOM_1 |
|
| 57 | + const CUSTOM2 = 128; // EGW_ACL_CUSTOM_2 |
|
| 58 | + const CUSTOM3 = 256; // EGW_ACL_CUSTOM_3 |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * ACL constructor for setting account id |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | if ((int)$this->account_id != (int)$account_id) |
| 80 | 80 | { |
| 81 | - $this->account_id = get_account_id((int)$account_id,@$GLOBALS['egw_info']['user']['account_id']); |
|
| 81 | + $this->account_id = get_account_id((int)$account_id, @$GLOBALS['egw_info']['user']['account_id']); |
|
| 82 | 82 | } |
| 83 | 83 | $this->data = array(); |
| 84 | 84 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | function __sleep() |
| 93 | 93 | { |
| 94 | - return array('account_id','db'); |
|
| 94 | + return array('account_id', 'db'); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /**************************************************************************\ |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @param boolean|array $no_groups = false if true, do not use memberships, if array do not use given groups |
| 105 | 105 | * @return array along with storing it in $acl->data. <br> |
| 106 | 106 | */ |
| 107 | - function read_repository($no_groups=false) |
|
| 107 | + function read_repository($no_groups = false) |
|
| 108 | 108 | { |
| 109 | 109 | // For some reason, calling this via XML-RPC doesn't call the constructor. |
| 110 | 110 | // Here is yet another work around(tm) (jengo) |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | else |
| 120 | 120 | { |
| 121 | 121 | $acl_acc_list = (array)$GLOBALS['egw']->accounts->memberships($this->account_id, true); |
| 122 | - if (is_array($no_groups)) $acl_acc_list = array_diff($acl_acc_list,$no_groups); |
|
| 123 | - array_unshift($acl_acc_list,$this->account_id); |
|
| 122 | + if (is_array($no_groups)) $acl_acc_list = array_diff($acl_acc_list, $no_groups); |
|
| 123 | + array_unshift($acl_acc_list, $this->account_id); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $this->data = Array(); |
| 127 | - foreach($this->db->select(self::TABLE,'*',array('acl_account' => $acl_acc_list ),__LINE__,__FILE__) as $row) |
|
| 127 | + foreach ($this->db->select(self::TABLE, '*', array('acl_account' => $acl_acc_list), __LINE__, __FILE__) as $row) |
|
| 128 | 128 | { |
| 129 | - $this->data[$row['acl_appname'].'-'.$row['acl_location'].'-'.$row['acl_account']] = Db::strip_array_keys($row,'acl_'); |
|
| 129 | + $this->data[$row['acl_appname'].'-'.$row['acl_location'].'-'.$row['acl_account']] = Db::strip_array_keys($row, 'acl_'); |
|
| 130 | 130 | } |
| 131 | 131 | return $this->data; |
| 132 | 132 | } |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | * @param int $rights rights |
| 156 | 156 | * @return array all ACL records from $this->data. |
| 157 | 157 | */ |
| 158 | - function add($appname,$location,$rights) |
|
| 158 | + function add($appname, $location, $rights) |
|
| 159 | 159 | { |
| 160 | 160 | if (!$appname) $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 161 | 161 | |
| 162 | 162 | $row = array( |
| 163 | 163 | 'appname' => $appname, |
| 164 | 164 | 'location' => $location, |
| 165 | - 'account' => (int) $this->account_id, |
|
| 166 | - 'rights' => (int) $rights |
|
| 165 | + 'account' => (int)$this->account_id, |
|
| 166 | + 'rights' => (int)$rights |
|
| 167 | 167 | ); |
| 168 | 168 | $this->data[$row['appname'].'-'.$row['location'].'-'.$row['account']] = $row; |
| 169 | 169 | |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | * @param string/boolean $location location or false for all locations |
| 178 | 178 | * @return array all ACL records from $this->data. |
| 179 | 179 | */ |
| 180 | - function delete($appname,$location) |
|
| 180 | + function delete($appname, $location) |
|
| 181 | 181 | { |
| 182 | 182 | if (!$appname) $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 183 | 183 | |
| 184 | - foreach($this->data as $idx => $value) |
|
| 184 | + foreach ($this->data as $idx => $value) |
|
| 185 | 185 | { |
| 186 | 186 | if ($value['appname'] == $appname && |
| 187 | 187 | ($location === false || $value['location'] == $location) && |
@@ -200,24 +200,24 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | function save_repository() |
| 202 | 202 | { |
| 203 | - $this->db->delete(self::TABLE,array( |
|
| 203 | + $this->db->delete(self::TABLE, array( |
|
| 204 | 204 | 'acl_account' => $this->account_id, |
| 205 | - ),__LINE__,__FILE__); |
|
| 205 | + ), __LINE__, __FILE__); |
|
| 206 | 206 | |
| 207 | - foreach($this->data as $value) |
|
| 207 | + foreach ($this->data as $value) |
|
| 208 | 208 | { |
| 209 | 209 | if ($value['account'] == $this->account_id) |
| 210 | 210 | { |
| 211 | - $this->db->insert(self::TABLE,array( |
|
| 211 | + $this->db->insert(self::TABLE, array( |
|
| 212 | 212 | 'acl_appname' => $value['appname'], |
| 213 | 213 | 'acl_location' => $value['location'], |
| 214 | 214 | 'acl_account' => $this->account_id, |
| 215 | 215 | 'acl_rights' => $value['rights'], |
| 216 | - ),false,__LINE__,__FILE__); |
|
| 216 | + ), false, __LINE__, __FILE__); |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | if ($this->account_id == $GLOBALS['egw_info']['user']['account_id'] && |
| 220 | - method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited |
|
| 220 | + method_exists($GLOBALS['egw'], 'invalidate_session_cache')) // egw object in setup is limited |
|
| 221 | 221 | { |
| 222 | 222 | $GLOBALS['egw']->invalidate_session_cache(); |
| 223 | 223 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * @param string $appname optional defaults to $GLOBALS['egw_info']['flags']['currentapp']; |
| 236 | 236 | * @return int all rights or'ed together |
| 237 | 237 | */ |
| 238 | - function get_rights($location,$appname = '') |
|
| 238 | + function get_rights($location, $appname = '') |
|
| 239 | 239 | { |
| 240 | 240 | // For XML-RPC, change this once its working correctly for passing parameters (jengo) |
| 241 | 241 | if (is_array($location)) |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | return True; |
| 256 | 256 | } |
| 257 | 257 | $rights = 0; |
| 258 | - foreach($this->data as $value) |
|
| 258 | + foreach ($this->data as $value) |
|
| 259 | 259 | { |
| 260 | 260 | if ($value['appname'] == $appname) |
| 261 | 261 | { |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | function check($location, $required, $appname = False) |
| 284 | 284 | { |
| 285 | - $rights = $this->get_rights($location,$appname); |
|
| 285 | + $rights = $this->get_rights($location, $appname); |
|
| 286 | 286 | |
| 287 | - return !!($rights & $required); |
|
| 287 | + return !!($rights&$required); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * @param array $memberships = array() additional account_id, eg. memberships to match beside $this->account_id, default none |
| 296 | 296 | * @return int $rights |
| 297 | 297 | */ |
| 298 | - function get_specific_rights($location, $appname = '', $memberships=array()) |
|
| 298 | + function get_specific_rights($location, $appname = '', $memberships = array()) |
|
| 299 | 299 | { |
| 300 | 300 | if (!$appname) $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 301 | 301 | |
@@ -305,10 +305,10 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | $rights = 0; |
| 307 | 307 | |
| 308 | - foreach($this->data as $value) |
|
| 308 | + foreach ($this->data as $value) |
|
| 309 | 309 | { |
| 310 | 310 | if ($value['appname'] == $appname && |
| 311 | - ($value['location'] == $location || $value['location'] == 'everywhere') && |
|
| 311 | + ($value['location'] == $location || $value['location'] == 'everywhere') && |
|
| 312 | 312 | ($value['account'] == $this->account_id || $memberships && in_array($value['account'], $memberships))) |
| 313 | 313 | { |
| 314 | 314 | if ($value['rights'] == 0) |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | function check_specific($location, $required, $appname = '') |
| 333 | 333 | { |
| 334 | - $rights = $this->get_specific_rights($location,$appname); |
|
| 334 | + $rights = $this->get_specific_rights($location, $appname); |
|
| 335 | 335 | |
| 336 | - return !!($rights & $required); |
|
| 336 | + return !!($rights&$required); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | /**************************************************************************\ |
@@ -352,16 +352,16 @@ discard block |
||
| 352 | 352 | function add_repository($app, $location, $account_id, $rights) |
| 353 | 353 | { |
| 354 | 354 | //echo "<p>self::add_repository('$app','$location',$account_id,$rights);</p>\n"; |
| 355 | - $this->db->insert(self::TABLE,array( |
|
| 355 | + $this->db->insert(self::TABLE, array( |
|
| 356 | 356 | 'acl_rights' => $rights, |
| 357 | - ),array( |
|
| 357 | + ), array( |
|
| 358 | 358 | 'acl_appname' => $app, |
| 359 | 359 | 'acl_location' => $location, |
| 360 | 360 | 'acl_account' => $account_id, |
| 361 | - ),__LINE__,__FILE__); |
|
| 361 | + ), __LINE__, __FILE__); |
|
| 362 | 362 | |
| 363 | 363 | if ($account_id == $GLOBALS['egw_info']['user']['account_id'] && |
| 364 | - method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited |
|
| 364 | + method_exists($GLOBALS['egw'], 'invalidate_session_cache')) // egw object in setup is limited |
|
| 365 | 365 | { |
| 366 | 366 | $GLOBALS['egw']->invalidate_session_cache(); |
| 367 | 367 | } |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | * @param int/boolean $accountid = '' account id, default 0=$this->account_id, or false to delete all entries for $app/$location |
| 377 | 377 | * @return int number of rows deleted |
| 378 | 378 | */ |
| 379 | - function delete_repository($app, $location, $accountid='') |
|
| 379 | + function delete_repository($app, $location, $accountid = '') |
|
| 380 | 380 | { |
| 381 | 381 | static $cache_accountid = array(); |
| 382 | 382 | |
@@ -386,22 +386,22 @@ discard block |
||
| 386 | 386 | ); |
| 387 | 387 | if ($accountid !== false) |
| 388 | 388 | { |
| 389 | - if(isset($cache_accountid[$accountid]) && $cache_accountid[$accountid]) |
|
| 389 | + if (isset($cache_accountid[$accountid]) && $cache_accountid[$accountid]) |
|
| 390 | 390 | { |
| 391 | 391 | $where['acl_account'] = $cache_accountid[$accountid]; |
| 392 | 392 | } |
| 393 | 393 | else |
| 394 | 394 | { |
| 395 | - $where['acl_account'] = $cache_accountid[$accountid] = get_account_id($accountid,$this->account_id); |
|
| 395 | + $where['acl_account'] = $cache_accountid[$accountid] = get_account_id($accountid, $this->account_id); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | - if (method_exists($GLOBALS['egw'],'invalidate_session_cache')) // egw object in setup is limited |
|
| 398 | + if (method_exists($GLOBALS['egw'], 'invalidate_session_cache')) // egw object in setup is limited |
|
| 399 | 399 | { |
| 400 | 400 | $GLOBALS['egw']->invalidate_session_cache(); |
| 401 | 401 | } |
| 402 | 402 | if ($app == '%' || $app == '%%') unset($where['acl_appname']); |
| 403 | 403 | |
| 404 | - $this->db->delete(self::TABLE,$where,__LINE__,__FILE__); |
|
| 404 | + $this->db->delete(self::TABLE, $where, __LINE__, __FILE__); |
|
| 405 | 405 | |
| 406 | 406 | return $this->db->affected_rows(); |
| 407 | 407 | } |
@@ -414,15 +414,15 @@ discard block |
||
| 414 | 414 | * @param string $appname = '' defaults to current app |
| 415 | 415 | * @return int/boolean rights or false if none exist |
| 416 | 416 | */ |
| 417 | - function get_specific_rights_for_account($account_id,$location,$appname='') |
|
| 417 | + function get_specific_rights_for_account($account_id, $location, $appname = '') |
|
| 418 | 418 | { |
| 419 | 419 | if (!$appname) $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 420 | 420 | |
| 421 | - return $this->db->select(self::TABLE,'acl_rights',array( |
|
| 421 | + return $this->db->select(self::TABLE, 'acl_rights', array( |
|
| 422 | 422 | 'acl_location' => $location, |
| 423 | 423 | 'acl_account' => $account_id, |
| 424 | 424 | 'acl_appname' => $appname, |
| 425 | - ),__LINE__,__FILE__)->fetchColumn(); |
|
| 425 | + ), __LINE__, __FILE__)->fetchColumn(); |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | /** |
@@ -432,15 +432,15 @@ discard block |
||
| 432 | 432 | * @param string $appname = '' defaults to current app |
| 433 | 433 | * @return array with account => rights pairs |
| 434 | 434 | */ |
| 435 | - function get_all_rights($location,$appname='') |
|
| 435 | + function get_all_rights($location, $appname = '') |
|
| 436 | 436 | { |
| 437 | 437 | if (!$appname) $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 438 | 438 | |
| 439 | 439 | $rights = array(); |
| 440 | - foreach($this->db->select(self::TABLE,'acl_account,acl_rights',array( |
|
| 440 | + foreach ($this->db->select(self::TABLE, 'acl_account,acl_rights', array( |
|
| 441 | 441 | 'acl_location' => $location, |
| 442 | 442 | 'acl_appname' => $appname, |
| 443 | - ),__LINE__,__FILE__) as $row) |
|
| 443 | + ), __LINE__, __FILE__) as $row) |
|
| 444 | 444 | { |
| 445 | 445 | $rights[$row['acl_account']] = $row['acl_rights']; |
| 446 | 446 | } |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | * @param boolean $use_memberships = true |
| 456 | 456 | * @return array with location => rights pairs |
| 457 | 457 | */ |
| 458 | - function get_all_location_rights($account_id,$appname='',$use_memberships=true) |
|
| 458 | + function get_all_location_rights($account_id, $appname = '', $use_memberships = true) |
|
| 459 | 459 | { |
| 460 | 460 | if (!$appname) $appname = $GLOBALS['egw_info']['flags']['currentapp']; |
| 461 | 461 | |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | $accounts[] = $account_id; |
| 467 | 467 | } |
| 468 | 468 | $rights = array(); |
| 469 | - foreach($this->db->select(self::TABLE,'acl_location,acl_rights',array( |
|
| 469 | + foreach ($this->db->select(self::TABLE, 'acl_location,acl_rights', array( |
|
| 470 | 470 | 'acl_account' => $accounts, |
| 471 | 471 | 'acl_appname' => $appname, |
| 472 | - ),__LINE__,__FILE__) as $row) |
|
| 472 | + ), __LINE__, __FILE__) as $row) |
|
| 473 | 473 | { |
| 474 | 474 | $rights[$row['acl_location']] |= $row['acl_rights']; |
| 475 | 475 | } |
@@ -488,28 +488,28 @@ discard block |
||
| 488 | 488 | { |
| 489 | 489 | static $cache_accountid = array(); |
| 490 | 490 | |
| 491 | - if(isset($cache_accountid[$accountid])) |
|
| 491 | + if (isset($cache_accountid[$accountid])) |
|
| 492 | 492 | { |
| 493 | 493 | $account_id = $cache_accountid[$accountid]; |
| 494 | 494 | } |
| 495 | 495 | else |
| 496 | 496 | { |
| 497 | - $account_id = get_account_id($accountid,$this->account_id); |
|
| 497 | + $account_id = get_account_id($accountid, $this->account_id); |
|
| 498 | 498 | $cache_accountid[$accountid] = $account_id; |
| 499 | 499 | } |
| 500 | 500 | $rights = 0; |
| 501 | 501 | $apps = false; |
| 502 | - foreach($this->db->select(self::TABLE,array('acl_appname','acl_rights'),array( |
|
| 502 | + foreach ($this->db->select(self::TABLE, array('acl_appname', 'acl_rights'), array( |
|
| 503 | 503 | 'acl_location' => $location, |
| 504 | 504 | 'acl_account' => $account_id, |
| 505 | - ),__LINE__,__FILE__) as $row) |
|
| 505 | + ), __LINE__, __FILE__) as $row) |
|
| 506 | 506 | { |
| 507 | 507 | if ($row['acl_rights'] == 0) |
| 508 | 508 | { |
| 509 | 509 | return False; |
| 510 | 510 | } |
| 511 | 511 | $rights |= $row['acl_rights']; |
| 512 | - if (!!($rights & $required)) |
|
| 512 | + if (!!($rights&$required)) |
|
| 513 | 513 | { |
| 514 | 514 | $apps[] = $row['acl_appname']; |
| 515 | 515 | } |
@@ -529,21 +529,21 @@ discard block |
||
| 529 | 529 | { |
| 530 | 530 | static $cache_accountid = array(); |
| 531 | 531 | |
| 532 | - if(isset($cache_accountid[$accountid])) |
|
| 532 | + if (isset($cache_accountid[$accountid])) |
|
| 533 | 533 | { |
| 534 | 534 | $accountid = $cache_accountid[$accountid]; |
| 535 | 535 | } |
| 536 | 536 | else |
| 537 | 537 | { |
| 538 | - $accountid = $cache_accountid[$accountid] = get_account_id($accountid,$this->account_id); |
|
| 538 | + $accountid = $cache_accountid[$accountid] = get_account_id($accountid, $this->account_id); |
|
| 539 | 539 | } |
| 540 | 540 | $locations = false; |
| 541 | - foreach($this->db->select(self::TABLE,'acl_location,acl_rights',array( |
|
| 541 | + foreach ($this->db->select(self::TABLE, 'acl_location,acl_rights', array( |
|
| 542 | 542 | 'acl_appname' => $app, |
| 543 | 543 | 'acl_account' => $accountid, |
| 544 | - ),__LINE__,__FILE__) as $row) |
|
| 544 | + ), __LINE__, __FILE__) as $row) |
|
| 545 | 545 | { |
| 546 | - if ($row['acl_rights'] & $required) |
|
| 546 | + if ($row['acl_rights']&$required) |
|
| 547 | 547 | { |
| 548 | 548 | $locations[] = $row['acl_location']; |
| 549 | 549 | } |
@@ -564,14 +564,14 @@ discard block |
||
| 564 | 564 | if (!$app) $app = $GLOBALS['egw_info']['flags']['currentapp']; |
| 565 | 565 | |
| 566 | 566 | $accounts = false; |
| 567 | - foreach($this->db->select(self::TABLE,array('acl_account','acl_rights'),array( |
|
| 567 | + foreach ($this->db->select(self::TABLE, array('acl_account', 'acl_rights'), array( |
|
| 568 | 568 | 'acl_appname' => $app, |
| 569 | 569 | 'acl_location' => $location, |
| 570 | - ),__LINE__,__FILE__) as $row) |
|
| 570 | + ), __LINE__, __FILE__) as $row) |
|
| 571 | 571 | { |
| 572 | - if (!!($row['acl_rights'] & $required)) |
|
| 572 | + if (!!($row['acl_rights']&$required)) |
|
| 573 | 573 | { |
| 574 | - $accounts[] = (int) $row['acl_account']; |
|
| 574 | + $accounts[] = (int)$row['acl_account']; |
|
| 575 | 575 | } |
| 576 | 576 | } |
| 577 | 577 | return $accounts; |
@@ -583,14 +583,14 @@ discard block |
||
| 583 | 583 | * @param string $app app optional defaults to $GLOBALS['egw_info']['flags']['currentapp']; |
| 584 | 584 | * @return boolean/array false if there are no matching location in the db or array of locations |
| 585 | 585 | */ |
| 586 | - function get_locations_for_app($app='') |
|
| 586 | + function get_locations_for_app($app = '') |
|
| 587 | 587 | { |
| 588 | 588 | if (!$app) $app = $GLOBALS['egw_info']['flags']['currentapp']; |
| 589 | 589 | |
| 590 | 590 | $locations = false; |
| 591 | - foreach($this->db->select(self::TABLE,'DISTINCT '.'acl_location',array( |
|
| 591 | + foreach ($this->db->select(self::TABLE, 'DISTINCT '.'acl_location', array( |
|
| 592 | 592 | 'acl_appname' => $app, |
| 593 | - ),__LINE__,__FILE__) as $row) |
|
| 593 | + ), __LINE__, __FILE__) as $row) |
|
| 594 | 594 | { |
| 595 | 595 | if (($location = $row['acl_location']) != 'run') |
| 596 | 596 | { |
@@ -608,38 +608,38 @@ discard block |
||
| 608 | 608 | * @param boolean $add_implicit_apps = true true: add apps every user has implicit rights |
| 609 | 609 | * @return array containing list of apps |
| 610 | 610 | */ |
| 611 | - function get_user_applications($accountid = '', $use_memberships=true, $add_implicit_apps=true) |
|
| 611 | + function get_user_applications($accountid = '', $use_memberships = true, $add_implicit_apps = true) |
|
| 612 | 612 | { |
| 613 | 613 | static $cache_accountid = array(); |
| 614 | 614 | |
| 615 | - if(isset($cache_accountid[$accountid])) |
|
| 615 | + if (isset($cache_accountid[$accountid])) |
|
| 616 | 616 | { |
| 617 | 617 | $account_id = $cache_accountid[$accountid]; |
| 618 | 618 | } |
| 619 | 619 | else |
| 620 | 620 | { |
| 621 | - $account_id = get_account_id($accountid,$this->account_id); |
|
| 621 | + $account_id = get_account_id($accountid, $this->account_id); |
|
| 622 | 622 | $cache_accountid[$accountid] = $account_id; |
| 623 | 623 | } |
| 624 | 624 | if ($use_memberships && (int)$account_id > 0) $memberships = $GLOBALS['egw']->accounts->memberships($account_id, true); |
| 625 | 625 | $memberships[] = (int)$account_id; |
| 626 | 626 | |
| 627 | 627 | $apps = array(); |
| 628 | - foreach($this->db->select(self::TABLE,array('acl_appname','acl_rights'),array( |
|
| 628 | + foreach ($this->db->select(self::TABLE, array('acl_appname', 'acl_rights'), array( |
|
| 629 | 629 | 'acl_location' => 'run', |
| 630 | 630 | 'acl_account' => $memberships, |
| 631 | - ),__LINE__,__FILE__) as $row) |
|
| 631 | + ), __LINE__, __FILE__) as $row) |
|
| 632 | 632 | { |
| 633 | 633 | $app = $row['acl_appname']; |
| 634 | - if(!isset($apps[$app])) |
|
| 634 | + if (!isset($apps[$app])) |
|
| 635 | 635 | { |
| 636 | 636 | $apps[$app] = 0; |
| 637 | 637 | } |
| 638 | - $apps[$app] |= (int) $row['acl_rights']; |
|
| 638 | + $apps[$app] |= (int)$row['acl_rights']; |
|
| 639 | 639 | } |
| 640 | 640 | if ($add_implicit_apps) |
| 641 | 641 | { |
| 642 | - $apps['api'] = 1; // give everyone implicit rights for the home app |
|
| 642 | + $apps['api'] = 1; // give everyone implicit rights for the home app |
|
| 643 | 643 | } |
| 644 | 644 | return $apps; |
| 645 | 645 | } |
@@ -653,29 +653,29 @@ discard block |
||
| 653 | 653 | * @param int $user = null user whos grants to return, default current user |
| 654 | 654 | * @return array with account-ids (of owners) and granted rights as values |
| 655 | 655 | */ |
| 656 | - function get_grants($app='',$enum_group_acls=true,$user=null) |
|
| 656 | + function get_grants($app = '', $enum_group_acls = true, $user = null) |
|
| 657 | 657 | { |
| 658 | 658 | if (!$app) $app = $GLOBALS['egw_info']['flags']['currentapp']; |
| 659 | 659 | if (!$user) $user = $this->account_id; |
| 660 | 660 | |
| 661 | - static $cache = array(); // some caching withing the request |
|
| 661 | + static $cache = array(); // some caching withing the request |
|
| 662 | 662 | |
| 663 | - $grants =& $cache[$app][$user]; |
|
| 663 | + $grants = & $cache[$app][$user]; |
|
| 664 | 664 | if (!isset($grants)) |
| 665 | 665 | { |
| 666 | 666 | if ((int)$user > 0) $memberships = $GLOBALS['egw']->accounts->memberships($user, true); |
| 667 | 667 | $memberships[] = $user; |
| 668 | 668 | |
| 669 | 669 | $grants = $accounts = Array(); |
| 670 | - foreach($this->db->select(self::TABLE,array('acl_account','acl_rights','acl_location'),array( |
|
| 670 | + foreach ($this->db->select(self::TABLE, array('acl_account', 'acl_rights', 'acl_location'), array( |
|
| 671 | 671 | 'acl_appname' => $app, |
| 672 | 672 | 'acl_location' => $memberships, |
| 673 | - ),__LINE__,__FILE__) as $row) |
|
| 673 | + ), __LINE__, __FILE__) as $row) |
|
| 674 | 674 | { |
| 675 | 675 | $grantor = $row['acl_account']; |
| 676 | 676 | $rights = $row['acl_rights']; |
| 677 | 677 | |
| 678 | - if(!isset($grants[$grantor])) |
|
| 678 | + if (!isset($grants[$grantor])) |
|
| 679 | 679 | { |
| 680 | 680 | $grants[$grantor] = 0; |
| 681 | 681 | } |
@@ -683,17 +683,17 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | // if the right is granted from a group and we enummerated group ACL's |
| 685 | 685 | if ($GLOBALS['egw']->accounts->get_type($grantor) == 'g' && $enum_group_acls && |
| 686 | - (!is_array($enum_group_acls) || !in_array($grantor,$enum_group_acls))) |
|
| 686 | + (!is_array($enum_group_acls) || !in_array($grantor, $enum_group_acls))) |
|
| 687 | 687 | { |
| 688 | 688 | // return the grant for each member of the group (false = also for no longer active users) |
| 689 | - foreach((array)$GLOBALS['egw']->accounts->members($grantor, true, false) as $grantor) |
|
| 689 | + foreach ((array)$GLOBALS['egw']->accounts->members($grantor, true, false) as $grantor) |
|
| 690 | 690 | { |
| 691 | - if (!$grantor) continue; // can happen if group has no members |
|
| 691 | + if (!$grantor) continue; // can happen if group has no members |
|
| 692 | 692 | |
| 693 | 693 | // Don't allow to override private with group ACL's! |
| 694 | 694 | $rights &= ~self::PRIVAT; |
| 695 | 695 | |
| 696 | - if(!isset($grants[$grantor])) |
|
| 696 | + if (!isset($grants[$grantor])) |
|
| 697 | 697 | { |
| 698 | 698 | $grants[$grantor] = 0; |
| 699 | 699 | } |
@@ -715,21 +715,21 @@ discard block |
||
| 715 | 715 | */ |
| 716 | 716 | function delete_account($account_id) |
| 717 | 717 | { |
| 718 | - if ((int) $account_id) |
|
| 718 | + if ((int)$account_id) |
|
| 719 | 719 | { |
| 720 | 720 | // Delete all grants from this account |
| 721 | - $this->db->delete(self::TABLE,array( |
|
| 721 | + $this->db->delete(self::TABLE, array( |
|
| 722 | 722 | 'acl_account' => $account_id |
| 723 | - ),__LINE__,__FILE__); |
|
| 723 | + ), __LINE__, __FILE__); |
|
| 724 | 724 | // Delete all grants to this account |
| 725 | - $this->db->delete(self::TABLE,array( |
|
| 725 | + $this->db->delete(self::TABLE, array( |
|
| 726 | 726 | 'acl_location' => $account_id |
| 727 | - ),__LINE__, __FILE__); |
|
| 727 | + ), __LINE__, __FILE__); |
|
| 728 | 728 | // delete all memberships in account_id (if it is a group) |
| 729 | - $this->db->delete(self::TABLE,array( |
|
| 729 | + $this->db->delete(self::TABLE, array( |
|
| 730 | 730 | 'acl_appname' => 'phpgw_group', |
| 731 | 731 | 'acl_location' => $account_id, |
| 732 | - ),__LINE__,__FILE__); |
|
| 732 | + ), __LINE__, __FILE__); |
|
| 733 | 733 | } |
| 734 | 734 | } |
| 735 | 735 | |
@@ -740,15 +740,15 @@ discard block |
||
| 740 | 740 | * @param string $app app optional defaults to $GLOBALS['egw_info']['flags']['currentapp']; |
| 741 | 741 | * @return array with location => array(account => rights) pairs |
| 742 | 742 | */ |
| 743 | - function get_location_grants($location,$app='') |
|
| 743 | + function get_location_grants($location, $app = '') |
|
| 744 | 744 | { |
| 745 | 745 | if (!$app) $app = $GLOBALS['egw_info']['flags']['currentapp']; |
| 746 | 746 | |
| 747 | 747 | $locations = array(); |
| 748 | - foreach($this->db->select(self::TABLE,'acl_location,acl_account,acl_rights',array( |
|
| 748 | + foreach ($this->db->select(self::TABLE, 'acl_location,acl_account,acl_rights', array( |
|
| 749 | 749 | 'acl_appname' => $app, |
| 750 | 750 | 'acl_location LIKE '.$this->db->quote($location), |
| 751 | - ),__LINE__,__FILE__) as $row) |
|
| 751 | + ), __LINE__, __FILE__) as $row) |
|
| 752 | 752 | { |
| 753 | 753 | if (($location = $row['acl_location']) != 'run') |
| 754 | 754 | { |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | var $total; |
| 42 | 42 | var $vfs; |
| 43 | - var $vfs_basedir='/infolog'; |
|
| 43 | + var $vfs_basedir = '/infolog'; |
|
| 44 | 44 | /** |
| 45 | 45 | * Set Logging |
| 46 | 46 | * |
@@ -65,13 +65,13 @@ discard block |
||
| 65 | 65 | * |
| 66 | 66 | * @var array |
| 67 | 67 | */ |
| 68 | - var $timestamps = array('info_startdate','info_enddate','info_datemodified','info_datecompleted','info_created'); |
|
| 68 | + var $timestamps = array('info_startdate', 'info_enddate', 'info_datemodified', 'info_datecompleted', 'info_created'); |
|
| 69 | 69 | /** |
| 70 | 70 | * fields the responsible user can change |
| 71 | 71 | * |
| 72 | 72 | * @var array |
| 73 | 73 | */ |
| 74 | - var $responsible_edit=array('info_status','info_percent','info_datecompleted'); |
|
| 74 | + var $responsible_edit = array('info_status', 'info_percent', 'info_datecompleted'); |
|
| 75 | 75 | /** |
| 76 | 76 | * Fields to exclude from copy, if an entry is copied, the ones below are excluded by default. |
| 77 | 77 | * |
@@ -95,19 +95,19 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @var string |
| 97 | 97 | */ |
| 98 | - var $implicit_rights='read'; |
|
| 98 | + var $implicit_rights = 'read'; |
|
| 99 | 99 | /** |
| 100 | 100 | * Custom fields read from the infolog config |
| 101 | 101 | * |
| 102 | 102 | * @var array |
| 103 | 103 | */ |
| 104 | - var $customfields=array(); |
|
| 104 | + var $customfields = array(); |
|
| 105 | 105 | /** |
| 106 | 106 | * Group owners for certain types read from the infolog config |
| 107 | 107 | * |
| 108 | 108 | * @var array |
| 109 | 109 | */ |
| 110 | - var $group_owners=array(); |
|
| 110 | + var $group_owners = array(); |
|
| 111 | 111 | /** |
| 112 | 112 | * Current user |
| 113 | 113 | * |
@@ -174,55 +174,55 @@ discard block |
||
| 174 | 174 | function __construct($info_id = 0) |
| 175 | 175 | { |
| 176 | 176 | $this->enums = $this->stock_enums = array( |
| 177 | - 'priority' => array ( |
|
| 177 | + 'priority' => array( |
|
| 178 | 178 | 3 => 'urgent', |
| 179 | 179 | 2 => 'high', |
| 180 | 180 | 1 => 'normal', |
| 181 | 181 | 0 => 'low' |
| 182 | 182 | ), |
| 183 | 183 | 'confirm' => array( |
| 184 | - 'not' => 'not','accept' => 'accept','finish' => 'finish', |
|
| 184 | + 'not' => 'not', 'accept' => 'accept', 'finish' => 'finish', |
|
| 185 | 185 | 'both' => 'both' ), |
| 186 | 186 | 'type' => array( |
| 187 | - 'task' => 'task','phone' => 'phone','note' => 'note','email' => 'email' |
|
| 187 | + 'task' => 'task', 'phone' => 'phone', 'note' => 'note', 'email' => 'email' |
|
| 188 | 188 | /* ,'confirm' => 'confirm','reject' => 'reject','fax' => 'fax' not implemented so far */ ) |
| 189 | 189 | ); |
| 190 | 190 | $this->status = $this->stock_status = array( |
| 191 | 191 | 'defaults' => array( |
| 192 | - 'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done','email' => 'done'), |
|
| 192 | + 'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done', 'email' => 'done'), |
|
| 193 | 193 | 'task' => array( |
| 194 | - 'offer' => 'offer', // --> NEEDS-ACTION |
|
| 195 | - 'not-started' => 'not-started', // iCal NEEDS-ACTION |
|
| 196 | - 'ongoing' => 'ongoing', // iCal IN-PROCESS |
|
| 197 | - 'done' => 'done', // iCal COMPLETED |
|
| 198 | - 'cancelled' => 'cancelled', // iCal CANCELLED |
|
| 199 | - 'billed' => 'billed', // --> DONE |
|
| 200 | - 'template' => 'template', // --> cancelled |
|
| 201 | - 'nonactive' => 'nonactive', // --> cancelled |
|
| 202 | - 'archive' => 'archive' ), // --> cancelled |
|
| 194 | + 'offer' => 'offer', // --> NEEDS-ACTION |
|
| 195 | + 'not-started' => 'not-started', // iCal NEEDS-ACTION |
|
| 196 | + 'ongoing' => 'ongoing', // iCal IN-PROCESS |
|
| 197 | + 'done' => 'done', // iCal COMPLETED |
|
| 198 | + 'cancelled' => 'cancelled', // iCal CANCELLED |
|
| 199 | + 'billed' => 'billed', // --> DONE |
|
| 200 | + 'template' => 'template', // --> cancelled |
|
| 201 | + 'nonactive' => 'nonactive', // --> cancelled |
|
| 202 | + 'archive' => 'archive' ), // --> cancelled |
|
| 203 | 203 | 'phone' => array( |
| 204 | - 'not-started' => 'call', // iCal NEEDS-ACTION |
|
| 205 | - 'ongoing' => 'will-call', // iCal IN-PROCESS |
|
| 206 | - 'done' => 'done', // iCal COMPLETED |
|
| 207 | - 'billed' => 'billed' ), // --> DONE |
|
| 204 | + 'not-started' => 'call', // iCal NEEDS-ACTION |
|
| 205 | + 'ongoing' => 'will-call', // iCal IN-PROCESS |
|
| 206 | + 'done' => 'done', // iCal COMPLETED |
|
| 207 | + 'billed' => 'billed' ), // --> DONE |
|
| 208 | 208 | 'note' => array( |
| 209 | - 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 209 | + 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 210 | 210 | 'done' => 'done' ), |
| 211 | 211 | 'email' => array( |
| 212 | - 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 212 | + 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 213 | 213 | 'done' => 'done' ), |
| 214 | 214 | ); |
| 215 | 215 | if (($config_data = Api\Config::read('infolog'))) |
| 216 | 216 | { |
| 217 | 217 | if (isset($config_data['status']) && is_array($config_data['status'])) |
| 218 | 218 | { |
| 219 | - foreach(array_keys($config_data['status']) as $key) |
|
| 219 | + foreach (array_keys($config_data['status']) as $key) |
|
| 220 | 220 | { |
| 221 | 221 | if (!is_array($this->status[$key])) |
| 222 | 222 | { |
| 223 | 223 | $this->status[$key] = array(); |
| 224 | 224 | } |
| 225 | - $this->status[$key] = array_merge($this->status[$key],(array)$config_data['status'][$key]); |
|
| 225 | + $this->status[$key] = array_merge($this->status[$key], (array)$config_data['status'][$key]); |
|
| 226 | 226 | } |
| 227 | 227 | } |
| 228 | 228 | if (isset($config_data['types']) && is_array($config_data['types'])) |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | $this->customfields = Api\Storage\Customfields::get('infolog'); |
| 238 | 238 | if ($this->customfields) |
| 239 | 239 | { |
| 240 | - foreach($this->customfields as $name => $field) |
|
| 240 | + foreach ($this->customfields as $name => $field) |
|
| 241 | 241 | { |
| 242 | 242 | // old infolog customefield record |
| 243 | - if(empty($field['type'])) |
|
| 243 | + if (empty($field['type'])) |
|
| 244 | 244 | { |
| 245 | 245 | if (count($field['values'])) $field['type'] = 'select'; // selectbox |
| 246 | 246 | elseif ($field['rows'] > 1) $field['type'] = 'textarea'; // textarea |
@@ -252,23 +252,23 @@ discard block |
||
| 252 | 252 | $save_config = true; |
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | - if ($save_config) Api\Config::save_value('customfields',$this->customfields,'infolog'); |
|
| 255 | + if ($save_config) Api\Config::save_value('customfields', $this->customfields, 'infolog'); |
|
| 256 | 256 | } |
| 257 | 257 | if (is_array($config_data['responsible_edit'])) |
| 258 | 258 | { |
| 259 | - $this->responsible_edit = array_merge($this->responsible_edit,$config_data['responsible_edit']); |
|
| 259 | + $this->responsible_edit = array_merge($this->responsible_edit, $config_data['responsible_edit']); |
|
| 260 | 260 | } |
| 261 | 261 | if (is_array($config_data['copy_excludefields'])) |
| 262 | 262 | { |
| 263 | - $this->copy_excludefields = array_merge($this->copy_excludefields,$config_data['copy_excludefields']); |
|
| 263 | + $this->copy_excludefields = array_merge($this->copy_excludefields, $config_data['copy_excludefields']); |
|
| 264 | 264 | } |
| 265 | 265 | if (is_array($config_data['sub_excludefields']) && $config_data['sub_excludefields']) |
| 266 | 266 | { |
| 267 | - $this->sub_excludefields = array_merge($this->sub_excludefields,$config_data['sub_excludefields']); |
|
| 267 | + $this->sub_excludefields = array_merge($this->sub_excludefields, $config_data['sub_excludefields']); |
|
| 268 | 268 | } |
| 269 | 269 | else |
| 270 | 270 | { |
| 271 | - $this->sub_excludefields = array_merge($this->sub_excludefields,$this->default_sub_excludefields); |
|
| 271 | + $this->sub_excludefields = array_merge($this->sub_excludefields, $this->default_sub_excludefields); |
|
| 272 | 272 | } |
| 273 | 273 | if ($config_data['implicit_rights'] == 'edit') |
| 274 | 274 | { |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | $this->history = $config_data['history']; |
| 278 | 278 | } |
| 279 | 279 | // sort types by there translation |
| 280 | - foreach($this->enums['type'] as $key => $val) |
|
| 280 | + foreach ($this->enums['type'] as $key => $val) |
|
| 281 | 281 | { |
| 282 | 282 | if (($val = lang($key)) != $key.'*') $this->enums['type'][$key] = lang($key); |
| 283 | 283 | } |
@@ -286,14 +286,14 @@ discard block |
||
| 286 | 286 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 287 | 287 | |
| 288 | 288 | $this->now = time(); |
| 289 | - $this->user_time_now = Api\DateTime::server2user($this->now,'ts'); |
|
| 289 | + $this->user_time_now = Api\DateTime::server2user($this->now, 'ts'); |
|
| 290 | 290 | |
| 291 | - $this->grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true); |
|
| 291 | + $this->grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true); |
|
| 292 | 292 | $this->so = new infolog_so($this->grants); |
| 293 | 293 | |
| 294 | 294 | if ($info_id) |
| 295 | 295 | { |
| 296 | - $this->read( $info_id ); |
|
| 296 | + $this->read($info_id); |
|
| 297 | 297 | } |
| 298 | 298 | else |
| 299 | 299 | { |
@@ -309,9 +309,9 @@ discard block |
||
| 309 | 309 | */ |
| 310 | 310 | function has_customfields($type) |
| 311 | 311 | { |
| 312 | - foreach($this->customfields as $field) |
|
| 312 | + foreach ($this->customfields as $field) |
|
| 313 | 313 | { |
| 314 | - if ((!$type || empty($field['type2']) || in_array($type,is_array($field['type2']) ? $field['type2'] : explode(',',$field['type2'])))) |
|
| 314 | + if ((!$type || empty($field['type2']) || in_array($type, is_array($field['type2']) ? $field['type2'] : explode(',', $field['type2'])))) |
|
| 315 | 315 | { |
| 316 | 316 | return True; |
| 317 | 317 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | * @param int $user = null user whos rights to check, default current user |
| 329 | 329 | * @return boolean |
| 330 | 330 | */ |
| 331 | - function check_access($info,$required_rights,$other=0,$user=null) |
|
| 331 | + function check_access($info, $required_rights, $other = 0, $user = null) |
|
| 332 | 332 | { |
| 333 | 333 | static $cache = array(); |
| 334 | 334 | |
@@ -338,17 +338,17 @@ discard block |
||
| 338 | 338 | if ($user == $this->user) |
| 339 | 339 | { |
| 340 | 340 | $grants = $this->grants; |
| 341 | - if ($info_id) $access =& $cache[$info_id][$required_rights]; // we only cache the current user! |
|
| 341 | + if ($info_id) $access = & $cache[$info_id][$required_rights]; // we only cache the current user! |
|
| 342 | 342 | } |
| 343 | 343 | else |
| 344 | 344 | { |
| 345 | - $grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true,$user); |
|
| 345 | + $grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true, $user); |
|
| 346 | 346 | } |
| 347 | 347 | if (!$info) |
| 348 | 348 | { |
| 349 | 349 | $owner = $other ? $other : $user; |
| 350 | 350 | $grant = $grants[$owner]; |
| 351 | - return $grant & $required_rights; |
|
| 351 | + return $grant&$required_rights; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | |
@@ -360,10 +360,10 @@ discard block |
||
| 360 | 360 | if (!is_array($info) && !($info = $this->so->read(array('info_id' => $info_id)))) return false; |
| 361 | 361 | |
| 362 | 362 | if ($info['info_status'] == 'deleted' && |
| 363 | - ($required_rights == Acl::EDIT || // no edit rights for deleted entries |
|
| 364 | - $required_rights == Acl::ADD || // no add rights for deleted entries |
|
| 363 | + ($required_rights == Acl::EDIT || // no edit rights for deleted entries |
|
| 364 | + $required_rights == Acl::ADD || // no add rights for deleted entries |
|
| 365 | 365 | $required_rights == Acl::DELETE && ($this->history == 'history_no_delete' || // no delete at all! |
| 366 | - $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user!=$this->user)))) // delete only for admins |
|
| 366 | + $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user != $this->user)))) // delete only for admins |
|
| 367 | 367 | { |
| 368 | 368 | $access = false; |
| 369 | 369 | } |
@@ -371,12 +371,12 @@ discard block |
||
| 371 | 371 | { |
| 372 | 372 | if ($info['info_status'] != 'deleted') |
| 373 | 373 | { |
| 374 | - $access = false; // can only undelete deleted items |
|
| 374 | + $access = false; // can only undelete deleted items |
|
| 375 | 375 | } |
| 376 | 376 | else |
| 377 | 377 | { |
| 378 | 378 | // undelete requires edit rights |
| 379 | - $access = $this->so->check_access( $info,Acl::EDIT,$this->implicit_rights == 'edit',$grants,$user ); |
|
| 379 | + $access = $this->so->check_access($info, Acl::EDIT, $this->implicit_rights == 'edit', $grants, $user); |
|
| 380 | 380 | } |
| 381 | 381 | } |
| 382 | 382 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | if (!isset($access)) |
| 388 | 388 | { |
| 389 | - $access = $this->so->check_access( $info,$required_rights,$this->implicit_rights == 'edit',$grants,$user ); |
|
| 389 | + $access = $this->so->check_access($info, $required_rights, $this->implicit_rights == 'edit', $grants, $user); |
|
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | // else $cached = ' (from cache)'; |
@@ -421,12 +421,12 @@ discard block |
||
| 421 | 421 | * @param string $not_id = '' id to exclude |
| 422 | 422 | * @return boolean True if we have a linked item, False otherwise |
| 423 | 423 | */ |
| 424 | - function link_id2from(&$info,$not_app='',$not_id='') |
|
| 424 | + function link_id2from(&$info, $not_app = '', $not_id = '') |
|
| 425 | 425 | { |
| 426 | 426 | //error_log(__METHOD__ . "(subject='{$info['info_subject']}', link_id='{$info['info_link_id']}', from='{$info['info_from']}', not_app='$not_app', not_id='$not_id')"); |
| 427 | 427 | |
| 428 | 428 | if ($info['info_link_id'] > 0 && |
| 429 | - (isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) || // use supplied links info |
|
| 429 | + (isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) || // use supplied links info |
|
| 430 | 430 | ($link = Link::get_link($info['info_link_id'])) !== False)) // if link not found in supplied links, we always search! |
| 431 | 431 | { |
| 432 | 432 | if (isset($info['links']) && isset($link['app'])) |
@@ -440,11 +440,11 @@ discard block |
||
| 440 | 440 | $app = $link['link_app'.$nr]; |
| 441 | 441 | $id = $link['link_id'.$nr]; |
| 442 | 442 | } |
| 443 | - $title = Link::title($app,$id); |
|
| 443 | + $title = Link::title($app, $id); |
|
| 444 | 444 | |
| 445 | 445 | if ((string)$info['info_custom_from'] === '') // old entry |
| 446 | 446 | { |
| 447 | - $info['info_custom_from'] = (int) ($title != $info['info_from'] && @htmlentities($title) != $info['info_from']); |
|
| 447 | + $info['info_custom_from'] = (int)($title != $info['info_from'] && @htmlentities($title) != $info['info_from']); |
|
| 448 | 448 | } |
| 449 | 449 | if (!$info['info_custom_from']) |
| 450 | 450 | { |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | return $info['blur_title'] = $title; |
| 467 | 467 | } |
| 468 | 468 | $info['info_link'] = array('title' => $info['info_from']); |
| 469 | - $info['info_link_id'] = 0; // link might have been deleted |
|
| 469 | + $info['info_link_id'] = 0; // link might have been deleted |
|
| 470 | 470 | $info['info_custom_from'] = (int)!!$info['info_from']; |
| 471 | 471 | |
| 472 | 472 | return False; |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | */ |
| 478 | 478 | static function subject_from_des($des) |
| 479 | 479 | { |
| 480 | - return substr($des,0,60).' ...'; |
|
| 480 | + return substr($des, 0, 60).' ...'; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | * or NULL for timestamps in user-time |
| 493 | 493 | * or false for timestamps in server-time |
| 494 | 494 | */ |
| 495 | - function time2time(&$values, $fromTZId=false, $toTZId=null) |
|
| 495 | + function time2time(&$values, $fromTZId = false, $toTZId = null) |
|
| 496 | 496 | { |
| 497 | 497 | |
| 498 | 498 | if ($fromTZId === $toTZId) return; |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | $toTZ = Api\DateTime::$server_timezone; |
| 534 | 534 | } |
| 535 | 535 | //error_log(__METHOD__.'(values[info_enddate]='.date('Y-m-d H:i:s',$values['info_enddate']).", from=".array2string($fromTZId).", to=".array2string($toTZId).") tz=".$tz->getName().', fromTZ='.$fromTZ->getName().', toTZ='.$toTZ->getName().', userTZ='.Api\DateTime::$user_timezone->getName()); |
| 536 | - foreach($this->timestamps as $key) |
|
| 536 | + foreach ($this->timestamps as $key) |
|
| 537 | 537 | { |
| 538 | 538 | if ($values[$key]) |
| 539 | 539 | { |
@@ -542,14 +542,14 @@ discard block |
||
| 542 | 542 | if ($time->format('Hi') == '0000') |
| 543 | 543 | { |
| 544 | 544 | // we keep dates the same in new timezone |
| 545 | - $arr = Api\DateTime::to($time,'array'); |
|
| 545 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 546 | 546 | $time = new Api\DateTime($arr, $toTZ); |
| 547 | 547 | } |
| 548 | 548 | else |
| 549 | 549 | { |
| 550 | 550 | $time->setTimezone($toTZ); |
| 551 | 551 | } |
| 552 | - $values[$key] = Api\DateTime::to($time,'ts'); |
|
| 552 | + $values[$key] = Api\DateTime::to($time, 'ts'); |
|
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | //error_log(__METHOD__.'() --> values[info_enddate]='.date('Y-m-d H:i:s',$values['info_enddate'])); |
@@ -562,11 +562,11 @@ discard block |
||
| 562 | 562 | * @param string $date_format = 'ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format |
| 563 | 563 | * @return mixed depending of $date_format |
| 564 | 564 | */ |
| 565 | - function date2usertime($ts,$date_format='ts') |
|
| 565 | + function date2usertime($ts, $date_format = 'ts') |
|
| 566 | 566 | { |
| 567 | 567 | if (empty($ts) || $date_format == 'server') return $ts; |
| 568 | 568 | |
| 569 | - return Api\DateTime::server2user($ts,$date_format); |
|
| 569 | + return Api\DateTime::server2user($ts, $date_format); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | /** |
@@ -581,10 +581,10 @@ discard block |
||
| 581 | 581 | * |
| 582 | 582 | * @return array|boolean infolog entry, null if not found or false if no permission to read it |
| 583 | 583 | */ |
| 584 | - function &read($info_id,$run_link_id2from=true,$date_format='ts',$ignore_acl=false) |
|
| 584 | + function &read($info_id, $run_link_id2from = true, $date_format = 'ts', $ignore_acl = false) |
|
| 585 | 585 | { |
| 586 | 586 | //error_log(__METHOD__.'('.array2string($info_id).', '.array2string($run_link_id2from).", '$date_format') ".function_backtrace()); |
| 587 | - if (is_scalar($info_id) || isset($info_id[count($info_id)-1])) |
|
| 587 | + if (is_scalar($info_id) || isset($info_id[count($info_id) - 1])) |
|
| 588 | 588 | { |
| 589 | 589 | if (is_scalar($info_id) && !is_numeric($info_id)) |
| 590 | 590 | { |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | return null; |
| 602 | 602 | } |
| 603 | 603 | |
| 604 | - if (!$ignore_acl && !$this->check_access($data,Acl::READ)) // check behind read, to prevent a double read |
|
| 604 | + if (!$ignore_acl && !$this->check_access($data, Acl::READ)) // check behind read, to prevent a double read |
|
| 605 | 605 | { |
| 606 | 606 | return False; |
| 607 | 607 | } |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | * @param boolean $skip_notification Do not send notification of delete |
| 634 | 634 | * @return boolean True if delete was successful, False otherwise ($info_id does not exist or no rights) |
| 635 | 635 | */ |
| 636 | - function delete($info_id,$delete_children=False,$new_parent=False, $skip_notification=False) |
|
| 636 | + function delete($info_id, $delete_children = False, $new_parent = False, $skip_notification = False) |
|
| 637 | 637 | { |
| 638 | 638 | if (is_array($info_id)) |
| 639 | 639 | { |
@@ -643,18 +643,18 @@ discard block |
||
| 643 | 643 | { |
| 644 | 644 | return False; |
| 645 | 645 | } |
| 646 | - if (!$this->check_access($info,Acl::DELETE)) |
|
| 646 | + if (!$this->check_access($info, Acl::DELETE)) |
|
| 647 | 647 | { |
| 648 | 648 | return False; |
| 649 | 649 | } |
| 650 | 650 | // check if we have children and delete or re-parent them |
| 651 | 651 | if (($children = $this->so->get_children($info_id))) |
| 652 | 652 | { |
| 653 | - foreach($children as $id => $owner) |
|
| 653 | + foreach ($children as $id => $owner) |
|
| 654 | 654 | { |
| 655 | - if ($delete_children && $this->so->grants[$owner] & Acl::DELETE) |
|
| 655 | + if ($delete_children && $this->so->grants[$owner]&Acl::DELETE) |
|
| 656 | 656 | { |
| 657 | - $this->delete($id,$delete_children,$new_parent,$skip_notification); // call ourself recursive to delete the child |
|
| 657 | + $this->delete($id, $delete_children, $new_parent, $skip_notification); // call ourself recursive to delete the child |
|
| 658 | 658 | } |
| 659 | 659 | else // dont delete or no rights to delete the child --> re-parent it |
| 660 | 660 | { |
@@ -673,28 +673,28 @@ discard block |
||
| 673 | 673 | // if we have history switched on and not an already deleted item --> set only status deleted |
| 674 | 674 | if ($this->history && $info['info_status'] != 'deleted') |
| 675 | 675 | { |
| 676 | - if ($info['info_status'] == 'deleted') return false; // entry already deleted |
|
| 676 | + if ($info['info_status'] == 'deleted') return false; // entry already deleted |
|
| 677 | 677 | |
| 678 | 678 | $this->so->write($deleted); |
| 679 | 679 | |
| 680 | - Link::unlink(0,'infolog',$info_id,'','!file','',true); // keep the file attachments, hide the rest |
|
| 680 | + Link::unlink(0, 'infolog', $info_id, '', '!file', '', true); // keep the file attachments, hide the rest |
|
| 681 | 681 | } |
| 682 | 682 | else |
| 683 | 683 | { |
| 684 | - $this->so->delete($info_id,false); // we delete the children via bo to get all notifications! |
|
| 684 | + $this->so->delete($info_id, false); // we delete the children via bo to get all notifications! |
|
| 685 | 685 | |
| 686 | - Link::unlink(0,'infolog',$info_id); |
|
| 686 | + Link::unlink(0, 'infolog', $info_id); |
|
| 687 | 687 | } |
| 688 | 688 | if ($info['info_status'] != 'deleted') // dont notify of final purge of already deleted items |
| 689 | 689 | { |
| 690 | 690 | // send email notifications and do the history logging |
| 691 | - if(!$skip_notification) |
|
| 691 | + if (!$skip_notification) |
|
| 692 | 692 | { |
| 693 | 693 | if (!is_object($this->tracking)) |
| 694 | 694 | { |
| 695 | 695 | $this->tracking = new infolog_tracking($this); |
| 696 | 696 | } |
| 697 | - $this->tracking->track($deleted,$info,$this->user,true); |
|
| 697 | + $this->tracking->track($deleted, $info, $this->user, true); |
|
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | 700 | return True; |
@@ -716,13 +716,13 @@ discard block |
||
| 716 | 716 | * |
| 717 | 717 | * @return int|boolean info_id on a successfull write or false |
| 718 | 718 | */ |
| 719 | - function write(&$values_in, $check_defaults=true, $touch_modified=true, $user2server=true, |
|
| 720 | - $skip_notification=false, $throw_exception=false, $purge_cfs=null, $ignore_acl=false) |
|
| 719 | + function write(&$values_in, $check_defaults = true, $touch_modified = true, $user2server = true, |
|
| 720 | + $skip_notification = false, $throw_exception = false, $purge_cfs = null, $ignore_acl = false) |
|
| 721 | 721 | { |
| 722 | 722 | $values = $values_in; |
| 723 | 723 | //echo "boinfolog::write()values="; _debug_array($values); |
| 724 | - if (!$ignore_acl && (!$values['info_id'] && !$this->check_access(0,Acl::EDIT,$values['info_owner']) && |
|
| 725 | - !$this->check_access(0,Acl::ADD,$values['info_owner']))) |
|
| 724 | + if (!$ignore_acl && (!$values['info_id'] && !$this->check_access(0, Acl::EDIT, $values['info_owner']) && |
|
| 725 | + !$this->check_access(0, Acl::ADD, $values['info_owner']))) |
|
| 726 | 726 | { |
| 727 | 727 | return false; |
| 728 | 728 | } |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | $old = $this->read($values['info_id'], false, 'server', $ignore_acl); |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - if (($status_only = !$ignore_acl && $values['info_id'] && !$this->check_access($values,Acl::EDIT))) |
|
| 735 | + if (($status_only = !$ignore_acl && $values['info_id'] && !$this->check_access($values, Acl::EDIT))) |
|
| 736 | 736 | { |
| 737 | 737 | if (!isset($values['info_responsible'])) |
| 738 | 738 | { |
@@ -744,21 +744,21 @@ discard block |
||
| 744 | 744 | } |
| 745 | 745 | if (!($status_only = in_array($this->user, (array)$responsible))) // responsible has implicit right to change status |
| 746 | 746 | { |
| 747 | - $status_only = !!array_intersect((array)$responsible,array_keys($GLOBALS['egw']->accounts->memberships($this->user))); |
|
| 747 | + $status_only = !!array_intersect((array)$responsible, array_keys($GLOBALS['egw']->accounts->memberships($this->user))); |
|
| 748 | 748 | } |
| 749 | 749 | if (!$status_only && $values['info_status'] != 'deleted') |
| 750 | 750 | { |
| 751 | - $status_only = $undelete = $this->check_access($values['info_id'],self::ACL_UNDELETE); |
|
| 751 | + $status_only = $undelete = $this->check_access($values['info_id'], self::ACL_UNDELETE); |
|
| 752 | 752 | } |
| 753 | 753 | } |
| 754 | - if (!$ignore_acl && ($values['info_id'] && !$this->check_access($values['info_id'],Acl::EDIT) && !$status_only || |
|
| 755 | - !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],Acl::ADD))) |
|
| 754 | + if (!$ignore_acl && ($values['info_id'] && !$this->check_access($values['info_id'], Acl::EDIT) && !$status_only || |
|
| 755 | + !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'], Acl::ADD))) |
|
| 756 | 756 | { |
| 757 | 757 | return false; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | 760 | // Make sure status is still valid if the type changes |
| 761 | - if($old['info_type'] != $values['info_type'] && $values['info_status']) |
|
| 761 | + if ($old['info_type'] != $values['info_type'] && $values['info_status']) |
|
| 762 | 762 | { |
| 763 | 763 | if (isset($this->status[$values['info_type']]) && |
| 764 | 764 | !in_array($values['info_status'], array_keys($this->status[$values['info_type']]))) |
@@ -768,8 +768,8 @@ discard block |
||
| 768 | 768 | } |
| 769 | 769 | if ($status_only && !$undelete) // make sure only status gets writen |
| 770 | 770 | { |
| 771 | - $set_completed = !$values['info_datecompleted'] && // set date completed of finished job, only if its not already set |
|
| 772 | - in_array($values['info_status'],array('done','billed','cancelled')); |
|
| 771 | + $set_completed = !$values['info_datecompleted'] && // set date completed of finished job, only if its not already set |
|
| 772 | + in_array($values['info_status'], array('done', 'billed', 'cancelled')); |
|
| 773 | 773 | |
| 774 | 774 | $values = $old; |
| 775 | 775 | // only overwrite explicitly allowed fields |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | $values['info_percent'] = 100; |
| 785 | 785 | $forcestatus = true; |
| 786 | 786 | $status = 'done'; |
| 787 | - if (isset($values['info_type']) && !in_array($values['info_status'],array('done','billed','cancelled'))) { |
|
| 787 | + if (isset($values['info_type']) && !in_array($values['info_status'], array('done', 'billed', 'cancelled'))) { |
|
| 788 | 788 | $forcestatus = false; |
| 789 | 789 | //echo "set_completed:"; _debug_array($this->status[$values['info_type']]); |
| 790 | 790 | if (isset($this->status[$values['info_type']]['done'])) { |
@@ -798,19 +798,19 @@ discard block |
||
| 798 | 798 | $status = 'cancelled'; |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | - if ($forcestatus && !in_array($values['info_status'],array('done','billed','cancelled'))) $values['info_status'] = $status; |
|
| 801 | + if ($forcestatus && !in_array($values['info_status'], array('done', 'billed', 'cancelled'))) $values['info_status'] = $status; |
|
| 802 | 802 | } |
| 803 | 803 | $check_defaults = false; |
| 804 | 804 | } |
| 805 | 805 | if ($check_defaults) |
| 806 | 806 | { |
| 807 | 807 | if (!$values['info_datecompleted'] && |
| 808 | - (in_array($values['info_status'],array('done','billed')))) |
|
| 808 | + (in_array($values['info_status'], array('done', 'billed')))) |
|
| 809 | 809 | { |
| 810 | - $values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now; // set date completed to today if status == done |
|
| 810 | + $values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now; // set date completed to today if status == done |
|
| 811 | 811 | } |
| 812 | 812 | // Check for valid status / percent combinations |
| 813 | - if (in_array($values['info_status'],array('done','billed'))) |
|
| 813 | + if (in_array($values['info_status'], array('done', 'billed'))) |
|
| 814 | 814 | { |
| 815 | 815 | $values['info_percent'] = 100; |
| 816 | 816 | } |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | // We change percent to match status, not status to match percent |
| 826 | 826 | $values['info_percent'] = 10; |
| 827 | 827 | } |
| 828 | - if ((int)$values['info_percent'] == 100 && !in_array($values['info_status'],array('done','billed','cancelled','archive'))) |
|
| 828 | + if ((int)$values['info_percent'] == 100 && !in_array($values['info_status'], array('done', 'billed', 'cancelled', 'archive'))) |
|
| 829 | 829 | { |
| 830 | 830 | //echo "check_defaults:"; _debug_array($this->status[$values['info_type']]); |
| 831 | 831 | //$values['info_status'] = 'done'; |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | } |
| 847 | 847 | if ($values['info_responsible'] && $values['info_status'] == 'offer') |
| 848 | 848 | { |
| 849 | - $values['info_status'] = 'not-started'; // have to match if not finished |
|
| 849 | + $values['info_status'] = 'not-started'; // have to match if not finished |
|
| 850 | 850 | } |
| 851 | 851 | if (isset($values['info_subject']) && empty($values['info_subject'])) |
| 852 | 852 | { |
@@ -854,18 +854,18 @@ discard block |
||
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | // Check required custom fields |
| 857 | - if($throw_exception) |
|
| 857 | + if ($throw_exception) |
|
| 858 | 858 | { |
| 859 | 859 | $custom = Api\Storage\Customfields::get('infolog'); |
| 860 | - foreach($custom as $c_name => $c_field) |
|
| 860 | + foreach ($custom as $c_name => $c_field) |
|
| 861 | 861 | { |
| 862 | - if($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',',$c_field['type2']); |
|
| 863 | - if($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'],$type2))) |
|
| 862 | + if ($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',', $c_field['type2']); |
|
| 863 | + if ($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'], $type2))) |
|
| 864 | 864 | { |
| 865 | 865 | // Required custom field |
| 866 | - if(!$values['#'.$c_name]) |
|
| 866 | + if (!$values['#'.$c_name]) |
|
| 867 | 867 | { |
| 868 | - throw new Api\Exception\WrongUserinput(lang('For infolog type %1, %2 is required',lang($values['info_type']),$c_field['label'])); |
|
| 868 | + throw new Api\Exception\WrongUserinput(lang('For infolog type %1, %2 is required', lang($values['info_type']), $c_field['label'])); |
|
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | } |
@@ -874,16 +874,16 @@ discard block |
||
| 874 | 874 | if (isset($this->group_owners[$values['info_type']])) |
| 875 | 875 | { |
| 876 | 876 | $values['info_owner'] = $this->group_owners[$values['info_type']]; |
| 877 | - if (!$ignore_acl && !($this->grants[$this->group_owners[$values['info_type']]] & Acl::EDIT)) |
|
| 877 | + if (!$ignore_acl && !($this->grants[$this->group_owners[$values['info_type']]]&Acl::EDIT)) |
|
| 878 | 878 | { |
| 879 | - if (!$this->check_access($values['info_id'],Acl::EDIT) || |
|
| 880 | - !$values['info_id'] && !$this->check_access($values,Acl::ADD) |
|
| 879 | + if (!$this->check_access($values['info_id'], Acl::EDIT) || |
|
| 880 | + !$values['info_id'] && !$this->check_access($values, Acl::ADD) |
|
| 881 | 881 | ) |
| 882 | 882 | { |
| 883 | - return false; // no edit rights from the group-owner and no implicit rights (delegated and sufficient rights) |
|
| 883 | + return false; // no edit rights from the group-owner and no implicit rights (delegated and sufficient rights) |
|
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | - $values['info_access'] = 'public'; // group-owners are allways public |
|
| 886 | + $values['info_access'] = 'public'; // group-owners are allways public |
|
| 887 | 887 | } |
| 888 | 888 | elseif (!$values['info_id'] && !$values['info_owner'] || $GLOBALS['egw']->accounts->get_type($values['info_owner']) == 'g') |
| 889 | 889 | { |
@@ -938,10 +938,10 @@ discard block |
||
| 938 | 938 | $to_write['info_id'] = $info_id; |
| 939 | 939 | |
| 940 | 940 | // if the info responbsible array is not passed, fetch it from old. |
| 941 | - if (!array_key_exists('info_responsible',$values)) $values['info_responsible'] = $old['info_responsible']; |
|
| 941 | + if (!array_key_exists('info_responsible', $values)) $values['info_responsible'] = $old['info_responsible']; |
|
| 942 | 942 | if (!is_array($values['info_responsible'])) // this should not happen, bug it does ;-) |
| 943 | 943 | { |
| 944 | - $values['info_responsible'] = $values['info_responsible'] ? explode(',',$values['info_responsible']) : array(); |
|
| 944 | + $values['info_responsible'] = $values['info_responsible'] ? explode(',', $values['info_responsible']) : array(); |
|
| 945 | 945 | $to_write['info_responsible'] = $values['info_responsible']; |
| 946 | 946 | } |
| 947 | 947 | |
@@ -949,11 +949,11 @@ discard block |
||
| 949 | 949 | if (!$old && is_array($to_write['link_to']['to_id']) && count($to_write['link_to']['to_id'])) |
| 950 | 950 | { |
| 951 | 951 | //echo "<p>writing links for new entry $info_id</p>\n"; _debug_array($content['link_to']['to_id']); |
| 952 | - Link::link('infolog',$info_id,$to_write['link_to']['to_id']); |
|
| 952 | + Link::link('infolog', $info_id, $to_write['link_to']['to_id']); |
|
| 953 | 953 | $values['link_to']['to_id'] = $info_id; |
| 954 | 954 | } |
| 955 | 955 | $this->write_check_links($to_write); |
| 956 | - if(!$values['info_link_id'] || $values['info_link_id'] != $to_write['info_link_id']) |
|
| 956 | + if (!$values['info_link_id'] || $values['info_link_id'] != $to_write['info_link_id']) |
|
| 957 | 957 | { |
| 958 | 958 | // Just got a link ID, need to save it |
| 959 | 959 | $this->so->write($to_write); |
@@ -968,20 +968,20 @@ discard block |
||
| 968 | 968 | } |
| 969 | 969 | |
| 970 | 970 | // create (and remove) links in custom fields |
| 971 | - if(!is_array($old)) |
|
| 971 | + if (!is_array($old)) |
|
| 972 | 972 | { |
| 973 | 973 | $old = array(); |
| 974 | 974 | } |
| 975 | - Api\Storage\Customfields::update_links('infolog',$values,$old,'info_id'); |
|
| 975 | + Api\Storage\Customfields::update_links('infolog', $values, $old, 'info_id'); |
|
| 976 | 976 | |
| 977 | 977 | // Check for restore of deleted entry, restore held links |
| 978 | - if($old['info_status'] == 'deleted' && $values['info_status'] != 'deleted') |
|
| 978 | + if ($old['info_status'] == 'deleted' && $values['info_status'] != 'deleted') |
|
| 979 | 979 | { |
| 980 | 980 | Link::restore('infolog', $info_id); |
| 981 | 981 | } |
| 982 | 982 | |
| 983 | 983 | // notify the link-class about the update, as other apps may be subscribt to it |
| 984 | - Link::notify_update('infolog',$info_id,$values); |
|
| 984 | + Link::notify_update('infolog', $info_id, $values); |
|
| 985 | 985 | |
| 986 | 986 | // pre-cache the new values |
| 987 | 987 | self::set_link_cache($values); |
@@ -992,39 +992,39 @@ discard block |
||
| 992 | 992 | $this->tracking = new infolog_tracking($this); |
| 993 | 993 | } |
| 994 | 994 | |
| 995 | - if ($old && ($missing_fields = array_diff_key($old,$values))) |
|
| 995 | + if ($old && ($missing_fields = array_diff_key($old, $values))) |
|
| 996 | 996 | { |
| 997 | 997 | // Some custom fields (multiselect with nothing selected) will be missing, |
| 998 | 998 | // and that's OK. Don't put them back. |
| 999 | - foreach(array_keys($missing_fields) as $field) |
|
| 999 | + foreach (array_keys($missing_fields) as $field) |
|
| 1000 | 1000 | { |
| 1001 | - if(array_key_exists($field, $values_in)) |
|
| 1001 | + if (array_key_exists($field, $values_in)) |
|
| 1002 | 1002 | { |
| 1003 | 1003 | unset($missing_fields[$field]); |
| 1004 | 1004 | } |
| 1005 | 1005 | } |
| 1006 | - $values = array_merge($values,$missing_fields); |
|
| 1006 | + $values = array_merge($values, $missing_fields); |
|
| 1007 | 1007 | } |
| 1008 | 1008 | // Add keys missing in the $to_write array |
| 1009 | - if (($missing_fields = array_diff_key($values,$to_write))) |
|
| 1009 | + if (($missing_fields = array_diff_key($values, $to_write))) |
|
| 1010 | 1010 | { |
| 1011 | - $to_write = array_merge($to_write,$missing_fields); |
|
| 1011 | + $to_write = array_merge($to_write, $missing_fields); |
|
| 1012 | 1012 | } |
| 1013 | - $this->tracking->track($to_write,$old,$this->user,$values['info_status'] == 'deleted' || $old['info_status'] == 'deleted', |
|
| 1014 | - null,$skip_notification); |
|
| 1013 | + $this->tracking->track($to_write, $old, $this->user, $values['info_status'] == 'deleted' || $old['info_status'] == 'deleted', |
|
| 1014 | + null, $skip_notification); |
|
| 1015 | 1015 | |
| 1016 | 1016 | if ($info_from_set) $values['info_from'] = ''; |
| 1017 | 1017 | |
| 1018 | 1018 | // Change new values back to user time before sending them back |
| 1019 | - if($user2server) |
|
| 1019 | + if ($user2server) |
|
| 1020 | 1020 | { |
| 1021 | 1021 | $this->time2time($values); |
| 1022 | 1022 | } |
| 1023 | 1023 | // merge changes (keeping extra values from the UI) |
| 1024 | - $values_in = array_merge($values_in,$values); |
|
| 1024 | + $values_in = array_merge($values_in, $values); |
|
| 1025 | 1025 | |
| 1026 | 1026 | // Update modified timestamp of parent |
| 1027 | - if($values['info_id_parent'] && $touch_modified) |
|
| 1027 | + if ($values['info_id_parent'] && $touch_modified) |
|
| 1028 | 1028 | { |
| 1029 | 1029 | $parent = $this->read($values['info_id_parent'], false, 'server', true); |
| 1030 | 1030 | $this->write($parent, false, true, false, true, false, null, $ignore_acl); |
@@ -1044,9 +1044,9 @@ discard block |
||
| 1044 | 1044 | protected function write_check_links(&$values) |
| 1045 | 1045 | { |
| 1046 | 1046 | $old_link_id = (int)$values['info_link_id']; |
| 1047 | - if($values['info_contact']) |
|
| 1047 | + if ($values['info_contact']) |
|
| 1048 | 1048 | { |
| 1049 | - if(is_array($values['info_contact'])) |
|
| 1049 | + if (is_array($values['info_contact'])) |
|
| 1050 | 1050 | { |
| 1051 | 1051 | // eTemplate2 returns the array all ready |
| 1052 | 1052 | $app = $values['info_contact']['app']; |
@@ -1063,14 +1063,14 @@ discard block |
||
| 1063 | 1063 | } |
| 1064 | 1064 | elseif ($app && $id) |
| 1065 | 1065 | { |
| 1066 | - if(!is_array($values['link_to'])) |
|
| 1066 | + if (!is_array($values['link_to'])) |
|
| 1067 | 1067 | { |
| 1068 | 1068 | $values['link_to'] = array(); |
| 1069 | 1069 | } |
| 1070 | 1070 | $values['info_link_id'] = (int)($info_link_id = Link::link( |
| 1071 | 1071 | 'infolog', |
| 1072 | 1072 | $values['info_id'], |
| 1073 | - $app,$id |
|
| 1073 | + $app, $id |
|
| 1074 | 1074 | )); |
| 1075 | 1075 | } |
| 1076 | 1076 | else |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | { |
| 1083 | 1083 | $link = Link::get_link($old_link_id); |
| 1084 | 1084 | // remove selected project, if removed link is that project |
| 1085 | - if($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $values['old_pm_id']) |
|
| 1085 | + if ($link['link_app2'] == 'projectmanager' && $link['link_id2'] == $values['old_pm_id']) |
|
| 1086 | 1086 | { |
| 1087 | 1087 | unset($values['pm_id'], $values['old_pm_id']); |
| 1088 | 1088 | } |
@@ -1101,9 +1101,9 @@ discard block |
||
| 1101 | 1101 | * @param int|array $info_id id |
| 1102 | 1102 | * @return int|array number of subs |
| 1103 | 1103 | */ |
| 1104 | - function anzSubs( $info_id ) |
|
| 1104 | + function anzSubs($info_id) |
|
| 1105 | 1105 | { |
| 1106 | - return $this->so->anzSubs( $info_id ); |
|
| 1106 | + return $this->so->anzSubs($info_id); |
|
| 1107 | 1107 | } |
| 1108 | 1108 | |
| 1109 | 1109 | /** |
@@ -1120,23 +1120,23 @@ discard block |
||
| 1120 | 1120 | * @param boolean $no_acl =false true: ignore all acl |
| 1121 | 1121 | * @return array with id's as key of the matching log-entries |
| 1122 | 1122 | */ |
| 1123 | - function &search(&$query, $no_acl=false) |
|
| 1123 | + function &search(&$query, $no_acl = false) |
|
| 1124 | 1124 | { |
| 1125 | 1125 | //error_log(__METHOD__.'('.array2string($query).')'); |
| 1126 | 1126 | |
| 1127 | - if($query['filter'] == 'bydate') |
|
| 1127 | + if ($query['filter'] == 'bydate') |
|
| 1128 | 1128 | { |
| 1129 | 1129 | if (is_int($query['startdate'])) $query['col_filter'][] = 'info_startdate >= '.$GLOBALS['egw']->db->quote($query['startdate']); |
| 1130 | - if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1); |
|
| 1130 | + if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate'] + (60 * 60 * 24) - 1); |
|
| 1131 | 1131 | } |
| 1132 | 1132 | elseif ($query['filter'] == 'duedate') |
| 1133 | 1133 | { |
| 1134 | 1134 | if (is_int($query['startdate'])) $query['col_filter'][] = 'info_enddate >= '.$GLOBALS['egw']->db->quote($query['startdate']); |
| 1135 | - if (is_int($query['enddate'])) $query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1); |
|
| 1135 | + if (is_int($query['enddate'])) $query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate'] + (60 * 60 * 24) - 1); |
|
| 1136 | 1136 | } |
| 1137 | 1137 | elseif ($query['filter'] == 'private') |
| 1138 | 1138 | { |
| 1139 | - $query['col_filter'][] = 'info_access = ' . $GLOBALS['egw']->db->quote('private'); |
|
| 1139 | + $query['col_filter'][] = 'info_access = '.$GLOBALS['egw']->db->quote('private'); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | if (!isset($query['date_format']) || $query['date_format'] != 'server') |
| 1142 | 1142 | { |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | { |
| 1147 | 1147 | if (!empty($query['col_filter'][$key])) |
| 1148 | 1148 | { |
| 1149 | - $query['col_filter'][$key] = Api\DateTime::user2server($query['col_filter'][$key],'ts'); |
|
| 1149 | + $query['col_filter'][$key] = Api\DateTime::user2server($query['col_filter'][$key], 'ts'); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | } |
| 1152 | 1152 | } |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | { |
| 1160 | 1160 | foreach ($ret as $id => &$data) |
| 1161 | 1161 | { |
| 1162 | - if (!$no_acl && !$this->check_access($data,Acl::READ)) |
|
| 1162 | + if (!$no_acl && !$this->check_access($data, Acl::READ)) |
|
| 1163 | 1163 | { |
| 1164 | 1164 | unset($ret[$id]); |
| 1165 | 1165 | continue; |
@@ -1175,7 +1175,7 @@ discard block |
||
| 1175 | 1175 | if ($time->format('Hi') == '0000') |
| 1176 | 1176 | { |
| 1177 | 1177 | // we keep dates the same in user-time |
| 1178 | - $arr = Api\DateTime::to($time,'array'); |
|
| 1178 | + $arr = Api\DateTime::to($time, 'array'); |
|
| 1179 | 1179 | $time = new Api\DateTime($arr, Api\DateTime::$user_timezone); |
| 1180 | 1180 | } |
| 1181 | 1181 | else |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | $time->setTimezone(Api\DateTime::$user_timezone); |
| 1184 | 1184 | } |
| 1185 | 1185 | } |
| 1186 | - $data[$key] = Api\DateTime::to($time,'ts'); |
|
| 1186 | + $data[$key] = Api\DateTime::to($time, 'ts'); |
|
| 1187 | 1187 | } |
| 1188 | 1188 | } |
| 1189 | 1189 | // pre-cache title and file access |
@@ -1200,7 +1200,7 @@ discard block |
||
| 1200 | 1200 | * @param array $filter = array('filter'=>'own','info_type'=>'task') |
| 1201 | 1201 | * @return string |
| 1202 | 1202 | */ |
| 1203 | - public function getctag(array $filter=array('filter'=>'own','info_type'=>'task')) |
|
| 1203 | + public function getctag(array $filter = array('filter'=>'own', 'info_type'=>'task')) |
|
| 1204 | 1204 | { |
| 1205 | 1205 | $filter += array( |
| 1206 | 1206 | 'order' => 'info_datemodified', |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | // we need to query deleted entries too for a ctag! |
| 1213 | 1213 | $filter['filter'] .= '+deleted'; |
| 1214 | 1214 | |
| 1215 | - $result =& $this->search($filter); |
|
| 1215 | + $result = & $this->search($filter); |
|
| 1216 | 1216 | |
| 1217 | 1217 | if (empty($result)) return 'EGw-empty-wGE'; |
| 1218 | 1218 | |
@@ -1234,12 +1234,12 @@ discard block |
||
| 1234 | 1234 | * @param string $_date |
| 1235 | 1235 | * @return array $content array for uiinfolog |
| 1236 | 1236 | */ |
| 1237 | - function import_mail($_addresses,$_subject,$_message,$_attachments,$_date) |
|
| 1237 | + function import_mail($_addresses, $_subject, $_message, $_attachments, $_date) |
|
| 1238 | 1238 | { |
| 1239 | - foreach($_addresses as $address) |
|
| 1239 | + foreach ($_addresses as $address) |
|
| 1240 | 1240 | { |
| 1241 | 1241 | $names[] = $address['name']; |
| 1242 | - $emails[] =$address['email']; |
|
| 1242 | + $emails[] = $address['email']; |
|
| 1243 | 1243 | } |
| 1244 | 1244 | |
| 1245 | 1245 | $type = isset($this->enums['type']['email']) ? 'email' : 'note'; |
@@ -1247,8 +1247,8 @@ discard block |
||
| 1247 | 1247 | $info = array( |
| 1248 | 1248 | 'info_id' => 0, |
| 1249 | 1249 | 'info_type' => $type, |
| 1250 | - 'info_from' => implode(', ',$names), |
|
| 1251 | - 'info_addr' => implode(', ',$emails), |
|
| 1250 | + 'info_from' => implode(', ', $names), |
|
| 1251 | + 'info_addr' => implode(', ', $emails), |
|
| 1252 | 1252 | 'info_subject' => $_subject, |
| 1253 | 1253 | 'info_des' => $_message, |
| 1254 | 1254 | 'info_startdate' => Api\DateTime::server2user($_date), |
@@ -1267,16 +1267,16 @@ discard block |
||
| 1267 | 1267 | $contacts = array(); |
| 1268 | 1268 | foreach ($emails as $mailadr) |
| 1269 | 1269 | { |
| 1270 | - $contacts = array_merge($contacts,(array)$addressbook->search( |
|
| 1270 | + $contacts = array_merge($contacts, (array)$addressbook->search( |
|
| 1271 | 1271 | array( |
| 1272 | 1272 | 'email' => $mailadr, |
| 1273 | 1273 | 'email_home' => $mailadr |
| 1274 | - ),True,'','','',false,'OR',false,null,'',false)); |
|
| 1274 | + ), True, '', '', '', false, 'OR', false, null, '', false)); |
|
| 1275 | 1275 | } |
| 1276 | 1276 | if (!$contacts || !is_array($contacts) || !is_array($contacts[0])) |
| 1277 | 1277 | { |
| 1278 | - $info['msg'] = lang('Attention: No Contact with address %1 found.',$info['info_addr']); |
|
| 1279 | - $info['info_custom_from'] = true; // show the info_from line and NOT only the link |
|
| 1278 | + $info['msg'] = lang('Attention: No Contact with address %1 found.', $info['info_addr']); |
|
| 1279 | + $info['info_custom_from'] = true; // show the info_from line and NOT only the link |
|
| 1280 | 1280 | } |
| 1281 | 1281 | else |
| 1282 | 1282 | { |
@@ -1286,21 +1286,21 @@ discard block |
||
| 1286 | 1286 | // create the rest a "ordinary" links |
| 1287 | 1287 | foreach ($contacts as $contact) |
| 1288 | 1288 | { |
| 1289 | - Link::link('infolog',$info['link_to']['to_id'],'addressbook',$contact['id']); |
|
| 1289 | + Link::link('infolog', $info['link_to']['to_id'], 'addressbook', $contact['id']); |
|
| 1290 | 1290 | } |
| 1291 | 1291 | } |
| 1292 | 1292 | if (is_array($_attachments)) |
| 1293 | 1293 | { |
| 1294 | 1294 | foreach ($_attachments as $attachment) |
| 1295 | 1295 | { |
| 1296 | - if($attachment['egw_data']) |
|
| 1296 | + if ($attachment['egw_data']) |
|
| 1297 | 1297 | { |
| 1298 | - Link::link('infolog',$info['link_to']['to_id'],Link::DATA_APPNAME, $attachment); |
|
| 1298 | + Link::link('infolog', $info['link_to']['to_id'], Link::DATA_APPNAME, $attachment); |
|
| 1299 | 1299 | } |
| 1300 | - else if(is_readable($attachment['tmp_name']) || |
|
| 1300 | + else if (is_readable($attachment['tmp_name']) || |
|
| 1301 | 1301 | (Vfs::is_readable($attachment['tmp_name']) && parse_url($attachment['tmp_name'], PHP_URL_SCHEME) === 'vfs')) |
| 1302 | 1302 | { |
| 1303 | - Link::link('infolog',$info['link_to']['to_id'],'file', $attachment); |
|
| 1303 | + Link::link('infolog', $info['link_to']['to_id'], 'file', $attachment); |
|
| 1304 | 1304 | } |
| 1305 | 1305 | } |
| 1306 | 1306 | } |
@@ -1319,14 +1319,14 @@ discard block |
||
| 1319 | 1319 | { |
| 1320 | 1320 | if (!is_array($info)) |
| 1321 | 1321 | { |
| 1322 | - $info = $this->read( $info,false ); |
|
| 1322 | + $info = $this->read($info, false); |
|
| 1323 | 1323 | } |
| 1324 | 1324 | if (!$info) |
| 1325 | 1325 | { |
| 1326 | 1326 | return $info; |
| 1327 | 1327 | } |
| 1328 | - $title = !empty($info['info_subject']) ? $info['info_subject'] :self::subject_from_des($info['info_descr']); |
|
| 1329 | - return $title.($GLOBALS['egw_info']['user']['preferences']['infolog']['show_id']?' (#'.$info['info_id'].')':''); |
|
| 1328 | + $title = !empty($info['info_subject']) ? $info['info_subject'] : self::subject_from_des($info['info_descr']); |
|
| 1329 | + return $title.($GLOBALS['egw_info']['user']['preferences']['infolog']['show_id'] ? ' (#'.$info['info_id'].')' : ''); |
|
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | /** |
@@ -1337,15 +1337,15 @@ discard block |
||
| 1337 | 1337 | function link_titles(array $ids) |
| 1338 | 1338 | { |
| 1339 | 1339 | $titles = array(); |
| 1340 | - foreach ($this->search($params=array( |
|
| 1340 | + foreach ($this->search($params = array( |
|
| 1341 | 1341 | 'col_filter' => array('info_id' => $ids), |
| 1342 | 1342 | )) as $info) |
| 1343 | 1343 | { |
| 1344 | 1344 | $titles[$info['info_id']] = $this->link_title($info); |
| 1345 | 1345 | } |
| 1346 | - foreach (array_diff($ids,array_keys($titles)) as $id) |
|
| 1346 | + foreach (array_diff($ids, array_keys($titles)) as $id) |
|
| 1347 | 1347 | { |
| 1348 | - $titles[$id] = false; // we assume every not returned entry to be not readable, as we notify the link class about all deletes |
|
| 1348 | + $titles[$id] = false; // we assume every not returned entry to be not readable, as we notify the link class about all deletes |
|
| 1349 | 1349 | } |
| 1350 | 1350 | return $titles; |
| 1351 | 1351 | } |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | $content = array(); |
| 1373 | 1373 | if (is_array($ids)) |
| 1374 | 1374 | { |
| 1375 | - foreach(array_keys($ids) as $id) |
|
| 1375 | + foreach (array_keys($ids) as $id) |
|
| 1376 | 1376 | { |
| 1377 | 1377 | $content[$id] = $this->link_title($id); |
| 1378 | 1378 | } |
@@ -1389,10 +1389,10 @@ discard block |
||
| 1389 | 1389 | * @param int $user = null for which user to check, default current user |
| 1390 | 1390 | * @return boolean true if access is granted or false otherwise |
| 1391 | 1391 | */ |
| 1392 | - function file_access($id,$check,$rel_path=null,$user=null) |
|
| 1392 | + function file_access($id, $check, $rel_path = null, $user = null) |
|
| 1393 | 1393 | { |
| 1394 | - unset($rel_path); // not used |
|
| 1395 | - return $this->check_access($id,$check,0,$user); |
|
| 1394 | + unset($rel_path); // not used |
|
| 1395 | + return $this->check_access($id, $check, 0, $user); |
|
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | /** |
@@ -1402,10 +1402,9 @@ discard block |
||
| 1402 | 1402 | */ |
| 1403 | 1403 | function set_link_cache(array $info) |
| 1404 | 1404 | { |
| 1405 | - Link::set_cache('infolog',$info['info_id'], |
|
| 1405 | + Link::set_cache('infolog', $info['info_id'], |
|
| 1406 | 1406 | $this->link_title($info), |
| 1407 | - $this->file_access($info,Acl::EDIT) ? EGW_ACL_READ|EGW_ACL_EDIT : |
|
| 1408 | - ($this->file_access($info,Acl::READ) ? Acl::READ : 0)); |
|
| 1407 | + $this->file_access($info, Acl::EDIT) ? EGW_ACL_READ|EGW_ACL_EDIT : ($this->file_access($info, Acl::READ) ? Acl::READ : 0)); |
|
| 1409 | 1408 | } |
| 1410 | 1409 | |
| 1411 | 1410 | /** |
@@ -1419,8 +1418,8 @@ discard block |
||
| 1419 | 1418 | function cal_to_include($args) |
| 1420 | 1419 | { |
| 1421 | 1420 | //echo "<p>cal_to_include("; print_r($args); echo ")</p>\n"; |
| 1422 | - $user = (int) $args['owner']; |
|
| 1423 | - if ($user <= 0 && !checkdate($args['month'],$args['day'],$args['year'])) |
|
| 1421 | + $user = (int)$args['owner']; |
|
| 1422 | + if ($user <= 0 && !checkdate($args['month'], $args['day'], $args['year'])) |
|
| 1424 | 1423 | { |
| 1425 | 1424 | return False; |
| 1426 | 1425 | } |
@@ -1428,7 +1427,7 @@ discard block |
||
| 1428 | 1427 | |
| 1429 | 1428 | $do_events = $args['location'] == 'calendar_include_events'; |
| 1430 | 1429 | $to_include = array(); |
| 1431 | - $date_wanted = sprintf('%04d/%02d/%02d',$args['year'],$args['month'],$args['day']); |
|
| 1430 | + $date_wanted = sprintf('%04d/%02d/%02d', $args['year'], $args['month'], $args['day']); |
|
| 1432 | 1431 | $query = array( |
| 1433 | 1432 | 'order' => $args['order'] ? $args['order'] : 'info_startdate', |
| 1434 | 1433 | 'sort' => $args['sort'] ? $args['sort'] : ($do_events ? 'ASC' : 'DESC'), |
@@ -1437,34 +1436,34 @@ discard block |
||
| 1437 | 1436 | ); |
| 1438 | 1437 | if ($GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show'] || $GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show'] === '0') |
| 1439 | 1438 | { |
| 1440 | - $query['col_filter']['info_type'] = explode(',',$GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show']); |
|
| 1439 | + $query['col_filter']['info_type'] = explode(',', $GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show']); |
|
| 1441 | 1440 | } |
| 1442 | 1441 | elseif ($this->customfields && !$GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show_custom']) |
| 1443 | 1442 | { |
| 1444 | - $query['col_filter']['info_type'] = array('task','phone','note','email'); |
|
| 1443 | + $query['col_filter']['info_type'] = array('task', 'phone', 'note', 'email'); |
|
| 1445 | 1444 | } |
| 1446 | 1445 | while ($infos = $this->search($query)) |
| 1447 | 1446 | { |
| 1448 | 1447 | foreach ($infos as $info) |
| 1449 | 1448 | { |
| 1450 | - $start = new Api\DateTime($info['info_startdate'],Api\DateTime::$user_timezone); |
|
| 1449 | + $start = new Api\DateTime($info['info_startdate'], Api\DateTime::$user_timezone); |
|
| 1451 | 1450 | $title = ($do_events ? $start->format(false).' ' : ''). |
| 1452 | 1451 | $info['info_subject']; |
| 1453 | - $view = Link::view('infolog',$info['info_id']); |
|
| 1452 | + $view = Link::view('infolog', $info['info_id']); |
|
| 1454 | 1453 | $size = null; |
| 1455 | - $edit = Link::edit('infolog',$info['info_id'], $size); |
|
| 1454 | + $edit = Link::edit('infolog', $info['info_id'], $size); |
|
| 1456 | 1455 | $edit['size'] = $size; |
| 1457 | - $content=array(); |
|
| 1456 | + $content = array(); |
|
| 1458 | 1457 | $status = $this->status[$info['info_type']][$info['info_status']]; |
| 1459 | 1458 | $icons = array(); |
| 1460 | - foreach(array( |
|
| 1459 | + foreach (array( |
|
| 1461 | 1460 | $info['info_type'] => 'navbar', |
| 1462 | 1461 | $status => 'status' |
| 1463 | 1462 | ) as $icon => $default) |
| 1464 | 1463 | { |
| 1465 | - $icons[Api\Image::find('infolog',$icon) ? $icon : $default] = $icon; |
|
| 1464 | + $icons[Api\Image::find('infolog', $icon) ? $icon : $default] = $icon; |
|
| 1466 | 1465 | } |
| 1467 | - $content[] = Api\Html::a_href($title,$view); |
|
| 1466 | + $content[] = Api\Html::a_href($title, $view); |
|
| 1468 | 1467 | $html = Api\Html::table(array(1 => $content)); |
| 1469 | 1468 | |
| 1470 | 1469 | $to_include[] = array( |
@@ -1477,9 +1476,9 @@ discard block |
||
| 1477 | 1476 | 'content' => $html, |
| 1478 | 1477 | ); |
| 1479 | 1478 | } |
| 1480 | - if ($query['total'] <= ($query['start']+=count($infos))) |
|
| 1479 | + if ($query['total'] <= ($query['start'] += count($infos))) |
|
| 1481 | 1480 | { |
| 1482 | - break; // no more availible |
|
| 1481 | + break; // no more availible |
|
| 1483 | 1482 | } |
| 1484 | 1483 | } |
| 1485 | 1484 | //echo "boinfolog::cal_to_include("; print_r($args); echo ")<pre>"; print_r($to_include); echo "</pre>\n"; |
@@ -1502,7 +1501,7 @@ discard block |
||
| 1502 | 1501 | 'cols' => 'main.info_id,info_type,info_status,info_percent,info_id_parent', |
| 1503 | 1502 | ); |
| 1504 | 1503 | $infos = array(); |
| 1505 | - foreach($this->search($query) as $row) |
|
| 1504 | + foreach ($this->search($query) as $row) |
|
| 1506 | 1505 | { |
| 1507 | 1506 | $infos[$row['info_id']] = array( |
| 1508 | 1507 | 'status' => $row['info_type'] != 'phone' && $row['info_status'] == 'ongoing' ? |
@@ -1511,16 +1510,16 @@ discard block |
||
| 1511 | 1510 | 'ongoing' : 'infolog/'.$row['info_status'], |
| 1512 | 1511 | 'class' => $row['info_id_parent'] ? 'infolog_rowHasParent' : null, |
| 1513 | 1512 | ); |
| 1514 | - if (Api\Image::find('infolog', $icon=$row['info_type'].'_element') || |
|
| 1515 | - Api\Image::find('infolog', $icon=$row['info_type'])) |
|
| 1513 | + if (Api\Image::find('infolog', $icon = $row['info_type'].'_element') || |
|
| 1514 | + Api\Image::find('infolog', $icon = $row['info_type'])) |
|
| 1516 | 1515 | { |
| 1517 | 1516 | $infos[$row['info_id']]['icon'] = 'infolog/'.$icon; |
| 1518 | 1517 | } |
| 1519 | 1518 | } |
| 1520 | 1519 | $anzSubs = $this->anzSubs(array_keys($infos)); |
| 1521 | - if($anzSubs && is_array($anzSubs)) |
|
| 1520 | + if ($anzSubs && is_array($anzSubs)) |
|
| 1522 | 1521 | { |
| 1523 | - foreach($anzSubs as $info_id => $subs) |
|
| 1522 | + foreach ($anzSubs as $info_id => $subs) |
|
| 1524 | 1523 | { |
| 1525 | 1524 | if ($subs) $infos[$info_id]['class'] .= ' infolog_rowHasSubs'; |
| 1526 | 1525 | } |
@@ -1540,18 +1539,18 @@ discard block |
||
| 1540 | 1539 | * by the ones the user normally does not see due to category permissions - used to preserve categories |
| 1541 | 1540 | * @return array category ids (found, added and preserved categories) |
| 1542 | 1541 | */ |
| 1543 | - function find_or_add_categories($catname_list, $info_id=-1) |
|
| 1542 | + function find_or_add_categories($catname_list, $info_id = -1) |
|
| 1544 | 1543 | { |
| 1545 | 1544 | if (!is_object($this->categories)) |
| 1546 | 1545 | { |
| 1547 | - $this->categories = new Api\Categories($this->user,'infolog'); |
|
| 1546 | + $this->categories = new Api\Categories($this->user, 'infolog'); |
|
| 1548 | 1547 | } |
| 1549 | 1548 | $old_cats_preserve = array(); |
| 1550 | 1549 | if ($info_id && $info_id > 0) |
| 1551 | 1550 | { |
| 1552 | 1551 | // preserve Api\Categories without users read access |
| 1553 | 1552 | $old_infolog = $this->read($info_id); |
| 1554 | - $old_categories = explode(',',$old_infolog['info_cat']); |
|
| 1553 | + $old_categories = explode(',', $old_infolog['info_cat']); |
|
| 1555 | 1554 | if (is_array($old_categories) && count($old_categories) > 0) |
| 1556 | 1555 | { |
| 1557 | 1556 | foreach ($old_categories as $cat_id) |
@@ -1612,15 +1611,15 @@ discard block |
||
| 1612 | 1611 | { |
| 1613 | 1612 | if (!is_object($this->categories)) |
| 1614 | 1613 | { |
| 1615 | - $this->categories = new Api\Categories($this->user,'infolog'); |
|
| 1614 | + $this->categories = new Api\Categories($this->user, 'infolog'); |
|
| 1616 | 1615 | } |
| 1617 | 1616 | |
| 1618 | 1617 | if (!is_array($cat_id_list)) |
| 1619 | 1618 | { |
| 1620 | - $cat_id_list = explode(',',$cat_id_list); |
|
| 1619 | + $cat_id_list = explode(',', $cat_id_list); |
|
| 1621 | 1620 | } |
| 1622 | 1621 | $cat_list = array(); |
| 1623 | - foreach($cat_id_list as $cat_id) |
|
| 1622 | + foreach ($cat_id_list as $cat_id) |
|
| 1624 | 1623 | { |
| 1625 | 1624 | if ($cat_id && $this->categories->check_perms(Acl::READ, $cat_id) && |
| 1626 | 1625 | ($cat_name = $this->categories->id2name($cat_id)) && $cat_name != '--') |
@@ -1647,19 +1646,19 @@ discard block |
||
| 1647 | 1646 | |
| 1648 | 1647 | $save_account_id = $GLOBALS['egw_info']['user']['account_id']; |
| 1649 | 1648 | $save_prefs = $GLOBALS['egw_info']['user']['preferences']; |
| 1650 | - foreach($users as $user) |
|
| 1649 | + foreach ($users as $user) |
|
| 1651 | 1650 | { |
| 1652 | - if (!($email = $GLOBALS['egw']->accounts->id2name($user,'account_email'))) continue; |
|
| 1651 | + if (!($email = $GLOBALS['egw']->accounts->id2name($user, 'account_email'))) continue; |
|
| 1653 | 1652 | // create the enviroment for $user |
| 1654 | 1653 | $this->user = $GLOBALS['egw_info']['user']['account_id'] = $user; |
| 1655 | 1654 | $GLOBALS['egw']->preferences->__construct($user); |
| 1656 | 1655 | $GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository(); |
| 1657 | 1656 | $GLOBALS['egw']->acl->__construct($user); |
| 1658 | - $this->grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true); |
|
| 1659 | - $this->so = new infolog_so($this->grants); // so caches it's filters |
|
| 1657 | + $this->grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true); |
|
| 1658 | + $this->so = new infolog_so($this->grants); // so caches it's filters |
|
| 1660 | 1659 | |
| 1661 | 1660 | $notified_info_ids = array(); |
| 1662 | - foreach(array( |
|
| 1661 | + foreach (array( |
|
| 1663 | 1662 | 'notify_due_responsible' => 'open-responsible-enddate', |
| 1664 | 1663 | 'notify_due_delegated' => 'open-delegated-enddate', |
| 1665 | 1664 | 'notify_start_responsible' => 'open-responsible-date', |
@@ -1668,44 +1667,44 @@ discard block |
||
| 1668 | 1667 | { |
| 1669 | 1668 | if (!($pref_value = $GLOBALS['egw_info']['user']['preferences']['infolog'][$pref])) continue; |
| 1670 | 1669 | |
| 1671 | - $filter .= date('Y-m-d',time()+24*60*60*(int)$pref_value); |
|
| 1670 | + $filter .= date('Y-m-d', time() + 24 * 60 * 60 * (int)$pref_value); |
|
| 1672 | 1671 | //error_log(__METHOD__."() checking with filter '$filter' ($pref_value) for user $user ($email)"); |
| 1673 | 1672 | |
| 1674 | 1673 | $params = array('filter' => $filter, 'custom_fields' => true, 'subs' => true); |
| 1675 | - foreach($this->so->search($params) as $info) |
|
| 1674 | + foreach ($this->so->search($params) as $info) |
|
| 1676 | 1675 | { |
| 1677 | 1676 | // check if we already send a notification for that infolog entry, eg. starting and due on same day |
| 1678 | - if (in_array($info['info_id'],$notified_info_ids)) continue; |
|
| 1677 | + if (in_array($info['info_id'], $notified_info_ids)) continue; |
|
| 1679 | 1678 | |
| 1680 | 1679 | if (is_null($this->tracking) || $this->tracking->user != $user) |
| 1681 | 1680 | { |
| 1682 | 1681 | $this->tracking = new infolog_tracking($this); |
| 1683 | 1682 | } |
| 1684 | - switch($pref) |
|
| 1683 | + switch ($pref) |
|
| 1685 | 1684 | { |
| 1686 | 1685 | case 'notify_due_responsible': |
| 1687 | - $info['prefix'] = lang('Due %1',$this->enums['type'][$info['info_type']]); |
|
| 1688 | - $info['message'] = lang('%1 you are responsible for is due at %2',$this->enums['type'][$info['info_type']], |
|
| 1689 | - $this->tracking->datetime($info['info_enddate'],false)); |
|
| 1686 | + $info['prefix'] = lang('Due %1', $this->enums['type'][$info['info_type']]); |
|
| 1687 | + $info['message'] = lang('%1 you are responsible for is due at %2', $this->enums['type'][$info['info_type']], |
|
| 1688 | + $this->tracking->datetime($info['info_enddate'], false)); |
|
| 1690 | 1689 | break; |
| 1691 | 1690 | case 'notify_due_delegated': |
| 1692 | - $info['prefix'] = lang('Due %1',$this->enums['type'][$info['info_type']]); |
|
| 1693 | - $info['message'] = lang('%1 you delegated is due at %2',$this->enums['type'][$info['info_type']], |
|
| 1694 | - $this->tracking->datetime($info['info_enddate'],false)); |
|
| 1691 | + $info['prefix'] = lang('Due %1', $this->enums['type'][$info['info_type']]); |
|
| 1692 | + $info['message'] = lang('%1 you delegated is due at %2', $this->enums['type'][$info['info_type']], |
|
| 1693 | + $this->tracking->datetime($info['info_enddate'], false)); |
|
| 1695 | 1694 | break; |
| 1696 | 1695 | case 'notify_start_responsible': |
| 1697 | - $info['prefix'] = lang('Starting %1',$this->enums['type'][$info['info_type']]); |
|
| 1698 | - $info['message'] = lang('%1 you are responsible for is starting at %2',$this->enums['type'][$info['info_type']], |
|
| 1699 | - $this->tracking->datetime($info['info_startdate'],null)); |
|
| 1696 | + $info['prefix'] = lang('Starting %1', $this->enums['type'][$info['info_type']]); |
|
| 1697 | + $info['message'] = lang('%1 you are responsible for is starting at %2', $this->enums['type'][$info['info_type']], |
|
| 1698 | + $this->tracking->datetime($info['info_startdate'], null)); |
|
| 1700 | 1699 | break; |
| 1701 | 1700 | case 'notify_start_delegated': |
| 1702 | - $info['prefix'] = lang('Starting %1',$this->enums['type'][$info['info_type']]); |
|
| 1703 | - $info['message'] = lang('%1 you delegated is starting at %2',$this->enums['type'][$info['info_type']], |
|
| 1704 | - $this->tracking->datetime($info['info_startdate'],null)); |
|
| 1701 | + $info['prefix'] = lang('Starting %1', $this->enums['type'][$info['info_type']]); |
|
| 1702 | + $info['message'] = lang('%1 you delegated is starting at %2', $this->enums['type'][$info['info_type']], |
|
| 1703 | + $this->tracking->datetime($info['info_startdate'], null)); |
|
| 1705 | 1704 | break; |
| 1706 | 1705 | } |
| 1707 | 1706 | //error_log("notifiying $user($email) about $info[info_subject]: $info[message]"); |
| 1708 | - $this->tracking->send_notification($info,null,$email,$user,$pref); |
|
| 1707 | + $this->tracking->send_notification($info, null, $email, $user, $pref); |
|
| 1709 | 1708 | |
| 1710 | 1709 | $notified_info_ids[] = $info['info_id']; |
| 1711 | 1710 | } |
@@ -1768,7 +1767,7 @@ discard block |
||
| 1768 | 1767 | * @param string $x_infolog_status preserved original infolog status |
| 1769 | 1768 | * @return string |
| 1770 | 1769 | */ |
| 1771 | - function vtodo2status($_vtodo_status,$x_infolog_status=null) |
|
| 1770 | + function vtodo2status($_vtodo_status, $x_infolog_status = null) |
|
| 1772 | 1771 | { |
| 1773 | 1772 | $vtodo_status = strtoupper($_vtodo_status); |
| 1774 | 1773 | |
@@ -1792,7 +1791,7 @@ discard block |
||
| 1792 | 1791 | * @param array &$icons = null on return name of icons |
| 1793 | 1792 | * @return array value => (commaseparated) translations |
| 1794 | 1793 | */ |
| 1795 | - function get_status($type=null, array &$icons=null) |
|
| 1794 | + function get_status($type = null, array &$icons = null) |
|
| 1796 | 1795 | { |
| 1797 | 1796 | // if filtered by type, show only the stati of the filtered type |
| 1798 | 1797 | if ($type && isset($this->status[$type])) |
@@ -1802,16 +1801,16 @@ discard block |
||
| 1802 | 1801 | else // show all stati |
| 1803 | 1802 | { |
| 1804 | 1803 | $statis = $icons = array(); |
| 1805 | - foreach($this->status as $t => $stati) |
|
| 1804 | + foreach ($this->status as $t => $stati) |
|
| 1806 | 1805 | { |
| 1807 | 1806 | if ($t === 'defaults') continue; |
| 1808 | - foreach($stati as $val => $label) |
|
| 1807 | + foreach ($stati as $val => $label) |
|
| 1809 | 1808 | { |
| 1810 | 1809 | $statis[$val][$label] = lang($label); |
| 1811 | 1810 | if (!isset($icons[$val])) $icons[$val] = $label; |
| 1812 | 1811 | } |
| 1813 | 1812 | } |
| 1814 | - foreach($statis as $val => &$labels) |
|
| 1813 | + foreach ($statis as $val => &$labels) |
|
| 1815 | 1814 | { |
| 1816 | 1815 | $labels = implode(', ', $labels); |
| 1817 | 1816 | } |
@@ -1827,7 +1826,7 @@ discard block |
||
| 1827 | 1826 | */ |
| 1828 | 1827 | function activate($info) |
| 1829 | 1828 | { |
| 1830 | - switch((int)$info['info_percent']) |
|
| 1829 | + switch ((int)$info['info_percent']) |
|
| 1831 | 1830 | { |
| 1832 | 1831 | case 0: return 'not-started'; |
| 1833 | 1832 | case 100: return 'done'; |
@@ -1846,8 +1845,8 @@ discard block |
||
| 1846 | 1845 | #Horde::logMessage("getParentID($_guid)", __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 1847 | 1846 | |
| 1848 | 1847 | $parentID = False; |
| 1849 | - $myfilter = array('col_filter' => array('info_uid'=>$_guid)) ; |
|
| 1850 | - if ($_guid && ($found=$this->search($myfilter)) && ($uidmatch = array_shift($found))) |
|
| 1848 | + $myfilter = array('col_filter' => array('info_uid'=>$_guid)); |
|
| 1849 | + if ($_guid && ($found = $this->search($myfilter)) && ($uidmatch = array_shift($found))) |
|
| 1851 | 1850 | { |
| 1852 | 1851 | $parentID = $uidmatch['info_id']; |
| 1853 | 1852 | } |
@@ -1864,7 +1863,7 @@ discard block |
||
| 1864 | 1863 | * |
| 1865 | 1864 | * @return array of infolog_ids of matching entries |
| 1866 | 1865 | */ |
| 1867 | - function findInfo($infoData, $relax=false, $tzid=null) |
|
| 1866 | + function findInfo($infoData, $relax = false, $tzid = null) |
|
| 1868 | 1867 | { |
| 1869 | 1868 | $foundInfoLogs = array(); |
| 1870 | 1869 | $filter = array(); |
@@ -1872,7 +1871,7 @@ discard block |
||
| 1872 | 1871 | if ($this->log) |
| 1873 | 1872 | { |
| 1874 | 1873 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1875 | - . '('. ($relax ? 'RELAX, ': 'EXACT, ') . $tzid . ')[InfoData]:' |
|
| 1874 | + . '('.($relax ? 'RELAX, ' : 'EXACT, ').$tzid.')[InfoData]:' |
|
| 1876 | 1875 | . array2string($infoData)); |
| 1877 | 1876 | } |
| 1878 | 1877 | |
@@ -1891,9 +1890,9 @@ discard block |
||
| 1891 | 1890 | if (!$relax && !empty($infoData['info_uid'])) |
| 1892 | 1891 | { |
| 1893 | 1892 | $filter = array('col_filter' => array('info_uid' => $infoData['info_uid'])); |
| 1894 | - foreach($this->so->search($filter) as $egwData) |
|
| 1893 | + foreach ($this->so->search($filter) as $egwData) |
|
| 1895 | 1894 | { |
| 1896 | - if (!$this->check_access($egwData,Acl::READ)) continue; |
|
| 1895 | + if (!$this->check_access($egwData, Acl::READ)) continue; |
|
| 1897 | 1896 | $foundInfoLogs[$egwData['info_id']] = $egwData['info_id']; |
| 1898 | 1897 | } |
| 1899 | 1898 | return $foundInfoLogs; |
@@ -1921,7 +1920,7 @@ discard block |
||
| 1921 | 1920 | $text = ''; |
| 1922 | 1921 | foreach ($matches as $chunk) |
| 1923 | 1922 | { |
| 1924 | - if (strlen($text) < strlen($chunk[0])) |
|
| 1923 | + if (strlen($text) < strlen($chunk[0])) |
|
| 1925 | 1924 | { |
| 1926 | 1925 | $text = $chunk[0]; |
| 1927 | 1926 | } |
@@ -1945,7 +1944,7 @@ discard block |
||
| 1945 | 1944 | |
| 1946 | 1945 | foreach ($this->so->search($filter) as $itemID => $egwData) |
| 1947 | 1946 | { |
| 1948 | - if (!$this->check_access($egwData,Acl::READ)) continue; |
|
| 1947 | + if (!$this->check_access($egwData, Acl::READ)) continue; |
|
| 1949 | 1948 | |
| 1950 | 1949 | switch ($infoData['info_type']) |
| 1951 | 1950 | { |
@@ -1962,7 +1961,7 @@ discard block |
||
| 1962 | 1961 | { |
| 1963 | 1962 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1964 | 1963 | . '()[location mismatch]: ' |
| 1965 | - . $infoData['info_location'] . ' <> ' . $egwData['info_location']); |
|
| 1964 | + . $infoData['info_location'].' <> '.$egwData['info_location']); |
|
| 1966 | 1965 | } |
| 1967 | 1966 | continue; |
| 1968 | 1967 | } |
@@ -1979,7 +1978,7 @@ discard block |
||
| 1979 | 1978 | { |
| 1980 | 1979 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1981 | 1980 | . '()[description mismatch]: ' |
| 1982 | - . $infoData['info_des'] . ' <> ' . $egwData['info_des']); |
|
| 1981 | + . $infoData['info_des'].' <> '.$egwData['info_des']); |
|
| 1983 | 1982 | } |
| 1984 | 1983 | continue; |
| 1985 | 1984 | } |
@@ -1993,7 +1992,7 @@ discard block |
||
| 1993 | 1992 | if ($this->log) |
| 1994 | 1993 | { |
| 1995 | 1994 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1996 | - . '()[FOUND]:' . array2string($foundInfoLogs)); |
|
| 1995 | + . '()[FOUND]:'.array2string($foundInfoLogs)); |
|
| 1997 | 1996 | } |
| 1998 | 1997 | return $foundInfoLogs; |
| 1999 | 1998 | } |
@@ -2018,7 +2017,7 @@ discard block |
||
| 2018 | 2017 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 2019 | 2018 | foreach ($this->so->search($filter) as $itemID => $egwData) |
| 2020 | 2019 | { |
| 2021 | - if (!$this->check_access($egwData,Acl::READ)) continue; |
|
| 2020 | + if (!$this->check_access($egwData, Acl::READ)) continue; |
|
| 2022 | 2021 | // Horde::logMessage("findVTODO Trying\n" |
| 2023 | 2022 | // . print_r($egwData, true), |
| 2024 | 2023 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -2030,7 +2029,7 @@ discard block |
||
| 2030 | 2029 | { |
| 2031 | 2030 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2032 | 2031 | . '()[category mismatch]: ' |
| 2033 | - . $infoData['info_cat'] . ' <> ' . $egwData['info_cat']); |
|
| 2032 | + . $infoData['info_cat'].' <> '.$egwData['info_cat']); |
|
| 2034 | 2033 | } |
| 2035 | 2034 | continue; |
| 2036 | 2035 | } |
@@ -2040,15 +2039,15 @@ discard block |
||
| 2040 | 2039 | if (isset($egwData['info_startdate']) && $egwData['info_startdate']) |
| 2041 | 2040 | { |
| 2042 | 2041 | // We compare the date only |
| 2043 | - $taskTime = new Api\DateTime($infoData['info_startdate'],Api\DateTime::$server_timezone); |
|
| 2044 | - $egwTime = new Api\DateTime($egwData['info_startdate'],Api\DateTime::$server_timezone); |
|
| 2042 | + $taskTime = new Api\DateTime($infoData['info_startdate'], Api\DateTime::$server_timezone); |
|
| 2043 | + $egwTime = new Api\DateTime($egwData['info_startdate'], Api\DateTime::$server_timezone); |
|
| 2045 | 2044 | if ($taskTime->format('Ymd') != $egwTime->format('Ymd')) |
| 2046 | 2045 | { |
| 2047 | 2046 | if ($this->log) |
| 2048 | 2047 | { |
| 2049 | 2048 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2050 | 2049 | . '()[start mismatch]: ' |
| 2051 | - . $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd')); |
|
| 2050 | + . $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd')); |
|
| 2052 | 2051 | } |
| 2053 | 2052 | continue; |
| 2054 | 2053 | } |
@@ -2075,7 +2074,7 @@ discard block |
||
| 2075 | 2074 | { |
| 2076 | 2075 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2077 | 2076 | . '()[status mismatch]: ' |
| 2078 | - . $infoData['info_status'] . ' <> ' . $egwData['info_status']); |
|
| 2077 | + . $infoData['info_status'].' <> '.$egwData['info_status']); |
|
| 2079 | 2078 | } |
| 2080 | 2079 | continue; |
| 2081 | 2080 | } |
@@ -2085,15 +2084,15 @@ discard block |
||
| 2085 | 2084 | if (isset($egwData['info_enddate']) && $egwData['info_enddate']) |
| 2086 | 2085 | { |
| 2087 | 2086 | // We compare the date only |
| 2088 | - $taskTime = new Api\DateTime($infoData['info_enddate'],Api\DateTime::$server_timezone); |
|
| 2089 | - $egwTime = new Api\DateTime($egwData['info_enddate'],Api\DateTime::$server_timezone); |
|
| 2087 | + $taskTime = new Api\DateTime($infoData['info_enddate'], Api\DateTime::$server_timezone); |
|
| 2088 | + $egwTime = new Api\DateTime($egwData['info_enddate'], Api\DateTime::$server_timezone); |
|
| 2090 | 2089 | if ($taskTime->format('Ymd') != $egwTime->format('Ymd')) |
| 2091 | 2090 | { |
| 2092 | 2091 | if ($this->log) |
| 2093 | 2092 | { |
| 2094 | 2093 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2095 | 2094 | . '()[DUE mismatch]: ' |
| 2096 | - . $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd')); |
|
| 2095 | + . $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd')); |
|
| 2097 | 2096 | } |
| 2098 | 2097 | continue; |
| 2099 | 2098 | } |
@@ -2114,15 +2113,15 @@ discard block |
||
| 2114 | 2113 | if (isset($egwData['info_datecompleted']) && $egwData['info_datecompleted']) |
| 2115 | 2114 | { |
| 2116 | 2115 | // We compare the date only |
| 2117 | - $taskTime = new Api\DateTime($infoData['info_datecompleted'],Api\DateTime::$server_timezone); |
|
| 2118 | - $egwTime = new Api\DateTime($egwData['info_datecompleted'],Api\DateTime::$server_timezone); |
|
| 2116 | + $taskTime = new Api\DateTime($infoData['info_datecompleted'], Api\DateTime::$server_timezone); |
|
| 2117 | + $egwTime = new Api\DateTime($egwData['info_datecompleted'], Api\DateTime::$server_timezone); |
|
| 2119 | 2118 | if ($taskTime->format('Ymd') != $egwTime->format('Ymd')) |
| 2120 | 2119 | { |
| 2121 | 2120 | if ($this->log) |
| 2122 | 2121 | { |
| 2123 | 2122 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2124 | 2123 | . '()[completed mismatch]: ' |
| 2125 | - . $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd')); |
|
| 2124 | + . $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd')); |
|
| 2126 | 2125 | } |
| 2127 | 2126 | continue; |
| 2128 | 2127 | } |
@@ -2152,7 +2151,7 @@ discard block |
||
| 2152 | 2151 | if ($this->log) |
| 2153 | 2152 | { |
| 2154 | 2153 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2155 | - . '()[FOUND]:' . array2string($foundInfoLogs)); |
|
| 2154 | + . '()[FOUND]:'.array2string($foundInfoLogs)); |
|
| 2156 | 2155 | } |
| 2157 | 2156 | return $foundInfoLogs; |
| 2158 | 2157 | } |