@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return; |
85 | 85 | } |
86 | 86 | $parent = $this->get_parent(); |
87 | - if ( $parent |
|
87 | + if ($parent |
|
88 | 88 | && $parent->component == 'org.openpsa.documents') { |
89 | 89 | midcom::get()->auth->request_sudo('org.openpsa.documents'); |
90 | 90 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $backup_attachment = $backup->create_attachment($original_attachment->name, $original_attachment->title, $original_attachment->mimetype); |
155 | 155 | |
156 | 156 | $original_handle = $original_attachment->open('r'); |
157 | - if ( !$backup_attachment |
|
157 | + if (!$backup_attachment |
|
158 | 158 | || !$original_handle) { |
159 | 159 | // Failed to copy the attachment, abort |
160 | 160 | return $backup->delete(); |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - if ( $this->_config->get('jabber_enable_presence') |
|
162 | + if ($this->_config->get('jabber_enable_presence') |
|
163 | 163 | && $person->get_parameter('org.openpsa.jabber', 'jid')) { |
164 | 164 | $this->contact_details['jid'] = $person->get_parameter('org.openpsa.jabber', 'jid'); |
165 | 165 | } |
166 | 166 | |
167 | - if ( $this->_config->get('skype_enable_presence') |
|
167 | + if ($this->_config->get('skype_enable_presence') |
|
168 | 168 | && $person->get_parameter('org.openpsa.skype', 'name')) { |
169 | 169 | $this->contact_details['skype'] = $person->get_parameter('org.openpsa.skype', 'name'); |
170 | 170 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | if (!empty($attachments[$type])) { |
202 | 202 | return '<img class="photo" src="' . midcom_db_attachment::get_url($attachments[$type]) . '">'; |
203 | 203 | } |
204 | - if ( $this->_config->get('gravatar_enable') |
|
204 | + if ($this->_config->get('gravatar_enable') |
|
205 | 205 | && !empty($this->contact_details['email'])) { |
206 | 206 | $size = ($type == 'view') ? 500 : 32; |
207 | 207 | $gravatar_url = "https://www.gravatar.com/avatar/" . md5(strtolower(trim($this->contact_details['email']))) . "?s=" . $size . '&d=identicon'; |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | private function _show_groups() |
315 | 315 | { |
316 | - if ( !$this->show_groups |
|
316 | + if (!$this->show_groups |
|
317 | 317 | || empty($this->contact_details['id'])) { |
318 | 318 | return; |
319 | 319 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | $default_shown = true; |
378 | 378 | $cards_to_show[] = $cardname; |
379 | 379 | } |
380 | - } elseif ( $customer->$property |
|
380 | + } elseif ($customer->$property |
|
381 | 381 | || ($customer->street && !$inherited_cards_only && !$default_shown)) { |
382 | 382 | $inherited_cards_only = false; |
383 | 383 | $multiple_addresses = true; |
@@ -398,8 +398,8 @@ discard block |
||
398 | 398 | |
399 | 399 | foreach ($cards_to_show as $cardname) { |
400 | 400 | echo '<div class="vcard">'; |
401 | - if ( $multiple_addresses |
|
402 | - || ( $cardname != 'visiting' |
|
401 | + if ($multiple_addresses |
|
402 | + || ($cardname != 'visiting' |
|
403 | 403 | && !$inherited_cards_only)) { |
404 | 404 | echo '<div style="text-align:center"><em>' . midcom::get()->i18n->get_string($cardname . ' address', 'org.openpsa.contacts') . "</em></div>\n"; |
405 | 405 | } |
@@ -113,7 +113,8 @@ discard block |
||
113 | 113 | |
114 | 114 | try { |
115 | 115 | $person = midcom_db_person::get_cached($src); |
116 | - } catch (midcom_error $e) { |
|
116 | + } |
|
117 | + catch (midcom_error $e) { |
|
117 | 118 | return $cache[$src] = new self(new midcom_db_person); |
118 | 119 | } |
119 | 120 | |
@@ -313,7 +314,8 @@ discard block |
||
313 | 314 | foreach ($mc->get_rows(['gid', 'extra']) as $data) { |
314 | 315 | try { |
315 | 316 | $group = org_openpsa_contacts_group_dba::get_cached($data['gid']); |
316 | - } catch (midcom_error $e) { |
|
317 | + } |
|
318 | + catch (midcom_error $e) { |
|
317 | 319 | $e->log(); |
318 | 320 | continue; |
319 | 321 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | echo " <td><a href='" . $data['router']->generate('preview', ['guid' => $guid, 'revision' => $number]) . "'>{$revision['version']}</a></td>\n"; |
33 | 33 | echo " <td>" . $formatter->datetime($revision['date']) . "</td>\n"; |
34 | 34 | |
35 | - if ( $revision['user'] |
|
35 | + if ($revision['user'] |
|
36 | 36 | && $user = midcom::get()->auth->get_user($revision['user'])) { |
37 | 37 | $person_label = $user->get_storage()->name; |
38 | 38 | echo " <td>{$person_label}</td>\n"; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | public function form_widget_simple(FormView $view, array $data) |
19 | 19 | { |
20 | - if ( !empty($data['value']) |
|
20 | + if (!empty($data['value']) |
|
21 | 21 | || is_numeric($data['value'])) { |
22 | 22 | return $data['value']; |
23 | 23 | } |
@@ -143,7 +143,7 @@ |
||
143 | 143 | |
144 | 144 | public function form_widget_simple(FormView $view, array $data) |
145 | 145 | { |
146 | - if ( !empty($data['value']) |
|
146 | + if (!empty($data['value']) |
|
147 | 147 | || is_numeric($data['value'])) { |
148 | 148 | return $this->escape($data['value']); |
149 | 149 | } |
@@ -64,7 +64,8 @@ |
||
64 | 64 | try { |
65 | 65 | $this->__object = $this->__midcom_class_name__::get_cached($this->__identifier); |
66 | 66 | return true; |
67 | - } catch (midcom_error $e) { |
|
67 | + } |
|
68 | + catch (midcom_error $e) { |
|
68 | 69 | $e->log(); |
69 | 70 | } |
70 | 71 | return false; |
@@ -166,7 +166,7 @@ |
||
166 | 166 | $address = addslashes($address); |
167 | 167 | return preg_replace_callback( |
168 | 168 | '/href="(http:\/\/.*?)"/i', |
169 | - function ($match) use ($address) { |
|
169 | + function($match) use ($address) { |
|
170 | 170 | return 'href="' . str_replace("URL", rawurlencode($match[1]), $address) . '"'; |
171 | 171 | }, |
172 | 172 | $html); |
@@ -148,13 +148,13 @@ |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
151 | - * Inserts a link detector to the given HTML source. All outgoing |
|
152 | - * HTTP links in the source HTML are replaced with the given |
|
153 | - * link detector address so that the token "URL" is replaced with |
|
154 | - * encoded form of the original link. It is expected that the link detector |
|
155 | - * address points to a script that records the passed link and |
|
156 | - * forwards the client to the real link target. |
|
157 | - */ |
|
151 | + * Inserts a link detector to the given HTML source. All outgoing |
|
152 | + * HTTP links in the source HTML are replaced with the given |
|
153 | + * link detector address so that the token "URL" is replaced with |
|
154 | + * encoded form of the original link. It is expected that the link detector |
|
155 | + * address points to a script that records the passed link and |
|
156 | + * forwards the client to the real link target. |
|
157 | + */ |
|
158 | 158 | private function _insert_link_detector(string $html, string $address) : string |
159 | 159 | { |
160 | 160 | $address = addslashes($address); |
@@ -575,7 +575,8 @@ |
||
575 | 575 | $param = $param->__object; |
576 | 576 | } |
577 | 577 | $this->_group_cache[$id] = new midcom_core_group($param); |
578 | - } catch (midcom_error $e) { |
|
578 | + } |
|
579 | + catch (midcom_error $e) { |
|
579 | 580 | debug_add("Group with identifier {$id} could not be loaded: " . $e->getMessage(), MIDCOM_LOG_WARN); |
580 | 581 | $this->_group_cache[$id] = null; |
581 | 582 | } |
@@ -221,7 +221,7 @@ |
||
221 | 221 | return true; |
222 | 222 | } |
223 | 223 | if ($user === null) { |
224 | - $user =& $this->user; |
|
224 | + $user = & $this->user; |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | if ($user == 'EVERYONE') { |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | protected function add_string_field(string $key, string $type) |
66 | 66 | { |
67 | - if ( $key == 'component' |
|
67 | + if ($key == 'component' |
|
68 | 68 | && $type == midcom_db_topic::class) { |
69 | 69 | $this->_add_component_dropdown($key); |
70 | 70 | return; |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | parent::add_longtext_field($key); |
135 | 135 | |
136 | 136 | // Check the user preference and configuration |
137 | - if ( in_array($key, ['content', 'description']) |
|
137 | + if (in_array($key, ['content', 'description']) |
|
138 | 138 | && midgard_admin_asgard_plugin::get_preference('tinymce_enabled')) { |
139 | 139 | $this->schema['fields'][$key]['widget'] = 'tinymce'; |
140 | 140 | } |
141 | 141 | |
142 | - if ( in_array($key, ['value', 'code']) |
|
142 | + if (in_array($key, ['value', 'code']) |
|
143 | 143 | && midgard_admin_asgard_plugin::get_preference('codemirror_enabled')) { |
144 | 144 | $this->schema['fields'][$key]['widget'] = 'codemirror'; |
145 | 145 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | if ($score1 > $score2) { |
258 | 258 | return 1; |
259 | 259 | } |
260 | - if ( $score1 < 3 |
|
260 | + if ($score1 < 3 |
|
261 | 261 | || $score1 > 6) { |
262 | 262 | return strnatcmp($first, $second); |
263 | 263 | } |