@@ -654,7 +654,8 @@ |
||
| 654 | 654 | { |
| 655 | 655 | try { |
| 656 | 656 | return midcom_db_person::get_cached($id); |
| 657 | - } catch (midcom_error $e) { |
|
| 657 | + } |
|
| 658 | + catch (midcom_error $e) { |
|
| 658 | 659 | return null; |
| 659 | 660 | } |
| 660 | 661 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | $etag = trim($parser->data['headers']['etag']); |
| 88 | 88 | |
| 89 | 89 | $feed_etag = $this->_feed->get_parameter('net.nemein.rss', 'etag'); |
| 90 | - if ( !empty($feed_etag) |
|
| 90 | + if (!empty($feed_etag) |
|
| 91 | 91 | && $feed_etag == $etag) { |
| 92 | 92 | // Feed hasn't changed, skip updating |
| 93 | 93 | debug_add("Feed {$this->_feed->url} has not changed since " . date('c', $this->_feed->latestfetch), MIDCOM_LOG_WARN); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | $guid = $item->get_id(); |
| 159 | 159 | $title = $item->get_title(); |
| 160 | 160 | |
| 161 | - if ( ( empty($title) |
|
| 161 | + if ((empty($title) |
|
| 162 | 162 | || trim($title) == '...') |
| 163 | 163 | && empty($guid)) { |
| 164 | 164 | // Something wrong with this entry, skip it |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $meta_values['published'] = $article_date; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if ( $this->apply_values($article, $values, $meta_values) |
|
| 226 | + if ($this->apply_values($article, $values, $meta_values) |
|
| 227 | 227 | && !$article->update()) { |
| 228 | 228 | return null; |
| 229 | 229 | } |
@@ -252,14 +252,14 @@ discard block |
||
| 252 | 252 | private function find_author(net_nemein_rss_parser_item $item) : midcom_db_person |
| 253 | 253 | { |
| 254 | 254 | // Try to figure out item author |
| 255 | - if ( $this->_feed->forceauthor |
|
| 255 | + if ($this->_feed->forceauthor |
|
| 256 | 256 | && $this->_feed->defaultauthor) { |
| 257 | 257 | // Feed has a "default author" set, use it |
| 258 | 258 | return new midcom_db_person($this->_feed->defaultauthor); |
| 259 | 259 | } |
| 260 | 260 | $author = $this->match_item_author($item); |
| 261 | 261 | $fallback_person_id = 1; |
| 262 | - if ( !$author |
|
| 262 | + if (!$author |
|
| 263 | 263 | || $author->id == $fallback_person_id) { |
| 264 | 264 | if ($this->_feed->defaultauthor) { |
| 265 | 265 | // Feed has a "default author" set, use it |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
| 432 | - if ( !empty($author_info['username']) |
|
| 432 | + if (!empty($author_info['username']) |
|
| 433 | 433 | && $person = midcom::get()->auth->get_user_by_name($author_info['username'])) { |
| 434 | 434 | return $person->get_storage(); |
| 435 | 435 | } |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $mimetype = $request->request->get('midgard_admin_asgard_mimetype'); |
| 101 | - if ( !empty($mimetype) |
|
| 101 | + if (!empty($mimetype) |
|
| 102 | 102 | && $local_file->mimetype != $mimetype) { |
| 103 | 103 | $local_file->mimetype = $mimetype; |
| 104 | 104 | $needs_update = true; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if ( $needs_update |
|
| 107 | + if ($needs_update |
|
| 108 | 108 | && !$local_file->update()) { |
| 109 | 109 | return null; |
| 110 | 110 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | $this->bind_view_to_object($this->_file); |
| 235 | 235 | |
| 236 | 236 | $filename = $this->_process_form($request); |
| 237 | - if ( $filename |
|
| 237 | + if ($filename |
|
| 238 | 238 | && $filename != $data['filename']) { |
| 239 | 239 | return $this->relocate_to_file($filename); |
| 240 | 240 | } |
@@ -143,7 +143,8 @@ |
||
| 143 | 143 | debug_add('person #' . $person->id . 'has no email address, aborting'); |
| 144 | 144 | return null; |
| 145 | 145 | } |
| 146 | - } catch (midcom_error $e) { |
|
| 146 | + } |
|
| 147 | + catch (midcom_error $e) { |
|
| 147 | 148 | return null; |
| 148 | 149 | } |
| 149 | 150 | |
@@ -48,7 +48,8 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | try { |
| 50 | 50 | $folder = midcom_db_topic::get_cached($this->topic); |
| 51 | - } catch (midcom_error $e) { |
|
| 51 | + } |
|
| 52 | + catch (midcom_error $e) { |
|
| 52 | 53 | $e->log(); |
| 53 | 54 | } |
| 54 | 55 | $folder->delete_attachment(self::FOLDER_THUMBNAIL); |
@@ -58,7 +59,8 @@ discard block |
||
| 58 | 59 | { |
| 59 | 60 | try { |
| 60 | 61 | return new midcom_db_attachment($this->$type); |
| 61 | - } catch (midcom_error $e) { |
|
| 62 | + } |
|
| 63 | + catch (midcom_error $e) { |
|
| 62 | 64 | $e->log(); |
| 63 | 65 | return null; |
| 64 | 66 | } |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public static function create($from_obj, $from_component, $to_obj, $to_component, $status = null, array $extra = []) : ?org_openpsa_relatedto_dba |
| 33 | 33 | { |
| 34 | - if ( !is_object($from_obj) |
|
| 34 | + if (!is_object($from_obj) |
|
| 35 | 35 | || !is_object($to_obj)) { |
| 36 | 36 | return null; |
| 37 | 37 | } |
@@ -104,7 +104,8 @@ |
||
| 104 | 104 | { |
| 105 | 105 | $ret = ['org_openpsa_relatedto' => []]; |
| 106 | 106 | foreach ($array as $rel) { |
| 107 | - if (!midcom::get()->dbfactory->is_a($rel, org_openpsa_relatedto_dba::class)) { //Matches also 'org_openpsa_relatedto' |
|
| 107 | + if (!midcom::get()->dbfactory->is_a($rel, org_openpsa_relatedto_dba::class)) { |
|
| 108 | +//Matches also 'org_openpsa_relatedto' |
|
| 108 | 109 | //Wrong type of object found in array, cruelly abort the whole procedure |
| 109 | 110 | return null; |
| 110 | 111 | } |
@@ -96,7 +96,8 @@ discard block |
||
| 96 | 96 | // if the property useContactAddress is set |
| 97 | 97 | $billing_data[0]->set_address(); |
| 98 | 98 | return $billing_data[0]; |
| 99 | - } catch (midcom_error $e) { |
|
| 99 | + } |
|
| 100 | + catch (midcom_error $e) { |
|
| 100 | 101 | $e->log(); |
| 101 | 102 | return null; |
| 102 | 103 | } |
@@ -141,10 +142,12 @@ discard block |
||
| 141 | 142 | { |
| 142 | 143 | try { |
| 143 | 144 | return new org_openpsa_contacts_person_dba($this->linkGuid); |
| 144 | - } catch (midcom_error $e) { |
|
| 145 | + } |
|
| 146 | + catch (midcom_error $e) { |
|
| 145 | 147 | try { |
| 146 | 148 | return new org_openpsa_contacts_group_dba($this->linkGuid); |
| 147 | - } catch (midcom_error $e) { |
|
| 149 | + } |
|
| 150 | + catch (midcom_error $e) { |
|
| 148 | 151 | debug_add("Failed to load contact with GUID: " . $this->linkGuid . " - last error:" . $e->getMessage(), MIDCOM_LOG_ERROR); |
| 149 | 152 | return false; |
| 150 | 153 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $this->from = $from; |
| 80 | 80 | $this->subject = $subject; |
| 81 | 81 | |
| 82 | - if ( $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
| 82 | + if ($this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_TEXT |
|
| 83 | 83 | && $this->_message->orgOpenpsaObtype != org_openpsa_directmarketing_campaign_message_dba::EMAIL_HTML) { |
| 84 | 84 | throw new midcom_error('unsupported message type'); |
| 85 | 85 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $token .= midcom_helper_misc::random_string($this->token_size - 1, 'abcdefghijklmnopqrstuvwxyz0123456789'); |
| 224 | 224 | |
| 225 | 225 | //If token is not free or (very, very unlikely) matches our dummy token, recurse. |
| 226 | - if ( $token === 'dummy' |
|
| 226 | + if ($token === 'dummy' |
|
| 227 | 227 | || !org_openpsa_directmarketing_campaign_messagereceipt_dba::token_is_free($token)) { |
| 228 | 228 | return $this->_create_token(); |
| 229 | 229 | } |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | return null; |
| 248 | 248 | } |
| 249 | 249 | $type = $this->_backend->get_type(); |
| 250 | - if ( $person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
| 250 | + if ($person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
| 251 | 251 | || $person->get_parameter('org.openpsa.directmarketing', "send_{$type}_denied")) { |
| 252 | 252 | debug_add("Sending {$type} messages to person {$person->rname} is denied, unsubscribing member (member #{$member->id})"); |
| 253 | 253 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |