@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) |
| 86 | 86 | { |
| 87 | - if ( $object instanceof org_openpsa_contacts_group_dba |
|
| 87 | + if ($object instanceof org_openpsa_contacts_group_dba |
|
| 88 | 88 | || $object instanceof midcom_db_group) |
| 89 | 89 | { |
| 90 | 90 | return "group/{$object->guid}/"; |
| 91 | 91 | } |
| 92 | - if ( $object instanceof org_openpsa_contacts_person_dba |
|
| 92 | + if ($object instanceof org_openpsa_contacts_person_dba |
|
| 93 | 93 | || $object instanceof midcom_db_person) |
| 94 | 94 | { |
| 95 | 95 | return "person/{$object->guid}/"; |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | if (count($items) > 0) |
| 134 | 134 | { |
| 135 | - if ( $items[0]->get_latitude() |
|
| 135 | + if ($items[0]->get_latitude() |
|
| 136 | 136 | || $items[0]->get_longitude()) |
| 137 | 137 | { |
| 138 | 138 | // This is a GeoRSS feed |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | $hcards = @$hkit->getByURL('hcard', $url); |
| 145 | 145 | |
| 146 | - if ( is_array($hcards) |
|
| 146 | + if (is_array($hcards) |
|
| 147 | 147 | && count($hcards) > 0) |
| 148 | 148 | { |
| 149 | 149 | // We have found hCard data here |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $latitude = (float) $icbm_parts[0]; |
| 219 | 219 | $longitude = (float) $icbm_parts[1]; |
| 220 | - if ( abs($latitude) < 90 |
|
| 220 | + if (abs($latitude) < 90 |
|
| 221 | 221 | && abs($longitude) < 180) |
| 222 | 222 | { |
| 223 | 223 | $location = new org_routamc_positioning_location_dba(); |
@@ -59,8 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | $root_groups[$name] = $group; |
| 61 | 61 | } |
| 62 | - } |
|
| 63 | - else |
|
| 62 | + } else |
|
| 64 | 63 | { |
| 65 | 64 | debug_add("OpenPSA Contacts root group could not be found", MIDCOM_LOG_WARN); |
| 66 | 65 | |
@@ -168,8 +167,7 @@ discard block |
||
| 168 | 167 | try |
| 169 | 168 | { |
| 170 | 169 | $person = new org_openpsa_contacts_person_dba($args['person']); |
| 171 | - } |
|
| 172 | - catch (midcom_error $e) |
|
| 170 | + } catch (midcom_error $e) |
|
| 173 | 171 | { |
| 174 | 172 | $handler->print_error("Person {$args['person']} not found, error " . $e->getMessage()); |
| 175 | 173 | return false; |
@@ -180,15 +178,13 @@ discard block |
||
| 180 | 178 | return false; |
| 181 | 179 | } |
| 182 | 180 | return $this->_check_person_url($person); |
| 183 | - } |
|
| 184 | - else if (array_key_exists('group', $args)) |
|
| 181 | + } else if (array_key_exists('group', $args)) |
|
| 185 | 182 | { |
| 186 | 183 | // Handling for groups |
| 187 | 184 | try |
| 188 | 185 | { |
| 189 | 186 | $group = new org_openpsa_contacts_group_dba($args['group']); |
| 190 | - } |
|
| 191 | - catch (midcom_error $e) |
|
| 187 | + } catch (midcom_error $e) |
|
| 192 | 188 | { |
| 193 | 189 | $handler->print_error("Group {$args['group']} not found, error " . $e->getMessage()); |
| 194 | 190 | return false; |
@@ -255,8 +251,7 @@ discard block |
||
| 255 | 251 | { |
| 256 | 252 | // GeoRSS subscription is a good way to keep track of person's location |
| 257 | 253 | $person->set_parameter('org.routamc.positioning:georss', 'georss_url', $data['georss_url']); |
| 258 | - } |
|
| 259 | - else if (array_key_exists('icbm', $data)) |
|
| 254 | + } else if (array_key_exists('icbm', $data)) |
|
| 260 | 255 | { |
| 261 | 256 | // Instead of using the ICBM position data directly we can subscribe to it so we get modifications too |
| 262 | 257 | $person->set_parameter('org.routamc.positioning:html', 'icbm_url', $person->homepage); |
@@ -14,8 +14,7 @@ discard block |
||
| 14 | 14 | public $__midcom_class_name__ = __CLASS__; |
| 15 | 15 | public $__mgdschema_class_name__ = 'org_openpsa_organization'; |
| 16 | 16 | |
| 17 | - public $autodelete_dependents = array |
|
| 18 | - ( |
|
| 17 | + public $autodelete_dependents = array( |
|
| 19 | 18 | 'org_openpsa_contacts_member_dba' => 'gid' |
| 20 | 19 | ); |
| 21 | 20 | |
@@ -32,7 +31,7 @@ discard block |
||
| 32 | 31 | |
| 33 | 32 | public function __set($name, $value) |
| 34 | 33 | { |
| 35 | - if ( $name == 'homepage' |
|
| 34 | + if ($name == 'homepage' |
|
| 36 | 35 | && !empty($value) |
| 37 | 36 | && $value != $this->homepage) |
| 38 | 37 | { |
@@ -83,7 +82,7 @@ discard block |
||
| 83 | 82 | |
| 84 | 83 | public function __get($property) |
| 85 | 84 | { |
| 86 | - if ( $property == 'invoice_label' |
|
| 85 | + if ($property == 'invoice_label' |
|
| 87 | 86 | || $property == 'postal_label') |
| 88 | 87 | { |
| 89 | 88 | if (!isset($this->_address_extras[$property])) |
@@ -124,8 +123,7 @@ discard block |
||
| 124 | 123 | { |
| 125 | 124 | if ($this->_register_prober) |
| 126 | 125 | { |
| 127 | - $args = array |
|
| 128 | - ( |
|
| 126 | + $args = array( |
|
| 129 | 127 | 'group' => $this->guid, |
| 130 | 128 | ); |
| 131 | 129 | midcom_services_at_interface::register(time() + 60, 'org.openpsa.contacts', 'check_url', $args); |
@@ -102,8 +102,7 @@ |
||
| 102 | 102 | if (!empty($this->name)) |
| 103 | 103 | { |
| 104 | 104 | $this->official = $this->name; |
| 105 | - } |
|
| 106 | - else |
|
| 105 | + } else |
|
| 107 | 106 | { |
| 108 | 107 | $this->official = "Group #{$this->id}"; |
| 109 | 108 | } |
@@ -48,8 +48,7 @@ discard block |
||
| 48 | 48 | //Search for all potential duplicates (more detailed checking is done later) |
| 49 | 49 | $check_persons = $this->get_person_candidates($person); |
| 50 | 50 | |
| 51 | - $person = $this->normalize_fields(array |
|
| 52 | - ( |
|
| 51 | + $person = $this->normalize_fields(array( |
|
| 53 | 52 | 'firstname' => $person->firstname, |
| 54 | 53 | 'lastname' => $person->lastname, |
| 55 | 54 | 'email' => $person->email, |
@@ -122,8 +121,7 @@ discard block |
||
| 122 | 121 | */ |
| 123 | 122 | function p_duplicate_person(array $person1, array $person2) |
| 124 | 123 | { |
| 125 | - $ret = array |
|
| 126 | - ( |
|
| 124 | + $ret = array( |
|
| 127 | 125 | 'p' => 0, |
| 128 | 126 | 'email_match' => false, |
| 129 | 127 | 'handphone_match' => false, |
@@ -144,7 +142,7 @@ discard block |
||
| 144 | 142 | // if user's lastname is part of the email address, check to see if the difference is only in the domain part |
| 145 | 143 | $email1 = preg_replace('/@.+/', '', $person1['email']); |
| 146 | 144 | $email2 = preg_replace('/@.+/', '', $person2['email']); |
| 147 | - if ( strpos($email1, $person1['lastname']) !== false |
|
| 145 | + if (strpos($email1, $person1['lastname']) !== false |
|
| 148 | 146 | && $email1 == $email2) |
| 149 | 147 | { |
| 150 | 148 | $ret['email_match'] = true; |
@@ -203,7 +201,7 @@ discard block |
||
| 203 | 201 | |
| 204 | 202 | private function match($property, array $data1, array $data2) |
| 205 | 203 | { |
| 206 | - if ( !empty($data1[$property]) |
|
| 204 | + if (!empty($data1[$property]) |
|
| 207 | 205 | && $data1[$property] == $data2[$property]) |
| 208 | 206 | { |
| 209 | 207 | return true; |
@@ -243,8 +241,7 @@ discard block |
||
| 243 | 241 | |
| 244 | 242 | $check_groups = $this->get_group_candidates($group); |
| 245 | 243 | |
| 246 | - $group = $this->normalize_fields(array |
|
| 247 | - ( |
|
| 244 | + $group = $this->normalize_fields(array( |
|
| 248 | 245 | 'official' => $group->official, |
| 249 | 246 | 'street' => $group->street, |
| 250 | 247 | 'phone' => $group->phone, |
@@ -303,8 +300,7 @@ discard block |
||
| 303 | 300 | */ |
| 304 | 301 | function p_duplicate_group(array $group1, array $group2) |
| 305 | 302 | { |
| 306 | - $ret = array |
|
| 307 | - ( |
|
| 303 | + $ret = array( |
|
| 308 | 304 | 'p' => 0, |
| 309 | 305 | 'homepage_match' => false, |
| 310 | 306 | 'phone_match' => false, |
@@ -370,7 +366,7 @@ discard block |
||
| 370 | 366 | $persons = $this->get_person_candidates(); |
| 371 | 367 | |
| 372 | 368 | $params = array(); |
| 373 | - $params['objects'] =& $persons; |
|
| 369 | + $params['objects'] = & $persons; |
|
| 374 | 370 | $params['mode'] = 'person'; |
| 375 | 371 | |
| 376 | 372 | array_walk($persons, array($this, 'check_all_arraywalk'), $params); |
@@ -442,7 +438,7 @@ discard block |
||
| 442 | 438 | continue; |
| 443 | 439 | } |
| 444 | 440 | |
| 445 | - if ( $obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
| 441 | + if ($obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
| 446 | 442 | || $obj2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj1->guid)) |
| 447 | 443 | { |
| 448 | 444 | // Not-duplicate parameter found, returning zero probability |
@@ -472,7 +468,7 @@ discard block |
||
| 472 | 468 | |
| 473 | 469 | $groups = $this->get_group_candidates(); |
| 474 | 470 | $params = array(); |
| 475 | - $params['objects'] =& $groups; |
|
| 471 | + $params['objects'] = & $groups; |
|
| 476 | 472 | $params['mode'] = 'group'; |
| 477 | 473 | array_walk($groups, array($this, 'check_all_arraywalk'), $params); |
| 478 | 474 | |
@@ -517,7 +513,7 @@ discard block |
||
| 517 | 513 | } |
| 518 | 514 | } |
| 519 | 515 | } |
| 520 | - debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds"); |
|
| 516 | + debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds"); |
|
| 521 | 517 | if ($output) |
| 522 | 518 | { |
| 523 | 519 | echo "INFO: DONE with persons. Elapsed time " . (time() - $time_start) . " seconds<br/>\n"; |
@@ -557,10 +553,10 @@ discard block |
||
| 557 | 553 | } |
| 558 | 554 | } |
| 559 | 555 | |
| 560 | - debug_add("Done on " . time() . ", took: " . (time()-$time_start) . " seconds"); |
|
| 556 | + debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds"); |
|
| 561 | 557 | if ($output) |
| 562 | 558 | { |
| 563 | - echo "INFO: DONE with groups. Elapsed time: " . (time()-$time_start) ." seconds<br/>\n"; |
|
| 559 | + echo "INFO: DONE with groups. Elapsed time: " . (time() - $time_start) . " seconds<br/>\n"; |
|
| 564 | 560 | flush(); |
| 565 | 561 | } |
| 566 | 562 | } |
@@ -138,8 +138,7 @@ discard block |
||
| 138 | 138 | { |
| 139 | 139 | $ret['email_match'] = true; |
| 140 | 140 | $ret['p'] += 1; |
| 141 | - } |
|
| 142 | - else if (!empty($person1['lastname'])) |
|
| 141 | + } else if (!empty($person1['lastname'])) |
|
| 143 | 142 | { |
| 144 | 143 | // if user's lastname is part of the email address, check to see if the difference is only in the domain part |
| 145 | 144 | $email1 = preg_replace('/@.+/', '', $person1['email']); |
@@ -435,8 +434,7 @@ discard block |
||
| 435 | 434 | { |
| 436 | 435 | $obj1 = $class::get_cached($arr1['guid']); |
| 437 | 436 | $obj2 = $class::get_cached($arr2['guid']); |
| 438 | - } |
|
| 439 | - catch (midcom_error $e) |
|
| 437 | + } catch (midcom_error $e) |
|
| 440 | 438 | { |
| 441 | 439 | $e->log(); |
| 442 | 440 | continue; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | public function merge($obj1, $obj2, $merge_mode) |
| 48 | 48 | { |
| 49 | - if ( $merge_mode !== 'all' |
|
| 49 | + if ($merge_mode !== 'all' |
|
| 50 | 50 | && $merge_mode !== 'future') |
| 51 | 51 | { |
| 52 | 52 | debug_add("invalid mode {$merge_mode}", MIDCOM_LOG_ERROR); |
@@ -97,10 +97,10 @@ discard block |
||
| 97 | 97 | { |
| 98 | 98 | $dup = $this->check_duplicate($results, $result, $conf['duplicate_check']); |
| 99 | 99 | |
| 100 | - if ( is_object($dup) |
|
| 100 | + if (is_object($dup) |
|
| 101 | 101 | || $dup === false) |
| 102 | 102 | { |
| 103 | - if ( !is_object($dup) |
|
| 103 | + if (!is_object($dup) |
|
| 104 | 104 | || !array_key_exists($dup->id, $todelete)) |
| 105 | 105 | { |
| 106 | 106 | $todelete[$result->id] = $result; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | - if ( $needs_update |
|
| 114 | + if ($needs_update |
|
| 115 | 115 | && !$result->update()) |
| 116 | 116 | { |
| 117 | 117 | throw new midcom_error("Failed to update {$classname} #{$result->id}, errstr: " . midcom_connection::get_error_string()); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | foreach ($results as $result) |
| 172 | 172 | { |
| 173 | - if ( $result->$field === $object->$field |
|
| 173 | + if ($result->$field === $object->$field |
|
| 174 | 174 | && $result->id !== $object->id) |
| 175 | 175 | { |
| 176 | 176 | return $result; |
@@ -182,8 +182,7 @@ discard block |
||
| 182 | 182 | private function merge_persons($person1, $person2) |
| 183 | 183 | { |
| 184 | 184 | // Copy fields missing from person1 and present in person2 over |
| 185 | - $skip_properties = array |
|
| 186 | - ( |
|
| 185 | + $skip_properties = array( |
|
| 187 | 186 | 'id' => true, |
| 188 | 187 | 'guid' => true, |
| 189 | 188 | ); |
@@ -191,7 +190,7 @@ discard block |
||
| 191 | 190 | foreach ($person2 as $property => $value) |
| 192 | 191 | { |
| 193 | 192 | // Copy only simple properties not marked to be skipped missing from person1 |
| 194 | - if ( empty($person2->$property) |
|
| 193 | + if (empty($person2->$property) |
|
| 195 | 194 | || !empty($person1->$property) |
| 196 | 195 | || isset($skip_properties[$property]) |
| 197 | 196 | || !is_scalar($value)) |
@@ -74,10 +74,8 @@ |
||
| 74 | 74 | */ |
| 75 | 75 | public function get_calendar_options() |
| 76 | 76 | { |
| 77 | - $options = array |
|
| 78 | - ( |
|
| 79 | - 'businessHours' => array |
|
| 80 | - ( |
|
| 77 | + $options = array( |
|
| 78 | + 'businessHours' => array( |
|
| 81 | 79 | 'start' => $this->_config->get('day_start_time') . ':00', |
| 82 | 80 | 'end' => $this->_config->get('day_end_time') . ':00', |
| 83 | 81 | 'dow' => array(1, 2, 3, 4, 5) |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | //Check up |
| 169 | - if ( !$this->up |
|
| 169 | + if (!$this->up |
|
| 170 | 170 | && $this->title != '__org_openpsa_calendar') |
| 171 | 171 | { |
| 172 | 172 | $root_event = org_openpsa_calendar_interface::find_root_event(); |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | private function _check_timerange() |
| 203 | 203 | { |
| 204 | 204 | //Force types |
| 205 | - $this->start = (int)$this->start; |
|
| 206 | - $this->end = (int)$this->end; |
|
| 207 | - if ( !$this->start |
|
| 205 | + $this->start = (int) $this->start; |
|
| 206 | + $this->end = (int) $this->end; |
|
| 207 | + if (!$this->start |
|
| 208 | 208 | || !$this->end) |
| 209 | 209 | { |
| 210 | 210 | debug_add('Event must have start and end timestamps'); |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * Force start and end seconds to 1 and 0 respectively |
| 217 | 217 | * (to avoid stupid one second overlaps) |
| 218 | 218 | */ |
| 219 | - $this->start = mktime( date('G', $this->start), |
|
| 219 | + $this->start = mktime(date('G', $this->start), |
|
| 220 | 220 | date('i', $this->start), |
| 221 | 221 | 1, |
| 222 | 222 | date('n', $this->start), |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | private function _suspects_classes_present() |
| 327 | 327 | { |
| 328 | - return ( class_exists('org_openpsa_relatedto_dba') |
|
| 328 | + return (class_exists('org_openpsa_relatedto_dba') |
|
| 329 | 329 | && class_exists('org_openpsa_relatedto_suspect')); |
| 330 | 330 | } |
| 331 | 331 | |
@@ -310,8 +310,7 @@ discard block |
||
| 310 | 310 | if ($linkdata['link']->create()) |
| 311 | 311 | { |
| 312 | 312 | debug_add("saved link to task #{$linkdata['other_obj']->id} (link id #{$linkdata['link']->id})", MIDCOM_LOG_INFO); |
| 313 | - } |
|
| 314 | - else |
|
| 313 | + } else |
|
| 315 | 314 | { |
| 316 | 315 | debug_add("could not save link to task #{$linkdata['other_obj']->id}, errstr" . midcom_connection::get_error_string(), MIDCOM_LOG_WARN); |
| 317 | 316 | } |
@@ -360,8 +359,7 @@ discard block |
||
| 360 | 359 | if ($linkdata['link']->create()) |
| 361 | 360 | { |
| 362 | 361 | debug_add("saved sales link to {$linkdata['other_obj']->guid} (link id #{$linkdata['link']->id})", MIDCOM_LOG_INFO); |
| 363 | - } |
|
| 364 | - else |
|
| 362 | + } else |
|
| 365 | 363 | { |
| 366 | 364 | debug_add("could not save sales link to {$linkdata['other_obj']->guid}, errstr" . midcom_connection::get_error_string(), MIDCOM_LOG_WARN); |
| 367 | 365 | } |
@@ -420,8 +418,7 @@ discard block |
||
| 420 | 418 | if ($this->orgOpenpsaAccesstype == org_openpsa_core_acl::ACCESS_PRIVATE) |
| 421 | 419 | { |
| 422 | 420 | $this->set_privilege('org.openpsa.calendar:read', 'EVERYONE', MIDCOM_PRIVILEGE_DENY); |
| 423 | - } |
|
| 424 | - else |
|
| 421 | + } else |
|
| 425 | 422 | { |
| 426 | 423 | $this->set_privilege('org.openpsa.calendar:read', 'EVERYONE', MIDCOM_PRIVILEGE_ALLOW); |
| 427 | 424 | } |
@@ -45,8 +45,7 @@ |
||
| 45 | 45 | try |
| 46 | 46 | { |
| 47 | 47 | $resource = org_openpsa_calendar_resource_dba::get_cached($this->resource); |
| 48 | - } |
|
| 49 | - catch (midcom_error $e) |
|
| 48 | + } catch (midcom_error $e) |
|
| 50 | 49 | { |
| 51 | 50 | debug_add("Cannot fetch resource #{$this->resource} returning false", MIDCOM_LOG_INFO); |
| 52 | 51 | return false; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | $event = new org_openpsa_calendar_event_dba($this->eid); |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( $recipient->id == midcom_connection::get_user() |
|
| 76 | + if ($recipient->id == midcom_connection::get_user() |
|
| 77 | 77 | && !$event->send_notify_me) |
| 78 | 78 | { |
| 79 | 79 | //Do not send notification to current user |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | return false; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if ( $type == 'cancel' |
|
| 122 | + if ($type == 'cancel' |
|
| 123 | 123 | || $type == 'remove') |
| 124 | 124 | { |
| 125 | 125 | // TODO: Create iCal export with correct delete commands |
@@ -129,10 +129,8 @@ discard block |
||
| 129 | 129 | $generator = midcom::get()->serviceloader->load('midcom_core_service_urlgenerator'); |
| 130 | 130 | $encoder = new org_openpsa_calendar_vcal; |
| 131 | 131 | $encoder->add_event($event); |
| 132 | - $message['attachments'] = array |
|
| 133 | - ( |
|
| 134 | - array |
|
| 135 | - ( |
|
| 132 | + $message['attachments'] = array( |
|
| 133 | + array( |
|
| 136 | 134 | 'name' => $generator->from_string(sprintf('%s on %s', $event->title, date('Ymd_Hi', $event->start))) . '.ics', |
| 137 | 135 | 'mimetype' => 'text/calendar', |
| 138 | 136 | 'content' => (string) $encoder, |
@@ -208,7 +206,7 @@ discard block |
||
| 208 | 206 | { |
| 209 | 207 | $ymd = date('Ymd', $stamp); |
| 210 | 208 | debug_add("making sure date {$ymd} has at least one event"); |
| 211 | - $stamp = mktime(0, 0, 1, date('m', $stamp), date('d', $stamp)+1, date('Y', $stamp)); |
|
| 209 | + $stamp = mktime(0, 0, 1, date('m', $stamp), date('d', $stamp) + 1, date('Y', $stamp)); |
|
| 212 | 210 | if (array_key_exists($ymd, $events_by_date)) |
| 213 | 211 | { |
| 214 | 212 | continue; |
@@ -227,13 +225,13 @@ discard block |
||
| 227 | 225 | $workday_starts = 8; |
| 228 | 226 | $workday_ends = 16; |
| 229 | 227 | |
| 230 | - $workday_starts_ts = mktime($workday_starts, 0, 0, (int)$ymd_matches[2], (int)$ymd_matches[3], (int)$ymd_matches[1]); |
|
| 231 | - $workday_ends_ts = mktime($workday_ends, 0, 0, (int)$ymd_matches[2], (int)$ymd_matches[3], (int)$ymd_matches[1]); |
|
| 228 | + $workday_starts_ts = mktime($workday_starts, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]); |
|
| 229 | + $workday_ends_ts = mktime($workday_ends, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]); |
|
| 232 | 230 | $last_end_time = false; |
| 233 | 231 | $last_event = false; |
| 234 | 232 | foreach ($events as $event) |
| 235 | 233 | { |
| 236 | - if ( $event->end <= $workday_starts_ts |
|
| 234 | + if ($event->end <= $workday_starts_ts |
|
| 237 | 235 | || $event->start >= $workday_ends_ts) |
| 238 | 236 | { |
| 239 | 237 | // We need not to consider this event, it is outside the defined workday |
@@ -271,8 +269,8 @@ discard block |
||
| 271 | 269 | { |
| 272 | 270 | $last_end_time = $workday_starts_ts; |
| 273 | 271 | } |
| 274 | - if ( $last_end_time < $workday_ends_ts |
|
| 275 | - && (($workday_ends_ts- $last_end_time) >= $amount)) |
|
| 272 | + if ($last_end_time < $workday_ends_ts |
|
| 273 | + && (($workday_ends_ts - $last_end_time) >= $amount)) |
|
| 276 | 274 | { |
| 277 | 275 | $slots[] = self::_create_slot($last_end_time, $workday_ends_ts, $last_event); |
| 278 | 276 | } |
@@ -283,8 +281,7 @@ discard block |
||
| 283 | 281 | |
| 284 | 282 | private static function _create_slot($start, $end, $previous, $next = false) |
| 285 | 283 | { |
| 286 | - return array |
|
| 287 | - ( |
|
| 284 | + return array( |
|
| 288 | 285 | 'start' => $start, |
| 289 | 286 | 'end' => $end, |
| 290 | 287 | 'previous' => $previous, |
@@ -123,8 +123,7 @@ discard block |
||
| 123 | 123 | || $type == 'remove') |
| 124 | 124 | { |
| 125 | 125 | // TODO: Create iCal export with correct delete commands |
| 126 | - } |
|
| 127 | - else |
|
| 126 | + } else |
|
| 128 | 127 | { |
| 129 | 128 | $generator = midcom::get()->serviceloader->load('midcom_core_service_urlgenerator'); |
| 130 | 129 | $encoder = new org_openpsa_calendar_vcal; |
@@ -158,8 +157,7 @@ discard block |
||
| 158 | 157 | debug_add('person #' . $person->id . 'has no email address, aborting'); |
| 159 | 158 | return false; |
| 160 | 159 | } |
| 161 | - } |
|
| 162 | - catch (midcom_error $e) |
|
| 160 | + } catch (midcom_error $e) |
|
| 163 | 161 | { |
| 164 | 162 | return false; |
| 165 | 163 | } |
@@ -190,8 +188,7 @@ discard block |
||
| 190 | 188 | try |
| 191 | 189 | { |
| 192 | 190 | $event = org_openpsa_calendar_event_dba::get_cached($eid); |
| 193 | - } |
|
| 194 | - catch (midcom_error $e) |
|
| 191 | + } catch (midcom_error $e) |
|
| 195 | 192 | { |
| 196 | 193 | continue; |
| 197 | 194 | } |
@@ -247,8 +244,7 @@ discard block |
||
| 247 | 244 | { |
| 248 | 245 | // First event of the day starts after we have started working, use work start time as last end time. |
| 249 | 246 | $last_end_time = $workday_starts_ts; |
| 250 | - } |
|
| 251 | - else |
|
| 247 | + } else |
|
| 252 | 248 | { |
| 253 | 249 | // Make the first event of the day the last end time and skip rest of the checks |
| 254 | 250 | $last_end_time = $event->end; |
@@ -99,8 +99,7 @@ |
||
| 99 | 99 | // Attendee must have email address of valid format, these must also be unique. |
| 100 | 100 | $person->email = preg_replace('/[^0-9_\x61-\x7a]/i', '_', strtolower($person->name)) . '[email protected]'; |
| 101 | 101 | } |
| 102 | - $parameters = array |
|
| 103 | - ( |
|
| 102 | + $parameters = array( |
|
| 104 | 103 | 'ROLE' => 'REQ-PARTICIPANT', |
| 105 | 104 | 'CUTYPE' => 'INDIVIDUAL', |
| 106 | 105 | 'PARTSTAT' => 'ACCEPTED', |
@@ -68,8 +68,7 @@ |
||
| 68 | 68 | if ($event->busy) |
| 69 | 69 | { |
| 70 | 70 | $vevent->TRANSP = 'OPAQUE'; |
| 71 | - } |
|
| 72 | - else |
|
| 71 | + } else |
|
| 73 | 72 | { |
| 74 | 73 | $vevent->TRANSP = 'TRANSPARENT'; |
| 75 | 74 | } |