@@ -18,7 +18,7 @@ discard block |
||
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 () { |
|
21 | + register_shutdown_function(function() { |
|
22 | 22 | midcom::get()->finish(); |
23 | 23 | }); |
24 | 24 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | if (($dir = $this->dir($dst)) == false) { |
46 | - return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#'.$dst); |
|
46 | + return $this->setError(elFinder::ERROR_TRGDIR_NOT_FOUND, '#' . $dst); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | if (!$dir['write']) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem |
86 | 86 | // check POST data `overwrite` for 3rd party uploader |
87 | - $overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite']; |
|
87 | + $overwrite = isset($_POST['overwrite']) ? (bool) $_POST['overwrite'] : $this->options['uploadOverwrite']; |
|
88 | 88 | if ($overwrite) { |
89 | 89 | if (!$file['write']) { |
90 | 90 | return $this->setError(elFinder::ERROR_PERM_DENIED); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | $output = array($object->get_label()); |
250 | 250 | |
251 | 251 | $parent = $object->get_parent(); |
252 | - while ( $parent |
|
252 | + while ($parent |
|
253 | 253 | && $parent->component == 'org.openpsa.documents') { |
254 | 254 | $output[] = $parent->extra; |
255 | 255 | $parent = $parent->get_parent(); |
@@ -346,12 +346,12 @@ discard block |
||
346 | 346 | $data['mime'] = 'directory'; |
347 | 347 | } |
348 | 348 | |
349 | - if ( $owner |
|
349 | + if ($owner |
|
350 | 350 | && $group = midcom::get()->auth->get_assignee($owner)) { |
351 | 351 | $data['group'] = $group->name; |
352 | 352 | } |
353 | 353 | |
354 | - if ( $this->root !== $path |
|
354 | + if ($this->root !== $path |
|
355 | 355 | && $parent = $object->get_parent()) { |
356 | 356 | $data['phash'] = $this->encode($parent->guid); |
357 | 357 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | * @param string $mode open mode |
411 | 411 | * @return resource|false |
412 | 412 | */ |
413 | - protected function _fopen($path, $mode="rb") |
|
413 | + protected function _fopen($path, $mode = "rb") |
|
414 | 414 | { |
415 | 415 | $document = org_openpsa_documents_document_dba::get_cached($path); |
416 | 416 | $attachments = org_openpsa_helpers::get_dm2_attachments($document, 'document'); |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @param string $path file path |
429 | 429 | * @return bool |
430 | 430 | */ |
431 | - protected function _fclose($fp, $path='') |
|
431 | + protected function _fclose($fp, $path = '') |
|
432 | 432 | { |
433 | 433 | fclose($fp); |
434 | 434 | return true; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | { |
615 | 615 | $filename = midcom_db_attachment::safe_filename($name, true); |
616 | 616 | $att = $doc->create_attachment($filename, $name, $mimetype); |
617 | - if ( !$att |
|
617 | + if (!$att |
|
618 | 618 | || !$att->copy_from_handle($fp)) { |
619 | 619 | return false; |
620 | 620 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | return; |
75 | 75 | } |
76 | 76 | $parent = $this->get_parent(); |
77 | - if ( $parent |
|
77 | + if ($parent |
|
78 | 78 | && $parent->component == 'org.openpsa.documents') { |
79 | 79 | midcom::get()->auth->request_sudo('org.openpsa.documents'); |
80 | 80 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * if nothing matched so far and the subtype is alphanumeric, uppercase it on the theory |
172 | 172 | * that it's probably a file extension |
173 | 173 | */ |
174 | - if ( $parts[1] == $subtype |
|
174 | + if ($parts[1] == $subtype |
|
175 | 175 | && preg_match('/^[a-z0-9]+$/', $subtype)) { |
176 | 176 | $subtype = strtoupper($subtype); |
177 | 177 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $properties = $this->get_properties(); |
187 | 187 | // Copy current properties |
188 | 188 | foreach ($properties as $key) { |
189 | - if ( $key != 'guid' |
|
189 | + if ($key != 'guid' |
|
190 | 190 | && $key != 'id' |
191 | 191 | && $key != 'metadata') { |
192 | 192 | $backup->$key = $this->{$key}; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $backup_attachment = $backup->create_attachment($original_attachment->name, $original_attachment->title, $original_attachment->mimetype); |
219 | 219 | |
220 | 220 | $original_handle = $original_attachment->open('r'); |
221 | - if ( !$backup_attachment |
|
221 | + if (!$backup_attachment |
|
222 | 222 | || !$original_handle) { |
223 | 223 | // Failed to copy the attachment, abort |
224 | 224 | return $backup->delete(); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - if ( !$person |
|
131 | + if (!$person |
|
132 | 132 | && !empty($subscriber['person']['handphone'])) { |
133 | 133 | // Perform a simple cell phone test. More complicated duplicate checking is best left to the o.o.contacts duplicate checker |
134 | 134 | $qb = org_openpsa_contacts_person_dba::new_query_builder(); |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | // User is or has been subscriber earlier, update status |
175 | 175 | $member = $members[0]; |
176 | 176 | |
177 | - if ( $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
177 | + if ($member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED |
|
178 | 178 | || $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::NORMAL) { |
179 | 179 | $this->_import_status['already_subscribed']++; |
180 | 180 | return; |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | |
215 | 215 | $qb = org_openpsa_contacts_group_dba::new_query_builder(); |
216 | 216 | |
217 | - if ( array_key_exists('company_id', $this->_schemadbs['organization']['default']->fields) |
|
217 | + if (array_key_exists('company_id', $this->_schemadbs['organization']['default']->fields) |
|
218 | 218 | && !empty($subscriber['organization']['company_id'])) { |
219 | 219 | // Imported data has a company id, we use that instead of name |
220 | 220 | $qb->add_constraint($this->_schemadbs['organization']['default']->fields['company_id']['storage']['location'], '=', $subscriber['organization']['company_id']); |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | // Seek by official name |
223 | 223 | $qb->add_constraint('official', '=', $subscriber['organization']['official']); |
224 | 224 | |
225 | - if ( array_key_exists('city', $this->_schemadbs['organization']['default']->fields) |
|
225 | + if (array_key_exists('city', $this->_schemadbs['organization']['default']->fields) |
|
226 | 226 | && !empty($subscriber['organization']['city'])) { |
227 | 227 | // Imported data has a city, we use also that for matching |
228 | 228 | $qb->add_constraint($this->_schemadbs['organization']['default']->fields['city']['storage']['location'], '=', $subscriber['organization']['city']); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | //Check for bounce detector usage |
33 | 33 | if (!empty($config['bounce_detector_address'])) { |
34 | 34 | //Force bouncer as backend if default specified |
35 | - if ( empty($config['mail_send_backend']) |
|
35 | + if (empty($config['mail_send_backend']) |
|
36 | 36 | || $config['mail_send_backend'] == 'try_default') { |
37 | 37 | $config['mail_send_backend'] = 'bouncer'; |
38 | 38 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | //Set some List-xxx headers to avoid auto-replies and in general to be a good netizen |
91 | 91 | $mail->headers['List-Id'] = "<{$this->_message->guid}@{$_SERVER['SERVER_NAME']}>"; |
92 | - $mail->headers['List-Unsubscribe'] = '<' . $member->get_unsubscribe_url() . '>'; |
|
92 | + $mail->headers['List-Unsubscribe'] = '<' . $member->get_unsubscribe_url() . '>'; |
|
93 | 93 | |
94 | 94 | debug_add('mail->from: ' . $mail->from . ', mail->to: ' . $mail->to . ', mail->subject: ' . $mail->subject); |
95 | 95 | switch ($this->_message->orgOpenpsaObtype) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | // If you don't want to add the image as an attachment to the field, add show_attachment customdata-definition to |
143 | 143 | // schema and set it to false |
144 | - if ( isset($typedata->storage->_schema->fields[$field]['customdata']['show_attachment']) |
|
144 | + if (isset($typedata->storage->_schema->fields[$field]['customdata']['show_attachment']) |
|
145 | 145 | && $typedata->storage->_schema->fields[$field]['customdata']['show_attachment'] === false) { |
146 | 146 | continue; |
147 | 147 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | $address = addslashes($address); |
184 | 184 | return preg_replace_callback( |
185 | 185 | '/href="(http:\/\/.*?)"/i', |
186 | - function ($match) use ($address) { |
|
186 | + function($match) use ($address) { |
|
187 | 187 | return 'href="' . str_replace("URL", rawurlencode($match[1]), $address) . '"'; |
188 | 188 | }, |
189 | 189 | $html); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | private function _populate_node_toolbar() |
22 | 22 | { |
23 | - if ( $this->_topic->can_do('midgard:update') |
|
23 | + if ($this->_topic->can_do('midgard:update') |
|
24 | 24 | && $this->_topic->can_do('midcom:component_config')) { |
25 | 25 | $workflow = $this->get_workflow('datamanager2'); |
26 | 26 | $this->_node_toolbar->add_item($workflow->get_button('config/', array( |
@@ -116,7 +116,7 @@ |
||
116 | 116 | private function _get_sender(array &$data) |
117 | 117 | { |
118 | 118 | $data['message_array'] = $this->_datamanager->get_content_raw(); |
119 | - $data['message_array']['dm_types'] =& $this->_datamanager->types; |
|
119 | + $data['message_array']['dm_types'] = & $this->_datamanager->types; |
|
120 | 120 | if (!array_key_exists('content', $data['message_array'])) { |
121 | 121 | throw new midcom_error('"content" not defined in schema'); |
122 | 122 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | { |
52 | 52 | $this->_load_schemadb(); |
53 | 53 | $this->_controller = midcom_helper_datamanager2_controller::create('simple'); |
54 | - $this->_controller->schemadb =& $this->_schemadb; |
|
54 | + $this->_controller->schemadb = & $this->_schemadb; |
|
55 | 55 | $this->_controller->set_storage($this->_message); |
56 | 56 | if (!$this->_controller->initialize()) { |
57 | 57 | throw new midcom_error("Failed to initialize a DM2 controller instance for message {$this->_message->id}."); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $this->_schemadb = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_message_copy')); |
114 | 114 | $this->_controller = midcom_helper_datamanager2_controller::create('nullstorage'); |
115 | - $this->_controller->schemadb =& $this->_schemadb; |
|
115 | + $this->_controller->schemadb = & $this->_schemadb; |
|
116 | 116 | $this->_controller->initialize(); |
117 | 117 | |
118 | 118 | midcom::get()->head->set_pagetitle($this->_l10n->get('copy message')); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | { |
104 | 104 | $eval_ret = @eval('$rules = ' . $ruleset . ';'); |
105 | 105 | |
106 | - if ( $eval_ret === false |
|
106 | + if ($eval_ret === false |
|
107 | 107 | || !is_array($rules)) { |
108 | 108 | throw new midcom_error('given ruleset could not be parsed'); |
109 | 109 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | */ |
319 | 319 | private function add_misc_rule(array $rule, $class, $person_property) |
320 | 320 | { |
321 | - $persons = array( 0 => -1); |
|
321 | + $persons = array(0 => -1); |
|
322 | 322 | $match = $rule['match']; |
323 | 323 | $constraint_match = "IN"; |
324 | 324 | if ($rule['match'] == '<>') { |
@@ -408,13 +408,13 @@ discard block |
||
408 | 408 | $helper = new helper; |
409 | 409 | |
410 | 410 | foreach ($helper->get_object_vars($object) as $property => $value) { |
411 | - if ( preg_match('/^_/', $property) |
|
411 | + if (preg_match('/^_/', $property) |
|
412 | 412 | || in_array($property, $skip_properties) |
413 | 413 | || property_exists($object, $property)) { |
414 | 414 | // Skip private or otherwise invalid properties |
415 | 415 | continue; |
416 | 416 | } |
417 | - if ( is_object($value) |
|
417 | + if (is_object($value) |
|
418 | 418 | && !is_a($value, 'midgard_datetime')) { |
419 | 419 | while (list($property2, $value2) = each($value)) { |
420 | 420 | $prop_merged = "{$property}.{$property2}"; |
@@ -54,10 +54,10 @@ discard block |
||
54 | 54 | $defaults['date'] = time(); |
55 | 55 | |
56 | 56 | $controller = midcom_helper_datamanager2_controller::create('create'); |
57 | - $controller->schemadb =& $this->_schemadb; |
|
57 | + $controller->schemadb = & $this->_schemadb; |
|
58 | 58 | $controller->schemaname = $this->_schema; |
59 | 59 | $controller->defaults = $defaults; |
60 | - $controller->callback_object =& $this; |
|
60 | + $controller->callback_object = & $this; |
|
61 | 61 | if (!$controller->initialize()) { |
62 | 62 | throw new midcom_error("Failed to initialize a DM2 create controller."); |
63 | 63 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | |
130 | 130 | $this->_load_schemadb(); |
131 | 131 | $data['controller'] = midcom_helper_datamanager2_controller::create('simple'); |
132 | - $data['controller']->schemadb =& $this->_schemadb; |
|
132 | + $data['controller']->schemadb = & $this->_schemadb; |
|
133 | 133 | $data['controller']->set_storage($this->_hour_report); |
134 | 134 | if (!$data['controller']->initialize()) { |
135 | 135 | throw new midcom_error("Failed to initialize a DM2 controller instance for hour_report {$this->_hour_report->id}."); |