Completed
Push — master ( a75ecc...97ae17 )
by Adam
71:21 queued 52:34
created
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   +32 added lines, -32 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,14 +174,14 @@  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
 
Please login to merge, or discard this patch.
Braces   +8 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.
@@ -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];
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.
modules/EmailTemplates/field_arrays.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -46,19 +46,19 @@
 block discarded – undo
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48 48
 $fields_array['EmailTemplate'] = array ('column_fields' => Array("id"
49
-		, "date_entered"
50
-		, "date_modified"
51
-		, "modified_user_id"
52
-		, "created_by"
53
-		, "description"
54
-		, "subject"
55
-		, "body"
56
-		, "body_html"
57
-		, "name"
58
-		, "published"
59
-		),
49
+        , "date_entered"
50
+        , "date_modified"
51
+        , "modified_user_id"
52
+        , "created_by"
53
+        , "description"
54
+        , "subject"
55
+        , "body"
56
+        , "body_html"
57
+        , "name"
58
+        , "published"
59
+        ),
60 60
         'list_fields' =>  Array('id', 'name', 'description','date_modified'
61
-	),
61
+    ),
62 62
     'required_fields' => array("name"=>1),
63 63
 );
64 64
 ?>
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 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.
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
  * All Rights Reserved.
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48
-$fields_array['EmailTemplate'] = array ('column_fields' => Array("id"
48
+$fields_array['EmailTemplate'] = array('column_fields' => Array("id"
49 49
 		, "date_entered"
50 50
 		, "date_modified"
51 51
 		, "modified_user_id"
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		, "name"
58 58
 		, "published"
59 59
 		),
60
-        'list_fields' =>  Array('id', 'name', 'description','date_modified'
60
+        'list_fields' =>  Array('id', 'name', 'description', 'date_modified'
61 61
 	),
62 62
     'required_fields' => array("name"=>1),
63 63
 );
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/EmailTemplates/PopupDocumentsCampaignTemplate.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,14 +76,14 @@
 block discarded – undo
76 76
 $button  = "<form action='index.php' method='post' name='form' id='form'>\n";
77 77
 if(!$hide_clear_button)
78 78
 {
79
-	$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
80
-		.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
81
-		.$app_strings['LBL_CLEAR_BUTTON_LABEL']."  ' />\n";
79
+    $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
80
+        .$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
81
+        .$app_strings['LBL_CLEAR_BUTTON_LABEL']."  ' />\n";
82 82
 }
83 83
 $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
84
-	.$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
85
-	.$app_strings['LBL_CANCEL_BUTTON_KEY']."' value='  "
86
-	.$app_strings['LBL_CANCEL_BUTTON_LABEL']."  ' />\n";
84
+    .$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
85
+    .$app_strings['LBL_CANCEL_BUTTON_KEY']."' value='  "
86
+    .$app_strings['LBL_CANCEL_BUTTON_LABEL']."  ' />\n";
87 87
 $button .= "</form>\n";
88 88
 
89 89
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 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.
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 
74 74
 
75 75
 $hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
76
-$button  = "<form action='index.php' method='post' name='form' id='form'>\n";
77
-if(!$hide_clear_button)
76
+$button = "<form action='index.php' method='post' name='form' id='form'>\n";
77
+if (!$hide_clear_button)
78 78
 {
79 79
 	$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
80 80
 		.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' value='  "
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 $form->assign('MODULE_NAME', $currentModule);
95 95
 $form->assign('NAME', $name);
96 96
 $form->assign('DOCUMENT_NAME', $document_name);
97
-if(isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
97
+if (isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
98 98
 else $form->assign('DOCUMENT_TARGET', '');
99 99
 
100 100
 $form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 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.
@@ -94,8 +96,11 @@  discard block
 block discarded – undo
94 96
 $form->assign('MODULE_NAME', $currentModule);
95 97
 $form->assign('NAME', $name);
96 98
 $form->assign('DOCUMENT_NAME', $document_name);
97
-if(isset($_REQUEST['target'])) $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
98
-else $form->assign('DOCUMENT_TARGET', '');
99
+if(isset($_REQUEST['target'])) {
100
+    $form->assign('DOCUMENT_TARGET', $_REQUEST['target']);
101
+} else {
102
+    $form->assign('DOCUMENT_TARGET', '');
103
+}
99 104
 
100 105
 $form->assign('DOCUMENT_REVISION_ID', $document_revision_id);
101 106
 
Please login to merge, or discard this patch.
modules/EmailTemplates/EmailTemplateFormBase.php 3 patches
Indentation   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -54,24 +54,24 @@  discard block
 block discarded – undo
54 54
 
55 55
     }
56 56
 
57
-	function getFormBody($prefix, $mod='',$formname='', $size='30') {
57
+    function getFormBody($prefix, $mod='',$formname='', $size='30') {
58 58
 
59 59
 
60
-		global $mod_strings;
60
+        global $mod_strings;
61 61
 
62
-		$temp_strings = $mod_strings;
62
+        $temp_strings = $mod_strings;
63 63
 
64
-		if(!empty($mod)) {
65
-			global $current_language;
66
-			$mod_strings = return_module_language($current_language, $mod);
67
-		}
68
-					global $app_strings;
69
-					global $app_list_strings;
64
+        if(!empty($mod)) {
65
+            global $current_language;
66
+            $mod_strings = return_module_language($current_language, $mod);
67
+        }
68
+                    global $app_strings;
69
+                    global $app_list_strings;
70 70
 
71
-				$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
72
-				$lbl_subject = $mod_strings['LBL_NOTE_SUBJECT'];
73
-				$lbl_description = $mod_strings['LBL_NOTE'];
74
-				$default_parent_type= $app_list_strings['record_type_default_key'];
71
+                $lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
72
+                $lbl_subject = $mod_strings['LBL_NOTE_SUBJECT'];
73
+                $lbl_description = $mod_strings['LBL_NOTE'];
74
+                $default_parent_type= $app_list_strings['record_type_default_key'];
75 75
 
76 76
 $form = <<<EOF
77 77
 				<input type="hidden" name="${prefix}record" value="">
@@ -93,105 +93,105 @@  discard block
 block discarded – undo
93 93
 				</table></p>
94 94
 EOF;
95 95
 
96
-	$javascript = new javascript();
97
-	$javascript->setFormName($formname);
98
-	$javascript->setSugarBean(new EmailTemplate());
99
-	$javascript->addRequiredFields($prefix);
100
-	$form .=$javascript->getScript();
101
-	$mod_strings = $temp_strings;
102
-	return $form;
103
-	}
104
-
105
-	function getForm($prefix, $mod='') {
106
-		if(!empty($mod)) {
107
-		global $current_language;
108
-		$mod_strings = return_module_language($current_language, $mod);
109
-	}else global $mod_strings;
110
-		global $app_strings;
111
-		global $app_list_strings;
112
-
113
-		$lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
114
-		$lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
115
-		$lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
116
-
117
-
118
-		$the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
96
+    $javascript = new javascript();
97
+    $javascript->setFormName($formname);
98
+    $javascript->setSugarBean(new EmailTemplate());
99
+    $javascript->addRequiredFields($prefix);
100
+    $form .=$javascript->getScript();
101
+    $mod_strings = $temp_strings;
102
+    return $form;
103
+    }
104
+
105
+    function getForm($prefix, $mod='') {
106
+        if(!empty($mod)) {
107
+        global $current_language;
108
+        $mod_strings = return_module_language($current_language, $mod);
109
+    }else global $mod_strings;
110
+        global $app_strings;
111
+        global $app_list_strings;
112
+
113
+        $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
114
+        $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
115
+        $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
116
+
117
+
118
+        $the_form = get_left_form_header($mod_strings['LBL_NEW_FORM_TITLE']);
119 119
 $the_form .= <<<EOQ
120 120
 
121 121
 				<form name="${prefix}EmailTemplateSave" onSubmit="return check_form('${prefix}EmailTemplateSave')" method="POST" action="index.php">
122 122
 					<input type="hidden" name="${prefix}module" value="EmailTemplates">
123 123
 					<input type="hidden" name="${prefix}action" value="Save">
124 124
 EOQ;
125
-		$the_form .= $this->getFormBody($prefix, $mod, "${prefix}EmailTemplateSave", "20");
125
+        $the_form .= $this->getFormBody($prefix, $mod, "${prefix}EmailTemplateSave", "20");
126 126
 $the_form .= <<<EOQ
127 127
 				<p><input title="$lbl_save_button_title" accessKey="$lbl_save_button_key" class="button" type="submit" name="button" value="  $lbl_save_button_label  " ></p>
128 128
 				</form>
129 129
 
130 130
 EOQ;
131 131
 
132
-		$the_form .= get_left_form_footer();
133
-		$the_form .= get_validate_record_js();
132
+        $the_form .= get_left_form_footer();
133
+        $the_form .= get_validate_record_js();
134 134
 
135 135
 
136
-		return $the_form;
137
-	}
138
-
136
+        return $the_form;
137
+    }
139 138
 
140
-	function handleSave($prefix,$redirect=true, $useRequired=false)
141
-	{
142
-		require_once('include/formbase.php');
143
-		require_once('include/upload_file.php');
144
-		global $upload_maxsize;
145
-		global $mod_strings;
146
-		global $sugar_config;
147 139
 
148
-		$focus = new EmailTemplate();
149
-		if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150
-			return null;
151
-		}
152
-		$focus = populateFromPost($prefix, $focus);
140
+    function handleSave($prefix,$redirect=true, $useRequired=false)
141
+    {
142
+        require_once('include/formbase.php');
143
+        require_once('include/upload_file.php');
144
+        global $upload_maxsize;
145
+        global $mod_strings;
146
+        global $sugar_config;
147
+
148
+        $focus = new EmailTemplate();
149
+        if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150
+            return null;
151
+        }
152
+        $focus = populateFromPost($prefix, $focus);
153 153
         //process the text only flag
154 154
         if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
155 155
             $focus->text_only = 1;
156 156
         }else{
157 157
             $focus->text_only = 0;
158 158
         }
159
-		if(!$focus->ACLAccess('Save')) {
160
-			ACLController::displayNoAccess(true);
161
-			sugar_cleanup(true);
162
-		}
163
-		if(!isset($_REQUEST['published'])) $focus->published = 'off';
164
-
165
-		$preProcessedImages = array();
166
-		$emailTemplateBodyHtml = from_html($focus->body_html);
167
-		if(strpos($emailTemplateBodyHtml, '"cache/images/')) {
168
-			$matches = array();
169
-			preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
170
-			foreach($matches[1] as $match) {
171
-				$filename = urldecode($match);
159
+        if(!$focus->ACLAccess('Save')) {
160
+            ACLController::displayNoAccess(true);
161
+            sugar_cleanup(true);
162
+        }
163
+        if(!isset($_REQUEST['published'])) $focus->published = 'off';
164
+
165
+        $preProcessedImages = array();
166
+        $emailTemplateBodyHtml = from_html($focus->body_html);
167
+        if(strpos($emailTemplateBodyHtml, '"cache/images/')) {
168
+            $matches = array();
169
+            preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
170
+            foreach($matches[1] as $match) {
171
+                $filename = urldecode($match);
172 172
                 if($filename != pathinfo($filename, PATHINFO_BASENAME)) {
173 173
                     // don't allow paths there
174 174
                     $emailTemplateBodyHtml = str_replace("cache/images/$match", "", $emailTemplateBodyHtml);
175 175
                     continue;
176 176
                 }
177
-				$file_location = sugar_cached("images/{$filename}");
178
-				$mime_type = pathinfo($filename, PATHINFO_EXTENSION);
179
-
180
-				if(file_exists($file_location)) {
181
-					$id = create_guid();
182
-					$newFileLocation = "upload://$id";
183
-					if(!copy($file_location, $newFileLocation)) {
184
-						$GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
185
-					} else {
186
-						$secureLink = "index.php?entryPoint=download&type=Notes&id={$id}";
187
-					    $emailTemplateBodyHtml = str_replace("cache/images/$match", $secureLink, $emailTemplateBodyHtml);
188
-						unlink($file_location);
189
-						$preProcessedImages[$filename] = $id;
190
-					}
191
-				} // if
192
-			} // foreach
193
-		} // if
194
-		if (isset($GLOBALS['check_notify'])) {
177
+                $file_location = sugar_cached("images/{$filename}");
178
+                $mime_type = pathinfo($filename, PATHINFO_EXTENSION);
179
+
180
+                if(file_exists($file_location)) {
181
+                    $id = create_guid();
182
+                    $newFileLocation = "upload://$id";
183
+                    if(!copy($file_location, $newFileLocation)) {
184
+                        $GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
185
+                    } else {
186
+                        $secureLink = "index.php?entryPoint=download&type=Notes&id={$id}";
187
+                        $emailTemplateBodyHtml = str_replace("cache/images/$match", $secureLink, $emailTemplateBodyHtml);
188
+                        unlink($file_location);
189
+                        $preProcessedImages[$filename] = $id;
190
+                    }
191
+                } // if
192
+            } // foreach
193
+        } // if
194
+        if (isset($GLOBALS['check_notify'])) {
195 195
             $check_notify = $GLOBALS['check_notify'];
196 196
         }
197 197
         else {
@@ -199,183 +199,183 @@  discard block
 block discarded – undo
199 199
         }
200 200
         $focus->body_html = $emailTemplateBodyHtml;
201 201
         $return_id = $focus->save($check_notify);
202
-		///////////////////////////////////////////////////////////////////////////////
203
-		////	ATTACHMENT HANDLING
202
+        ///////////////////////////////////////////////////////////////////////////////
203
+        ////	ATTACHMENT HANDLING
204
+
205
+        ///////////////////////////////////////////////////////////////////////////
206
+        ////	ADDING NEW ATTACHMENTS
207
+
208
+        $max_files_upload = count($_FILES);
209
+
210
+        if(!empty($focus->id)) {
211
+            $note = new Note();
212
+            $where = "notes.parent_id='{$focus->id}'";
213
+            if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
214
+                $where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
215
+            }
216
+            $notes_list = $note->get_full_list("", $where, true);
217
+        }
204 218
 
205
-		///////////////////////////////////////////////////////////////////////////
206
-		////	ADDING NEW ATTACHMENTS
219
+        if(!isset($notes_list)) {
220
+            $notes_list = array();
221
+        }
207 222
 
208
-		$max_files_upload = count($_FILES);
223
+        if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
224
+            $focus->attachments = array();
225
+        }
226
+        $focus->attachments = array_merge($focus->attachments, $notes_list);
209 227
 
210
-		if(!empty($focus->id)) {
211
-			$note = new Note();
212
-			$where = "notes.parent_id='{$focus->id}'";
213
-			if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
214
-				$where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
215
-			}
216
-			$notes_list = $note->get_full_list("", $where, true);
217
-		}
218 228
 
219
-		if(!isset($notes_list)) {
220
-			$notes_list = array();
221
-		}
222 229
 
223
-		if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
224
-			$focus->attachments = array();
225
-		}
226
-		$focus->attachments = array_merge($focus->attachments, $notes_list);
230
+        //for($i = 0; $i < $max_files_upload; $i++) {
227 231
 
232
+        foreach ($_FILES as $key => $file)
233
+        {
234
+            $note = new Note();
228 235
 
236
+            //Images are presaved above so we need to prevent duplicate files from being created.
237
+            if( isset($preProcessedImages[$file['name']]) )
238
+            {
239
+                $oldId = $preProcessedImages[$file['name']];
240
+                $note->id = $oldId;
241
+                $note->new_with_id = TRUE;
242
+                $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
243
+            }
229 244
 
230
-		//for($i = 0; $i < $max_files_upload; $i++) {
245
+            $i=preg_replace("/email_attachment(.+)/",'$1',$key);
246
+            $upload_file = new UploadFile($key);
247
+
248
+            if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
249
+                $note->filename = $upload_file->get_stored_file_name();
250
+                $note->file = $upload_file;
251
+                $note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
252
+                if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253
+                    if($_REQUEST['embedded'.$i]=='true'){
254
+                        $note->embed_flag =true;
255
+                    }
256
+                    else{
257
+                        $note->embed_flag =false;
258
+                    }
259
+                }
260
+                array_push($focus->attachments, $note);
261
+            }
231 262
 
232
-		foreach ($_FILES as $key => $file)
233
-		{
234
-			$note = new Note();
263
+        }
235 264
 
236
-			//Images are presaved above so we need to prevent duplicate files from being created.
237
-			if( isset($preProcessedImages[$file['name']]) )
238
-			{
239
-			    $oldId = $preProcessedImages[$file['name']];
240
-			    $note->id = $oldId;
241
-			    $note->new_with_id = TRUE;
242
-			    $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
265
+        $focus->saved_attachments = array();
266
+        foreach($focus->attachments as $note)
267
+        {
268
+            if( !empty($note->id) && $note->new_with_id === FALSE)
269
+            {
270
+                if(empty($_REQUEST['old_id']))
271
+                    array_push($focus->saved_attachments, $note); // to support duplication of email templates
272
+                else
273
+                {
274
+                    // we're duplicating a template with attachments
275
+                    // dupe the file, create a new note, assign the note to the new template
276
+                    $newNote = new Note();
277
+                    $newNote->retrieve($note->id);
278
+                    $newNote->id = create_guid();
279
+                    $newNote->parent_id = $focus->id;
280
+                    $newNote->new_with_id = true;
281
+                    $newNote->date_modified = '';
282
+                    $newNote->date_entered = '';
283
+                    /* BEGIN - SECURITY GROUPS */
284
+                    //Need to do this so that attachments show under an EmailTemplate correctly for a normal user
285
+                    global $current_user;
286
+                    $newNote->assigned_user_id = $current_user->id;
287
+                    /* END - SECURITY GROUPS */
288
+                    $newNoteId = $newNote->save();
289
+
290
+                    UploadFile::duplicate_file($note->id, $newNoteId, $note->filename);
291
+                }
292
+                continue;
243 293
             }
294
+            $note->parent_id = $focus->id;
295
+            $note->parent_type = 'Emails';
296
+            $note->file_mime_type = $note->file->mime_type;
297
+            /* BEGIN - SECURITY GROUPS */
298
+            //Need to do this so that attachments show under an EmailTemplate correctly for a normal user
299
+            global $current_user;
300
+            $note->assigned_user_id = $current_user->id;
301
+            /* END - SECURITY GROUPS */
302
+            $note_id = $note->save();
303
+            array_push($focus->saved_attachments, $note);
304
+            $note->id = $note_id;
305
+
306
+            if($note->new_with_id === FALSE)
307
+                $note->file->final_move($note->id);
308
+            else
309
+                $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
310
+        }
244 311
 
245
-			$i=preg_replace("/email_attachment(.+)/",'$1',$key);
246
-			$upload_file = new UploadFile($key);
247
-
248
-			if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
249
-				$note->filename = $upload_file->get_stored_file_name();
250
-				$note->file = $upload_file;
251
-				$note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
252
-				if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253
-                  if($_REQUEST['embedded'.$i]=='true'){
254
-				  	$note->embed_flag =true;
255
-                  }
256
-                  else{
257
-                  	$note->embed_flag =false;
258
-                  }
259
-				}
260
-				array_push($focus->attachments, $note);
261
-			}
262
-
263
-		}
264
-
265
-		$focus->saved_attachments = array();
266
-		foreach($focus->attachments as $note)
267
-		{
268
-			if( !empty($note->id) && $note->new_with_id === FALSE)
269
-			{
270
-				if(empty($_REQUEST['old_id']))
271
-					array_push($focus->saved_attachments, $note); // to support duplication of email templates
272
-				else
273
-				{
274
-					// we're duplicating a template with attachments
275
-					// dupe the file, create a new note, assign the note to the new template
276
-					$newNote = new Note();
277
-					$newNote->retrieve($note->id);
278
-					$newNote->id = create_guid();
279
-					$newNote->parent_id = $focus->id;
280
-					$newNote->new_with_id = true;
281
-					$newNote->date_modified = '';
282
-					$newNote->date_entered = '';
283
-					/* BEGIN - SECURITY GROUPS */
284
-					//Need to do this so that attachments show under an EmailTemplate correctly for a normal user
285
-					global $current_user;
286
-					$newNote->assigned_user_id = $current_user->id;
287
-					/* END - SECURITY GROUPS */
288
-					$newNoteId = $newNote->save();
289
-
290
-					UploadFile::duplicate_file($note->id, $newNoteId, $note->filename);
291
-				}
292
-				continue;
293
-			}
294
-			$note->parent_id = $focus->id;
295
-			$note->parent_type = 'Emails';
296
-			$note->file_mime_type = $note->file->mime_type;
297
-			/* BEGIN - SECURITY GROUPS */
298
-			//Need to do this so that attachments show under an EmailTemplate correctly for a normal user
299
-			global $current_user;
300
-			$note->assigned_user_id = $current_user->id;
301
-			/* END - SECURITY GROUPS */
302
-			$note_id = $note->save();
303
-			array_push($focus->saved_attachments, $note);
304
-			$note->id = $note_id;
305
-
306
-			if($note->new_with_id === FALSE)
307
-    			$note->file->final_move($note->id);
308
-    	    else
309
-    	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
310
-		}
311
-
312
-		////	END NEW ATTACHMENTS
313
-		///////////////////////////////////////////////////////////////////////////
314
-
315
-	///////////////////////////////////////////////////////////////////////////
316
-	////	ATTACHMENTS FROM DOCUMENTS
317
-	$count='';
318
-	//_pp($_REQUEST);
319
-	//_ppd(count($_REQUEST['document']));
320
-	if(!empty($_REQUEST['document'])){
321
-      $count = count($_REQUEST['document']);
312
+        ////	END NEW ATTACHMENTS
313
+        ///////////////////////////////////////////////////////////////////////////
314
+
315
+    ///////////////////////////////////////////////////////////////////////////
316
+    ////	ATTACHMENTS FROM DOCUMENTS
317
+    $count='';
318
+    //_pp($_REQUEST);
319
+    //_ppd(count($_REQUEST['document']));
320
+    if(!empty($_REQUEST['document'])){
321
+        $count = count($_REQUEST['document']);
322 322
     }
323 323
     else{
324
-    	$count=10;
324
+        $count=10;
325 325
     }
326 326
 
327
-	for($i=0; $i<$count; $i++) {
328
-		if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
329
-			$doc = new Document();
330
-			$docRev = new DocumentRevision();
331
-			$docNote = new Note();
327
+    for($i=0; $i<$count; $i++) {
328
+        if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
329
+            $doc = new Document();
330
+            $docRev = new DocumentRevision();
331
+            $docNote = new Note();
332 332
 
333
-			$doc->retrieve($_REQUEST['documentId'.$i]);
334
-			$docRev->retrieve($doc->document_revision_id);
333
+            $doc->retrieve($_REQUEST['documentId'.$i]);
334
+            $docRev->retrieve($doc->document_revision_id);
335 335
 
336
-			array_push($focus->saved_attachments, $docRev);
336
+            array_push($focus->saved_attachments, $docRev);
337 337
 
338
-			$docNote->name = $doc->document_name;
339
-			$docNote->filename = $docRev->filename;
340
-			$docNote->description = $doc->description;
341
-			$docNote->parent_id = $focus->id;
342
-			$docNote->parent_type = 'Emails';
343
-			$docNote->file_mime_type = $docRev->file_mime_type;
344
-			$docId = $docNote = $docNote->save();
338
+            $docNote->name = $doc->document_name;
339
+            $docNote->filename = $docRev->filename;
340
+            $docNote->description = $doc->description;
341
+            $docNote->parent_id = $focus->id;
342
+            $docNote->parent_type = 'Emails';
343
+            $docNote->file_mime_type = $docRev->file_mime_type;
344
+            $docId = $docNote = $docNote->save();
345 345
 
346
-			UploadFile::duplicate_file($docRev->id, $docId, $docRev->filename);
347
-		}
346
+            UploadFile::duplicate_file($docRev->id, $docId, $docRev->filename);
347
+        }
348 348
 
349
-	}
349
+    }
350 350
 
351
-	////	END ATTACHMENTS FROM DOCUMENTS
352
-	///////////////////////////////////////////////////////////////////////////
351
+    ////	END ATTACHMENTS FROM DOCUMENTS
352
+    ///////////////////////////////////////////////////////////////////////////
353 353
 
354
-		///////////////////////////////////////////////////////////////////////////
355
-		////	REMOVE ATTACHMENTS
354
+        ///////////////////////////////////////////////////////////////////////////
355
+        ////	REMOVE ATTACHMENTS
356 356
 
357
-		if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
-			foreach($_REQUEST['remove_attachment'] as $noteId) {
359
-				$q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
360
-				$focus->db->query($q);
361
-			}
357
+        if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
+            foreach($_REQUEST['remove_attachment'] as $noteId) {
359
+                $q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
360
+                $focus->db->query($q);
361
+            }
362 362
 
363
-		}
363
+        }
364 364
 
365
-		////	END REMOVE ATTACHMENTS
366
-		///////////////////////////////////////////////////////////////////////////
367
-	////	END ATTACHMENT HANDLING
368
-	///////////////////////////////////////////////////////////////////////////////
365
+        ////	END REMOVE ATTACHMENTS
366
+        ///////////////////////////////////////////////////////////////////////////
367
+    ////	END ATTACHMENT HANDLING
368
+    ///////////////////////////////////////////////////////////////////////////////
369 369
 
370 370
         clear_register_value('select_array', $focus->object_name);
371 371
 
372
-		if($redirect) {
373
-		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
374
-			handleRedirect($return_id, "EmailTemplates");
375
-		}else{
376
-			return $focus;
377
-		}
378
-	}
372
+        if($redirect) {
373
+        $GLOBALS['log']->debug("Saved record with id of ".$return_id);
374
+            handleRedirect($return_id, "EmailTemplates");
375
+        }else{
376
+            return $focus;
377
+        }
378
+    }
379 379
 
380 380
 }
381 381
 ?>
382 382
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 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.
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 
55 55
     }
56 56
 
57
-	function getFormBody($prefix, $mod='',$formname='', $size='30') {
57
+	function getFormBody($prefix, $mod = '', $formname = '', $size = '30') {
58 58
 
59 59
 
60 60
 		global $mod_strings;
61 61
 
62 62
 		$temp_strings = $mod_strings;
63 63
 
64
-		if(!empty($mod)) {
64
+		if (!empty($mod)) {
65 65
 			global $current_language;
66 66
 			$mod_strings = return_module_language($current_language, $mod);
67 67
 		}
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				$lbl_required_symbol = $app_strings['LBL_REQUIRED_SYMBOL'];
72 72
 				$lbl_subject = $mod_strings['LBL_NOTE_SUBJECT'];
73 73
 				$lbl_description = $mod_strings['LBL_NOTE'];
74
-				$default_parent_type= $app_list_strings['record_type_default_key'];
74
+				$default_parent_type = $app_list_strings['record_type_default_key'];
75 75
 
76 76
 $form = <<<EOF
77 77
 				<input type="hidden" name="${prefix}record" value="">
@@ -97,16 +97,16 @@  discard block
 block discarded – undo
97 97
 	$javascript->setFormName($formname);
98 98
 	$javascript->setSugarBean(new EmailTemplate());
99 99
 	$javascript->addRequiredFields($prefix);
100
-	$form .=$javascript->getScript();
100
+	$form .= $javascript->getScript();
101 101
 	$mod_strings = $temp_strings;
102 102
 	return $form;
103 103
 	}
104 104
 
105
-	function getForm($prefix, $mod='') {
106
-		if(!empty($mod)) {
105
+	function getForm($prefix, $mod = '') {
106
+		if (!empty($mod)) {
107 107
 		global $current_language;
108 108
 		$mod_strings = return_module_language($current_language, $mod);
109
-	}else global $mod_strings;
109
+	} else global $mod_strings;
110 110
 		global $app_strings;
111 111
 		global $app_list_strings;
112 112
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	}
138 138
 
139 139
 
140
-	function handleSave($prefix,$redirect=true, $useRequired=false)
140
+	function handleSave($prefix, $redirect = true, $useRequired = false)
141 141
 	{
142 142
 		require_once('include/formbase.php');
143 143
 		require_once('include/upload_file.php');
@@ -146,30 +146,30 @@  discard block
 block discarded – undo
146 146
 		global $sugar_config;
147 147
 
148 148
 		$focus = new EmailTemplate();
149
-		if($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
149
+		if ($useRequired && !checkRequired($prefix, array_keys($focus->required_fields))) {
150 150
 			return null;
151 151
 		}
152 152
 		$focus = populateFromPost($prefix, $focus);
153 153
         //process the text only flag
154
-        if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
154
+        if (isset($_POST['text_only']) && ($_POST['text_only'] == '1')) {
155 155
             $focus->text_only = 1;
156
-        }else{
156
+        } else {
157 157
             $focus->text_only = 0;
158 158
         }
159
-		if(!$focus->ACLAccess('Save')) {
159
+		if (!$focus->ACLAccess('Save')) {
160 160
 			ACLController::displayNoAccess(true);
161 161
 			sugar_cleanup(true);
162 162
 		}
163
-		if(!isset($_REQUEST['published'])) $focus->published = 'off';
163
+		if (!isset($_REQUEST['published'])) $focus->published = 'off';
164 164
 
165 165
 		$preProcessedImages = array();
166 166
 		$emailTemplateBodyHtml = from_html($focus->body_html);
167
-		if(strpos($emailTemplateBodyHtml, '"cache/images/')) {
167
+		if (strpos($emailTemplateBodyHtml, '"cache/images/')) {
168 168
 			$matches = array();
169 169
 			preg_match_all('#<img[^>]*[\s]+src[^=]*=[\s]*["\']cache/images/(.+?)["\']#si', $emailTemplateBodyHtml, $matches);
170
-			foreach($matches[1] as $match) {
170
+			foreach ($matches[1] as $match) {
171 171
 				$filename = urldecode($match);
172
-                if($filename != pathinfo($filename, PATHINFO_BASENAME)) {
172
+                if ($filename != pathinfo($filename, PATHINFO_BASENAME)) {
173 173
                     // don't allow paths there
174 174
                     $emailTemplateBodyHtml = str_replace("cache/images/$match", "", $emailTemplateBodyHtml);
175 175
                     continue;
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 				$file_location = sugar_cached("images/{$filename}");
178 178
 				$mime_type = pathinfo($filename, PATHINFO_EXTENSION);
179 179
 
180
-				if(file_exists($file_location)) {
180
+				if (file_exists($file_location)) {
181 181
 					$id = create_guid();
182 182
 					$newFileLocation = "upload://$id";
183
-					if(!copy($file_location, $newFileLocation)) {
183
+					if (!copy($file_location, $newFileLocation)) {
184 184
 						$GLOBALS['log']->debug("EMAIL Template could not copy attachment to $newFileLocation");
185 185
 					} else {
186 186
 						$secureLink = "index.php?entryPoint=download&type=Notes&id={$id}";
@@ -207,20 +207,20 @@  discard block
 block discarded – undo
207 207
 
208 208
 		$max_files_upload = count($_FILES);
209 209
 
210
-		if(!empty($focus->id)) {
210
+		if (!empty($focus->id)) {
211 211
 			$note = new Note();
212 212
 			$where = "notes.parent_id='{$focus->id}'";
213
-			if(!empty($_REQUEST['old_id'])) { // to support duplication of email templates
213
+			if (!empty($_REQUEST['old_id'])) { // to support duplication of email templates
214 214
 				$where .= " OR notes.parent_id='".htmlspecialchars($_REQUEST['old_id'], ENT_QUOTES)."'";
215 215
 			}
216 216
 			$notes_list = $note->get_full_list("", $where, true);
217 217
 		}
218 218
 
219
-		if(!isset($notes_list)) {
219
+		if (!isset($notes_list)) {
220 220
 			$notes_list = array();
221 221
 		}
222 222
 
223
-		if(!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
223
+		if (!is_array($focus->attachments)) { // PHP5 does not auto-create arrays(). Need to initialize it here.
224 224
 			$focus->attachments = array();
225 225
 		}
226 226
 		$focus->attachments = array_merge($focus->attachments, $notes_list);
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 			$note = new Note();
235 235
 
236 236
 			//Images are presaved above so we need to prevent duplicate files from being created.
237
-			if( isset($preProcessedImages[$file['name']]) )
237
+			if (isset($preProcessedImages[$file['name']]))
238 238
 			{
239 239
 			    $oldId = $preProcessedImages[$file['name']];
240 240
 			    $note->id = $oldId;
@@ -242,19 +242,19 @@  discard block
 block discarded – undo
242 242
 			    $GLOBALS['log']->debug("Image {$file['name']} has already been processed.");
243 243
             }
244 244
 
245
-			$i=preg_replace("/email_attachment(.+)/",'$1',$key);
245
+			$i = preg_replace("/email_attachment(.+)/", '$1', $key);
246 246
 			$upload_file = new UploadFile($key);
247 247
 
248
-			if(isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/",$key)) {
248
+			if (isset($_FILES[$key]) && $upload_file->confirm_upload() && preg_match("/^email_attachment/", $key)) {
249 249
 				$note->filename = $upload_file->get_stored_file_name();
250 250
 				$note->file = $upload_file;
251 251
 				$note->name = $mod_strings['LBL_EMAIL_ATTACHMENT'].': '.$note->file->original_file_name;
252
-				if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253
-                  if($_REQUEST['embedded'.$i]=='true'){
254
-				  	$note->embed_flag =true;
252
+				if (isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])) {
253
+                  if ($_REQUEST['embedded'.$i] == 'true') {
254
+				  	$note->embed_flag = true;
255 255
                   }
256
-                  else{
257
-                  	$note->embed_flag =false;
256
+                  else {
257
+                  	$note->embed_flag = false;
258 258
                   }
259 259
 				}
260 260
 				array_push($focus->attachments, $note);
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 		}
264 264
 
265 265
 		$focus->saved_attachments = array();
266
-		foreach($focus->attachments as $note)
266
+		foreach ($focus->attachments as $note)
267 267
 		{
268
-			if( !empty($note->id) && $note->new_with_id === FALSE)
268
+			if (!empty($note->id) && $note->new_with_id === FALSE)
269 269
 			{
270
-				if(empty($_REQUEST['old_id']))
270
+				if (empty($_REQUEST['old_id']))
271 271
 					array_push($focus->saved_attachments, $note); // to support duplication of email templates
272 272
 				else
273 273
 				{
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 			array_push($focus->saved_attachments, $note);
304 304
 			$note->id = $note_id;
305 305
 
306
-			if($note->new_with_id === FALSE)
306
+			if ($note->new_with_id === FALSE)
307 307
     			$note->file->final_move($note->id);
308 308
     	    else
309 309
     	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
@@ -314,18 +314,18 @@  discard block
 block discarded – undo
314 314
 
315 315
 	///////////////////////////////////////////////////////////////////////////
316 316
 	////	ATTACHMENTS FROM DOCUMENTS
317
-	$count='';
317
+	$count = '';
318 318
 	//_pp($_REQUEST);
319 319
 	//_ppd(count($_REQUEST['document']));
320
-	if(!empty($_REQUEST['document'])){
320
+	if (!empty($_REQUEST['document'])) {
321 321
       $count = count($_REQUEST['document']);
322 322
     }
323
-    else{
324
-    	$count=10;
323
+    else {
324
+    	$count = 10;
325 325
     }
326 326
 
327
-	for($i=0; $i<$count; $i++) {
328
-		if(isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
327
+	for ($i = 0; $i < $count; $i++) {
328
+		if (isset($_REQUEST['documentId'.$i]) && !empty($_REQUEST['documentId'.$i])) {
329 329
 			$doc = new Document();
330 330
 			$docRev = new DocumentRevision();
331 331
 			$docNote = new Note();
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 		///////////////////////////////////////////////////////////////////////////
355 355
 		////	REMOVE ATTACHMENTS
356 356
 
357
-		if(isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
-			foreach($_REQUEST['remove_attachment'] as $noteId) {
357
+		if (isset($_REQUEST['remove_attachment']) && !empty($_REQUEST['remove_attachment'])) {
358
+			foreach ($_REQUEST['remove_attachment'] as $noteId) {
359 359
 				$q = 'UPDATE notes SET deleted = 1 WHERE id = \''.$noteId.'\'';
360 360
 				$focus->db->query($q);
361 361
 			}
@@ -369,10 +369,10 @@  discard block
 block discarded – undo
369 369
 
370 370
         clear_register_value('select_array', $focus->object_name);
371 371
 
372
-		if($redirect) {
372
+		if ($redirect) {
373 373
 		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
374 374
 			handleRedirect($return_id, "EmailTemplates");
375
-		}else{
375
+		} else {
376 376
 			return $focus;
377 377
 		}
378 378
 	}
Please login to merge, or discard this patch.
Braces   +23 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.
@@ -106,7 +108,9 @@  discard block
 block discarded – undo
106 108
 		if(!empty($mod)) {
107 109
 		global $current_language;
108 110
 		$mod_strings = return_module_language($current_language, $mod);
109
-	}else global $mod_strings;
111
+	} else {
112
+	    global $mod_strings;
113
+	}
110 114
 		global $app_strings;
111 115
 		global $app_list_strings;
112 116
 
@@ -153,14 +157,16 @@  discard block
 block discarded – undo
153 157
         //process the text only flag
154 158
         if(isset($_POST['text_only']) && ($_POST['text_only'] == '1')){
155 159
             $focus->text_only = 1;
156
-        }else{
160
+        } else{
157 161
             $focus->text_only = 0;
158 162
         }
159 163
 		if(!$focus->ACLAccess('Save')) {
160 164
 			ACLController::displayNoAccess(true);
161 165
 			sugar_cleanup(true);
162 166
 		}
163
-		if(!isset($_REQUEST['published'])) $focus->published = 'off';
167
+		if(!isset($_REQUEST['published'])) {
168
+		    $focus->published = 'off';
169
+		}
164 170
 
165 171
 		$preProcessedImages = array();
166 172
 		$emailTemplateBodyHtml = from_html($focus->body_html);
@@ -193,8 +199,7 @@  discard block
 block discarded – undo
193 199
 		} // if
194 200
 		if (isset($GLOBALS['check_notify'])) {
195 201
             $check_notify = $GLOBALS['check_notify'];
196
-        }
197
-        else {
202
+        } else {
198 203
             $check_notify = FALSE;
199 204
         }
200 205
         $focus->body_html = $emailTemplateBodyHtml;
@@ -252,8 +257,7 @@  discard block
 block discarded – undo
252 257
 				if(isset($_REQUEST['embedded'.$i]) && !empty($_REQUEST['embedded'.$i])){
253 258
                   if($_REQUEST['embedded'.$i]=='true'){
254 259
 				  	$note->embed_flag =true;
255
-                  }
256
-                  else{
260
+                  } else{
257 261
                   	$note->embed_flag =false;
258 262
                   }
259 263
 				}
@@ -267,8 +271,10 @@  discard block
 block discarded – undo
267 271
 		{
268 272
 			if( !empty($note->id) && $note->new_with_id === FALSE)
269 273
 			{
270
-				if(empty($_REQUEST['old_id']))
271
-					array_push($focus->saved_attachments, $note); // to support duplication of email templates
274
+				if(empty($_REQUEST['old_id'])) {
275
+									array_push($focus->saved_attachments, $note);
276
+				}
277
+				// to support duplication of email templates
272 278
 				else
273 279
 				{
274 280
 					// we're duplicating a template with attachments
@@ -303,10 +309,11 @@  discard block
 block discarded – undo
303 309
 			array_push($focus->saved_attachments, $note);
304 310
 			$note->id = $note_id;
305 311
 
306
-			if($note->new_with_id === FALSE)
307
-    			$note->file->final_move($note->id);
308
-    	    else
309
-    	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
312
+			if($note->new_with_id === FALSE) {
313
+			    			$note->file->final_move($note->id);
314
+			} else {
315
+    	        	       $GLOBALS['log']->debug("Not performing final move for note id {$note->id} as it has already been processed");
316
+    	    }
310 317
 		}
311 318
 
312 319
 		////	END NEW ATTACHMENTS
@@ -319,8 +326,7 @@  discard block
 block discarded – undo
319 326
 	//_ppd(count($_REQUEST['document']));
320 327
 	if(!empty($_REQUEST['document'])){
321 328
       $count = count($_REQUEST['document']);
322
-    }
323
-    else{
329
+    } else{
324 330
     	$count=10;
325 331
     }
326 332
 
@@ -372,7 +378,7 @@  discard block
 block discarded – undo
372 378
 		if($redirect) {
373 379
 		$GLOBALS['log']->debug("Saved record with id of ".$return_id);
374 380
 			handleRedirect($return_id, "EmailTemplates");
375
-		}else{
381
+		} else{
376 382
 			return $focus;
377 383
 		}
378 384
 	}
Please login to merge, or discard this patch.
modules/EmailTemplates/AttachFiles.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 39
  ********************************************************************************/
40 40
 
41
- //Request object must have these property values:
42
- //		Module: module name, this module should have a file called TreeData.php
43
- //		Function: name of the function to be called in TreeData.php, the function will be called statically.
44
- //		PARAM prefixed properties: array of these property/values will be passed to the function as parameter.
41
+    //Request object must have these property values:
42
+    //		Module: module name, this module should have a file called TreeData.php
43
+    //		Function: name of the function to be called in TreeData.php, the function will be called statically.
44
+    //		PARAM prefixed properties: array of these property/values will be passed to the function as parameter.
45 45
 
46 46
 
47 47
 require_once('include/JSON.php');
@@ -56,27 +56,27 @@  discard block
 block discarded – undo
56 56
 $ret = array();
57 57
 
58 58
 foreach($_FILES as $k => $file) {
59
-	if(in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) {
60
-	    $upload_file = new UploadFile($k);
61
-		// check the file
62
-		if($upload_file->confirm_upload()) {
63
-		    $dest = $cachedir.basename($upload_file->get_stored_file_name()); // target name
64
-		    $guid = create_guid();
65
-		    if($upload_file->final_move($guid)) { // move to uploads
66
-		        $path = $upload_file->get_upload_path($guid);
67
-		        // if file is OK, copy to cache
68
-		        if(verify_uploaded_image($path) && copy($path, $dest)) {
69
-		            $ret[] = $dest;
70
-		        }
71
-		        // remove temp file
72
-		        unlink($path);
73
-		    }
74
-		}
75
-	}
59
+    if(in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) {
60
+        $upload_file = new UploadFile($k);
61
+        // check the file
62
+        if($upload_file->confirm_upload()) {
63
+            $dest = $cachedir.basename($upload_file->get_stored_file_name()); // target name
64
+            $guid = create_guid();
65
+            if($upload_file->final_move($guid)) { // move to uploads
66
+                $path = $upload_file->get_upload_path($guid);
67
+                // if file is OK, copy to cache
68
+                if(verify_uploaded_image($path) && copy($path, $dest)) {
69
+                    $ret[] = $dest;
70
+                }
71
+                // remove temp file
72
+                unlink($path);
73
+            }
74
+        }
75
+    }
76 76
 }
77 77
 
78 78
 if (!empty($ret)) {
79
-	$json = getJSONobj();
80
-	echo $json->encode($ret);
81
-	//return the parameters
79
+    $json = getJSONobj();
80
+    echo $json->encode($ret);
81
+    //return the parameters
82 82
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 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,17 +55,17 @@  discard block
 block discarded – undo
55 55
 
56 56
 $ret = array();
57 57
 
58
-foreach($_FILES as $k => $file) {
59
-	if(in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) {
58
+foreach ($_FILES as $k => $file) {
59
+	if (in_array(strtolower($_FILES[$k]['type']), $imgType) && $_FILES[$k]['size'] > 0) {
60 60
 	    $upload_file = new UploadFile($k);
61 61
 		// check the file
62
-		if($upload_file->confirm_upload()) {
62
+		if ($upload_file->confirm_upload()) {
63 63
 		    $dest = $cachedir.basename($upload_file->get_stored_file_name()); // target name
64 64
 		    $guid = create_guid();
65
-		    if($upload_file->final_move($guid)) { // move to uploads
65
+		    if ($upload_file->final_move($guid)) { // move to uploads
66 66
 		        $path = $upload_file->get_upload_path($guid);
67 67
 		        // if file is OK, copy to cache
68
-		        if(verify_uploaded_image($path) && copy($path, $dest)) {
68
+		        if (verify_uploaded_image($path) && copy($path, $dest)) {
69 69
 		            $ret[] = $dest;
70 70
 		        }
71 71
 		        // remove temp file
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 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.
@@ -47,8 +49,9 @@  discard block
 block discarded – undo
47 49
 require_once('include/JSON.php');
48 50
 require_once('include/upload_file.php');
49 51
 
50
-if (!is_dir($cachedir = sugar_cached('images/')))
52
+if (!is_dir($cachedir = sugar_cached('images/'))) {
51 53
     mkdir_recursive($cachedir);
54
+}
52 55
 
53 56
 // cn: bug 11012 - fixed some MIME types not getting picked up.  Also changed array iterator.
54 57
 $imgType = array('image/gif', 'image/png', 'image/x-png', 'image/bmp', 'image/jpeg', 'image/jpg', 'image/pjpeg');
Please login to merge, or discard this patch.
modules/EmailTemplates/EditView.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 $GLOBALS['log']->info("EmailTemplate detail view");
75 75
 
76 76
 if ($has_campaign || $inboundEmail) {
77
-    $xtpl = new XTemplate ('modules/EmailTemplates/EditView.html');
77
+    $xtpl = new XTemplate('modules/EmailTemplates/EditView.html');
78 78
 } else {
79
-    $xtpl = new XTemplate ('modules/EmailTemplates/EditViewMain.html');
79
+    $xtpl = new XTemplate('modules/EmailTemplates/EditViewMain.html');
80 80
 } // else
81 81
 $xtpl->assign("MOD", $mod_strings);
82 82
 $xtpl->assign("APP", $app_strings);
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
 require_once('include/QuickSearchDefaults.php');
129 129
 $qsd = QuickSearchDefaults::getQuickSearchDefaults();
130 130
 $sqs_objects = array('EditView_assigned_user_name' => $qsd->getQSUser());
131
-$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = ' . $json->encode($sqs_objects) . '; enableQS();</script>';
131
+$quicksearch_js = '<script type="text/javascript" language="javascript">sqs_objects = '.$json->encode($sqs_objects).'; enableQS();</script>';
132 132
 
133 133
 $xtpl->assign("CANCEL_SCRIPT", $cancel_script);
134
-$xtpl->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
135
-$xtpl->assign("JAVASCRIPT", get_set_focus_js() . $quicksearch_js);
134
+$xtpl->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
135
+$xtpl->assign("JAVASCRIPT", get_set_focus_js().$quicksearch_js);
136 136
 
137
-if (!is_file(sugar_cached('jsLanguage/') . $GLOBALS['current_language'] . '.js')) {
137
+if (!is_file(sugar_cached('jsLanguage/').$GLOBALS['current_language'].'.js')) {
138 138
     require_once('include/language/jsLanguage.php');
139 139
     jsLanguage::createAppStringsCache($GLOBALS['current_language']);
140 140
 }
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
         $record = $_REQUEST['record'];
184 184
     }
185 185
 
186
-    $xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=" . $_REQUEST['action'] . "&from_module=" . $_REQUEST['module'] . "&record=" . $record . "'>" . SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT']) . "</a>");
186
+    $xtpl->assign("ADMIN_EDIT", "<a href='index.php?action=index&module=DynamicLayout&from_action=".$_REQUEST['action']."&from_module=".$_REQUEST['module']."&record=".$record."'>".SugarThemeRegistry::current()->getImage("EditLayout", "border='0' align='bottom'", null, null, '.gif', $mod_strings['LBL_EDIT_LAYOUT'])."</a>");
187 187
 
188 188
 }
189 189
 if (isset($focus->parent_type) && $focus->parent_type != "") {
190
-    $change_parent_button = "<input title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "'
191
-tabindex='3' type='button' class='button' value='" . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "' name='button' LANGUAGE=javascript onclick='return
190
+    $change_parent_button = "<input title='".$app_strings['LBL_SELECT_BUTTON_TITLE']."'
191
+tabindex='3' type='button' class='button' value='" . $app_strings['LBL_SELECT_BUTTON_LABEL']."' name='button' LANGUAGE=javascript onclick='return
192 192
 window.open(\"index.php?module=\"+ document.EditView.parent_type.value +
193 193
 \"&action=Popup&html=Popup_picker&form=TasksEditView\",\"test\",\"width=600,height=400,resizable=1,scrollbars=1\");'>";
194 194
     $xtpl->assign("CHANGE_PARENT_BUTTON", $change_parent_button);
195 195
 }
196 196
 if ($focus->parent_type == "Account") {
197
-    $xtpl->assign("DEFAULT_SEARCH", "&query=true&account_id=$focus->parent_id&account_name=" . urlencode($focus->parent_name));
197
+    $xtpl->assign("DEFAULT_SEARCH", "&query=true&account_id=$focus->parent_id&account_name=".urlencode($focus->parent_name));
198 198
 }
199 199
 
200 200
 $xtpl->assign("DESCRIPTION", $focus->description);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     // If it's campaign then hide the Account.
252 252
     if ($has_campaign) {
253 253
         $dropdown = "<option value='Contacts'>
254
-						" . $lblContactAndOthers . "
254
+						" . $lblContactAndOthers."
255 255
 			       </option>";
256 256
         $xtpl->assign("DROPDOWN", $dropdown);
257 257
         $xtpl->assign("DEFAULT_MODULE", 'Contacts');
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
             if (empty($the_note->filename)) {
286 286
                 continue;
287 287
             }
288
-            $secureLink = 'index.php?entryPoint=download&id=' . $the_note->id . '&type=Notes';
289
-            $attachments .= '<input type="checkbox" name="remove_attachment[]" value="' . $the_note->id . '"> ' . $app_strings['LNK_REMOVE'] . '&nbsp;&nbsp;';
290
-            $attachments .= '<a href="' . $secureLink . '" target="_blank">' . $the_note->filename . '</a><br>';
288
+            $secureLink = 'index.php?entryPoint=download&id='.$the_note->id.'&type=Notes';
289
+            $attachments .= '<input type="checkbox" name="remove_attachment[]" value="'.$the_note->id.'"> '.$app_strings['LNK_REMOVE'].'&nbsp;&nbsp;';
290
+            $attachments .= '<a href="'.$secureLink.'" target="_blank">'.$the_note->filename.'</a><br>';
291 291
         }
292 292
     }
293 293
     $attJs = '<script type="text/javascript">';
294
-    $attJs .= 'var lnk_remove = "' . $app_strings['LNK_REMOVE'] . '";';
294
+    $attJs .= 'var lnk_remove = "'.$app_strings['LNK_REMOVE'].'";';
295 295
     $attJs .= '</script>';
296 296
     $xtpl->assign('ATTACHMENTS', $attachments);
297 297
     $xtpl->assign('ATTACHMENTS_JAVASCRIPT', $attJs);
Please login to merge, or discard this patch.
Braces   +45 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
 require_once('modules/Campaigns/utils.php');
5 7
 
@@ -26,7 +28,9 @@  discard block
 block discarded – undo
26 28
 
27 29
 
28 30
 //setting default flag value so due date and time not required
29
-if (!isset($focus->id)) $focus->date_due_flag = 1;
31
+if (!isset($focus->id)) {
32
+    $focus->date_due_flag = 1;
33
+}
30 34
 
31 35
 //needed when creating a new case with default values passed in
32 36
 if (isset($_REQUEST['contact_name']) && is_null($focus->contact_name)) {
@@ -85,12 +89,16 @@  discard block
 block discarded – undo
85 89
 $xtpl->parse("main.variable_option");
86 90
 
87 91
 $returnAction = 'index';
88
-if (isset($_REQUEST['return_module'])) $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
92
+if (isset($_REQUEST['return_module'])) {
93
+    $xtpl->assign("RETURN_MODULE", $_REQUEST['return_module']);
94
+}
89 95
 if (isset($_REQUEST['return_action'])) {
90 96
     $xtpl->assign("RETURN_ACTION", $_REQUEST['return_action']);
91 97
     $returnAction = $_REQUEST['return_action'];
92 98
 }
93
-if (isset($_REQUEST['return_id'])) $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
99
+if (isset($_REQUEST['return_id'])) {
100
+    $xtpl->assign("RETURN_ID", $_REQUEST['return_id']);
101
+}
94 102
 // handle Create $module then Cancel
95 103
 if (empty($_REQUEST['return_id'])) {
96 104
     $xtpl->assign("RETURN_ACTION", 'index');
@@ -119,8 +127,9 @@  discard block
 block discarded – undo
119 127
 );
120 128
 $json = getJSONobj();
121 129
 $xtpl->assign('encoded_assigned_users_popup_request_data', $json->encode($popup_request_data));
122
-if (!empty($focus->assigned_user_name))
130
+if (!empty($focus->assigned_user_name)) {
123 131
     $xtpl->assign("ASSIGNED_USER_NAME", $focus->assigned_user_name);
132
+}
124 133
 
125 134
 $xtpl->assign("assign_user_select", SugarThemeRegistry::current()->getImage('id-ff-select', '', null, null, '.png', $mod_strings['LBL_SELECT']));
126 135
 $xtpl->assign("assign_user_clear", SugarThemeRegistry::current()->getImage('id-ff-clear', '', null, null, '.gif', $mod_strings['LBL_ID_FF_CLEAR']));
@@ -142,24 +151,39 @@  discard block
 block discarded – undo
142 151
 $xtpl->assign("JSLANG", $jsLang);
143 152
 
144 153
 $xtpl->assign("ID", $focus->id);
145
-if (isset($focus->name)) $xtpl->assign("NAME", $focus->name); else $xtpl->assign("NAME", "");
154
+if (isset($focus->name)) {
155
+    $xtpl->assign("NAME", $focus->name);
156
+} else {
157
+    $xtpl->assign("NAME", "");
158
+}
146 159
 
147 160
 //Bug45632
148 161
 /* BEGIN - SECURITY GROUPS */
149 162
 /**
150 163
  * if(isset($focus->assigned_user_id)) $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id); else $xtpl->assign("ASSIGNED_USER_ID", "");
151 164
  */
152
-if (isset($focus->assigned_user_id)) $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
153
-else if (empty($focus->id) && empty($focus->assigned_user_id)) {
165
+if (isset($focus->assigned_user_id)) {
166
+    $xtpl->assign("ASSIGNED_USER_ID", $focus->assigned_user_id);
167
+} else if (empty($focus->id) && empty($focus->assigned_user_id)) {
154 168
     global $current_user;
155 169
     $xtpl->assign("ASSIGNED_USER_ID", $current_user->id);
156 170
     $xtpl->assign("ASSIGNED_USER_NAME", get_assigned_user_name($current_user->id));
157
-} else $xtpl->assign("ASSIGNED_USER_ID", "");
171
+} else {
172
+    $xtpl->assign("ASSIGNED_USER_ID", "");
173
+}
158 174
 /* END - SECURITY GROUPS */
159 175
 //Bug45632
160 176
 
161
-if (isset($focus->description)) $xtpl->assign("DESCRIPTION", $focus->description); else $xtpl->assign("DESCRIPTION", "");
162
-if (isset($focus->subject)) $xtpl->assign("SUBJECT", $focus->subject); else $xtpl->assign("SUBJECT", "");
177
+if (isset($focus->description)) {
178
+    $xtpl->assign("DESCRIPTION", $focus->description);
179
+} else {
180
+    $xtpl->assign("DESCRIPTION", "");
181
+}
182
+if (isset($focus->subject)) {
183
+    $xtpl->assign("SUBJECT", $focus->subject);
184
+} else {
185
+    $xtpl->assign("SUBJECT", "");
186
+}
163 187
 if ($focus->published == 'on') {
164 188
     $xtpl->assign("PUBLISHED", "CHECKED");
165 189
 }
@@ -201,8 +225,16 @@  discard block
 block discarded – undo
201 225
 $xtpl->assign("TYPE_OPTIONS", get_select_options_with_id($app_list_strings['record_type_display'], $focus->parent_type));
202 226
 //$xtpl->assign("DEFAULT_MODULE","Accounts");
203 227
 
204
-if (isset($focus->body)) $xtpl->assign("BODY", $focus->body); else $xtpl->assign("BODY", "");
205
-if (isset($focus->body_html)) $xtpl->assign("BODY_HTML", $focus->body_html); else $xtpl->assign("BODY_HTML", "");
228
+if (isset($focus->body)) {
229
+    $xtpl->assign("BODY", $focus->body);
230
+} else {
231
+    $xtpl->assign("BODY", "");
232
+}
233
+if (isset($focus->body_html)) {
234
+    $xtpl->assign("BODY_HTML", $focus->body_html);
235
+} else {
236
+    $xtpl->assign("BODY_HTML", "");
237
+}
206 238
 
207 239
 
208 240
 if (true) {
Please login to merge, or discard this patch.