Completed
Branch master (e8947e)
by Andreas
15:09
created
lib/net/nemein/wiki/parser.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@
 block discarded – undo
58 58
                 $value = "<a href=\"{$prefix}__mfa/asgard_midcom.admin.user/group/edit/{$group->guid}/\">{$value}</a>";
59 59
             }
60 60
             $groups[] = $value;
61
-        }
62
-        catch (midcom_error $e)
61
+        } catch (midcom_error $e)
63 62
         {
64 63
             $groups[] = "#{$member->gid}";
65 64
         }
Please login to merge, or discard this patch.
lib/midcom/helper/metadata.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 
219 219
         $object_schema = self::find_schemaname($this->_schemadb, $this->__object);
220 220
         $this->_datamanager->set_schema($object_schema);
221
-        if (! $this->_datamanager->set_storage($this->__object))
221
+        if (!$this->_datamanager->set_storage($this->__object))
222 222
         {
223 223
             throw new midcom_error('Failed to initialize the metadata datamanager instance, see the Debug Log for details.');
224 224
         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
         // Check if we have metadata schema defined in the schemadb specific for the object's schema or component
237 237
         $object_schema = $object->get_parameter('midcom.helper.datamanager2', 'schema_name');
238 238
         $component_schema = str_replace('.', '_', midcom_core_context::get()->get_key(MIDCOM_CONTEXT_COMPONENT));
239
-        if (   $object_schema == ''
239
+        if ($object_schema == ''
240 240
             || !isset($schemadb[$object_schema]))
241 241
         {
242 242
             if (isset($schemadb[$component_schema]))
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
     function release_datamanager()
257 257
     {
258
-        if (! is_null($this->_datamanager))
258
+        if (!is_null($this->_datamanager))
259 259
         {
260 260
             $this->_datamanager = null;
261 261
         }
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
             case 'scheduleend':
483 483
             case 'exported':
484 484
             case 'imported':
485
-                if (   !extension_loaded('midgard')
485
+                if (!extension_loaded('midgard')
486 486
                     && isset($this->__metadata->$key))
487 487
                 {
488 488
                     //This is ugly, but seems the only possible way...
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                         $value = (int) $this->__metadata->$key->format('U');
496 496
                     }
497 497
                 }
498
-                else if (   empty($this->__metadata->$key)
498
+                else if (empty($this->__metadata->$key)
499 499
                          || $this->__metadata->$key == '0000-00-00 00:00:00')
500 500
                 {
501 501
                     $value = 0;
@@ -594,12 +594,12 @@  discard block
 block discarded – undo
594 594
         }
595 595
 
596 596
         $now = time();
597
-        if (   $this->get('schedulestart')
597
+        if ($this->get('schedulestart')
598 598
             && $this->get('schedulestart') > $now)
599 599
         {
600 600
             return false;
601 601
         }
602
-        if (   $this->get('scheduleend')
602
+        if ($this->get('scheduleend')
603 603
             && $this->get('scheduleend') < $now)
604 604
         {
605 605
             return false;
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
     function is_object_visible_onsite()
619 619
     {
620 620
         return
621
-        (   (   midcom::get()->config->get('show_hidden_objects')
621
+        ((midcom::get()->config->get('show_hidden_objects')
622 622
              || $this->is_visible())
623
-         && (   midcom::get()->config->get('show_unapproved_objects')
623
+         && (midcom::get()->config->get('show_unapproved_objects')
624 624
              || $this->is_approved())
625 625
         );
626 626
     }
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
         }
715 715
         else if (is_array($source))
716 716
         {
717
-            if (   !array_key_exists(MIDCOM_NAV_GUID, $source)
717
+            if (!array_key_exists(MIDCOM_NAV_GUID, $source)
718 718
                 || is_null($source[MIDCOM_NAV_GUID]))
719 719
             {
720 720
                 debug_print_r('We got an invalid input, cannot return metadata:', $source);
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
             $guid = $source;
729 729
         }
730 730
 
731
-        if (   is_null($object)
731
+        if (is_null($object)
732 732
             && mgd_is_guid($guid))
733 733
         {
734 734
             try
@@ -769,7 +769,7 @@  discard block
 block discarded – undo
769 769
         }
770 770
 
771 771
         // Lock was created by the user, return "not locked"
772
-        if (   !empty(midcom::get()->auth->user->guid)
772
+        if (!empty(midcom::get()->auth->user->guid)
773 773
             && $this->get('locker') === midcom::get()->auth->user->guid)
774 774
         {
775 775
             return false;
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
             $timeout = midcom::get()->config->get('metadata_lock_timeout');
795 795
         }
796 796
 
797
-        if (   is_object($this->__object)
797
+        if (is_object($this->__object)
798 798
             && $this->__object->lock())
799 799
         {
800 800
             $this->_cache = array();
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
      */
813 813
     function can_unlock()
814 814
     {
815
-        return (   $this->__object->can_do('midcom:unlock')
815
+        return ($this->__object->can_do('midcom:unlock')
816 816
                 || midcom::get()->auth->can_user_do('midcom:unlock', null, 'midcom_services_auth', 'midcom'));
817 817
     }
818 818
 
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
      */
824 824
     public function unlock()
825 825
     {
826
-        if (   $this->can_unlock()
826
+        if ($this->can_unlock()
827 827
             && is_object($this->__object)
828 828
             && $this->__object->unlock())
829 829
         {
Please login to merge, or discard this patch.
Braces   +12 added lines, -24 removed lines patch added patch discarded remove patch
@@ -243,8 +243,7 @@  discard block
 block discarded – undo
243 243
             {
244 244
                 // No specific metadata schema for object, fall back to component-specific metadata schema
245 245
                 $object_schema = $component_schema;
246
-            }
247
-            else
246
+            } else
248 247
             {
249 248
                 // No metadata schema for component, fall back to default
250 249
                 $object_schema = 'metadata';
@@ -379,8 +378,7 @@  discard block
 block discarded – undo
379 378
                 if ($value == 0)
380 379
                 {
381 380
                     $value = '0000-00-00 00:00:00';
382
-                }
383
-                else
381
+                } else
384 382
                 {
385 383
                     $value = gmstrftime('%Y-%m-%d %T', $value);
386 384
                 }
@@ -389,8 +387,7 @@  discard block
 block discarded – undo
389 387
                     if ($value == '0000-00-00 00:00:00')
390 388
                     {
391 389
                         $value = null;
392
-                    }
393
-                    else
390
+                    } else
394 391
                     {
395 392
                         $value = new midgard_datetime($value);
396 393
                     }
@@ -437,8 +434,7 @@  discard block
 block discarded – undo
437 434
         if ($key)
438 435
         {
439 436
             unset ($this->_cache[$key]);
440
-        }
441
-        else
437
+        } else
442 438
         {
443 439
             $this->_cache = Array();
444 440
         }
@@ -489,18 +485,15 @@  discard block
 block discarded – undo
489 485
                     if ((string) $this->__metadata->$key === "0001-01-01T00:00:00+00:00")
490 486
                     {
491 487
                         $value = 0;
492
-                    }
493
-                    else
488
+                    } else
494 489
                     {
495 490
                         $value = (int) $this->__metadata->$key->format('U');
496 491
                     }
497
-                }
498
-                else if (   empty($this->__metadata->$key)
492
+                } else if (   empty($this->__metadata->$key)
499 493
                          || $this->__metadata->$key == '0000-00-00 00:00:00')
500 494
                 {
501 495
                     $value = 0;
502
-                }
503
-                else
496
+                } else
504 497
                 {
505 498
                     $value = strtotime("{$this->__metadata->$key} UTC");
506 499
                 }
@@ -525,8 +518,7 @@  discard block
 block discarded – undo
525 518
                         if (empty($guids))
526 519
                         {
527 520
                             $root_user_guid = 'f6b665f1984503790ed91f39b11b5392';
528
-                        }
529
-                        else
521
+                        } else
530 522
                         {
531 523
                             $root_user_guid = key($guids);
532 524
                         }
@@ -555,8 +547,7 @@  discard block
 block discarded – undo
555 547
                 {
556 548
                     // Fall back to the parameter reader for non-core MidCOM metadata params
557 549
                     $value = $this->__object->get_parameter('midcom.helper.metadata', $key);
558
-                }
559
-                else
550
+                } else
560 551
                 {
561 552
                     $value = $dm->types[$key]->convert_to_csv();
562 553
                 }
@@ -711,8 +702,7 @@  discard block
 block discarded – undo
711 702
         {
712 703
             $object = $source;
713 704
             $guid = $source->guid;
714
-        }
715
-        else if (is_array($source))
705
+        } else if (is_array($source))
716 706
         {
717 707
             if (   !array_key_exists(MIDCOM_NAV_GUID, $source)
718 708
                 || is_null($source[MIDCOM_NAV_GUID]))
@@ -722,8 +712,7 @@  discard block
 block discarded – undo
722 712
             }
723 713
             $guid = $source[MIDCOM_NAV_GUID];
724 714
             $object = $source[MIDCOM_NAV_OBJECT];
725
-        }
726
-        else
715
+        } else
727 716
         {
728 717
             $guid = $source;
729 718
         }
@@ -734,8 +723,7 @@  discard block
 block discarded – undo
734 723
             try
735 724
             {
736 725
                 $object = midcom::get()->dbfactory->get_object_by_guid($guid);
737
-            }
738
-            catch (midcom_error $e)
726
+            } catch (midcom_error $e)
739 727
             {
740 728
                 debug_add("Failed to create a metadata instance for the GUID {$guid}: " . $e->getMessage(), MIDCOM_LOG_WARN);
741 729
                 debug_print_r("Source was:", $source);
Please login to merge, or discard this patch.
lib/midcom/helper/imagepopup/handler/upload.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,10 +26,10 @@  discard block
 block discarded – undo
26 26
         reset($_FILES);
27 27
         $temp = array_shift($_FILES);
28 28
 
29
-        if(is_uploaded_file($temp['tmp_name']))
29
+        if (is_uploaded_file($temp['tmp_name']))
30 30
         {
31 31
             // Verify file extension
32
-            if(!in_array(strtolower(pathinfo($temp['name'], PATHINFO_EXTENSION)), array("gif", "jpg", "png")))
32
+            if (!in_array(strtolower(pathinfo($temp['name'], PATHINFO_EXTENSION)), array("gif", "jpg", "png")))
33 33
             {
34 34
                 throw new midcom_error('Invalid extension.');
35 35
             }
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
         $query->add_constraint('parentguid', '=', $parentguid);
94 94
         $entry = $query->execute();
95 95
 
96
-        if(count($entry) == 0)
96
+        if (count($entry) == 0)
97 97
         {
98 98
             throw new midcom_error_notfound("There is no match in database " . midcom_connection::get_error_string());
99 99
         }
100
-        else if(count($entry) == 1)
100
+        else if (count($entry) == 1)
101 101
         {
102 102
             return $entry[0];
103 103
         }
104
-        else if(count($entry) > 1)
104
+        else if (count($entry) > 1)
105 105
         {
106 106
             throw new midcom_error('There is more than just one object' . midcom_connection::get_error_string());
107 107
         }
@@ -114,13 +114,13 @@  discard block
 block discarded – undo
114 114
     private function write_the_file($tmp, midcom_db_attachment $target)
115 115
     {
116 116
         $source = fopen($tmp, 'r');
117
-        if(!$source)
117
+        if (!$source)
118 118
         {
119 119
             throw new midcom_error("Could not open file " . $tmp . " for reading.");
120 120
         }
121 121
         $stat = $target->copy_from_handle($source);
122 122
         fclose($source);
123
-        if(!$stat)
123
+        if (!$stat)
124 124
         {
125 125
             throw new midcom_error('Failed to copy from handle: ' . midcom_connection::get_error_string());
126 126
         }
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         $attachment->title = $filename;
140 140
         $attachment->mimetype = $mimetype;
141 141
         $attachment->parentguid = $parentguid;
142
-        if(!$attachment->create())
142
+        if (!$attachment->create())
143 143
         {
144 144
             throw new midcom_error('Failed to create derived image: ' . midcom_connection::get_error_string());
145 145
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -96,12 +96,10 @@
 block discarded – undo
96 96
         if(count($entry) == 0)
97 97
         {
98 98
             throw new midcom_error_notfound("There is no match in database " . midcom_connection::get_error_string());
99
-        }
100
-        else if(count($entry) == 1)
99
+        } else if(count($entry) == 1)
101 100
         {
102 101
             return $entry[0];
103
-        }
104
-        else if(count($entry) > 1)
102
+        } else if(count($entry) > 1)
105 103
         {
106 104
             throw new midcom_error('There is more than just one object' . midcom_connection::get_error_string());
107 105
         }
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/midcom/interfaces.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
23 23
         {
24 24
             $relatedto_arr = $session->get('relatedto2get_array');
25 25
             $session->remove('relatedto2get_array');
26
-        }
27
-        else
26
+        } else
28 27
         {
29 28
             $relatedto_arr = org_openpsa_relatedto_plugin::get2relatedto();
30 29
         }
@@ -35,8 +34,7 @@  discard block
 block discarded – undo
35 34
             if (!$rel->id)
36 35
             {
37 36
                 $rel->create();
38
-            }
39
-            else
37
+            } else
40 38
             {
41 39
                 //In theory we should not ever hit this, but better to be sure.
42 40
                 $rel->update();
Please login to merge, or discard this patch.
lib/org/openpsa/products/midcom/interfaces.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,8 +46,7 @@  discard block
 block discarded – undo
46 46
         {
47 47
             $local_filename = midcom_db_attachment::safe_filename($uploaded_file['name']);
48 48
             $local_file = $this->_get_file($local_filename, true);
49
-        }
50
-        else
49
+        } else
51 50
         {
52 51
             $local_file = $this->_file;
53 52
         }
@@ -89,8 +88,7 @@  discard block
 block discarded – undo
89 88
             // We're creating a new file
90 89
             $local_filename = midcom_db_attachment::safe_filename($_POST['midgard_admin_asgard_filename']);
91 90
             $local_file = $this->_get_file($local_filename, true);
92
-        }
93
-        else
91
+        } else
94 92
         {
95 93
             $local_file = $this->_file;
96 94
         }
Please login to merge, or discard this patch.
lib/fi/protie/navigation/main.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
             return;
267 267
         }
268 268
 
269
-        if (   isset($this->_get_params[$name])
269
+        if (isset($this->_get_params[$name])
270 270
             && $this->_get_params[$name] == $value)
271 271
         {
272 272
             return;
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 
437 437
         if ($child[MIDCOM_NAV_TYPE] === 'node')
438 438
         {
439
-            if (   $item[MIDCOM_NAV_ID] === $this->_nap->get_current_node()
440
-                && (   !$this->_nap->get_current_leaf()
439
+            if ($item[MIDCOM_NAV_ID] === $this->_nap->get_current_node()
440
+                && (!$this->_nap->get_current_leaf()
441 441
                     || !$this->_nap->get_leaf($this->_nap->get_current_leaf())))
442 442
             {
443 443
                 $classes[] = $this->css_active;
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
         }
503 503
 
504 504
         // Add information about the object's status
505
-        if (   $this->object_status_to_class
505
+        if ($this->object_status_to_class
506 506
             && isset($item[MIDCOM_NAV_OBJECT])
507 507
             && $css_status_class = midcom::get()->metadata->get_object_classes($item[MIDCOM_NAV_OBJECT]))
508 508
         {
@@ -524,13 +524,13 @@  discard block
 block discarded – undo
524 524
         echo "<a href=\"{$item[MIDCOM_NAV_ABSOLUTEURL]}{$get_params}\"{$link_class}>{$item[MIDCOM_NAV_NAME]}</a>";
525 525
         // If either of the follow nodes switches is on, follow all the nodes
526 526
 
527
-        if (   $item[MIDCOM_NAV_TYPE] === 'node'
527
+        if ($item[MIDCOM_NAV_TYPE] === 'node'
528 528
             && !$this->show_only_current
529
-            && (   $this->list_levels === 0
529
+            && ($this->list_levels === 0
530 530
                 || $this->_level < $this->list_levels))
531 531
         {
532
-            if (   $this->follow_all
533
-                || (   $this->follow_selected
532
+            if ($this->follow_all
533
+                || ($this->follow_selected
534 534
                     && in_array($item[MIDCOM_NAV_ID], $this->node_path, true)))
535 535
             {
536 536
                 $this->_level++;
Please login to merge, or discard this patch.