@@ -92,7 +92,7 @@ |
||
| 92 | 92 | $entry['mimetype'] = org_openpsa_documents_document_dba::get_file_type($att->mimetype); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $title = '<a class="tab_escape" href="' .$prefix . 'document/' . $document->guid .'/"><img src="' . $icon . '"'; |
|
| 95 | + $title = '<a class="tab_escape" href="' . $prefix . 'document/' . $document->guid . '/"><img src="' . $icon . '"'; |
|
| 96 | 96 | $title .= 'alt="' . $alt . '" style="border: 0px; height: 16px; vertical-align: middle" /> ' . $document->title . '</a>'; |
| 97 | 97 | |
| 98 | 98 | $entry['title'] = $title; |
@@ -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 | } |
@@ -82,7 +82,8 @@ discard block |
||
| 82 | 82 | $file = $this->stat($test); |
| 83 | 83 | $this->clearcache(); |
| 84 | 84 | |
| 85 | - if ($file && $file['name'] === $name) { // file exists and check filename for item ID based filesystem |
|
| 85 | + if ($file && $file['name'] === $name) { |
|
| 86 | +// file exists and check filename for item ID based filesystem |
|
| 86 | 87 | // check POST data `overwrite` for 3rd party uploader |
| 87 | 88 | $overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite']; |
| 88 | 89 | if ($overwrite) { |
@@ -135,11 +136,13 @@ discard block |
||
| 135 | 136 | { |
| 136 | 137 | try { |
| 137 | 138 | return org_openpsa_documents_document_dba::get_cached($path); |
| 138 | - } catch (midcom_error $e) { |
|
| 139 | + } |
|
| 140 | + catch (midcom_error $e) { |
|
| 139 | 141 | $e->log(); |
| 140 | 142 | try { |
| 141 | 143 | return org_openpsa_documents_directory::get_cached($path); |
| 142 | - } catch (midcom_error $e) { |
|
| 144 | + } |
|
| 145 | + catch (midcom_error $e) { |
|
| 143 | 146 | $e->log(); |
| 144 | 147 | } |
| 145 | 148 | } |
@@ -275,7 +278,8 @@ discard block |
||
| 275 | 278 | $object = midcom::get()->dbfactory->get_object_by_guid($path); |
| 276 | 279 | try { |
| 277 | 280 | $parentdir = org_openpsa_documents_directory::get_cached($parent); |
| 278 | - } catch (midcom_error $e) { |
|
| 281 | + } |
|
| 282 | + catch (midcom_error $e) { |
|
| 279 | 283 | $e->log(); |
| 280 | 284 | return false; |
| 281 | 285 | } |
@@ -571,7 +575,8 @@ discard block |
||
| 571 | 575 | try { |
| 572 | 576 | $doc = new org_openpsa_documents_document_dba($path); |
| 573 | 577 | return $doc->delete(); |
| 574 | - } catch (midcom_error $e) { |
|
| 578 | + } |
|
| 579 | + catch (midcom_error $e) { |
|
| 575 | 580 | return false; |
| 576 | 581 | } |
| 577 | 582 | } |
@@ -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']); |
@@ -300,7 +300,8 @@ |
||
| 300 | 300 | $organization = $this->_import_subscribers_organization($subscriber); |
| 301 | 301 | $this->_import_subscribers_organization_member($subscriber, $person, $organization); |
| 302 | 302 | } |
| 303 | - } catch (midcom_error $e) { |
|
| 303 | + } |
|
| 304 | + catch (midcom_error $e) { |
|
| 304 | 305 | $e->log(); |
| 305 | 306 | // Clean up possibly created data |
| 306 | 307 | $this->_clean_new_objects(); |
@@ -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')); |
@@ -107,7 +107,8 @@ |
||
| 107 | 107 | if (!empty($_POST['midcom_helper_datamanager2_save'])) { |
| 108 | 108 | try { |
| 109 | 109 | $rules = $this->_load_rules(); |
| 110 | - } catch (midcom_error $e) { |
|
| 110 | + } |
|
| 111 | + catch (midcom_error $e) { |
|
| 111 | 112 | midcom::get()->uimessages->add('org.openpsa.directmarketing', $this->_l10n->get($e->getMessage()), 'error'); |
| 112 | 113 | return; |
| 113 | 114 | } |
@@ -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}."); |
@@ -163,7 +163,8 @@ |
||
| 163 | 163 | try { |
| 164 | 164 | $task = org_openpsa_projects_task_dba::get_cached($hour_report->task); |
| 165 | 165 | $options['success_url'] = 'hours/task/' . $task->guid . '/'; |
| 166 | - } catch (midcom_error $e) { |
|
| 166 | + } |
|
| 167 | + catch (midcom_error $e) { |
|
| 167 | 168 | $e->log(); |
| 168 | 169 | } |
| 169 | 170 | return $this->get_workflow('delete', $options)->run(); |