@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function set_privilege($privilege, $assignee = null, $value = MIDCOM_PRIVILEGE_ALLOW, $classname = '') |
60 | 60 | { |
61 | - if ( !$this->can_do('midgard:update') |
|
61 | + if (!$this->can_do('midgard:update') |
|
62 | 62 | || !$this->can_do('midgard:privileges')) { |
63 | 63 | debug_add("Failed to set a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
64 | 64 | MIDCOM_LOG_ERROR); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function unset_privilege($privilege, $assignee = null, $classname = '') |
93 | 93 | { |
94 | - if ( !$this->can_do('midgard:update') |
|
94 | + if (!$this->can_do('midgard:update') |
|
95 | 95 | || !$this->can_do('midgard:privileges')) { |
96 | 96 | debug_add("Failed to unset a privilege, midgard:update or midgard:privileges on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
97 | 97 | MIDCOM_LOG_ERROR); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if ( !$this->can_do('midgard:update') |
219 | 219 | || !$this->can_do('midgard:parameters')) { |
220 | 220 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
221 | - MIDCOM_LOG_ERROR); |
|
221 | + MIDCOM_LOG_ERROR); |
|
222 | 222 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
223 | 223 | return false; |
224 | 224 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if ( !$this->can_do('midgard:update') |
272 | 272 | || !$this->can_do('midgard:parameters')) { |
273 | 273 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
274 | - MIDCOM_LOG_ERROR); |
|
274 | + MIDCOM_LOG_ERROR); |
|
275 | 275 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
276 | 276 | return false; |
277 | 277 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | debug_add('Cannot set parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
206 | 206 | return false; |
207 | 207 | } |
208 | - if ( empty($domain) |
|
208 | + if (empty($domain) |
|
209 | 209 | || empty($name) |
210 | 210 | || !is_string($domain) |
211 | 211 | || !is_string($name)) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | - if ( !$this->can_do('midgard:update') |
|
218 | + if (!$this->can_do('midgard:update') |
|
219 | 219 | || !$this->can_do('midgard:parameters')) { |
220 | 220 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
221 | 221 | MIDCOM_LOG_ERROR); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | debug_add('Cannot delete parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
259 | 259 | return false; |
260 | 260 | } |
261 | - if ( empty($domain) |
|
261 | + if (empty($domain) |
|
262 | 262 | || empty($name) |
263 | 263 | || !is_string($domain) |
264 | 264 | || !is_string($name)) { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | |
271 | - if ( !$this->can_do('midgard:update') |
|
271 | + if (!$this->can_do('midgard:update') |
|
272 | 272 | || !$this->can_do('midgard:parameters')) { |
273 | 273 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
274 | 274 | MIDCOM_LOG_ERROR); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | - if ( !$this->can_do('midgard:update') |
|
66 | + if (!$this->can_do('midgard:update') |
|
67 | 67 | || !$this->can_do('midgard:attachments')) { |
68 | 68 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
69 | 69 | MIDCOM_LOG_ERROR); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return false; |
89 | 89 | } |
90 | 90 | |
91 | - if ( !$this->can_do('midgard:update') |
|
91 | + if (!$this->can_do('midgard:update') |
|
92 | 92 | || !$this->can_do('midgard:attachments')) { |
93 | 93 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
94 | 94 | MIDCOM_LOG_ERROR); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $attachment->parentguid = $this->guid; |
103 | 103 | |
104 | 104 | if (!$attachment->create()) { |
105 | - debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
105 | + debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
106 | 106 | MIDCOM_LOG_INFO); |
107 | 107 | return false; |
108 | 108 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | } |
34 | 34 | } |
35 | 35 | |
36 | - if ( empty($input) |
|
37 | - || ( $input instanceof DateTime |
|
36 | + if (empty($input) |
|
37 | + || ($input instanceof DateTime |
|
38 | 38 | && $input->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) { |
39 | 39 | return $result; |
40 | 40 | } |
@@ -59,8 +59,8 @@ discard block |
||
59 | 59 | throw new TransformationFailedException('Expected an array.'); |
60 | 60 | } |
61 | 61 | |
62 | - if ( empty($array['date']) |
|
63 | - || ( $array['date'] instanceof DateTime |
|
62 | + if (empty($array['date']) |
|
63 | + || ($array['date'] instanceof DateTime |
|
64 | 64 | && $array['date']->format('Y-m-d H:i:s') == '0001-01-01 00:00:00')) { |
65 | 65 | return; |
66 | 66 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $this->_request_switch[$key]['handler'] = [&$this, $value['handler']]; |
417 | 417 | } |
418 | 418 | |
419 | - if ( !array_key_exists('expires', $value) |
|
419 | + if (!array_key_exists('expires', $value) |
|
420 | 420 | || !is_integer($value['expires']) |
421 | 421 | || $value['expires'] < -1) { |
422 | 422 | $this->_request_switch[$key]['expires'] = -1; |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | // Check if we need to start up a plugin. |
449 | - if ( count($argv) > 1 |
|
449 | + if (count($argv) > 1 |
|
450 | 450 | && array_key_exists($argv[0], self::$_plugin_namespace_config) |
451 | 451 | && array_key_exists($argv[1], self::$_plugin_namespace_config[$argv[0]])) { |
452 | 452 | $namespace = $argv[0]; |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | continue; |
463 | 463 | } |
464 | 464 | $fixed_args_count = count($request['fixed_args']); |
465 | - $this->_handler =& $this->_request_switch[$key]; |
|
465 | + $this->_handler = & $this->_request_switch[$key]; |
|
466 | 466 | |
467 | 467 | $this->_handler['id'] = $key; |
468 | 468 | $this->_handler['args'] = array_slice($argv, $fixed_args_count); |
@@ -471,10 +471,10 @@ discard block |
||
471 | 471 | $this->_prepare_handler(); |
472 | 472 | |
473 | 473 | // If applicable, run the _can_handle check for the handler in question. |
474 | - $handler =& $this->_handler['handler'][0]; |
|
474 | + $handler = & $this->_handler['handler'][0]; |
|
475 | 475 | $method = "_can_handle_{$this->_handler['handler'][1]}"; |
476 | 476 | |
477 | - if ( method_exists($handler, $method) |
|
477 | + if (method_exists($handler, $method) |
|
478 | 478 | && !$handler->$method($this->_handler['id'], $this->_handler['args'], $this->_request_data)) { |
479 | 479 | // This can_handle failed, allow next one to take over if there is one |
480 | 480 | continue; |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $variable_args_count = $request['variable_args']; |
492 | 492 | $total_args_count = $fixed_args_count + $variable_args_count; |
493 | 493 | |
494 | - if ( (count($argv) != $total_args_count && ($variable_args_count >= 0)) |
|
494 | + if ((count($argv) != $total_args_count && ($variable_args_count >= 0)) |
|
495 | 495 | || $fixed_args_count > count($argv)) { |
496 | 496 | return false; |
497 | 497 | } |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | $success = false; |
512 | 512 | foreach ($request['validation'][$i] as $rule) { |
513 | 513 | // rule is a callable function, like mgd_is_guid or is_int |
514 | - if ( is_callable($rule) |
|
514 | + if (is_callable($rule) |
|
515 | 515 | && $success = call_user_func($rule, $param)) { |
516 | 516 | break; |
517 | 517 | } |
@@ -200,7 +200,7 @@ |
||
200 | 200 | */ |
201 | 201 | public function can_handle($current_object, array $argv, $contextid) |
202 | 202 | { |
203 | - $data =& $this->_context_data[$contextid]; |
|
203 | + $data = & $this->_context_data[$contextid]; |
|
204 | 204 | $loader = midcom::get()->componentloader; |
205 | 205 | $class = $loader->path_to_prefix($this->_component) . '_' . $this->_site_class_suffix; |
206 | 206 | $data['handler'] = new $class($current_object, $data['config']); |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | { |
28 | 28 | parent::configureOptions($resolver); |
29 | 29 | |
30 | - $map_options = function (Options $options) { |
|
30 | + $map_options = function(Options $options) { |
|
31 | 31 | $return_options = []; |
32 | 32 | if (!empty($options['type_config']['options'])) { |
33 | 33 | foreach ($options['type_config']['options'] as $key => $value) { |
34 | 34 | //symfony expects only strings |
35 | - $return_options[(string)$value] = (string)$key; |
|
35 | + $return_options[(string) $value] = (string) $key; |
|
36 | 36 | } |
37 | 37 | } elseif (isset($options['type_config']['option_callback'])) { |
38 | 38 | $classname = $options['type_config']['option_callback']; |
@@ -40,13 +40,13 @@ discard block |
||
40 | 40 | $callback = new $classname($options['type_config']['option_callback_arg']); |
41 | 41 | foreach ($callback->list_all() as $key => $value) { |
42 | 42 | //symfony expects only strings |
43 | - $return_options[(string)$value] = (string)$key; |
|
43 | + $return_options[(string) $value] = (string) $key; |
|
44 | 44 | } |
45 | 45 | } |
46 | 46 | return $return_options; |
47 | 47 | }; |
48 | 48 | |
49 | - $map_multiple = function (Options $options) { |
|
49 | + $map_multiple = function(Options $options) { |
|
50 | 50 | return !empty($options['type_config']['allow_multiple']); |
51 | 51 | }; |
52 | 52 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'placeholder' => false |
58 | 58 | ]); |
59 | 59 | |
60 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
60 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
61 | 61 | $type_defaults = [ |
62 | 62 | 'options' => [], |
63 | 63 | 'option_callback' => null, |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ]; |
71 | 71 | return helper::resolve_options($type_defaults, $value); |
72 | 72 | }); |
73 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
73 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
74 | 74 | $widget_defaults = [ |
75 | 75 | 'height' => 6, |
76 | 76 | 'jsevents' => [] |
@@ -25,24 +25,24 @@ discard block |
||
25 | 25 | public function configureOptions(OptionsResolver $resolver) |
26 | 26 | { |
27 | 27 | parent::configureOptions($resolver); |
28 | - $map_options = function (Options $options) { |
|
28 | + $map_options = function(Options $options) { |
|
29 | 29 | $return_options = []; |
30 | 30 | if (!empty($options['type_config']['options'])) { |
31 | 31 | foreach ($options['type_config']['options'] as $key => $value) { |
32 | 32 | //symfony expects only strings |
33 | - $return_options[(string)$value] = (string)$key; |
|
33 | + $return_options[(string) $value] = (string) $key; |
|
34 | 34 | } |
35 | 35 | } elseif (isset($options['type_config']['option_callback'])) { |
36 | 36 | $classname = $options['type_config']['option_callback']; |
37 | 37 | $callback = new $classname($options['type_config']['option_callback_arg']); |
38 | 38 | foreach ($callback->list_all() as $key => $value) { |
39 | 39 | //symfony expects only strings |
40 | - $return_options[(string)$value] = (string)$key; |
|
40 | + $return_options[(string) $value] = (string) $key; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | return $return_options; |
44 | 44 | }; |
45 | - $map_multiple = function (Options $options) { |
|
45 | + $map_multiple = function(Options $options) { |
|
46 | 46 | return !empty($options['type_config']['allow_multiple']); |
47 | 47 | }; |
48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'placeholder' => false |
55 | 55 | ]); |
56 | 56 | |
57 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
57 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
58 | 58 | $type_defaults = [ |
59 | 59 | 'options' => [], |
60 | 60 | 'option_callback' => null, |
@@ -114,7 +114,7 @@ |
||
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | // No topics matching path, check for attachments |
117 | - $att_qb = midcom_db_attachment::new_query_builder(); |
|
117 | + $att_qb = midcom_db_attachment::new_query_builder(); |
|
118 | 118 | $att_qb->add_constraint('name', '=', $this->argv[0]); |
119 | 119 | $att_qb->add_constraint('parentguid', '=', $this->get_current_object()->guid); |
120 | 120 | if ($att_qb->count() == 0) { |