Completed
Pull Request — master (#198)
by
unknown
19:02
created
src/midcom/datamanager/extension/transformer/jsdateTransformer.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         }
Please login to merge, or discard this patch.
lib/net/nehmer/blog/viewer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
             net_nemein_rss_manage::add_toolbar_buttons($this->_node_toolbar, $this->_topic->can_do('midgard:create'));
93 93
         }
94 94
 
95
-        if (   $this->_topic->can_do('midgard:update')
95
+        if ($this->_topic->can_do('midgard:update')
96 96
             && $this->_topic->can_do('midcom:component_config')) {
97 97
             $buttons[] = $workflow->get_button('config/', [
98 98
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'),
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
         $this->_request_data['categories'] = explode(',', $this->_config->get('categories'));
127 127
 
128 128
         foreach ($this->_request_data['schemadb']->all() as $schema) {
129
-            if (   $schema->has_field('categories')
129
+            if ($schema->has_field('categories')
130 130
                 && $schema->get_field('categories')['type'] == 'select') {
131 131
                 // TODO: Merge schema local and component config categories?
132 132
                 $options = array_combine($this->_request_data['categories'], $this->_request_data['categories']);
133
-                $field =& $schema->get_field('categories');
133
+                $field = & $schema->get_field('categories');
134 134
                 $field['type_config']['options'] = $options;
135 135
             }
136 136
         }
Please login to merge, or discard this patch.
lib/midcom/core/privilege.php 3 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,6 @@
 block discarded – undo
37 37
                 - 1: MIDCOM_PRIVILEGE_ALLOW
38 38
                 - 2: MIDCOM_PRIVILEGE_DENY
39 39
                 - 3: MIDCOM_PRIVILEGE_INHERIT
40
-
41 40
  * @property string $guid
42 41
  * @package midcom
43 42
  */
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
      */
247 247
     public function set_assignee($assignee)
248 248
     {
249
-        if (   is_a($assignee, midcom_core_user::class)
249
+        if (is_a($assignee, midcom_core_user::class)
250 250
             || is_a($assignee, midcom_core_group::class)) {
251 251
             $this->assignee = $assignee->id;
252 252
         } elseif (is_string($assignee)) {
@@ -304,12 +304,12 @@  discard block
 block discarded – undo
304 304
             }
305 305
         }
306 306
 
307
-        if (   !$this->is_magic_assignee()
307
+        if (!$this->is_magic_assignee()
308 308
             && !$this->get_assignee()) {
309 309
             debug_add("The assignee identifier '{$this->assignee}' is invalid.", MIDCOM_LOG_INFO);
310 310
             return false;
311 311
         }
312
-        if (   $this->assignee == 'OWNER'
312
+        if ($this->assignee == 'OWNER'
313 313
             && $this->privilegename == 'midgard:owner') {
314 314
             debug_add("Tried to assign midgard:owner to the OWNER magic assignee, this is invalid.", MIDCOM_LOG_INFO);
315 315
             return false;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
                 MIDCOM_LOG_INFO);
322 322
             return false;
323 323
         }
324
-        if (   !$object->can_do('midgard:update')
324
+        if (!$object->can_do('midgard:update')
325 325
             || !$object->can_do('midgard:privileges')) {
326 326
             debug_add("Insufficient privileges on the content object with the GUID '{$this->__guid}', midgard:update and midgard:privileges required.",
327 327
                 MIDCOM_LOG_INFO);
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,8 @@
 block discarded – undo
128 128
         if ($this->__cached_object === null) {
129 129
             try {
130 130
                 $this->__cached_object = midcom::get()->dbfactory->get_object_by_guid($this->objectguid);
131
-            } catch (midcom_error $e) {
131
+            }
132
+            catch (midcom_error $e) {
132 133
                 return false;
133 134
             }
134 135
         }
Please login to merge, or discard this patch.
lib/midcom/services/auth/acl.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -600,10 +600,10 @@  discard block
 block discarded – undo
600 600
         }
601 601
 
602 602
         //owner privileges override everything but person privileges, so we have to cross-check those here
603
-        if (   $privilegename != 'midgard:owner'
603
+        if ($privilegename != 'midgard:owner'
604 604
             && $last_scope < MIDCOM_PRIVILEGE_SCOPE_OWNER) {
605 605
             $owner_privileges = $this->get_owner_default_privileges();
606
-            if (    array_key_exists($privilegename, $owner_privileges)
606
+            if (array_key_exists($privilegename, $owner_privileges)
607 607
                  && $this->_load_content_privilege('midgard:owner', $guid, $class, $user_id)
608 608
                  && self::$_content_privileges_cache[$cache_id]['midgard:owner']) {
609 609
                 self::$_content_privileges_cache[$cache_id][$privilegename] = ($owner_privileges[$privilegename] == MIDCOM_PRIVILEGE_ALLOW);
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
         //if nothing was found, we try to recurse to parent
620 620
         list ($parent_guid, $parent_class) = $this->get_parent_data($guid, $class);
621 621
 
622
-        if (   $parent_guid == $guid
622
+        if ($parent_guid == $guid
623 623
             || !mgd_is_guid($parent_guid)) {
624 624
             return false;
625 625
         }
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -269,17 +269,17 @@
 block discarded – undo
269 269
     private static $_default_magic_class_privileges = [];
270 270
 
271 271
     /**
272
-    * Internal cache of the content privileges of users on content objects, this is
273
-    * an associative array using a combination of the user identifier and the object's
274
-    * guid as index. The privileges for the anonymous user use the magic
275
-    * EVERYONE as user identifier.
276
-    *
277
-    * This must not be merged with the class-wide privileges_cache, because otherwise
278
-    * class_default_privileges for child objects might be overridden by parent default
279
-    * privileges
280
-    *
281
-    * @var Array
282
-    */
272
+     * Internal cache of the content privileges of users on content objects, this is
273
+     * an associative array using a combination of the user identifier and the object's
274
+     * guid as index. The privileges for the anonymous user use the magic
275
+     * EVERYONE as user identifier.
276
+     *
277
+     * This must not be merged with the class-wide privileges_cache, because otherwise
278
+     * class_default_privileges for child objects might be overridden by parent default
279
+     * privileges
280
+     *
281
+     * @var Array
282
+     */
283 283
     private static $_content_privileges_cache = [];
284 284
 
285 285
     /**
Please login to merge, or discard this patch.
src/midcom/datamanager/extension/subscriber/purifySubscriber.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function purify_content(FormEvent $event)
42 42
     {
43
-        if (   isset($this->config['Cache']['SerializerPath'])
43
+        if (isset($this->config['Cache']['SerializerPath'])
44 44
             && !file_exists($this->config['Cache']['SerializerPath'])) {
45 45
             mkdir($this->config['Cache']['SerializerPath']);
46 46
         }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
         // Load custom element/attribute definitions
56 56
         $definitions = $this->get_from_global_config('html_purify_HTMLDefinition');
57
-        if (   !empty($definitions)
57
+        if (!empty($definitions)
58 58
             && $def = $purifier_config->maybeGetRawHTMLDefinition()) {
59 59
             if (!empty($definitions['addAttribute'])) {
60 60
                 foreach (array_filter((array) $definitions['addAttribute'], 'is_array') as $attrdef) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -72,7 +72,8 @@
 block discarded – undo
72 72
         $data = $event->getData();
73 73
         try {
74 74
             $data = $purifier->purify($data);
75
-        } catch (\Exception $e) {
75
+        }
76
+        catch (\Exception $e) {
76 77
             debug_add("HTML Purifier failed: " . $e->getMessage(), MIDCOM_LOG_WARN);
77 78
         }
78 79
         $event->setData($data);
Please login to merge, or discard this patch.
src/midcom/datamanager/extension/type/autocompleteType.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -132,7 +132,8 @@
 block discarded – undo
132 132
                 try {
133 133
                     $object = call_user_func([$options['widget_config']['class'], 'get_cached'], $identifier);
134 134
                     $preset[$identifier] = autocomplete_helper::create_item_label($object, $options['widget_config']['result_headers'], $options['widget_config']['titlefield']);
135
-                } catch (midcom_error $e) {
135
+                }
136
+                catch (midcom_error $e) {
136 137
                     $e->log();
137 138
                 }
138 139
             }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public function configureOptions(OptionsResolver $resolver)
35 35
     {
36 36
         $resolver->setDefault('error_bubbling', false);
37
-        $resolver->setNormalizer('widget_config', function (Options $options, $value) {
37
+        $resolver->setNormalizer('widget_config', function(Options $options, $value) {
38 38
             $widget_defaults = [
39 39
                 'creation_mode_enabled' => false,
40 40
                 'class' => null,
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
             return helper::normalize($widget_defaults, $value);
68 68
         });
69
-        $resolver->setNormalizer('type_config', function (Options $options, $value) {
69
+        $resolver->setNormalizer('type_config', function(Options $options, $value) {
70 70
             $type_defaults = [
71 71
                 'options' => [],
72 72
                 'method' => 'GET',
Please login to merge, or discard this patch.
lib/org/openpsa/documents/elFinderVolumeOpenpsa.php 2 patches
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -85,7 +85,8 @@  discard block
 block discarded – undo
85 85
 
86 86
         $this->clearcache();
87 87
 
88
-        if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem
88
+        if ($file && $file['name'] === $name) {
89
+// file exists and check filename for item ID based filesystem
89 90
             if ($this->uploadOverwrite) {
90 91
                 if (!$file['write']) {
91 92
                     return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -142,11 +143,13 @@  discard block
 block discarded – undo
142 143
     {
143 144
         try {
144 145
             return org_openpsa_documents_document_dba::get_cached($path);
145
-        } catch (midcom_error $e) {
146
+        }
147
+        catch (midcom_error $e) {
146 148
             $e->log();
147 149
             try {
148 150
                 return org_openpsa_documents_directory::get_cached($path);
149
-            } catch (midcom_error $e) {
151
+            }
152
+            catch (midcom_error $e) {
150 153
                 $e->log();
151 154
             }
152 155
         }
@@ -282,7 +285,8 @@  discard block
 block discarded – undo
282 285
         $object = midcom::get()->dbfactory->get_object_by_guid($path);
283 286
         try {
284 287
             $parentdir = org_openpsa_documents_directory::get_cached($parent);
285
-        } catch (midcom_error $e) {
288
+        }
289
+        catch (midcom_error $e) {
286 290
             $e->log();
287 291
             return false;
288 292
         }
@@ -579,7 +583,8 @@  discard block
 block discarded – undo
579 583
         try {
580 584
             $doc = new org_openpsa_documents_document_dba($path);
581 585
             return $doc->delete();
582
-        } catch (midcom_error $e) {
586
+        }
587
+        catch (midcom_error $e) {
583 588
             return false;
584 589
         }
585 590
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         }
40 40
 
41 41
         if (($dir = $this->dir($dst)) == false) {
42
-            return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst);
42
+            return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst);
43 43
         }
44 44
 
45 45
         if (!$dir['write']) {
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         $output = [$object->get_label()];
254 254
 
255 255
         $parent = $object->get_parent();
256
-        while (   $parent
256
+        while ($parent
257 257
                && $parent->component == 'org.openpsa.documents') {
258 258
             $output[] = $parent->extra;
259 259
             $parent = $parent->get_parent();
@@ -350,12 +350,12 @@  discard block
 block discarded – undo
350 350
             $data['mime'] = 'directory';
351 351
         }
352 352
 
353
-        if (   $owner
353
+        if ($owner
354 354
             && $group = midcom::get()->auth->get_assignee($owner)) {
355 355
             $data['group'] = $group->name;
356 356
         }
357 357
 
358
-        if (   $this->root !== $path
358
+        if ($this->root !== $path
359 359
             && $parent = $object->get_parent()) {
360 360
             $data['phash'] = $this->encode($parent->guid);
361 361
         }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
      * @param  string $mode open mode
415 415
      * @return resource|false
416 416
      */
417
-    protected function _fopen($path, $mode="rb")
417
+    protected function _fopen($path, $mode = "rb")
418 418
     {
419 419
         $document = org_openpsa_documents_document_dba::get_cached($path);
420 420
         $attachments = org_openpsa_helpers::get_dm2_attachments($document, 'document');
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
      * @param  string    $path  file path
433 433
      * @return bool
434 434
      */
435
-    protected function _fclose($fp, $path='')
435
+    protected function _fclose($fp, $path = '')
436 436
     {
437 437
         fclose($fp);
438 438
         return true;
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
     {
617 617
         $filename = midcom_db_attachment::safe_filename($name, true);
618 618
         $att = $doc->create_attachment($filename, $name, $mimetype);
619
-        if (   !$att
619
+        if (!$att
620 620
             || !$att->copy_from_handle($fp)) {
621 621
             return false;
622 622
         }
Please login to merge, or discard this patch.
lib/midcom/helper/search/handler/search.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
     {
55 55
         $node = $nap->get_node($node_id);
56 56
 
57
-        if (   !array_key_exists($node[MIDCOM_NAV_COMPONENT], $this->_request_data['components'])
57
+        if (!array_key_exists($node[MIDCOM_NAV_COMPONENT], $this->_request_data['components'])
58 58
             && $node[MIDCOM_NAV_COMPONENT] != 'midcom.helper.search') {
59 59
             $l10n = $this->_i18n->get_l10n($node[MIDCOM_NAV_COMPONENT]);
60 60
             $this->_request_data['components'][$node[MIDCOM_NAV_COMPONENT]] = $l10n->get($node[MIDCOM_NAV_COMPONENT]);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
         }
108 108
         $this->prepare_formdata($_REQUEST['type']);
109 109
 
110
-        if (   count(explode(' ', $data['query'])) == 1
110
+        if (count(explode(' ', $data['query'])) == 1
111 111
             && strpos($data['query'], '*') === false
112 112
             && $this->_config->get('single_term_auto_wildcard')) {
113 113
             //If there is only one search term append * to the query if auto_wildcard is enabled
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
             $this->_request_data['last_document_number'] = $last_document_id + 1;
182 182
             $this->_request_data['shown_documents'] = $last_document_id - $first_document_id + 1;
183 183
             $this->_request_data['results_per_page'] = $results_per_page;
184
-            $this->_request_data['all_results'] =& $result;
184
+            $this->_request_data['all_results'] = & $result;
185 185
             $this->_request_data['result'] = array_slice($result, $first_document_id, $results_per_page);
186 186
 
187 187
             // Register GUIDs for cache engine
188 188
             foreach ($this->_request_data['result'] as $doc) {
189
-                if (   !isset($doc->source)
189
+                if (!isset($doc->source)
190 190
                     || !mgd_is_guid($doc->source)) {
191 191
                     // Non-Midgard results don't need to go through cache registration
192 192
                     continue;
Please login to merge, or discard this patch.
lib/midcom/admin/rcs/style/midcom-admin-rcs-diff.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
 
28 28
     $changes = true;
29 29
 
30
-    echo "<dt>". $data['handler']->translate($attribute) ."</dt>\n";
30
+    echo "<dt>" . $data['handler']->translate($attribute) . "</dt>\n";
31 31
     echo "    <dd>\n";
32 32
     echo $values['diff'];
33 33
     echo "    </dd>\n";
34 34
 }
35 35
 
36 36
 if (!$changes) {
37
-    echo "<dt>". $data['l10n']->get('no changes in content') ."</dt>\n";
37
+    echo "<dt>" . $data['l10n']->get('no changes in content') . "</dt>\n";
38 38
 }
39 39
 ?>
40 40
 </dl>
41 41
\ No newline at end of file
Please login to merge, or discard this patch.