@@ -23,7 +23,7 @@ |
||
23 | 23 | include dirname(__DIR__) . '/config-default.inc.php'; |
24 | 24 | } |
25 | 25 | |
26 | -if (! defined('MIDCOM_STATIC_URL')) { |
|
26 | +if (!defined('MIDCOM_STATIC_URL')) { |
|
27 | 27 | define('MIDCOM_STATIC_URL', '/midcom-static'); |
28 | 28 | } |
29 | 29 |
@@ -77,7 +77,8 @@ discard block |
||
77 | 77 | // if the property useContactAddress is set |
78 | 78 | $billing_data[0]->set_address(); |
79 | 79 | return $billing_data[0]; |
80 | - } catch (midcom_error $e) { |
|
80 | + } |
|
81 | + catch (midcom_error $e) { |
|
81 | 82 | $e->log(); |
82 | 83 | return false; |
83 | 84 | } |
@@ -122,10 +123,12 @@ discard block |
||
122 | 123 | { |
123 | 124 | try { |
124 | 125 | return new org_openpsa_contacts_person_dba($this->linkGuid); |
125 | - } catch (midcom_error $e) { |
|
126 | + } |
|
127 | + catch (midcom_error $e) { |
|
126 | 128 | try { |
127 | 129 | return new org_openpsa_contacts_group_dba($this->linkGuid); |
128 | - } catch (midcom_error $e) { |
|
130 | + } |
|
131 | + catch (midcom_error $e) { |
|
129 | 132 | debug_add("Failed to load contact with GUID: " . $this->linkGuid . " - last error:" . $e->getMessage(), MIDCOM_LOG_ERROR); |
130 | 133 | return false; |
131 | 134 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) |
42 | 42 | { |
43 | 43 | if ( !($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
44 | - // check if the customerContact is set and has invoice_data |
|
44 | + // check if the customerContact is set and has invoice_data |
|
45 | 45 | && !($bd = self::get_billing_data(org_openpsa_contacts_person_dba::class, $object->customerContact))) { |
46 | 46 | $bd = new org_openpsa_invoices_billing_data_dba(); |
47 | 47 | $due = midcom_baseclasses_components_configuration::get('org.openpsa.invoices', 'config')->get('default_due_days'); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | */ |
41 | 41 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) |
42 | 42 | { |
43 | - if ( !($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
43 | + if (!($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
44 | 44 | // check if the customerContact is set and has invoice_data |
45 | 45 | && !($bd = self::get_billing_data(org_openpsa_contacts_person_dba::class, $object->customerContact))) { |
46 | 46 | $bd = new org_openpsa_invoices_billing_data_dba(); |
@@ -48,7 +48,8 @@ |
||
48 | 48 | try { |
49 | 49 | $pdf_helper->render_and_attach(); |
50 | 50 | return $this->reply(true, $this->_l10n->get('pdf created')); |
51 | - } catch (midcom_error $e) { |
|
51 | + } |
|
52 | + catch (midcom_error $e) { |
|
52 | 53 | return $this->reply(false, $this->_l10n->get('pdf creation failed') . ': ' . $e->getMessage()); |
53 | 54 | } |
54 | 55 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $data['page_title'] = $this->_topic->extra; |
63 | 63 | |
64 | 64 | // Filter by categories |
65 | - if ( $handler_id == 'index-category' |
|
65 | + if ($handler_id == 'index-category' |
|
66 | 66 | || $handler_id == 'latest-category') { |
67 | 67 | $data['category'] = trim(strip_tags($args[0])); |
68 | 68 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | midcom::get()->head->set_pagetitle($this->_request_data['page_title']); |
112 | 112 | |
113 | 113 | // Activate correct leaf |
114 | - if ( $this->_config->get('show_navigation_pseudo_leaves') |
|
114 | + if ($this->_config->get('show_navigation_pseudo_leaves') |
|
115 | 115 | && in_array($this->_request_data['category'], $this->_request_data['categories'])) { |
116 | 116 | $this->set_active_leaf($this->_topic->id . '_CAT_' . $this->_request_data['category']); |
117 | 117 | } |
@@ -141,7 +141,8 @@ discard block |
||
141 | 141 | foreach ($this->_articles as $article_counter => $article) { |
142 | 142 | try { |
143 | 143 | $data['datamanager']->set_storage($article); |
144 | - } catch (midcom_error $e) { |
|
144 | + } |
|
145 | + catch (midcom_error $e) { |
|
145 | 146 | $e->log(); |
146 | 147 | continue; |
147 | 148 | } |
@@ -178,7 +179,8 @@ discard block |
||
178 | 179 | if ($this->_config->get('comments_topic')) { |
179 | 180 | try { |
180 | 181 | $comments_topic = new midcom_db_topic($this->_config->get('comments_topic')); |
181 | - } catch (midcom_error $e) { |
|
182 | + } |
|
183 | + catch (midcom_error $e) { |
|
182 | 184 | return false; |
183 | 185 | } |
184 | 186 |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $rawdata = base64_decode($_COOKIE['midcom_services_i18n']); |
130 | 130 | $array = unserialize($rawdata); |
131 | 131 | |
132 | - if ( !array_key_exists('language', $array) |
|
132 | + if (!array_key_exists('language', $array) |
|
133 | 133 | || !array_key_exists('charset', $array)) { |
134 | 134 | debug_add("Rejecting cookie, it seems invalid."); |
135 | 135 | return; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $lang = substr($lang, 0, 2); |
159 | 159 | $q = $this->_get_q($params); |
160 | 160 | |
161 | - if ( !isset($http_langs[$lang]) |
|
161 | + if (!isset($http_langs[$lang]) |
|
162 | 162 | || $http_langs[$lang] < $q) { |
163 | 163 | $http_langs[$lang] = $q; |
164 | 164 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | private function iconv($source_charset, $destination_charset, $string) |
422 | 422 | { |
423 | 423 | $result = @iconv($source_charset, $destination_charset, $string); |
424 | - if ( $result === false |
|
424 | + if ($result === false |
|
425 | 425 | && strlen($string) > 0) { |
426 | 426 | debug_add("Iconv returned failed to convert a string, returning an empty string.", MIDCOM_LOG_WARN); |
427 | 427 | debug_print_r("Tried to convert this string from {$source_charset} to {$destination_charset}:", $string); |
@@ -46,7 +46,8 @@ |
||
46 | 46 | $target = new midcom_db_topic((int) $_POST['move_to']); |
47 | 47 | $this->_move_object($target); |
48 | 48 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), sprintf($this->_l10n->get('moved %s to %s'), $this->_topic->get_label(), $target->get_label())); |
49 | - } catch (midcom_error $e) { |
|
49 | + } |
|
50 | + catch (midcom_error $e) { |
|
50 | 51 | midcom::get()->uimessages->add($this->_l10n->get($this->_component), $e->getMessage(), 'error'); |
51 | 52 | } |
52 | 53 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $this->_object = midcom::get()->dbfactory->get_object_by_guid($args[0]); |
34 | 34 | |
35 | - if ( !is_a($this->_object, midcom_db_topic::class) |
|
35 | + if (!is_a($this->_object, midcom_db_topic::class) |
|
36 | 36 | && !is_a($this->_object, midcom_db_article::class)) { |
37 | 37 | throw new midcom_error_notfound("Moving only topics and articles is supported."); |
38 | 38 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | $folder = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ROOTTOPIC); |
74 | 74 | } |
75 | 75 | |
76 | - if ( is_a($this->_object, midcom_db_topic::class) |
|
76 | + if (is_a($this->_object, midcom_db_topic::class) |
|
77 | 77 | && $folder->up == $this->_object->id) { |
78 | 78 | $tree_disabled = true; |
79 | 79 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $selected = ' checked="checked"'; |
87 | 87 | } |
88 | 88 | |
89 | - if ( !is_a($this->_object, midcom_db_topic::class) |
|
89 | + if (!is_a($this->_object, midcom_db_topic::class) |
|
90 | 90 | && $folder->component !== $this->_request_data['current_folder']->component) { |
91 | 91 | // Non-topic objects may only be moved under folders of same component |
92 | 92 | $class = 'wrong_component'; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | { |
47 | 47 | $this->object = midcom::get()->dbfactory->get_object_by_guid($guid); |
48 | 48 | |
49 | - if ( !midcom::get()->config->get('midcom_services_rcs_enable') |
|
49 | + if (!midcom::get()->config->get('midcom_services_rcs_enable') |
|
50 | 50 | || !$this->object->_use_rcs) { |
51 | 51 | throw new midcom_error_notfound("Revision control not supported for " . get_class($this->object) . "."); |
52 | 52 | } |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | public function _handler_history($handler_id, array $args, array &$data) |
184 | 184 | { |
185 | 185 | // Check if the comparison request is valid |
186 | - if ( !empty($_GET['first']) && !empty($_GET['last']) |
|
187 | - && $_GET['first'] !== $_GET['last']) { |
|
186 | + if (!empty($_GET['first']) && !empty($_GET['last']) |
|
187 | + && $_GET['first'] !== $_GET['last']) { |
|
188 | 188 | return new midcom_response_relocate($this->url_prefix . "diff/{$args[0]}/{$_GET['first']}/{$_GET['last']}/"); |
189 | 189 | } |
190 | 190 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | { |
219 | 219 | $this->load_object($args[0]); |
220 | 220 | |
221 | - if ( !$this->backend->version_exists($args[1]) |
|
221 | + if (!$this->backend->version_exists($args[1]) |
|
222 | 222 | || !$this->backend->version_exists($args[2])) { |
223 | 223 | throw new midcom_error_notfound("One of the revisions {$args[1]} or {$args[2]} does not exist."); |
224 | 224 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | $this->object->require_do('midgard:update'); |
293 | 293 | // TODO: set another privilege for restoring? |
294 | 294 | |
295 | - if ( $this->backend->version_exists($args[1]) |
|
295 | + if ($this->backend->version_exists($args[1]) |
|
296 | 296 | && $this->backend->restore_to_revision($args[1])) { |
297 | 297 | midcom::get()->uimessages->add($this->_l10n->get('midcom.admin.rcs'), sprintf($this->_l10n->get('restore to version %s successful'), $args[1])); |
298 | 298 | return new midcom_response_relocate($this->get_object_url()); |
@@ -26,12 +26,12 @@ |
||
26 | 26 | private function find_duplicates() |
27 | 27 | { |
28 | 28 | $qb = org_openpsa_projects_task_resource_dba::new_query_builder(); |
29 | - $qb->add_constraint('person', '=', (int)$this->person); |
|
30 | - $qb->add_constraint('task', '=', (int)$this->task); |
|
31 | - $qb->add_constraint('orgOpenpsaObtype', '=', (int)$this->orgOpenpsaObtype); |
|
29 | + $qb->add_constraint('person', '=', (int) $this->person); |
|
30 | + $qb->add_constraint('task', '=', (int) $this->task); |
|
31 | + $qb->add_constraint('orgOpenpsaObtype', '=', (int) $this->orgOpenpsaObtype); |
|
32 | 32 | |
33 | 33 | if ($this->id) { |
34 | - $qb->add_constraint('id', '<>', (int)$this->id); |
|
34 | + $qb->add_constraint('id', '<>', (int) $this->id); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | return ($qb->count() > 0); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | protected function _add_visibility_checks() |
130 | 130 | { |
131 | - if ( $this->hide_invisible |
|
131 | + if ($this->hide_invisible |
|
132 | 132 | && !$this->_visibility_checks_added) { |
133 | 133 | if (!midcom::get()->config->get('show_hidden_objects')) { |
134 | 134 | $this->add_constraint('metadata.hidden', '=', false); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | // Deal with empty arrays, which would produce invalid queries |
195 | 195 | // This is done here to avoid repetitive code in callers, and because |
196 | 196 | // it's easy enough to generalize: IN empty set => always false, NOT IN empty set => always true |
197 | - if ( is_array($value) |
|
197 | + if (is_array($value) |
|
198 | 198 | && empty($value)) { |
199 | 199 | if ($operator == 'NOT IN') { |
200 | 200 | return true; |