@@ -151,7 +151,7 @@ |
||
151 | 151 | return; |
152 | 152 | } |
153 | 153 | foreach ($parameters as $param_data) { |
154 | - if ( empty($param_data['domain']) |
|
154 | + if (empty($param_data['domain']) |
|
155 | 155 | || empty($param_data['name']) |
156 | 156 | || empty($param_data['value'])) { |
157 | 157 | // TODO: Log warning |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | $token .= $generator->generateString($this->token_size - 1, 'abcdefghijklmnopqrstuvwxyz0123456789'); |
263 | 263 | |
264 | 264 | //If token is not free or (very, very unlikely) matches our dummy token, recurse. |
265 | - if ( $token === 'dummy' |
|
265 | + if ($token === 'dummy' |
|
266 | 266 | || !org_openpsa_directmarketing_campaign_messagereceipt_dba::token_is_free($token)) { |
267 | 267 | return $this->_create_token(); |
268 | 268 | } |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | return false; |
287 | 287 | } |
288 | 288 | $type = $this->_backend->get_type(); |
289 | - if ( $person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
289 | + if ($person->get_parameter('org.openpsa.directmarketing', "send_all_denied") |
|
290 | 290 | || $person->get_parameter('org.openpsa.directmarketing', "send_{$type}_denied")) { |
291 | 291 | debug_add("Sending {$type} messages to person {$person->rname} is denied, unsubscribing member (member #{$member->id})"); |
292 | 292 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | debug_add("Recursion level is {$level}, limit is {$this->_chunk_max_recurse}"); |
334 | 334 | /* Make sure we still have results left, if not just recurse... |
335 | 335 | (basically this is to avoid returning an empty array when everything is otherwise ok) */ |
336 | - if ( count($results) == 0 |
|
336 | + if (count($results) == 0 |
|
337 | 337 | && ($level < $this->_chunk_max_recurse)) { |
338 | 338 | debug_add('All our results got filtered, recursing for another round'); |
339 | 339 | //Trivial rate limiting. |
@@ -222,7 +222,8 @@ discard block |
||
222 | 222 | $this->_backend->send($person, $member, $token, $subject, $content, $from); |
223 | 223 | self::$_messages_sent++; |
224 | 224 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT; |
225 | - } catch (midcom_error $e) { |
|
225 | + } |
|
226 | + catch (midcom_error $e) { |
|
226 | 227 | $status = org_openpsa_directmarketing_campaign_messagereceipt_dba::FAILURE; |
227 | 228 | if (!$this->test_mode) { |
228 | 229 | $params[] = array( |
@@ -279,7 +280,8 @@ discard block |
||
279 | 280 | { |
280 | 281 | try { |
281 | 282 | $person = org_openpsa_contacts_person_dba::get_cached($member->person); |
282 | - } catch (midcom_error $e) { |
|
283 | + } |
|
284 | + catch (midcom_error $e) { |
|
283 | 285 | debug_add("Person #{$member->person} deleted or missing, removing member (member #{$member->id})"); |
284 | 286 | $member->orgOpenpsaObtype = org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED; |
285 | 287 | $member->delete(); |
@@ -51,7 +51,7 @@ |
||
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->_campaign); |
56 | 56 | if (!$this->_controller->initialize()) { |
57 | 57 | throw new midcom_error("Failed to initialize a DM2 controller instance for campaign {$this->_campaign->id}."); |
@@ -59,7 +59,8 @@ discard block |
||
59 | 59 | { |
60 | 60 | try { |
61 | 61 | $person = new org_openpsa_contacts_person_dba($member->person); |
62 | - } catch (midcom_error $e) { |
|
62 | + } |
|
63 | + catch (midcom_error $e) { |
|
63 | 64 | $e->log(); |
64 | 65 | return; |
65 | 66 | } |
@@ -82,7 +83,8 @@ discard block |
||
82 | 83 | $row['organization_member'] = $membership; |
83 | 84 | try { |
84 | 85 | $row['organization'] = org_openpsa_contacts_group_dba::get_cached($membership->gid); |
85 | - } catch (midcom_error $e) { |
|
86 | + } |
|
87 | + catch (midcom_error $e) { |
|
86 | 88 | debug_add("Error fetching org_openpsa_contacts_group_dba #{$membership->gid}, skipping", MIDCOM_LOG_WARN); |
87 | 89 | continue; |
88 | 90 | } |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | } |
59 | 59 | |
60 | 60 | //Substyle handling |
61 | - if ( !empty($data['message_array']['substyle']) |
|
61 | + if (!empty($data['message_array']['substyle']) |
|
62 | 62 | && !preg_match('/^builtin:/', $data['message_array']['substyle'])) { |
63 | 63 | debug_add("Appending substyle {$data['message_array']['substyle']}"); |
64 | 64 | midcom::get()->style->append_substyle($data['message_array']['substyle']); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | private function _real_show_compose($handler_id, array &$data) |
118 | 118 | { |
119 | 119 | $prefix = ''; |
120 | - if ( !empty($data['message_array']['substyle']) |
|
120 | + if (!empty($data['message_array']['substyle']) |
|
121 | 121 | && preg_match('/^builtin:(.*)/', $data['message_array']['substyle'], $matches_style)) { |
122 | 122 | $prefix = $matches_style[1] . '-'; |
123 | 123 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $contacts = $importer->parse($input); |
155 | 155 | if (count($contacts) > 0) { |
156 | 156 | $this->_request_data['import_status'] = $importer->import_subscribers($contacts, $this->_request_data['campaign']); |
157 | - if ( $this->_request_data['import_status']['subscribed_new'] > 0 |
|
157 | + if ($this->_request_data['import_status']['subscribed_new'] > 0 |
|
158 | 158 | || $this->_request_data['import_status']['already_subscribed'] > 0) { |
159 | 159 | $this->_import_success = true; |
160 | 160 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Update the breadcrumb line |
193 | 193 | $this->_update_breadcrumb($handler_id, $args); |
194 | 194 | |
195 | - if ( array_key_exists('org_openpsa_directmarketing_import', $_POST) |
|
195 | + if (array_key_exists('org_openpsa_directmarketing_import', $_POST) |
|
196 | 196 | && is_uploaded_file($_FILES['org_openpsa_directmarketing_import_upload']['tmp_name'])) { |
197 | 197 | $importer = new org_openpsa_directmarketing_importer_vcards($this->_schemadbs); |
198 | 198 | $this->_run_import($importer, $_FILES['org_openpsa_directmarketing_import_upload']['tmp_name']); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | $read_rows = 0; |
247 | 247 | $handle = fopen($_FILES['org_openpsa_directmarketing_import_upload']['tmp_name'], 'r'); |
248 | 248 | $total_columns = 0; |
249 | - while ( $read_rows < 2 |
|
249 | + while ($read_rows < 2 |
|
250 | 250 | && $csv_line = fgetcsv($handle, 1000, $data['separator'])) { |
251 | 251 | if ($total_columns == 0) { |
252 | 252 | $total_columns = count($csv_line); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | if (!$this->timestamp) { |
25 | 25 | $this->timestamp = time(); |
26 | 26 | } |
27 | - if ( !$this->referrer |
|
27 | + if (!$this->referrer |
|
28 | 28 | && !empty($_SERVER['HTTP_REFERER'])) { |
29 | 29 | $this->referrer = $_SERVER['HTTP_REFERER']; |
30 | 30 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | $recipient = $_ENV["RECIPIENT"]; |
47 | 47 | $token_length = strlen($recipient) - strlen($prefix) - strlen($suffix); |
48 | -if ( $token_length <= 0 |
|
48 | +if ($token_length <= 0 |
|
49 | 49 | || substr($recipient, 0, strlen($prefix)) != $prefix |
50 | 50 | || substr($recipient, strlen($prefix) + $token_length) != $suffix) { |
51 | 51 | error_log("Recipient address does not match address template: $recipient"); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | fclose($fh); |
62 | 62 | exit(0); |
63 | 63 | } |
64 | -} elseif ( substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
64 | +} elseif (substr($BOUNCE_LOGGER, 0, strlen("http://")) == "http://" |
|
65 | 65 | || substr($BOUNCE_LOGGER, 0, strlen("https://")) == "https://") { |
66 | 66 | $client = new org_openpsa_httplib(); |
67 | 67 | $client->post($BOUNCE_LOGGER, array("token" => $token)); |
@@ -55,13 +55,13 @@ |
||
55 | 55 | foreach (array_filter($csv_line) as $field => $value) { |
56 | 56 | // Process the row accordingly |
57 | 57 | $field_matching = $this->_settings['fields'][$field]; |
58 | - if ( $field_matching |
|
58 | + if ($field_matching |
|
59 | 59 | && strstr($field_matching, ':')) { |
60 | 60 | $matching_parts = explode(':', $field_matching); |
61 | 61 | $schemadb = $matching_parts[0]; |
62 | 62 | $schema_field = $matching_parts[1]; |
63 | 63 | |
64 | - if ( !array_key_exists($schemadb, $this->_schemadbs) |
|
64 | + if (!array_key_exists($schemadb, $this->_schemadbs) |
|
65 | 65 | || !array_key_exists($schema_field, $this->_schemadbs[$schemadb]['default']->fields)) { |
66 | 66 | // Invalid matching, skip |
67 | 67 | continue; |