Completed
Branch master (e8947e)
by Andreas
15:09
created
lib/midcom/helper/metadata.php 1 patch
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.
lib/midcom/helper/imagepopup/handler/upload.php 1 patch
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.
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.