Passed
Branch master (95796a)
by Andreas
38:22
created
lib/org/openpsa/mypage/viewer.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@
 block discarded – undo
69 69
         $query = '__TOPIC_URL:"' . midcom::get()->get_host_name() . '*"';
70 70
         $filter = new midcom_services_indexer_filter_date('__EDITED', $start, 0);
71 71
         $this->_request_data['today'] = $indexer->query($query, $filter);
72
-        $start = mktime(0, 0, 0, date('m'), date('d')-1, date('Y'));
73
-        $end = mktime(23, 59, 59, date('m'), date('d')-1, date('Y'));
72
+        $start = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
73
+        $end = mktime(23, 59, 59, date('m'), date('d') - 1, date('Y'));
74 74
         $query = '__TOPIC_URL:"' . midcom::get()->get_host_name() . '*"';
75 75
         $filter = new midcom_services_indexer_filter_date('__EDITED', $start, $end);
76 76
         $this->_request_data['yesterday'] = $indexer->query($query, $filter);
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
             {
82 82
                 throw new midcom_error(midcom_connection::get_error_string());
83 83
             }
84
-        }
85
-        else
84
+        } else
86 85
         {
87 86
             $nodes = $object_qb->execute();
88 87
             $node = $nodes[0];
Please login to merge, or discard this patch.
lib/org/openpsa/mypage/workingon.php 2 patches
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -125,8 +125,7 @@
 block discarded – undo
125 125
         }
126 126
 
127 127
         // Mark the new task work session as started
128
-        $workingon = array
129
-        (
128
+        $workingon = array(
130 129
             'task' => $task_guid,
131 130
             'description' => $description,
132 131
             'invoiceable' => $invoiceable,
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
             {
82 82
                 throw new midcom_error(midcom_connection::get_error_string());
83 83
             }
84
-        }
85
-        else
84
+        } else
86 85
         {
87 86
             $nodes = $object_qb->execute();
88 87
             $node = $nodes[0];
Please login to merge, or discard this patch.
lib/org/openpsa/mypage/handler/today.php 2 patches
Spacing   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -15,22 +15,18 @@  discard block
 block discarded – undo
15 15
 {
16 16
     private function _populate_toolbar()
17 17
     {
18
-        $buttons = array
19
-        (
20
-            array
21
-            (
18
+        $buttons = array(
19
+            array(
22 20
                 MIDCOM_TOOLBAR_URL => 'weekreview/' . $this->_request_data['this_day'] . '/',
23 21
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('week review'),
24 22
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/properties.png',
25 23
             ),
26
-            array
27
-            (
24
+            array(
28 25
                 MIDCOM_TOOLBAR_URL => 'day/' . $this->_request_data['prev_day'] . '/',
29 26
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('previous'),
30 27
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/back.png',
31 28
             ),
32
-            array
33
-            (
29
+            array(
34 30
                 MIDCOM_TOOLBAR_URL => 'day/' . $this->_request_data['next_day'] . '/',
35 31
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('next'),
36 32
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/next.png',
@@ -77,10 +73,9 @@  discard block
 block discarded – undo
77 73
         org_openpsa_widgets_calendar::add_head_elements();
78 74
 
79 75
         //set the start-constraints for journal-entries
80
-        $time_span = 7 * 24 * 60 * 60 ; //7 days
76
+        $time_span = 7 * 24 * 60 * 60; //7 days
81 77
 
82
-        $this->_request_data['journal_constraints'] = array
83
-        (
78
+        $this->_request_data['journal_constraints'] = array(
84 79
             //just show entries of current_user
85 80
             array(
86 81
                 'property' => 'metadata.creator',
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
             {
82 82
                 throw new midcom_error(midcom_connection::get_error_string());
83 83
             }
84
-        }
85
-        else
84
+        } else
86 85
         {
87 86
             $nodes = $object_qb->execute();
88 87
             $node = $nodes[0];
Please login to merge, or discard this patch.
lib/org/openpsa/mypage/handler/workingon.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@
 block discarded – undo
107 107
                         $customer = $customer_id;
108 108
                     }
109 109
                     catch (midcom_error $e){}
110
-               }
110
+                }
111 111
             }
112 112
             $customer_cache[$array['task']] = $customer;
113 113
             if (!isset($this->_request_data['customers'][$customer]))
Please login to merge, or discard this patch.
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
         $task_conf = midcom_helper_datamanager2_widget_autocomplete::get_widget_config('task');
31 31
         $task_conf['id_field'] = 'guid';
32 32
 
33
-        $task_conf['constraints'][] = array
34
-        (
33
+        $task_conf['constraints'][] = array(
35 34
             'field' => 'status',
36 35
             'op'    => '<',
37 36
             'value' => org_openpsa_projects_task_status_dba::COMPLETED,
@@ -65,8 +64,7 @@  discard block
 block discarded – undo
65 64
         $hours = $hours_mc->list_keys();
66 65
 
67 66
         $this->_request_data['customers'] = array();
68
-        $this->_request_data['hours'] = array
69
-        (
67
+        $this->_request_data['hours'] = array(
70 68
             'invoiceable' => array(),
71 69
             'uninvoiceable' => array(),
72 70
             'total_invoiceable' => 0,
@@ -106,7 +104,7 @@  discard block
 block discarded – undo
106 104
                         $customer_label = $customer->official;
107 105
                         $customer = $customer_id;
108 106
                     }
109
-                    catch (midcom_error $e){}
107
+                    catch (midcom_error $e) {}
110 108
                }
111 109
             }
112 110
             $customer_cache[$array['task']] = $customer;
@@ -173,7 +171,7 @@  discard block
 block discarded – undo
173 171
         $workingon = new org_openpsa_mypage_workingon();
174 172
         if (!$workingon->set($_POST['task']))
175 173
         {
176
-            midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.mypage'),  'Failed to set "working on" parameter to "' . $_POST['task'] . '", reason ' . midcom_connection::get_error_string(), 'error');
174
+            midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.mypage'), 'Failed to set "working on" parameter to "' . $_POST['task'] . '", reason ' . midcom_connection::get_error_string(), 'error');
177 175
         }
178 176
 
179 177
         return new midcom_response_relocate($relocate . "workingon/");
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -105,8 +105,7 @@  discard block
 block discarded – undo
105 105
                         $customer = new org_openpsa_contacts_group_dba($customer_id);
106 106
                         $customer_label = $customer->official;
107 107
                         $customer = $customer_id;
108
-                    }
109
-                    catch (midcom_error $e){}
108
+                    } catch (midcom_error $e){}
110 109
                }
111 110
             }
112 111
             $customer_cache[$array['task']] = $customer;
@@ -127,8 +126,7 @@  discard block
 block discarded – undo
127 126
         if (!isset($this->_request_data['hours'][$category][$customer]))
128 127
         {
129 128
             $this->_request_data['hours'][$category][$customer] = $array['hours'];
130
-        }
131
-        else
129
+        } else
132 130
         {
133 131
             $this->_request_data['hours'][$category][$customer] += $array['hours'];
134 132
         }
Please login to merge, or discard this patch.
lib/org/openpsa/documents/elFinderVolumeOpenpsa.php 3 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -21,73 +21,73 @@  discard block
 block discarded – undo
21 21
         register_shutdown_function(function(){midcom::get()->finish();});
22 22
     }
23 23
 
24
-	/**
25
-	 * Save uploaded file.
26
-	 * On success return array with new file stat and with removed file hash (if existed file was replaced)
24
+    /**
25
+     * Save uploaded file.
26
+     * On success return array with new file stat and with removed file hash (if existed file was replaced)
27 27
      *
28 28
      * Copied from parent and slightly modified to support attachment versioning
29
-	 *
30
-	 * @param  Resource $fp      file pointer
31
-	 * @param  string   $dst     destination folder hash
32
-	 * @param  string   $src     file name
33
-	 * @param  string   $tmpname file tmp name - required to detect mime type
34
-	 * @return array|false
35
-	 * @author Dmitry (dio) Levashov
36
-	 **/
37
-	public function upload($fp, $dst, $name, $tmpname, $hashes = array()) {
38
-		if ($this->commandDisabled('upload')) {
39
-			return $this->setError(elFinder::ERROR_PERM_DENIED);
40
-		}
41
-
42
-		if (($dir = $this->dir($dst)) == false) {
43
-			return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst);
44
-		}
45
-
46
-		if (!$dir['write']) {
47
-			return $this->setError(elFinder::ERROR_PERM_DENIED);
48
-		}
49
-
50
-		if (!$this->nameAccepted($name)) {
51
-			return $this->setError(elFinder::ERROR_INVALID_NAME);
52
-		}
53
-
54
-		$mime = $this->mimetype($this->mimeDetect == 'internal' ? $name : $tmpname, $name);
55
-		$mimeByName = '';
56
-		if ($this->mimeDetect !== 'internal') {
57
-			$mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name);
58
-			if ($mime == 'unknown') {
59
-				$mime = $mimeByName;
60
-			}
61
-		}
62
-
63
-		if (!$this->allowPutMime($mime) || ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
64
-			return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
65
-		}
66
-
67
-		$tmpsize = sprintf('%u', filesize($tmpname));
68
-		if ($this->uploadMaxSize > 0 && $tmpsize > $this->uploadMaxSize) {
69
-			return $this->setError(elFinder::ERROR_UPLOAD_FILE_SIZE);
70
-		}
71
-
72
-		$dstpath = $this->decode($dst);
73
-		if (isset($hashes[$name])) {
74
-			$test = $this->decode($hashes[$name]);
75
-		} else {
76
-			$test = $this->joinPathCE($dstpath, $name);
77
-		}
78
-
79
-		$file = $this->stat($test);
80
-		$this->clearcache();
81
-
82
-		if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem
83
-			// check POST data `overwrite` for 3rd party uploader
84
-			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
85
-			if ($overwrite) {
86
-				if (!$file['write']) {
87
-					return $this->setError(elFinder::ERROR_PERM_DENIED);
88
-				} elseif ($file['mime'] == 'directory') {
89
-					return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
90
-				}
29
+     *
30
+     * @param  Resource $fp      file pointer
31
+     * @param  string   $dst     destination folder hash
32
+     * @param  string   $src     file name
33
+     * @param  string   $tmpname file tmp name - required to detect mime type
34
+     * @return array|false
35
+     * @author Dmitry (dio) Levashov
36
+     **/
37
+    public function upload($fp, $dst, $name, $tmpname, $hashes = array()) {
38
+        if ($this->commandDisabled('upload')) {
39
+            return $this->setError(elFinder::ERROR_PERM_DENIED);
40
+        }
41
+
42
+        if (($dir = $this->dir($dst)) == false) {
43
+            return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst);
44
+        }
45
+
46
+        if (!$dir['write']) {
47
+            return $this->setError(elFinder::ERROR_PERM_DENIED);
48
+        }
49
+
50
+        if (!$this->nameAccepted($name)) {
51
+            return $this->setError(elFinder::ERROR_INVALID_NAME);
52
+        }
53
+
54
+        $mime = $this->mimetype($this->mimeDetect == 'internal' ? $name : $tmpname, $name);
55
+        $mimeByName = '';
56
+        if ($this->mimeDetect !== 'internal') {
57
+            $mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name);
58
+            if ($mime == 'unknown') {
59
+                $mime = $mimeByName;
60
+            }
61
+        }
62
+
63
+        if (!$this->allowPutMime($mime) || ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
64
+            return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
65
+        }
66
+
67
+        $tmpsize = sprintf('%u', filesize($tmpname));
68
+        if ($this->uploadMaxSize > 0 && $tmpsize > $this->uploadMaxSize) {
69
+            return $this->setError(elFinder::ERROR_UPLOAD_FILE_SIZE);
70
+        }
71
+
72
+        $dstpath = $this->decode($dst);
73
+        if (isset($hashes[$name])) {
74
+            $test = $this->decode($hashes[$name]);
75
+        } else {
76
+            $test = $this->joinPathCE($dstpath, $name);
77
+        }
78
+
79
+        $file = $this->stat($test);
80
+        $this->clearcache();
81
+
82
+        if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem
83
+            // check POST data `overwrite` for 3rd party uploader
84
+            $overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
85
+            if ($overwrite) {
86
+                if (!$file['write']) {
87
+                    return $this->setError(elFinder::ERROR_PERM_DENIED);
88
+                } elseif ($file['mime'] == 'directory') {
89
+                    return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
90
+                }
91 91
                 $document = new org_openpsa_documents_document_dba($test);
92 92
                 $document->backup_version();
93 93
                 $attachments = org_openpsa_helpers::get_dm2_attachments($document, 'document');
@@ -108,28 +108,28 @@  discard block
 block discarded – undo
108 108
 
109 109
                 return $this->stat($document->guid);
110 110
 
111
-			} else {
112
-				$name = $this->uniqueName($dstpath, $name, '-', false);
113
-			}
114
-		}
111
+            } else {
112
+                $name = $this->uniqueName($dstpath, $name, '-', false);
113
+            }
114
+        }
115 115
 
116
-		$stat = array(
117
-			'mime'   => $mime,
118
-			'width'  => 0,
119
-			'height' => 0,
120
-			'size'   => $tmpsize);
116
+        $stat = array(
117
+            'mime'   => $mime,
118
+            'width'  => 0,
119
+            'height' => 0,
120
+            'size'   => $tmpsize);
121 121
 
122
-		if (strpos($mime, 'image') === 0 && ($s = getimagesize($tmpname))) {
123
-			$stat['width'] = $s[0];
124
-			$stat['height'] = $s[1];
125
-		}
122
+        if (strpos($mime, 'image') === 0 && ($s = getimagesize($tmpname))) {
123
+            $stat['width'] = $s[0];
124
+            $stat['height'] = $s[1];
125
+        }
126 126
 
127
-		if (($path = $this->saveCE($fp, $dstpath, $name, $stat)) == false) {
128
-			return false;
129
-		}
127
+        if (($path = $this->saveCE($fp, $dstpath, $name, $stat)) == false) {
128
+            return false;
129
+        }
130 130
 
131
-		return $this->stat($path);
132
-	}
131
+        return $this->stat($path);
132
+    }
133 133
 
134 134
     /**
135 135
      * Return parent directory path
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
         {
265 265
             $object = midcom::get()->dbfactory->get_object_by_guid($path);
266 266
         }
267
-		catch (midcom_error $e)
267
+        catch (midcom_error $e)
268 268
         {
269 269
             $e->log();
270
-			return '';
271
-		}
270
+            return '';
271
+        }
272 272
 
273 273
         $output = array();
274 274
         if ($object instanceof org_openpsa_documents_document_dba)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         // elfinder tmp detection doesn't work on OS X
19 19
         $this->tmpPath = midcom::get()->config->get('midcom_tempdir');
20 20
         // elfinder calls exit(), so we need to make sure we write caches
21
-        register_shutdown_function(function(){midcom::get()->finish();});
21
+        register_shutdown_function(function() {midcom::get()->finish(); });
22 22
     }
23 23
 
24 24
 	/**
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		}
41 41
 
42 42
 		if (($dir = $this->dir($dst)) == false) {
43
-			return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst);
43
+			return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst);
44 44
 		}
45 45
 
46 46
 		if (!$dir['write']) {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem
83 83
 			// check POST data `overwrite` for 3rd party uploader
84
-			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
84
+			$overwrite = isset($_POST['overwrite']) ? (bool) $_POST['overwrite'] : $this->options['uploadOverwrite'];
85 85
 			if ($overwrite) {
86 86
 				if (!$file['write']) {
87 87
 					return $this->setError(elFinder::ERROR_PERM_DENIED);
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
             $output[] = $object->extra;
281 281
         }
282 282
         $parent = $object->get_parent();
283
-        while (   $parent
283
+        while ($parent
284 284
                && $parent->component == 'org.openpsa.documents')
285 285
         {
286 286
             $output[] = $parent->extra;
@@ -354,8 +354,7 @@  discard block
 block discarded – undo
354 354
         }
355 355
         $object = midcom::get()->dbfactory->get_object_by_guid($path);
356 356
 
357
-        $data = array
358
-        (
357
+        $data = array(
359 358
             'ts' => $object->metadata->revised,
360 359
             'read' => true,
361 360
             'write' => $object->can_do('midgard:update'),
@@ -465,7 +464,7 @@  discard block
 block discarded – undo
465 464
      * @param  string $mode open mode
466 465
      * @return resource|false
467 466
      */
468
-    protected function _fopen($path, $mode="rb")
467
+    protected function _fopen($path, $mode = "rb")
469 468
     {
470 469
         $document = new org_openpsa_documents_document_dba($path);
471 470
         $attachments = org_openpsa_helpers::get_dm2_attachments($document, 'document');
@@ -484,7 +483,7 @@  discard block
 block discarded – undo
484 483
      * @param  string    $path  file path
485 484
      * @return bool
486 485
      */
487
-    protected function _fclose($fp, $path='')
486
+    protected function _fclose($fp, $path = '')
488 487
     {
489 488
         fclose($fp);
490 489
         return true;
@@ -688,7 +687,7 @@  discard block
 block discarded – undo
688 687
     {
689 688
         $filename = midcom_db_attachment::safe_filename($name, true);
690 689
         $att = $doc->create_attachment($filename, $name, $mimetype);
691
-        if (   !$att
690
+        if (!$att
692 691
             || !$att->copy_from_handle($fp))
693 692
         {
694 693
             return false;
Please login to merge, or discard this patch.
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -144,8 +144,7 @@  discard block
 block discarded – undo
144 144
             $topic = new org_openpsa_documents_directory($path);
145 145
             $parent = $topic->get_parent();
146 146
             return $parent->guid;
147
-        }
148
-        catch (midcom_error $e)
147
+        } catch (midcom_error $e)
149 148
         {
150 149
             $e->log();
151 150
             try
@@ -153,8 +152,7 @@  discard block
 block discarded – undo
153 152
                 $document = new org_openpsa_documents_document_dba($path);
154 153
                 $parent = $document->get_parent();
155 154
                 return $parent->guid;
156
-            }
157
-            catch (midcom_error $e)
155
+            } catch (midcom_error $e)
158 156
             {
159 157
                 $e->log();
160 158
                 return '';
@@ -174,16 +172,14 @@  discard block
 block discarded – undo
174 172
         {
175 173
             $topic = new org_openpsa_documents_directory($path);
176 174
             return $topic->extra;
177
-        }
178
-        catch (midcom_error $e)
175
+        } catch (midcom_error $e)
179 176
         {
180 177
             $e->log();
181 178
             try
182 179
             {
183 180
                 $document = new org_openpsa_documents_document_dba($path);
184 181
                 return $document->title;
185
-            }
186
-            catch (midcom_error $e)
182
+            } catch (midcom_error $e)
187 183
             {
188 184
                 $e->log();
189 185
                 return '';
@@ -263,8 +259,7 @@  discard block
 block discarded – undo
263 259
         try
264 260
         {
265 261
             $object = midcom::get()->dbfactory->get_object_by_guid($path);
266
-        }
267
-		catch (midcom_error $e)
262
+        } catch (midcom_error $e)
268 263
         {
269 264
             $e->log();
270 265
 			return '';
@@ -274,8 +269,7 @@  discard block
 block discarded – undo
274 269
         if ($object instanceof org_openpsa_documents_document_dba)
275 270
         {
276 271
             $output[] = $object->title;
277
-        }
278
-        else
272
+        } else
279 273
         {
280 274
             $output[] = $object->extra;
281 275
         }
@@ -308,8 +302,7 @@  discard block
 block discarded – undo
308 302
         try
309 303
         {
310 304
             $parentdir = new org_openpsa_documents_directory($parent);
311
-        }
312
-        catch (midcom_error $e)
305
+        } catch (midcom_error $e)
313 306
         {
314 307
             $e->log();
315 308
             return false;
@@ -320,8 +313,7 @@  discard block
 block discarded – undo
320 313
         if ($object instanceof org_openpsa_documents_document_dba)
321 314
         {
322 315
             $qb->add_constraint('id', '=', $object->topic);
323
-        }
324
-        else
316
+        } else
325 317
         {
326 318
             $qb->add_constraint('id', '=', $object->id);
327 319
         }
@@ -380,8 +372,7 @@  discard block
 block discarded – undo
380 372
                     $data['size'] = $stat['size'];
381 373
                 }
382 374
             }
383
-        }
384
-        else
375
+        } else
385 376
         {
386 377
             $parentfield = 'up';
387 378
             $group = midcom::get()->auth->get_assignee($object->get_parameter('org.openpsa.core', 'orgOpenpsaOwnerWg'));
@@ -612,8 +603,7 @@  discard block
 block discarded – undo
612 603
             {
613 604
                 return $source;
614 605
             }
615
-        }
616
-        catch (midcom_error $e)
606
+        } catch (midcom_error $e)
617 607
         {
618 608
             $e->log();
619 609
             $dir = new org_openpsa_documents_directory($source);
@@ -640,8 +630,7 @@  discard block
 block discarded – undo
640 630
         {
641 631
             $doc = new org_openpsa_documents_document_dba($path);
642 632
             return $doc->delete();
643
-        }
644
-        catch (midcom_error $e)
633
+        } catch (midcom_error $e)
645 634
         {
646 635
             return false;
647 636
         }
Please login to merge, or discard this patch.
lib/org/openpsa/documents/document.php 2 patches
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,8 +18,7 @@  discard block
 block discarded – undo
18 18
     public $__midcom_class_name__ = __CLASS__;
19 19
     public $__mgdschema_class_name__ = 'org_openpsa_document';
20 20
 
21
-    public $autodelete_dependents = array
22
-    (
21
+    public $autodelete_dependents = array(
23 22
         'org_openpsa_documents_document_dba' => 'nextVersion'
24 23
     );
25 24
 
@@ -79,7 +78,7 @@  discard block
 block discarded – undo
79 78
             return;
80 79
         }
81 80
         $parent = $this->get_parent();
82
-        if (   $parent
81
+        if ($parent
83 82
             && $parent->component == 'org.openpsa.documents')
84 83
         {
85 84
             midcom::get()->auth->request_sudo('org.openpsa.documents');
@@ -95,7 +94,7 @@  discard block
 block discarded – undo
95 94
 
96 95
     public function get_class()
97 96
     {
98
-        if (   !midcom::get()->auth->user
97
+        if (!midcom::get()->auth->user
99 98
             || empty($this->guid))
100 99
         {
101 100
             return '';
@@ -103,7 +102,7 @@  discard block
 block discarded – undo
103 102
         $person = midcom::get()->auth->user->get_storage();
104 103
         $lastvisited = $person->get_parameter('org.openpsa.documents_visited', $this->guid);
105 104
 
106
-        if (   $lastvisited
105
+        if ($lastvisited
107 106
             && $lastvisited > $this->metadata->revised)
108 107
         {
109 108
             return 'visited';
@@ -201,7 +200,7 @@  discard block
 block discarded – undo
201 200
          * if nothing matched so far and the subtype is alphanumeric, uppercase it on the theory
202 201
          * that it's probably a file extension
203 202
          */
204
-        if (   $parts[1] == $subtype
203
+        if ($parts[1] == $subtype
205 204
             && preg_match('/^[a-z0-9]+$/', $subtype))
206 205
         {
207 206
             $subtype = strtoupper($subtype);
@@ -218,7 +217,7 @@  discard block
 block discarded – undo
218 217
         // Copy current properties
219 218
         foreach ($properties as $key)
220 219
         {
221
-            if (   $key != 'guid'
220
+            if ($key != 'guid'
222 221
                 && $key != 'id'
223 222
                 && $key != 'metadata')
224 223
             {
@@ -263,7 +262,7 @@  discard block
 block discarded – undo
263 262
             $backup_attachment = $backup->create_attachment($original_attachment->name, $original_attachment->title, $original_attachment->mimetype);
264 263
 
265 264
             $original_handle = $original_attachment->open('r');
266
-            if (   !$backup_attachment
265
+            if (!$backup_attachment
267 266
                 || !$original_handle)
268 267
             {
269 268
                 // Failed to copy the attachment, abort
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -177,12 +177,10 @@
 block discarded – undo
177 177
                 {
178 178
                     $type = str_replace('vnd.oasis.opendocument.', '', $subtype);
179 179
                     $subtype = 'OpenDocument';
180
-                }
181
-                else if (preg_match('/^vnd\.ms/', $subtype))
180
+                } else if (preg_match('/^vnd\.ms/', $subtype))
182 181
                 {
183 182
                     $subtype = ucfirst(str_replace('vnd.ms-', '', $subtype));
184
-                }
185
-                else if (preg_match('/^vnd\.openxmlformats/', $subtype))
183
+                } else if (preg_match('/^vnd\.openxmlformats/', $subtype))
186 184
                 {
187 185
                     $type = str_replace('vnd.openxmlformats-officedocument.', '', $subtype);
188 186
                     $type = str_replace('ml.', ' ', $type);
Please login to merge, or discard this patch.
lib/org/openpsa/documents/handler/document/view.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@
 block discarded – undo
299 299
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('next version'),
300 300
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/up.png',
301 301
                 )
302
-             );
302
+                );
303 303
         }
304 304
         if ($previous_version)
305 305
         {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -11 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype);
99 99
         }
100 100
 
101
-        $title = '<a class="tab_escape" href="' .$prefix . 'document/' . $document->guid .'/"><img src="' . $icon . '"';
101
+        $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"';
102 102
         $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>';
103 103
 
104 104
         $entry['title'] = $title;
@@ -226,8 +226,7 @@  discard block
 block discarded – undo
226 226
         if ($this->_document->can_do('midgard:update'))
227 227
         {
228 228
             $workflow = $this->get_workflow('datamanager2');
229
-            $this->_view_toolbar->add_item($workflow->get_button("document/edit/{$this->_document->guid}/", array
230
-            (
229
+            $this->_view_toolbar->add_item($workflow->get_button("document/edit/{$this->_document->guid}/", array(
231 230
                 MIDCOM_TOOLBAR_ACCESSKEY => 'e',
232 231
             )));
233 232
         }
@@ -291,10 +290,8 @@  discard block
 block discarded – undo
291 290
 
292 291
         if ($next_version)
293 292
         {
294
-            $this->_view_toolbar->add_item
295
-            (
296
-                array
297
-                (
293
+            $this->_view_toolbar->add_item(
294
+                array(
298 295
                     MIDCOM_TOOLBAR_URL => "document/{$next_version->guid}/",
299 296
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('next version'),
300 297
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/up.png',
@@ -303,10 +300,8 @@  discard block
 block discarded – undo
303 300
         }
304 301
         if ($previous_version)
305 302
         {
306
-            $this->_view_toolbar->add_item
307
-            (
308
-                array
309
-                (
303
+            $this->_view_toolbar->add_item(
304
+                array(
310 305
                     MIDCOM_TOOLBAR_URL => "document/{$previous_version->guid}/",
311 306
                     MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('previous version'),
312 307
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/down.png',
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -340,8 +340,7 @@  discard block
 block discarded – undo
340 340
             $this->_controller->schemaname = $this->_schema;
341 341
             $this->_controller->defaults = $this->_defaults;
342 342
             $this->_controller->callback_object =& $this;
343
-        }
344
-        else
343
+        } else
345 344
         {
346 345
             if (!$this->_object)
347 346
             {
@@ -393,8 +392,7 @@  discard block
 block discarded – undo
393 392
         {
394 393
             // Parent object available, check permissions
395 394
             $this->_parent->require_do('midgard:create');
396
-        }
397
-        else
395
+        } else
398 396
         {
399 397
             midcom::get()->auth->require_user_do('midgard:create', null, $this->_dba_class);
400 398
         }
@@ -448,8 +446,7 @@  discard block
 block discarded – undo
448 446
             $this->_load_controller('ajax');
449 447
             $this->_controller->process_ajax();
450 448
             $this->_datamanager =& $this->_controller->datamanager;
451
-        }
452
-        else
449
+        } else
453 450
         {
454 451
             $this->_load_datamanager();
455 452
         }
@@ -460,8 +457,7 @@  discard block
 block discarded – undo
460 457
         {
461 458
             // For AJAX handling it is the controller that renders everything
462 459
             $this->_request_data['object_view'] = $this->_controller->get_content_html();
463
-        }
464
-        else
460
+        } else
465 461
         {
466 462
             $this->_request_data['object_view'] = $this->_datamanager->get_content_html();
467 463
         }
Please login to merge, or discard this patch.
lib/org/openpsa/documents/handler/document/create.php 1 patch
Spacing   +7 added lines, -9 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
     private function _load_create_controller()
60 60
     {
61 61
         $this->_controller = midcom_helper_datamanager2_controller::create('create');
62
-        $this->_controller->schemadb =& $this->_schemadb;
62
+        $this->_controller->schemadb = & $this->_schemadb;
63 63
         $this->_controller->schemaname = $this->_schema;
64
-        $this->_controller->callback_object =& $this;
64
+        $this->_controller->callback_object = & $this;
65 65
         $this->_controller->defaults = $this->_defaults;
66
-        if (! $this->_controller->initialize())
66
+        if (!$this->_controller->initialize())
67 67
         {
68 68
             throw new midcom_error("Failed to initialize a DM2 create controller.");
69 69
         }
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         $this->_document->topic = $this->_request_data['directory']->id;
79 79
         $this->_document->orgOpenpsaAccesstype = org_openpsa_core_acl::ACCESS_WGPRIVATE;
80 80
 
81
-        if (! $this->_document->create())
81
+        if (!$this->_document->create())
82 82
         {
83 83
             debug_print_r('We operated on this object:', $this->_document);
84 84
             throw new midcom_error("Failed to create a new document. Error: " . midcom_connection::get_error_string());
@@ -96,8 +96,7 @@  discard block
 block discarded – undo
96 96
     {
97 97
         $data['directory']->require_do('midgard:create');
98 98
 
99
-        $this->_defaults = array
100
-        (
99
+        $this->_defaults = array(
101 100
             'topic' => $this->_request_data['directory']->id,
102 101
             'author' => midcom_connection::get_user(),
103 102
             'orgOpenpsaAccesstype' => $this->_topic->get_parameter('org.openpsa.core', 'orgOpenpsaAccesstype'),
@@ -108,8 +107,7 @@  discard block
 block discarded – undo
108 107
 
109 108
         midcom::get()->head->set_pagetitle($this->_l10n->get('create document'));
110 109
 
111
-        $workflow = $this->get_workflow('datamanager2', array
112
-        (
110
+        $workflow = $this->get_workflow('datamanager2', array(
113 111
             'controller' => $this->_controller,
114 112
             'save_callback' => array($this, 'save_callback')
115 113
         ));
@@ -142,6 +140,6 @@  discard block
 block discarded – undo
142 140
             $prefix = $node[MIDCOM_NAV_ABSOLUTEURL];
143 141
         }
144 142
 
145
-        return $prefix  . "document/" . $this->_document->guid . "/";
143
+        return $prefix . "document/" . $this->_document->guid . "/";
146 144
     }
147 145
 }
Please login to merge, or discard this patch.
lib/org/openpsa/documents/handler/document/admin.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
     private function _load_edit_controller()
54 54
     {
55 55
         $this->_controller = midcom_helper_datamanager2_controller::create('simple');
56
-        $this->_controller->schemadb =& $this->_schemadb;
56
+        $this->_controller->schemadb = & $this->_schemadb;
57 57
         $this->_controller->set_storage($this->_document, $this->_schema);
58
-        if (! $this->_controller->initialize())
58
+        if (!$this->_controller->initialize())
59 59
         {
60
-            throw new midcom_error( "Failed to initialize a DM2 controller instance for document {$this->_document->id}.");
60
+            throw new midcom_error("Failed to initialize a DM2 controller instance for document {$this->_document->id}.");
61 61
         }
62 62
     }
63 63
 
@@ -87,15 +87,14 @@  discard block
 block discarded – undo
87 87
 
88 88
         $this->_load_edit_controller();
89 89
 
90
-        if (   $data['enable_versioning']
90
+        if ($data['enable_versioning']
91 91
             && !empty($_POST))
92 92
         {
93 93
             $this->_backup_attachment();
94 94
         }
95 95
         midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_document->title));
96 96
 
97
-        $workflow = $this->get_workflow('datamanager2', array
98
-        (
97
+        $workflow = $this->get_workflow('datamanager2', array(
99 98
             'controller' => $this->_controller,
100 99
             'save_callback' => array($this, 'save_callback')
101 100
         ));
@@ -127,7 +126,7 @@  discard block
 block discarded – undo
127 126
             $prefix = $node[MIDCOM_NAV_ABSOLUTEURL];
128 127
         }
129 128
 
130
-        return $prefix  . "document/" . $this->_document->guid . "/";
129
+        return $prefix . "document/" . $this->_document->guid . "/";
131 130
     }
132 131
 
133 132
     /**
@@ -142,8 +141,8 @@  discard block
 block discarded – undo
142 141
         {
143 142
             foreach (array_keys($_POST['document']) as $key)
144 143
             {
145
-                if (    strpos($key, '_delete')
146
-                    || (    strpos($key, '_upload')
144
+                if (strpos($key, '_delete')
145
+                    || (strpos($key, '_upload')
147 146
                         && !strpos($key, 'new_upload')))
148 147
                 {
149 148
                     $this->_document->backup_version();
@@ -156,7 +155,7 @@  discard block
 block discarded – undo
156 155
         $group = $this->_controller->formmanager->form->getElement('document');
157 156
         foreach ($group->getElements() as $element)
158 157
         {
159
-            if (   preg_match('/e_exist_.+?_file$/', $element->getName())
158
+            if (preg_match('/e_exist_.+?_file$/', $element->getName())
160 159
                 && $element->isUploadedFile())
161 160
             {
162 161
                 $this->_document->backup_version();
Please login to merge, or discard this patch.