Passed
Branch master (95796a)
by Andreas
38:22
created
lib/org/openpsa/directmarketing/handler/campaign/create.php 1 patch
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,12 +56,12 @@  discard block
 block discarded – undo
56 56
     /**
57 57
      * DM2 creation callback, binds to the current content topic.
58 58
      */
59
-    public function & dm2_create_callback (&$controller)
59
+    public function & dm2_create_callback(&$controller)
60 60
     {
61 61
         $this->_campaign = new org_openpsa_directmarketing_campaign_dba();
62 62
         $this->_campaign->node = $this->_topic->id;
63 63
 
64
-        if (! $this->_campaign->create())
64
+        if (!$this->_campaign->create())
65 65
         {
66 66
             debug_print_r('We operated on this object:', $this->_campaign);
67 67
             throw new midcom_error('Failed to create a new campaign. Last Midgard error was: ' . midcom_connection::get_error_string());
@@ -84,8 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_schemadb[$this->_schema]->description)));
86 86
 
87
-        $workflow = $this->get_workflow('datamanager2', array
88
-        (
87
+        $workflow = $this->get_workflow('datamanager2', array(
89 88
             'controller' => $this->get_controller('create'),
90 89
             'save_callback' => array($this, 'save_callback')
91 90
         ));
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/handler/campaign/admin.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,9 +51,9 @@
 block discarded – undo
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
-        if (! $this->_controller->initialize())
56
+        if (!$this->_controller->initialize())
57 57
         {
58 58
             throw new midcom_error("Failed to initialize a DM2 controller instance for campaign {$this->_campaign->id}.");
59 59
         }
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/handler/list.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@
 block discarded – undo
74 74
             $schemadb_campaign = midcom_helper_datamanager2_schema::load_database($this->_config->get('schemadb_campaign'));
75 75
             foreach (array_keys($schemadb_campaign) as $name)
76 76
             {
77
-                $this->_view_toolbar->add_item($workflow->get_button("campaign/create/{$name}/", array
78
-                (
77
+                $this->_view_toolbar->add_item($workflow->get_button("campaign/create/{$name}/", array(
79 78
                     MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($schemadb_campaign[$name]->description)),
80 79
                     MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people.png',
81 80
                 )));
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/handler/subscriber.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
             try
37 37
             {
38 38
                 $campaign = new org_openpsa_directmarketing_campaign_dba($_POST['add_to_campaign']);
39
-            }
40
-            catch (midcom_error $e)
39
+            } catch (midcom_error $e)
41 40
             {
42 41
                 // FIXME: More informative error message
43 42
                 $this->notify('Failed adding person %s to campaign %s', $_POST['add_to_campaign'], 'error');
@@ -54,8 +53,7 @@  discard block
 block discarded – undo
54 53
             if ($member->create())
55 54
             {
56 55
                 $this->notify('added person %s to campaign %s', $campaign->title, 'info');
57
-            }
58
-            else
56
+            } else
59 57
             {
60 58
                 $this->notify('Failed adding person %s to campaign %s', $campaign->title, 'error');
61 59
             }
@@ -96,8 +94,7 @@  discard block
 block discarded – undo
96 94
             {
97 95
                 $campaigns[$membership->campaign] = new org_openpsa_directmarketing_campaign_dba($membership->campaign);
98 96
                 $campaign_membership_map[$membership->campaign] = $membership;
99
-            }
100
-            catch (midcom_error $e)
97
+            } catch (midcom_error $e)
101 98
             {
102 99
                 debug_add('Failed to load campaign ' . $membership->campaign . ', reason: ' . $e->getMessage());
103 100
             }
@@ -161,8 +158,7 @@  discard block
 block discarded – undo
161 158
         if ($this->_request_data['unsubscribe_status'] == false)
162 159
         {
163 160
             midcom_show_style('show-unsubscribe-failed');
164
-        }
165
-        else
161
+        } else
166 162
         {
167 163
             midcom_show_style('show-unsubscribe-ok');
168 164
         }
@@ -243,8 +239,7 @@  discard block
 block discarded – undo
243 239
         if ($data['unsubscribe_status'] == false)
244 240
         {
245 241
             midcom_show_style('show-unsubscribe-failed');
246
-        }
247
-        else
242
+        } else
248 243
         {
249 244
             midcom_show_style('show-unsubscribe-ok');
250 245
         }
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/handler/import.php 2 patches
Spacing   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,10 +34,8 @@  discard block
 block discarded – undo
34 34
         // Try to load the correct campaign
35 35
         $this->_request_data['campaign'] = $this->_master->load_campaign($args[0]);
36 36
 
37
-        $this->_view_toolbar->add_item
38
-        (
39
-            array
40
-            (
37
+        $this->_view_toolbar->add_item(
38
+            array(
41 39
                 MIDCOM_TOOLBAR_URL => "campaign/{$this->_request_data['campaign']->guid}/",
42 40
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get("back"),
43 41
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_left.png',
@@ -163,7 +161,7 @@  discard block
 block discarded – undo
163 161
         if (count($this->_request_data['contacts']) > 0)
164 162
         {
165 163
             $this->_request_data['import_status'] = $importer->import_subscribers($this->_request_data['contacts'], $this->_request_data['campaign']);
166
-            if (   $this->_request_data['import_status']['subscribed_new'] > 0
164
+            if ($this->_request_data['import_status']['subscribed_new'] > 0
167 165
                 || $this->_request_data['import_status']['already_subscribed'] > 0)
168 166
             {
169 167
                 $this->_import_success = true;
@@ -205,7 +203,7 @@  discard block
 block discarded – undo
205 203
         // Update the breadcrumb line
206 204
         $this->_update_breadcrumb($handler_id, $args);
207 205
 
208
-        if (   array_key_exists('org_openpsa_directmarketing_import', $_POST)
206
+        if (array_key_exists('org_openpsa_directmarketing_import', $_POST)
209 207
             && is_uploaded_file($_FILES['org_openpsa_directmarketing_import_upload']['tmp_name']))
210 208
         {
211 209
             $importer = new org_openpsa_directmarketing_importer_vcards($this->_schemadbs);
@@ -266,7 +264,7 @@  discard block
 block discarded – undo
266 264
                 $read_rows = 0;
267 265
                 $handle = fopen($_FILES['org_openpsa_directmarketing_import_upload']['tmp_name'], 'r');
268 266
                 $total_columns = 0;
269
-                while (   $read_rows < 2
267
+                while ($read_rows < 2
270 268
                        && $csv_line = fgetcsv($handle, 1000, $data['separator']))
271 269
                 {
272 270
                     if ($total_columns == 0)
@@ -341,8 +339,7 @@  discard block
 block discarded – undo
341 339
         $this->_update_breadcrumb($handler_id, $args);
342 340
 
343 341
         $data['rows'] = array();
344
-        $config = array
345
-        (
342
+        $config = array(
346 343
             'fields' => $_POST['org_openpsa_directmarketing_import_csv_field'],
347 344
             'separator' => $_POST['org_openpsa_directmarketing_import_separator'],
348 345
         );
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@  discard block
 block discarded – undo
23 23
         if (is_string($value[0]))
24 24
         {
25 25
             $date = $value[0];
26
-        }
27
-        else
26
+        } else
28 27
         {
29 28
             $date = $value[0][$options . '_date'];
30 29
         }
@@ -88,8 +87,7 @@  discard block
 block discarded – undo
88 87
             {
89 88
                 return false;
90 89
             }
91
-        }
92
-        else
90
+        } else
93 91
         {
94 92
             $minutes = '00';
95 93
         }
@@ -100,8 +98,7 @@  discard block
 block discarded – undo
100 98
             {
101 99
                 return false;
102 100
             }
103
-        }
104
-        else
101
+        } else
105 102
         {
106 103
             $seconds = '00';
107 104
         }
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/importer.php 2 patches
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 }
138 138
             }
139 139
 
140
-            if (   !$person
140
+            if (!$person
141 141
                 && !empty($subscriber['person']['handphone']))
142 142
             {
143 143
                 // Perform a simple cell phone test. More complicated duplicate checking is best left to the o.o.contacts duplicate checker
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
             // User is or has been subscriber earlier, update status
191 191
             $member = $members[0];
192 192
 
193
-            if (   $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED
193
+            if ($member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::UNSUBSCRIBED
194 194
                 || $member->orgOpenpsaObtype == org_openpsa_directmarketing_campaign_member_dba::NORMAL)
195 195
             {
196 196
                 $this->_import_status['already_subscribed']++;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
             $qb = org_openpsa_contacts_group_dba::new_query_builder();
241 241
 
242
-            if (   array_key_exists('company_id', $this->_schemadbs['organization']['default']->fields)
242
+            if (array_key_exists('company_id', $this->_schemadbs['organization']['default']->fields)
243 243
                 && !empty($subscriber['organization']['company_id']))
244 244
             {
245 245
                 // Imported data has a company id, we use that instead of name
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
                 // Seek by official name
251 251
                 $qb->add_constraint('official', '=', $subscriber['organization']['official']);
252 252
 
253
-                if (   array_key_exists('city', $this->_schemadbs['organization']['default']->fields)
253
+                if (array_key_exists('city', $this->_schemadbs['organization']['default']->fields)
254 254
                     && !empty($subscriber['organization']['city']))
255 255
                 {
256 256
                     // Imported data has a city, we use also that for matching
@@ -317,8 +317,7 @@  discard block
 block discarded – undo
317 317
      */
318 318
     public function import_subscribers(array $subscribers, org_openpsa_directmarketing_campaign_dba $campaign)
319 319
     {
320
-        $this->_import_status = array
321
-        (
320
+        $this->_import_status = array(
322 321
             'already_subscribed' => 0,
323 322
             'subscribed_new' => 0,
324 323
             'failed_create' => 0,
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -205,13 +205,11 @@  discard block
 block discarded – undo
205 205
             if (array_key_exists('person', $this->_new_objects))
206 206
             {
207 207
                 $this->_import_status['subscribed_new']++;
208
-            }
209
-            else
208
+            } else
210 209
             {
211 210
                 $this->_import_status['already_subscribed']++;
212 211
             }
213
-        }
214
-        else
212
+        } else
215 213
         {
216 214
             // Not a subscribed member yet, add
217 215
             $member = new org_openpsa_directmarketing_campaign_member_dba();
@@ -244,8 +242,7 @@  discard block
 block discarded – undo
244 242
             {
245 243
                 // Imported data has a company id, we use that instead of name
246 244
                 $qb->add_constraint($this->_schemadbs['organization']['default']->fields['company_id']['storage']['location'], '=', $subscriber['organization']['company_id']);
247
-            }
248
-            else
245
+            } else
249 246
             {
250 247
                 // Seek by official name
251 248
                 $qb->add_constraint('official', '=', $subscriber['organization']['official']);
@@ -292,8 +289,7 @@  discard block
 block discarded – undo
292 289
         {
293 290
             // Match found, use it
294 291
             $member = $members[0];
295
-        }
296
-        else
292
+        } else
297 293
         {
298 294
             // We didn't have person matching the email in DB. Create a new one.
299 295
             $member = new midcom_db_member();
@@ -340,8 +336,7 @@  discard block
 block discarded – undo
340 336
                     $organization = $this->_import_subscribers_organization($subscriber);
341 337
                     $this->_import_subscribers_organization_member($subscriber, $person, $organization);
342 338
                 }
343
-            }
344
-            catch (midcom_error $e)
339
+            } catch (midcom_error $e)
345 340
             {
346 341
                 $e->log();
347 342
                 // Clean up possibly created data
Please login to merge, or discard this patch.
lib/org/openpsa/directmarketing/midcom/interfaces.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     public function _on_watched_dba_delete($object)
18 18
     {
19 19
         $qb = org_openpsa_directmarketing_campaign_member_dba::new_query_builder();
20
-        if (   is_a($object, 'midcom_db_person')
20
+        if (is_a($object, 'midcom_db_person')
21 21
             || is_a($object, 'org_openpsa_contacts_person_dba'))
22 22
         {
23 23
             $qb->add_constraint('person', '=', $object->id);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     function background_send_message($args, $handler)
51 51
     {
52
-        if (   !isset($args['url_base'])
52
+        if (!isset($args['url_base'])
53 53
             || !isset($args['batch']))
54 54
         {
55 55
             $handler->print_error('url_base or batch number not set, aborting');
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,10 @@  discard block
 block discarded – undo
21 21
             || is_a($object, 'org_openpsa_contacts_person_dba'))
22 22
         {
23 23
             $qb->add_constraint('person', '=', $object->id);
24
-        }
25
-        else if (is_a($object, 'org_openpsa_directmarketing_campaign_dba'))
24
+        } else if (is_a($object, 'org_openpsa_directmarketing_campaign_dba'))
26 25
         {
27 26
             $qb->add_constraint('campaign', '=', $object->id);
28
-        }
29
-        else
27
+        } else
30 28
         {
31 29
             return;
32 30
         }
@@ -65,8 +63,7 @@  discard block
 block discarded – undo
65 63
         {
66 64
             midcom::get()->dynamic_load($batch_url);
67 65
             $ret = true;
68
-        }
69
-        catch (midcom_error $e)
66
+        } catch (midcom_error $e)
70 67
         {
71 68
             $ret = $e->getMessage();
72 69
         }
@@ -95,8 +92,7 @@  discard block
 block discarded – undo
95 92
         try
96 93
         {
97 94
             $campaign = new org_openpsa_directmarketing_campaign_dba($args['campaign_guid']);
98
-        }
99
-        catch (midcom_error $e)
95
+        } catch (midcom_error $e)
100 96
         {
101 97
             $handler->print_error("{$args['campaign_guid']} is not a valid campaign GUID");
102 98
             return false;
Please login to merge, or discard this patch.
lib/org/openpsa/user/widget/password.php 1 patch
Spacing   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
         $elements = array();
28 28
         $attributes = array_merge($attributes, array('class' => 'shorttext', 'id' => $this->name . '_input'));
29 29
 
30
-        $menu ='<label><input type="radio" name="org_openpsa_user_person_account_password_switch" value="0" checked="checked"/> ' . $this->_l10n->get("generate_password") . '
30
+        $menu = '<label><input type="radio" name="org_openpsa_user_person_account_password_switch" value="0" checked="checked"/> ' . $this->_l10n->get("generate_password") . '
31 31
             </label>
32 32
             <label>
33 33
                 <input type="radio" name="org_openpsa_user_person_account_password_switch" value="1"/> ' . $this->_l10n->get("own_password") . '
@@ -42,10 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
     public static function jsinit($name, midcom_services_i18n_l10n $l10n, midcom_helper_configuration $config, $userid_required)
44 44
     {
45
-        $conf = array
46
-        (
47
-            'strings' => array
48
-            (
45
+        $conf = array(
46
+            'strings' => array(
49 47
                 'shortPass' => $l10n->get("password too short"),
50 48
                 'badPass' => $l10n->get("password weak"),
51 49
                 'goodPass' => $l10n->get("password good"),
Please login to merge, or discard this patch.
lib/org/openpsa/user/viewer.php 1 patch
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
             $password = $formmanager->_types['password']->value;
36 36
         }
37 37
 
38
-        $stat = $account_helper->create_account
39
-        (
38
+        $stat = $account_helper->create_account(
40 39
             $person->guid,
41 40
             $formmanager->_types["username"]->value,
42 41
             $person->email,
Please login to merge, or discard this patch.