@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | public function __construct() |
49 | 49 | { |
50 | - if ( php_sapi_name() != 'cli' |
|
50 | + if (php_sapi_name() != 'cli' |
|
51 | 51 | || !empty($_SERVER['REMOTE_ADDR'])) { |
52 | 52 | $this->_httpd_setup(); |
53 | 53 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | * |
64 | 64 | * 2008-09-26: Now also rewrites urls ending in .html to end with trailing slash. |
65 | 65 | */ |
66 | - $redirect_test_uri = (string)$_SERVER['REQUEST_URI']; |
|
67 | - if ( !isset($_SERVER['MIDCOM_COMPAT_REDIR']) |
|
68 | - || (bool)$_SERVER['MIDCOM_COMPAT_REDIR'] !== false) { |
|
66 | + $redirect_test_uri = (string) $_SERVER['REQUEST_URI']; |
|
67 | + if (!isset($_SERVER['MIDCOM_COMPAT_REDIR']) |
|
68 | + || (bool) $_SERVER['MIDCOM_COMPAT_REDIR'] !== false) { |
|
69 | 69 | $redirect_test_uri = preg_replace('/\.html$/', '', $redirect_test_uri); |
70 | 70 | } |
71 | - if ( !preg_match('%\?|/$|midcom-.+-|/.*\.[^/]+$%', $redirect_test_uri) |
|
71 | + if (!preg_match('%\?|/$|midcom-.+-|/.*\.[^/]+$%', $redirect_test_uri) |
|
72 | 72 | && (empty($_POST))) { |
73 | 73 | $this->header('HTTP/1.0 301 Moved Permanently'); |
74 | 74 | $this->header("Location: {$redirect_test_uri}/"); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | private function send($httpcode, $message) |
250 | 250 | { |
251 | 251 | $error_actions = midcom::get()->config->get('error_actions'); |
252 | - if ( !isset($error_actions[$httpcode]) |
|
252 | + if (!isset($error_actions[$httpcode]) |
|
253 | 253 | || !isset($error_actions[$httpcode]['action'])) { |
254 | 254 | // No action specified for this error code, skip |
255 | 255 | return; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
282 | - if ( !is_writable($config['filename']) |
|
282 | + if (!is_writable($config['filename']) |
|
283 | 283 | && !is_writable(dirname($config['filename']))) { |
284 | 284 | debug_add("Error logging file {$config['filename']} is not writable", MIDCOM_LOG_WARN); |
285 | 285 | return; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function create($from_obj, $from_component, $to_obj, $to_component, $status = false, $extra = false) |
33 | 33 | { |
34 | - if ( !is_object($from_obj) |
|
34 | + if (!is_object($from_obj) |
|
35 | 35 | || !is_object($to_obj)) { |
36 | 36 | return false; |
37 | 37 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | debug_print_r("processing button '{$mode}' with data:", $data); |
259 | 259 | if ($data === false) { |
260 | 260 | //In case somebody didn't unset() a button from the defaults, just marked it as false |
261 | - debug_add('data marked as false, skipping (the correct way is to unset() the key)', MIDCOM_LOG_WARN); |
|
261 | + debug_add('data marked as false, skipping (the correct way is to unset() the key)', MIDCOM_LOG_WARN); |
|
262 | 262 | continue; |
263 | 263 | } |
264 | 264 |
@@ -136,7 +136,8 @@ |
||
136 | 136 | { |
137 | 137 | $ret = array('org_openpsa_relatedto' => array()); |
138 | 138 | foreach ($array as $rel) { |
139 | - if (!midcom::get()->dbfactory->is_a($rel, 'org_openpsa_relatedto_dba')) { //Matches also 'org_openpsa_relatedto' |
|
139 | + if (!midcom::get()->dbfactory->is_a($rel, 'org_openpsa_relatedto_dba')) { |
|
140 | +//Matches also 'org_openpsa_relatedto' |
|
140 | 141 | //Wrong type of object found in array, cruelly abort the whole procedure |
141 | 142 | return false; |
142 | 143 | } |
@@ -30,7 +30,8 @@ |
||
30 | 30 | try { |
31 | 31 | midcom::get()->dbfactory->get_object_by_guid($result->fromGuid); |
32 | 32 | midcom::get()->dbfactory->get_object_by_guid($result->toGuid); |
33 | - } catch (midcom_error $e) { |
|
33 | + } |
|
34 | + catch (midcom_error $e) { |
|
34 | 35 | echo $i . "/" . $total . ": Deleting relatedto #" . $result->id . "\n"; |
35 | 36 | flush(); |
36 | 37 | $result->delete(); |
@@ -42,7 +42,8 @@ |
||
42 | 42 | } |
43 | 43 | try { |
44 | 44 | $resource = org_openpsa_calendar_resource_dba::get_cached($this->resource); |
45 | - } catch (midcom_error $e) { |
|
45 | + } |
|
46 | + catch (midcom_error $e) { |
|
46 | 47 | debug_add("Cannot fetch resource #{$this->resource} returning false", MIDCOM_LOG_INFO); |
47 | 48 | return false; |
48 | 49 | } |
@@ -287,7 +287,7 @@ |
||
287 | 287 | $this->_datamanager = new midcom_helper_datamanager2_datamanager($schemadb); |
288 | 288 | |
289 | 289 | if (!$this->_request_data['event']->can_do('org.openpsa.calendar:read')) { |
290 | - $stat = $this->_datamanager->set_schema('private') |
|
290 | + $stat = $this->_datamanager->set_schema('private') |
|
291 | 291 | && $this->_datamanager->set_storage($this->_request_data['event']); |
292 | 292 | } else { |
293 | 293 | $stat = $this->_datamanager->autoset_storage($this->_request_data['event']); |
@@ -152,8 +152,7 @@ |
||
152 | 152 | // Include each type |
153 | 153 | if ($type === 'people') { |
154 | 154 | $mc->add_constraint('uid.guid', 'IN', $selected); |
155 | - } |
|
156 | - else if ($type == 'groups') { |
|
155 | + } else if ($type == 'groups') { |
|
157 | 156 | if (!$join_added) { |
158 | 157 | $mc->get_doctrine()->leftJoin('midgard_member', 'm', Join::WITH, 'm.uid = c.uid'); |
159 | 158 | $mc->get_doctrine()->leftJoin('midgard_group', 'g', Join::WITH, 'g.id = m.gid'); |
@@ -92,7 +92,7 @@ |
||
92 | 92 | $root_event = self::find_root_event(); |
93 | 93 | |
94 | 94 | $qb = org_openpsa_calendar_event_dba::new_query_builder(); |
95 | - $qb->add_constraint('up', '=', $root_event->id); |
|
95 | + $qb->add_constraint('up', '=', $root_event->id); |
|
96 | 96 | $schemadb = midcom_helper_datamanager2_schema::load_database($config->get('schemadb')); |
97 | 97 | |
98 | 98 | $indexer = new org_openpsa_calendar_midcom_indexer($topic, $indexer); |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // TODO: Warehouse management: create new order |
86 | - if ( $this->_deliverable->end < $next_cycle_start |
|
86 | + if ($this->_deliverable->end < $next_cycle_start |
|
87 | 87 | && $this->_deliverable->end != 0) { |
88 | 88 | debug_add('Do not register next cycle, the contract ends before'); |
89 | 89 | return $this->_deliverable->end_subscription(); |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | if ($this->_deliverable->unit != 'd') { |
307 | 307 | //If previous cycle was run at the end of the month, the new one should be at the end of the month as well |
308 | 308 | $date = new DateTime(gmdate('Y-m-d', $time), new DateTimeZone('GMT')); |
309 | - if ( $date->format('t') == $date->format('j') |
|
309 | + if ($date->format('t') == $date->format('j') |
|
310 | 310 | && $new_date->format('t') != $new_date->format('j')) { |
311 | 311 | $new_date->setDate((int) $new_date->format('Y'), (int) $new_date->format('m'), (int) $new_date->format('t')); |
312 | 312 | } |
@@ -372,11 +372,11 @@ discard block |
||
372 | 372 | break; |
373 | 373 | case 'q': |
374 | 374 | // Quarterly recurring subscription |
375 | - $identifier = ceil(((int)$date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
375 | + $identifier = ceil(((int) $date->format('n')) / 4) . 'Q' . $date->format('y'); |
|
376 | 376 | break; |
377 | 377 | case 'hy': |
378 | 378 | // Half-yearly recurring subscription |
379 | - $identifier = ceil(((int)$date->format('n')) / 6) . '/' . $date->format('Y'); |
|
379 | + $identifier = ceil(((int) $date->format('n')) / 6) . '/' . $date->format('Y'); |
|
380 | 380 | break; |
381 | 381 | case 'y': |
382 | 382 | // Yearly recurring subscription |
@@ -126,7 +126,8 @@ |
||
126 | 126 | $salesproject = org_openpsa_sales_salesproject_dba::get_cached($this->_deliverable->salesproject); |
127 | 127 | try { |
128 | 128 | $owner = midcom_db_person::get_cached($salesproject->owner); |
129 | - } catch (midcom_error $e) { |
|
129 | + } |
|
130 | + catch (midcom_error $e) { |
|
130 | 131 | $e->log(); |
131 | 132 | return; |
132 | 133 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | // generate next action buttons |
52 | - if ( $invoice->can_do('midgard:update') |
|
52 | + if ($invoice->can_do('midgard:update') |
|
53 | 53 | && count($next) > 0) { |
54 | 54 | foreach ($next as $action) { |
55 | 55 | $actions .= '<button id="invoice_' . $invoice->guid . '" class="yes ' . $action . '">'; |