@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | public function is_readable_by($user_id) |
32 | 32 | { |
33 | - return ( !$user_id |
|
33 | + return (!$user_id |
|
34 | 34 | || midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->guid, 'midcom_db_topic', $user_id)); |
35 | 35 | } |
36 | 36 |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $this->_controller = midcom_helper_datamanager2_controller::create('create'); |
68 | 68 | $this->_controller->schemadb = $schemadb; |
69 | 69 | $this->_controller->schemaname = 'default'; |
70 | - $this->_controller->callback_object =& $this; |
|
70 | + $this->_controller->callback_object = & $this; |
|
71 | 71 | |
72 | 72 | // Suggest to create the same type of a folder as the parent is |
73 | 73 | $component_suggestion = $this->_topic->component; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | if (!$this->_new_topic->create()) { |
103 | 103 | debug_print_r('We operated on this object:', $this->_new_topic); |
104 | - throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
104 | + throw new midcom_error('Failed to create a new topic, cannot continue. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | return $this->_new_topic; |
@@ -121,7 +121,7 @@ |
||
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | // No topics matching path, check for attachments |
124 | - $att_qb = midcom_db_attachment::new_query_builder(); |
|
124 | + $att_qb = midcom_db_attachment::new_query_builder(); |
|
125 | 125 | $att_qb->add_constraint('name', '=', $this->argv[0]); |
126 | 126 | $att_qb->add_constraint('parentguid', '=', $this->get_current_object()->guid); |
127 | 127 | if ($att_qb->count() == 0) { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | |
163 | 163 | private function _filter_schema_fields($key) |
164 | 164 | { |
165 | - if ( $key == 'metadata' |
|
165 | + if ($key == 'metadata' |
|
166 | 166 | || in_array($key, $this->_config->get('object_skip_fields'))) { |
167 | 167 | return false; |
168 | 168 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | private function _add_string_field($key, $type) |
174 | 174 | { |
175 | - if ( $key == 'component' |
|
175 | + if ($key == 'component' |
|
176 | 176 | && $type == 'midcom_db_topic') { |
177 | 177 | $this->_add_component_dropdown($key); |
178 | 178 | return; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | |
222 | 222 | private function _add_int_field($key) |
223 | 223 | { |
224 | - if ( $key == 'start' |
|
224 | + if ($key == 'start' |
|
225 | 225 | || $key == 'end' |
226 | 226 | || $key == 'added' |
227 | 227 | || $key == 'date') { |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | $height = 30; |
266 | 266 | |
267 | 267 | // Check the user preference and configuration |
268 | - if ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
269 | - || ( midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
268 | + if (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') |
|
269 | + || (midgard_admin_asgard_plugin::get_preference('tinymce_enabled') !== '0' |
|
270 | 270 | && $this->_config->get('tinymce_enabled'))) { |
271 | 271 | $widget = 'tinymce'; |
272 | 272 | } |
@@ -279,8 +279,8 @@ discard block |
||
279 | 279 | $height = 30; |
280 | 280 | |
281 | 281 | // Check the user preference and configuration |
282 | - if ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
283 | - || ( midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
282 | + if (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') |
|
283 | + || (midgard_admin_asgard_plugin::get_preference('codemirror_enabled') !== '0' |
|
284 | 284 | && $this->_config->get('codemirror_enabled'))) { |
285 | 285 | $widget = 'codemirror'; |
286 | 286 | } |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | if ($score1 > $score2) { |
543 | 543 | return 1; |
544 | 544 | } |
545 | - if ( $score1 < 3 |
|
545 | + if ($score1 < 3 |
|
546 | 546 | || $score1 > 6) { |
547 | 547 | return strnatcmp($first, $second); |
548 | 548 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | private function _compute_welcome_posting_count($start, $end) |
121 | 121 | { |
122 | - $data =& $this->_request_data; |
|
122 | + $data = & $this->_request_data; |
|
123 | 123 | $qb = midcom_db_article::new_query_builder(); |
124 | 124 | |
125 | 125 | $qb->add_constraint('metadata.published', '>=', $start->format('Y-m-d H:i:s')); |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | $year_data = array(); |
144 | 144 | $first_post = $this->_compute_welcome_first_post(); |
145 | 145 | $this->_request_data['first_post'] = $first_post; |
146 | - $this->_request_data['total_count'] =& $total_count; |
|
147 | - $this->_request_data['year_data'] =& $year_data; |
|
146 | + $this->_request_data['total_count'] = & $total_count; |
|
147 | + $this->_request_data['year_data'] = & $year_data; |
|
148 | 148 | if (!$first_post) { |
149 | 149 | return; |
150 | 150 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | switch ($handler_id) { |
279 | 279 | case 'archive-year-category': |
280 | 280 | $data['category'] = trim(strip_tags($args[1])); |
281 | - if ( isset($data['schemadb']['default']->fields['categories']) |
|
281 | + if (isset($data['schemadb']['default']->fields['categories']) |
|
282 | 282 | && array_key_exists('allow_multiple', $data['schemadb']['default']->fields['categories']['type_config']) |
283 | 283 | && !$data['schemadb']['default']->fields['categories']['type_config']['allow_multiple']) { |
284 | 284 | $qb->add_constraint('extra1', '=', (string) $data['category']); |
@@ -373,15 +373,15 @@ discard block |
||
373 | 373 | throw new midcom_error_notfound("The year '{$year}' is not a valid year identifier."); |
374 | 374 | } |
375 | 375 | |
376 | - if ( $month < 1 |
|
376 | + if ($month < 1 |
|
377 | 377 | || $month > 12) { |
378 | 378 | throw new midcom_error_notfound("The year {$month} is not a valid year identifier."); |
379 | 379 | } |
380 | 380 | |
381 | 381 | $now = new DateTime(); |
382 | - $this->_start = new DateTime("{$year}-" . sprintf('%02d', $month) . "-01 00:00:00"); |
|
382 | + $this->_start = new DateTime("{$year}-" . sprintf('%02d', $month) . "-01 00:00:00"); |
|
383 | 383 | if ($this->_start > $now) { |
384 | - throw new midcom_error_notfound("The month '{$year}-" . sprintf('%02d', $month) . "' is in the future, no archive available."); |
|
384 | + throw new midcom_error_notfound("The month '{$year}-" . sprintf('%02d', $month) . "' is in the future, no archive available."); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | if ($month == 12) { |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $endmonth = $month + 1; |
393 | 393 | } |
394 | 394 | |
395 | - $this->_end = new DateTime("{$endyear}-" . sprintf('%02d', $endmonth) . "-01 00:00:00"); |
|
395 | + $this->_end = new DateTime("{$endyear}-" . sprintf('%02d', $endmonth) . "-01 00:00:00"); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -68,7 +68,7 @@ |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $config = $this->get_config_for_topic($topic); |
71 | - if ( $object->name == 'index' |
|
71 | + if ($object->name == 'index' |
|
72 | 72 | && !$config->get('autoindex')) { |
73 | 73 | return ''; |
74 | 74 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | )); |
45 | 45 | } |
46 | 46 | |
47 | - if ( $this->_article->topic === $this->_topic->id |
|
47 | + if ($this->_article->topic === $this->_topic->id |
|
48 | 48 | && $this->_article->can_do('midgard:delete')) { |
49 | 49 | $delete = $this->get_workflow('delete', array('object' => $this->_article)); |
50 | 50 | $buttons[] = $delete->get_button("delete/{$this->_article->guid}/"); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | if ($this->_config->get('enable_ajax_editing')) { |
99 | 99 | $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
100 | - $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb']; |
|
100 | + $this->_request_data['controller']->schemadb = & $this->_request_data['schemadb']; |
|
101 | 101 | $this->_request_data['controller']->set_storage($this->_article); |
102 | 102 | $this->_request_data['controller']->process_ajax(); |
103 | 103 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | if ($this->_config->get('comments_enable')) { |
106 | 106 | if ($comments_node = $this->_seek_comments()) { |
107 | 107 | $this->_request_data['comments_url'] = $comments_node[MIDCOM_NAV_RELATIVEURL] . "comment/{$this->_article->guid}"; |
108 | - if ( $this->_topic->can_do('midgard:update') |
|
108 | + if ($this->_topic->can_do('midgard:update') |
|
109 | 109 | && $this->_topic->can_do('net.nehmer.comments:moderation')) { |
110 | 110 | net_nehmer_comments_viewer::add_head_elements(); |
111 | 111 | } |
@@ -218,7 +218,8 @@ |
||
218 | 218 | if ($this->_config->get('comments_topic')) { |
219 | 219 | try { |
220 | 220 | $comments_topic = new midcom_db_topic($this->_config->get('comments_topic')); |
221 | - } catch (midcom_error $e) { |
|
221 | + } |
|
222 | + catch (midcom_error $e) { |
|
222 | 223 | return false; |
223 | 224 | } |
224 | 225 |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | )); |
45 | 45 | } |
46 | 46 | |
47 | - if ( $this->_article->topic === $this->_topic->id |
|
47 | + if ($this->_article->topic === $this->_topic->id |
|
48 | 48 | && $this->_article->can_do('midgard:delete')) { |
49 | 49 | $delete = $this->get_workflow('delete', array('object' => $this->_article)); |
50 | 50 | $buttons[] = $delete->get_button("delete/{$this->_article->guid}/"); |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | |
116 | 116 | if ($this->_config->get('enable_ajax_editing')) { |
117 | 117 | $this->_request_data['controller'] = midcom_helper_datamanager2_controller::create('ajax'); |
118 | - $this->_request_data['controller']->schemadb =& $this->_request_data['schemadb']; |
|
118 | + $this->_request_data['controller']->schemadb = & $this->_request_data['schemadb']; |
|
119 | 119 | $this->_request_data['controller']->set_storage($this->_article); |
120 | 120 | $this->_request_data['controller']->process_ajax(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $arg = $this->_article->name ?: $this->_article->guid; |
124 | - if ( $arg != 'index' |
|
124 | + if ($arg != 'index' |
|
125 | 125 | && $this->_config->get('hide_navigation')) { |
126 | 126 | $this->add_breadcrumb("{$arg}/", $this->_article->title); |
127 | 127 | } |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | midcom::get()->metadata->set_request_metadata($this->_article->metadata->revised, $this->_article->guid); |
132 | 132 | $this->bind_view_to_object($this->_article, $this->_datamanager->schema->name); |
133 | 133 | |
134 | - if ( $this->_config->get('indexinnav') |
|
134 | + if ($this->_config->get('indexinnav') |
|
135 | 135 | || $this->_config->get('autoindex') |
136 | 136 | || $this->_article->name != 'index') { |
137 | 137 | $this->set_active_leaf($this->_article->id); |
138 | 138 | } |
139 | 139 | |
140 | - if ( $this->_config->get('folder_in_title') |
|
140 | + if ($this->_config->get('folder_in_title') |
|
141 | 141 | && $this->_topic->extra != $this->_article->title) { |
142 | 142 | midcom::get()->head->set_pagetitle("{$this->_topic->extra}: {$this->_article->title}"); |
143 | 143 | } else { |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function _show_view($handler_id, array &$data) |
193 | 193 | { |
194 | - if ( $this->_config->get('enable_ajax_editing') |
|
194 | + if ($this->_config->get('enable_ajax_editing') |
|
195 | 195 | && isset($data['controller'])) { |
196 | 196 | // For AJAX handling it is the controller that renders everything |
197 | 197 | $this->_request_data['view_article'] = $this->_request_data['controller']->get_content_html(); |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | * if the field has the default value or is empty, the user gets a free pass |
41 | 41 | * (if the field is required, this is caught by a separate rule) |
42 | 42 | */ |
43 | - if ( $date == "" |
|
43 | + if ($date == "" |
|
44 | 44 | || $date == "0000-00-00" |
45 | 45 | || $date == "0000-00-00 00:00:00") { |
46 | 46 | debug_add("value {$date} is assumed to be intentionally blank"); |
47 | 47 | return true; |
48 | 48 | } |
49 | - if ( preg_match("/^\d{4}-\d{2}-\d{2}/", $date) == 0 |
|
49 | + if (preg_match("/^\d{4}-\d{2}-\d{2}/", $date) == 0 |
|
50 | 50 | && preg_match("/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/", $date) == 0) { |
51 | 51 | debug_add("value {$date} is incorrectly formatted"); |
52 | 52 | return false; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | private function _sanitize_time($value, $options) |
66 | 66 | { |
67 | - if ( empty($value[0][$options . '_hours']) |
|
67 | + if (empty($value[0][$options . '_hours']) |
|
68 | 68 | && empty($value[0][$options . '_minutes']) |
69 | 69 | && empty($value[0][$options . '_seconds'])) { |
70 | 70 | return ''; |