@@ -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 | } |
@@ -61,7 +61,7 @@ |
||
| 61 | 61 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) : self |
| 62 | 62 | { |
| 63 | 63 | if ( !($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
| 64 | - // check if the customerContact is set and has invoice_data |
|
| 64 | + // check if the customerContact is set and has invoice_data |
|
| 65 | 65 | && !($bd = self::get_billing_data(org_openpsa_contacts_person_dba::class, $object->customerContact))) { |
| 66 | 66 | $bd = new self(); |
| 67 | 67 | $due = midcom_baseclasses_components_configuration::get('org.openpsa.invoices', 'config')->get('default_due_days'); |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public static function get_by_object(org_openpsa_invoices_interfaces_customer $object) : self |
| 62 | 62 | { |
| 63 | - if ( !($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
| 63 | + if (!($bd = self::get_billing_data(org_openpsa_contacts_group_dba::class, $object->customer)) |
|
| 64 | 64 | // check if the customerContact is set and has invoice_data |
| 65 | 65 | && !($bd = self::get_billing_data(org_openpsa_contacts_person_dba::class, $object->customerContact))) { |
| 66 | 66 | $bd = new self(); |
@@ -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 | } |
@@ -152,7 +152,8 @@ |
||
| 152 | 152 | debug_add('person #' . $person->id . 'has no email address, aborting'); |
| 153 | 153 | return false; |
| 154 | 154 | } |
| 155 | - } catch (midcom_error $e) { |
|
| 155 | + } |
|
| 156 | + catch (midcom_error $e) { |
|
| 156 | 157 | return false; |
| 157 | 158 | } |
| 158 | 159 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $event = new org_openpsa_calendar_event_dba($this->eid); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if ( $recipient->id == midcom_connection::get_user() |
|
| 71 | + if ($recipient->id == midcom_connection::get_user() |
|
| 72 | 72 | && !$event->send_notify_me) { |
| 73 | 73 | //Do not send notification to current user |
| 74 | 74 | debug_add('event->send_notify_me is false and recipient is current user, aborting notify'); |
@@ -203,12 +203,12 @@ discard block |
||
| 203 | 203 | $workday_starts = 8; |
| 204 | 204 | $workday_ends = 16; |
| 205 | 205 | |
| 206 | - $workday_starts_ts = mktime($workday_starts, 0, 0, (int)$ymd_matches[2], (int)$ymd_matches[3], (int)$ymd_matches[1]); |
|
| 207 | - $workday_ends_ts = mktime($workday_ends, 0, 0, (int)$ymd_matches[2], (int)$ymd_matches[3], (int)$ymd_matches[1]); |
|
| 206 | + $workday_starts_ts = mktime($workday_starts, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]); |
|
| 207 | + $workday_ends_ts = mktime($workday_ends, 0, 0, (int) $ymd_matches[2], (int) $ymd_matches[3], (int) $ymd_matches[1]); |
|
| 208 | 208 | $last_end_time = false; |
| 209 | 209 | $last_event = false; |
| 210 | 210 | foreach ($events as $event) { |
| 211 | - if ( $event->end <= $workday_starts_ts |
|
| 211 | + if ($event->end <= $workday_starts_ts |
|
| 212 | 212 | || $event->start >= $workday_ends_ts) { |
| 213 | 213 | // We need not to consider this event, it is outside the defined workday |
| 214 | 214 | continue; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | if ($last_end_time === false) { |
| 239 | 239 | $last_end_time = $workday_starts_ts; |
| 240 | 240 | } |
| 241 | - if ( $last_end_time < $workday_ends_ts |
|
| 241 | + if ($last_end_time < $workday_ends_ts |
|
| 242 | 242 | && (($workday_ends_ts - $last_end_time) >= $amount)) { |
| 243 | 243 | $slots[] = self::_create_slot($last_end_time, $workday_ends_ts, $last_event); |
| 244 | 244 | } |
@@ -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; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $this->_add_visibility_checks(); |
| 107 | 107 | |
| 108 | - if ( empty($this->_limit) |
|
| 108 | + if (empty($this->_limit) |
|
| 109 | 109 | && empty($this->_offset)) { |
| 110 | 110 | // No point to do windowing |
| 111 | 111 | $newresult = $this->_execute_and_check_privileges(); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | $this->_query->set_limit($window_size); |
| 152 | 152 | |
| 153 | - while ( ($resultset = $this->_execute_and_check_privileges()) |
|
| 153 | + while (($resultset = $this->_execute_and_check_privileges()) |
|
| 154 | 154 | || $this->denied > $denied) { |
| 155 | 155 | $size = count($resultset); |
| 156 | 156 | $total_size = $size + ($this->denied - $denied); |
@@ -57,7 +57,8 @@ |
||
| 57 | 57 | $classname = $this->_real_class; |
| 58 | 58 | try { |
| 59 | 59 | $result[] = new $classname($object); |
| 60 | - } catch (midcom_error $e) { |
|
| 60 | + } |
|
| 61 | + catch (midcom_error $e) { |
|
| 61 | 62 | if ($e->getCode() == MIDCOM_ERRFORBIDDEN) { |
| 62 | 63 | $this->denied++; |
| 63 | 64 | } |
@@ -25,7 +25,8 @@ |
||
| 25 | 25 | { |
| 26 | 26 | try { |
| 27 | 27 | $viewer->register_plugin_namespace('__feeds', ['rss' => ['class' => __CLASS__]]); |
| 28 | - } catch (midcom_error $e) { |
|
| 28 | + } |
|
| 29 | + catch (midcom_error $e) { |
|
| 29 | 30 | $e->log(); |
| 30 | 31 | } |
| 31 | 32 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // Hide the articles that have the publish time in the future and if |
| 43 | 43 | // the user is not administrator |
| 44 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
| 44 | + if ($this->_config->get('enable_scheduled_publishing') |
|
| 45 | 45 | && !midcom::get()->auth->admin) { |
| 46 | 46 | // Show the article only if the publishing time has passed or the viewer |
| 47 | 47 | // is the author |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | private function _add_pseudo_leaves(array &$leaves) |
| 85 | 85 | { |
| 86 | - if ( $this->_config->get('archive_enable') |
|
| 86 | + if ($this->_config->get('archive_enable') |
|
| 87 | 87 | && $this->_config->get('archive_in_navigation')) { |
| 88 | 88 | $leaves["{$this->_topic->id}_ARCHIVE"] = [ |
| 89 | 89 | MIDCOM_NAV_URL => "archive/", |
| 90 | 90 | MIDCOM_NAV_NAME => $this->_l10n->get('archive'), |
| 91 | 91 | ]; |
| 92 | 92 | } |
| 93 | - if ( $this->_config->get('rss_enable') |
|
| 93 | + if ($this->_config->get('rss_enable') |
|
| 94 | 94 | && $this->_config->get('feeds_in_navigation')) { |
| 95 | 95 | $leaves[self::LEAFID_FEEDS] = [ |
| 96 | 96 | MIDCOM_NAV_URL => "feeds/", |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ]; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( $this->_config->get('categories_in_navigation') |
|
| 101 | + if ($this->_config->get('categories_in_navigation') |
|
| 102 | 102 | && $this->_config->get('categories') != '') { |
| 103 | 103 | $categories = explode(',', $this->_config->get('categories')); |
| 104 | 104 | foreach ($categories as $category) { |
@@ -109,14 +109,14 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if ( $this->_config->get('archive_years_in_navigation') |
|
| 112 | + if ($this->_config->get('archive_years_in_navigation') |
|
| 113 | 113 | && $this->_config->get('archive_years_enable')) { |
| 114 | 114 | $qb = midcom_db_article::new_query_builder(); |
| 115 | 115 | $qb->add_constraint('topic', '=', $this->_topic->id); |
| 116 | 116 | |
| 117 | 117 | // Hide the articles that have the publish time in the future and if |
| 118 | 118 | // the user is not administrator |
| 119 | - if ( $this->_config->get('enable_scheduled_publishing') |
|
| 119 | + if ($this->_config->get('enable_scheduled_publishing') |
|
| 120 | 120 | && !midcom::get()->auth->admin) { |
| 121 | 121 | // Show the article only if the publishing time has passed or the viewer |
| 122 | 122 | // is the author |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if ( $this->_topic->can_do('midgard:update') |
|
| 76 | + if ($this->_topic->can_do('midgard:update') |
|
| 77 | 77 | && $this->_topic->can_do('midcom:component_config')) { |
| 78 | 78 | $buttons[] = $workflow->get_button('config/', [ |
| 79 | 79 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |