@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @version $Id$ |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -define('EGW_ACL_UNDELETE',EGW_ACL_CUSTOM_1); // undelete right |
|
| 14 | +define('EGW_ACL_UNDELETE', EGW_ACL_CUSTOM_1); // undelete right |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * This class is the BO-layer of InfoLog |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | var $total; |
| 34 | 34 | var $vfs; |
| 35 | - var $vfs_basedir='/infolog'; |
|
| 35 | + var $vfs_basedir = '/infolog'; |
|
| 36 | 36 | /** |
| 37 | 37 | * Set Logging |
| 38 | 38 | * |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @var array |
| 59 | 59 | */ |
| 60 | - var $timestamps = array('info_startdate','info_enddate','info_datemodified','info_datecompleted','info_created'); |
|
| 60 | + var $timestamps = array('info_startdate', 'info_enddate', 'info_datemodified', 'info_datecompleted', 'info_created'); |
|
| 61 | 61 | /** |
| 62 | 62 | * fields the responsible user can change |
| 63 | 63 | * |
| 64 | 64 | * @var array |
| 65 | 65 | */ |
| 66 | - var $responsible_edit=array('info_status','info_percent','info_datecompleted'); |
|
| 66 | + var $responsible_edit = array('info_status', 'info_percent', 'info_datecompleted'); |
|
| 67 | 67 | /** |
| 68 | 68 | * Fields to exclude from copy, if an entry is copied, the ones below are excluded by default. |
| 69 | 69 | * |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | * |
| 88 | 88 | * @var string |
| 89 | 89 | */ |
| 90 | - var $implicit_rights='read'; |
|
| 90 | + var $implicit_rights = 'read'; |
|
| 91 | 91 | /** |
| 92 | 92 | * Custom fields read from the infolog config |
| 93 | 93 | * |
| 94 | 94 | * @var array |
| 95 | 95 | */ |
| 96 | - var $customfields=array(); |
|
| 96 | + var $customfields = array(); |
|
| 97 | 97 | /** |
| 98 | 98 | * Group owners for certain types read from the infolog config |
| 99 | 99 | * |
| 100 | 100 | * @var array |
| 101 | 101 | */ |
| 102 | - var $group_owners=array(); |
|
| 102 | + var $group_owners = array(); |
|
| 103 | 103 | /** |
| 104 | 104 | * Current user |
| 105 | 105 | * |
@@ -166,55 +166,55 @@ discard block |
||
| 166 | 166 | function __construct($info_id = 0) |
| 167 | 167 | { |
| 168 | 168 | $this->enums = $this->stock_enums = array( |
| 169 | - 'priority' => array ( |
|
| 169 | + 'priority' => array( |
|
| 170 | 170 | 3 => 'urgent', |
| 171 | 171 | 2 => 'high', |
| 172 | 172 | 1 => 'normal', |
| 173 | 173 | 0 => 'low' |
| 174 | 174 | ), |
| 175 | 175 | 'confirm' => array( |
| 176 | - 'not' => 'not','accept' => 'accept','finish' => 'finish', |
|
| 176 | + 'not' => 'not', 'accept' => 'accept', 'finish' => 'finish', |
|
| 177 | 177 | 'both' => 'both' ), |
| 178 | 178 | 'type' => array( |
| 179 | - 'task' => 'task','phone' => 'phone','note' => 'note','email' => 'email' |
|
| 179 | + 'task' => 'task', 'phone' => 'phone', 'note' => 'note', 'email' => 'email' |
|
| 180 | 180 | /* ,'confirm' => 'confirm','reject' => 'reject','fax' => 'fax' not implemented so far */ ) |
| 181 | 181 | ); |
| 182 | 182 | $this->status = $this->stock_status = array( |
| 183 | 183 | 'defaults' => array( |
| 184 | - 'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done','email' => 'done'), |
|
| 184 | + 'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done', 'email' => 'done'), |
|
| 185 | 185 | 'task' => array( |
| 186 | - 'offer' => 'offer', // --> NEEDS-ACTION |
|
| 187 | - 'not-started' => 'not-started', // iCal NEEDS-ACTION |
|
| 188 | - 'ongoing' => 'ongoing', // iCal IN-PROCESS |
|
| 189 | - 'done' => 'done', // iCal COMPLETED |
|
| 190 | - 'cancelled' => 'cancelled', // iCal CANCELLED |
|
| 191 | - 'billed' => 'billed', // --> DONE |
|
| 192 | - 'template' => 'template', // --> cancelled |
|
| 193 | - 'nonactive' => 'nonactive', // --> cancelled |
|
| 194 | - 'archive' => 'archive' ), // --> cancelled |
|
| 186 | + 'offer' => 'offer', // --> NEEDS-ACTION |
|
| 187 | + 'not-started' => 'not-started', // iCal NEEDS-ACTION |
|
| 188 | + 'ongoing' => 'ongoing', // iCal IN-PROCESS |
|
| 189 | + 'done' => 'done', // iCal COMPLETED |
|
| 190 | + 'cancelled' => 'cancelled', // iCal CANCELLED |
|
| 191 | + 'billed' => 'billed', // --> DONE |
|
| 192 | + 'template' => 'template', // --> cancelled |
|
| 193 | + 'nonactive' => 'nonactive', // --> cancelled |
|
| 194 | + 'archive' => 'archive' ), // --> cancelled |
|
| 195 | 195 | 'phone' => array( |
| 196 | - 'not-started' => 'call', // iCal NEEDS-ACTION |
|
| 197 | - 'ongoing' => 'will-call', // iCal IN-PROCESS |
|
| 198 | - 'done' => 'done', // iCal COMPLETED |
|
| 199 | - 'billed' => 'billed' ), // --> DONE |
|
| 196 | + 'not-started' => 'call', // iCal NEEDS-ACTION |
|
| 197 | + 'ongoing' => 'will-call', // iCal IN-PROCESS |
|
| 198 | + 'done' => 'done', // iCal COMPLETED |
|
| 199 | + 'billed' => 'billed' ), // --> DONE |
|
| 200 | 200 | 'note' => array( |
| 201 | - 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 201 | + 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 202 | 202 | 'done' => 'done' ), |
| 203 | 203 | 'email' => array( |
| 204 | - 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 204 | + 'ongoing' => 'ongoing', // iCal has no status on notes |
|
| 205 | 205 | 'done' => 'done' ), |
| 206 | 206 | ); |
| 207 | 207 | if (($config_data = config::read('infolog'))) |
| 208 | 208 | { |
| 209 | 209 | if (isset($config_data['status']) && is_array($config_data['status'])) |
| 210 | 210 | { |
| 211 | - foreach(array_keys($config_data['status']) as $key) |
|
| 211 | + foreach (array_keys($config_data['status']) as $key) |
|
| 212 | 212 | { |
| 213 | 213 | if (!is_array($this->status[$key])) |
| 214 | 214 | { |
| 215 | 215 | $this->status[$key] = array(); |
| 216 | 216 | } |
| 217 | - $this->status[$key] = array_merge($this->status[$key],(array)$config_data['status'][$key]); |
|
| 217 | + $this->status[$key] = array_merge($this->status[$key], (array)$config_data['status'][$key]); |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | if (isset($config_data['types']) && is_array($config_data['types'])) |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | $this->customfields = egw_customfields::get('infolog'); |
| 230 | 230 | if ($this->customfields) |
| 231 | 231 | { |
| 232 | - foreach($this->customfields as $name => $field) |
|
| 232 | + foreach ($this->customfields as $name => $field) |
|
| 233 | 233 | { |
| 234 | 234 | // old infolog customefield record |
| 235 | - if(empty($field['type'])) |
|
| 235 | + if (empty($field['type'])) |
|
| 236 | 236 | { |
| 237 | 237 | if (count($field['values'])) $field['type'] = 'select'; // selectbox |
| 238 | 238 | elseif ($field['rows'] > 1) $field['type'] = 'textarea'; // textarea |
@@ -244,23 +244,23 @@ discard block |
||
| 244 | 244 | $save_config = true; |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | - if ($save_config) config::save_value('customfields',$this->customfields,'infolog'); |
|
| 247 | + if ($save_config) config::save_value('customfields', $this->customfields, 'infolog'); |
|
| 248 | 248 | } |
| 249 | 249 | if (is_array($config_data['responsible_edit'])) |
| 250 | 250 | { |
| 251 | - $this->responsible_edit = array_merge($this->responsible_edit,$config_data['responsible_edit']); |
|
| 251 | + $this->responsible_edit = array_merge($this->responsible_edit, $config_data['responsible_edit']); |
|
| 252 | 252 | } |
| 253 | 253 | if (is_array($config_data['copy_excludefields'])) |
| 254 | 254 | { |
| 255 | - $this->copy_excludefields = array_merge($this->copy_excludefields,$config_data['copy_excludefields']); |
|
| 255 | + $this->copy_excludefields = array_merge($this->copy_excludefields, $config_data['copy_excludefields']); |
|
| 256 | 256 | } |
| 257 | 257 | if (is_array($config_data['sub_excludefields']) && $config_data['sub_excludefields']) |
| 258 | 258 | { |
| 259 | - $this->sub_excludefields = array_merge($this->sub_excludefields,$config_data['sub_excludefields']); |
|
| 259 | + $this->sub_excludefields = array_merge($this->sub_excludefields, $config_data['sub_excludefields']); |
|
| 260 | 260 | } |
| 261 | 261 | else |
| 262 | 262 | { |
| 263 | - $this->sub_excludefields = array_merge($this->sub_excludefields,$this->default_sub_excludefields); |
|
| 263 | + $this->sub_excludefields = array_merge($this->sub_excludefields, $this->default_sub_excludefields); |
|
| 264 | 264 | } |
| 265 | 265 | if ($config_data['implicit_rights'] == 'edit') |
| 266 | 266 | { |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $this->history = $config_data['history']; |
| 270 | 270 | } |
| 271 | 271 | // sort types by there translation |
| 272 | - foreach($this->enums['type'] as $key => $val) |
|
| 272 | + foreach ($this->enums['type'] as $key => $val) |
|
| 273 | 273 | { |
| 274 | 274 | if (($val = lang($key)) != $key.'*') $this->enums['type'][$key] = lang($key); |
| 275 | 275 | } |
@@ -278,14 +278,14 @@ discard block |
||
| 278 | 278 | $this->user = $GLOBALS['egw_info']['user']['account_id']; |
| 279 | 279 | |
| 280 | 280 | $this->now = time(); |
| 281 | - $this->user_time_now = egw_time::server2user($this->now,'ts'); |
|
| 281 | + $this->user_time_now = egw_time::server2user($this->now, 'ts'); |
|
| 282 | 282 | |
| 283 | - $this->grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true); |
|
| 283 | + $this->grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true); |
|
| 284 | 284 | $this->so = new infolog_so($this->grants); |
| 285 | 285 | |
| 286 | 286 | if ($info_id) |
| 287 | 287 | { |
| 288 | - $this->read( $info_id ); |
|
| 288 | + $this->read($info_id); |
|
| 289 | 289 | } |
| 290 | 290 | else |
| 291 | 291 | { |
@@ -300,14 +300,14 @@ discard block |
||
| 300 | 300 | * @param boolean $links = false if true check only customfields containing links, default false = all custom fields |
| 301 | 301 | * @return boolean True if there are customfields for $typ, else False |
| 302 | 302 | */ |
| 303 | - function has_customfields($type,$links=false) |
|
| 303 | + function has_customfields($type, $links = false) |
|
| 304 | 304 | { |
| 305 | 305 | if ($links) $link_types = customfields_widget::get_customfield_link_types(); |
| 306 | 306 | |
| 307 | - foreach($this->customfields as $field) |
|
| 307 | + foreach ($this->customfields as $field) |
|
| 308 | 308 | { |
| 309 | - if ((!$type || empty($field['type2']) || in_array($type,is_array($field['type2']) ? $field['type2'] : explode(',',$field['type2']))) && |
|
| 310 | - (!$links || in_array($field['type'],$link_types))) |
|
| 309 | + if ((!$type || empty($field['type2']) || in_array($type, is_array($field['type2']) ? $field['type2'] : explode(',', $field['type2']))) && |
|
| 310 | + (!$links || in_array($field['type'], $link_types))) |
|
| 311 | 311 | { |
| 312 | 312 | return True; |
| 313 | 313 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @param int $user = null user whos rights to check, default current user |
| 325 | 325 | * @return boolean |
| 326 | 326 | */ |
| 327 | - function check_access($info,$required_rights,$other=0,$user=null) |
|
| 327 | + function check_access($info, $required_rights, $other = 0, $user = null) |
|
| 328 | 328 | { |
| 329 | 329 | static $cache = array(); |
| 330 | 330 | |
@@ -334,17 +334,17 @@ discard block |
||
| 334 | 334 | if ($user == $this->user) |
| 335 | 335 | { |
| 336 | 336 | $grants = $this->grants; |
| 337 | - if ($info_id) $access =& $cache[$info_id][$required_rights]; // we only cache the current user! |
|
| 337 | + if ($info_id) $access = & $cache[$info_id][$required_rights]; // we only cache the current user! |
|
| 338 | 338 | } |
| 339 | 339 | else |
| 340 | 340 | { |
| 341 | - $grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true,$user); |
|
| 341 | + $grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true, $user); |
|
| 342 | 342 | } |
| 343 | 343 | if (!$info) |
| 344 | 344 | { |
| 345 | 345 | $owner = $other ? $other : $user; |
| 346 | 346 | $grant = $grants[$owner]; |
| 347 | - return $grant & $required_rights; |
|
| 347 | + return $grant&$required_rights; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
@@ -356,10 +356,10 @@ discard block |
||
| 356 | 356 | if (!is_array($info) && !($info = $this->so->read(array('info_id' => $info_id)))) return false; |
| 357 | 357 | |
| 358 | 358 | if ($info['info_status'] == 'deleted' && |
| 359 | - ($required_rights == EGW_ACL_EDIT || // no edit rights for deleted entries |
|
| 360 | - $required_rights == EGW_ACL_ADD || // no add rights for deleted entries |
|
| 359 | + ($required_rights == EGW_ACL_EDIT || // no edit rights for deleted entries |
|
| 360 | + $required_rights == EGW_ACL_ADD || // no add rights for deleted entries |
|
| 361 | 361 | $required_rights == EGW_ACL_DELETE && ($this->history == 'history_no_delete' || // no delete at all! |
| 362 | - $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user!=$this->user)))) // delete only for admins |
|
| 362 | + $this->history == 'history_admin_delete' && (!isset($GLOBALS['egw_info']['user']['apps']['admin']) || $user != $this->user)))) // delete only for admins |
|
| 363 | 363 | { |
| 364 | 364 | $access = false; |
| 365 | 365 | } |
@@ -367,12 +367,12 @@ discard block |
||
| 367 | 367 | { |
| 368 | 368 | if ($info['info_status'] != 'deleted') |
| 369 | 369 | { |
| 370 | - $access = false; // can only undelete deleted items |
|
| 370 | + $access = false; // can only undelete deleted items |
|
| 371 | 371 | } |
| 372 | 372 | else |
| 373 | 373 | { |
| 374 | 374 | // undelete requires edit rights |
| 375 | - $access = $this->so->check_access( $info,EGW_ACL_EDIT,$this->implicit_rights == 'edit',$grants,$user ); |
|
| 375 | + $access = $this->so->check_access($info, EGW_ACL_EDIT, $this->implicit_rights == 'edit', $grants, $user); |
|
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | } |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | } |
| 383 | 383 | if (!isset($access)) |
| 384 | 384 | { |
| 385 | - $access = $this->so->check_access( $info,$required_rights,$this->implicit_rights == 'edit',$grants,$user ); |
|
| 385 | + $access = $this->so->check_access($info, $required_rights, $this->implicit_rights == 'edit', $grants, $user); |
|
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | // else $cached = ' (from cache)'; |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | * @param string $not_id = '' id to exclude |
| 418 | 418 | * @return boolean True if we have a linked item, False otherwise |
| 419 | 419 | */ |
| 420 | - function link_id2from(&$info,$not_app='',$not_id='') |
|
| 420 | + function link_id2from(&$info, $not_app = '', $not_id = '') |
|
| 421 | 421 | { |
| 422 | 422 | //echo "<p>boinfolog::link_id2from(subject='$info[info_subject]', link_id='$info[info_link_id]', from='$info[info_from]', not_app='$not_app', not_id='$not_id')"; |
| 423 | 423 | |
| 424 | 424 | if ($info['info_link_id'] > 0 && |
| 425 | - (isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) || // use supplied links info |
|
| 425 | + (isset($info['links']) && ($link = $info['links'][$info['info_link_id']]) || // use supplied links info |
|
| 426 | 426 | ($link = egw_link::get_link($info['info_link_id'])) !== False)) // if link not found in supplied links, we always search! |
| 427 | 427 | { |
| 428 | 428 | if (isset($info['links']) && isset($link['app'])) |
@@ -436,11 +436,11 @@ discard block |
||
| 436 | 436 | $app = $link['link_app'.$nr]; |
| 437 | 437 | $id = $link['link_id'.$nr]; |
| 438 | 438 | } |
| 439 | - $title = egw_link::title($app,$id); |
|
| 439 | + $title = egw_link::title($app, $id); |
|
| 440 | 440 | |
| 441 | 441 | if ((string)$info['info_custom_from'] === '') // old entry |
| 442 | 442 | { |
| 443 | - $info['info_custom_from'] = (int) ($title != $info['info_from'] && @htmlentities($title) != $info['info_from']); |
|
| 443 | + $info['info_custom_from'] = (int)($title != $info['info_from'] && @htmlentities($title) != $info['info_from']); |
|
| 444 | 444 | } |
| 445 | 445 | if (!$info['info_custom_from']) |
| 446 | 446 | { |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | return $info['blur_title'] = $title; |
| 463 | 463 | } |
| 464 | 464 | $info['info_link'] = array('title' => $info['info_from']); |
| 465 | - $info['info_link_id'] = 0; // link might have been deleted |
|
| 465 | + $info['info_link_id'] = 0; // link might have been deleted |
|
| 466 | 466 | $info['info_custom_from'] = (int)!!$info['info_from']; |
| 467 | 467 | |
| 468 | 468 | return False; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | static function subject_from_des($des) |
| 475 | 475 | { |
| 476 | - return substr($des,0,60).' ...'; |
|
| 476 | + return substr($des, 0, 60).' ...'; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * or NULL for timestamps in user-time |
| 489 | 489 | * or false for timestamps in server-time |
| 490 | 490 | */ |
| 491 | - function time2time(&$values, $fromTZId=false, $toTZId=null) |
|
| 491 | + function time2time(&$values, $fromTZId = false, $toTZId = null) |
|
| 492 | 492 | { |
| 493 | 493 | |
| 494 | 494 | if ($fromTZId === $toTZId) return; |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $toTZ = egw_time::$server_timezone; |
| 530 | 530 | } |
| 531 | 531 | //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='.egw_time::$user_timezone->getName()); |
| 532 | - foreach($this->timestamps as $key) |
|
| 532 | + foreach ($this->timestamps as $key) |
|
| 533 | 533 | { |
| 534 | 534 | if ($values[$key]) |
| 535 | 535 | { |
@@ -538,14 +538,14 @@ discard block |
||
| 538 | 538 | if ($time->format('Hi') == '0000') |
| 539 | 539 | { |
| 540 | 540 | // we keep dates the same in new timezone |
| 541 | - $arr = egw_time::to($time,'array'); |
|
| 541 | + $arr = egw_time::to($time, 'array'); |
|
| 542 | 542 | $time = new egw_time($arr, $toTZ); |
| 543 | 543 | } |
| 544 | 544 | else |
| 545 | 545 | { |
| 546 | 546 | $time->setTimezone($toTZ); |
| 547 | 547 | } |
| 548 | - $values[$key] = egw_time::to($time,'ts'); |
|
| 548 | + $values[$key] = egw_time::to($time, 'ts'); |
|
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | //error_log(__METHOD__.'() --> values[info_enddate]='.date('Y-m-d H:i:s',$values['info_enddate'])); |
@@ -558,11 +558,11 @@ discard block |
||
| 558 | 558 | * @param string $date_format = 'ts' date-formats: 'ts'=timestamp, 'server'=timestamp in server-time, 'array'=array or string with date-format |
| 559 | 559 | * @return mixed depending of $date_format |
| 560 | 560 | */ |
| 561 | - function date2usertime($ts,$date_format='ts') |
|
| 561 | + function date2usertime($ts, $date_format = 'ts') |
|
| 562 | 562 | { |
| 563 | 563 | if (empty($ts) || $date_format == 'server') return $ts; |
| 564 | 564 | |
| 565 | - return egw_time::server2user($ts,$date_format); |
|
| 565 | + return egw_time::server2user($ts, $date_format); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | /** |
@@ -577,10 +577,10 @@ discard block |
||
| 577 | 577 | * |
| 578 | 578 | * @return array|boolean infolog entry, null if not found or false if no permission to read it |
| 579 | 579 | */ |
| 580 | - function &read($info_id,$run_link_id2from=true,$date_format='ts',$ignore_acl=false) |
|
| 580 | + function &read($info_id, $run_link_id2from = true, $date_format = 'ts', $ignore_acl = false) |
|
| 581 | 581 | { |
| 582 | 582 | //error_log(__METHOD__.'('.array2string($info_id).', '.array2string($run_link_id2from).", '$date_format') ".function_backtrace()); |
| 583 | - if (is_scalar($info_id) || isset($info_id[count($info_id)-1])) |
|
| 583 | + if (is_scalar($info_id) || isset($info_id[count($info_id) - 1])) |
|
| 584 | 584 | { |
| 585 | 585 | if (is_scalar($info_id) && !is_numeric($info_id)) |
| 586 | 586 | { |
@@ -596,9 +596,9 @@ discard block |
||
| 596 | 596 | { |
| 597 | 597 | return null; |
| 598 | 598 | } |
| 599 | - $info_id = $data['info_id']; // in case the uid was specified |
|
| 599 | + $info_id = $data['info_id']; // in case the uid was specified |
|
| 600 | 600 | |
| 601 | - if (!$ignore_acl && !$this->check_access($data,EGW_ACL_READ)) // check behind read, to prevent a double read |
|
| 601 | + if (!$ignore_acl && !$this->check_access($data, EGW_ACL_READ)) // check behind read, to prevent a double read |
|
| 602 | 602 | { |
| 603 | 603 | return False; |
| 604 | 604 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | * @param boolean $skip_notification Do not send notification of delete |
| 631 | 631 | * @return boolean True if delete was successful, False otherwise ($info_id does not exist or no rights) |
| 632 | 632 | */ |
| 633 | - function delete($info_id,$delete_children=False,$new_parent=False, $skip_notification=False) |
|
| 633 | + function delete($info_id, $delete_children = False, $new_parent = False, $skip_notification = False) |
|
| 634 | 634 | { |
| 635 | 635 | if (is_array($info_id)) |
| 636 | 636 | { |
@@ -640,18 +640,18 @@ discard block |
||
| 640 | 640 | { |
| 641 | 641 | return False; |
| 642 | 642 | } |
| 643 | - if (!$this->check_access($info,EGW_ACL_DELETE)) |
|
| 643 | + if (!$this->check_access($info, EGW_ACL_DELETE)) |
|
| 644 | 644 | { |
| 645 | 645 | return False; |
| 646 | 646 | } |
| 647 | 647 | // check if we have children and delete or re-parent them |
| 648 | 648 | if (($children = $this->so->get_children($info_id))) |
| 649 | 649 | { |
| 650 | - foreach($children as $id => $owner) |
|
| 650 | + foreach ($children as $id => $owner) |
|
| 651 | 651 | { |
| 652 | - if ($delete_children && $this->so->grants[$owner] & EGW_ACL_DELETE) |
|
| 652 | + if ($delete_children && $this->so->grants[$owner]&EGW_ACL_DELETE) |
|
| 653 | 653 | { |
| 654 | - $this->delete($id,$delete_children,$new_parent,$skip_notification); // call ourself recursive to delete the child |
|
| 654 | + $this->delete($id, $delete_children, $new_parent, $skip_notification); // call ourself recursive to delete the child |
|
| 655 | 655 | } |
| 656 | 656 | else // dont delete or no rights to delete the child --> re-parent it |
| 657 | 657 | { |
@@ -670,30 +670,30 @@ discard block |
||
| 670 | 670 | // if we have history switched on and not an already deleted item --> set only status deleted |
| 671 | 671 | if ($this->history && $info['info_status'] != 'deleted') |
| 672 | 672 | { |
| 673 | - if ($info['info_status'] == 'deleted') return false; // entry already deleted |
|
| 673 | + if ($info['info_status'] == 'deleted') return false; // entry already deleted |
|
| 674 | 674 | |
| 675 | 675 | $this->so->write($deleted); |
| 676 | 676 | |
| 677 | - egw_link::unlink(0,'infolog',$info_id,'','!file','',true); // keep the file attachments, hide the rest |
|
| 677 | + egw_link::unlink(0, 'infolog', $info_id, '', '!file', '', true); // keep the file attachments, hide the rest |
|
| 678 | 678 | } |
| 679 | 679 | else |
| 680 | 680 | { |
| 681 | - $this->so->delete($info_id,false); // we delete the children via bo to get all notifications! |
|
| 681 | + $this->so->delete($info_id, false); // we delete the children via bo to get all notifications! |
|
| 682 | 682 | |
| 683 | - egw_link::unlink(0,'infolog',$info_id); |
|
| 683 | + egw_link::unlink(0, 'infolog', $info_id); |
|
| 684 | 684 | } |
| 685 | 685 | if ($info['info_status'] != 'deleted') // dont notify of final purge of already deleted items |
| 686 | 686 | { |
| 687 | 687 | $GLOBALS['egw']->contenthistory->updateTimeStamp('infolog_'.$info['info_type'], $info_id, 'delete', time()); |
| 688 | 688 | |
| 689 | 689 | // send email notifications and do the history logging |
| 690 | - if(!$skip_notification) |
|
| 690 | + if (!$skip_notification) |
|
| 691 | 691 | { |
| 692 | 692 | if (!is_object($this->tracking)) |
| 693 | 693 | { |
| 694 | 694 | $this->tracking = new infolog_tracking($this); |
| 695 | 695 | } |
| 696 | - $this->tracking->track($deleted,$info,$this->user,true); |
|
| 696 | + $this->tracking->track($deleted, $info, $this->user, true); |
|
| 697 | 697 | } |
| 698 | 698 | } |
| 699 | 699 | return True; |
@@ -714,13 +714,13 @@ discard block |
||
| 714 | 714 | * |
| 715 | 715 | * @return int|boolean info_id on a successfull write or false |
| 716 | 716 | */ |
| 717 | - function write(&$values_in, $check_defaults=true, $touch_modified=true, $user2server=true, |
|
| 718 | - $skip_notification=false, $throw_exception=false, $purge_cfs=null) |
|
| 717 | + function write(&$values_in, $check_defaults = true, $touch_modified = true, $user2server = true, |
|
| 718 | + $skip_notification = false, $throw_exception = false, $purge_cfs = null) |
|
| 719 | 719 | { |
| 720 | 720 | $values = $values_in; |
| 721 | 721 | //echo "boinfolog::write()values="; _debug_array($values); |
| 722 | - if (!$values['info_id'] && !$this->check_access(0,EGW_ACL_EDIT,$values['info_owner']) && |
|
| 723 | - !$this->check_access(0,EGW_ACL_ADD,$values['info_owner'])) |
|
| 722 | + if (!$values['info_id'] && !$this->check_access(0, EGW_ACL_EDIT, $values['info_owner']) && |
|
| 723 | + !$this->check_access(0, EGW_ACL_ADD, $values['info_owner'])) |
|
| 724 | 724 | { |
| 725 | 725 | return false; |
| 726 | 726 | } |
@@ -730,12 +730,12 @@ discard block |
||
| 730 | 730 | { |
| 731 | 731 | $old = $this->read($values['info_id'], false, 'server'); |
| 732 | 732 | } |
| 733 | - if(!$old) |
|
| 733 | + if (!$old) |
|
| 734 | 734 | { |
| 735 | 735 | $old = array(); |
| 736 | 736 | } |
| 737 | 737 | |
| 738 | - if (($status_only = $values['info_id'] && !$this->check_access($values,EGW_ACL_EDIT))) |
|
| 738 | + if (($status_only = $values['info_id'] && !$this->check_access($values, EGW_ACL_EDIT))) |
|
| 739 | 739 | { |
| 740 | 740 | if (!isset($values['info_responsible'])) |
| 741 | 741 | { |
@@ -747,31 +747,31 @@ discard block |
||
| 747 | 747 | } |
| 748 | 748 | if (!($status_only = in_array($this->user, (array)$responsible))) // responsible has implicit right to change status |
| 749 | 749 | { |
| 750 | - $status_only = !!array_intersect((array)$responsible,array_keys($GLOBALS['egw']->accounts->memberships($this->user))); |
|
| 750 | + $status_only = !!array_intersect((array)$responsible, array_keys($GLOBALS['egw']->accounts->memberships($this->user))); |
|
| 751 | 751 | } |
| 752 | 752 | if (!$status_only && $values['info_status'] != 'deleted') |
| 753 | 753 | { |
| 754 | - $status_only = $undelete = $this->check_access($values['info_id'],EGW_ACL_UNDELETE); |
|
| 754 | + $status_only = $undelete = $this->check_access($values['info_id'], EGW_ACL_UNDELETE); |
|
| 755 | 755 | } |
| 756 | 756 | } |
| 757 | - if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT) && !$status_only || |
|
| 758 | - !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD)) |
|
| 757 | + if ($values['info_id'] && !$this->check_access($values['info_id'], EGW_ACL_EDIT) && !$status_only || |
|
| 758 | + !$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'], EGW_ACL_ADD)) |
|
| 759 | 759 | { |
| 760 | 760 | return false; |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | // Make sure status is still valid if the type changes |
| 764 | - if($old['info_type'] != $values['info_type'] && $values['info_status']) |
|
| 764 | + if ($old['info_type'] != $values['info_type'] && $values['info_status']) |
|
| 765 | 765 | { |
| 766 | - if(!in_array($values['info_status'], array_keys($this->status[$values['info_type']]))) |
|
| 766 | + if (!in_array($values['info_status'], array_keys($this->status[$values['info_type']]))) |
|
| 767 | 767 | { |
| 768 | 768 | $values['info_status'] = $this->status['defaults'][$values['info_type']]; |
| 769 | 769 | } |
| 770 | 770 | } |
| 771 | 771 | if ($status_only && !$undelete) // make sure only status gets writen |
| 772 | 772 | { |
| 773 | - $set_completed = !$values['info_datecompleted'] && // set date completed of finished job, only if its not already set |
|
| 774 | - in_array($values['info_status'],array('done','billed','cancelled')); |
|
| 773 | + $set_completed = !$values['info_datecompleted'] && // set date completed of finished job, only if its not already set |
|
| 774 | + in_array($values['info_status'], array('done', 'billed', 'cancelled')); |
|
| 775 | 775 | |
| 776 | 776 | $values = $old; |
| 777 | 777 | // only overwrite explicitly allowed fields |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | $values['info_percent'] = 100; |
| 787 | 787 | $forcestatus = true; |
| 788 | 788 | $status = 'done'; |
| 789 | - if (isset($values['info_type']) && !in_array($values['info_status'],array('done','billed','cancelled'))) { |
|
| 789 | + if (isset($values['info_type']) && !in_array($values['info_status'], array('done', 'billed', 'cancelled'))) { |
|
| 790 | 790 | $forcestatus = false; |
| 791 | 791 | //echo "set_completed:"; _debug_array($this->status[$values['info_type']]); |
| 792 | 792 | if (isset($this->status[$values['info_type']]['done'])) { |
@@ -800,19 +800,19 @@ discard block |
||
| 800 | 800 | $status = 'cancelled'; |
| 801 | 801 | } |
| 802 | 802 | } |
| 803 | - if ($forcestatus && !in_array($values['info_status'],array('done','billed','cancelled'))) $values['info_status'] = $status; |
|
| 803 | + if ($forcestatus && !in_array($values['info_status'], array('done', 'billed', 'cancelled'))) $values['info_status'] = $status; |
|
| 804 | 804 | } |
| 805 | 805 | $check_defaults = false; |
| 806 | 806 | } |
| 807 | 807 | if ($check_defaults) |
| 808 | 808 | { |
| 809 | 809 | if (!$values['info_datecompleted'] && |
| 810 | - (in_array($values['info_status'],array('done','billed')))) |
|
| 810 | + (in_array($values['info_status'], array('done', 'billed')))) |
|
| 811 | 811 | { |
| 812 | - $values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now; // set date completed to today if status == done |
|
| 812 | + $values['info_datecompleted'] = $user2server ? $this->user_time_now : $this->now; // set date completed to today if status == done |
|
| 813 | 813 | } |
| 814 | 814 | // Check for valid status / percent combinations |
| 815 | - if (in_array($values['info_status'],array('done','billed'))) |
|
| 815 | + if (in_array($values['info_status'], array('done', 'billed'))) |
|
| 816 | 816 | { |
| 817 | 817 | $values['info_percent'] = 100; |
| 818 | 818 | } |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | // We change percent to match status, not status to match percent |
| 828 | 828 | $values['info_percent'] = 10; |
| 829 | 829 | } |
| 830 | - if ((int)$values['info_percent'] == 100 && !in_array($values['info_status'],array('done','billed','cancelled','archive'))) |
|
| 830 | + if ((int)$values['info_percent'] == 100 && !in_array($values['info_status'], array('done', 'billed', 'cancelled', 'archive'))) |
|
| 831 | 831 | { |
| 832 | 832 | //echo "check_defaults:"; _debug_array($this->status[$values['info_type']]); |
| 833 | 833 | //$values['info_status'] = 'done'; |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | } |
| 849 | 849 | if ($values['info_responsible'] && $values['info_status'] == 'offer') |
| 850 | 850 | { |
| 851 | - $values['info_status'] = 'not-started'; // have to match if not finished |
|
| 851 | + $values['info_status'] = 'not-started'; // have to match if not finished |
|
| 852 | 852 | } |
| 853 | 853 | if (isset($values['info_subject']) && empty($values['info_subject'])) |
| 854 | 854 | { |
@@ -856,18 +856,18 @@ discard block |
||
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | // Check required custom fields |
| 859 | - if($throw_exception) |
|
| 859 | + if ($throw_exception) |
|
| 860 | 860 | { |
| 861 | 861 | $custom = egw_customfields::get('infolog'); |
| 862 | - foreach($custom as $c_name => $c_field) |
|
| 862 | + foreach ($custom as $c_name => $c_field) |
|
| 863 | 863 | { |
| 864 | - if($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',',$c_field['type2']); |
|
| 865 | - if($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'],$type2))) |
|
| 864 | + if ($c_field['type2']) $type2 = is_array($c_field['type2']) ? $c_field['type2'] : explode(',', $c_field['type2']); |
|
| 865 | + if ($c_field['needed'] && (!$c_field['type2'] || $c_field['type2'] && in_array($values['info_type'], $type2))) |
|
| 866 | 866 | { |
| 867 | 867 | // Required custom field |
| 868 | - if(!$values['#'.$c_name]) |
|
| 868 | + if (!$values['#'.$c_name]) |
|
| 869 | 869 | { |
| 870 | - throw new egw_exception_wrong_userinput(lang('For infolog type %1, %2 is required',lang($values['info_type']),$c_field['label'])); |
|
| 870 | + throw new egw_exception_wrong_userinput(lang('For infolog type %1, %2 is required', lang($values['info_type']), $c_field['label'])); |
|
| 871 | 871 | } |
| 872 | 872 | } |
| 873 | 873 | } |
@@ -876,16 +876,16 @@ discard block |
||
| 876 | 876 | if (isset($this->group_owners[$values['info_type']])) |
| 877 | 877 | { |
| 878 | 878 | $values['info_owner'] = $this->group_owners[$values['info_type']]; |
| 879 | - if (!($this->grants[$this->group_owners[$values['info_type']]] & EGW_ACL_EDIT)) |
|
| 879 | + if (!($this->grants[$this->group_owners[$values['info_type']]]&EGW_ACL_EDIT)) |
|
| 880 | 880 | { |
| 881 | - if (!$this->check_access($values['info_id'],EGW_ACL_EDIT) || |
|
| 882 | - !$values['info_id'] && !$this->check_access($values,EGW_ACL_ADD) |
|
| 881 | + if (!$this->check_access($values['info_id'], EGW_ACL_EDIT) || |
|
| 882 | + !$values['info_id'] && !$this->check_access($values, EGW_ACL_ADD) |
|
| 883 | 883 | ) |
| 884 | 884 | { |
| 885 | - return false; // no edit rights from the group-owner and no implicit rights (delegated and sufficient rights) |
|
| 885 | + return false; // no edit rights from the group-owner and no implicit rights (delegated and sufficient rights) |
|
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | - $values['info_access'] = 'public'; // group-owners are allways public |
|
| 888 | + $values['info_access'] = 'public'; // group-owners are allways public |
|
| 889 | 889 | } |
| 890 | 890 | elseif (!$values['info_id'] && !$values['info_owner'] || $GLOBALS['egw']->accounts->get_type($values['info_owner']) == 'g') |
| 891 | 891 | { |
@@ -960,23 +960,23 @@ discard block |
||
| 960 | 960 | $to_write['info_id'] = $info_id; |
| 961 | 961 | |
| 962 | 962 | // if the info responbsible array is not passed, fetch it from old. |
| 963 | - if (!array_key_exists('info_responsible',$values)) $values['info_responsible'] = $old['info_responsible']; |
|
| 963 | + if (!array_key_exists('info_responsible', $values)) $values['info_responsible'] = $old['info_responsible']; |
|
| 964 | 964 | if (!is_array($values['info_responsible'])) // this should not happen, bug it does ;-) |
| 965 | 965 | { |
| 966 | - $values['info_responsible'] = $values['info_responsible'] ? explode(',',$values['info_responsible']) : array(); |
|
| 966 | + $values['info_responsible'] = $values['info_responsible'] ? explode(',', $values['info_responsible']) : array(); |
|
| 967 | 967 | $to_write['info_responsible'] = $values['info_responsible']; |
| 968 | 968 | } |
| 969 | 969 | // create (and remove) links in custom fields |
| 970 | - customfields_widget::update_customfield_links('infolog',$values,$old,'info_id'); |
|
| 970 | + customfields_widget::update_customfield_links('infolog', $values, $old, 'info_id'); |
|
| 971 | 971 | |
| 972 | 972 | // Check for restore of deleted entry, restore held links |
| 973 | - if($old['info_status'] == 'deleted' && $values['info_status'] != 'deleted') |
|
| 973 | + if ($old['info_status'] == 'deleted' && $values['info_status'] != 'deleted') |
|
| 974 | 974 | { |
| 975 | 975 | egw_link::restore('infolog', $info_id); |
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | // notify the link-class about the update, as other apps may be subscribt to it |
| 979 | - egw_link::notify_update('infolog',$info_id,$values); |
|
| 979 | + egw_link::notify_update('infolog', $info_id, $values); |
|
| 980 | 980 | |
| 981 | 981 | // pre-cache the new values |
| 982 | 982 | self::set_link_cache($values); |
@@ -987,42 +987,42 @@ discard block |
||
| 987 | 987 | $this->tracking = new infolog_tracking($this); |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | - if ($old && ($missing_fields = array_diff_key($old,$values))) |
|
| 990 | + if ($old && ($missing_fields = array_diff_key($old, $values))) |
|
| 991 | 991 | { |
| 992 | 992 | // Some custom fields (multiselect with nothing selected) will be missing, |
| 993 | 993 | // and that's OK. Don't put them back. |
| 994 | - foreach(array_keys($missing_fields) as $field) |
|
| 994 | + foreach (array_keys($missing_fields) as $field) |
|
| 995 | 995 | { |
| 996 | - if(array_key_exists($field, $values_in)) |
|
| 996 | + if (array_key_exists($field, $values_in)) |
|
| 997 | 997 | { |
| 998 | 998 | unset($missing_fields[$field]); |
| 999 | 999 | } |
| 1000 | 1000 | } |
| 1001 | - $values = array_merge($values,$missing_fields); |
|
| 1001 | + $values = array_merge($values, $missing_fields); |
|
| 1002 | 1002 | } |
| 1003 | 1003 | // Add keys missing in the $to_write array |
| 1004 | - if (($missing_fields = array_diff_key($values,$to_write))) |
|
| 1004 | + if (($missing_fields = array_diff_key($values, $to_write))) |
|
| 1005 | 1005 | { |
| 1006 | - $to_write = array_merge($to_write,$missing_fields); |
|
| 1006 | + $to_write = array_merge($to_write, $missing_fields); |
|
| 1007 | 1007 | } |
| 1008 | - $this->tracking->track($to_write,$old,$this->user,$values['info_status'] == 'deleted' || $old['info_status'] == 'deleted', |
|
| 1009 | - null,$skip_notification); |
|
| 1008 | + $this->tracking->track($to_write, $old, $this->user, $values['info_status'] == 'deleted' || $old['info_status'] == 'deleted', |
|
| 1009 | + null, $skip_notification); |
|
| 1010 | 1010 | |
| 1011 | 1011 | if ($info_from_set) $values['info_from'] = ''; |
| 1012 | 1012 | |
| 1013 | 1013 | // Change new values back to user time before sending them back |
| 1014 | - if($user2server) |
|
| 1014 | + if ($user2server) |
|
| 1015 | 1015 | { |
| 1016 | 1016 | $this->time2time($values); |
| 1017 | 1017 | } |
| 1018 | 1018 | // merge changes (keeping extra values from the UI) |
| 1019 | - $values_in = array_merge($values_in,$values); |
|
| 1019 | + $values_in = array_merge($values_in, $values); |
|
| 1020 | 1020 | |
| 1021 | 1021 | // Update modified timestamp of parent |
| 1022 | - if($values['info_id_parent']) |
|
| 1022 | + if ($values['info_id_parent']) |
|
| 1023 | 1023 | { |
| 1024 | - $parent = $this->read($values['info_id_parent'], false, 'server',true); |
|
| 1025 | - $this->write($parent,false, true, false, true); |
|
| 1024 | + $parent = $this->read($values['info_id_parent'], false, 'server', true); |
|
| 1025 | + $this->write($parent, false, true, false, true); |
|
| 1026 | 1026 | } |
| 1027 | 1027 | } |
| 1028 | 1028 | return $info_id; |
@@ -1034,9 +1034,9 @@ discard block |
||
| 1034 | 1034 | * @param int|array $info_id id |
| 1035 | 1035 | * @return int|array number of subs |
| 1036 | 1036 | */ |
| 1037 | - function anzSubs( $info_id ) |
|
| 1037 | + function anzSubs($info_id) |
|
| 1038 | 1038 | { |
| 1039 | - return $this->so->anzSubs( $info_id ); |
|
| 1039 | + return $this->so->anzSubs($info_id); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | /** |
@@ -1056,19 +1056,19 @@ discard block |
||
| 1056 | 1056 | { |
| 1057 | 1057 | //error_log(__METHOD__.'('.array2string($query).')'); |
| 1058 | 1058 | |
| 1059 | - if($query['filter'] == 'bydate') |
|
| 1059 | + if ($query['filter'] == 'bydate') |
|
| 1060 | 1060 | { |
| 1061 | 1061 | if (is_int($query['startdate'])) $query['col_filter'][] = 'info_startdate >= '.$GLOBALS['egw']->db->quote($query['startdate']); |
| 1062 | - if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1); |
|
| 1062 | + if (is_int($query['enddate'])) $query['col_filter'][] = 'info_startdate <= '.$GLOBALS['egw']->db->quote($query['enddate'] + (60 * 60 * 24) - 1); |
|
| 1063 | 1063 | } |
| 1064 | 1064 | elseif ($query['filter'] == 'duedate') |
| 1065 | 1065 | { |
| 1066 | 1066 | if (is_int($query['startdate'])) $query['col_filter'][] = 'info_enddate >= '.$GLOBALS['egw']->db->quote($query['startdate']); |
| 1067 | - if (is_int($query['enddate'])) $query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate']+(60*60*24)-1); |
|
| 1067 | + if (is_int($query['enddate'])) $query['col_filter'][] = 'info_enddate <= '.$GLOBALS['egw']->db->quote($query['enddate'] + (60 * 60 * 24) - 1); |
|
| 1068 | 1068 | } |
| 1069 | 1069 | elseif ($query['filter'] == 'private') |
| 1070 | 1070 | { |
| 1071 | - $query['col_filter'][] = 'info_access = ' . $GLOBALS['egw']->db->quote('private'); |
|
| 1071 | + $query['col_filter'][] = 'info_access = '.$GLOBALS['egw']->db->quote('private'); |
|
| 1072 | 1072 | } |
| 1073 | 1073 | if (!isset($query['date_format']) || $query['date_format'] != 'server') |
| 1074 | 1074 | { |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | { |
| 1079 | 1079 | if (!empty($query['col_filter'][$key])) |
| 1080 | 1080 | { |
| 1081 | - $query['col_filter'][$key] = egw_time::user2server($query['col_filter'][$key],'ts'); |
|
| 1081 | + $query['col_filter'][$key] = egw_time::user2server($query['col_filter'][$key], 'ts'); |
|
| 1082 | 1082 | } |
| 1083 | 1083 | } |
| 1084 | 1084 | } |
@@ -1091,7 +1091,7 @@ discard block |
||
| 1091 | 1091 | { |
| 1092 | 1092 | foreach ($ret as $id => &$data) |
| 1093 | 1093 | { |
| 1094 | - if (!$this->check_access($data,EGW_ACL_READ)) |
|
| 1094 | + if (!$this->check_access($data, EGW_ACL_READ)) |
|
| 1095 | 1095 | { |
| 1096 | 1096 | unset($ret[$id]); |
| 1097 | 1097 | continue; |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | if ($time->format('Hi') == '0000') |
| 1108 | 1108 | { |
| 1109 | 1109 | // we keep dates the same in user-time |
| 1110 | - $arr = egw_time::to($time,'array'); |
|
| 1110 | + $arr = egw_time::to($time, 'array'); |
|
| 1111 | 1111 | $time = new egw_time($arr, egw_time::$user_timezone); |
| 1112 | 1112 | } |
| 1113 | 1113 | else |
@@ -1115,7 +1115,7 @@ discard block |
||
| 1115 | 1115 | $time->setTimezone(egw_time::$user_timezone); |
| 1116 | 1116 | } |
| 1117 | 1117 | } |
| 1118 | - $data[$key] = egw_time::to($time,'ts'); |
|
| 1118 | + $data[$key] = egw_time::to($time, 'ts'); |
|
| 1119 | 1119 | } |
| 1120 | 1120 | } |
| 1121 | 1121 | // pre-cache title and file access |
@@ -1132,7 +1132,7 @@ discard block |
||
| 1132 | 1132 | * @param array $filter = array('filter'=>'own','info_type'=>'task') |
| 1133 | 1133 | * @return string |
| 1134 | 1134 | */ |
| 1135 | - public function getctag(array $filter=array('filter'=>'own','info_type'=>'task')) |
|
| 1135 | + public function getctag(array $filter = array('filter'=>'own', 'info_type'=>'task')) |
|
| 1136 | 1136 | { |
| 1137 | 1137 | $filter += array( |
| 1138 | 1138 | 'order' => 'info_datemodified', |
@@ -1144,7 +1144,7 @@ discard block |
||
| 1144 | 1144 | // we need to query deleted entries too for a ctag! |
| 1145 | 1145 | $filter['filter'] .= '+deleted'; |
| 1146 | 1146 | |
| 1147 | - $result =& $this->search($filter); |
|
| 1147 | + $result = & $this->search($filter); |
|
| 1148 | 1148 | |
| 1149 | 1149 | if (empty($result)) return 'EGw-empty-wGE'; |
| 1150 | 1150 | |
@@ -1166,12 +1166,12 @@ discard block |
||
| 1166 | 1166 | * @param string $_date |
| 1167 | 1167 | * @return array $content array for uiinfolog |
| 1168 | 1168 | */ |
| 1169 | - function import_mail($_addresses,$_subject,$_message,$_attachments,$_date) |
|
| 1169 | + function import_mail($_addresses, $_subject, $_message, $_attachments, $_date) |
|
| 1170 | 1170 | { |
| 1171 | - foreach($_addresses as $address) |
|
| 1171 | + foreach ($_addresses as $address) |
|
| 1172 | 1172 | { |
| 1173 | 1173 | $names[] = $address['name']; |
| 1174 | - $emails[] =$address['email']; |
|
| 1174 | + $emails[] = $address['email']; |
|
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | $type = isset($this->enums['type']['email']) ? 'email' : 'note'; |
@@ -1179,8 +1179,8 @@ discard block |
||
| 1179 | 1179 | $info = array( |
| 1180 | 1180 | 'info_id' => 0, |
| 1181 | 1181 | 'info_type' => $type, |
| 1182 | - 'info_from' => implode(', ',$names), |
|
| 1183 | - 'info_addr' => implode(', ',$emails), |
|
| 1182 | + 'info_from' => implode(', ', $names), |
|
| 1183 | + 'info_addr' => implode(', ', $emails), |
|
| 1184 | 1184 | 'info_subject' => $_subject, |
| 1185 | 1185 | 'info_des' => $_message, |
| 1186 | 1186 | 'info_startdate' => egw_time::server2user($_date), |
@@ -1199,16 +1199,16 @@ discard block |
||
| 1199 | 1199 | $contacts = array(); |
| 1200 | 1200 | foreach ($emails as $mailadr) |
| 1201 | 1201 | { |
| 1202 | - $contacts = array_merge($contacts,(array)$addressbook->search( |
|
| 1202 | + $contacts = array_merge($contacts, (array)$addressbook->search( |
|
| 1203 | 1203 | array( |
| 1204 | 1204 | 'email' => $mailadr, |
| 1205 | 1205 | 'email_home' => $mailadr |
| 1206 | - ),True,'','','',false,'OR',false,null,'',false)); |
|
| 1206 | + ), True, '', '', '', false, 'OR', false, null, '', false)); |
|
| 1207 | 1207 | } |
| 1208 | 1208 | if (!$contacts || !is_array($contacts) || !is_array($contacts[0])) |
| 1209 | 1209 | { |
| 1210 | - $info['msg'] = lang('Attention: No Contact with address %1 found.',$info['info_addr']); |
|
| 1211 | - $info['info_custom_from'] = true; // show the info_from line and NOT only the link |
|
| 1210 | + $info['msg'] = lang('Attention: No Contact with address %1 found.', $info['info_addr']); |
|
| 1211 | + $info['info_custom_from'] = true; // show the info_from line and NOT only the link |
|
| 1212 | 1212 | } |
| 1213 | 1213 | else |
| 1214 | 1214 | { |
@@ -1218,21 +1218,21 @@ discard block |
||
| 1218 | 1218 | // create the rest a "ordinary" links |
| 1219 | 1219 | foreach ($contacts as $contact) |
| 1220 | 1220 | { |
| 1221 | - egw_link::link('infolog',$info['link_to']['to_id'],'addressbook',$contact['id']); |
|
| 1221 | + egw_link::link('infolog', $info['link_to']['to_id'], 'addressbook', $contact['id']); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | if (is_array($_attachments)) |
| 1225 | 1225 | { |
| 1226 | 1226 | foreach ($_attachments as $attachment) |
| 1227 | 1227 | { |
| 1228 | - if($attachment['egw_data']) |
|
| 1228 | + if ($attachment['egw_data']) |
|
| 1229 | 1229 | { |
| 1230 | - egw_link::link('infolog',$info['link_to']['to_id'],egw_link::DATA_APPNAME, $attachment); |
|
| 1230 | + egw_link::link('infolog', $info['link_to']['to_id'], egw_link::DATA_APPNAME, $attachment); |
|
| 1231 | 1231 | } |
| 1232 | - else if(is_readable($attachment['tmp_name']) || |
|
| 1232 | + else if (is_readable($attachment['tmp_name']) || |
|
| 1233 | 1233 | (egw_vfs::is_readable($attachment['tmp_name']) && parse_url($attachment['tmp_name'], PHP_URL_SCHEME) === 'vfs')) |
| 1234 | 1234 | { |
| 1235 | - egw_link::link('infolog',$info['link_to']['to_id'],'file', $attachment); |
|
| 1235 | + egw_link::link('infolog', $info['link_to']['to_id'], 'file', $attachment); |
|
| 1236 | 1236 | } |
| 1237 | 1237 | } |
| 1238 | 1238 | } |
@@ -1251,14 +1251,14 @@ discard block |
||
| 1251 | 1251 | { |
| 1252 | 1252 | if (!is_array($info)) |
| 1253 | 1253 | { |
| 1254 | - $info = $this->read( $info,false ); |
|
| 1254 | + $info = $this->read($info, false); |
|
| 1255 | 1255 | } |
| 1256 | 1256 | if (!$info) |
| 1257 | 1257 | { |
| 1258 | 1258 | return $info; |
| 1259 | 1259 | } |
| 1260 | - $title = !empty($info['info_subject']) ? $info['info_subject'] :self::subject_from_des($info['info_descr']); |
|
| 1261 | - return $title.($GLOBALS['egw_info']['user']['preferences']['infolog']['show_id']?' (#'.$info['info_id'].')':''); |
|
| 1260 | + $title = !empty($info['info_subject']) ? $info['info_subject'] : self::subject_from_des($info['info_descr']); |
|
| 1261 | + return $title.($GLOBALS['egw_info']['user']['preferences']['infolog']['show_id'] ? ' (#'.$info['info_id'].')' : ''); |
|
| 1262 | 1262 | } |
| 1263 | 1263 | |
| 1264 | 1264 | /** |
@@ -1269,15 +1269,15 @@ discard block |
||
| 1269 | 1269 | function link_titles(array $ids) |
| 1270 | 1270 | { |
| 1271 | 1271 | $titles = array(); |
| 1272 | - foreach ($this->search($params=array( |
|
| 1272 | + foreach ($this->search($params = array( |
|
| 1273 | 1273 | 'col_filter' => array('info_id' => $ids), |
| 1274 | 1274 | )) as $info) |
| 1275 | 1275 | { |
| 1276 | 1276 | $titles[$info['info_id']] = $this->link_title($info); |
| 1277 | 1277 | } |
| 1278 | - foreach (array_diff($ids,array_keys($titles)) as $id) |
|
| 1278 | + foreach (array_diff($ids, array_keys($titles)) as $id) |
|
| 1279 | 1279 | { |
| 1280 | - $titles[$id] = false; // we assume every not returned entry to be not readable, as we notify the link class about all deletes |
|
| 1280 | + $titles[$id] = false; // we assume every not returned entry to be not readable, as we notify the link class about all deletes |
|
| 1281 | 1281 | } |
| 1282 | 1282 | return $titles; |
| 1283 | 1283 | } |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | $content = array(); |
| 1305 | 1305 | if (is_array($ids)) |
| 1306 | 1306 | { |
| 1307 | - foreach(array_keys($ids) as $id) |
|
| 1307 | + foreach (array_keys($ids) as $id) |
|
| 1308 | 1308 | { |
| 1309 | 1309 | $content[$id] = $this->link_title($id); |
| 1310 | 1310 | } |
@@ -1321,10 +1321,10 @@ discard block |
||
| 1321 | 1321 | * @param int $user = null for which user to check, default current user |
| 1322 | 1322 | * @return boolean true if access is granted or false otherwise |
| 1323 | 1323 | */ |
| 1324 | - function file_access($id,$check,$rel_path=null,$user=null) |
|
| 1324 | + function file_access($id, $check, $rel_path = null, $user = null) |
|
| 1325 | 1325 | { |
| 1326 | - unset($rel_path); // not used |
|
| 1327 | - return $this->check_access($id,$check,0,$user); |
|
| 1326 | + unset($rel_path); // not used |
|
| 1327 | + return $this->check_access($id, $check, 0, $user); |
|
| 1328 | 1328 | } |
| 1329 | 1329 | |
| 1330 | 1330 | /** |
@@ -1334,10 +1334,9 @@ discard block |
||
| 1334 | 1334 | */ |
| 1335 | 1335 | function set_link_cache(array $info) |
| 1336 | 1336 | { |
| 1337 | - egw_link::set_cache('infolog',$info['info_id'], |
|
| 1337 | + egw_link::set_cache('infolog', $info['info_id'], |
|
| 1338 | 1338 | $this->link_title($info), |
| 1339 | - $this->file_access($info,EGW_ACL_EDIT) ? EGW_ACL_READ|EGW_ACL_EDIT : |
|
| 1340 | - ($this->file_access($info,EGW_ACL_READ) ? EGW_ACL_READ : 0)); |
|
| 1339 | + $this->file_access($info, EGW_ACL_EDIT) ? EGW_ACL_READ|EGW_ACL_EDIT : ($this->file_access($info, EGW_ACL_READ) ? EGW_ACL_READ : 0)); |
|
| 1341 | 1340 | } |
| 1342 | 1341 | |
| 1343 | 1342 | /** |
@@ -1351,8 +1350,8 @@ discard block |
||
| 1351 | 1350 | function cal_to_include($args) |
| 1352 | 1351 | { |
| 1353 | 1352 | //echo "<p>cal_to_include("; print_r($args); echo ")</p>\n"; |
| 1354 | - $user = (int) $args['owner']; |
|
| 1355 | - if ($user <= 0 && !checkdate($args['month'],$args['day'],$args['year'])) |
|
| 1353 | + $user = (int)$args['owner']; |
|
| 1354 | + if ($user <= 0 && !checkdate($args['month'], $args['day'], $args['year'])) |
|
| 1356 | 1355 | { |
| 1357 | 1356 | return False; |
| 1358 | 1357 | } |
@@ -1360,7 +1359,7 @@ discard block |
||
| 1360 | 1359 | |
| 1361 | 1360 | $do_events = $args['location'] == 'calendar_include_events'; |
| 1362 | 1361 | $to_include = array(); |
| 1363 | - $date_wanted = sprintf('%04d/%02d/%02d',$args['year'],$args['month'],$args['day']); |
|
| 1362 | + $date_wanted = sprintf('%04d/%02d/%02d', $args['year'], $args['month'], $args['day']); |
|
| 1364 | 1363 | $query = array( |
| 1365 | 1364 | 'order' => 'info_startdate', |
| 1366 | 1365 | 'sort' => $do_events ? 'ASC' : 'DESC', |
@@ -1369,32 +1368,32 @@ discard block |
||
| 1369 | 1368 | ); |
| 1370 | 1369 | if ($GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show'] || $GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show'] === '0') |
| 1371 | 1370 | { |
| 1372 | - $query['col_filter']['info_type'] = explode(',',$GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show']); |
|
| 1371 | + $query['col_filter']['info_type'] = explode(',', $GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show']); |
|
| 1373 | 1372 | } |
| 1374 | 1373 | elseif ($this->customfields && !$GLOBALS['egw_info']['user']['preferences']['infolog']['cal_show_custom']) |
| 1375 | 1374 | { |
| 1376 | - $query['col_filter']['info_type'] = array('task','phone','note','email'); |
|
| 1375 | + $query['col_filter']['info_type'] = array('task', 'phone', 'note', 'email'); |
|
| 1377 | 1376 | } |
| 1378 | 1377 | while ($infos = $this->search($query)) |
| 1379 | 1378 | { |
| 1380 | 1379 | foreach ($infos as $info) |
| 1381 | 1380 | { |
| 1382 | - $start = new egw_time($info['info_startdate'],egw_time::$user_timezone); |
|
| 1383 | - $title = ($do_events?common::formattime($start->format('H'),$start->format('i')).' ':''). |
|
| 1381 | + $start = new egw_time($info['info_startdate'], egw_time::$user_timezone); |
|
| 1382 | + $title = ($do_events ? common::formattime($start->format('H'), $start->format('i')).' ' : ''). |
|
| 1384 | 1383 | $info['info_subject']; |
| 1385 | - $view = egw_link::view('infolog',$info['info_id']); |
|
| 1384 | + $view = egw_link::view('infolog', $info['info_id']); |
|
| 1386 | 1385 | $size = null; |
| 1387 | - $edit = egw_link::edit('infolog',$info['info_id'], $size); |
|
| 1386 | + $edit = egw_link::edit('infolog', $info['info_id'], $size); |
|
| 1388 | 1387 | $edit['size'] = $size; |
| 1389 | - $content=array(); |
|
| 1388 | + $content = array(); |
|
| 1390 | 1389 | foreach ($icons = array( |
| 1391 | 1390 | $info['info_type'] => 'infolog', |
| 1392 | 1391 | $this->status[$info['info_type']][$info['info_status']] => 'infolog', |
| 1393 | 1392 | ) as $name => $app) |
| 1394 | 1393 | { |
| 1395 | - $content[] = html::image($app,$name,lang($name),'border="0" width="15" height="15"').' '; |
|
| 1394 | + $content[] = html::image($app, $name, lang($name), 'border="0" width="15" height="15"').' '; |
|
| 1396 | 1395 | } |
| 1397 | - $content[] = html::a_href($title,$view); |
|
| 1396 | + $content[] = html::a_href($title, $view); |
|
| 1398 | 1397 | $html = html::table(array(1 => $content)); |
| 1399 | 1398 | |
| 1400 | 1399 | $to_include[] = array( |
@@ -1407,9 +1406,9 @@ discard block |
||
| 1407 | 1406 | 'content' => $html, |
| 1408 | 1407 | ); |
| 1409 | 1408 | } |
| 1410 | - if ($query['total'] <= ($query['start']+=count($infos))) |
|
| 1409 | + if ($query['total'] <= ($query['start'] += count($infos))) |
|
| 1411 | 1410 | { |
| 1412 | - break; // no more availible |
|
| 1411 | + break; // no more availible |
|
| 1413 | 1412 | } |
| 1414 | 1413 | } |
| 1415 | 1414 | //echo "boinfolog::cal_to_include("; print_r($args); echo ")<pre>"; print_r($to_include); echo "</pre>\n"; |
@@ -1432,7 +1431,7 @@ discard block |
||
| 1432 | 1431 | 'cols' => 'info_id,info_type,info_status,info_percent,info_id_parent', |
| 1433 | 1432 | ); |
| 1434 | 1433 | $infos = array(); |
| 1435 | - foreach($this->search($query) as $row) |
|
| 1434 | + foreach ($this->search($query) as $row) |
|
| 1436 | 1435 | { |
| 1437 | 1436 | $infos[$row['info_id']] = array( |
| 1438 | 1437 | 'status' => $row['info_type'] != 'phone' && $row['info_status'] == 'ongoing' ? |
@@ -1441,13 +1440,13 @@ discard block |
||
| 1441 | 1440 | 'ongoing' : 'infolog/'.$row['info_status'], |
| 1442 | 1441 | 'class' => $row['info_id_parent'] ? 'infolog_rowHasParent' : null, |
| 1443 | 1442 | ); |
| 1444 | - if (common::image('infolog', $icon=$row['info_type'].'_element') || |
|
| 1445 | - common::image('infolog', $icon=$row['info_type'])) |
|
| 1443 | + if (common::image('infolog', $icon = $row['info_type'].'_element') || |
|
| 1444 | + common::image('infolog', $icon = $row['info_type'])) |
|
| 1446 | 1445 | { |
| 1447 | 1446 | $infos[$row['info_id']]['icon'] = 'infolog/'.$icon; |
| 1448 | 1447 | } |
| 1449 | 1448 | } |
| 1450 | - foreach($this->anzSubs(array_keys($infos)) as $info_id => $subs) |
|
| 1449 | + foreach ($this->anzSubs(array_keys($infos)) as $info_id => $subs) |
|
| 1451 | 1450 | { |
| 1452 | 1451 | if ($subs) $infos[$info_id]['class'] .= ' infolog_rowHasSubs'; |
| 1453 | 1452 | } |
@@ -1466,18 +1465,18 @@ discard block |
||
| 1466 | 1465 | * by the ones the user normally does not see due to category permissions - used to preserve categories |
| 1467 | 1466 | * @return array category ids (found, added and preserved categories) |
| 1468 | 1467 | */ |
| 1469 | - function find_or_add_categories($catname_list, $info_id=-1) |
|
| 1468 | + function find_or_add_categories($catname_list, $info_id = -1) |
|
| 1470 | 1469 | { |
| 1471 | 1470 | if (!is_object($this->categories)) |
| 1472 | 1471 | { |
| 1473 | - $this->categories = new categories($this->user,'infolog'); |
|
| 1472 | + $this->categories = new categories($this->user, 'infolog'); |
|
| 1474 | 1473 | } |
| 1475 | 1474 | $old_cats_preserve = array(); |
| 1476 | 1475 | if ($info_id && $info_id > 0) |
| 1477 | 1476 | { |
| 1478 | 1477 | // preserve categories without users read access |
| 1479 | 1478 | $old_infolog = $this->read($info_id); |
| 1480 | - $old_categories = explode(',',$old_infolog['info_cat']); |
|
| 1479 | + $old_categories = explode(',', $old_infolog['info_cat']); |
|
| 1481 | 1480 | if (is_array($old_categories) && count($old_categories) > 0) |
| 1482 | 1481 | { |
| 1483 | 1482 | foreach ($old_categories as $cat_id) |
@@ -1538,15 +1537,15 @@ discard block |
||
| 1538 | 1537 | { |
| 1539 | 1538 | if (!is_object($this->categories)) |
| 1540 | 1539 | { |
| 1541 | - $this->categories = new categories($this->user,'infolog'); |
|
| 1540 | + $this->categories = new categories($this->user, 'infolog'); |
|
| 1542 | 1541 | } |
| 1543 | 1542 | |
| 1544 | 1543 | if (!is_array($cat_id_list)) |
| 1545 | 1544 | { |
| 1546 | - $cat_id_list = explode(',',$cat_id_list); |
|
| 1545 | + $cat_id_list = explode(',', $cat_id_list); |
|
| 1547 | 1546 | } |
| 1548 | 1547 | $cat_list = array(); |
| 1549 | - foreach($cat_id_list as $cat_id) |
|
| 1548 | + foreach ($cat_id_list as $cat_id) |
|
| 1550 | 1549 | { |
| 1551 | 1550 | if ($cat_id && $this->categories->check_perms(EGW_ACL_READ, $cat_id) && |
| 1552 | 1551 | ($cat_name = $this->categories->id2name($cat_id)) && $cat_name != '--') |
@@ -1573,20 +1572,20 @@ discard block |
||
| 1573 | 1572 | |
| 1574 | 1573 | $save_account_id = $GLOBALS['egw_info']['user']['account_id']; |
| 1575 | 1574 | $save_prefs = $GLOBALS['egw_info']['user']['preferences']; |
| 1576 | - foreach($users as $user) |
|
| 1575 | + foreach ($users as $user) |
|
| 1577 | 1576 | { |
| 1578 | - if (!($email = $GLOBALS['egw']->accounts->id2name($user,'account_email'))) continue; |
|
| 1577 | + if (!($email = $GLOBALS['egw']->accounts->id2name($user, 'account_email'))) continue; |
|
| 1579 | 1578 | // create the enviroment for $user |
| 1580 | 1579 | $this->user = $GLOBALS['egw_info']['user']['account_id'] = $user; |
| 1581 | 1580 | $GLOBALS['egw']->preferences->preferences($user); |
| 1582 | 1581 | $GLOBALS['egw_info']['user']['preferences'] = $GLOBALS['egw']->preferences->read_repository(); |
| 1583 | 1582 | $GLOBALS['egw']->acl->acl($user); |
| 1584 | 1583 | $GLOBALS['egw']->acl->read_repository(); |
| 1585 | - $this->grants = $GLOBALS['egw']->acl->get_grants('infolog',$this->group_owners ? $this->group_owners : true); |
|
| 1586 | - $this->so = new infolog_so($this->grants); // so caches it's filters |
|
| 1584 | + $this->grants = $GLOBALS['egw']->acl->get_grants('infolog', $this->group_owners ? $this->group_owners : true); |
|
| 1585 | + $this->so = new infolog_so($this->grants); // so caches it's filters |
|
| 1587 | 1586 | |
| 1588 | 1587 | $notified_info_ids = array(); |
| 1589 | - foreach(array( |
|
| 1588 | + foreach (array( |
|
| 1590 | 1589 | 'notify_due_responsible' => 'open-responsible-enddate', |
| 1591 | 1590 | 'notify_due_delegated' => 'open-delegated-enddate', |
| 1592 | 1591 | 'notify_start_responsible' => 'open-responsible-date', |
@@ -1595,44 +1594,44 @@ discard block |
||
| 1595 | 1594 | { |
| 1596 | 1595 | if (!($pref_value = $GLOBALS['egw_info']['user']['preferences']['infolog'][$pref])) continue; |
| 1597 | 1596 | |
| 1598 | - $filter .= date('Y-m-d',time()+24*60*60*(int)$pref_value); |
|
| 1597 | + $filter .= date('Y-m-d', time() + 24 * 60 * 60 * (int)$pref_value); |
|
| 1599 | 1598 | //error_log(__METHOD__."() checking with filter '$filter' ($pref_value) for user $user ($email)"); |
| 1600 | 1599 | |
| 1601 | 1600 | $params = array('filter' => $filter, 'custom_fields' => true, 'subs' => true); |
| 1602 | - foreach($this->so->search($params) as $info) |
|
| 1601 | + foreach ($this->so->search($params) as $info) |
|
| 1603 | 1602 | { |
| 1604 | 1603 | // check if we already send a notification for that infolog entry, eg. starting and due on same day |
| 1605 | - if (in_array($info['info_id'],$notified_info_ids)) continue; |
|
| 1604 | + if (in_array($info['info_id'], $notified_info_ids)) continue; |
|
| 1606 | 1605 | |
| 1607 | 1606 | if (is_null($this->tracking) || $this->tracking->user != $user) |
| 1608 | 1607 | { |
| 1609 | 1608 | $this->tracking = new infolog_tracking($this); |
| 1610 | 1609 | } |
| 1611 | - switch($pref) |
|
| 1610 | + switch ($pref) |
|
| 1612 | 1611 | { |
| 1613 | 1612 | case 'notify_due_responsible': |
| 1614 | - $info['prefix'] = lang('Due %1',$this->enums['type'][$info['info_type']]); |
|
| 1615 | - $info['message'] = lang('%1 you are responsible for is due at %2',$this->enums['type'][$info['info_type']], |
|
| 1616 | - $this->tracking->datetime($info['info_enddate'],false)); |
|
| 1613 | + $info['prefix'] = lang('Due %1', $this->enums['type'][$info['info_type']]); |
|
| 1614 | + $info['message'] = lang('%1 you are responsible for is due at %2', $this->enums['type'][$info['info_type']], |
|
| 1615 | + $this->tracking->datetime($info['info_enddate'], false)); |
|
| 1617 | 1616 | break; |
| 1618 | 1617 | case 'notify_due_delegated': |
| 1619 | - $info['prefix'] = lang('Due %1',$this->enums['type'][$info['info_type']]); |
|
| 1620 | - $info['message'] = lang('%1 you delegated is due at %2',$this->enums['type'][$info['info_type']], |
|
| 1621 | - $this->tracking->datetime($info['info_enddate'],false)); |
|
| 1618 | + $info['prefix'] = lang('Due %1', $this->enums['type'][$info['info_type']]); |
|
| 1619 | + $info['message'] = lang('%1 you delegated is due at %2', $this->enums['type'][$info['info_type']], |
|
| 1620 | + $this->tracking->datetime($info['info_enddate'], false)); |
|
| 1622 | 1621 | break; |
| 1623 | 1622 | case 'notify_start_responsible': |
| 1624 | - $info['prefix'] = lang('Starting %1',$this->enums['type'][$info['info_type']]); |
|
| 1625 | - $info['message'] = lang('%1 you are responsible for is starting at %2',$this->enums['type'][$info['info_type']], |
|
| 1626 | - $this->tracking->datetime($info['info_startdate'],null)); |
|
| 1623 | + $info['prefix'] = lang('Starting %1', $this->enums['type'][$info['info_type']]); |
|
| 1624 | + $info['message'] = lang('%1 you are responsible for is starting at %2', $this->enums['type'][$info['info_type']], |
|
| 1625 | + $this->tracking->datetime($info['info_startdate'], null)); |
|
| 1627 | 1626 | break; |
| 1628 | 1627 | case 'notify_start_delegated': |
| 1629 | - $info['prefix'] = lang('Starting %1',$this->enums['type'][$info['info_type']]); |
|
| 1630 | - $info['message'] = lang('%1 you delegated is starting at %2',$this->enums['type'][$info['info_type']], |
|
| 1631 | - $this->tracking->datetime($info['info_startdate'],null)); |
|
| 1628 | + $info['prefix'] = lang('Starting %1', $this->enums['type'][$info['info_type']]); |
|
| 1629 | + $info['message'] = lang('%1 you delegated is starting at %2', $this->enums['type'][$info['info_type']], |
|
| 1630 | + $this->tracking->datetime($info['info_startdate'], null)); |
|
| 1632 | 1631 | break; |
| 1633 | 1632 | } |
| 1634 | 1633 | //error_log("notifiying $user($email) about $info[info_subject]: $info[message]"); |
| 1635 | - $this->tracking->send_notification($info,null,$email,$user,$pref); |
|
| 1634 | + $this->tracking->send_notification($info, null, $email, $user, $pref); |
|
| 1636 | 1635 | |
| 1637 | 1636 | $notified_info_ids[] = $info['info_id']; |
| 1638 | 1637 | } |
@@ -1695,7 +1694,7 @@ discard block |
||
| 1695 | 1694 | * @param string $x_infolog_status preserved original infolog status |
| 1696 | 1695 | * @return string |
| 1697 | 1696 | */ |
| 1698 | - function vtodo2status($vtodo_status,$x_infolog_status=null) |
|
| 1697 | + function vtodo2status($vtodo_status, $x_infolog_status = null) |
|
| 1699 | 1698 | { |
| 1700 | 1699 | $vtodo_status = strtoupper($vtodo_status); |
| 1701 | 1700 | |
@@ -1719,7 +1718,7 @@ discard block |
||
| 1719 | 1718 | * @param array &$icons = null on return name of icons |
| 1720 | 1719 | * @return array value => (commaseparated) translations |
| 1721 | 1720 | */ |
| 1722 | - function get_status($type=null, array &$icons=null) |
|
| 1721 | + function get_status($type = null, array &$icons = null) |
|
| 1723 | 1722 | { |
| 1724 | 1723 | // if filtered by type, show only the stati of the filtered type |
| 1725 | 1724 | if ($type && isset($this->status[$type])) |
@@ -1729,16 +1728,16 @@ discard block |
||
| 1729 | 1728 | else // show all stati |
| 1730 | 1729 | { |
| 1731 | 1730 | $statis = $icons = array(); |
| 1732 | - foreach($this->status as $t => $stati) |
|
| 1731 | + foreach ($this->status as $t => $stati) |
|
| 1733 | 1732 | { |
| 1734 | 1733 | if ($t === 'defaults') continue; |
| 1735 | - foreach($stati as $val => $label) |
|
| 1734 | + foreach ($stati as $val => $label) |
|
| 1736 | 1735 | { |
| 1737 | 1736 | $statis[$val][$label] = lang($label); |
| 1738 | 1737 | if (!isset($icons[$val])) $icons[$val] = $label; |
| 1739 | 1738 | } |
| 1740 | 1739 | } |
| 1741 | - foreach($statis as $val => &$labels) |
|
| 1740 | + foreach ($statis as $val => &$labels) |
|
| 1742 | 1741 | { |
| 1743 | 1742 | $labels = implode(', ', $labels); |
| 1744 | 1743 | } |
@@ -1754,7 +1753,7 @@ discard block |
||
| 1754 | 1753 | */ |
| 1755 | 1754 | function activate($info) |
| 1756 | 1755 | { |
| 1757 | - switch((int)$info['info_percent']) |
|
| 1756 | + switch ((int)$info['info_percent']) |
|
| 1758 | 1757 | { |
| 1759 | 1758 | case 0: return 'not-started'; |
| 1760 | 1759 | case 100: return 'done'; |
@@ -1773,8 +1772,8 @@ discard block |
||
| 1773 | 1772 | #Horde::logMessage("getParentID($_guid)", __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 1774 | 1773 | |
| 1775 | 1774 | $parentID = False; |
| 1776 | - $myfilter = array('col_filter' => array('info_uid'=>$_guid)) ; |
|
| 1777 | - if ($_guid && ($found=$this->search($myfilter)) && ($uidmatch = array_shift($found))) |
|
| 1775 | + $myfilter = array('col_filter' => array('info_uid'=>$_guid)); |
|
| 1776 | + if ($_guid && ($found = $this->search($myfilter)) && ($uidmatch = array_shift($found))) |
|
| 1778 | 1777 | { |
| 1779 | 1778 | $parentID = $uidmatch['info_id']; |
| 1780 | 1779 | } |
@@ -1791,7 +1790,7 @@ discard block |
||
| 1791 | 1790 | * |
| 1792 | 1791 | * @return array of infolog_ids of matching entries |
| 1793 | 1792 | */ |
| 1794 | - function findInfo($infoData, $relax=false, $tzid=null) |
|
| 1793 | + function findInfo($infoData, $relax = false, $tzid = null) |
|
| 1795 | 1794 | { |
| 1796 | 1795 | $foundInfoLogs = array(); |
| 1797 | 1796 | $filter = array(); |
@@ -1799,7 +1798,7 @@ discard block |
||
| 1799 | 1798 | if ($this->log) |
| 1800 | 1799 | { |
| 1801 | 1800 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1802 | - . '('. ($relax ? 'RELAX, ': 'EXACT, ') . $tzid . ')[InfoData]:' |
|
| 1801 | + . '('.($relax ? 'RELAX, ' : 'EXACT, ').$tzid.')[InfoData]:' |
|
| 1803 | 1802 | . array2string($infoData)); |
| 1804 | 1803 | } |
| 1805 | 1804 | |
@@ -1818,9 +1817,9 @@ discard block |
||
| 1818 | 1817 | if (!$relax && !empty($infoData['info_uid'])) |
| 1819 | 1818 | { |
| 1820 | 1819 | $filter = array('col_filter' => array('info_uid' => $infoData['info_uid'])); |
| 1821 | - foreach($this->so->search($filter) as $egwData) |
|
| 1820 | + foreach ($this->so->search($filter) as $egwData) |
|
| 1822 | 1821 | { |
| 1823 | - if (!$this->check_access($egwData,EGW_ACL_READ)) continue; |
|
| 1822 | + if (!$this->check_access($egwData, EGW_ACL_READ)) continue; |
|
| 1824 | 1823 | $foundInfoLogs[$egwData['info_id']] = $egwData['info_id']; |
| 1825 | 1824 | } |
| 1826 | 1825 | return $foundInfoLogs; |
@@ -1848,7 +1847,7 @@ discard block |
||
| 1848 | 1847 | $text = ''; |
| 1849 | 1848 | foreach ($matches as $chunk) |
| 1850 | 1849 | { |
| 1851 | - if (strlen($text) < strlen($chunk[0])) |
|
| 1850 | + if (strlen($text) < strlen($chunk[0])) |
|
| 1852 | 1851 | { |
| 1853 | 1852 | $text = $chunk[0]; |
| 1854 | 1853 | } |
@@ -1872,7 +1871,7 @@ discard block |
||
| 1872 | 1871 | |
| 1873 | 1872 | foreach ($this->so->search($filter) as $itemID => $egwData) |
| 1874 | 1873 | { |
| 1875 | - if (!$this->check_access($egwData,EGW_ACL_READ)) continue; |
|
| 1874 | + if (!$this->check_access($egwData, EGW_ACL_READ)) continue; |
|
| 1876 | 1875 | |
| 1877 | 1876 | switch ($infoData['info_type']) |
| 1878 | 1877 | { |
@@ -1889,7 +1888,7 @@ discard block |
||
| 1889 | 1888 | { |
| 1890 | 1889 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1891 | 1890 | . '()[location mismatch]: ' |
| 1892 | - . $infoData['info_location'] . ' <> ' . $egwData['info_location']); |
|
| 1891 | + . $infoData['info_location'].' <> '.$egwData['info_location']); |
|
| 1893 | 1892 | } |
| 1894 | 1893 | continue; |
| 1895 | 1894 | } |
@@ -1906,7 +1905,7 @@ discard block |
||
| 1906 | 1905 | { |
| 1907 | 1906 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1908 | 1907 | . '()[description mismatch]: ' |
| 1909 | - . $infoData['info_des'] . ' <> ' . $egwData['info_des']); |
|
| 1908 | + . $infoData['info_des'].' <> '.$egwData['info_des']); |
|
| 1910 | 1909 | } |
| 1911 | 1910 | continue; |
| 1912 | 1911 | } |
@@ -1920,7 +1919,7 @@ discard block |
||
| 1920 | 1919 | if ($this->log) |
| 1921 | 1920 | { |
| 1922 | 1921 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1923 | - . '()[FOUND]:' . array2string($foundInfoLogs)); |
|
| 1922 | + . '()[FOUND]:'.array2string($foundInfoLogs)); |
|
| 1924 | 1923 | } |
| 1925 | 1924 | return $foundInfoLogs; |
| 1926 | 1925 | } |
@@ -1945,7 +1944,7 @@ discard block |
||
| 1945 | 1944 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
| 1946 | 1945 | foreach ($this->so->search($filter) as $itemID => $egwData) |
| 1947 | 1946 | { |
| 1948 | - if (!$this->check_access($egwData,EGW_ACL_READ)) continue; |
|
| 1947 | + if (!$this->check_access($egwData, EGW_ACL_READ)) continue; |
|
| 1949 | 1948 | // Horde::logMessage("findVTODO Trying\n" |
| 1950 | 1949 | // . print_r($egwData, true), |
| 1951 | 1950 | // __FILE__, __LINE__, PEAR_LOG_DEBUG); |
@@ -1957,7 +1956,7 @@ discard block |
||
| 1957 | 1956 | { |
| 1958 | 1957 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1959 | 1958 | . '()[category mismatch]: ' |
| 1960 | - . $infoData['info_cat'] . ' <> ' . $egwData['info_cat']); |
|
| 1959 | + . $infoData['info_cat'].' <> '.$egwData['info_cat']); |
|
| 1961 | 1960 | } |
| 1962 | 1961 | continue; |
| 1963 | 1962 | } |
@@ -1967,15 +1966,15 @@ discard block |
||
| 1967 | 1966 | if (isset($egwData['info_startdate']) && $egwData['info_startdate']) |
| 1968 | 1967 | { |
| 1969 | 1968 | // We compare the date only |
| 1970 | - $taskTime = new egw_time($infoData['info_startdate'],egw_time::$server_timezone); |
|
| 1971 | - $egwTime = new egw_time($egwData['info_startdate'],egw_time::$server_timezone); |
|
| 1969 | + $taskTime = new egw_time($infoData['info_startdate'], egw_time::$server_timezone); |
|
| 1970 | + $egwTime = new egw_time($egwData['info_startdate'], egw_time::$server_timezone); |
|
| 1972 | 1971 | if ($taskTime->format('Ymd') != $egwTime->format('Ymd')) |
| 1973 | 1972 | { |
| 1974 | 1973 | if ($this->log) |
| 1975 | 1974 | { |
| 1976 | 1975 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 1977 | 1976 | . '()[start mismatch]: ' |
| 1978 | - . $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd')); |
|
| 1977 | + . $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd')); |
|
| 1979 | 1978 | } |
| 1980 | 1979 | continue; |
| 1981 | 1980 | } |
@@ -2002,7 +2001,7 @@ discard block |
||
| 2002 | 2001 | { |
| 2003 | 2002 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2004 | 2003 | . '()[status mismatch]: ' |
| 2005 | - . $infoData['info_status'] . ' <> ' . $egwData['info_status']); |
|
| 2004 | + . $infoData['info_status'].' <> '.$egwData['info_status']); |
|
| 2006 | 2005 | } |
| 2007 | 2006 | continue; |
| 2008 | 2007 | } |
@@ -2012,15 +2011,15 @@ discard block |
||
| 2012 | 2011 | if (isset($egwData['info_enddate']) && $egwData['info_enddate']) |
| 2013 | 2012 | { |
| 2014 | 2013 | // We compare the date only |
| 2015 | - $taskTime = new egw_time($infoData['info_enddate'],egw_time::$server_timezone); |
|
| 2016 | - $egwTime = new egw_time($egwData['info_enddate'],egw_time::$server_timezone); |
|
| 2014 | + $taskTime = new egw_time($infoData['info_enddate'], egw_time::$server_timezone); |
|
| 2015 | + $egwTime = new egw_time($egwData['info_enddate'], egw_time::$server_timezone); |
|
| 2017 | 2016 | if ($taskTime->format('Ymd') != $egwTime->format('Ymd')) |
| 2018 | 2017 | { |
| 2019 | 2018 | if ($this->log) |
| 2020 | 2019 | { |
| 2021 | 2020 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2022 | 2021 | . '()[DUE mismatch]: ' |
| 2023 | - . $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd')); |
|
| 2022 | + . $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd')); |
|
| 2024 | 2023 | } |
| 2025 | 2024 | continue; |
| 2026 | 2025 | } |
@@ -2041,15 +2040,15 @@ discard block |
||
| 2041 | 2040 | if (isset($egwData['info_datecompleted']) && $egwData['info_datecompleted']) |
| 2042 | 2041 | { |
| 2043 | 2042 | // We compare the date only |
| 2044 | - $taskTime = new egw_time($infoData['info_datecompleted'],egw_time::$server_timezone); |
|
| 2045 | - $egwTime = new egw_time($egwData['info_datecompleted'],egw_time::$server_timezone); |
|
| 2043 | + $taskTime = new egw_time($infoData['info_datecompleted'], egw_time::$server_timezone); |
|
| 2044 | + $egwTime = new egw_time($egwData['info_datecompleted'], egw_time::$server_timezone); |
|
| 2046 | 2045 | if ($taskTime->format('Ymd') != $egwTime->format('Ymd')) |
| 2047 | 2046 | { |
| 2048 | 2047 | if ($this->log) |
| 2049 | 2048 | { |
| 2050 | 2049 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2051 | 2050 | . '()[completed mismatch]: ' |
| 2052 | - . $taskTime->format('Ymd') . ' <> ' . $egwTime->format('Ymd')); |
|
| 2051 | + . $taskTime->format('Ymd').' <> '.$egwTime->format('Ymd')); |
|
| 2053 | 2052 | } |
| 2054 | 2053 | continue; |
| 2055 | 2054 | } |
@@ -2079,7 +2078,7 @@ discard block |
||
| 2079 | 2078 | if ($this->log) |
| 2080 | 2079 | { |
| 2081 | 2080 | error_log(__FILE__.'['.__LINE__.'] '.__METHOD__ |
| 2082 | - . '()[FOUND]:' . array2string($foundInfoLogs)); |
|
| 2081 | + . '()[FOUND]:'.array2string($foundInfoLogs)); |
|
| 2083 | 2082 | } |
| 2084 | 2083 | return $foundInfoLogs; |
| 2085 | 2084 | } |