Passed
Push — scrutinizer-code-quality ( 27193c...09f5a1 )
by Adam
51:28
created
modules/Campaigns/WebToLeadCapture.php 3 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
 $mod_strings = return_module_language($sugar_config['default_language'], 'Leads');
49 49
 
50
-$app_list_strings['record_type_module'] = array('Contact'=>'Contacts', 'Account'=>'Accounts', 'Opportunity'=>'Opportunities', 'Case'=>'Cases', 'Note'=>'Notes', 'Call'=>'Calls', 'Email'=>'Emails', 'Meeting'=>'Meetings', 'Task'=>'Tasks', 'Lead'=>'Leads','Bug'=>'Bugs',
50
+$app_list_strings['record_type_module'] = array('Contact'=>'Contacts', 'Account'=>'Accounts', 'Opportunity'=>'Opportunities', 'Case'=>'Cases', 'Note'=>'Notes', 'Call'=>'Calls', 'Email'=>'Emails', 'Meeting'=>'Meetings', 'Task'=>'Tasks', 'Lead'=>'Leads', 'Bug'=>'Bugs',
51 51
 
52 52
 );
53 53
 
@@ -61,18 +61,18 @@  discard block
 block discarded – undo
61 61
 if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) {
62 62
 	    //adding the client ip address
63 63
 	    $_POST['client_id_address'] = query_client_ip();
64
-		$campaign_id=$_POST['campaign_id'];
64
+		$campaign_id = $_POST['campaign_id'];
65 65
 		$campaign = new Campaign();
66 66
 		$camp_query  = "select name,id from campaigns where id='$campaign_id'";
67 67
 		$camp_query .= " and deleted=0";
68
-        $camp_result=$campaign->db->query($camp_query);
68
+        $camp_result = $campaign->db->query($camp_query);
69 69
         $camp_data = $campaign->db->fetchByAssoc($camp_result);
70 70
         // Bug 41292 - have to select marketing_id for new lead
71 71
         $db = DBManagerFactory::getInstance();
72 72
         $marketing = new EmailMarketing();
73 73
         $marketing_query = $marketing->create_new_list_query(
74 74
                 'date_start desc, date_modified desc',
75
-                "campaign_id = '{$campaign_id}' and status = 'active' and date_start < " . $db->convert('', 'today'),
75
+                "campaign_id = '{$campaign_id}' and status = 'active' and date_start < ".$db->convert('', 'today'),
76 76
                 array('id')
77 77
         );
78 78
         $marketing_result = $db->limitQuery($marketing_query, 0, 1, true);
@@ -83,22 +83,22 @@  discard block
 block discarded – undo
83 83
 			$current_user->retrieve($_REQUEST['assigned_user_id']);
84 84
 		} 
85 85
 
86
-	    if(isset($camp_data) && $camp_data != null ){
86
+	    if (isset($camp_data) && $camp_data != null) {
87 87
 			$leadForm = new LeadFormBase();
88 88
             $lead = new Lead();
89 89
 			$prefix = '';
90
-			if(!empty($_POST['prefix'])){
90
+			if (!empty($_POST['prefix'])) {
91 91
 				$prefix = $_POST['prefix'];
92 92
 			}
93 93
 
94
-			if(empty($lead->id)) {
94
+			if (empty($lead->id)) {
95 95
                 $lead->id = create_guid();
96 96
                 $lead->new_with_id = true;
97 97
             }
98 98
             $GLOBALS['check_notify'] = true;
99 99
 
100 100
             //bug: 47574 - make sure, that webtolead_email1 field has same required attribute as email1 field
101
-            if(isset($lead->required_fields['email1'])){
101
+            if (isset($lead->required_fields['email1'])) {
102 102
                 $lead->required_fields['webtolead_email1'] = $lead->required_fields['email1'];
103 103
             }
104 104
             
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             // checkRequired needs a major overhaul before it works for web to lead forms.
115 115
             $lead = $leadForm->handleSave($prefix, false, false, false, $lead);
116 116
             
117
-			if(!empty($lead)){
117
+			if (!empty($lead)) {
118 118
 				
119 119
 	            //create campaign log
120 120
 	            $camplog = new CampaignLog();
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 	            $camplog->related_type = $lead->module_dir;
124 124
 	            $camplog->activity_type = "lead";
125 125
 	            $camplog->target_type = $lead->module_dir;
126
-	            $campaign_log->activity_date=$timedate->now();
127
-	            $camplog->target_id    = $lead->id;
128
-                if(isset($marketing_data['id']))
126
+	            $campaign_log->activity_date = $timedate->now();
127
+	            $camplog->target_id = $lead->id;
128
+                if (isset($marketing_data['id']))
129 129
                 {
130 130
                     $camplog->marketing_id = $marketing_data['id'];
131 131
                 }
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                 
156 156
 		        $lead->load_relationship('campaigns');
157 157
 		        $lead->campaigns->add($camplog->id);
158
-                if(!empty($GLOBALS['check_notify'])) {
158
+                if (!empty($GLOBALS['check_notify'])) {
159 159
                     $lead->save($GLOBALS['check_notify']);
160 160
                 }
161 161
                 else {
@@ -164,47 +164,47 @@  discard block
 block discarded – undo
164 164
             }
165 165
 
166 166
             //in case there are forms out there still using email_opt_out
167
-            if(isset($_POST['webtolead_email_opt_out']) || isset($_POST['email_opt_out'])){
167
+            if (isset($_POST['webtolead_email_opt_out']) || isset($_POST['email_opt_out'])) {
168 168
                     
169
-                if(isset ($lead->email1) && !empty($lead->email1)){
169
+                if (isset ($lead->email1) && !empty($lead->email1)) {
170 170
                     $sea = new SugarEmailAddress();
171
-                    $sea->AddUpdateEmailAddress($lead->email1,0,1);
171
+                    $sea->AddUpdateEmailAddress($lead->email1, 0, 1);
172 172
                 }   
173
-                if(isset ($lead->email2) && !empty($lead->email2)){
173
+                if (isset ($lead->email2) && !empty($lead->email2)) {
174 174
                     $sea = new SugarEmailAddress();
175
-                    $sea->AddUpdateEmailAddress($lead->email2,0,1);
175
+                    $sea->AddUpdateEmailAddress($lead->email2, 0, 1);
176 176
                     
177 177
                 }
178 178
             }              
179
-			if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
179
+			if (isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])) {
180 180
 			    // Get the redirect url, and make sure the query string is not too long
181 181
 		        $redirect_url = $_POST['redirect_url'];
182 182
 		        $query_string = '';
183 183
 				$first_char = '&';
184
-				if(strpos($redirect_url, '?') === FALSE){
184
+				if (strpos($redirect_url, '?') === FALSE) {
185 185
 					$first_char = '?';
186 186
 				}
187 187
 				$first_iteration = true;
188 188
 				$get_and_post = array_merge($_GET, $_POST);
189
-				foreach($get_and_post as $param => $value) {
189
+				foreach ($get_and_post as $param => $value) {
190 190
 
191
-					if($param == 'redirect_url' && $param == 'submit')
191
+					if ($param == 'redirect_url' && $param == 'submit')
192 192
 						continue;
193 193
 					
194
-					if($first_iteration){
194
+					if ($first_iteration) {
195 195
 						$first_iteration = false;
196 196
 						$query_string .= $first_char;
197 197
 					}
198
-					else{
198
+					else {
199 199
 						$query_string .= "&";
200 200
 					}
201 201
 					$query_string .= "{$param}=".urlencode($value);
202 202
 				}
203
-				if(empty($lead)) {
204
-					if($first_iteration){
203
+				if (empty($lead)) {
204
+					if ($first_iteration) {
205 205
 						$query_string .= $first_char;
206 206
 					}
207
-					else{
207
+					else {
208 208
 						$query_string .= "&";
209 209
 					}
210 210
 					$query_string .= "error=1";
@@ -215,46 +215,46 @@  discard block
 block discarded – undo
215 215
 
216 216
 				// Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length)
217 217
 				//   and use a javascript form submission if that is the case.
218
-			    if(headers_sent() || strlen($redirect_url) > 2083){
219
-    				echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
220
-    				echo '<form name="redirect" action="' .$_POST['redirect_url']. '" method="GET">';
218
+			    if (headers_sent() || strlen($redirect_url) > 2083) {
219
+    				echo '<html '.get_language_header().'><head><title>SugarCRM</title></head><body>';
220
+    				echo '<form name="redirect" action="'.$_POST['redirect_url'].'" method="GET">';
221 221
     
222
-    				foreach($_POST as $param => $value) {
223
-    					if($param != 'redirect_url' ||$param != 'submit') {
222
+    				foreach ($_POST as $param => $value) {
223
+    					if ($param != 'redirect_url' || $param != 'submit') {
224 224
     						echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
225 225
     					}
226 226
     				}
227
-    				if(empty($lead)) {
227
+    				if (empty($lead)) {
228 228
     					echo '<input type="hidden" name="error" value="1">';
229 229
     				}
230 230
     				echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231 231
     				echo '</body></html>';
232 232
     			}
233
-				else{
233
+				else {
234 234
     				header("Location: {$redirect_url}");
235 235
     				die();
236 236
 			    }
237 237
 			}
238
-			else{
238
+			else {
239 239
 				echo $mod_strings['LBL_THANKS_FOR_SUBMITTING_LEAD'];
240 240
 			}
241 241
 			sugar_cleanup();
242 242
 			// die to keep code from running into redirect case below
243 243
 			die();
244 244
 	    }
245
-	   else{
245
+	   else {
246 246
 	  	  echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
247 247
 	  }
248 248
 }
249 249
 
250 250
 if (!empty($_POST['redirect'])) {
251
-    if(headers_sent()){
252
-    	echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
253
-    	echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
251
+    if (headers_sent()) {
252
+    	echo '<html '.get_language_header().'><head><title>SugarCRM</title></head><body>';
253
+    	echo '<form name="redirect" action="'.$_POST['redirect'].'" method="GET">';
254 254
     	echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
255 255
     	echo '</body></html>';
256 256
     }
257
-    else{
257
+    else {
258 258
     	header("Location: {$_POST['redirect']}");
259 259
     	die();
260 260
     }
Please login to merge, or discard this patch.
Braces   +13 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -157,8 +159,7 @@  discard block
 block discarded – undo
157 159
 		        $lead->campaigns->add($camplog->id);
158 160
                 if(!empty($GLOBALS['check_notify'])) {
159 161
                     $lead->save($GLOBALS['check_notify']);
160
-                }
161
-                else {
162
+                } else {
162 163
                     $lead->save(FALSE);
163 164
                 }
164 165
             }
@@ -188,14 +189,14 @@  discard block
 block discarded – undo
188 189
 				$get_and_post = array_merge($_GET, $_POST);
189 190
 				foreach($get_and_post as $param => $value) {
190 191
 
191
-					if($param == 'redirect_url' && $param == 'submit')
192
-						continue;
192
+					if($param == 'redirect_url' && $param == 'submit') {
193
+											continue;
194
+					}
193 195
 					
194 196
 					if($first_iteration){
195 197
 						$first_iteration = false;
196 198
 						$query_string .= $first_char;
197
-					}
198
-					else{
199
+					} else{
199 200
 						$query_string .= "&";
200 201
 					}
201 202
 					$query_string .= "{$param}=".urlencode($value);
@@ -203,8 +204,7 @@  discard block
 block discarded – undo
203 204
 				if(empty($lead)) {
204 205
 					if($first_iteration){
205 206
 						$query_string .= $first_char;
206
-					}
207
-					else{
207
+					} else{
208 208
 						$query_string .= "&";
209 209
 					}
210 210
 					$query_string .= "error=1";
@@ -229,20 +229,17 @@  discard block
 block discarded – undo
229 229
     				}
230 230
     				echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231 231
     				echo '</body></html>';
232
-    			}
233
-				else{
232
+    			} else{
234 233
     				header("Location: {$redirect_url}");
235 234
     				die();
236 235
 			    }
237
-			}
238
-			else{
236
+			} else{
239 237
 				echo $mod_strings['LBL_THANKS_FOR_SUBMITTING_LEAD'];
240 238
 			}
241 239
 			sugar_cleanup();
242 240
 			// die to keep code from running into redirect case below
243 241
 			die();
244
-	    }
245
-	   else{
242
+	    } else{
246 243
 	  	  echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
247 244
 	  }
248 245
 }
@@ -253,8 +250,7 @@  discard block
 block discarded – undo
253 250
     	echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
254 251
     	echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
255 252
     	echo '</body></html>';
256
-    }
257
-    else{
253
+    } else{
258 254
     	header("Location: {$_POST['redirect']}");
259 255
     	die();
260 256
     }
Please login to merge, or discard this patch.
Indentation   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -55,16 +55,16 @@  discard block
 block discarded – undo
55 55
  * To make your changes upgrade safe create a file called leadCapture_override.php and place the changes there
56 56
  */
57 57
 $users = array(
58
-	'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
58
+    'PUT A RANDOM KEY FROM THE WEBSITE HERE' => array('name'=>'PUT THE USER_NAME HERE', 'pass'=>'PUT THE USER_HASH FOR THE RESPECTIVE USER HERE'),
59 59
 );
60 60
 
61 61
 if (isset($_POST['campaign_id']) && !empty($_POST['campaign_id'])) {
62
-	    //adding the client ip address
63
-	    $_POST['client_id_address'] = query_client_ip();
64
-		$campaign_id=$_POST['campaign_id'];
65
-		$campaign = new Campaign();
66
-		$camp_query  = "select name,id from campaigns where id='$campaign_id'";
67
-		$camp_query .= " and deleted=0";
62
+        //adding the client ip address
63
+        $_POST['client_id_address'] = query_client_ip();
64
+        $campaign_id=$_POST['campaign_id'];
65
+        $campaign = new Campaign();
66
+        $camp_query  = "select name,id from campaigns where id='$campaign_id'";
67
+        $camp_query .= " and deleted=0";
68 68
         $camp_result=$campaign->db->query($camp_query);
69 69
         $camp_data = $campaign->db->fetchByAssoc($camp_result);
70 70
         // Bug 41292 - have to select marketing_id for new lead
@@ -78,20 +78,20 @@  discard block
 block discarded – undo
78 78
         $marketing_result = $db->limitQuery($marketing_query, 0, 1, true);
79 79
         $marketing_data = $db->fetchByAssoc($marketing_result);
80 80
         // .Bug 41292
81
-		if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) {
82
-			$current_user = new User();
83
-			$current_user->retrieve($_REQUEST['assigned_user_id']);
84
-		} 
81
+        if (isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id'])) {
82
+            $current_user = new User();
83
+            $current_user->retrieve($_REQUEST['assigned_user_id']);
84
+        } 
85 85
 
86
-	    if(isset($camp_data) && $camp_data != null ){
87
-			$leadForm = new LeadFormBase();
86
+        if(isset($camp_data) && $camp_data != null ){
87
+            $leadForm = new LeadFormBase();
88 88
             $lead = new Lead();
89
-			$prefix = '';
90
-			if(!empty($_POST['prefix'])){
91
-				$prefix = $_POST['prefix'];
92
-			}
89
+            $prefix = '';
90
+            if(!empty($_POST['prefix'])){
91
+                $prefix = $_POST['prefix'];
92
+            }
93 93
 
94
-			if(empty($lead->id)) {
94
+            if(empty($lead->id)) {
95 95
                 $lead->id = create_guid();
96 96
                 $lead->new_with_id = true;
97 97
             }
@@ -114,47 +114,47 @@  discard block
 block discarded – undo
114 114
             // checkRequired needs a major overhaul before it works for web to lead forms.
115 115
             $lead = $leadForm->handleSave($prefix, false, false, false, $lead);
116 116
             
117
-			if(!empty($lead)){
117
+            if(!empty($lead)){
118 118
 				
119
-	            //create campaign log
120
-	            $camplog = new CampaignLog();
121
-	            $camplog->campaign_id  = $_POST['campaign_id'];
122
-	            $camplog->related_id   = $lead->id;
123
-	            $camplog->related_type = $lead->module_dir;
124
-	            $camplog->activity_type = "lead";
125
-	            $camplog->target_type = $lead->module_dir;
126
-	            $campaign_log->activity_date=$timedate->now();
127
-	            $camplog->target_id    = $lead->id;
119
+                //create campaign log
120
+                $camplog = new CampaignLog();
121
+                $camplog->campaign_id  = $_POST['campaign_id'];
122
+                $camplog->related_id   = $lead->id;
123
+                $camplog->related_type = $lead->module_dir;
124
+                $camplog->activity_type = "lead";
125
+                $camplog->target_type = $lead->module_dir;
126
+                $campaign_log->activity_date=$timedate->now();
127
+                $camplog->target_id    = $lead->id;
128 128
                 if(isset($marketing_data['id']))
129 129
                 {
130 130
                     $camplog->marketing_id = $marketing_data['id'];
131 131
                 }
132
-	            $camplog->save();
132
+                $camplog->save();
133 133
 
134
-		        //link campaignlog and lead
134
+                //link campaignlog and lead
135 135
 
136
-		        if (isset($_POST['email1']) && $_POST['email1'] != null)
136
+                if (isset($_POST['email1']) && $_POST['email1'] != null)
137 137
                 {
138 138
                     $lead->email1 = $_POST['email1'];
139
-		        } 
139
+                } 
140 140
                 //in case there are old forms used webtolead_email1
141 141
                 elseif (isset($_POST['webtolead_email1']) && $_POST['webtolead_email1'] != null)
142 142
                 {
143 143
                     $lead->email1 = $_POST['webtolead_email1'];
144 144
                 }
145 145
                 
146
-		        if (isset($_POST['email2']) && $_POST['email2'] != null)
146
+                if (isset($_POST['email2']) && $_POST['email2'] != null)
147 147
                 {
148 148
                     $lead->email2 = $_POST['email2'];
149
-		        } 
149
+                } 
150 150
                 //in case there are old forms used webtolead_email2
151 151
                 elseif (isset($_POST['webtolead_email2']) && $_POST['webtolead_email2'] != null)
152 152
                 {
153 153
                     $lead->email2 = $_POST['webtolead_email2'];
154 154
                 }
155 155
                 
156
-		        $lead->load_relationship('campaigns');
157
-		        $lead->campaigns->add($camplog->id);
156
+                $lead->load_relationship('campaigns');
157
+                $lead->campaigns->add($camplog->id);
158 158
                 if(!empty($GLOBALS['check_notify'])) {
159 159
                     $lead->save($GLOBALS['check_notify']);
160 160
                 }
@@ -176,87 +176,87 @@  discard block
 block discarded – undo
176 176
                     
177 177
                 }
178 178
             }              
179
-			if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
180
-			    // Get the redirect url, and make sure the query string is not too long
181
-		        $redirect_url = $_POST['redirect_url'];
182
-		        $query_string = '';
183
-				$first_char = '&';
184
-				if(strpos($redirect_url, '?') === FALSE){
185
-					$first_char = '?';
186
-				}
187
-				$first_iteration = true;
188
-				$get_and_post = array_merge($_GET, $_POST);
189
-				foreach($get_and_post as $param => $value) {
179
+            if(isset($_POST['redirect_url']) && !empty($_POST['redirect_url'])){
180
+                // Get the redirect url, and make sure the query string is not too long
181
+                $redirect_url = $_POST['redirect_url'];
182
+                $query_string = '';
183
+                $first_char = '&';
184
+                if(strpos($redirect_url, '?') === FALSE){
185
+                    $first_char = '?';
186
+                }
187
+                $first_iteration = true;
188
+                $get_and_post = array_merge($_GET, $_POST);
189
+                foreach($get_and_post as $param => $value) {
190 190
 
191
-					if($param == 'redirect_url' && $param == 'submit')
192
-						continue;
191
+                    if($param == 'redirect_url' && $param == 'submit')
192
+                        continue;
193 193
 					
194
-					if($first_iteration){
195
-						$first_iteration = false;
196
-						$query_string .= $first_char;
197
-					}
198
-					else{
199
-						$query_string .= "&";
200
-					}
201
-					$query_string .= "{$param}=".urlencode($value);
202
-				}
203
-				if(empty($lead)) {
204
-					if($first_iteration){
205
-						$query_string .= $first_char;
206
-					}
207
-					else{
208
-						$query_string .= "&";
209
-					}
210
-					$query_string .= "error=1";
211
-				}
194
+                    if($first_iteration){
195
+                        $first_iteration = false;
196
+                        $query_string .= $first_char;
197
+                    }
198
+                    else{
199
+                        $query_string .= "&";
200
+                    }
201
+                    $query_string .= "{$param}=".urlencode($value);
202
+                }
203
+                if(empty($lead)) {
204
+                    if($first_iteration){
205
+                        $query_string .= $first_char;
206
+                    }
207
+                    else{
208
+                        $query_string .= "&";
209
+                    }
210
+                    $query_string .= "error=1";
211
+                }
212 212
 				
213
-				$redirect_url = $redirect_url.$query_string;
213
+                $redirect_url = $redirect_url.$query_string;
214 214
 
215 215
 
216
-				// Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length)
217
-				//   and use a javascript form submission if that is the case.
218
-			    if(headers_sent() || strlen($redirect_url) > 2083){
219
-    				echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
220
-    				echo '<form name="redirect" action="' .$_POST['redirect_url']. '" method="GET">';
216
+                // Check if the headers have been sent, or if the redirect url is greater than 2083 characters (IE max URL length)
217
+                //   and use a javascript form submission if that is the case.
218
+                if(headers_sent() || strlen($redirect_url) > 2083){
219
+                    echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
220
+                    echo '<form name="redirect" action="' .$_POST['redirect_url']. '" method="GET">';
221 221
     
222
-    				foreach($_POST as $param => $value) {
223
-    					if($param != 'redirect_url' ||$param != 'submit') {
224
-    						echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
225
-    					}
226
-    				}
227
-    				if(empty($lead)) {
228
-    					echo '<input type="hidden" name="error" value="1">';
229
-    				}
230
-    				echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231
-    				echo '</body></html>';
232
-    			}
233
-				else{
234
-    				header("Location: {$redirect_url}");
235
-    				die();
236
-			    }
237
-			}
238
-			else{
239
-				echo $mod_strings['LBL_THANKS_FOR_SUBMITTING'];
240
-			}
241
-			sugar_cleanup();
242
-			// die to keep code from running into redirect case below
243
-			die();
244
-	    }
245
-	   else{
246
-	  	  echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
247
-	  }
222
+                    foreach($_POST as $param => $value) {
223
+                        if($param != 'redirect_url' ||$param != 'submit') {
224
+                            echo '<input type="hidden" name="'.$param.'" value="'.$value.'">';
225
+                        }
226
+                    }
227
+                    if(empty($lead)) {
228
+                        echo '<input type="hidden" name="error" value="1">';
229
+                    }
230
+                    echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
231
+                    echo '</body></html>';
232
+                }
233
+                else{
234
+                    header("Location: {$redirect_url}");
235
+                    die();
236
+                }
237
+            }
238
+            else{
239
+                echo $mod_strings['LBL_THANKS_FOR_SUBMITTING'];
240
+            }
241
+            sugar_cleanup();
242
+            // die to keep code from running into redirect case below
243
+            die();
244
+        }
245
+        else{
246
+            echo $mod_strings['LBL_SERVER_IS_CURRENTLY_UNAVAILABLE'];
247
+        }
248 248
 }
249 249
 
250 250
 if (!empty($_POST['redirect'])) {
251 251
     if(headers_sent()){
252
-    	echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
253
-    	echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
254
-    	echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
255
-    	echo '</body></html>';
252
+        echo '<html ' . get_language_header() . '><head><title>SugarCRM</title></head><body>';
253
+        echo '<form name="redirect" action="' .$_POST['redirect']. '" method="GET">';
254
+        echo '</form><script language="javascript" type="text/javascript">document.redirect.submit();</script>';
255
+        echo '</body></html>';
256 256
     }
257 257
     else{
258
-    	header("Location: {$_POST['redirect']}");
259
-    	die();
258
+        header("Location: {$_POST['redirect']}");
259
+        die();
260 260
     }
261 261
 }
262 262
 
Please login to merge, or discard this patch.
modules/Campaigns/DeleteTestCampaigns.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,8 +66,8 @@
 block discarded – undo
66 66
     $test_ids = array();
67 67
     $test_list_ids = array();
68 68
     while($row = $focus->db->fetchByAssoc($res)) {
69
-       $test_ids[] = $row['emailid'];
70
-       $test_list_ids[$row['listid']] = true;
69
+        $test_ids[] = $row['emailid'];
70
+        $test_list_ids[$row['listid']] = true;
71 71
     }
72 72
     $test_list_ids = array_keys($test_list_ids);
73 73
     unset($res);
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  */
56 56
 function deleteTestRecords($focus)
57 57
 {
58
-    if(empty($focus) || empty($focus->id))
58
+    if (empty($focus) || empty($focus->id))
59 59
     {
60 60
         return;
61 61
     }
@@ -65,17 +65,17 @@  discard block
 block discarded – undo
65 65
             WHERE campaign_log.campaign_id = '{$focus->id}' AND prospect_lists.list_type='test'");
66 66
     $test_ids = array();
67 67
     $test_list_ids = array();
68
-    while($row = $focus->db->fetchByAssoc($res)) {
68
+    while ($row = $focus->db->fetchByAssoc($res)) {
69 69
        $test_ids[] = $row['emailid'];
70 70
        $test_list_ids[$row['listid']] = true;
71 71
     }
72 72
     $test_list_ids = array_keys($test_list_ids);
73 73
     unset($res);
74
-    if(!empty($test_ids)) {
74
+    if (!empty($test_ids)) {
75 75
         $focus->db->query("UPDATE emails SET deleted=1 WHERE id IN ('".join("','", $test_ids)."')");
76 76
     }
77 77
 
78
-    if(!empty($test_list_ids)) {
78
+    if (!empty($test_list_ids)) {
79 79
         $query = "DELETE FROM emailman WHERE campaign_id = '{$focus->id}' AND list_id IN ('".join("','", $test_list_ids)."')";
80 80
         $focus->db->query($query);
81 81
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
modules/Campaigns/WizardEmailSetup.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
 if(isset($mbox) && count($mbox)>0){
138 138
     $mboxTable .= "<tr><td colspan='5'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK_WIZ_GOOD']." </b>.</td></tr>";
139 139
         $mboxTable .= "<tr class='listViewHRS1'><td width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></td>"
140
-                   .  " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>"
141
-                   .  " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>" 
142
-                   .  " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>"
143
-                   .  " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>";
140
+                    .  " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>"
141
+                    .  " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>" 
142
+                    .  " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>"
143
+                    .  " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>";
144 144
     $colorclass=' ';
145 145
     foreach($mbox as $details){
146 146
                 
147
-     if( $colorclass == "class='evenListRowS1'"){
147
+        if( $colorclass == "class='evenListRowS1'"){
148 148
             $colorclass= "class='oddListRowS1'";
149 149
         }else{ 
150 150
             $colorclass= "class='evenListRowS1'";
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 /**************************** WIZARD UI DIV Stuff *******************/
176 176
   
177 177
 //  this is the wizard control script that resides in page    
178
- $divScript = <<<EOQ
178
+    $divScript = <<<EOQ
179 179
  <script type="text/javascript" language="javascript">  
180 180
 
181 181
     //this function toggles visibility of fields based on selected options
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
 
53 53
 
54 54
 
55
-global $mod_strings,$app_list_strings,$app_strings,$current_user;
55
+global $mod_strings, $app_list_strings, $app_strings, $current_user;
56 56
 
57 57
 
58
-if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns')) sugar_die("Unauthorized access to administration.");
58
+if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) sugar_die("Unauthorized access to administration.");
59 59
 
60 60
 $params = array();
61 61
 $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
@@ -101,25 +101,25 @@  discard block
 block discarded – undo
101 101
 $ss->assign('PROTOCOL', get_select_options_with_id($protocol, ''));
102 102
 if (isset($focus->settings['massemailer_campaign_emails_per_run']) && !empty($focus->settings['massemailer_campaign_emails_per_run'])) {
103 103
     $ss->assign("EMAILS_PER_RUN", $focus->settings['massemailer_campaign_emails_per_run']);
104
-} else  {
104
+} else {
105 105
     $ss->assign("EMAILS_PER_RUN", 500);
106 106
 }
107 107
 
108
-if (!isset($focus->settings['massemailer_tracking_entities_location_type']) or empty($focus->settings['massemailer_tracking_entities_location_type']) or $focus->settings['massemailer_tracking_entities_location_type']=='1') {
108
+if (!isset($focus->settings['massemailer_tracking_entities_location_type']) or empty($focus->settings['massemailer_tracking_entities_location_type']) or $focus->settings['massemailer_tracking_entities_location_type'] == '1') {
109 109
     $ss->assign("DEFAULT_CHECKED", "checked");
110 110
     $ss->assign("TRACKING_ENTRIES_LOCATION_STATE", "disabled");
111
-    $ss->assign("TRACKING_ENTRIES_LOCATION",$mod_strings['TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE']);
112
-} else  {
111
+    $ss->assign("TRACKING_ENTRIES_LOCATION", $mod_strings['TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE']);
112
+} else {
113 113
     $ss->assign("USERDEFINED_CHECKED", "checked");
114
-    $ss->assign("TRACKING_ENTRIES_LOCATION",$focus->settings["massemailer_tracking_entities_location"]);
114
+    $ss->assign("TRACKING_ENTRIES_LOCATION", $focus->settings["massemailer_tracking_entities_location"]);
115 115
 }
116 116
 
117
-$ss->assign("SITEURL",$sugar_config['site_url']);
117
+$ss->assign("SITEURL", $sugar_config['site_url']);
118 118
 
119 119
 // Change the default campaign to not store a copy of each message.
120
-if (!empty($focus->settings['massemailer_email_copy']) and $focus->settings['massemailer_email_copy']=='1') {
120
+if (!empty($focus->settings['massemailer_email_copy']) and $focus->settings['massemailer_email_copy'] == '1') {
121 121
     $ss->assign("YES_CHECKED", "checked='checked'");
122
-} else  {
122
+} else {
123 123
     $ss->assign("NO_CHECKED", "checked='checked'");
124 124
 }
125 125
 
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
 /*********** New Mail Box UI DIV Stuff ****************/
130 130
 $mbox_qry = "select * from inbound_email where deleted ='0' and mailbox_type = 'bounce'";
131 131
 $mbox_res = $focus->db->query($mbox_qry);
132
-while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)){$mbox[] = $mbox_row;}
132
+while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)) {$mbox[] = $mbox_row; }
133 133
 $mbox_msg = ' ';
134 134
 $need_mbox = '';  
135 135
 
136 136
 $mboxTable = "<table class='list view' width='100%' border='0' cellspacing='1' cellpadding='1'>";
137
-if(isset($mbox) && count($mbox)>0){
138
-    $mboxTable .= "<tr><td colspan='5'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK_WIZ_GOOD']." </b>.</td></tr>";
137
+if (isset($mbox) && count($mbox) > 0) {
138
+    $mboxTable .= "<tr><td colspan='5'><b>".count($mbox)." ".$mod_strings['LBL_MAILBOX_CHECK_WIZ_GOOD']." </b>.</td></tr>";
139 139
         $mboxTable .= "<tr class='listViewHRS1'><td width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></td>"
140 140
                    .  " <td width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></td>"
141 141
                    .  " <td width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></td>" 
142 142
                    .  " <td width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></td>"
143 143
                    .  " <td width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></td></tr>";
144
-    $colorclass=' ';
145
-    foreach($mbox as $details){
144
+    $colorclass = ' ';
145
+    foreach ($mbox as $details) {
146 146
                 
147
-     if( $colorclass == "class='evenListRowS1'"){
148
-            $colorclass= "class='oddListRowS1'";
149
-        }else{ 
150
-            $colorclass= "class='evenListRowS1'";
147
+     if ($colorclass == "class='evenListRowS1'") {
148
+            $colorclass = "class='oddListRowS1'";
149
+        } else { 
150
+            $colorclass = "class='evenListRowS1'";
151 151
         }           
152 152
         
153 153
         $mboxTable .= "<tr $colorclass>";
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
     }
160 160
 
161 161
 
162
-}else{
162
+} else {
163 163
 $need_mbox = 'checked';
164 164
 $mboxTable .= "<tr><td colspan='5'><b>".$mod_strings['LBL_MAILBOX_CHECK_WIZ_BAD']." </b>.</td></tr>";
165 165
 }        
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 $ss->assign("MAILBOXES_DETECTED_MESSAGE", $mboxTable);
168 168
 $ss->assign("MBOX_NEEDED", $need_mbox);          
169 169
 $ss->assign('ROLLOVER', $email->rolloverStyle);
170
-if(!function_exists('imap_open')) {
170
+if (!function_exists('imap_open')) {
171 171
     $ss->assign('IE_DISABLED', 'DISABLED');   
172 172
 }
173 173
 /**************************** SUMMARY UI DIV Stuff *******************/
@@ -406,13 +406,13 @@  discard block
 block discarded – undo
406 406
 </script>
407 407
 EOQ;
408 408
 
409
-if(isset($_REQUEST['error'])){
409
+if (isset($_REQUEST['error'])) {
410 410
     //if there is an error flagged, then we are coming here after a save where there was an error detected
411 411
     //on an inbound email save.  Display error to user so they are aware.
412 412
     $errorString = "<div class='error'>".$mod_strings['ERR_NO_OPTS_SAVED']."  <a href='index.php?module=InboundEmail&action=index'>".$mod_strings['ERR_REVIEW_EMAIL_SETTINGS']."</a></div>";
413 413
     $ss->assign('ERROR', $errorString);
414 414
     //navigate to inbound email page by default
415
-    $divScript .=" <script>navigate('next');</script>";
415
+    $divScript .= " <script>navigate('next');</script>";
416 416
 }
417 417
 
418 418
 $ss->assign("DIV_JAVASCRIPT", $divScript);
Please login to merge, or discard this patch.
Braces   +17 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,7 +57,9 @@  discard block
 block discarded – undo
55 57
 global $mod_strings,$app_list_strings,$app_strings,$current_user;
56 58
 
57 59
 
58
-if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns')) sugar_die("Unauthorized access to administration.");
60
+if (!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns')) {
61
+    sugar_die("Unauthorized access to administration.");
62
+}
59 63
 
60 64
 $params = array();
61 65
 $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
@@ -78,9 +82,15 @@  discard block
 block discarded – undo
78 82
 $ss = new Sugar_Smarty();
79 83
 $ss->assign("MOD", $mod_strings);
80 84
 $ss->assign("APP", $app_strings);
81
-if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
82
-if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
83
-if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
85
+if (isset($_REQUEST['return_module'])) {
86
+    $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
87
+}
88
+if (isset($_REQUEST['return_action'])) {
89
+    $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
90
+}
91
+if (isset($_REQUEST['return_id'])) {
92
+    $ss->assign("RETURN_ID", $_REQUEST['return_id']);
93
+}
84 94
 
85 95
 
86 96
 
@@ -146,7 +156,7 @@  discard block
 block discarded – undo
146 156
                 
147 157
      if( $colorclass == "class='evenListRowS1'"){
148 158
             $colorclass= "class='oddListRowS1'";
149
-        }else{ 
159
+        } else{ 
150 160
             $colorclass= "class='evenListRowS1'";
151 161
         }           
152 162
         
@@ -159,7 +169,7 @@  discard block
 block discarded – undo
159 169
     }
160 170
 
161 171
 
162
-}else{
172
+} else{
163 173
 $need_mbox = 'checked';
164 174
 $mboxTable .= "<tr><td colspan='5'><b>".$mod_strings['LBL_MAILBOX_CHECK_WIZ_BAD']." </b>.</td></tr>";
165 175
 }        
Please login to merge, or discard this patch.
modules/Campaigns/ProcessBouncedEmails.php 4 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     $query = "SELECT description FROM notes WHERE file_mime_type = 'messsage/rfc822' AND parent_type='Emails' AND parent_id = '".$email->id."' AND deleted=0";
57 57
     $rs = $GLOBALS['db']->query($query);
58 58
     while ($row = $GLOBALS['db']->fetchByAssoc($rs)) 
59
-		$contents .= $row['description'];
59
+        $contents .= $row['description'];
60 60
 
61 61
     return $contents;
62 62
 }
@@ -162,80 +162,80 @@  discard block
 block discarded – undo
162 162
 
163 163
 function campaign_process_bounced_emails(&$email, &$email_header) 
164 164
 {
165
-	global $sugar_config;
166
-	$emailFromAddress = $email_header->fromaddress;
167
-	$email_description = $email->raw_source;
165
+    global $sugar_config;
166
+    $emailFromAddress = $email_header->fromaddress;
167
+    $email_description = $email->raw_source;
168 168
     	
169
-	//if raw_source is empty, try using the description instead
170
-    	if (empty($email_description)){
171
-        	$email_description = $email->description;
172
-	}
169
+    //if raw_source is empty, try using the description instead
170
+        if (empty($email_description)){
171
+            $email_description = $email->description;
172
+    }
173 173
 
174 174
     $email_description .= retrieveErrorReportAttachment($email);
175 175
 
176
-	if (preg_match('/MAILER-DAEMON|POSTMASTER/i',$emailFromAddress)) 
177
-	{
178
-	    $email_description=quoted_printable_decode($email_description);
179
-		$matches=array();
176
+    if (preg_match('/MAILER-DAEMON|POSTMASTER/i',$emailFromAddress)) 
177
+    {
178
+        $email_description=quoted_printable_decode($email_description);
179
+        $matches=array();
180 180
 		
181
-		//do we have the identifier tag in the email?
182
-		$identifierScanResults = checkBouncedEmailForIdentifier($email_description);
181
+        //do we have the identifier tag in the email?
182
+        $identifierScanResults = checkBouncedEmailForIdentifier($email_description);
183 183
 		
184
-		if ( $identifierScanResults['found'] ) 
185
-		{
186
-			$matches = $identifierScanResults['matches'];
187
-			$identifiers = $identifierScanResults['identifiers'];
188
-
189
-			if (!empty($identifiers)) 
190
-			{
191
-				//array should have only one element in it.
192
-				$identifier = trim($identifiers[0]);
193
-				$row = getExistingCampaignLogEntry($identifier);
184
+        if ( $identifierScanResults['found'] ) 
185
+        {
186
+            $matches = $identifierScanResults['matches'];
187
+            $identifiers = $identifierScanResults['identifiers'];
188
+
189
+            if (!empty($identifiers)) 
190
+            {
191
+                //array should have only one element in it.
192
+                $identifier = trim($identifiers[0]);
193
+                $row = getExistingCampaignLogEntry($identifier);
194 194
 				
195
-				//Found entry
196
-				if (!empty($row)) 
197
-				{
198
-					//do not create another campaign_log record is we already have an
199
-					//invalid email or send error entry for this tracker key.
200
-					$query_log = "select * from campaign_log where target_tracker_key='{$row['target_tracker_key']}'"; 
201
-					$query_log .=" and (activity_type='invalid email' or activity_type='send error')";
195
+                //Found entry
196
+                if (!empty($row)) 
197
+                {
198
+                    //do not create another campaign_log record is we already have an
199
+                    //invalid email or send error entry for this tracker key.
200
+                    $query_log = "select * from campaign_log where target_tracker_key='{$row['target_tracker_key']}'"; 
201
+                    $query_log .=" and (activity_type='invalid email' or activity_type='send error')";
202 202
                     $targeted = new CampaignLog();
203
-					$result_log=$targeted->db->query($query_log);
204
-					$row_log=$targeted->db->fetchByAssoc($result_log);
205
-
206
-					if (empty($row_log)) 
207
-					{
208
-						$return_id = createBouncedCampaignLogEntry($row, $email, $email_description);	
209
-						return TRUE;
210
-					}				
211
-					else 
212
-					{
213
-					    $GLOBALS['log']->debug("Warning: campaign log entry already exists for identifier $identifier");
214
-					    return FALSE;
215
-					}
216
-				} 
217
-				else 
218
-				{
219
-				    $GLOBALS['log']->info("Warning: skipping bounced email with this tracker_key(identifier) in the message body: ".$identifier);
220
-					return FALSE;
221
-				}			
222
-    		} 
223
-    		else 
224
-    		{
225
-    			$GLOBALS['log']->info("Warning: Empty identifier for campaign log.");
226
-    			return FALSE;
227
-    		}
228
-    	}  
229
-    	else 
230
-    	{
231
-    	    $GLOBALS['log']->info("Warning: skipping bounced email because it does not have the removeme link.");	
232
-    		return FALSE;	
233
-      	}
234
-  } 
235
-  else 
236
-  {
237
-	$GLOBALS['log']->info("Warning: skipping bounced email because the sender is not MAILER-DAEMON.");
238
-	return FALSE;
239
-  }
203
+                    $result_log=$targeted->db->query($query_log);
204
+                    $row_log=$targeted->db->fetchByAssoc($result_log);
205
+
206
+                    if (empty($row_log)) 
207
+                    {
208
+                        $return_id = createBouncedCampaignLogEntry($row, $email, $email_description);	
209
+                        return TRUE;
210
+                    }				
211
+                    else 
212
+                    {
213
+                        $GLOBALS['log']->debug("Warning: campaign log entry already exists for identifier $identifier");
214
+                        return FALSE;
215
+                    }
216
+                } 
217
+                else 
218
+                {
219
+                    $GLOBALS['log']->info("Warning: skipping bounced email with this tracker_key(identifier) in the message body: ".$identifier);
220
+                    return FALSE;
221
+                }			
222
+            } 
223
+            else 
224
+            {
225
+                $GLOBALS['log']->info("Warning: Empty identifier for campaign log.");
226
+                return FALSE;
227
+            }
228
+        }  
229
+        else 
230
+        {
231
+            $GLOBALS['log']->info("Warning: skipping bounced email because it does not have the removeme link.");	
232
+            return FALSE;	
233
+            }
234
+    } 
235
+    else 
236
+    {
237
+    $GLOBALS['log']->info("Warning: skipping bounced email because the sender is not MAILER-DAEMON.");
238
+    return FALSE;
239
+    }
240 240
 }
241 241
 ?>
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -69,31 +69,31 @@  discard block
 block discarded – undo
69 69
  * @param string $email_description
70 70
  * @return string
71 71
  */
72
-function createBouncedCampaignLogEntry($row,$email, $email_description)
72
+function createBouncedCampaignLogEntry($row, $email, $email_description)
73 73
 {
74 74
     $GLOBALS['log']->debug("Creating bounced email campaign log");
75 75
     $bounce = new CampaignLog();
76
-    $bounce->campaign_id=$row['campaign_id'];
77
-    $bounce->target_tracker_key=$row['target_tracker_key'];
78
-    $bounce->target_id= $row['target_id'];
79
-    $bounce->target_type=$row['target_type'];
80
-    $bounce->list_id=$row['list_id'];
81
-    $bounce->marketing_id=$row['marketing_id'];
76
+    $bounce->campaign_id = $row['campaign_id'];
77
+    $bounce->target_tracker_key = $row['target_tracker_key'];
78
+    $bounce->target_id = $row['target_id'];
79
+    $bounce->target_type = $row['target_type'];
80
+    $bounce->list_id = $row['list_id'];
81
+    $bounce->marketing_id = $row['marketing_id'];
82 82
 
83
-    $bounce->activity_date=$email->date_created;
84
-    $bounce->related_type='Emails';
85
-    $bounce->related_id= $email->id;
83
+    $bounce->activity_date = $email->date_created;
84
+    $bounce->related_type = 'Emails';
85
+    $bounce->related_id = $email->id;
86 86
 
87 87
     //do we have the phrase permanent error in the email body.
88
-    if (preg_match('/permanent[ ]*error/',$email_description))
88
+    if (preg_match('/permanent[ ]*error/', $email_description))
89 89
     {
90
-        $bounce->activity_type='invalid email';
90
+        $bounce->activity_type = 'invalid email';
91 91
         markEmailAddressInvalid($email);
92 92
     }
93 93
     else 
94
-        $bounce->activity_type='send error';
94
+        $bounce->activity_type = 'send error';
95 95
         
96
-    $return_id=$bounce->save();
96
+    $return_id = $bounce->save();
97 97
     return $return_id;
98 98
 }
99 99
 
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
  */
105 105
 function markEmailAddressInvalid($email_address)
106 106
 {
107
-    if(empty($email_address))
107
+    if (empty($email_address))
108 108
         return;
109 109
     $sea = new SugarEmailAddress();
110
-    $rs = $sea->retrieve_by_string_fields( array('email_address_caps' => trim(strtoupper($email_address))) );
111
-    if($rs != null)
110
+    $rs = $sea->retrieve_by_string_fields(array('email_address_caps' => trim(strtoupper($email_address))));
111
+    if ($rs != null)
112 112
     {
113 113
         $sea->AddUpdateEmailAddress($email_address, 1, 0, $rs->id);
114 114
     }
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
 {
125 125
     $row = FALSE;
126 126
     $targeted = new CampaignLog();
127
-    $where="campaign_log.activity_type='targeted' and campaign_log.target_tracker_key='{$identifier}'";
128
-    $query=$targeted->create_new_list_query('',$where);
129
-    $result=$targeted->db->query($query);
130
-    $row=$targeted->db->fetchByAssoc($result);
127
+    $where = "campaign_log.activity_type='targeted' and campaign_log.target_tracker_key='{$identifier}'";
128
+    $query = $targeted->create_new_list_query('', $where);
129
+    $result = $targeted->db->query($query);
130
+    $row = $targeted->db->fetchByAssoc($result);
131 131
     
132 132
     return $row;
133 133
 }
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
     $identifiers = array();
145 145
     $found = FALSE;
146 146
     //Check if the identifier is present in the header.
147
-    if(preg_match('/X-CampTrackID: [a-z0-9\-]*/',$email_description,$matches)) 
147
+    if (preg_match('/X-CampTrackID: [a-z0-9\-]*/', $email_description, $matches)) 
148 148
     {
149
-        $identifiers = preg_split('/X-CampTrackID: /',$matches[0],-1,PREG_SPLIT_NO_EMPTY);
149
+        $identifiers = preg_split('/X-CampTrackID: /', $matches[0], -1, PREG_SPLIT_NO_EMPTY);
150 150
         $found = TRUE;
151 151
         $GLOBALS['log']->debug("Found campaign identifier in header of email");  
152 152
     }
153
-    else if( preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/',$email_description, $matches) )
153
+    else if (preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/', $email_description, $matches))
154 154
     {
155
-        $identifiers = preg_split('/index.php\?entryPoint=removeme&identifier=/',$matches[0],-1,PREG_SPLIT_NO_EMPTY);
155
+        $identifiers = preg_split('/index.php\?entryPoint=removeme&identifier=/', $matches[0], -1, PREG_SPLIT_NO_EMPTY);
156 156
         $found = TRUE;
157 157
         $GLOBALS['log']->debug("Found campaign identifier in body of email");
158 158
     }
@@ -167,21 +167,21 @@  discard block
 block discarded – undo
167 167
 	$email_description = $email->raw_source;
168 168
     	
169 169
 	//if raw_source is empty, try using the description instead
170
-    	if (empty($email_description)){
170
+    	if (empty($email_description)) {
171 171
         	$email_description = $email->description;
172 172
 	}
173 173
 
174 174
     $email_description .= retrieveErrorReportAttachment($email);
175 175
 
176
-	if (preg_match('/MAILER-DAEMON|POSTMASTER/i',$emailFromAddress)) 
176
+	if (preg_match('/MAILER-DAEMON|POSTMASTER/i', $emailFromAddress)) 
177 177
 	{
178
-	    $email_description=quoted_printable_decode($email_description);
179
-		$matches=array();
178
+	    $email_description = quoted_printable_decode($email_description);
179
+		$matches = array();
180 180
 		
181 181
 		//do we have the identifier tag in the email?
182 182
 		$identifierScanResults = checkBouncedEmailForIdentifier($email_description);
183 183
 		
184
-		if ( $identifierScanResults['found'] ) 
184
+		if ($identifierScanResults['found']) 
185 185
 		{
186 186
 			$matches = $identifierScanResults['matches'];
187 187
 			$identifiers = $identifierScanResults['identifiers'];
@@ -198,10 +198,10 @@  discard block
 block discarded – undo
198 198
 					//do not create another campaign_log record is we already have an
199 199
 					//invalid email or send error entry for this tracker key.
200 200
 					$query_log = "select * from campaign_log where target_tracker_key='{$row['target_tracker_key']}'"; 
201
-					$query_log .=" and (activity_type='invalid email' or activity_type='send error')";
201
+					$query_log .= " and (activity_type='invalid email' or activity_type='send error')";
202 202
                     $targeted = new CampaignLog();
203
-					$result_log=$targeted->db->query($query_log);
204
-					$row_log=$targeted->db->fetchByAssoc($result_log);
203
+					$result_log = $targeted->db->query($query_log);
204
+					$row_log = $targeted->db->fetchByAssoc($result_log);
205 205
 
206 206
 					if (empty($row_log)) 
207 207
 					{
Please login to merge, or discard this patch.
Braces   +17 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -55,8 +57,9 @@  discard block
 block discarded – undo
55 57
     $contents = "";
56 58
     $query = "SELECT description FROM notes WHERE file_mime_type = 'messsage/rfc822' AND parent_type='Emails' AND parent_id = '".$email->id."' AND deleted=0";
57 59
     $rs = $GLOBALS['db']->query($query);
58
-    while ($row = $GLOBALS['db']->fetchByAssoc($rs)) 
59
-		$contents .= $row['description'];
60
+    while ($row = $GLOBALS['db']->fetchByAssoc($rs)) {
61
+    		$contents .= $row['description'];
62
+    }
60 63
 
61 64
     return $contents;
62 65
 }
@@ -89,9 +92,9 @@  discard block
 block discarded – undo
89 92
     {
90 93
         $bounce->activity_type='invalid email';
91 94
         markEmailAddressInvalid($email);
95
+    } else {
96
+            $bounce->activity_type='send error';
92 97
     }
93
-    else 
94
-        $bounce->activity_type='send error';
95 98
         
96 99
     $return_id=$bounce->save();
97 100
     return $return_id;
@@ -104,8 +107,9 @@  discard block
 block discarded – undo
104 107
  */
105 108
 function markEmailAddressInvalid($email_address)
106 109
 {
107
-    if(empty($email_address))
108
-        return;
110
+    if(empty($email_address)) {
111
+            return;
112
+    }
109 113
     $sea = new SugarEmailAddress();
110 114
     $rs = $sea->retrieve_by_string_fields( array('email_address_caps' => trim(strtoupper($email_address))) );
111 115
     if($rs != null)
@@ -149,8 +153,7 @@  discard block
 block discarded – undo
149 153
         $identifiers = preg_split('/X-CampTrackID: /',$matches[0],-1,PREG_SPLIT_NO_EMPTY);
150 154
         $found = TRUE;
151 155
         $GLOBALS['log']->debug("Found campaign identifier in header of email");  
152
-    }
153
-    else if( preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/',$email_description, $matches) )
156
+    } else if( preg_match('/index.php\?entryPoint=removeme&identifier=[a-z0-9\-]*/',$email_description, $matches) )
154 157
     {
155 158
         $identifiers = preg_split('/index.php\?entryPoint=removeme&identifier=/',$matches[0],-1,PREG_SPLIT_NO_EMPTY);
156 159
         $found = TRUE;
@@ -207,32 +210,27 @@  discard block
 block discarded – undo
207 210
 					{
208 211
 						$return_id = createBouncedCampaignLogEntry($row, $email, $email_description);	
209 212
 						return TRUE;
210
-					}				
211
-					else 
213
+					} else 
212 214
 					{
213 215
 					    $GLOBALS['log']->debug("Warning: campaign log entry already exists for identifier $identifier");
214 216
 					    return FALSE;
215 217
 					}
216
-				} 
217
-				else 
218
+				} else 
218 219
 				{
219 220
 				    $GLOBALS['log']->info("Warning: skipping bounced email with this tracker_key(identifier) in the message body: ".$identifier);
220 221
 					return FALSE;
221 222
 				}			
222
-    		} 
223
-    		else 
223
+    		} else 
224 224
     		{
225 225
     			$GLOBALS['log']->info("Warning: Empty identifier for campaign log.");
226 226
     			return FALSE;
227 227
     		}
228
-    	}  
229
-    	else 
228
+    	} else 
230 229
     	{
231 230
     	    $GLOBALS['log']->info("Warning: skipping bounced email because it does not have the removeme link.");	
232 231
     		return FALSE;	
233 232
       	}
234
-  } 
235
-  else 
233
+  } else 
236 234
   {
237 235
 	$GLOBALS['log']->info("Warning: skipping bounced email because the sender is not MAILER-DAEMON.");
238 236
 	return FALSE;
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 /**
101 101
  * Given an email address, mark it as invalid.
102 102
  *
103
- * @param $email_address
103
+ * @param Email $email_address
104 104
  */
105 105
 function markEmailAddressInvalid($email_address)
106 106
 {
@@ -118,6 +118,7 @@  discard block
 block discarded – undo
118 118
  * Get the existing campaign log entry by tracker key.
119 119
  * 
120 120
  * @param string Target Key
121
+ * @param string $identifier
121 122
  * @return array Campaign Log Row
122 123
  */
123 124
 function getExistingCampaignLogEntry($identifier)
@@ -136,6 +137,7 @@  discard block
 block discarded – undo
136 137
  * Scan the bounced email searching for a valid target identifier.
137 138
  * 
138 139
  * @param string Email Description
140
+ * @param string $email_description
139 141
  * @return array Results including matches and identifier
140 142
  */
141 143
 function checkBouncedEmailForIdentifier($email_description)
Please login to merge, or discard this patch.
modules/Campaigns/WebToLeadFormSave.php 3 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -56,52 +56,52 @@  discard block
 block discarded – undo
56 56
 
57 57
 //-----------begin replacing text input tags that have been marked with text area tags
58 58
 //get array of text areas strings to process
59
-$bodyHTML = html_entity_decode($_REQUEST['body_html'],ENT_QUOTES);
59
+$bodyHTML = html_entity_decode($_REQUEST['body_html'], ENT_QUOTES);
60 60
 //Bug53791
61 61
 $bodyHTML = str_replace(chr(160), " ", $bodyHTML);
62 62
 
63
-while (strpos($bodyHTML, "ta_replace") !== false){
63
+while (strpos($bodyHTML, "ta_replace") !== false) {
64 64
 
65 65
 	//define the marker edges of the sub string to process (opening and closing tag brackets)
66 66
 	$marker = strpos($bodyHTML, "ta_replace");
67
-	$start_border = strpos($bodyHTML, "input", $marker) - 1;// to account for opening '<' char;
67
+	$start_border = strpos($bodyHTML, "input", $marker) - 1; // to account for opening '<' char;
68 68
 	$end_border = strpos($bodyHTML, '>', $start_border); //get the closing tag after marker ">";
69 69
 
70 70
 	//extract the input tag string
71
-	$working_str = substr($bodyHTML, $marker-3, $end_border-($marker-3) );
71
+	$working_str = substr($bodyHTML, $marker - 3, $end_border - ($marker - 3));
72 72
 
73 73
 	//replace input markup with text areas markups
74
-	$new_str = str_replace('input','textarea',$working_str);
74
+	$new_str = str_replace('input', 'textarea', $working_str);
75 75
 	$new_str = str_replace("type='text'", ' ', $new_str);
76
-	$new_str = $new_str . '> </textarea';
76
+	$new_str = $new_str.'> </textarea';
77 77
 
78 78
 	//replace the marker with generic term
79 79
 	$new_str = str_replace('ta_replace', 'sugarslot', $new_str);
80 80
 
81 81
 	//merge the processed string back into bodyhtml string
82
-	$bodyHTML = str_replace($working_str , $new_str, $bodyHTML);
82
+	$bodyHTML = str_replace($working_str, $new_str, $bodyHTML);
83 83
 }
84 84
 //<<<----------end replacing marked text inputs with text area tags
85 85
 
86 86
 $guid = create_guid();
87 87
 $form_file = "upload://$guid";
88 88
 
89
-$SugarTiny =  new SugarTinyMCE();
89
+$SugarTiny = new SugarTinyMCE();
90 90
 $html = $SugarTiny->cleanEncodedMCEHtml($bodyHTML);
91 91
 
92 92
 //Check to ensure we have <html> tags in the form. Without them, IE8 will attempt to display the page as XML.
93 93
 if (stripos($html, "<html") === false) {
94 94
     $langHeader = get_language_header();
95
-    $html = "<html {$langHeader}><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>" . $html . "</body></html>";
95
+    $html = "<html {$langHeader}><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>".$html."</body></html>";
96 96
 }
97 97
 file_put_contents($form_file, $html);
98 98
 
99
-$xtpl=new XTemplate ('modules/Campaigns/WebToLeadDownloadForm.html');
99
+$xtpl = new XTemplate('modules/Campaigns/WebToLeadDownloadForm.html');
100 100
 $xtpl->assign("MOD", $mod_strings);
101 101
 $xtpl->assign("APP", $app_strings);
102 102
 $webformlink = "<b>$mod_strings[LBL_DOWNLOAD_TEXT_WEB_TO_LEAD_FORM]</b><br/>";
103 103
 $webformlink .= "<a href=\"index.php?entryPoint=download&id={$guid}&isTempFile=1&tempName=WebToLeadForm.html&type=temp\">$mod_strings[LBL_DOWNLOAD_WEB_TO_LEAD_FORM]</a>";
104
-$xtpl->assign("LINK_TO_WEB_FORM",$webformlink);
104
+$xtpl->assign("LINK_TO_WEB_FORM", $webformlink);
105 105
 $xtpl->assign("RAW_SOURCE", htmlspecialchars($html)); 
106 106
 $xtpl->parse("main.copy_source");
107 107
 $xtpl->parse("main");
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -62,27 +62,27 @@
 block discarded – undo
62 62
 
63 63
 while (strpos($bodyHTML, "ta_replace") !== false){
64 64
 
65
-	//define the marker edges of the sub string to process (opening and closing tag brackets)
66
-	$marker = strpos($bodyHTML, "ta_replace");
67
-	$start_border = strpos($bodyHTML, "input", $marker) - 1;// to account for opening '<' char;
68
-	$end_border = strpos($bodyHTML, '>', $start_border); //get the closing tag after marker ">";
65
+    //define the marker edges of the sub string to process (opening and closing tag brackets)
66
+    $marker = strpos($bodyHTML, "ta_replace");
67
+    $start_border = strpos($bodyHTML, "input", $marker) - 1;// to account for opening '<' char;
68
+    $end_border = strpos($bodyHTML, '>', $start_border); //get the closing tag after marker ">";
69 69
 
70
-	//extract the input tag string
71
-	$working_str = substr($bodyHTML, $marker-3, $end_border-($marker-3) );
70
+    //extract the input tag string
71
+    $working_str = substr($bodyHTML, $marker-3, $end_border-($marker-3) );
72 72
 
73
-	//replace input markup with text areas markups
74
-	$new_str = str_replace('input','textarea',$working_str);
75
-	$new_str = str_replace("type=\"text\"", ' ', $new_str);
76
-	$new_str = $new_str . '> </textarea';
73
+    //replace input markup with text areas markups
74
+    $new_str = str_replace('input','textarea',$working_str);
75
+    $new_str = str_replace("type=\"text\"", ' ', $new_str);
76
+    $new_str = $new_str . '> </textarea';
77 77
 
78
-	//replace the marker with generic term
79
-	$new_str = str_replace('ta_replace', 'sugarslot', $new_str);
78
+    //replace the marker with generic term
79
+    $new_str = str_replace('ta_replace', 'sugarslot', $new_str);
80 80
 
81
-	// NET-enabling start-tag requires SHORTTAG YES
82
-	$new_str = str_replace('/> </textarea>', '> </textarea>', $new_str);
81
+    // NET-enabling start-tag requires SHORTTAG YES
82
+    $new_str = str_replace('/> </textarea>', '> </textarea>', $new_str);
83 83
 
84
-	//merge the processed string back into bodyhtml string
85
-	$bodyHTML = str_replace($working_str , $new_str, $bodyHTML);
84
+    //merge the processed string back into bodyhtml string
85
+    $bodyHTML = str_replace($working_str , $new_str, $bodyHTML);
86 86
 }
87 87
 //<<<----------end replacing marked text inputs with text area tags
88 88
 
Please login to merge, or discard this patch.
modules/Campaigns/CampaignDiagnostic.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@  discard block
 block discarded – undo
59 59
 //if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
60 60
 //account for use within wizards
61 61
 if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
62
-	$params = array();
63
-	$params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
64
-	$params[] = $mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'];
62
+    $params = array();
63
+    $params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
64
+    $params[] = $mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'];
65 65
 	
66
-	echo getClassicModuleTitle('Campaigns', $params, true);
66
+    echo getClassicModuleTitle('Campaigns', $params, true);
67 67
 }
68 68
 
69 69
 global $theme;
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 if(isset($mbox) && count($mbox)>0){
111 111
     $mboxTable .= "<tr><td colspan='5' style='text-align: left;'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK1_GOOD']." </b>.</td></tr>";
112 112
         $mboxTable .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></th>"
113
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></th>"
114
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></th>"
115
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></th>"
116
-                   .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></th></tr>";
113
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></th>"
114
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></th>"
115
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></th>"
116
+                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></th></tr>";
117 117
 
118 118
     foreach($mbox as $details){
119 119
         $mboxTable .= "<tr><td>".$details['name']."</td>";
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 }else{
145 145
     $conf_msg .= "<tr><td colspan = '5'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_GOOD']."</b></td></tr>";
146 146
     $conf_msg .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_NAME']."</b></th>"
147
-               .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
148
-               .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SENDTYPE']."</b></th>";
147
+                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
148
+                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SENDTYPE']."</b></th>";
149 149
     if($focus->settings['mail_sendtype']=='SMTP'){
150
-     $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151
-               .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
150
+        $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151
+                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
152 152
 
153 153
     }else{$conf_msg .= "</tr>";}
154 154
                    
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         $conf_msg .= "<tr><td>".$focus->settings['notify_fromname']."</td>";
158 158
         $conf_msg .= "<td>".$focus->settings['notify_fromaddress']."</td>";
159 159
         $conf_msg .= "<td>".$focus->settings['mail_sendtype']."</td>";
160
-     if($focus->settings['mail_sendtype']=='SMTP'){
160
+        if($focus->settings['mail_sendtype']=='SMTP'){
161 161
         $conf_msg .= "<td>".$focus->settings['mail_smtpserver']."</td>";
162 162
         $conf_msg .= "<td>".$focus->settings['mail_smtpuser']."</td></tr>";
163 163
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 //build the table rows for scheduler display
199 199
 while ($sched_row = $focus->db->fetchByAssoc($sched_res)){$scheds[] = $sched_row;}
200 200
 foreach ($scheds as $funct){
201
-  if( ($funct['job']==$check_sched1)  ||   ($funct['job']==$check_sched2)){
201
+    if( ($funct['job']==$check_sched1)  ||   ($funct['job']==$check_sched2)){
202 202
         $sched_mes = 'use';
203 203
         $sched_mes_body .= "<tr><td style='text-align: left;'>".$funct['name']."</td>";
204 204
         $sched_mes_body .= "<td style='text-align: left;'>".$funct['status']."</td></tr>";
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
             $check_sched2 ="found";
209 209
         }  
210 210
         
211
-  }
211
+    }
212 212
 }
213 213
 
214 214
 //determine which table header to use, based on whether or not schedulers were found
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 if($sched_mes == 'use'){
217 217
     $sched_mes = "<h5>".$mod_strings['LBL_SCHEDULER_CHECK_GOOD']."</h5><br><table class='other view' cellspacing='1'>";
218 218
     $sched_mes .= "<tr><th scope='col' width='40%'><b>".$mod_strings['LBL_SCHEDULER_NAME']."</b></tH>"
219
-               .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
219
+                .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
220 220
             
221 221
 }else{
222 222
     $sched_mes = "<table class='other view' cellspacing='1'>";
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
     if (is_admin($current_user)){
239 239
         $admin_sched_link="<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240 240
     }else{
241
-     $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
241
+        $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
242 242
     }    
243 243
 }    
244 244
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 /********** FINAL END OF PAGE UI Stuff ********/
252 252
 if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
253 253
 
254
-      $ss->display('modules/Campaigns/CampaignDiagnostic.html');
254
+        $ss->display('modules/Campaigns/CampaignDiagnostic.html');
255 255
 }
256 256
 
257 257
 /**
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     }elseif($num == 0){
273 273
         //if health number is zero, then all checks passed, set green image
274 274
         //green
275
-       return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
275
+        return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
276 276
 
277 277
 
278 278
     }else{
Please login to merge, or discard this patch.
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 //if (!is_admin($current_user)) sugar_die("Unauthorized access to administration.");
60 60
 //account for use within wizards
61
-if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
61
+if (!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline') {
62 62
 	$params = array();
63 63
 	$params[] = "<a href='index.php?module=Campaigns&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
64 64
 	$params[] = $mod_strings['LBL_CAMPAIGN_DIAGNOSTICS'];
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 
73 73
 
74 74
 
75
-if(isset($_REQUEST['inline']) && $_REQUEST['inline'] == 'inline'){
75
+if (isset($_REQUEST['inline']) && $_REQUEST['inline'] == 'inline') {
76 76
     {
77 77
 
78 78
 }
79
-}else{
79
+} else {
80 80
     //use html if not inline
81 81
     $ss = new Sugar_Smarty();
82 82
     $ss->assign("MOD", $mod_strings);
@@ -104,18 +104,18 @@  discard block
 block discarded – undo
104 104
 $mboxTable = "<table border ='0' width='100%'  class='detail view' cellpadding='0' cellspacing='0'>";
105 105
 //put all rows returned into an array
106 106
 $mbox = array();
107
-while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)){$mbox[] = $mbox_row;}
107
+while ($mbox_row = $focus->db->fetchByAssoc($mbox_res)) {$mbox[] = $mbox_row; }
108 108
     $mbox_msg = ' ';
109 109
 //if the array is not empty, then set "good" message
110
-if(isset($mbox) && count($mbox)>0){
111
-    $mboxTable .= "<tr><td colspan='5' style='text-align: left;'><b>" .count($mbox) ." ". $mod_strings['LBL_MAILBOX_CHECK1_GOOD']." </b>.</td></tr>";
110
+if (isset($mbox) && count($mbox) > 0) {
111
+    $mboxTable .= "<tr><td colspan='5' style='text-align: left;'><b>".count($mbox)." ".$mod_strings['LBL_MAILBOX_CHECK1_GOOD']." </b>.</td></tr>";
112 112
         $mboxTable .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX_NAME']."</b></th>"
113 113
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LOGIN']."</b></th>"
114 114
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAILBOX']."</b></th>"
115 115
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_SERVER_URL']."</b></th>"
116 116
                    .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_LIST_STATUS']."</b></th></tr>";
117 117
 
118
-    foreach($mbox as $details){
118
+    foreach ($mbox as $details) {
119 119
         $mboxTable .= "<tr><td>".$details['name']."</td>";
120 120
         $mboxTable .= "<td>".$details['email_user']."</td>";
121 121
         $mboxTable .= "<td>".$details['mailbox']."</td>";
@@ -123,64 +123,64 @@  discard block
 block discarded – undo
123 123
         $mboxTable .= "<td>".$details['status']."</td></tr>";
124 124
     }
125 125
 
126
-}else{
126
+} else {
127 127
     //if array is empty, then set "bad" message and increment health counter
128
-    $mboxTable .=  "<tr><td colspan='5'><b class='error'>". $mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></td></tr>";
129
-    $email_health =$email_health +1;
128
+    $mboxTable .= "<tr><td colspan='5'><b class='error'>".$mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></td></tr>";
129
+    $email_health = $email_health + 1;
130 130
 }
131 131
 
132
-$mboxTable.= '</table>' ;
132
+$mboxTable .= '</table>';
133 133
 
134 134
 
135 135
     
136 136
 $ss->assign("MAILBOXES_DETECTED_MESSAGE", $mboxTable);
137 137
 
138 138
 //email settings configured 
139
-$conf_msg="<table border='0' width='100%' class='detail view' cellpadding='0' cellspacing='0'>";
140
-if (strstr($focus->settings['notify_fromaddress'], 'example.com')){
139
+$conf_msg = "<table border='0' width='100%' class='detail view' cellpadding='0' cellspacing='0'>";
140
+if (strstr($focus->settings['notify_fromaddress'], 'example.com')) {
141 141
     //if from address is the default, then set "bad" message and increment health counter
142 142
     $conf_msg .= "<tr><td colspan = '5'><b class='error'> ".$mod_strings['LBL_MAILBOX_CHECK2_BAD']." </b></td></td>";
143
-    $email_health =$email_health +1;
144
-}else{
143
+    $email_health = $email_health + 1;
144
+} else {
145 145
     $conf_msg .= "<tr><td colspan = '5'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_GOOD']."</b></td></tr>";
146 146
     $conf_msg .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_NAME']."</b></th>"
147 147
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
148 148
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SENDTYPE']."</b></th>";
149
-    if($focus->settings['mail_sendtype']=='SMTP'){
149
+    if ($focus->settings['mail_sendtype'] == 'SMTP') {
150 150
      $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151 151
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
152 152
 
153
-    }else{$conf_msg .= "</tr>";}
153
+    } else {$conf_msg .= "</tr>"; }
154 154
                    
155 155
     
156 156
 
157 157
         $conf_msg .= "<tr><td>".$focus->settings['notify_fromname']."</td>";
158 158
         $conf_msg .= "<td>".$focus->settings['notify_fromaddress']."</td>";
159 159
         $conf_msg .= "<td>".$focus->settings['mail_sendtype']."</td>";
160
-     if($focus->settings['mail_sendtype']=='SMTP'){
160
+     if ($focus->settings['mail_sendtype'] == 'SMTP') {
161 161
         $conf_msg .= "<td>".$focus->settings['mail_smtpserver']."</td>";
162 162
         $conf_msg .= "<td>".$focus->settings['mail_smtpuser']."</td></tr>";
163 163
 
164
-    }else{$conf_msg .= "</tr>";}       
164
+    } else {$conf_msg .= "</tr>"; }       
165 165
 
166 166
 }
167 167
           
168 168
 $conf_msg .= '</table>'; 
169 169
 $ss->assign("EMAIL_SETTINGS_CONFIGURED_MESSAGE", $conf_msg);
170
-$email_setup_wiz_link='';
171
-if ($email_health>0){
172
-    if (is_admin($current_user)){
173
-        $email_setup_wiz_link="<a href='index.php?module=Campaigns&action=WizardEmailSetup'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a>";
174
-    }else{
175
-        $email_setup_wiz_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
170
+$email_setup_wiz_link = '';
171
+if ($email_health > 0) {
172
+    if (is_admin($current_user)) {
173
+        $email_setup_wiz_link = "<a href='index.php?module=Campaigns&action=WizardEmailSetup'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a>";
174
+    } else {
175
+        $email_setup_wiz_link = $mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
176 176
     }    
177 177
 }
178 178
 
179 179
 $ss->assign("EMAIL_SETUP_WIZ_LINK", $email_setup_wiz_link);
180
-$ss->assign( 'EMAIL_IMAGE', define_image($email_health, 2));
181
-$ss->assign( 'EMAIL_COMPONENTS', $mod_strings['LBL_EMAIL_COMPONENTS']);
182
-$ss->assign( 'SCHEDULER_COMPONENTS', $mod_strings['LBL_SCHEDULER_COMPONENTS']);
183
-$ss->assign( 'RECHECK_BTN', $mod_strings['LBL_RECHECK_BTN']);
180
+$ss->assign('EMAIL_IMAGE', define_image($email_health, 2));
181
+$ss->assign('EMAIL_COMPONENTS', $mod_strings['LBL_EMAIL_COMPONENTS']);
182
+$ss->assign('SCHEDULER_COMPONENTS', $mod_strings['LBL_SCHEDULER_COMPONENTS']);
183
+$ss->assign('RECHECK_BTN', $mod_strings['LBL_RECHECK_BTN']);
184 184
 
185 185
 /************* SCHEDULER COMPONENTS ************/
186 186
 
@@ -196,16 +196,16 @@  discard block
 block discarded – undo
196 196
 
197 197
 $scheds = array();
198 198
 //build the table rows for scheduler display
199
-while ($sched_row = $focus->db->fetchByAssoc($sched_res)){$scheds[] = $sched_row;}
200
-foreach ($scheds as $funct){
201
-  if( ($funct['job']==$check_sched1)  ||   ($funct['job']==$check_sched2)){
199
+while ($sched_row = $focus->db->fetchByAssoc($sched_res)) {$scheds[] = $sched_row; }
200
+foreach ($scheds as $funct) {
201
+  if (($funct['job'] == $check_sched1) || ($funct['job'] == $check_sched2)) {
202 202
         $sched_mes = 'use';
203 203
         $sched_mes_body .= "<tr><td style='text-align: left;'>".$funct['name']."</td>";
204 204
         $sched_mes_body .= "<td style='text-align: left;'>".$funct['status']."</td></tr>";
205
-        if($funct['job']==$check_sched1){
206
-            $check_sched1 ="found";
207
-        }else{
208
-            $check_sched2 ="found";
205
+        if ($funct['job'] == $check_sched1) {
206
+            $check_sched1 = "found";
207
+        } else {
208
+            $check_sched2 = "found";
209 209
         }  
210 210
         
211 211
   }
@@ -213,43 +213,43 @@  discard block
 block discarded – undo
213 213
 
214 214
 //determine which table header to use, based on whether or not schedulers were found
215 215
 $show_admin_link = false;
216
-if($sched_mes == 'use'){
216
+if ($sched_mes == 'use') {
217 217
     $sched_mes = "<h5>".$mod_strings['LBL_SCHEDULER_CHECK_GOOD']."</h5><br><table class='other view' cellspacing='1'>";
218 218
     $sched_mes .= "<tr><th scope='col' width='40%'><b>".$mod_strings['LBL_SCHEDULER_NAME']."</b></tH>"
219 219
                .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
220 220
             
221
-}else{
221
+} else {
222 222
     $sched_mes = "<table class='other view' cellspacing='1'>";
223
-    $sched_mes  .= "<tr><td colspan ='3'><font color='red'><b> ".$mod_strings['LBL_SCHEDULER_CHECK_BAD']."</b></font></td></tr>";
223
+    $sched_mes .= "<tr><td colspan ='3'><font color='red'><b> ".$mod_strings['LBL_SCHEDULER_CHECK_BAD']."</b></font></td></tr>";
224 224
     $show_admin_link = true;
225 225
 }
226 226
 
227 227
 //determine if error messages need to be displayed for schedulers
228
-if($check_sched2 != 'found'){
229
-    $sched_health =$sched_health +1;
230
-    $sched_mes_body  .= "<tr><td colspan ='3'><font color='red'> ".$mod_strings['LBL_SCHEDULER_CHECK1_BAD']."</font></td></tr>";
228
+if ($check_sched2 != 'found') {
229
+    $sched_health = $sched_health + 1;
230
+    $sched_mes_body .= "<tr><td colspan ='3'><font color='red'> ".$mod_strings['LBL_SCHEDULER_CHECK1_BAD']."</font></td></tr>";
231 231
 }
232
-if($check_sched1 != 'found'){
233
-    $sched_health =$sched_health +1;
234
-    $sched_mes_body  .= "<tr><td colspan ='3' scope='row'><font color='red'>".$mod_strings['LBL_SCHEDULER_CHECK2_BAD']."</font></td></tr>";
232
+if ($check_sched1 != 'found') {
233
+    $sched_health = $sched_health + 1;
234
+    $sched_mes_body .= "<tr><td colspan ='3' scope='row'><font color='red'>".$mod_strings['LBL_SCHEDULER_CHECK2_BAD']."</font></td></tr>";
235 235
 }
236
-$admin_sched_link='';
237
-if ($sched_health>0){
238
-    if (is_admin($current_user)){
239
-        $admin_sched_link="<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240
-    }else{
241
-     $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
236
+$admin_sched_link = '';
237
+if ($sched_health > 0) {
238
+    if (is_admin($current_user)) {
239
+        $admin_sched_link = "<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240
+    } else {
241
+     $admin_sched_link = $mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
242 242
     }    
243 243
 }    
244 244
 
245 245
 //put table html together and display
246
-    $final_sched_msg = $sched_mes . $sched_mes_body . '</table>' . $admin_sched_link;        
246
+    $final_sched_msg = $sched_mes.$sched_mes_body.'</table>'.$admin_sched_link;        
247 247
     $ss->assign("SCHEDULER_EMAILS_MESSAGE", $final_sched_msg);
248
-    $ss->assign( 'SCHEDULE_IMAGE', define_image($sched_health, 2));
248
+    $ss->assign('SCHEDULE_IMAGE', define_image($sched_health, 2));
249 249
 
250 250
 
251 251
 /********** FINAL END OF PAGE UI Stuff ********/
252
-if(!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline'){
252
+if (!isset($_REQUEST['inline']) || $_REQUEST['inline'] != 'inline') {
253 253
 
254 254
       $ss->display('modules/Campaigns/CampaignDiagnostic.html');
255 255
 }
@@ -264,18 +264,18 @@  discard block
 block discarded – undo
264 264
 function define_image($num, $total)
265 265
 { global $mod_strings;
266 266
     //if health number is equal to total number then all checks failed, set red image
267
-    if($num == $total){
267
+    if ($num == $total) {
268 268
         //red
269 269
         return SugarThemeRegistry::current()->getImage('red_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_INVALID']);
270 270
 
271 271
 
272
-    }elseif($num == 0){
272
+    }elseif ($num == 0) {
273 273
         //if health number is zero, then all checks passed, set green image
274 274
         //green
275 275
        return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
276 276
 
277 277
 
278
-    }else{
278
+    } else {
279 279
         //if health number is between total and num params, then some checks failed but not all, set yellow image
280 280
         //yellow
281 281
         return SugarThemeRegistry::current()->getImage('yellow_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_ALERT']);
Please login to merge, or discard this patch.
Braces   +23 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -76,14 +78,20 @@  discard block
 block discarded – undo
76 78
     {
77 79
 
78 80
 }
79
-}else{
81
+} else{
80 82
     //use html if not inline
81 83
     $ss = new Sugar_Smarty();
82 84
     $ss->assign("MOD", $mod_strings);
83 85
     $ss->assign("APP", $app_strings);
84
-    if (isset($_REQUEST['return_module'])) $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
85
-    if (isset($_REQUEST['return_action'])) $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
86
-    if (isset($_REQUEST['return_id'])) $ss->assign("RETURN_ID", $_REQUEST['return_id']);
86
+    if (isset($_REQUEST['return_module'])) {
87
+        $ss->assign("RETURN_MODULE", $_REQUEST['return_module']);
88
+    }
89
+    if (isset($_REQUEST['return_action'])) {
90
+        $ss->assign("RETURN_ACTION", $_REQUEST['return_action']);
91
+    }
92
+    if (isset($_REQUEST['return_id'])) {
93
+        $ss->assign("RETURN_ID", $_REQUEST['return_id']);
94
+    }
87 95
     // handle Create $module then Cancel
88 96
     if (empty($_REQUEST['return_id'])) {
89 97
         $ss->assign("RETURN_ACTION", 'index');
@@ -123,7 +131,7 @@  discard block
 block discarded – undo
123 131
         $mboxTable .= "<td>".$details['status']."</td></tr>";
124 132
     }
125 133
 
126
-}else{
134
+} else{
127 135
     //if array is empty, then set "bad" message and increment health counter
128 136
     $mboxTable .=  "<tr><td colspan='5'><b class='error'>". $mod_strings['LBL_MAILBOX_CHECK1_BAD']."</b></td></tr>";
129 137
     $email_health =$email_health +1;
@@ -141,7 +149,7 @@  discard block
 block discarded – undo
141 149
     //if from address is the default, then set "bad" message and increment health counter
142 150
     $conf_msg .= "<tr><td colspan = '5'><b class='error'> ".$mod_strings['LBL_MAILBOX_CHECK2_BAD']." </b></td></td>";
143 151
     $email_health =$email_health +1;
144
-}else{
152
+} else{
145 153
     $conf_msg .= "<tr><td colspan = '5'><b> ".$mod_strings['LBL_MAILBOX_CHECK2_GOOD']."</b></td></tr>";
146 154
     $conf_msg .= "<tr><th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_NAME']."</b></th>"
147 155
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_WIZ_FROM_ADDRESS']."</b></th>"
@@ -150,7 +158,7 @@  discard block
 block discarded – undo
150 158
      $conf_msg .= " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPSERVER']."</b></th>"
151 159
                .  " <th scope='col' width='20%'><b>".$mod_strings['LBL_MAIL_SMTPUSER']."</b></th></tr>";
152 160
 
153
-    }else{$conf_msg .= "</tr>";}
161
+    } else{$conf_msg .= "</tr>";}
154 162
                    
155 163
     
156 164
 
@@ -161,7 +169,7 @@  discard block
 block discarded – undo
161 169
         $conf_msg .= "<td>".$focus->settings['mail_smtpserver']."</td>";
162 170
         $conf_msg .= "<td>".$focus->settings['mail_smtpuser']."</td></tr>";
163 171
 
164
-    }else{$conf_msg .= "</tr>";}       
172
+    } else{$conf_msg .= "</tr>";}       
165 173
 
166 174
 }
167 175
           
@@ -171,7 +179,7 @@  discard block
 block discarded – undo
171 179
 if ($email_health>0){
172 180
     if (is_admin($current_user)){
173 181
         $email_setup_wiz_link="<a href='index.php?module=Campaigns&action=WizardEmailSetup'>".$mod_strings['LBL_EMAIL_SETUP_WIZ']."</a>";
174
-    }else{
182
+    } else{
175 183
         $email_setup_wiz_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];
176 184
     }    
177 185
 }
@@ -204,7 +212,7 @@  discard block
 block discarded – undo
204 212
         $sched_mes_body .= "<td style='text-align: left;'>".$funct['status']."</td></tr>";
205 213
         if($funct['job']==$check_sched1){
206 214
             $check_sched1 ="found";
207
-        }else{
215
+        } else{
208 216
             $check_sched2 ="found";
209 217
         }  
210 218
         
@@ -218,7 +226,7 @@  discard block
 block discarded – undo
218 226
     $sched_mes .= "<tr><th scope='col' width='40%'><b>".$mod_strings['LBL_SCHEDULER_NAME']."</b></tH>"
219 227
                .  " <th scope='col' width='60%'><b>".$mod_strings['LBL_SCHEDULER_STATUS']."</b></tH></tr>";
220 228
             
221
-}else{
229
+} else{
222 230
     $sched_mes = "<table class='other view' cellspacing='1'>";
223 231
     $sched_mes  .= "<tr><td colspan ='3'><font color='red'><b> ".$mod_strings['LBL_SCHEDULER_CHECK_BAD']."</b></font></td></tr>";
224 232
     $show_admin_link = true;
@@ -237,7 +245,7 @@  discard block
 block discarded – undo
237 245
 if ($sched_health>0){
238 246
     if (is_admin($current_user)){
239 247
         $admin_sched_link="<a href='index.php?module=Schedulers&action=index'>".$mod_strings['LBL_SCHEDULER_LINK']."</a>";
240
-    }else{
248
+    } else{
241 249
      $admin_sched_link=$mod_strings['LBL_NON_ADMIN_ERROR_MSG'];   
242 250
     }    
243 251
 }    
@@ -269,13 +277,13 @@  discard block
 block discarded – undo
269 277
         return SugarThemeRegistry::current()->getImage('red_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_INVALID']);
270 278
 
271 279
 
272
-    }elseif($num == 0){
280
+    } elseif($num == 0){
273 281
         //if health number is zero, then all checks passed, set green image
274 282
         //green
275 283
        return SugarThemeRegistry::current()->getImage('green_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_VALID']);
276 284
 
277 285
 
278
-    }else{
286
+    } else{
279 287
         //if health number is between total and num params, then some checks failed but not all, set yellow image
280 288
         //yellow
281 289
         return SugarThemeRegistry::current()->getImage('yellow_camp', "align='absmiddle'", null, null, ".gif", $mod_strings['LBL_ALERT']);
Please login to merge, or discard this patch.
modules/Campaigns/WizardMarketingSave.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
     }
66 66
         
67 67
 }else{
68
-     //default to just saving and exiting wizard
69
-     $master = 'save';   
68
+        //default to just saving and exiting wizard
69
+        $master = 'save';   
70 70
 }
71 71
 
72 72
 
@@ -90,17 +90,17 @@  discard block
 block discarded – undo
90 90
 }
91 91
 
92 92
     foreach ($_REQUEST as $key => $val) {
93
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
94
-              $newkey  =substr($key, strlen($prefix)) ;
95
-              $_REQUEST[$newkey] = $val;
96
-         }               
93
+                if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
94
+                $newkey  =substr($key, strlen($prefix)) ;
95
+                $_REQUEST[$newkey] = $val;
96
+            }               
97 97
     }
98 98
 
99 99
     foreach ($_REQUEST as $key => $val) {
100
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
101
-              $newkey  =substr($key, strlen($prefix)) ;
102
-              $_REQUEST[$newkey] = $val;
103
-         }               
100
+                if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
101
+                $newkey  =substr($key, strlen($prefix)) ;
102
+                $_REQUEST[$newkey] = $val;
103
+            }               
104 104
     }
105 105
 
106 106
 if(!empty($_REQUEST['meridiem'])){
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 }
109 109
 
110 110
 if(empty($_REQUEST['time_start'])) {
111
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';	
111
+    $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';	
112 112
 } else {
113
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
113
+    $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
114 114
 }
115 115
 
116 116
 foreach($marketing->column_fields as $field)
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
     $_REQUEST['record'] =$marketing->campaign_id;
181 181
     $_POST['record']=$marketing->campaign_id;
182 182
     $_REQUEST['mode'] = $master;
183
-     $_POST['mode'] = $master; 
184
-     $_REQUEST['from_wiz']= 'true';
183
+        $_POST['mode'] = $master; 
184
+        $_REQUEST['from_wiz']= 'true';
185 185
     require_once('modules/Campaigns/QueueCampaign.php');
186 186
 }
187 187
 
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -53,18 +53,18 @@  discard block
 block discarded – undo
53 53
 $master = 'save';
54 54
 if (isset($_REQUEST['wiz_home_next_step']) && !empty($_REQUEST['wiz_home_next_step'])) {
55 55
     
56
-    if($_REQUEST['wiz_home_next_step']==3){
56
+    if ($_REQUEST['wiz_home_next_step'] == 3) {
57 57
         //user has chosen to save and schedule this campaign for email
58 58
         $master = 'send';
59
-    }elseif($_REQUEST['wiz_home_next_step']==2){
59
+    }elseif ($_REQUEST['wiz_home_next_step'] == 2) {
60 60
         //user has chosen to save and send this campaign in test mode
61 61
         $master = 'test';
62
-    }else{
62
+    } else {
63 63
         //user has chosen to simply save
64
-        $master  = 'save';        
64
+        $master = 'save';        
65 65
     }
66 66
         
67
-}else{
67
+} else {
68 68
      //default to just saving and exiting wizard
69 69
      $master = 'save';   
70 70
 }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 if (isset($_REQUEST['record']) && !empty($_REQUEST['record'])) {
78 78
     $marketing->retrieve($_REQUEST['record']);
79 79
 }
80
-if(!$marketing->ACLAccess('Save')){
80
+if (!$marketing->ACLAccess('Save')) {
81 81
         ACLController::displayNoAccess(true);
82 82
         sugar_cleanup(true);
83 83
 }
@@ -90,40 +90,40 @@  discard block
 block discarded – undo
90 90
 }
91 91
 
92 92
     foreach ($_REQUEST as $key => $val) {
93
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
94
-              $newkey  =substr($key, strlen($prefix)) ;
93
+              if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) {
94
+              $newkey = substr($key, strlen($prefix));
95 95
               $_REQUEST[$newkey] = $val;
96 96
          }               
97 97
     }
98 98
 
99 99
     foreach ($_REQUEST as $key => $val) {
100
-              if((strstr($key, $prefix )) && (strpos($key, $prefix )== 0)){
101
-              $newkey  =substr($key, strlen($prefix)) ;
100
+              if ((strstr($key, $prefix)) && (strpos($key, $prefix) == 0)) {
101
+              $newkey = substr($key, strlen($prefix));
102 102
               $_REQUEST[$newkey] = $val;
103 103
          }               
104 104
     }
105 105
 
106
-if(!empty($_REQUEST['meridiem'])){
107
-    $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'],$timedate->get_time_format(), $_REQUEST['meridiem']);
106
+if (!empty($_REQUEST['meridiem'])) {
107
+    $_REQUEST['time_start'] = $timedate->merge_time_meridiem($_REQUEST['time_start'], $timedate->get_time_format(), $_REQUEST['meridiem']);
108 108
 }
109 109
 
110
-if(empty($_REQUEST['time_start'])) {
111
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' 00:00';	
110
+if (empty($_REQUEST['time_start'])) {
111
+  $_REQUEST['date_start'] = $_REQUEST['date_start'].' 00:00';	
112 112
 } else {
113
-  $_REQUEST['date_start'] = $_REQUEST['date_start'] . ' ' . $_REQUEST['time_start'];
113
+  $_REQUEST['date_start'] = $_REQUEST['date_start'].' '.$_REQUEST['time_start'];
114 114
 }
115 115
 
116
-foreach($marketing->column_fields as $field)
116
+foreach ($marketing->column_fields as $field)
117 117
 {
118 118
     if ($field == 'all_prospect_lists') {
119
-        if(isset($_REQUEST[$field]) && $_REQUEST[$field]='on' )
119
+        if (isset($_REQUEST[$field]) && $_REQUEST[$field] = 'on')
120 120
         {
121 121
             $marketing->$field = 1;
122 122
         } else {
123 123
             $marketing->$field = 0;         
124 124
         }
125
-    }else {
126
-        if(isset($_REQUEST[$field]))
125
+    } else {
126
+        if (isset($_REQUEST[$field]))
127 127
         {
128 128
             $value = $_REQUEST[$field];
129 129
             $marketing->$field = trim($value);
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
     }
132 132
 }
133 133
 
134
-foreach($marketing->additional_column_fields as $field)
134
+foreach ($marketing->additional_column_fields as $field)
135 135
 {
136
-    if(isset($_REQUEST[$field]))
136
+    if (isset($_REQUEST[$field]))
137 137
     {
138 138
         $value = $_REQUEST[$field];
139 139
         $marketing->$field = $value;
@@ -145,8 +145,8 @@  discard block
 block discarded – undo
145 145
 
146 146
 //add prospect lists to campaign.
147 147
 $marketing->load_relationship('prospectlists');
148
-$prospectlists=$marketing->prospectlists->get();
149
-if ($marketing->all_prospect_lists==1) {
148
+$prospectlists = $marketing->prospectlists->get();
149
+if ($marketing->all_prospect_lists == 1) {
150 150
     //remove all related prospect lists.
151 151
     if (!empty($prospectlists)) {
152 152
         $marketing->prospectlists->delete($marketing->id);
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     if (isset($_REQUEST['message_for']) && is_array($_REQUEST['message_for'])) {
156 156
         foreach ($_REQUEST['message_for'] as $prospect_list_id) {
157 157
             
158
-            $key=array_search($prospect_list_id,$prospectlists);
158
+            $key = array_search($prospect_list_id, $prospectlists);
159 159
             if ($key === null or $key === false) {
160 160
                 $marketing->prospectlists->add($prospect_list_id);          
161 161
             } else {
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         }
165 165
         if (count($prospectlists) != 0) {
166 166
             foreach ($prospectlists as $key=>$list_id) {
167
-                $marketing->prospectlists->delete($marketing->id,$list_id);             
167
+                $marketing->prospectlists->delete($marketing->id, $list_id);             
168 168
             }   
169 169
         }
170 170
     }
@@ -174,21 +174,21 @@  discard block
 block discarded – undo
174 174
 $mass[] = $marketing->id; 
175 175
 //if sending an email was chosen, set all the needed variables for queuing campaign
176 176
 
177
-if($master !='save'){
178
-    $_REQUEST['mass']= $mass;
179
-    $_POST['mass']=$mass;
180
-    $_REQUEST['record'] =$marketing->campaign_id;
181
-    $_POST['record']=$marketing->campaign_id;
177
+if ($master != 'save') {
178
+    $_REQUEST['mass'] = $mass;
179
+    $_POST['mass'] = $mass;
180
+    $_REQUEST['record'] = $marketing->campaign_id;
181
+    $_POST['record'] = $marketing->campaign_id;
182 182
     $_REQUEST['mode'] = $master;
183 183
      $_POST['mode'] = $master; 
184
-     $_REQUEST['from_wiz']= 'true';
184
+     $_REQUEST['from_wiz'] = 'true';
185 185
     require_once('modules/Campaigns/QueueCampaign.php');
186 186
 }
187 187
 
188
-if(isset($_REQUEST['show_wizard_summary']) && $_REQUEST['show_wizard_summary']) {
188
+if (isset($_REQUEST['show_wizard_summary']) && $_REQUEST['show_wizard_summary']) {
189 189
 
190
-    if( (isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) ||
191
-        (isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) ) {
190
+    if ((isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) ||
191
+        (isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule'])) {
192 192
         // set correct post variables..
193 193
         $_POST['module'] = 'Campaigns';
194 194
         $_POST['action'] = 'QueueCampaign';
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
         $_POST['direct_step'] = '1';
201 201
         //$_POST['campaign_id'] = '';
202 202
         $_POST['wiz_mass'] = $marketing->id;
203
-        if(isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) {
203
+        if (isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) {
204 204
             $_POST['mode'] = 'test';
205 205
         }
206
-        else if(isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) {
206
+        else if (isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) {
207 207
             $_POST['mode'] = 'send';
208 208
             $_SESSION['msg'] = 'LBL_EMAILS_SCHEDULED';
209 209
         }
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
         exit;
218 218
     }
219 219
 
220
-    $header_URL = "Location: index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome&return_id=" . $marketing->campaign_id . "&campaign_id=" . $marketing->campaign_id . "&jump=3&marketing_id=" . $marketing->id;
220
+    $header_URL = "Location: index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome&return_id=".$marketing->campaign_id."&campaign_id=".$marketing->campaign_id."&jump=3&marketing_id=".$marketing->id;
221 221
 }
222 222
 else {
223 223
     $header_URL = "Location: index.php?action=WizardHome&module=Campaigns&record=".$marketing->campaign_id;
Please login to merge, or discard this patch.
Braces   +11 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -56,15 +58,15 @@  discard block
 block discarded – undo
56 58
     if($_REQUEST['wiz_home_next_step']==3){
57 59
         //user has chosen to save and schedule this campaign for email
58 60
         $master = 'send';
59
-    }elseif($_REQUEST['wiz_home_next_step']==2){
61
+    } elseif($_REQUEST['wiz_home_next_step']==2){
60 62
         //user has chosen to save and send this campaign in test mode
61 63
         $master = 'test';
62
-    }else{
64
+    } else{
63 65
         //user has chosen to simply save
64 66
         $master  = 'save';        
65 67
     }
66 68
         
67
-}else{
69
+} else{
68 70
      //default to just saving and exiting wizard
69 71
      $master = 'save';   
70 72
 }
@@ -84,8 +86,7 @@  discard block
 block discarded – undo
84 86
 
85 87
 if (!empty($_REQUEST['assigned_user_id']) && ($marketing->assigned_user_id != $_REQUEST['assigned_user_id']) && ($_POST['assigned_user_id'] != $current_user->id)) {
86 88
     $check_notify = TRUE;
87
-}
88
-else {
89
+} else {
89 90
     $check_notify = FALSE;
90 91
 }
91 92
 
@@ -122,7 +123,7 @@  discard block
 block discarded – undo
122 123
         } else {
123 124
             $marketing->$field = 0;         
124 125
         }
125
-    }else {
126
+    } else {
126 127
         if(isset($_REQUEST[$field]))
127 128
         {
128 129
             $value = $_REQUEST[$field];
@@ -202,12 +203,10 @@  discard block
 block discarded – undo
202 203
         $_POST['wiz_mass'] = $marketing->id;
203 204
         if(isset($_REQUEST['sendMarketingEmailTest']) && $_REQUEST['sendMarketingEmailTest']) {
204 205
             $_POST['mode'] = 'test';
205
-        }
206
-        else if(isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) {
206
+        } else if(isset($_REQUEST['sendMarketingEmailSchedule']) && $_REQUEST['sendMarketingEmailSchedule']) {
207 207
             $_POST['mode'] = 'send';
208 208
             $_SESSION['msg'] = 'LBL_EMAILS_SCHEDULED';
209
-        }
210
-        else {
209
+        } else {
211 210
             throw new Exception('request error');
212 211
         }
213 212
 
@@ -218,8 +217,7 @@  discard block
 block discarded – undo
218 217
     }
219 218
 
220 219
     $header_URL = "Location: index.php?action=WizardMarketing&module=Campaigns&return_module=Campaigns&return_action=WizardHome&return_id=" . $marketing->campaign_id . "&campaign_id=" . $marketing->campaign_id . "&jump=3&marketing_id=" . $marketing->id;
221
-}
222
-else {
220
+} else {
223 221
     $header_URL = "Location: index.php?action=WizardHome&module=Campaigns&record=".$marketing->campaign_id;
224 222
 }
225 223
 
Please login to merge, or discard this patch.
modules/AOR_Conditions/vardefs.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	'table'=>'aor_conditions',
27 27
 	'audited'=>false,
28 28
 	'duplicate_merge'=>true,
29
-	'fields'=>array (
29
+	'fields'=>array(
30 30
   'aor_report_id' =>
31
-  array (
31
+  array(
32 32
     'required' => false,
33 33
     'name' => 'aor_report_id',
34 34
     'vname' => 'LBL_AOR_REPORT_ID',
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     'size' => '20',
48 48
   ),
49 49
   'condition_order' => 
50
-  array (
50
+  array(
51 51
     'required' => false,
52 52
     'name' => 'condition_order',
53 53
     'vname' => 'LBL_ORDER',
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
             'type' => 'varchar',
80 80
         ),
81 81
   'module_path' =>
82
-  array (
82
+  array(
83 83
     'name' => 'module_path',
84 84
     'type' => 'longtext',
85 85
     'vname' => 'LBL_MODULE_PATH',
86 86
     'isnull' => true,
87 87
   ),
88 88
   'field' => 
89
-  array (
89
+  array(
90 90
     'required' => false,
91 91
     'name' => 'field',
92 92
     'vname' => 'LBL_FIELD',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     'dependency' => false,
109 109
   ),
110 110
   'operator' => 
111
-  array (
111
+  array(
112 112
     'required' => false,
113 113
     'name' => 'operator',
114 114
     'vname' => 'LBL_OPERATOR',
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     'dependency' => false,
132 132
   ),
133 133
     'value_type' =>
134
-    array (
134
+    array(
135 135
     'required' => false,
136 136
     'name' => 'value_type',
137 137
     'vname' => 'LBL_VALUE_TYPE',
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     'size' => '20',
151 151
     ),
152 152
   'value' => 
153
-  array (
153
+  array(
154 154
     'required' => false,
155 155
     'name' => 'value',
156 156
     'vname' => 'LBL_VALUE',
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
     'size' => '20',
170 170
   ),
171 171
         'parameter' =>
172
-            array (
172
+            array(
173 173
                 'required' => false,
174 174
                 'name' => 'parameter',
175 175
                 'vname' => 'LBL_PARAMETER',
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
                 'studio' => 'visible',
188 188
             ),
189 189
   'aor_reports' =>
190
-  array (
190
+  array(
191 191
     'name' => 'aor_reports',
192 192
     'type' => 'link',
193 193
     'relationship' => 'aor_report_aor_conditions',
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     'source'=>'non-db',
197 197
   ),
198 198
 ),
199
-	'relationships'=>array (
199
+	'relationships'=>array(
200 200
 ),
201 201
     'indices' => array(
202 202
         array(
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	'unified_search'=>true,
210 210
 );
211 211
 
212
-if (!class_exists('VardefManager')){
212
+if (!class_exists('VardefManager')) {
213 213
         require_once('include/SugarObjects/VardefManager.php');
214 214
 }
215
-VardefManager::createVardef('AOR_Conditions','AOR_Condition', array('basic'));
215
+VardefManager::createVardef('AOR_Conditions', 'AOR_Condition', array('basic'));
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 $dictionary['AOR_Condition'] = array(
26
-	'table'=>'aor_conditions',
27
-	'audited'=>false,
28
-	'duplicate_merge'=>true,
29
-	'fields'=>array (
30
-  'aor_report_id' =>
31
-  array (
26
+    'table'=>'aor_conditions',
27
+    'audited'=>false,
28
+    'duplicate_merge'=>true,
29
+    'fields'=>array (
30
+    'aor_report_id' =>
31
+    array (
32 32
     'required' => false,
33 33
     'name' => 'aor_report_id',
34 34
     'vname' => 'LBL_AOR_REPORT_ID',
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
     'merge_filter' => 'disabled',
46 46
     'len' => 36,
47 47
     'size' => '20',
48
-  ),
49
-  'condition_order' => 
50
-  array (
48
+    ),
49
+    'condition_order' => 
50
+    array (
51 51
     'required' => false,
52 52
     'name' => 'condition_order',
53 53
     'vname' => 'LBL_ORDER',
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     'size' => '20',
67 67
     'enable_range_search' => false,
68 68
     'disable_num_format' => '',
69
-  ),
69
+    ),
70 70
         'logic_op' => array(
71 71
             'name' => 'logic_op',
72 72
             'vname' => 'LBL_LOGIC_OP',
@@ -78,15 +78,15 @@  discard block
 block discarded – undo
78 78
             'vname' => 'LBL_PARENTHESIS',
79 79
             'type' => 'varchar',
80 80
         ),
81
-  'module_path' =>
82
-  array (
81
+    'module_path' =>
82
+    array (
83 83
     'name' => 'module_path',
84 84
     'type' => 'longtext',
85 85
     'vname' => 'LBL_MODULE_PATH',
86 86
     'isnull' => true,
87
-  ),
88
-  'field' => 
89
-  array (
87
+    ),
88
+    'field' => 
89
+    array (
90 90
     'required' => false,
91 91
     'name' => 'field',
92 92
     'vname' => 'LBL_FIELD',
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
     'options' => 'user_type_dom',
107 107
     'studio' => 'visible',
108 108
     'dependency' => false,
109
-  ),
110
-  'operator' => 
111
-  array (
109
+    ),
110
+    'operator' => 
111
+    array (
112 112
     'required' => false,
113 113
     'name' => 'operator',
114 114
     'vname' => 'LBL_OPERATOR',
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     'options' => 'aor_operator_list',
130 130
     'studio' => 'visible',
131 131
     'dependency' => false,
132
-  ),
132
+    ),
133 133
     'value_type' =>
134 134
     array (
135 135
     'required' => false,
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
     'options' => 'aor_condition_type_list',
153 153
     'studio' => 'visible',
154 154
     'dependency' => false,
155
-  ),
156
-  'value' => 
157
-  array (
155
+    ),
156
+    'value' => 
157
+    array (
158 158
     'required' => false,
159 159
     'name' => 'value',
160 160
     'vname' => 'LBL_VALUE',
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
     'merge_filter' => 'disabled',
172 172
     'len' => '255',
173 173
     'size' => '20',
174
-  ),
174
+    ),
175 175
         'parameter' =>
176 176
             array (
177 177
                 'required' => false,
@@ -190,17 +190,17 @@  discard block
 block discarded – undo
190 190
                 'merge_filter' => 'disabled',
191 191
                 'studio' => 'visible',
192 192
             ),
193
-  'aor_reports' =>
194
-  array (
193
+    'aor_reports' =>
194
+    array (
195 195
     'name' => 'aor_reports',
196 196
     'type' => 'link',
197 197
     'relationship' => 'aor_report_aor_conditions',
198 198
     'module'=>'AOR_Reports',
199 199
     'bean_name'=>'AOR_Reports',
200 200
     'source'=>'non-db',
201
-  ),
201
+    ),
202 202
 ),
203
-	'relationships'=>array (
203
+    'relationships'=>array (
204 204
 ),
205 205
     'indices' => array(
206 206
         array(
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
             'fields' => array('aor_report_id'),
210 210
         ),
211 211
     ),
212
-	'optimistic_locking'=>true,
213
-	'unified_search'=>true,
212
+    'optimistic_locking'=>true,
213
+    'unified_search'=>true,
214 214
 );
215 215
 
216 216
 if (!class_exists('VardefManager')){
Please login to merge, or discard this patch.
modules/AOR_Conditions/conditionLines.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
  */
24 24
 
25 25
 
26
-function display_condition_lines($focus, $field, $value, $view){
26
+function display_condition_lines($focus, $field, $value, $view) {
27 27
 
28 28
     global $locale, $app_list_strings, $mod_strings;
29 29
 
30 30
     $html = '';
31 31
 
32
-    if (!is_file('cache/jsLanguage/AOR_Conditions/' . $GLOBALS['current_language'] . '.js')) {
32
+    if (!is_file('cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js')) {
33 33
         require_once ('include/language/jsLanguage.php');
34 34
         jsLanguage::createModuleStringsCache('AOR_Conditions', $GLOBALS['current_language']);
35 35
     }
36
-    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'. $GLOBALS['current_language'] . '.js"></script>';
36
+    $html .= '<script src="cache/jsLanguage/AOR_Conditions/'.$GLOBALS['current_language'].'.js"></script>';
37 37
 
38
-    if($view == 'EditView'){
38
+    if ($view == 'EditView') {
39 39
 
40 40
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
41 41
         $html .= "<table border='0' cellspacing='4' width='100%' id='conditionLines'></table>";
@@ -45,12 +45,12 @@  discard block
 block discarded – undo
45 45
         $html .= "</div>";
46 46
 
47 47
 
48
-        if(isset($focus->report_module) && $focus->report_module != ''){
48
+        if (isset($focus->report_module) && $focus->report_module != '') {
49 49
             require_once("modules/AOW_WorkFlow/aow_utils.php");
50 50
             $html .= "<script>";
51 51
             $html .= "report_module = \"".$focus->report_module."\";";
52 52
             $html .= "document.getElementById('btn_ConditionLine').disabled = '';";
53
-            if($focus->id != ''){
53
+            if ($focus->id != '') {
54 54
                 $sql = "SELECT id FROM aor_conditions WHERE aor_report_id = '".$focus->id."' AND deleted = 0 ORDER BY condition_order ASC";
55 55
                 $result = $focus->db->query($sql);
56 56
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
                     $condition_name = new AOR_Condition();
59 59
                     $condition_name->retrieve($row['id']);
60 60
                     $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
61
-                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module,$condition_name->module_path[0]))))."\";";
62
-                    if($condition_name->value_type == 'Date'){
61
+                    $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields(getRelatedModule($focus->report_module, $condition_name->module_path[0]))))."\";";
62
+                    if ($condition_name->value_type == 'Date') {
63 63
                         $condition_name->value = unserialize(base64_decode($condition_name->value));
64 64
                     }
65 65
                     $condition_item = json_encode($condition_name->toArray());
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
         }
72 72
 
73 73
     }
74
-    else if($view == 'DetailView'){
74
+    else if ($view == 'DetailView') {
75 75
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
76 76
         $html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>";
77 77
 
78 78
 
79
-        if(isset($focus->report_module) && $focus->report_module != ''){
79
+        if (isset($focus->report_module) && $focus->report_module != '') {
80 80
             require_once("modules/AOW_WorkFlow/aow_utils.php");
81 81
             $html .= "<script>";
82 82
             $html .= "report_fields = \"".trim(preg_replace('/\s+/', ' ', getModuleFields($focus->report_module)))."\";";
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $condition_name = new AOR_Condition();
89 89
                 $condition_name->retrieve($row['id']);
90 90
                 $condition_name->module_path = unserialize(base64_decode($condition_name->module_path));
91
-                if($condition_name->value_type == 'Date'){
91
+                if ($condition_name->value_type == 'Date') {
92 92
                     $condition_name->value = unserialize(base64_decode($condition_name->value));
93 93
                 }
94 94
                 $condition_item = json_encode($condition_name->toArray());
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,7 @@
 block discarded – undo
70 70
             $html .= "</script>";
71 71
         }
72 72
 
73
-    }
74
-    else if($view == 'DetailView'){
73
+    } else if($view == 'DetailView'){
75 74
         $html .= '<script src="modules/AOR_Conditions/conditionLines.js"></script>';
76 75
         $html .= "<table border='0' cellspacing='0' width='100%' id='conditionLines'></table>";
77 76
 
Please login to merge, or discard this patch.