@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | { |
18 | 18 | $data['schemadb'] = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_feed')); |
19 | 19 | $data['controller'] = midcom_helper_datamanager2_controller::create('simple'); |
20 | - $data['controller']->schemadb =& $data['schemadb']; |
|
20 | + $data['controller']->schemadb = & $data['schemadb']; |
|
21 | 21 | $data['controller']->set_storage($data['feed']); |
22 | 22 | if (!$data['controller']->initialize()) { |
23 | 23 | throw new midcom_error("Failed to initialize a DM2 controller instance for feed {$data['feed']->id}."); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | // OPML subscription list import support |
87 | - if ( array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
87 | + if (array_key_exists('net_nemein_rss_manage_opml', $_FILES) |
|
88 | 88 | && is_uploaded_file($_FILES['net_nemein_rss_manage_opml']['tmp_name'])) { |
89 | 89 | $opml_file = $_FILES['net_nemein_rss_manage_opml']['tmp_name']; |
90 | 90 |
@@ -25,7 +25,8 @@ |
||
25 | 25 | { |
26 | 26 | try { |
27 | 27 | $viewer->register_plugin_namespace('__feeds', array('rss' => array('class' => __CLASS__))); |
28 | - } catch (midcom_error $e) { |
|
28 | + } |
|
29 | + catch (midcom_error $e) { |
|
29 | 30 | $e->log(); |
30 | 31 | } |
31 | 32 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | */ |
61 | 61 | private function _load_schemadb() |
62 | 62 | { |
63 | - $this->_schemadb =& $this->_request_data['schemadb']; |
|
64 | - if ( $this->_config->get('simple_name_handling') |
|
63 | + $this->_schemadb = & $this->_request_data['schemadb']; |
|
64 | + if ($this->_config->get('simple_name_handling') |
|
65 | 65 | && !midcom::get()->auth->admin) { |
66 | 66 | foreach (array_keys($this->_schemadb) as $name) { |
67 | 67 | $this->_schemadb[$name]->fields['name']['readonly'] = true; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | { |
77 | 77 | $this->_load_schemadb(); |
78 | 78 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
79 | - $this->_controller->schemadb =& $this->_schemadb; |
|
79 | + $this->_controller->schemadb = & $this->_schemadb; |
|
80 | 80 | $this->_controller->set_storage($this->_article); |
81 | 81 | if (!$this->_controller->initialize()) { |
82 | 82 | throw new midcom_error("Failed to initialize a DM2 controller instance for article {$this->_article->id}."); |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function load_schemadb() |
63 | 63 | { |
64 | - $this->_schemadb =& $this->_request_data['schemadb']; |
|
65 | - if ( $this->_config->get('simple_name_handling') |
|
64 | + $this->_schemadb = & $this->_request_data['schemadb']; |
|
65 | + if ($this->_config->get('simple_name_handling') |
|
66 | 66 | && !midcom::get()->auth->can_user_do('midcom:urlname')) { |
67 | 67 | foreach (array_keys($this->_schemadb) as $name) { |
68 | 68 | $this->_schemadb[$name]->fields['name']['readonly'] = true; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | if (!$this->_article->create()) { |
88 | 88 | debug_print_r('We operated on this object:', $this->_article); |
89 | - throw new midcom_error('Failed to create a new article. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
89 | + throw new midcom_error('Failed to create a new article. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // Callback possibility |
@@ -46,7 +46,7 @@ |
||
46 | 46 | $qb->add_constraint('name', '<>', ''); |
47 | 47 | |
48 | 48 | // Unless in Auto-Index mode or the index article is hidden, we skip the index article. |
49 | - if ( !$this->_config->get('autoindex') |
|
49 | + if (!$this->_config->get('autoindex') |
|
50 | 50 | && !$this->_config->get('indexinnav')) { |
51 | 51 | $qb->add_constraint('name', '<>', 'index'); |
52 | 52 | } |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | */ |
54 | 54 | private function _load_schemadb() |
55 | 55 | { |
56 | - $this->_schemadb =& $this->_request_data['schemadb']; |
|
57 | - if ( $this->_config->get('simple_name_handling') |
|
56 | + $this->_schemadb = & $this->_request_data['schemadb']; |
|
57 | + if ($this->_config->get('simple_name_handling') |
|
58 | 58 | && !midcom::get()->auth->admin) { |
59 | 59 | foreach (array_keys($this->_schemadb) as $name) { |
60 | 60 | $this->_schemadb[$name]->fields['name']['readonly'] = true; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | $this->_load_schemadb(); |
73 | 73 | $controller = midcom_helper_datamanager2_controller::create('simple'); |
74 | - $controller->schemadb =& $this->_schemadb; |
|
74 | + $controller->schemadb = & $this->_schemadb; |
|
75 | 75 | $controller->set_storage($this->_article); |
76 | 76 | |
77 | 77 | if (!$controller->initialize()) { |
@@ -174,7 +174,7 @@ |
||
174 | 174 | $filename = "{$article->name}/{$data['filename']}"; |
175 | 175 | $view[$filename] = $this->_get_attachment_data($filename, $data); |
176 | 176 | } |
177 | - } elseif ( $datamanager->types[$name] instanceof midcom_helper_datamanager2_type_image |
|
177 | + } elseif ($datamanager->types[$name] instanceof midcom_helper_datamanager2_type_image |
|
178 | 178 | && $datamanager->types[$name]->attachments_info) { |
179 | 179 | $data = $datamanager->types[$name]->attachments_info['main']; |
180 | 180 | $filename = "{$article->name}/{$data['filename']}"; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | private function _populate_node_toolbar() |
27 | 27 | { |
28 | 28 | $buttons = array(); |
29 | - if ( $this->_topic->can_do('midgard:update') |
|
29 | + if ($this->_topic->can_do('midgard:update') |
|
30 | 30 | && $this->_topic->can_do('midcom:component_config')) { |
31 | 31 | $workflow = $this->get_workflow('datamanager2'); |
32 | 32 | $buttons[] = $workflow->get_button('config/', array( |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png', |
35 | 35 | )); |
36 | 36 | } |
37 | - if ( $this->_topic->can_do('midgard:update') |
|
37 | + if ($this->_topic->can_do('midgard:update') |
|
38 | 38 | && $this->_topic->can_do('net.nehmer.comments:moderation')) { |
39 | 39 | $buttons[] = array( |
40 | 40 | MIDCOM_TOOLBAR_URL => 'moderate/reported_abuse/', |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $toolbar = new midcom_helper_toolbar(); |
82 | 82 | $buttons = array(); |
83 | - if ( midcom::get()->auth->user |
|
83 | + if (midcom::get()->auth->user |
|
84 | 84 | && $comment->status < net_nehmer_comments_comment::MODERATED) { |
85 | 85 | if (!$comment->can_do('net.nehmer.comments:moderation')) { |
86 | 86 | // Regular users can only report abuse |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | if (!$this->_schemadb) { |
95 | 95 | $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb')); |
96 | 96 | |
97 | - if ( $this->_config->get('use_captcha') |
|
98 | - || ( !midcom::get()->auth->user |
|
97 | + if ($this->_config->get('use_captcha') |
|
98 | + || (!midcom::get()->auth->user |
|
99 | 99 | && $this->_config->get('use_captcha_if_anonymous'))) { |
100 | 100 | $this->_schemadb['comment']->append_field( |
101 | 101 | 'captcha', |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
112 | - if ( $this->_config->get('ratings_enable') |
|
112 | + if ($this->_config->get('ratings_enable') |
|
113 | 113 | && array_key_exists('rating', $this->_schemadb['comment']->fields)) { |
114 | 114 | $this->_schemadb['comment']->fields['rating']['hidden'] = false; |
115 | 115 | } |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | } |
130 | 130 | |
131 | 131 | $this->_post_controller = midcom_helper_datamanager2_controller::create('create'); |
132 | - $this->_post_controller->schemadb =& $this->_schemadb; |
|
132 | + $this->_post_controller->schemadb = & $this->_schemadb; |
|
133 | 133 | $this->_post_controller->schema = 'comment'; |
134 | 134 | $this->_post_controller->defaults = $defaults; |
135 | - $this->_post_controller->callback_object =& $this; |
|
135 | + $this->_post_controller->callback_object = & $this; |
|
136 | 136 | |
137 | 137 | if (!$this->_post_controller->initialize()) { |
138 | 138 | throw new midcom_error('Failed to initialize a DM2 create controller.'); |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | |
167 | 167 | if (!$this->_new_comment->create()) { |
168 | 168 | debug_print_r('We operated on this object:', $this->_new_comment); |
169 | - throw new midcom_error('Failed to create a new comment, cannot continue. Last Midgard error was: '. midcom_connection::get_error_string()); |
|
169 | + throw new midcom_error('Failed to create a new comment, cannot continue. Last Midgard error was: ' . midcom_connection::get_error_string()); |
|
170 | 170 | } |
171 | 171 | |
172 | - if ( isset($_POST['subscribe']) |
|
172 | + if (isset($_POST['subscribe']) |
|
173 | 173 | && midcom::get()->auth->user) { |
174 | 174 | // User wants to subscribe to receive notifications about this comments thread |
175 | 175 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $this->_comments = $this->_comments->execute(); |
231 | 231 | } |
232 | 232 | |
233 | - if ( midcom::get()->auth->user |
|
233 | + if (midcom::get()->auth->user |
|
234 | 234 | || $this->_config->get('allow_anonymous')) { |
235 | 235 | $this->_init_post_controller(); |
236 | 236 | $this->_process_post(); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | $this->_init_display_datamanager(); |
241 | 241 | } |
242 | 242 | |
243 | - if ( $handler_id == 'view-comments-custom' |
|
243 | + if ($handler_id == 'view-comments-custom' |
|
244 | 244 | && count($args) > 1) { |
245 | 245 | midcom::get()->skip_page_style = true; |
246 | 246 | $this->custom_view = $args[1]; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $this->_prepare_request_data(); |
250 | 250 | midcom::get()->metadata->set_request_metadata($this->_get_last_modified(), $this->_objectguid); |
251 | 251 | |
252 | - if ( isset($_SERVER['HTTP_X_REQUESTED_WITH']) |
|
252 | + if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) |
|
253 | 253 | && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { |
254 | 254 | midcom::get()->skip_page_style = true; |
255 | 255 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | private function _process_post() |
286 | 286 | { |
287 | - if ( !midcom::get()->auth->user |
|
287 | + if (!midcom::get()->auth->user |
|
288 | 288 | && !midcom::get()->auth->request_sudo('net.nehmer.comments')) { |
289 | 289 | throw new midcom_error('We were anonymous but could not acquire SUDO privileges, aborting'); |
290 | 290 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | */ |
315 | 315 | private function _get_last_modified() |
316 | 316 | { |
317 | - return array_reduce($this->_comments, function ($carry, net_nehmer_comments_comment $item) { |
|
317 | + return array_reduce($this->_comments, function($carry, net_nehmer_comments_comment $item) { |
|
318 | 318 | return max($item->metadata->revised, $carry); |
319 | 319 | }, 0); |
320 | 320 | } |
@@ -346,8 +346,8 @@ discard block |
||
346 | 346 | $data['comment_toolbar'] = $this->_master->_populate_post_toolbar($comment); |
347 | 347 | midcom_show_style('comments-item'); |
348 | 348 | |
349 | - if ( midcom::get()->auth->admin |
|
350 | - || ( midcom::get()->auth->user |
|
349 | + if (midcom::get()->auth->admin |
|
350 | + || (midcom::get()->auth->user |
|
351 | 351 | && $comment->can_do('midgard:delete'))) { |
352 | 352 | midcom_show_style('comments-admintoolbar'); |
353 | 353 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | midcom_show_style('comments-nonefound'); |
358 | 358 | } |
359 | 359 | |
360 | - if ( midcom::get()->auth->user |
|
360 | + if (midcom::get()->auth->user |
|
361 | 361 | || $this->_config->get('allow_anonymous')) { |
362 | 362 | midcom_show_style('post-comment'); |
363 | 363 | } else { |