Completed
Push — console-installer ( 186d32...cb4007 )
by Adam
91:14 queued 78:40
created
custom/modules/unified_search_modules_display.php 2 patches
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -1,140 +1,140 @@
 block discarded – undo
1 1
 <?php
2 2
 // created: 2014-01-29 09:59:23
3 3
 $unified_search_modules_display = array (
4
-  'AOP_Case_Events' => 
5
-  array (
4
+    'AOP_Case_Events' => 
5
+    array (
6 6
     'visible' => false,
7
-  ),
8
-  'AOP_Case_Updates' => 
9
-  array (
7
+    ),
8
+    'AOP_Case_Updates' => 
9
+    array (
10 10
     'visible' => false,
11
-  ),
12
-  'AOR_Reports' => 
13
-  array (
11
+    ),
12
+    'AOR_Reports' => 
13
+    array (
14 14
     'visible' => false,
15
-  ),
16
-  'AOS_Contracts' => 
17
-  array (
15
+    ),
16
+    'AOS_Contracts' => 
17
+    array (
18 18
     'visible' => false,
19
-  ),
20
-  'AOS_Invoices' => 
21
-  array (
19
+    ),
20
+    'AOS_Invoices' => 
21
+    array (
22 22
     'visible' => false,
23
-  ),
24
-  'AOS_PDF_Templates' => 
25
-  array (
23
+    ),
24
+    'AOS_PDF_Templates' => 
25
+    array (
26 26
     'visible' => false,
27
-  ),
28
-  'AOS_Product_Categories' => 
29
-  array (
27
+    ),
28
+    'AOS_Product_Categories' => 
29
+    array (
30 30
     'visible' => false,
31
-  ),
32
-  'AOS_Products' => 
33
-  array (
31
+    ),
32
+    'AOS_Products' => 
33
+    array (
34 34
     'visible' => false,
35
-  ),
36
-  'AOS_Quotes' => 
37
-  array (
35
+    ),
36
+    'AOS_Quotes' => 
37
+    array (
38 38
     'visible' => false,
39
-  ),
40
-  'AOW_Processed' => 
41
-  array (
39
+    ),
40
+    'AOW_Processed' => 
41
+    array (
42 42
     'visible' => false,
43
-  ),
44
-  'AOW_WorkFlow' => 
45
-  array (
43
+    ),
44
+    'AOW_WorkFlow' => 
45
+    array (
46 46
     'visible' => false,
47
-  ),
48
-  'Accounts' => 
49
-  array (
47
+    ),
48
+    'Accounts' => 
49
+    array (
50 50
     'visible' => true,
51
-  ),
52
-  'Bugs' => 
53
-  array (
51
+    ),
52
+    'Bugs' => 
53
+    array (
54 54
     'visible' => false,
55
-  ),
56
-  'Calls' => 
57
-  array (
55
+    ),
56
+    'Calls' => 
57
+    array (
58 58
     'visible' => true,
59
-  ),
60
-  'Calls_Reschedule' => 
61
-  array (
59
+    ),
60
+    'Calls_Reschedule' => 
61
+    array (
62 62
     'visible' => false,
63
-  ),
64
-  'Campaigns' => 
65
-  array (
63
+    ),
64
+    'Campaigns' => 
65
+    array (
66 66
     'visible' => false,
67
-  ),
68
-  'Cases' => 
69
-  array (
67
+    ),
68
+    'Cases' => 
69
+    array (
70 70
     'visible' => true,
71
-  ),
72
-  'Contacts' => 
73
-  array (
71
+    ),
72
+    'Contacts' => 
73
+    array (
74 74
     'visible' => true,
75
-  ),
76
-  'Documents' => 
77
-  array (
75
+    ),
76
+    'Documents' => 
77
+    array (
78 78
     'visible' => true,
79
-  ),
80
-  'FP_Event_Locations' => 
81
-  array (
79
+    ),
80
+    'FP_Event_Locations' => 
81
+    array (
82 82
     'visible' => false,
83
-  ),
84
-  'FP_events' => 
85
-  array (
83
+    ),
84
+    'FP_events' => 
85
+    array (
86 86
     'visible' => false,
87
-  ),
88
-  'Leads' => 
89
-  array (
87
+    ),
88
+    'Leads' => 
89
+    array (
90 90
     'visible' => true,
91
-  ),
92
-  'Meetings' => 
93
-  array (
91
+    ),
92
+    'Meetings' => 
93
+    array (
94 94
     'visible' => true,
95
-  ),
96
-  'Notes' => 
97
-  array (
95
+    ),
96
+    'Notes' => 
97
+    array (
98 98
     'visible' => true,
99
-  ),
100
-  'Opportunities' => 
101
-  array (
99
+    ),
100
+    'Opportunities' => 
101
+    array (
102 102
     'visible' => true,
103
-  ),
104
-  'Project' => 
105
-  array (
103
+    ),
104
+    'Project' => 
105
+    array (
106 106
     'visible' => false,
107
-  ),
108
-  'ProjectTask' => 
109
-  array (
107
+    ),
108
+    'ProjectTask' => 
109
+    array (
110 110
     'visible' => false,
111
-  ),
112
-  'ProspectLists' => 
113
-  array (
111
+    ),
112
+    'ProspectLists' => 
113
+    array (
114 114
     'visible' => false,
115
-  ),
116
-  'Prospects' => 
117
-  array (
115
+    ),
116
+    'Prospects' => 
117
+    array (
118 118
     'visible' => false,
119
-  ),
120
-  'Tasks' => 
121
-  array (
119
+    ),
120
+    'Tasks' => 
121
+    array (
122 122
     'visible' => false,
123
-  ),
124
-  'jjwg_Address_Cache' => 
125
-  array (
123
+    ),
124
+    'jjwg_Address_Cache' => 
125
+    array (
126 126
     'visible' => false,
127
-  ),
128
-  'jjwg_Areas' => 
129
-  array (
127
+    ),
128
+    'jjwg_Areas' => 
129
+    array (
130 130
     'visible' => false,
131
-  ),
132
-  'jjwg_Maps' => 
133
-  array (
131
+    ),
132
+    'jjwg_Maps' => 
133
+    array (
134 134
     'visible' => false,
135
-  ),
136
-  'jjwg_Markers' => 
137
-  array (
135
+    ),
136
+    'jjwg_Markers' => 
137
+    array (
138 138
     'visible' => false,
139
-  ),
139
+    ),
140 140
 );
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,140 +1,140 @@
 block discarded – undo
1 1
 <?php
2 2
 // created: 2014-01-29 09:59:23
3
-$unified_search_modules_display = array (
3
+$unified_search_modules_display = array(
4 4
   'AOP_Case_Events' => 
5
-  array (
5
+  array(
6 6
     'visible' => false,
7 7
   ),
8 8
   'AOP_Case_Updates' => 
9
-  array (
9
+  array(
10 10
     'visible' => false,
11 11
   ),
12 12
   'AOR_Reports' => 
13
-  array (
13
+  array(
14 14
     'visible' => false,
15 15
   ),
16 16
   'AOS_Contracts' => 
17
-  array (
17
+  array(
18 18
     'visible' => false,
19 19
   ),
20 20
   'AOS_Invoices' => 
21
-  array (
21
+  array(
22 22
     'visible' => false,
23 23
   ),
24 24
   'AOS_PDF_Templates' => 
25
-  array (
25
+  array(
26 26
     'visible' => false,
27 27
   ),
28 28
   'AOS_Product_Categories' => 
29
-  array (
29
+  array(
30 30
     'visible' => false,
31 31
   ),
32 32
   'AOS_Products' => 
33
-  array (
33
+  array(
34 34
     'visible' => false,
35 35
   ),
36 36
   'AOS_Quotes' => 
37
-  array (
37
+  array(
38 38
     'visible' => false,
39 39
   ),
40 40
   'AOW_Processed' => 
41
-  array (
41
+  array(
42 42
     'visible' => false,
43 43
   ),
44 44
   'AOW_WorkFlow' => 
45
-  array (
45
+  array(
46 46
     'visible' => false,
47 47
   ),
48 48
   'Accounts' => 
49
-  array (
49
+  array(
50 50
     'visible' => true,
51 51
   ),
52 52
   'Bugs' => 
53
-  array (
53
+  array(
54 54
     'visible' => false,
55 55
   ),
56 56
   'Calls' => 
57
-  array (
57
+  array(
58 58
     'visible' => true,
59 59
   ),
60 60
   'Calls_Reschedule' => 
61
-  array (
61
+  array(
62 62
     'visible' => false,
63 63
   ),
64 64
   'Campaigns' => 
65
-  array (
65
+  array(
66 66
     'visible' => false,
67 67
   ),
68 68
   'Cases' => 
69
-  array (
69
+  array(
70 70
     'visible' => true,
71 71
   ),
72 72
   'Contacts' => 
73
-  array (
73
+  array(
74 74
     'visible' => true,
75 75
   ),
76 76
   'Documents' => 
77
-  array (
77
+  array(
78 78
     'visible' => true,
79 79
   ),
80 80
   'FP_Event_Locations' => 
81
-  array (
81
+  array(
82 82
     'visible' => false,
83 83
   ),
84 84
   'FP_events' => 
85
-  array (
85
+  array(
86 86
     'visible' => false,
87 87
   ),
88 88
   'Leads' => 
89
-  array (
89
+  array(
90 90
     'visible' => true,
91 91
   ),
92 92
   'Meetings' => 
93
-  array (
93
+  array(
94 94
     'visible' => true,
95 95
   ),
96 96
   'Notes' => 
97
-  array (
97
+  array(
98 98
     'visible' => true,
99 99
   ),
100 100
   'Opportunities' => 
101
-  array (
101
+  array(
102 102
     'visible' => true,
103 103
   ),
104 104
   'Project' => 
105
-  array (
105
+  array(
106 106
     'visible' => false,
107 107
   ),
108 108
   'ProjectTask' => 
109
-  array (
109
+  array(
110 110
     'visible' => false,
111 111
   ),
112 112
   'ProspectLists' => 
113
-  array (
113
+  array(
114 114
     'visible' => false,
115 115
   ),
116 116
   'Prospects' => 
117
-  array (
117
+  array(
118 118
     'visible' => false,
119 119
   ),
120 120
   'Tasks' => 
121
-  array (
121
+  array(
122 122
     'visible' => false,
123 123
   ),
124 124
   'jjwg_Address_Cache' => 
125
-  array (
125
+  array(
126 126
     'visible' => false,
127 127
   ),
128 128
   'jjwg_Areas' => 
129
-  array (
129
+  array(
130 130
     'visible' => false,
131 131
   ),
132 132
   'jjwg_Maps' => 
133
-  array (
133
+  array(
134 134
     'visible' => false,
135 135
   ),
136 136
   'jjwg_Markers' => 
137
-  array (
137
+  array(
138 138
     'visible' => false,
139 139
   ),
140 140
 );
141 141
\ No newline at end of file
Please login to merge, or discard this patch.
custom/Extension/application/Ext/LogicHooks/AOW_WorkFlow_Hook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,4 +28,4 @@
 block discarded – undo
28 28
 if (!isset($hook_array['after_save']) || !is_array($hook_array['after_save'])) {
29 29
     $hook_array['after_save'] = array();
30 30
 }
31
-$hook_array['after_save'][] = Array(99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php','AOW_WorkFlow', 'run_bean_flows');
32 31
\ No newline at end of file
32
+$hook_array['after_save'][] = Array(99, 'AOW_Workflow', 'modules/AOW_WorkFlow/AOW_WorkFlow.php', 'AOW_WorkFlow', 'run_bean_flows');
33 33
\ No newline at end of file
Please login to merge, or discard this patch.
include/SugarFields/Parsers/MetaParser.php 3 patches
Indentation   +388 added lines, -388 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 }
59 59
 
60 60
 function parse() {
61
-   return "NOT AVAILABLE";
61
+    return "NOT AVAILABLE";
62 62
 }
63 63
 
64 64
 /**
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
  * Parses for contents enclosed within <form>...</form> tags
67 67
  */
68 68
 function getFormContents($contents, $all = true) {
69
-   if($all) {
70
-      preg_match_all("'(<form[^>]*?>)(.*?)(</form[^>]*?>)'si", $contents, $matches);
71
-      return $matches;
72
-   }
69
+    if($all) {
70
+        preg_match_all("'(<form[^>]*?>)(.*?)(</form[^>]*?>)'si", $contents, $matches);
71
+        return $matches;
72
+    }
73 73
 
74
-   preg_match("'(<form[^>]*?>)(.*?)(</form[^>]*?>)'si", $contents, $matches);
75
-   return $this->convertToTagElement($matches);
76
-   //return $matches;
74
+    preg_match("'(<form[^>]*?>)(.*?)(</form[^>]*?>)'si", $contents, $matches);
75
+    return $this->convertToTagElement($matches);
76
+    //return $matches;
77 77
 }
78 78
 
79 79
 
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
  * @return $matches Array of matches of PREG_SET_ORDER
85 85
  */
86 86
 function getFormElements($contents) {
87
-   preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $contents, $matches, PREG_PATTERN_ORDER);
88
-   $elems = array();
89
-   foreach($matches[3] as $match) {
90
-   	  $elems[] = $match;
91
-   }
92
-   return $elems;
87
+    preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $contents, $matches, PREG_PATTERN_ORDER);
88
+    $elems = array();
89
+    foreach($matches[3] as $match) {
90
+            $elems[] = $match;
91
+    }
92
+    return $elems;
93 93
 }
94 94
 
95 95
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
  * @return $matches Array of name/value pairs
101 101
  */
102 102
 function getFormElementsNames($contents) {
103
-   preg_match_all("'(<[ ]*?)(textarea|input|select)[^>]*?name=[\'\"]([^\'\"]*?)(\[\])?(_basic)?[\'\"]([^>]*?>)'si", $contents, $matches, PREG_PATTERN_ORDER);
104
-   return !empty($matches[3]) ? $matches[3] : null;
103
+    preg_match_all("'(<[ ]*?)(textarea|input|select)[^>]*?name=[\'\"]([^\'\"]*?)(\[\])?(_basic)?[\'\"]([^>]*?>)'si", $contents, $matches, PREG_PATTERN_ORDER);
104
+    return !empty($matches[3]) ? $matches[3] : null;
105 105
 }
106 106
 
107 107
 
@@ -114,21 +114,21 @@  discard block
 block discarded – undo
114 114
  * @return Array of name/value for matching attribute
115 115
  */
116 116
 function getTagAttribute($name, $contents, $filter = '') {
117
-   //$exp = "'".$name."[ ]*?=[ ]*?[\'\"]([a-zA-Z0-9\_\[\]]*)[\'\"]'si";
117
+    //$exp = "'".$name."[ ]*?=[ ]*?[\'\"]([a-zA-Z0-9\_\[\]]*)[\'\"]'si";
118 118
 
119
-   $exp = "'".$name."[\s]*?=[\s]*?[\'\"]([^\'^\"]*?)[\'\"]'si";
120
-   preg_match_all($exp, $contents, $matches, PREG_SET_ORDER);
121
-   if(empty($filter)) {
122
-   	  return !empty($matches[0][1]) ? $matches[0][1] : '';
123
-   }
119
+    $exp = "'".$name."[\s]*?=[\s]*?[\'\"]([^\'^\"]*?)[\'\"]'si";
120
+    preg_match_all($exp, $contents, $matches, PREG_SET_ORDER);
121
+    if(empty($filter)) {
122
+            return !empty($matches[0][1]) ? $matches[0][1] : '';
123
+    }
124 124
 
125
-   $filtered = array();
126
-   foreach($matches as $tag) {
127
-   	  if(preg_match($filter, $tag[1])) {
128
-   	  	 $filtered[] = $tag;
129
-   	  }
130
-   }
131
-   return $filtered;
125
+    $filtered = array();
126
+    foreach($matches as $tag) {
127
+            if(preg_match($filter, $tag[1])) {
128
+                $filtered[] = $tag;
129
+            }
130
+    }
131
+    return $filtered;
132 132
 }
133 133
 
134 134
 /**
@@ -140,18 +140,18 @@  discard block
 block discarded – undo
140 140
  * @return Array of table elements found
141 141
  */
142 142
 function getTables($tableClass = null, $contents) {
143
-   preg_match_all("'(<table[^>]*?>)(.*?)(</table[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
144
-   if($tableClass == null) {
145
-   	  return $matches;
146
-   }
143
+    preg_match_all("'(<table[^>]*?>)(.*?)(</table[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
144
+    if($tableClass == null) {
145
+            return $matches;
146
+    }
147 147
 
148
-   $tables = array();
149
-   foreach($matches as $key => $table) {
150
-   	  if(strpos($table[1], $tableClass) > 0) {
151
-   	  	 $tables[] = $table;
152
-   	  }
153
-   }
154
-   return $this->convertToTagElement($tables);
148
+    $tables = array();
149
+    foreach($matches as $key => $table) {
150
+            if(strpos($table[1], $tableClass) > 0) {
151
+                $tables[] = $table;
152
+            }
153
+    }
154
+    return $this->convertToTagElement($tables);
155 155
 }
156 156
 
157 157
 /**
@@ -167,40 +167,40 @@  discard block
 block discarded – undo
167 167
  * @return a tag element format Array
168 168
  */
169 169
 function getElementsByType($type, $contents) {
170
-   $x = strlen($contents);
171
-   $mark = 0;
172
-   $count = 0;
173
-   $stag1 = "<" . trim($type, " <>") . '>';
174
-   $stag2 = "<" . trim($type, " <>") . ' ';
175
-   $etag = "</".$type.">";
176
-   $sincrement = strlen($stag1);
177
-   $eincrement = strlen($etag);
178
-   $sarr = array();
179
-   $values = array();
180
-
181
-   while($count < $x) {
182
-   	     $stok = substr($contents, $count, $sincrement);
183
-   	     $etok = substr($contents, $count, $eincrement);
184
-   	     if($stok == $stag1 || $stok == $stag2) {
185
-   	     	//Reset mark;
186
-   	        if(count($sarr) == 0) {
187
-   	           $mark = $count;
188
-   	        }
170
+    $x = strlen($contents);
171
+    $mark = 0;
172
+    $count = 0;
173
+    $stag1 = "<" . trim($type, " <>") . '>';
174
+    $stag2 = "<" . trim($type, " <>") . ' ';
175
+    $etag = "</".$type.">";
176
+    $sincrement = strlen($stag1);
177
+    $eincrement = strlen($etag);
178
+    $sarr = array();
179
+    $values = array();
180
+
181
+    while($count < $x) {
182
+            $stok = substr($contents, $count, $sincrement);
183
+            $etok = substr($contents, $count, $eincrement);
184
+            if($stok == $stag1 || $stok == $stag2) {
185
+                //Reset mark;
186
+                if(count($sarr) == 0) {
187
+                    $mark = $count;
188
+                }
189 189
             $sarr[] = $count;
190 190
 
191
-   	     } else if($etok == $etag) {
192
-   	        array_shift($sarr);
193
-   	        if(count($sarr) == 0) {
194
-   	           $val = substr($contents, $mark, ($count - $mark) + $eincrement);
195
-   	           $values[] = $val;
196
-   	           $mark = $count;
197
-   	        }
198
-   	     }
199
-   	     $count++;
200
-   }
191
+            } else if($etok == $etag) {
192
+                array_shift($sarr);
193
+                if(count($sarr) == 0) {
194
+                    $val = substr($contents, $mark, ($count - $mark) + $eincrement);
195
+                    $values[] = $val;
196
+                    $mark = $count;
197
+                }
198
+            }
199
+            $count++;
200
+    }
201 201
 
202
-   $count = 0;
203
-   return $values;
202
+    $count = 0;
203
+    return $values;
204 204
 }
205 205
 
206 206
 
@@ -210,14 +210,14 @@  discard block
 block discarded – undo
210 210
  *
211 211
  */
212 212
 function getElementValue($type, $contents, $filter = "(.*?)") {
213
-   $exp = "'<".$type."[^>]*?>".$filter."</".$type."[^>]*?>'si";
214
-   preg_match($exp, $contents, $matches);
215
-   return isset($matches[1]) ? $matches[1] : '';
213
+    $exp = "'<".$type."[^>]*?>".$filter."</".$type."[^>]*?>'si";
214
+    preg_match($exp, $contents, $matches);
215
+    return isset($matches[1]) ? $matches[1] : '';
216 216
 }
217 217
 
218 218
 
219 219
 function stripComments($contents) {
220
-   return preg_replace("'(<!--.*?-->)'si", "", $contents);
220
+    return preg_replace("'(<!--.*?-->)'si", "", $contents);
221 221
 }
222 222
 
223 223
 /**
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
  * @param $result The file contents with non-matching flavor tags and their nested comments removed
230 230
  */
231 231
 function stripFlavorTags($contents) {
232
-   $flavor = isset($GLOBALS['sugar_flavor']) ? $GLOBALS['sugar_flavor'] : 'PRO';
233
-   $isPro = ($flavor == 'ENT' || $flavor == 'PRO') ? true : false;
234
-   if($isPro) {
235
-   	 $contents = preg_replace('/<!-- BEGIN: open_source -->.*?<!-- END: open_source -->/', '', $contents);
236
-   } else {
237
-   	 $contents = preg_replace('/<!-- BEGIN: pro -->.*?<!-- END: pro -->/', '', $contents);
238
-   }
239
-   return $contents;
232
+    $flavor = isset($GLOBALS['sugar_flavor']) ? $GLOBALS['sugar_flavor'] : 'PRO';
233
+    $isPro = ($flavor == 'ENT' || $flavor == 'PRO') ? true : false;
234
+    if($isPro) {
235
+        $contents = preg_replace('/<!-- BEGIN: open_source -->.*?<!-- END: open_source -->/', '', $contents);
236
+    } else {
237
+        $contents = preg_replace('/<!-- BEGIN: pro -->.*?<!-- END: pro -->/', '', $contents);
238
+    }
239
+    return $contents;
240 240
 }
241 241
 
242 242
 /**
@@ -247,34 +247,34 @@  discard block
 block discarded – undo
247 247
  * @return The maximum column count
248 248
  */
249 249
 function getMaxColumns($contents, $filter) {
250
-   preg_match_all("'(<tr[^>]*?>)(.*?)(</tr[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
251
-   $max = 0;
252
-   foreach($matches as $tableRows) {
253
-           $count = substr_count($tableRows[2], $filter);
254
-           if($count > $max) {
255
-           	  $max = $count;
256
-           }
257
-   }
250
+    preg_match_all("'(<tr[^>]*?>)(.*?)(</tr[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
251
+    $max = 0;
252
+    foreach($matches as $tableRows) {
253
+            $count = substr_count($tableRows[2], $filter);
254
+            if($count > $max) {
255
+                    $max = $count;
256
+            }
257
+    }
258 258
 
259
-   return $max;
259
+    return $max;
260 260
 }
261 261
 
262 262
 function convertToTagElement($matches) {
263 263
 
264
-   $elements = array();
264
+    $elements = array();
265 265
 
266
-   foreach($matches as $data) {
267
-   	   // We need 4 because the 1,2,3 indexes make up start,body,end
268
-	   if(count($data) == 4) {
269
-	   	  $element = array();
270
-	   	  $element['start'] = $data[1];
271
-	   	  $element['body'] = $data[2];
272
-	   	  $element['end'] = $data[3];
273
-	   	  $elements[] = $element;
274
-	   }
275
-   }
266
+    foreach($matches as $data) {
267
+            // We need 4 because the 1,2,3 indexes make up start,body,end
268
+        if(count($data) == 4) {
269
+                $element = array();
270
+                $element['start'] = $data[1];
271
+                $element['body'] = $data[2];
272
+                $element['end'] = $data[3];
273
+                $elements[] = $element;
274
+        }
275
+    }
276 276
 
277
-   return empty($elements) ? $matches : $elements;
277
+    return empty($elements) ? $matches : $elements;
278 278
 }
279 279
 
280 280
 /*
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
  * This function removes the \r (return), \n (newline) and \t (tab) markup from string
283 283
  */
284 284
 function trimHTML($contents) {
285
-   $contents = str_replace(array("\r"), array(""), $contents);
286
-   $contents = str_replace(array("\n"), array(""), $contents);
287
-   $contents = str_replace(array("\t"), array(""), $contents);
288
-   return $contents;
285
+    $contents = str_replace(array("\r"), array(""), $contents);
286
+    $contents = str_replace(array("\n"), array(""), $contents);
287
+    $contents = str_replace(array("\t"), array(""), $contents);
288
+    return $contents;
289 289
 }
290 290
 
291 291
 
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
 //Check if there are Javascript blocks of code to process
308 308
 preg_match_all("'(<script[^>]*?>)(.*?)(</script[^>]*?>)'si", $contents, $matches, PREG_PATTERN_ORDER);
309 309
 if(empty($matches)) {
310
-   return $javascript;
310
+    return $javascript;
311 311
 }
312 312
 
313 313
 foreach($matches[0] as $scriptBlock) {
314
-	    $javascript .= "\n" . $scriptBlock;
314
+        $javascript .= "\n" . $scriptBlock;
315 315
 } //foreach
316 316
 
317 317
 $javascript = substr($javascript, 1);
@@ -323,19 +323,19 @@  discard block
 block discarded – undo
323 323
 //Find all blocks that may need to be replaced with Smarty syntax
324 324
 preg_match_all("'([\{])([a-zA-Z0-9_]*?)([\}])'si", $javascript, $matches, PREG_PATTERN_ORDER);
325 325
 if(!empty($matches)) {
326
-	$replace = array();
326
+    $replace = array();
327 327
 
328
-	foreach($matches[0] as $xTemplateCode) {
329
-		    if(!isset($replace[$xTemplateCode])) {
330
-		       $replace[$xTemplateCode] = str_replace("{", "{\$", $xTemplateCode);
331
-		    } //if
332
-	} //foreach
328
+    foreach($matches[0] as $xTemplateCode) {
329
+            if(!isset($replace[$xTemplateCode])) {
330
+                $replace[$xTemplateCode] = str_replace("{", "{\$", $xTemplateCode);
331
+            } //if
332
+    } //foreach
333 333
 
334
-	$javascript = str_replace(array_keys($replace), array_values($replace), $javascript);
334
+    $javascript = str_replace(array_keys($replace), array_values($replace), $javascript);
335 335
 } //if
336 336
 
337 337
 if(!$addLiterals) {
338
-   return $javascript;
338
+    return $javascript;
339 339
 }
340 340
 
341 341
 return $this->parseDelimiters($javascript);
@@ -343,44 +343,44 @@  discard block
 block discarded – undo
343 343
 }
344 344
 
345 345
 static function parseDelimiters($javascript) {
346
-	$newJavascript = '';
347
-	$scriptLength = strlen($javascript);
348
-	$count = 0;
349
-	$inSmartyVariable = false;
350
-
351
-	while($count < $scriptLength) {
352
-
353
-	      if($inSmartyVariable) {
354
-	      	 $start = $count;
355
-	      	 $numOfChars = 1;
356
-	      	 while(isset($javascript[$count]) && $javascript[$count] != '}') {
357
-	      	 	   $count++;
358
-	      	 	   $numOfChars++;
359
-	      	 }
360
-
361
-	      	 $newJavascript .= substr($javascript, $start, $numOfChars);
362
-	      	 $inSmartyVariable = false;
363
-
364
-	      } else {
365
-
366
-			  $char = $javascript[$count];
367
-			  $nextChar = ($count + 1 >= $scriptLength) ? '' : $javascript[$count + 1];
368
-
369
-			  if($char == "{" && $nextChar == "$") {
370
-			  	 $inSmartyVariable = true;
371
-			  	 $newJavascript .= $javascript[$count];
372
-			  } else if($char == "{") {
373
-			  	 $newJavascript .=  " {ldelim} ";
374
-			  } else if($char == "}") {
375
-			  	 $newJavascript .= " {rdelim} ";
376
-			  } else {
377
-			     $newJavascript .= $javascript[$count];
378
-			  }
379
-	      }
380
-		  $count++;
381
-	} //while
382
-
383
-	return $newJavascript;
346
+    $newJavascript = '';
347
+    $scriptLength = strlen($javascript);
348
+    $count = 0;
349
+    $inSmartyVariable = false;
350
+
351
+    while($count < $scriptLength) {
352
+
353
+            if($inSmartyVariable) {
354
+                $start = $count;
355
+                $numOfChars = 1;
356
+                while(isset($javascript[$count]) && $javascript[$count] != '}') {
357
+                        $count++;
358
+                        $numOfChars++;
359
+                }
360
+
361
+                $newJavascript .= substr($javascript, $start, $numOfChars);
362
+                $inSmartyVariable = false;
363
+
364
+            } else {
365
+
366
+                $char = $javascript[$count];
367
+                $nextChar = ($count + 1 >= $scriptLength) ? '' : $javascript[$count + 1];
368
+
369
+                if($char == "{" && $nextChar == "$") {
370
+                    $inSmartyVariable = true;
371
+                    $newJavascript .= $javascript[$count];
372
+                } else if($char == "{") {
373
+                    $newJavascript .=  " {ldelim} ";
374
+                } else if($char == "}") {
375
+                    $newJavascript .= " {rdelim} ";
376
+                } else {
377
+                    $newJavascript .= $javascript[$count];
378
+                }
379
+            }
380
+            $count++;
381
+    } //while
382
+
383
+    return $newJavascript;
384 384
 }
385 385
 
386 386
 /**
@@ -397,43 +397,43 @@  discard block
 block discarded – undo
397 397
  */
398 398
 function findAssignedVariableName($name, $filePath) {
399 399
 
400
-	if($this->mPHPFile == "INVALID") {
401
-	   return $name;
402
-	}
403
-
404
-	if(!isset($this->mPHPFile)) {
405
-	   if(preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) {
406
-	   	 $dir = $matches[1];
407
-	   } else if(preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) {
408
-	   	 $dir = $matches[1];
409
-	   }
410
-
411
-	   if(!isset($dir) || !is_dir($dir)) {
412
-	      $this->mPHPFile = "INVALID";
413
-	      return $name;
414
-	   }
415
-
416
-       $filesInDir = $this->dirList($dir);
417
-       $phpFile = $matches[2].'.*?[\.]php';
418
-       foreach($filesInDir as $file) {
419
-       	  if(preg_match("/$phpFile/", $file)) {
420
-       	  	 $this->mPHPFile = $matches[1] . $file;
421
-       	  	 break;
422
-       	  }
423
-       }
424
-
425
-       if(!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) {
426
-       	  $this->mPHPFile = "INVALID";
427
-       	  return $name;
428
-       }
429
-	}
430
-
431
-	$phpContents = file_get_contents($this->mPHPFile);
432
-	$uname = strtoupper($name);
433
-	if(preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) {
434
-	   return $matches[1];
435
-	}
436
-	return $name;
400
+    if($this->mPHPFile == "INVALID") {
401
+        return $name;
402
+    }
403
+
404
+    if(!isset($this->mPHPFile)) {
405
+        if(preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) {
406
+            $dir = $matches[1];
407
+        } else if(preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) {
408
+            $dir = $matches[1];
409
+        }
410
+
411
+        if(!isset($dir) || !is_dir($dir)) {
412
+            $this->mPHPFile = "INVALID";
413
+            return $name;
414
+        }
415
+
416
+        $filesInDir = $this->dirList($dir);
417
+        $phpFile = $matches[2].'.*?[\.]php';
418
+        foreach($filesInDir as $file) {
419
+                if(preg_match("/$phpFile/", $file)) {
420
+                    $this->mPHPFile = $matches[1] . $file;
421
+                    break;
422
+                }
423
+        }
424
+
425
+        if(!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) {
426
+                $this->mPHPFile = "INVALID";
427
+                return $name;
428
+        }
429
+    }
430
+
431
+    $phpContents = file_get_contents($this->mPHPFile);
432
+    $uname = strtoupper($name);
433
+    if(preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) {
434
+        return $matches[1];
435
+    }
436
+    return $name;
437 437
 }
438 438
 
439 439
 
@@ -476,65 +476,65 @@  discard block
 block discarded – undo
476 476
  */
477 477
 function getCustomField($elementNames) {
478 478
 
479
-   if(!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) {
480
-   	  return null;
481
-   }
479
+    if(!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) {
480
+            return null;
481
+    }
482 482
 
483
-   if(is_string($elementNames)) {
484
-   	  if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) {
485
-   	  	 return count($matches) == 1 ? $matches[0] : $matches[1];
486
-   	  }
487
-   	  return null;
488
-   }
483
+    if(is_string($elementNames)) {
484
+            if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) {
485
+                return count($matches) == 1 ? $matches[0] : $matches[1];
486
+            }
487
+            return null;
488
+    }
489 489
 
490
-   foreach($elementNames as $name) {
491
-   	  if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) {
492
-   	  	 return count($matches) == 1 ? $matches[0] : $matches[1];
493
-   	  }
494
-   }
490
+    foreach($elementNames as $name) {
491
+            if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) {
492
+                return count($matches) == 1 ? $matches[0] : $matches[1];
493
+            }
494
+    }
495 495
 
496
-   return null;
496
+    return null;
497 497
 }
498 498
 
499 499
 function applyPreRules($moduleDir, $panels) {
500
-   if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
501
-	  require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
502
-	  $class = $moduleDir."ParseRule";
503
-	  $parseRule = new $class();
504
-	  $panels = $parseRule->preParse($panels, $this->mView);
505
-   }
506
-   return $panels;
500
+    if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
501
+        require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
502
+        $class = $moduleDir."ParseRule";
503
+        $parseRule = new $class();
504
+        $panels = $parseRule->preParse($panels, $this->mView);
505
+    }
506
+    return $panels;
507 507
 }
508 508
 
509 509
 function applyRules($moduleDir, $panels) {
510
-   return $this->applyPostRules($moduleDir, $panels);
510
+    return $this->applyPostRules($moduleDir, $panels);
511 511
 }
512 512
 
513 513
 function applyPostRules($moduleDir, $panels) {
514
-   //Run module specific rules
515
-   if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
516
-	  require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
517
-	  $class = $moduleDir."ParseRule";
518
-	  $parseRule = new $class();
519
-	  $panels = $parseRule->parsePanels($panels, $this->mView);
520
-   }
514
+    //Run module specific rules
515
+    if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
516
+        require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
517
+        $class = $moduleDir."ParseRule";
518
+        $parseRule = new $class();
519
+        $panels = $parseRule->parsePanels($panels, $this->mView);
520
+    }
521 521
 
522
-   //Now run defined rules
523
-   require_once("include/SugarFields/Parsers/Rules/ParseRules.php");
524
-   $rules = ParseRules::getRules();
522
+    //Now run defined rules
523
+    require_once("include/SugarFields/Parsers/Rules/ParseRules.php");
524
+    $rules = ParseRules::getRules();
525 525
 
526
-   foreach($rules as $rule) {
527
-   	  if(!file_exists($rule['file'])) {
528
-   	  	 $GLOBALS['log']->error("Cannot run rule for " . $rule['file']);
529
-   	  	 continue;
530
-   	  } //if
531
-   	  require_once($rule['file']);
532
-   	  $runRule = new $rule['class'];
533
-   	  $panels = $runRule->parsePanels($panels, $this->mView);
526
+    foreach($rules as $rule) {
527
+            if(!file_exists($rule['file'])) {
528
+                $GLOBALS['log']->error("Cannot run rule for " . $rule['file']);
529
+                continue;
530
+            } //if
531
+            require_once($rule['file']);
532
+            $runRule = new $rule['class'];
533
+            $panels = $runRule->parsePanels($panels, $this->mView);
534 534
 
535
-   } //foreach
535
+    } //foreach
536 536
 
537
-   return $panels;
537
+    return $panels;
538 538
 }
539 539
 
540 540
 function createFileContents($moduleDir, $panels, $templateMeta=array(), $htmlFilePath) {
@@ -574,11 +574,11 @@  discard block
 block discarded – undo
574 574
 );
575 575
 ?>";
576 576
 
577
-   $metadata = '';
578
-   $body = var_export($panels, true);
579
-   $metadata = $header . $body . $footer;
580
-   $metadata = preg_replace('/(\d+)[\s]=>[\s]?/',"",$metadata);
581
-   return $metadata;
577
+    $metadata = '';
578
+    $body = var_export($panels, true);
579
+    $metadata = $header . $body . $footer;
580
+    $metadata = preg_replace('/(\d+)[\s]=>[\s]?/',"",$metadata);
581
+    return $metadata;
582 582
 
583 583
 }
584 584
 
@@ -592,88 +592,88 @@  discard block
 block discarded – undo
592 592
  * @return Array of merged $panel definition
593 593
  */
594 594
 function mergePanels($panels, $vardefs, $moduleDir, $masterCopy) {
595
-   require($masterCopy);
596
-   $masterpanels = $viewdefs[$moduleDir][$this->mView]['panels'];
597
-   $hasMultiplePanels = $this->hasMultiplePanels($masterpanels);
595
+    require($masterCopy);
596
+    $masterpanels = $viewdefs[$moduleDir][$this->mView]['panels'];
597
+    $hasMultiplePanels = $this->hasMultiplePanels($masterpanels);
598 598
 
599
-   if(!$hasMultiplePanels) {
600
-   	    $keys = array_keys($viewdefs[$moduleDir][$this->mView]['panels']);
599
+    if(!$hasMultiplePanels) {
600
+            $keys = array_keys($viewdefs[$moduleDir][$this->mView]['panels']);
601 601
         if(!empty($keys) && count($keys) == 1) {
602
-        	if(strtolower($keys[0]) == 'default') {
603
-        	   $masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels'][$keys[0]]);
604
-        	} else {
605
-        	   $firstPanel = array_values($viewdefs[$moduleDir][$this->mView]['panels']);
606
-	           $masterpanels = array('default'=> $firstPanel[0]);
607
-        	}
602
+            if(strtolower($keys[0]) == 'default') {
603
+                $masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels'][$keys[0]]);
604
+            } else {
605
+                $firstPanel = array_values($viewdefs[$moduleDir][$this->mView]['panels']);
606
+                $masterpanels = array('default'=> $firstPanel[0]);
607
+            }
608 608
         } else {
609
-        	$masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels']);
609
+            $masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels']);
610 610
         }
611
-   }
612
-   foreach($masterpanels as $name=>$masterpanel) {
613
-   	       if(isset($panels[$name])) {
614
-	   	       	  // Get all the names in the panel
615
-	   	       	  $existingElements = array();
616
-	   	       	  $existingLocation = array();
617
-
618
-	   	       	  foreach($panels[$name] as $rowKey=>$row) {
619
-	   	       	  	 foreach($row as $colKey=>$column) {
620
-	   	       	  	 	if(is_array($column) && !empty($column['name'])) {
621
-	   	       	  	 	   $existingElements[$column['name']] = $column['name'];
622
-	   	       	  	 	   $existingLocation[$column['name']] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
623
-	   	       	  	 	} else if(!is_array($column) && !empty($column)) {
624
-	   	       	  	 	   $existingElements[$column] = $column;
625
-	   	       	  	 	   $existingLocation[$column] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
626
-	   	       	  	 	}
627
-	   	       	  	 } //foreach
628
-	   	       	  } //foreach
629
-
630
-	   	       	  // Now check against the $masterCopy
631
-	   	       	  foreach($masterpanel as $rowKey=>$row) {
632
-
633
-	   	       	  	 $addRow = array();
634
-
635
-	   	       	  	 foreach($row as $colKey=>$column) {
636
-	   	       	  	 	if(is_array($column) && isset($column['name'])) {
637
-	   	       	  	 	   $id = $column['name'];
638
-	   	       	  	 	} else if(!is_array($column) && !empty($column)) {
639
-	   	       	  	 	   $id = $column;
640
-	   	       	  	 	} else {
641
-	   	       	  	 	   continue;
642
-	   	       	  	 	}
643
-	   	       	  	 	if(empty($existingElements[$id])) {
644
-	   	       	  	 	   //Only add if
645
-	   	       	  	 	   // 1) if it is a required field (as defined in metadata)
646
-	   	       	  	 	   // 2) or if it has a customLabel and customCode (a very deep customization)
647
-	   	       	  	 	   if((is_array($column) && !empty($column['displayParams']['required'])) ||
648
-	   	       	  	 	      (is_array($column) && !empty($column['customCode']) && !empty($column['customLabel']))) {
649
-	   	       	  	 	   	  $addRow[] = $column;
650
-	   	       	  	 	   }
651
-	   	       	  	 	} else {
652
-	   	       	  	 	   //Use definition from master copy instead
653
-	   	       	  	 	   $panels[$existingLocation[$id]['panel']][$existingLocation[$id]['row']][$existingLocation[$id]['col']] = $column;
654
-	   	       	  	 	}
655
-	   	       	  	 } //foreach
656
-
657
-	   	       	  	 // Add it to the $panels
658
-	   	       	  	 if(!empty($addRow)) {
659
-	   	       	  	 	$panels[$name][] = $addRow;
660
-	   	       	  	 }
661
-	   	       	  } //foreach
662
-
663
-   	       } else {
664
-	   	       	  $panels[$name] = $masterpanel;
665
-   	       }
666
-   } //foreach
667
-
668
-   // We're not done yet... go through the $panels Array now and try to remove duplicate
669
-   // or empty panels
670
-   foreach($panels as $name=>$panel) {
671
-   	   if(count($panel) == 0 || !isset($masterpanels[$name])) {
672
-   	   	  unset($panels[$name]);
673
-   	   }
674
-   } //foreach
675
-
676
-   return $panels;
611
+    }
612
+    foreach($masterpanels as $name=>$masterpanel) {
613
+                if(isset($panels[$name])) {
614
+                        // Get all the names in the panel
615
+                        $existingElements = array();
616
+                        $existingLocation = array();
617
+
618
+                        foreach($panels[$name] as $rowKey=>$row) {
619
+                                foreach($row as $colKey=>$column) {
620
+                                    if(is_array($column) && !empty($column['name'])) {
621
+                                    $existingElements[$column['name']] = $column['name'];
622
+                                    $existingLocation[$column['name']] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
623
+                                    } else if(!is_array($column) && !empty($column)) {
624
+                                    $existingElements[$column] = $column;
625
+                                    $existingLocation[$column] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
626
+                                    }
627
+                                } //foreach
628
+                        } //foreach
629
+
630
+                        // Now check against the $masterCopy
631
+                        foreach($masterpanel as $rowKey=>$row) {
632
+
633
+                                $addRow = array();
634
+
635
+                                foreach($row as $colKey=>$column) {
636
+                                    if(is_array($column) && isset($column['name'])) {
637
+                                    $id = $column['name'];
638
+                                    } else if(!is_array($column) && !empty($column)) {
639
+                                    $id = $column;
640
+                                    } else {
641
+                                    continue;
642
+                                    }
643
+                                    if(empty($existingElements[$id])) {
644
+                                    //Only add if
645
+                                    // 1) if it is a required field (as defined in metadata)
646
+                                    // 2) or if it has a customLabel and customCode (a very deep customization)
647
+                                    if((is_array($column) && !empty($column['displayParams']['required'])) ||
648
+                                       (is_array($column) && !empty($column['customCode']) && !empty($column['customLabel']))) {
649
+                                            $addRow[] = $column;
650
+                                    }
651
+                                    } else {
652
+                                    //Use definition from master copy instead
653
+                                    $panels[$existingLocation[$id]['panel']][$existingLocation[$id]['row']][$existingLocation[$id]['col']] = $column;
654
+                                    }
655
+                                } //foreach
656
+
657
+                                // Add it to the $panels
658
+                                if(!empty($addRow)) {
659
+                                    $panels[$name][] = $addRow;
660
+                                }
661
+                        } //foreach
662
+
663
+                } else {
664
+                        $panels[$name] = $masterpanel;
665
+                }
666
+    } //foreach
667
+
668
+    // We're not done yet... go through the $panels Array now and try to remove duplicate
669
+    // or empty panels
670
+    foreach($panels as $name=>$panel) {
671
+            if(count($panel) == 0 || !isset($masterpanels[$name])) {
672
+                unset($panels[$name]);
673
+            }
674
+    } //foreach
675
+
676
+    return $panels;
677 677
 }
678 678
 
679 679
 /**
@@ -685,70 +685,70 @@  discard block
 block discarded – undo
685 685
  * @return Array of merged $templateMeta definition
686 686
  */
687 687
 function mergeTemplateMeta($templateMeta, $moduleDir, $masterCopy) {
688
-   require($masterCopy);
689
-   $masterTemplateMeta = $viewdefs[$moduleDir][$this->mView]['templateMeta'];
688
+    require($masterCopy);
689
+    $masterTemplateMeta = $viewdefs[$moduleDir][$this->mView]['templateMeta'];
690 690
 
691
-   if(isset($masterTemplateMeta['javascript'])) {
692
-   	  //Insert the getJSPath code back into src value
693
-   	  $masterTemplateMeta['javascript'] = preg_replace('/src\s*=\s*[\'\"].*?(modules\/|include\/)([^\.]*?\.js)([^\'\"]*?)[\'\"]/i', 'src="@sq . getJSPath(@sq${1}${2}@sq) . @sq"', $masterTemplateMeta['javascript']);
694
-   }
691
+    if(isset($masterTemplateMeta['javascript'])) {
692
+            //Insert the getJSPath code back into src value
693
+            $masterTemplateMeta['javascript'] = preg_replace('/src\s*=\s*[\'\"].*?(modules\/|include\/)([^\.]*?\.js)([^\'\"]*?)[\'\"]/i', 'src="@sq . getJSPath(@sq${1}${2}@sq) . @sq"', $masterTemplateMeta['javascript']);
694
+    }
695 695
 
696
-   return $masterTemplateMeta;
696
+    return $masterTemplateMeta;
697 697
 }
698 698
 
699 699
 function hasRequiredSpanLabel($html) {
700
-   if(empty($html)) {
701
-   	  return false;
702
-   }
700
+    if(empty($html)) {
701
+            return false;
702
+    }
703 703
 
704
-   return preg_match('/\<(div|span) class=(\")?required(\")?\s?>\*<\/(div|span)>/si', $html);
704
+    return preg_match('/\<(div|span) class=(\")?required(\")?\s?>\*<\/(div|span)>/si', $html);
705 705
 }
706 706
 
707 707
 function hasMultiplePanels($panels) {
708 708
 
709
-   if(!isset($panels) || empty($panels) || !is_array($panels)) {
710
-   	  return false;
711
-   }
709
+    if(!isset($panels) || empty($panels) || !is_array($panels)) {
710
+            return false;
711
+    }
712 712
 
713
-   if(is_array($panels) && (count($panels) == 0 || count($panels) == 1)) {
714
-   	  return false;
715
-   }
713
+    if(is_array($panels) && (count($panels) == 0 || count($panels) == 1)) {
714
+            return false;
715
+    }
716 716
 
717
-   foreach($panels as $panel) {
718
-   	  if(!empty($panel) && !is_array($panel)) {
719
-   	  	 return false;
720
-   	  } else {
721
-   	  	 foreach($panel as $row) {
722
-   	  	    if(!empty($row) && !is_array($row)) {
723
-   	  	       return false;
724
-   	  	    } //if
725
-   	  	 } //foreach
726
-   	  } //if-else
727
-   } //foreach
717
+    foreach($panels as $panel) {
718
+            if(!empty($panel) && !is_array($panel)) {
719
+                return false;
720
+            } else {
721
+                foreach($panel as $row) {
722
+                    if(!empty($row) && !is_array($row)) {
723
+                    return false;
724
+                    } //if
725
+                } //foreach
726
+            } //if-else
727
+    } //foreach
728 728
 
729
-   return true;
729
+    return true;
730 730
 }
731 731
 
732 732
 function getRelateFieldName($mixed='') {
733
-   if(!is_array($mixed)) {
734
-   	  return '';
735
-   } else if(count($mixed) == 2){
736
-      $id = '';
737
-   	  $name = '';
738
-   	  foreach($mixed as $el) {
739
-   	  	 if(preg_match('/_id$/', $el)) {
740
-   	  	    $id = $el;
741
-   	  	 } else if(preg_match('/_name$/', $el)) {
742
-   	  	    $name = $el;
743
-   	  	 }
744
-   	  }
745
-   	  return (!empty($id) && !empty($name)) ? $name : '';
746
-   }
747
-   return '';
733
+    if(!is_array($mixed)) {
734
+            return '';
735
+    } else if(count($mixed) == 2){
736
+        $id = '';
737
+            $name = '';
738
+            foreach($mixed as $el) {
739
+                if(preg_match('/_id$/', $el)) {
740
+                    $id = $el;
741
+                } else if(preg_match('/_name$/', $el)) {
742
+                    $name = $el;
743
+                }
744
+            }
745
+            return (!empty($id) && !empty($name)) ? $name : '';
746
+    }
747
+    return '';
748 748
 }
749 749
 
750 750
 function getCustomPanels() {
751
-   return $this->mCustomPanels;
751
+    return $this->mCustomPanels;
752 752
 }
753 753
 
754 754
 /**
@@ -759,10 +759,10 @@  discard block
 block discarded – undo
759 759
  *
760 760
  */
761 761
 function fixTablesWithMissingTr($tableContents) {
762
-   if(preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
763
-   	  return preg_replace('/(<table[^>]*?[\/]?>\s*?<td)/i', '<table><tr><td', $tableContents);
764
-   }
765
-   return $tableContents;
762
+    if(preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
763
+            return preg_replace('/(<table[^>]*?[\/]?>\s*?<td)/i', '<table><tr><td', $tableContents);
764
+    }
765
+    return $tableContents;
766 766
 }
767 767
 
768 768
 /**
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
  * This is a very crude function to fix instances where files have an </tr> tag immediately followed by a <td> tag
771 771
  */
772 772
 function fixRowsWithMissingTr($tableContents) {
773
-   if(preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
774
-   	  return preg_replace('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', '</tr><tr><td', $tableContents);
775
-   }
776
-   return $tableContents;
773
+    if(preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
774
+            return preg_replace('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', '</tr><tr><td', $tableContents);
775
+    }
776
+    return $tableContents;
777 777
 }
778 778
 
779 779
 /**
@@ -781,10 +781,10 @@  discard block
 block discarded – undo
781 781
  * This is a very crude function to fix instances where files have two consecutive <tr> tags
782 782
  */
783 783
 function fixDuplicateTrTags($tableContents) {
784
-   if(preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) {
785
-   	  return preg_replace('/(<tr[^>]*?[\/]?>\s*?<tr)/i', '<tr', $tableContents);
786
-   }
787
-   return $tableContents;
784
+    if(preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) {
785
+            return preg_replace('/(<tr[^>]*?[\/]?>\s*?<tr)/i', '<tr', $tableContents);
786
+    }
787
+    return $tableContents;
788 788
 }
789 789
 
790 790
 /**
@@ -793,18 +793,18 @@  discard block
 block discarded – undo
793 793
  * return that vardef name
794 794
  */
795 795
 function findSingleVardefElement($formElements=array(), $vardefs=array()) {
796
-   if(empty($formElements) || !is_array($formElements)) {
797
-   	  return '';
798
-   }
799
-
800
-   $found = array();
801
-   foreach($formElements as $el) {
802
-   	   if(isset($vardefs[$el])) {
803
-   	   	  $found[] = $el;
804
-   	   }
805
-   }
806
-
807
-   return count($found) == 1 ? $found[0] : '';
796
+    if(empty($formElements) || !is_array($formElements)) {
797
+            return '';
798
+    }
799
+
800
+    $found = array();
801
+    foreach($formElements as $el) {
802
+            if(isset($vardefs[$el])) {
803
+                $found[] = $el;
804
+            }
805
+    }
806
+
807
+    return count($found) == 1 ? $found[0] : '';
808 808
 }
809 809
 
810 810
 
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 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.
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
62 62
      */
63
-    function MetaParser(){
63
+    function MetaParser() {
64 64
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
65
-        if(isset($GLOBALS['log'])) {
65
+        if (isset($GLOBALS['log'])) {
66 66
             $GLOBALS['log']->deprecated($deprecatedMessage);
67 67
         }
68 68
         else {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
  * Parses for contents enclosed within <form>...</form> tags
82 82
  */
83 83
 function getFormContents($contents, $all = true) {
84
-   if($all) {
84
+   if ($all) {
85 85
       preg_match_all("'(<form[^>]*?>)(.*?)(</form[^>]*?>)'si", $contents, $matches);
86 86
       return $matches;
87 87
    }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 function getFormElements($contents) {
102 102
    preg_match_all("'(<[ ]*?)(textarea|input|select)([^>]*?)(>)'si", $contents, $matches, PREG_PATTERN_ORDER);
103 103
    $elems = array();
104
-   foreach($matches[3] as $match) {
104
+   foreach ($matches[3] as $match) {
105 105
    	  $elems[] = $match;
106 106
    }
107 107
    return $elems;
@@ -133,13 +133,13 @@  discard block
 block discarded – undo
133 133
 
134 134
    $exp = "'".$name."[\s]*?=[\s]*?[\'\"]([^\'^\"]*?)[\'\"]'si";
135 135
    preg_match_all($exp, $contents, $matches, PREG_SET_ORDER);
136
-   if(empty($filter)) {
136
+   if (empty($filter)) {
137 137
    	  return !empty($matches[0][1]) ? $matches[0][1] : '';
138 138
    }
139 139
 
140 140
    $filtered = array();
141
-   foreach($matches as $tag) {
142
-   	  if(preg_match($filter, $tag[1])) {
141
+   foreach ($matches as $tag) {
142
+   	  if (preg_match($filter, $tag[1])) {
143 143
    	  	 $filtered[] = $tag;
144 144
    	  }
145 145
    }
@@ -156,13 +156,13 @@  discard block
 block discarded – undo
156 156
  */
157 157
 function getTables($tableClass = null, $contents) {
158 158
    preg_match_all("'(<table[^>]*?>)(.*?)(</table[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
159
-   if($tableClass == null) {
159
+   if ($tableClass == null) {
160 160
    	  return $matches;
161 161
    }
162 162
 
163 163
    $tables = array();
164
-   foreach($matches as $key => $table) {
165
-   	  if(strpos($table[1], $tableClass) > 0) {
164
+   foreach ($matches as $key => $table) {
165
+   	  if (strpos($table[1], $tableClass) > 0) {
166 166
    	  	 $tables[] = $table;
167 167
    	  }
168 168
    }
@@ -185,27 +185,27 @@  discard block
 block discarded – undo
185 185
    $x = strlen($contents);
186 186
    $mark = 0;
187 187
    $count = 0;
188
-   $stag1 = "<" . trim($type, " <>") . '>';
189
-   $stag2 = "<" . trim($type, " <>") . ' ';
188
+   $stag1 = "<".trim($type, " <>").'>';
189
+   $stag2 = "<".trim($type, " <>").' ';
190 190
    $etag = "</".$type.">";
191 191
    $sincrement = strlen($stag1);
192 192
    $eincrement = strlen($etag);
193 193
    $sarr = array();
194 194
    $values = array();
195 195
 
196
-   while($count < $x) {
196
+   while ($count < $x) {
197 197
    	     $stok = substr($contents, $count, $sincrement);
198 198
    	     $etok = substr($contents, $count, $eincrement);
199
-   	     if($stok == $stag1 || $stok == $stag2) {
199
+   	     if ($stok == $stag1 || $stok == $stag2) {
200 200
    	     	//Reset mark;
201
-   	        if(count($sarr) == 0) {
201
+   	        if (count($sarr) == 0) {
202 202
    	           $mark = $count;
203 203
    	        }
204 204
             $sarr[] = $count;
205 205
 
206
-   	     } else if($etok == $etag) {
206
+   	     } else if ($etok == $etag) {
207 207
    	        array_shift($sarr);
208
-   	        if(count($sarr) == 0) {
208
+   	        if (count($sarr) == 0) {
209 209
    	           $val = substr($contents, $mark, ($count - $mark) + $eincrement);
210 210
    	           $values[] = $val;
211 211
    	           $mark = $count;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 function stripFlavorTags($contents) {
247 247
    $flavor = isset($GLOBALS['sugar_flavor']) ? $GLOBALS['sugar_flavor'] : 'PRO';
248 248
    $isPro = ($flavor == 'ENT' || $flavor == 'PRO') ? true : false;
249
-   if($isPro) {
249
+   if ($isPro) {
250 250
    	 $contents = preg_replace('/<!-- BEGIN: open_source -->.*?<!-- END: open_source -->/', '', $contents);
251 251
    } else {
252 252
    	 $contents = preg_replace('/<!-- BEGIN: pro -->.*?<!-- END: pro -->/', '', $contents);
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 function getMaxColumns($contents, $filter) {
265 265
    preg_match_all("'(<tr[^>]*?>)(.*?)(</tr[^>]*?>)'si", $contents, $matches, PREG_SET_ORDER);
266 266
    $max = 0;
267
-   foreach($matches as $tableRows) {
267
+   foreach ($matches as $tableRows) {
268 268
            $count = substr_count($tableRows[2], $filter);
269
-           if($count > $max) {
269
+           if ($count > $max) {
270 270
            	  $max = $count;
271 271
            }
272 272
    }
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
 
279 279
    $elements = array();
280 280
 
281
-   foreach($matches as $data) {
281
+   foreach ($matches as $data) {
282 282
    	   // We need 4 because the 1,2,3 indexes make up start,body,end
283
-	   if(count($data) == 4) {
283
+	   if (count($data) == 4) {
284 284
 	   	  $element = array();
285 285
 	   	  $element['start'] = $data[1];
286 286
 	   	  $element['body'] = $data[2];
@@ -321,12 +321,12 @@  discard block
 block discarded – undo
321 321
 
322 322
 //Check if there are Javascript blocks of code to process
323 323
 preg_match_all("'(<script[^>]*?>)(.*?)(</script[^>]*?>)'si", $contents, $matches, PREG_PATTERN_ORDER);
324
-if(empty($matches)) {
324
+if (empty($matches)) {
325 325
    return $javascript;
326 326
 }
327 327
 
328
-foreach($matches[0] as $scriptBlock) {
329
-	    $javascript .= "\n" . $scriptBlock;
328
+foreach ($matches[0] as $scriptBlock) {
329
+	    $javascript .= "\n".$scriptBlock;
330 330
 } //foreach
331 331
 
332 332
 $javascript = substr($javascript, 1);
@@ -337,11 +337,11 @@  discard block
 block discarded – undo
337 337
 
338 338
 //Find all blocks that may need to be replaced with Smarty syntax
339 339
 preg_match_all("'([\{])([a-zA-Z0-9_]*?)([\}])'si", $javascript, $matches, PREG_PATTERN_ORDER);
340
-if(!empty($matches)) {
340
+if (!empty($matches)) {
341 341
 	$replace = array();
342 342
 
343
-	foreach($matches[0] as $xTemplateCode) {
344
-		    if(!isset($replace[$xTemplateCode])) {
343
+	foreach ($matches[0] as $xTemplateCode) {
344
+		    if (!isset($replace[$xTemplateCode])) {
345 345
 		       $replace[$xTemplateCode] = str_replace("{", "{\$", $xTemplateCode);
346 346
 		    } //if
347 347
 	} //foreach
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
 	$javascript = str_replace(array_keys($replace), array_values($replace), $javascript);
350 350
 } //if
351 351
 
352
-if(!$addLiterals) {
352
+if (!$addLiterals) {
353 353
    return $javascript;
354 354
 }
355 355
 
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 	$count = 0;
364 364
 	$inSmartyVariable = false;
365 365
 
366
-	while($count < $scriptLength) {
366
+	while ($count < $scriptLength) {
367 367
 
368
-	      if($inSmartyVariable) {
368
+	      if ($inSmartyVariable) {
369 369
 	      	 $start = $count;
370 370
 	      	 $numOfChars = 1;
371
-	      	 while(isset($javascript[$count]) && $javascript[$count] != '}') {
371
+	      	 while (isset($javascript[$count]) && $javascript[$count] != '}') {
372 372
 	      	 	   $count++;
373 373
 	      	 	   $numOfChars++;
374 374
 	      	 }
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 			  $char = $javascript[$count];
382 382
 			  $nextChar = ($count + 1 >= $scriptLength) ? '' : $javascript[$count + 1];
383 383
 
384
-			  if($char == "{" && $nextChar == "$") {
384
+			  if ($char == "{" && $nextChar == "$") {
385 385
 			  	 $inSmartyVariable = true;
386 386
 			  	 $newJavascript .= $javascript[$count];
387
-			  } else if($char == "{") {
388
-			  	 $newJavascript .=  " {ldelim} ";
389
-			  } else if($char == "}") {
387
+			  } else if ($char == "{") {
388
+			  	 $newJavascript .= " {ldelim} ";
389
+			  } else if ($char == "}") {
390 390
 			  	 $newJavascript .= " {rdelim} ";
391 391
 			  } else {
392 392
 			     $newJavascript .= $javascript[$count];
@@ -412,32 +412,32 @@  discard block
 block discarded – undo
412 412
  */
413 413
 function findAssignedVariableName($name, $filePath) {
414 414
 
415
-	if($this->mPHPFile == "INVALID") {
415
+	if ($this->mPHPFile == "INVALID") {
416 416
 	   return $name;
417 417
 	}
418 418
 
419
-	if(!isset($this->mPHPFile)) {
420
-	   if(preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) {
419
+	if (!isset($this->mPHPFile)) {
420
+	   if (preg_match('/(.*?)(DetailView).html$/', $filePath, $matches)) {
421 421
 	   	 $dir = $matches[1];
422
-	   } else if(preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) {
422
+	   } else if (preg_match('/(.*?)(EditView).html$/', $filePath, $matches)) {
423 423
 	   	 $dir = $matches[1];
424 424
 	   }
425 425
 
426
-	   if(!isset($dir) || !is_dir($dir)) {
426
+	   if (!isset($dir) || !is_dir($dir)) {
427 427
 	      $this->mPHPFile = "INVALID";
428 428
 	      return $name;
429 429
 	   }
430 430
 
431 431
        $filesInDir = $this->dirList($dir);
432 432
        $phpFile = $matches[2].'.*?[\.]php';
433
-       foreach($filesInDir as $file) {
434
-       	  if(preg_match("/$phpFile/", $file)) {
435
-       	  	 $this->mPHPFile = $matches[1] . $file;
433
+       foreach ($filesInDir as $file) {
434
+       	  if (preg_match("/$phpFile/", $file)) {
435
+       	  	 $this->mPHPFile = $matches[1].$file;
436 436
        	  	 break;
437 437
        	  }
438 438
        }
439 439
 
440
-       if(!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) {
440
+       if (!isset($this->mPHPFile) || !file_exists($this->mPHPFile)) {
441 441
        	  $this->mPHPFile = "INVALID";
442 442
        	  return $name;
443 443
        }
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 
446 446
 	$phpContents = file_get_contents($this->mPHPFile);
447 447
 	$uname = strtoupper($name);
448
-	if(preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) {
448
+	if (preg_match("/xtpl->assign[\(][\"\']".$uname."[\"\'][\s]*?,[\s]*?[\$]focus->(.*?)[\)]/si", $phpContents, $matches)) {
449 449
 	   return $matches[1];
450 450
 	}
451 451
 	return $name;
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
  * @param $directory The directory to scan
460 460
  * @return $results The files in the directory that were found
461 461
  */
462
-function dirList ($directory) {
462
+function dirList($directory) {
463 463
 
464 464
     // create an array to hold directory list
465 465
     $results = array();
@@ -491,19 +491,19 @@  discard block
 block discarded – undo
491 491
  */
492 492
 function getCustomField($elementNames) {
493 493
 
494
-   if(!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) {
494
+   if (!isset($elementNames) || (!is_string($elementNames) && !is_array($elementNames))) {
495 495
    	  return null;
496 496
    }
497 497
 
498
-   if(is_string($elementNames)) {
499
-   	  if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) {
498
+   if (is_string($elementNames)) {
499
+   	  if (preg_match('/(.+_c)(_basic)?(\[\])?$/', $elementNames, $matches)) {
500 500
    	  	 return count($matches) == 1 ? $matches[0] : $matches[1];
501 501
    	  }
502 502
    	  return null;
503 503
    }
504 504
 
505
-   foreach($elementNames as $name) {
506
-   	  if(preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) {
505
+   foreach ($elementNames as $name) {
506
+   	  if (preg_match('/(.+_c)(_basic)?(\[\])?$/', $name, $matches)) {
507 507
    	  	 return count($matches) == 1 ? $matches[0] : $matches[1];
508 508
    	  }
509 509
    }
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 }
513 513
 
514 514
 function applyPreRules($moduleDir, $panels) {
515
-   if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
515
+   if (file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
516 516
 	  require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
517 517
 	  $class = $moduleDir."ParseRule";
518 518
 	  $parseRule = new $class();
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 
528 528
 function applyPostRules($moduleDir, $panels) {
529 529
    //Run module specific rules
530
-   if(file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
530
+   if (file_exists("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php")) {
531 531
 	  require_once("include/SugarFields/Parsers/Rules/".$moduleDir."ParseRule.php");
532 532
 	  $class = $moduleDir."ParseRule";
533 533
 	  $parseRule = new $class();
@@ -538,9 +538,9 @@  discard block
 block discarded – undo
538 538
    require_once("include/SugarFields/Parsers/Rules/ParseRules.php");
539 539
    $rules = ParseRules::getRules();
540 540
 
541
-   foreach($rules as $rule) {
542
-   	  if(!file_exists($rule['file'])) {
543
-   	  	 $GLOBALS['log']->error("Cannot run rule for " . $rule['file']);
541
+   foreach ($rules as $rule) {
542
+   	  if (!file_exists($rule['file'])) {
543
+   	  	 $GLOBALS['log']->error("Cannot run rule for ".$rule['file']);
544 544
    	  	 continue;
545 545
    	  } //if
546 546
    	  require_once($rule['file']);
@@ -552,11 +552,11 @@  discard block
 block discarded – undo
552 552
    return $panels;
553 553
 }
554 554
 
555
-function createFileContents($moduleDir, $panels, $templateMeta=array(), $htmlFilePath) {
555
+function createFileContents($moduleDir, $panels, $templateMeta = array(), $htmlFilePath) {
556 556
 
557 557
 $header = "<?php\n\n";
558 558
 
559
-if(empty($templateMeta)) {
559
+if (empty($templateMeta)) {
560 560
 $header .= "\$viewdefs['$moduleDir']['$this->mView'] = array(
561 561
     'templateMeta' => array('maxColumns' => '2',
562 562
                             'widths' => array(
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
     ),";
567 567
 } else {
568 568
 $header .= "\$viewdefs['$moduleDir']['$this->mView'] = array(
569
-    'templateMeta' =>" . var_export($templateMeta, true) . ",";
569
+    'templateMeta' =>".var_export($templateMeta, true).",";
570 570
 }
571 571
 
572 572
 //Replace all the @sq (single quote tags that may have been inserted)
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 
592 592
    $metadata = '';
593 593
    $body = var_export($panels, true);
594
-   $metadata = $header . $body . $footer;
595
-   $metadata = preg_replace('/(\d+)[\s]=>[\s]?/',"",$metadata);
594
+   $metadata = $header.$body.$footer;
595
+   $metadata = preg_replace('/(\d+)[\s]=>[\s]?/', "", $metadata);
596 596
    return $metadata;
597 597
 
598 598
 }
@@ -611,10 +611,10 @@  discard block
 block discarded – undo
611 611
    $masterpanels = $viewdefs[$moduleDir][$this->mView]['panels'];
612 612
    $hasMultiplePanels = $this->hasMultiplePanels($masterpanels);
613 613
 
614
-   if(!$hasMultiplePanels) {
614
+   if (!$hasMultiplePanels) {
615 615
    	    $keys = array_keys($viewdefs[$moduleDir][$this->mView]['panels']);
616
-        if(!empty($keys) && count($keys) == 1) {
617
-        	if(strtolower($keys[0]) == 'default') {
616
+        if (!empty($keys) && count($keys) == 1) {
617
+        	if (strtolower($keys[0]) == 'default') {
618 618
         	   $masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels'][$keys[0]]);
619 619
         	} else {
620 620
         	   $firstPanel = array_values($viewdefs[$moduleDir][$this->mView]['panels']);
@@ -624,18 +624,18 @@  discard block
 block discarded – undo
624 624
         	$masterpanels = array('default'=>$viewdefs[$moduleDir][$this->mView]['panels']);
625 625
         }
626 626
    }
627
-   foreach($masterpanels as $name=>$masterpanel) {
628
-   	       if(isset($panels[$name])) {
627
+   foreach ($masterpanels as $name=>$masterpanel) {
628
+   	       if (isset($panels[$name])) {
629 629
 	   	       	  // Get all the names in the panel
630 630
 	   	       	  $existingElements = array();
631 631
 	   	       	  $existingLocation = array();
632 632
 
633
-	   	       	  foreach($panels[$name] as $rowKey=>$row) {
634
-	   	       	  	 foreach($row as $colKey=>$column) {
635
-	   	       	  	 	if(is_array($column) && !empty($column['name'])) {
633
+	   	       	  foreach ($panels[$name] as $rowKey=>$row) {
634
+	   	       	  	 foreach ($row as $colKey=>$column) {
635
+	   	       	  	 	if (is_array($column) && !empty($column['name'])) {
636 636
 	   	       	  	 	   $existingElements[$column['name']] = $column['name'];
637 637
 	   	       	  	 	   $existingLocation[$column['name']] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
638
-	   	       	  	 	} else if(!is_array($column) && !empty($column)) {
638
+	   	       	  	 	} else if (!is_array($column) && !empty($column)) {
639 639
 	   	       	  	 	   $existingElements[$column] = $column;
640 640
 	   	       	  	 	   $existingLocation[$column] = array("panel"=>$name, "row"=>$rowKey, "col"=>$colKey);
641 641
 	   	       	  	 	}
@@ -643,23 +643,23 @@  discard block
 block discarded – undo
643 643
 	   	       	  } //foreach
644 644
 
645 645
 	   	       	  // Now check against the $masterCopy
646
-	   	       	  foreach($masterpanel as $rowKey=>$row) {
646
+	   	       	  foreach ($masterpanel as $rowKey=>$row) {
647 647
 
648 648
 	   	       	  	 $addRow = array();
649 649
 
650
-	   	       	  	 foreach($row as $colKey=>$column) {
651
-	   	       	  	 	if(is_array($column) && isset($column['name'])) {
650
+	   	       	  	 foreach ($row as $colKey=>$column) {
651
+	   	       	  	 	if (is_array($column) && isset($column['name'])) {
652 652
 	   	       	  	 	   $id = $column['name'];
653
-	   	       	  	 	} else if(!is_array($column) && !empty($column)) {
653
+	   	       	  	 	} else if (!is_array($column) && !empty($column)) {
654 654
 	   	       	  	 	   $id = $column;
655 655
 	   	       	  	 	} else {
656 656
 	   	       	  	 	   continue;
657 657
 	   	       	  	 	}
658
-	   	       	  	 	if(empty($existingElements[$id])) {
658
+	   	       	  	 	if (empty($existingElements[$id])) {
659 659
 	   	       	  	 	   //Only add if
660 660
 	   	       	  	 	   // 1) if it is a required field (as defined in metadata)
661 661
 	   	       	  	 	   // 2) or if it has a customLabel and customCode (a very deep customization)
662
-	   	       	  	 	   if((is_array($column) && !empty($column['displayParams']['required'])) ||
662
+	   	       	  	 	   if ((is_array($column) && !empty($column['displayParams']['required'])) ||
663 663
 	   	       	  	 	      (is_array($column) && !empty($column['customCode']) && !empty($column['customLabel']))) {
664 664
 	   	       	  	 	   	  $addRow[] = $column;
665 665
 	   	       	  	 	   }
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	   	       	  	 } //foreach
671 671
 
672 672
 	   	       	  	 // Add it to the $panels
673
-	   	       	  	 if(!empty($addRow)) {
673
+	   	       	  	 if (!empty($addRow)) {
674 674
 	   	       	  	 	$panels[$name][] = $addRow;
675 675
 	   	       	  	 }
676 676
 	   	       	  } //foreach
@@ -682,8 +682,8 @@  discard block
 block discarded – undo
682 682
 
683 683
    // We're not done yet... go through the $panels Array now and try to remove duplicate
684 684
    // or empty panels
685
-   foreach($panels as $name=>$panel) {
686
-   	   if(count($panel) == 0 || !isset($masterpanels[$name])) {
685
+   foreach ($panels as $name=>$panel) {
686
+   	   if (count($panel) == 0 || !isset($masterpanels[$name])) {
687 687
    	   	  unset($panels[$name]);
688 688
    	   }
689 689
    } //foreach
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
    require($masterCopy);
704 704
    $masterTemplateMeta = $viewdefs[$moduleDir][$this->mView]['templateMeta'];
705 705
 
706
-   if(isset($masterTemplateMeta['javascript'])) {
706
+   if (isset($masterTemplateMeta['javascript'])) {
707 707
    	  //Insert the getJSPath code back into src value
708 708
    	  $masterTemplateMeta['javascript'] = preg_replace('/src\s*=\s*[\'\"].*?(modules\/|include\/)([^\.]*?\.js)([^\'\"]*?)[\'\"]/i', 'src="@sq . getJSPath(@sq${1}${2}@sq) . @sq"', $masterTemplateMeta['javascript']);
709 709
    }
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 }
713 713
 
714 714
 function hasRequiredSpanLabel($html) {
715
-   if(empty($html)) {
715
+   if (empty($html)) {
716 716
    	  return false;
717 717
    }
718 718
 
@@ -721,20 +721,20 @@  discard block
 block discarded – undo
721 721
 
722 722
 function hasMultiplePanels($panels) {
723 723
 
724
-   if(!isset($panels) || empty($panels) || !is_array($panels)) {
724
+   if (!isset($panels) || empty($panels) || !is_array($panels)) {
725 725
    	  return false;
726 726
    }
727 727
 
728
-   if(is_array($panels) && (count($panels) == 0 || count($panels) == 1)) {
728
+   if (is_array($panels) && (count($panels) == 0 || count($panels) == 1)) {
729 729
    	  return false;
730 730
    }
731 731
 
732
-   foreach($panels as $panel) {
733
-   	  if(!empty($panel) && !is_array($panel)) {
732
+   foreach ($panels as $panel) {
733
+   	  if (!empty($panel) && !is_array($panel)) {
734 734
    	  	 return false;
735 735
    	  } else {
736
-   	  	 foreach($panel as $row) {
737
-   	  	    if(!empty($row) && !is_array($row)) {
736
+   	  	 foreach ($panel as $row) {
737
+   	  	    if (!empty($row) && !is_array($row)) {
738 738
    	  	       return false;
739 739
    	  	    } //if
740 740
    	  	 } //foreach
@@ -744,16 +744,16 @@  discard block
 block discarded – undo
744 744
    return true;
745 745
 }
746 746
 
747
-function getRelateFieldName($mixed='') {
748
-   if(!is_array($mixed)) {
747
+function getRelateFieldName($mixed = '') {
748
+   if (!is_array($mixed)) {
749 749
    	  return '';
750
-   } else if(count($mixed) == 2){
750
+   } else if (count($mixed) == 2) {
751 751
       $id = '';
752 752
    	  $name = '';
753
-   	  foreach($mixed as $el) {
754
-   	  	 if(preg_match('/_id$/', $el)) {
753
+   	  foreach ($mixed as $el) {
754
+   	  	 if (preg_match('/_id$/', $el)) {
755 755
    	  	    $id = $el;
756
-   	  	 } else if(preg_match('/_name$/', $el)) {
756
+   	  	 } else if (preg_match('/_name$/', $el)) {
757 757
    	  	    $name = $el;
758 758
    	  	 }
759 759
    	  }
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
  *
775 775
  */
776 776
 function fixTablesWithMissingTr($tableContents) {
777
-   if(preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
777
+   if (preg_match('/(<table[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
778 778
    	  return preg_replace('/(<table[^>]*?[\/]?>\s*?<td)/i', '<table><tr><td', $tableContents);
779 779
    }
780 780
    return $tableContents;
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
  * This is a very crude function to fix instances where files have an </tr> tag immediately followed by a <td> tag
786 786
  */
787 787
 function fixRowsWithMissingTr($tableContents) {
788
-   if(preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
788
+   if (preg_match('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', $tableContents, $matches)) {
789 789
    	  return preg_replace('/(<\/tr[^>]*?[\/]?>\s*?<td)/i', '</tr><tr><td', $tableContents);
790 790
    }
791 791
    return $tableContents;
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
  * This is a very crude function to fix instances where files have two consecutive <tr> tags
797 797
  */
798 798
 function fixDuplicateTrTags($tableContents) {
799
-   if(preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) {
799
+   if (preg_match('/(<tr[^>]*?[\/]?>\s*?<tr)/i', $tableContents, $matches)) {
800 800
    	  return preg_replace('/(<tr[^>]*?[\/]?>\s*?<tr)/i', '<tr', $tableContents);
801 801
    }
802 802
    return $tableContents;
@@ -807,14 +807,14 @@  discard block
 block discarded – undo
807 807
  * Scans array of form elements to see if just one is a vardef element and, if so,
808 808
  * return that vardef name
809 809
  */
810
-function findSingleVardefElement($formElements=array(), $vardefs=array()) {
811
-   if(empty($formElements) || !is_array($formElements)) {
810
+function findSingleVardefElement($formElements = array(), $vardefs = array()) {
811
+   if (empty($formElements) || !is_array($formElements)) {
812 812
    	  return '';
813 813
    }
814 814
 
815 815
    $found = array();
816
-   foreach($formElements as $el) {
817
-   	   if(isset($vardefs[$el])) {
816
+   foreach ($formElements as $el) {
817
+   	   if (isset($vardefs[$el])) {
818 818
    	   	  $found[] = $el;
819 819
    	   }
820 820
    }
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 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.
@@ -64,8 +66,7 @@  discard block
 block discarded – undo
64 66
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
65 67
         if(isset($GLOBALS['log'])) {
66 68
             $GLOBALS['log']->deprecated($deprecatedMessage);
67
-        }
68
-        else {
69
+        } else {
69 70
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
70 71
         }
71 72
         self::__construct();
@@ -471,8 +472,9 @@  discard block
 block discarded – undo
471 472
     while ($file = readdir($handler)) {
472 473
         // if $file isn't this directory or its parent,
473 474
         // add it to the results array
474
-        if ($file != '.' && $file != '..')
475
-            $results[] = $file;
475
+        if ($file != '.' && $file != '..') {
476
+                    $results[] = $file;
477
+        }
476 478
     }
477 479
 
478 480
     // tidy up: close the handler
Please login to merge, or discard this patch.
include/SugarFields/Fields/Datetimecombo/SugarFieldDatetimecombo.php 3 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
     function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
         // Create Smarty variables for the Calendar picker widget
46 46
         if(!isset($displayParams['showMinutesDropdown'])) {
47
-           $displayParams['showMinutesDropdown'] = false;
47
+            $displayParams['showMinutesDropdown'] = false;
48 48
         }
49 49
 
50 50
         if(!isset($displayParams['showHoursDropdown'])) {
51
-           $displayParams['showHoursDropdown'] = false;
51
+            $displayParams['showHoursDropdown'] = false;
52 52
         }
53 53
 
54 54
         if(!isset($displayParams['showNoneCheckbox'])) {
55
-           $displayParams['showNoneCheckbox'] = false;
55
+            $displayParams['showNoneCheckbox'] = false;
56 56
         }
57 57
 
58 58
         if(!isset($displayParams['showFormats'])) {
59
-           $displayParams['showFormats'] = false;
59
+            $displayParams['showFormats'] = false;
60 60
         }
61 61
 
62 62
         global $timedate;
@@ -75,44 +75,44 @@  discard block
 block discarded – undo
75 75
 	
76 76
     function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
77 77
 
78
-    	 if($this->isRangeSearchView($vardef)) {
79
-           $displayParams['showMinutesDropdown'] = false;
80
-           $displayParams['showHoursDropdown'] = false;
81
-           $displayParams['showNoneCheckbox'] = false;
82
-           $displayParams['showFormats'] = false;
83
-	       global $timedate, $current_language;
84
-	       $displayParams['dateFormat'] = $timedate->get_cal_date_format();
85
-	       $displayParams['timeFormat'] = $timedate->get_user_time_format();
86
-
87
-           $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
88
-           $id = isset($displayParams['idName']) ? $displayParams['idName'] : $vardef['name'];
89
-           $this->ss->assign('original_id', "{$id}");
90
-           $this->ss->assign('id_range', "range_{$id}");
91
-           $this->ss->assign('id_range_start', "start_range_{$id}");
92
-           $this->ss->assign('id_range_end', "end_range_{$id}");
93
-           $this->ss->assign('id_range_choice', "{$id}_range_choice");
94
-           if(file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
95
-           {
96
-              return $this->fetch('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
97
-           }
98
-           return $this->fetch('include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
78
+            if($this->isRangeSearchView($vardef)) {
79
+            $displayParams['showMinutesDropdown'] = false;
80
+            $displayParams['showHoursDropdown'] = false;
81
+            $displayParams['showNoneCheckbox'] = false;
82
+            $displayParams['showFormats'] = false;
83
+            global $timedate, $current_language;
84
+            $displayParams['dateFormat'] = $timedate->get_cal_date_format();
85
+            $displayParams['timeFormat'] = $timedate->get_user_time_format();
86
+
87
+            $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
88
+            $id = isset($displayParams['idName']) ? $displayParams['idName'] : $vardef['name'];
89
+            $this->ss->assign('original_id', "{$id}");
90
+            $this->ss->assign('id_range', "range_{$id}");
91
+            $this->ss->assign('id_range_start', "start_range_{$id}");
92
+            $this->ss->assign('id_range_end', "end_range_{$id}");
93
+            $this->ss->assign('id_range_choice', "{$id}_range_choice");
94
+            if(file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
95
+            {
96
+                return $this->fetch('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
97
+            }
98
+            return $this->fetch('include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
99 99
         }
100 100
 
101
-    	// Create Smarty variables for the Calendar picker widget
101
+        // Create Smarty variables for the Calendar picker widget
102 102
         if(!isset($displayParams['showMinutesDropdown'])) {
103
-           $displayParams['showMinutesDropdown'] = false;
103
+            $displayParams['showMinutesDropdown'] = false;
104 104
         }
105 105
 
106 106
         if(!isset($displayParams['showHoursDropdown'])) {
107
-           $displayParams['showHoursDropdown'] = false;
107
+            $displayParams['showHoursDropdown'] = false;
108 108
         }
109 109
 
110 110
         if(!isset($displayParams['showNoneCheckbox'])) {
111
-           $displayParams['showNoneCheckbox'] = false;
111
+            $displayParams['showNoneCheckbox'] = false;
112 112
         }
113 113
 
114 114
         if(!isset($displayParams['showFormats'])) {
115
-           $displayParams['showFormats'] = false;
115
+            $displayParams['showFormats'] = false;
116 116
         }
117 117
 
118 118
         global $timedate;
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
 
127
-	public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0){
127
+    public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0){
128 128
         // This does not return a smarty section, instead it returns a direct value
129 129
         if(isset($context['notify_user'])) {
130 130
             $user = $context['notify_user'];
@@ -143,14 +143,14 @@  discard block
 block discarded – undo
143 143
 
144 144
         if(strpos($params[$prefix.$field], ' ') > 0) {
145 145
             if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATETIME_FORMAT)) {
146
-	            $bean->$field = $params[$prefix.$field];
146
+                $bean->$field = $params[$prefix.$field];
147 147
             } else {
148 148
                 $bean->$field = $timedate->to_db($params[$prefix.$field]);
149 149
             }
150 150
         } else {
151
-        	$GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $params[$prefix.$field]);
152
-	        //Default to assume date format value
153
-        	if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATE_FORMAT)) {
151
+            $GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $params[$prefix.$field]);
152
+            //Default to assume date format value
153
+            if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATE_FORMAT)) {
154 154
                 $bean->$field = $params[$prefix.$field];
155 155
             } else {
156 156
                 $bean->$field = $timedate->to_db_date($params[$prefix.$field]);
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
         if ( !$timedate->check_matching_format($value, $format) ) {
176 176
             $parts = $timedate->split_date_time($value);
177 177
             if(empty($parts[0])) {
178
-               $datepart = $timedate->getNow()->format($settings->dateformat);
178
+                $datepart = $timedate->getNow()->format($settings->dateformat);
179 179
             }
180 180
             else {
181
-               $datepart = $parts[0];
181
+                $datepart = $parts[0];
182 182
             }
183 183
             if(empty($parts[1])) {
184 184
                 $timepart = $timedate->fromTimestamp(0)->format($settings->timeformat);
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 
44 44
     function getEditViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
         // Create Smarty variables for the Calendar picker widget
46
-        if(!isset($displayParams['showMinutesDropdown'])) {
46
+        if (!isset($displayParams['showMinutesDropdown'])) {
47 47
            $displayParams['showMinutesDropdown'] = false;
48 48
         }
49 49
 
50
-        if(!isset($displayParams['showHoursDropdown'])) {
50
+        if (!isset($displayParams['showHoursDropdown'])) {
51 51
            $displayParams['showHoursDropdown'] = false;
52 52
         }
53 53
 
54
-        if(!isset($displayParams['showNoneCheckbox'])) {
54
+        if (!isset($displayParams['showNoneCheckbox'])) {
55 55
            $displayParams['showNoneCheckbox'] = false;
56 56
         }
57 57
 
58
-        if(!isset($displayParams['showFormats'])) {
58
+        if (!isset($displayParams['showFormats'])) {
59 59
            $displayParams['showFormats'] = false;
60 60
         }
61 61
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	
76 76
     function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
77 77
 
78
-    	 if($this->isRangeSearchView($vardef)) {
78
+    	 if ($this->isRangeSearchView($vardef)) {
79 79
            $displayParams['showMinutesDropdown'] = false;
80 80
            $displayParams['showHoursDropdown'] = false;
81 81
            $displayParams['showNoneCheckbox'] = false;
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
            $this->ss->assign('id_range_start', "start_range_{$id}");
92 92
            $this->ss->assign('id_range_end', "end_range_{$id}");
93 93
            $this->ss->assign('id_range_choice', "{$id}_range_choice");
94
-           if(file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
94
+           if (file_exists('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl'))
95 95
            {
96 96
               return $this->fetch('custom/include/SugarFields/Fields/Datetimecombo/RangeSearchForm.tpl');
97 97
            }
@@ -99,19 +99,19 @@  discard block
 block discarded – undo
99 99
         }
100 100
 
101 101
     	// Create Smarty variables for the Calendar picker widget
102
-        if(!isset($displayParams['showMinutesDropdown'])) {
102
+        if (!isset($displayParams['showMinutesDropdown'])) {
103 103
            $displayParams['showMinutesDropdown'] = false;
104 104
         }
105 105
 
106
-        if(!isset($displayParams['showHoursDropdown'])) {
106
+        if (!isset($displayParams['showHoursDropdown'])) {
107 107
            $displayParams['showHoursDropdown'] = false;
108 108
         }
109 109
 
110
-        if(!isset($displayParams['showNoneCheckbox'])) {
110
+        if (!isset($displayParams['showNoneCheckbox'])) {
111 111
            $displayParams['showNoneCheckbox'] = false;
112 112
         }
113 113
 
114
-        if(!isset($displayParams['showFormats'])) {
114
+        if (!isset($displayParams['showFormats'])) {
115 115
            $displayParams['showFormats'] = false;
116 116
         }
117 117
 
@@ -124,9 +124,9 @@  discard block
 block discarded – undo
124 124
     }
125 125
 
126 126
 
127
-	public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0){
127
+	public function getEmailTemplateValue($inputField, $vardef, $context = null, $tabindex = 0) {
128 128
         // This does not return a smarty section, instead it returns a direct value
129
-        if(isset($context['notify_user'])) {
129
+        if (isset($context['notify_user'])) {
130 130
             $user = $context['notify_user'];
131 131
         } else {
132 132
             $user = $GLOBALS['current_user'];
@@ -136,19 +136,19 @@  discard block
 block discarded – undo
136 136
     
137 137
     public function save(&$bean, $params, $field, $properties, $prefix = '') {
138 138
         global $timedate;
139
-        if ( !isset($params[$prefix.$field]) ) {
139
+        if (!isset($params[$prefix.$field])) {
140 140
             //$bean->$field = '';
141 141
             return;
142 142
         }
143 143
 
144
-        if(strpos($params[$prefix.$field], ' ') > 0) {
144
+        if (strpos($params[$prefix.$field], ' ') > 0) {
145 145
             if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATETIME_FORMAT)) {
146 146
 	            $bean->$field = $params[$prefix.$field];
147 147
             } else {
148 148
                 $bean->$field = $timedate->to_db($params[$prefix.$field]);
149 149
             }
150 150
         } else {
151
-        	$GLOBALS['log']->error('Field ' . $prefix.$field . ' expecting datetime format, but got value: ' . $params[$prefix.$field]);
151
+        	$GLOBALS['log']->error('Field '.$prefix.$field.' expecting datetime format, but got value: '.$params[$prefix.$field]);
152 152
 	        //Default to assume date format value
153 153
         	if ($timedate->check_matching_format($params[$prefix.$field], TimeDate::DB_DATE_FORMAT)) {
154 154
                 $bean->$field = $params[$prefix.$field];
@@ -172,39 +172,39 @@  discard block
 block discarded – undo
172 172
 
173 173
         $format = $timedate->merge_date_time($settings->dateformat, $settings->timeformat);
174 174
 
175
-        if ( !$timedate->check_matching_format($value, $format) ) {
175
+        if (!$timedate->check_matching_format($value, $format)) {
176 176
             $parts = $timedate->split_date_time($value);
177
-            if(empty($parts[0])) {
177
+            if (empty($parts[0])) {
178 178
                $datepart = $timedate->getNow()->format($settings->dateformat);
179 179
             }
180 180
             else {
181 181
                $datepart = $parts[0];
182 182
             }
183
-            if(empty($parts[1])) {
183
+            if (empty($parts[1])) {
184 184
                 $timepart = $timedate->fromTimestamp(0)->format($settings->timeformat);
185 185
             } else {
186 186
                 $timepart = $parts[1];
187 187
                 // see if we can get by stripping the seconds
188
-                if(strpos($settings->timeformat, 's') === false) {
188
+                if (strpos($settings->timeformat, 's') === false) {
189 189
                     $sep = $timedate->timeSeparatorFormat($settings->timeformat);
190 190
                     // We are assuming here seconds are the last component, which
191 191
                     // is kind of reasonable - no sane time format puts seconds first
192 192
                     $timeparts = explode($sep, $timepart);
193
-                    if(!empty($timeparts[2])) {
193
+                    if (!empty($timeparts[2])) {
194 194
                         $timepart = join($sep, array($timeparts[0], $timeparts[1]));
195 195
                     }
196 196
                 }
197 197
             }
198 198
 
199 199
             $value = $timedate->merge_date_time($datepart, $timepart);
200
-            if ( !$timedate->check_matching_format($value, $format) ) {
200
+            if (!$timedate->check_matching_format($value, $format)) {
201 201
                 return false;
202 202
             }
203 203
         }
204 204
 
205 205
         try {
206 206
             $date = SugarDateTime::createFromFormat($format, $value, new DateTimeZone($settings->timezone));
207
-        } catch(Exception $e) {
207
+        }catch (Exception $e) {
208 208
             return false;
209 209
         }
210 210
         return $date->asDb();
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@
 block discarded – undo
55 55
             }
56 56
             if(isset($parameters[$condition_item['condition_order']])) {
57 57
                 $parameters[] = $condition_item;
58
-            }
59
-            else {
58
+            } else {
60 59
                 $parameters[$condition_item['condition_order']] = $condition_item;
61 60
             }
62 61
         }
Please login to merge, or discard this patch.
SugarFields/Fields/Assigned_user_name/SugarFieldAssigned_user_name.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -41,14 +41,14 @@
 block discarded – undo
41 41
 
42 42
 class SugarFieldAssigned_user_name extends SugarFieldBase {
43 43
 
44
-	function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45
-    	$vardef['options'] = get_user_array(false);
46
-		if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
47
-    	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48
-           return $this->fetch($this->findTemplate('EditViewFunction'));
49
-    	}else{
50
-    	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51
-           return $this->fetch($this->findTemplate('SearchView'));
52
-    	}
44
+    function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45
+        $vardef['options'] = get_user_array(false);
46
+        if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
47
+            $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48
+            return $this->fetch($this->findTemplate('EditViewFunction'));
49
+        }else{
50
+            $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51
+            return $this->fetch($this->findTemplate('SearchView'));
52
+        }
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,10 +43,10 @@
 block discarded – undo
43 43
 
44 44
 	function getSearchViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
     	$vardef['options'] = get_user_array(false);
46
-		if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
46
+		if (!empty($vardef['function']['returns']) && $vardef['function']['returns'] == 'html') {
47 47
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48 48
            return $this->fetch($this->findTemplate('EditViewFunction'));
49
-    	}else{
49
+    	} else {
50 50
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51 51
            return $this->fetch($this->findTemplate('SearchView'));
52 52
     	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 		if(!empty($vardef['function']['returns']) && $vardef['function']['returns']== 'html'){
47 47
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
48 48
            return $this->fetch($this->findTemplate('EditViewFunction'));
49
-    	}else{
49
+    	} else{
50 50
     	   $this->setup($parentFieldArray, $vardef, $displayParams, $tabindex);
51 51
            return $this->fetch($this->findTemplate('SearchView'));
52 52
     	}
Please login to merge, or discard this patch.
include/SugarFields/Fields/Text/SugarFieldText.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 require_once 'include/clean.php';
42 42
 class SugarFieldText extends SugarFieldBase {
43 43
 
44
-	function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
44
+    function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45 45
         if(!isset($displayParams['nl2br'])){
46 46
             $displayParams['nl2br'] = true;
47 47
         }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         if(!isset($displayParams['url2html'])) {
52 52
             $displayParams['url2html'] = true;
53 53
         }
54
-		return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
54
+        return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
55 55
     }
56 56
     function getClassicEditView($field_id='description', $value='', $prefix='', $rich_text=false, $maxlength='', $tabindex=1, $cols=80, $rows=4) {
57 57
 
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 
69 69
 
70 70
         $this->ss->assign('displayParams', $displayParams);
71
-		if(isset($GLOBALS['current_user'])) {
72
-			$height = $GLOBALS['current_user']->getPreference('text_editor_height');
73
-			$width = $GLOBALS['current_user']->getPreference('text_editor_width');
74
-			$height = isset($height) ? $height : '300px';
75
-	        $width = isset($width) ? $width : '95%';
76
-			$this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height);
77
-			$this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width);
78
-		} else {
79
-			$this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px');
80
-			$this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%');
81
-		}
71
+        if(isset($GLOBALS['current_user'])) {
72
+            $height = $GLOBALS['current_user']->getPreference('text_editor_height');
73
+            $width = $GLOBALS['current_user']->getPreference('text_editor_width');
74
+            $height = isset($height) ? $height : '300px';
75
+            $width = isset($width) ? $width : '95%';
76
+            $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', $height);
77
+            $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', $width);
78
+        } else {
79
+            $this->ss->assign('RICH_TEXT_EDITOR_HEIGHT', '100px');
80
+            $this->ss->assign('RICH_TEXT_EDITOR_WIDTH', '95%');
81
+        }
82 82
 
83
-		return $this->ss->fetch($this->findTemplate('ClassicEditView'));
83
+        return $this->ss->fetch($this->findTemplate('ClassicEditView'));
84 84
     }
85 85
 }
86 86
 ?>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,18 +42,18 @@  discard block
 block discarded – undo
42 42
 class SugarFieldText extends SugarFieldBase {
43 43
 
44 44
 	function getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex) {
45
-        if(!isset($displayParams['nl2br'])){
45
+        if (!isset($displayParams['nl2br'])) {
46 46
             $displayParams['nl2br'] = true;
47 47
         }
48
-        if(!isset($displayParams['htmlescape'])) {
48
+        if (!isset($displayParams['htmlescape'])) {
49 49
             $displayParams['htmlescape'] = true;
50 50
         }
51
-        if(!isset($displayParams['url2html'])) {
51
+        if (!isset($displayParams['url2html'])) {
52 52
             $displayParams['url2html'] = true;
53 53
         }
54 54
 		return parent::getDetailViewSmarty($parentFieldArray, $vardef, $displayParams, $tabindex);
55 55
     }
56
-    function getClassicEditView($field_id='description', $value='', $prefix='', $rich_text=false, $maxlength='', $tabindex=1, $cols=80, $rows=4) {
56
+    function getClassicEditView($field_id = 'description', $value = '', $prefix = '', $rich_text = false, $maxlength = '', $tabindex = 1, $cols = 80, $rows = 4) {
57 57
 
58 58
         $this->ss->assign('prefix', $prefix);
59 59
         $this->ss->assign('field_id', $field_id);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 
70 70
         $this->ss->assign('displayParams', $displayParams);
71
-		if(isset($GLOBALS['current_user'])) {
71
+		if (isset($GLOBALS['current_user'])) {
72 72
 			$height = $GLOBALS['current_user']->getPreference('text_editor_height');
73 73
 			$width = $GLOBALS['current_user']->getPreference('text_editor_width');
74 74
 			$height = isset($height) ? $height : '300px';
Please login to merge, or discard this patch.
include/SugarFields/Fields/CronSchedule/SugarFieldCronSchedule.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -3,48 +3,48 @@
 block discarded – undo
3 3
 
4 4
 class SugarFieldCronSchedule extends SugarFieldBase {
5 5
 
6
-    private function getDays(){
6
+    private function getDays() {
7 7
         $days = array();
8 8
         $date = new DateTime("1986-05-01");
9 9
         $period = new DateInterval('P1D');
10
-        for($x = 1; $x <= 31; $x++){
11
-            $days[$x] = $date->format('jS');;
10
+        for ($x = 1; $x <= 31; $x++) {
11
+            $days[$x] = $date->format('jS'); ;
12 12
             $date->add($period);
13 13
         }
14 14
         return $days;
15 15
     }
16
-    private function getWeekDays(){
16
+    private function getWeekDays() {
17 17
         $days = array();
18 18
         $date = new DateTime("1986-05-04");
19 19
         $period = new DateInterval('P1D');
20
-        for($x = 0; $x < 7; $x++){
20
+        for ($x = 0; $x < 7; $x++) {
21 21
             $days[$x] = $date->format('D');
22 22
             $date->add($period);
23 23
         }
24 24
         return $days;
25 25
     }
26 26
 
27
-    function getHumanReadable($schedule){
27
+    function getHumanReadable($schedule) {
28 28
 
29 29
     }
30 30
 
31 31
     function setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass = true) {
32
-        global $app_list_strings,$app_strings;
32
+        global $app_list_strings, $app_strings;
33 33
         parent::setup($parentFieldArray, $vardef, $displayParams, $tabindex, $twopass);
34
-        $this->ss->assign('APP',$app_strings);
35
-        $this->ss->assign('types',get_select_options_with_id($app_list_strings['aor_scheduled_report_schedule_types'],''));
34
+        $this->ss->assign('APP', $app_strings);
35
+        $this->ss->assign('types', get_select_options_with_id($app_list_strings['aor_scheduled_report_schedule_types'], ''));
36 36
         $weekdays = $this->getWeekDays();
37
-        $this->ss->assign('weekday_vals',json_encode($weekdays));
38
-        $this->ss->assign('weekdays',get_select_options($weekdays,''));
37
+        $this->ss->assign('weekday_vals', json_encode($weekdays));
38
+        $this->ss->assign('weekdays', get_select_options($weekdays, ''));
39 39
         $days = $this->getDays();
40
-        $this->ss->assign('days',get_select_options($days,''));
41
-        function padNumbers($x){
42
-            return str_pad($x,2,'0',STR_PAD_LEFT);
40
+        $this->ss->assign('days', get_select_options($days, ''));
41
+        function padNumbers($x) {
42
+            return str_pad($x, 2, '0', STR_PAD_LEFT);
43 43
         }
44
-        $minutes = array_map('padNumbers',range(0,59));
45
-        $hours = array_map('padNumbers',range(0,23));
46
-        $this->ss->assign('minutes',get_select_options($minutes,''));
47
-        $this->ss->assign('hours',get_select_options($hours,''));
44
+        $minutes = array_map('padNumbers', range(0, 59));
45
+        $hours = array_map('padNumbers', range(0, 23));
46
+        $this->ss->assign('minutes', get_select_options($minutes, ''));
47
+        $this->ss->assign('hours', get_select_options($hours, ''));
48 48
     }
49 49
 
50 50
 
Please login to merge, or discard this patch.
include/SugarEmailAddress/SugarEmailAddress.php 3 patches
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     var $object_name = 'EmailAddress';
57 57
 
58 58
     //bug 40068, According to rules in page 6 of http://www.apps.ietf.org/rfc/rfc3696.html#sec-3,
59
-	//allowed special characters ! # $ % & ' * + - / = ?  ^ _ ` . { | } ~ in local part
59
+    //allowed special characters ! # $ % & ' * + - / = ?  ^ _ ` . { | } ~ in local part
60 60
     var $regex = "/^(?:['\.\-\+&#!\$\*=\?\^_`\{\}~\/\w]+)@(?:(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|\w+(?:[\.-]*\w+)*(?:\.[\w-]{2,})+)\$/";
61 61
     var $disable_custom_fields = true;
62 62
     var $db;
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
             // determine which array to process
392 392
             foreach($_REQUEST as $k => $v) {
393 393
                 if(strpos($k, 'emailAddress') !== false) {
394
-                   $fromRequest = true;
395
-                   break;
394
+                    $fromRequest = true;
395
+                    break;
396 396
                 }
397 397
             $widget_id = $_REQUEST[$module .'_email_widget_id'];
398 398
     }
@@ -409,30 +409,30 @@  discard block
 block discarded – undo
409 409
 
410 410
                 $eId = $module . $widget_id;
411 411
                 if(isset($_REQUEST[$eId . 'emailAddressPrimaryFlag'])) {
412
-                   $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag'];
412
+                    $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag'];
413 413
                 } else if(isset($_REQUEST[$module . 'emailAddressPrimaryFlag'])) {
414
-                   $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag'];
414
+                    $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag'];
415 415
                 }
416 416
 
417 417
                 $optOutValues = array();
418 418
                 if(isset($_REQUEST[$eId .'emailAddressOptOutFlag'])) {
419
-                   $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag'];
419
+                    $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag'];
420 420
                 } else if(isset($_REQUEST[$module . 'emailAddressOptOutFlag'])) {
421
-                   $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag'];
421
+                    $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag'];
422 422
                 }
423 423
 
424 424
                 $invalidValues = array();
425 425
                 if(isset($_REQUEST[$eId .'emailAddressInvalidFlag'])) {
426
-                   $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag'];
426
+                    $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag'];
427 427
                 } else if(isset($_REQUEST[$module . 'emailAddressInvalidFlag'])) {
428
-                   $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag'];
428
+                    $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag'];
429 429
                 }
430 430
 
431 431
                 $deleteValues = array();
432 432
                 if(isset($_REQUEST[$eId .'emailAddressDeleteFlag'])) {
433
-                   $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag'];
433
+                    $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag'];
434 434
                 } else if(isset($_REQUEST[$module . 'emailAddressDeleteFlag'])) {
435
-                   $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag'];
435
+                    $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag'];
436 436
                 }
437 437
 
438 438
                 // prep from form save
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 
447 447
                 if($fromRequest && empty($replyTo)) {
448 448
                     if(isset($_REQUEST[$eId .'emailAddressReplyToFlag'])) {
449
-                       $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag'];
449
+                        $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag'];
450 450
                     } else if(isset($_REQUEST[$module . 'emailAddressReplyToFlag'])) {
451
-                       $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag'];
451
+                        $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag'];
452 452
                     }
453 453
                 }
454 454
                 if($fromRequest && empty($new_addrs)) {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
                         if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
473 473
                             $validateFlag = str_replace("Value", "Flag", $k);
474 474
                             if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true")
475
-                              $new_addrs[$k] = $v;
475
+                                $new_addrs[$k] = $v;
476 476
                         }
477 477
                     }
478 478
                 }
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
                     $optOutValues = array();
485 485
                     $invalidValues = array();
486 486
                     foreach($new_addrs as $k=>$email) {
487
-                       preg_match('/emailAddress([0-9])+$/', $k, $matches);
488
-                       $count = $matches[1];
489
-                       $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'");
490
-                       if(!empty($result)) {
491
-                          $row=$this->db->fetchByAssoc($result);
492
-                          if(!empty($row['opt_out'])) {
493
-                             $optOutValues[$k] = "emailAddress$count";
494
-                          }
495
-                          if(!empty($row['invalid_email'])) {
496
-                             $invalidValues[$k] = "emailAddress$count";
497
-                          }
498
-                       }
487
+                        preg_match('/emailAddress([0-9])+$/', $k, $matches);
488
+                        $count = $matches[1];
489
+                        $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'");
490
+                        if(!empty($result)) {
491
+                            $row=$this->db->fetchByAssoc($result);
492
+                            if(!empty($row['opt_out'])) {
493
+                                $optOutValues[$k] = "emailAddress$count";
494
+                            }
495
+                            if(!empty($row['invalid_email'])) {
496
+                                $invalidValues[$k] = "emailAddress$count";
497
+                            }
498
+                        }
499 499
                     }
500 500
                 }
501 501
                 // Re-populate the addresses class variable if we have new address(es).
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 
523 523
         //If no widgets, set addresses array to empty
524 524
         if($post_from_email_address_widget && !$hasEmailValue) {
525
-           $this->addresses = array();
525
+            $this->addresses = array();
526 526
         }
527 527
     }
528 528
 
@@ -861,14 +861,14 @@  discard block
 block discarded – undo
861 861
             $count = 0;
862 862
             $key = $module . $widget_id . 'emailAddress'.$count;
863 863
             while(isset($_REQUEST[$key])) {
864
-                   $email = $_REQUEST[$key];
865
-                   $prefillDataArr[] =  array('email_address'=>$email,
866
-                                             'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key,
867
-                                             'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']),
868
-                                             'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']),
869
-                                             'reply_to_address'=>false
864
+                    $email = $_REQUEST[$key];
865
+                    $prefillDataArr[] =  array('email_address'=>$email,
866
+                                                'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key,
867
+                                                'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']),
868
+                                                'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']),
869
+                                                'reply_to_address'=>false
870 870
                                         );
871
-                   $key = $module . $widget_id . 'emailAddress' . ++$count;
871
+                    $key = $module . $widget_id . 'emailAddress' . ++$count;
872 872
             } //while
873 873
         }
874 874
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
         $this->smarty->assign('emailAddressWidget',$_POST['emailAddressWidget']);
986 986
 
987 987
         if(isset($_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'])) {
988
-           $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'];
988
+            $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'];
989 989
         }
990 990
 
991 991
         while(isset($_POST[$mod . $widget_id . "emailAddress" . $count])) {
@@ -994,31 +994,31 @@  discard block
 block discarded – undo
994 994
         }
995 995
 
996 996
         if($count == 0) {
997
-           return "";
997
+            return "";
998 998
         }
999 999
 
1000 1000
         if(isset($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'])) {
1001
-           foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) {
1002
-              $optOut[] = $v;
1003
-           }
1001
+            foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) {
1002
+                $optOut[] = $v;
1003
+            }
1004 1004
         }
1005 1005
 
1006 1006
         if(isset($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'])) {
1007
-           foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) {
1008
-              $invalid[] = $v;
1009
-           }
1007
+            foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) {
1008
+                $invalid[] = $v;
1009
+            }
1010 1010
         }
1011 1011
 
1012 1012
         if(isset($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'])) {
1013
-           foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) {
1014
-              $replyTo[] = $v;
1015
-           }
1013
+            foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) {
1014
+                $replyTo[] = $v;
1015
+            }
1016 1016
         }
1017 1017
 
1018 1018
         if(isset($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'])) {
1019
-           foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) {
1020
-              $delete[] = $v;
1021
-           }
1019
+            foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) {
1020
+                $delete[] = $v;
1021
+            }
1022 1022
         }
1023 1023
 
1024 1024
         while(isset($_POST[$mod . $widget_id . "emailAddressVerifiedValue" . $count])) {
@@ -1052,13 +1052,13 @@  discard block
 block discarded – undo
1052 1052
         $get .= '&emailAddressWidget='.$_POST['emailAddressWidget'];
1053 1053
 
1054 1054
         while(isset($_REQUEST[$mod . $widget_id . 'emailAddress' . $count])) {
1055
-              $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]);
1056
-              $count++;
1055
+                $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]);
1056
+                $count++;
1057 1057
         } //while
1058 1058
 
1059 1059
         while(isset($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count])) {
1060
-              $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]);
1061
-              $count++;
1060
+                $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]);
1061
+                $count++;
1062 1062
         } //while
1063 1063
 
1064 1064
         $options = array('emailAddressPrimaryFlag', 'emailAddressOptOutFlag', 'emailAddressInvalidFlag', 'emailAddressDeleteFlag', 'emailAddressReplyToFlag');
@@ -1067,14 +1067,14 @@  discard block
 block discarded – undo
1067 1067
             $count = 0;
1068 1068
             $optionIdentifier = $mod.$widget_id.$option;
1069 1069
             if(isset($_REQUEST[$optionIdentifier])) {
1070
-               if(is_array($_REQUEST[$optionIdentifier])) {
1071
-                   foreach($_REQUEST[$optionIdentifier] as $optOut) {
1072
-                      $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut;
1073
-                      $count++;
1074
-                   } //foreach
1075
-               } else {
1076
-                   $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier];
1077
-               }
1070
+                if(is_array($_REQUEST[$optionIdentifier])) {
1071
+                    foreach($_REQUEST[$optionIdentifier] as $optOut) {
1072
+                        $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut;
1073
+                        $count++;
1074
+                    } //foreach
1075
+                } else {
1076
+                    $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier];
1077
+                }
1078 1078
             } //if
1079 1079
         } //foreach
1080 1080
         return $get;
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
     }
1083 1083
 
1084 1084
     function setView($view) {
1085
-       $this->view = $view;
1085
+        $this->view = $view;
1086 1086
     }
1087 1087
 
1088 1088
 /**
Please login to merge, or discard this patch.
Braces   +40 added lines, -28 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.
@@ -85,8 +87,7 @@  discard block
 block discarded – undo
85 87
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
86 88
         if(isset($GLOBALS['log'])) {
87 89
             $GLOBALS['log']->deprecated($deprecatedMessage);
88
-        }
89
-        else {
90
+        } else {
90 91
             trigger_error($deprecatedMessage, E_USER_DEPRECATED);
91 92
         }
92 93
         self::__construct();
@@ -147,8 +148,9 @@  discard block
 block discarded – undo
147 148
         $alternate_found = false;
148 149
         $alternate2_found = false;
149 150
         foreach($this->addresses as $k=>$address) {
150
-            if ($primary_found && $alternate_found)
151
-                break;
151
+            if ($primary_found && $alternate_found) {
152
+                            break;
153
+            }
152 154
             if ($address['primary_address'] == 1 && !$primary_found) {
153 155
                 $primary_index = $k;
154 156
                 $primary_found = true;
@@ -286,8 +288,9 @@  discard block
 block discarded – undo
286 288
         )
287 289
     {
288 290
         $emailCaps = strtoupper(trim($email));
289
-        if(empty($emailCaps))
290
-            return 0;
291
+        if(empty($emailCaps)) {
292
+                    return 0;
293
+        }
291 294
 
292 295
         $q = "SELECT *
293 296
                 FROM email_addr_bean_rel eabl JOIN email_addresses ea
@@ -303,7 +306,9 @@  discard block
 block discarded – undo
303 306
 
304 307
         // do it this way to make the count accurate in oracle
305 308
         $i = 0;
306
-        while ($this->db->fetchByAssoc($r)) ++$i;
309
+        while ($this->db->fetchByAssoc($r)) {
310
+            ++$i;
311
+        }
307 312
 
308 313
         return $i;
309 314
     }
@@ -486,8 +491,9 @@  discard block
 block discarded – undo
486 491
                     foreach($_REQUEST as $k => $v) {
487 492
                         if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
488 493
                             $validateFlag = str_replace("Value", "Flag", $k);
489
-                            if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true")
490
-                              $new_addrs[$k] = $v;
494
+                            if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true") {
495
+                                                          $new_addrs[$k] = $v;
496
+                            }
491 497
                         }
492 498
                     }
493 499
                 }
@@ -690,8 +696,7 @@  discard block
 block discarded – undo
690 696
         if ($id) {
691 697
             $r = $this->db->query("SELECT * FROM email_addresses WHERE id='".$this->db->quote($id)."'");
692 698
             $current_email = $this->db->fetchByAssoc($r);
693
-        }
694
-        else {
699
+        } else {
695 700
             $current_email = null;
696 701
         }
697 702
 
@@ -731,8 +736,7 @@  discard block
 block discarded – undo
731 736
                 $upd_r = $this->db->query($upd_q);
732 737
             }
733 738
             return $duplicate_email['id'];
734
-        }
735
-        else {
739
+        } else {
736 740
             // no case-insensitive address match - it's new, or undeleted.
737 741
             $guid = '';
738 742
             if(!empty($address)){
@@ -798,8 +802,7 @@  discard block
 block discarded – undo
798 802
             // otherwise
799 803
             $q .= "
800 804
                 ORDER BY ear.reply_to_address DESC";
801
-        }
802
-        else
805
+        } else
803 806
         {
804 807
             // retrieve reply-to address only
805 808
             $q .= "
@@ -850,8 +853,9 @@  discard block
 block discarded – undo
850 853
      */
851 854
     function getEmailAddressWidgetEditView($id, $module, $asMetadata=false, $tpl='',$tabindex='0')
852 855
     {
853
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
854
-            $this->smarty = new Sugar_Smarty();
856
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
857
+                    $this->smarty = new Sugar_Smarty();
858
+        }
855 859
 
856 860
         global $app_strings, $dictionary, $beanList;
857 861
 
@@ -869,8 +873,9 @@  discard block
 block discarded – undo
869 873
         if(!empty($id)) {
870 874
             $prefillDataArr = $this->getAddressesByGUID($id, $module);
871 875
             //When coming from convert leads, sometimes module is Contacts while the id is for a lead.
872
-            if (empty($prefillDataArr) && $module == "Contacts")
873
-                $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
876
+            if (empty($prefillDataArr) && $module == "Contacts") {
877
+                            $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
878
+            }
874 879
         } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){
875 880
             $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0';
876 881
             $count = 0;
@@ -895,8 +900,9 @@  discard block
 block discarded – undo
895 900
 
896 901
         $required = false;
897 902
         $vardefs = $dictionary[$beanList[$passedModule]]['fields'];
898
-        if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required'])
899
-            $required = true;
903
+        if (!empty($vardefs['email1']) && isset($vardefs['email1']['required']) && $vardefs['email1']['required']) {
904
+                    $required = true;
905
+        }
900 906
         $this->smarty->assign('required', $required);
901 907
 
902 908
         $this->smarty->assign('module', $saveModule);
@@ -950,13 +956,16 @@  discard block
 block discarded – undo
950 956
      */
951 957
     function getEmailAddressWidgetDetailView($focus, $tpl='')
952 958
     {
953
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
954
-            $this->smarty = new Sugar_Smarty();
959
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
960
+                    $this->smarty = new Sugar_Smarty();
961
+        }
955 962
 
956 963
         global $app_strings;
957 964
         global $current_user;
958 965
         $assign = array();
959
-        if(empty($focus->id))return '';
966
+        if(empty($focus->id)) {
967
+            return '';
968
+        }
960 969
         $prefillData = $this->getAddressesByGUID($focus->id, $focus->module_dir);
961 970
 
962 971
         foreach($prefillData as $addressItem) {
@@ -985,8 +994,9 @@  discard block
 block discarded – undo
985 994
      */
986 995
     function getEmailAddressWidgetDuplicatesView($focus)
987 996
     {
988
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
989
-            $this->smarty = new Sugar_Smarty();
997
+        if ( !($this->smarty instanceOf Sugar_Smarty ) ) {
998
+                    $this->smarty = new Sugar_Smarty();
999
+        }
990 1000
 
991 1001
         $count = 0;
992 1002
         $emails = array();
@@ -1146,7 +1156,9 @@  discard block
 block discarded – undo
1146 1156
 
1147 1157
         if($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
1148 1158
             $module = $focus->module_dir;
1149
-            if ($view == 'ConvertLead' && $module == "Contacts")  $module = "Leads";
1159
+            if ($view == 'ConvertLead' && $module == "Contacts") {
1160
+                $module = "Leads";
1161
+            }
1150 1162
 
1151 1163
             return $sea->getEmailAddressWidgetEditView($focus->id, $module, false,'',$tabindex);
1152 1164
         }
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 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.
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
83 83
      */
84
-    public function SugarEmailAddress(){
84
+    public function SugarEmailAddress() {
85 85
         $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
86
-        if(isset($GLOBALS['log'])) {
86
+        if (isset($GLOBALS['log'])) {
87 87
             $GLOBALS['log']->deprecated($deprecatedMessage);
88 88
         }
89 89
         else {
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
      * @param string $module
100 100
      */
101 101
     function handleLegacySave($bean, $prefix = "") {
102
-        if(!isset($_REQUEST) || !isset($_REQUEST['useEmailWidget'])) {
102
+        if (!isset($_REQUEST) || !isset($_REQUEST['useEmailWidget'])) {
103 103
             if (empty($this->addresses) || !isset($_REQUEST['massupdate'])) {
104 104
                 $this->addresses = array();
105 105
                 $optOut = (isset($bean->email_opt_out) && $bean->email_opt_out == "1") ? true : false;
106 106
                 $invalid = (isset($bean->invalid_email) && $bean->invalid_email == "1") ? true : false;
107 107
 
108 108
                 $isPrimary = true;
109
-                for($i = 1; $i <= 10; $i++){
109
+                for ($i = 1; $i <= 10; $i++) {
110 110
                     $email = 'email'.$i;
111
-                    if(isset($bean->$email) && !empty($bean->$email)){
111
+                    if (isset($bean->$email) && !empty($bean->$email)) {
112 112
                         $opt_out_field = $email.'_opt_out';
113 113
                         $invalid_field = $email.'_invalid';
114 114
                         $field_optOut = (isset($bean->$opt_out_field)) ? $bean->$opt_out_field : $optOut;
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
                 }
120 120
             }
121 121
         }
122
-        $this->populateAddresses($bean->id, $bean->module_dir, array(),'');
123
-        if(isset($_REQUEST) && isset($_REQUEST['useEmailWidget'])) {
122
+        $this->populateAddresses($bean->id, $bean->module_dir, array(), '');
123
+        if (isset($_REQUEST) && isset($_REQUEST['useEmailWidget'])) {
124 124
             $this->populateLegacyFields($bean);
125 125
         }
126 126
     }
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
         return;
143 143
     }
144 144
 
145
-    function populateLegacyFields(&$bean){
145
+    function populateLegacyFields(&$bean) {
146 146
         $primary_found = false;
147 147
         $alternate_found = false;
148 148
         $alternate2_found = false;
149
-        foreach($this->addresses as $k=>$address) {
149
+        foreach ($this->addresses as $k=>$address) {
150 150
             if ($primary_found && $alternate_found)
151 151
                 break;
152 152
             if ($address['primary_address'] == 1 && !$primary_found) {
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
             } elseif (!$alternate_found) {
156 156
                 $alternate_index = $k;
157 157
                 $alternate_found = true;
158
-            } elseif (!$alternate2_found){
158
+            } elseif (!$alternate2_found) {
159 159
                 $alternate2_index = $k;
160 160
                 $alternate2_found = true;
161 161
             }
@@ -192,27 +192,27 @@  discard block
 block discarded – undo
192 192
         $args = func_get_args();
193 193
         return call_user_func_array(array($this, '_save'), $args);
194 194
     }
195
-    private function _save($id, $module, $new_addrs=array(), $primary='', $replyTo='', $invalid='', $optOut='', $in_workflow=false) {
196
-        if(empty($this->addresses) || $in_workflow){
197
-            $this->populateAddresses($id, $module, $new_addrs,$primary);
195
+    private function _save($id, $module, $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '', $in_workflow = false) {
196
+        if (empty($this->addresses) || $in_workflow) {
197
+            $this->populateAddresses($id, $module, $new_addrs, $primary);
198 198
         }
199 199
 
200 200
         //find all email addresses..
201
-        $current_links=array();
201
+        $current_links = array();
202 202
         // Need to correct this to handle the Employee/User split
203 203
         $module = $this->getCorrectedModule($module);
204
-        $q2="select *  from email_addr_bean_rel eabr WHERE eabr.bean_id = '".$this->db->quote($id)."' AND eabr.bean_module = '".$this->db->quote($module)."' and eabr.deleted=0";
204
+        $q2 = "select *  from email_addr_bean_rel eabr WHERE eabr.bean_id = '".$this->db->quote($id)."' AND eabr.bean_module = '".$this->db->quote($module)."' and eabr.deleted=0";
205 205
         $r2 = $this->db->query($q2);
206
-        while(($row2=$this->db->fetchByAssoc($r2)) != null ) {
207
-            $current_links[$row2['email_address_id']]=$row2;
206
+        while (($row2 = $this->db->fetchByAssoc($r2)) != null) {
207
+            $current_links[$row2['email_address_id']] = $row2;
208 208
         }
209 209
 
210 210
         $isConversion = (isset($_REQUEST) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'ConvertLead') ? true : false;
211 211
 
212 212
         if (!empty($this->addresses)) {
213 213
             // insert new relationships and create email address record, if they don't exist
214
-            foreach($this->addresses as $address) {
215
-                if(!empty($address['email_address'])) {
214
+            foreach ($this->addresses as $address) {
215
+                if (!empty($address['email_address'])) {
216 216
                     $guid = create_guid();
217 217
                     $emailId = isset($address['email_address_id'])
218 218
                         && isset($current_links[$address['email_address_id']])
@@ -220,14 +220,14 @@  discard block
 block discarded – undo
220 220
                     $emailId = $this->AddUpdateEmailAddress($address['email_address'],
221 221
                                                             $address['invalid_email'],
222 222
                                                             $address['opt_out'],
223
-                                                            $emailId);// this will save the email address if not found
223
+                                                            $emailId); // this will save the email address if not found
224 224
 
225 225
                     //verify linkage and flags.
226
-                    $upd_eabr="";
226
+                    $upd_eabr = "";
227 227
                     if (isset($current_links[$emailId])) {
228 228
                         if (!$isConversion) { // do not update anything if this is for lead conversion
229
-                        if ($address['primary_address'] != $current_links[$emailId]['primary_address'] or $address['reply_to_address'] != $current_links[$emailId]['reply_to_address'] ) {
230
-                            $upd_eabr="UPDATE email_addr_bean_rel SET primary_address='".$this->db->quote($address['primary_address'])."', reply_to_address='".$this->db->quote($address['reply_to_address'])."' WHERE id='".$this->db->quote($current_links[$emailId]['id'])."'";
229
+                        if ($address['primary_address'] != $current_links[$emailId]['primary_address'] or $address['reply_to_address'] != $current_links[$emailId]['reply_to_address']) {
230
+                            $upd_eabr = "UPDATE email_addr_bean_rel SET primary_address='".$this->db->quote($address['primary_address'])."', reply_to_address='".$this->db->quote($address['reply_to_address'])."' WHERE id='".$this->db->quote($current_links[$emailId]['id'])."'";
231 231
                         }
232 232
 
233 233
                         unset($current_links[$emailId]);
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
         // for lead conversion, do not delete email addresses
259 259
         if (!empty($current_links) && !$isConversion) {
260 260
 
261
-            $delete="";
261
+            $delete = "";
262 262
             foreach ($current_links as $eabr) {
263 263
 
264
-                $delete.=empty($delete) ? "'".$this->db->quote($eabr['id']) . "' " : ",'" . $this->db->quote($eabr['id']) . "'";
264
+                $delete .= empty($delete) ? "'".$this->db->quote($eabr['id'])."' " : ",'".$this->db->quote($eabr['id'])."'";
265 265
             }
266 266
 
267
-            $eabr_unlink="update email_addr_bean_rel set deleted=1 where id in ({$delete})";
267
+            $eabr_unlink = "update email_addr_bean_rel set deleted=1 where id in ({$delete})";
268 268
             $this->db->query($eabr_unlink);
269 269
         }
270 270
         $this->stateBeforeWorkflow = null;
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         )
287 287
     {
288 288
         $emailCaps = strtoupper(trim($email));
289
-        if(empty($emailCaps))
289
+        if (empty($emailCaps))
290 290
             return 0;
291 291
 
292 292
         $q = "SELECT *
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
         $r = $this->db->query($q, true);
325 325
 
326 326
         $retArr = array();
327
-        while($a = $this->db->fetchByAssoc($r)) {
327
+        while ($a = $this->db->fetchByAssoc($r)) {
328 328
             $retArr[] = $a['bean_id'];
329 329
         }
330
-        if(count($retArr) > 0) {
330
+        if (count($retArr) > 0) {
331 331
             return $retArr;
332 332
         } else {
333 333
             return false;
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
         $email = trim($email);
349 349
 
350
-        if(empty($email)) {
350
+        if (empty($email)) {
351 351
             return array();
352 352
         }
353 353
 
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
                 WHERE ea.email_address_caps = $emailCaps and eabl.deleted=0 ";
357 357
         $r = $this->db->query($q);
358 358
 
359
-        while($a = $this->db->fetchByAssoc($r)) {
360
-            if(isset($beanList[$a['bean_module']]) && !empty($beanList[$a['bean_module']])) {
359
+        while ($a = $this->db->fetchByAssoc($r)) {
360
+            if (isset($beanList[$a['bean_module']]) && !empty($beanList[$a['bean_module']])) {
361 361
                 $className = $beanList[$a['bean_module']];
362 362
 
363
-                if(isset($beanFiles[$className]) && !empty($beanFiles[$className])) {
364
-                    if(!class_exists($className)) {
363
+                if (isset($beanFiles[$className]) && !empty($beanFiles[$className])) {
364
+                    if (!class_exists($className)) {
365 365
                         require_once($beanFiles[$className]);
366 366
                     }
367 367
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      * @param string $replyTo GUID of reply-to address
390 390
      * @param string $invalid GUID of invalid address
391 391
      */
392
-    function populateAddresses($id, $module, $new_addrs=array(), $primary='', $replyTo='', $invalid='', $optOut='') {
392
+    function populateAddresses($id, $module, $new_addrs = array(), $primary = '', $replyTo = '', $invalid = '', $optOut = '') {
393 393
         $module = $this->getCorrectedModule($module);
394 394
         //One last check for the ConvertLead action in which case we need to change $module to 'Leads'
395 395
         $module = (isset($_REQUEST) && isset($_REQUEST['action']) && $_REQUEST['action'] == 'ConvertLead') ? 'Leads' : $module;
@@ -400,54 +400,54 @@  discard block
 block discarded – undo
400 400
         $hasEmailValue = false;
401 401
         $email_ids = array();
402 402
 
403
-        if (isset($_REQUEST) && isset($_REQUEST[$module .'_email_widget_id'])) {
403
+        if (isset($_REQUEST) && isset($_REQUEST[$module.'_email_widget_id'])) {
404 404
 
405 405
             $fromRequest = false;
406 406
             // determine which array to process
407
-            foreach($_REQUEST as $k => $v) {
408
-                if(strpos($k, 'emailAddress') !== false) {
407
+            foreach ($_REQUEST as $k => $v) {
408
+                if (strpos($k, 'emailAddress') !== false) {
409 409
                    $fromRequest = true;
410 410
                    break;
411 411
                 }
412
-            $widget_id = $_REQUEST[$module .'_email_widget_id'];
412
+            $widget_id = $_REQUEST[$module.'_email_widget_id'];
413 413
     }
414 414
 
415 415
             //Iterate over the widgets for this module, in case there are multiple email widgets for this module
416
-            while(isset($_REQUEST[$module . $widget_id . "emailAddress" . $widgetCount]))
416
+            while (isset($_REQUEST[$module.$widget_id."emailAddress".$widgetCount]))
417 417
             {
418
-                if (empty($_REQUEST[$module . $widget_id . "emailAddress" . $widgetCount])) {
418
+                if (empty($_REQUEST[$module.$widget_id."emailAddress".$widgetCount])) {
419 419
                     $widgetCount++;
420 420
                     continue;
421 421
                 }
422 422
 
423 423
                 $hasEmailValue = true;
424 424
 
425
-                $eId = $module . $widget_id;
426
-                if(isset($_REQUEST[$eId . 'emailAddressPrimaryFlag'])) {
427
-                   $primaryValue = $_REQUEST[$eId . 'emailAddressPrimaryFlag'];
428
-                } else if(isset($_REQUEST[$module . 'emailAddressPrimaryFlag'])) {
429
-                   $primaryValue = $_REQUEST[$module . 'emailAddressPrimaryFlag'];
425
+                $eId = $module.$widget_id;
426
+                if (isset($_REQUEST[$eId.'emailAddressPrimaryFlag'])) {
427
+                   $primaryValue = $_REQUEST[$eId.'emailAddressPrimaryFlag'];
428
+                } else if (isset($_REQUEST[$module.'emailAddressPrimaryFlag'])) {
429
+                   $primaryValue = $_REQUEST[$module.'emailAddressPrimaryFlag'];
430 430
                 }
431 431
 
432 432
                 $optOutValues = array();
433
-                if(isset($_REQUEST[$eId .'emailAddressOptOutFlag'])) {
434
-                   $optOutValues = $_REQUEST[$eId .'emailAddressOptOutFlag'];
435
-                } else if(isset($_REQUEST[$module . 'emailAddressOptOutFlag'])) {
436
-                   $optOutValues = $_REQUEST[$module . 'emailAddressOptOutFlag'];
433
+                if (isset($_REQUEST[$eId.'emailAddressOptOutFlag'])) {
434
+                   $optOutValues = $_REQUEST[$eId.'emailAddressOptOutFlag'];
435
+                } else if (isset($_REQUEST[$module.'emailAddressOptOutFlag'])) {
436
+                   $optOutValues = $_REQUEST[$module.'emailAddressOptOutFlag'];
437 437
                 }
438 438
 
439 439
                 $invalidValues = array();
440
-                if(isset($_REQUEST[$eId .'emailAddressInvalidFlag'])) {
441
-                   $invalidValues = $_REQUEST[$eId .'emailAddressInvalidFlag'];
442
-                } else if(isset($_REQUEST[$module . 'emailAddressInvalidFlag'])) {
443
-                   $invalidValues = $_REQUEST[$module . 'emailAddressInvalidFlag'];
440
+                if (isset($_REQUEST[$eId.'emailAddressInvalidFlag'])) {
441
+                   $invalidValues = $_REQUEST[$eId.'emailAddressInvalidFlag'];
442
+                } else if (isset($_REQUEST[$module.'emailAddressInvalidFlag'])) {
443
+                   $invalidValues = $_REQUEST[$module.'emailAddressInvalidFlag'];
444 444
                 }
445 445
 
446 446
                 $deleteValues = array();
447
-                if(isset($_REQUEST[$eId .'emailAddressDeleteFlag'])) {
448
-                   $deleteValues = $_REQUEST[$eId .'emailAddressDeleteFlag'];
449
-                } else if(isset($_REQUEST[$module . 'emailAddressDeleteFlag'])) {
450
-                   $deleteValues = $_REQUEST[$module . 'emailAddressDeleteFlag'];
447
+                if (isset($_REQUEST[$eId.'emailAddressDeleteFlag'])) {
448
+                   $deleteValues = $_REQUEST[$eId.'emailAddressDeleteFlag'];
449
+                } else if (isset($_REQUEST[$module.'emailAddressDeleteFlag'])) {
450
+                   $deleteValues = $_REQUEST[$module.'emailAddressDeleteFlag'];
451 451
                 }
452 452
 
453 453
                 // prep from form save
@@ -455,36 +455,36 @@  discard block
 block discarded – undo
455 455
                 $replyToField = '';
456 456
                 $invalidField = '';
457 457
                 $optOutField = '';
458
-                if($fromRequest && empty($primary) && isset($primaryValue)) {
458
+                if ($fromRequest && empty($primary) && isset($primaryValue)) {
459 459
                     $primaryField = $primaryValue;
460 460
                 }
461 461
 
462
-                if($fromRequest && empty($replyTo)) {
463
-                    if(isset($_REQUEST[$eId .'emailAddressReplyToFlag'])) {
464
-                       $replyToField = $_REQUEST[$eId .'emailAddressReplyToFlag'];
465
-                    } else if(isset($_REQUEST[$module . 'emailAddressReplyToFlag'])) {
466
-                       $replyToField = $_REQUEST[$module . 'emailAddressReplyToFlag'];
462
+                if ($fromRequest && empty($replyTo)) {
463
+                    if (isset($_REQUEST[$eId.'emailAddressReplyToFlag'])) {
464
+                       $replyToField = $_REQUEST[$eId.'emailAddressReplyToFlag'];
465
+                    } else if (isset($_REQUEST[$module.'emailAddressReplyToFlag'])) {
466
+                       $replyToField = $_REQUEST[$module.'emailAddressReplyToFlag'];
467 467
                     }
468 468
                 }
469
-                if($fromRequest && empty($new_addrs)) {
470
-                    foreach($_REQUEST as $k => $v) {
471
-                        if(preg_match('/'.$eId.'emailAddress[0-9]+$/i', $k) && !empty($v)) {
469
+                if ($fromRequest && empty($new_addrs)) {
470
+                    foreach ($_REQUEST as $k => $v) {
471
+                        if (preg_match('/'.$eId.'emailAddress[0-9]+$/i', $k) && !empty($v)) {
472 472
                             $new_addrs[$k] = $v;
473 473
                         }
474 474
                     }
475 475
                 }
476
-                if($fromRequest && empty($email_ids)) {
477
-                    foreach($_REQUEST as $k => $v) {
478
-                        if(preg_match('/'.$eId.'emailAddressId[0-9]+$/i', $k) && !empty($v)) {
476
+                if ($fromRequest && empty($email_ids)) {
477
+                    foreach ($_REQUEST as $k => $v) {
478
+                        if (preg_match('/'.$eId.'emailAddressId[0-9]+$/i', $k) && !empty($v)) {
479 479
                             $key = str_replace('emailAddressId', 'emailAddress', $k);
480 480
                             $email_ids[$key] = $v;
481 481
                         }
482 482
                     }
483 483
                 }
484 484
 
485
-                if($fromRequest && empty($new_addrs)) {
486
-                    foreach($_REQUEST as $k => $v) {
487
-                        if(preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
485
+                if ($fromRequest && empty($new_addrs)) {
486
+                    foreach ($_REQUEST as $k => $v) {
487
+                        if (preg_match('/'.$eId.'emailAddressVerifiedValue[0-9]+$/i', $k) && !empty($v)) {
488 488
                             $validateFlag = str_replace("Value", "Flag", $k);
489 489
                             if (isset($_REQUEST[$validateFlag]) && $_REQUEST[$validateFlag] == "true")
490 490
                               $new_addrs[$k] = $v;
@@ -493,21 +493,21 @@  discard block
 block discarded – undo
493 493
                 }
494 494
 
495 495
                 //empty the addresses array if the post happened from email address widget.
496
-                if($post_from_email_address_widget) {
497
-                    $this->addresses=array();  //this gets populated during retrieve of the contact bean.
496
+                if ($post_from_email_address_widget) {
497
+                    $this->addresses = array(); //this gets populated during retrieve of the contact bean.
498 498
                 } else {
499 499
                     $optOutValues = array();
500 500
                     $invalidValues = array();
501
-                    foreach($new_addrs as $k=>$email) {
501
+                    foreach ($new_addrs as $k=>$email) {
502 502
                        preg_match('/emailAddress([0-9])+$/', $k, $matches);
503 503
                        $count = $matches[1];
504
-                       $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '" . $this->db->quote(strtoupper($email)) . "'");
505
-                       if(!empty($result)) {
506
-                          $row=$this->db->fetchByAssoc($result);
507
-                          if(!empty($row['opt_out'])) {
504
+                       $result = $this->db->query("SELECT opt_out, invalid_email from email_addresses where email_address_caps = '".$this->db->quote(strtoupper($email))."'");
505
+                       if (!empty($result)) {
506
+                          $row = $this->db->fetchByAssoc($result);
507
+                          if (!empty($row['opt_out'])) {
508 508
                              $optOutValues[$k] = "emailAddress$count";
509 509
                           }
510
-                          if(!empty($row['invalid_email'])) {
510
+                          if (!empty($row['invalid_email'])) {
511 511
                              $invalidValues[$k] = "emailAddress$count";
512 512
                           }
513 513
                        }
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
                 }
516 516
                 // Re-populate the addresses class variable if we have new address(es).
517 517
                 if (!empty($new_addrs)) {
518
-                    foreach($new_addrs as $k => $reqVar) {
518
+                    foreach ($new_addrs as $k => $reqVar) {
519 519
                         //$key = preg_match("/^$eId/s", $k) ? substr($k, strlen($eId)) : $k;
520 520
                         $reqVar = trim($reqVar);
521
-                        if(strpos($k, 'emailAddress') !== false) {
522
-                            if(!empty($reqVar) && !in_array($k, $deleteValues)) {
521
+                        if (strpos($k, 'emailAddress') !== false) {
522
+                            if (!empty($reqVar) && !in_array($k, $deleteValues)) {
523 523
                                 $email_id   = (array_key_exists($k, $email_ids)) ? $email_ids[$k] : null;
524 524
                                 $primary    = ($k == $primaryValue) ? true : false;
525 525
                                 $replyTo    = ($k == $replyToField) ? true : false;
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         }
537 537
 
538 538
         //If no widgets, set addresses array to empty
539
-        if($post_from_email_address_widget && !$hasEmailValue) {
539
+        if ($post_from_email_address_widget && !$hasEmailValue) {
540 540
            $this->addresses = array();
541 541
         }
542 542
     }
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
      * @param bool $primary Default false
548 548
      * @param bool $replyTo Default false
549 549
      */
550
-    function addAddress($addr, $primary=false, $replyTo=false, $invalid=false, $optOut=false, $email_id = null) {
550
+    function addAddress($addr, $primary = false, $replyTo = false, $invalid = false, $optOut = false, $email_id = null) {
551 551
         $addr = html_entity_decode($addr, ENT_QUOTES);
552
-        if(preg_match($this->regex, $addr)) {
552
+        if (preg_match($this->regex, $addr)) {
553 553
             $primaryFlag = ($primary) ? '1' : '0';
554 554
             $replyToFlag = ($replyTo) ? '1' : '0';
555 555
             $invalidFlag = ($invalid) ? '1' : '0';
@@ -585,17 +585,17 @@  discard block
 block discarded – undo
585 585
      * Updates invalid_email and opt_out flags for each address
586 586
      */
587 587
     function updateFlags() {
588
-        if(!empty($this->addresses)) {
589
-            foreach($this->addresses as $addressMeta) {
590
-                if(isset($addressMeta['email_address']) && !empty($addressMeta['email_address'])) {
588
+        if (!empty($this->addresses)) {
589
+            foreach ($this->addresses as $addressMeta) {
590
+                if (isset($addressMeta['email_address']) && !empty($addressMeta['email_address'])) {
591 591
                     $address = $this->db->quote($this->_cleanAddress($addressMeta['email_address']));
592 592
 
593 593
                     $q = "SELECT * FROM email_addresses WHERE email_address = '{$address}'";
594 594
                     $r = $this->db->query($q);
595 595
                     $a = $this->db->fetchByAssoc($r);
596 596
 
597
-                    if(!empty($a)) {
598
-                        if(isset($a['invalid_email']) && isset($addressMeta['invalid_email']) && isset($addressMeta['opt_out']) && $a['invalid_email'] != $addressMeta['invalid_email'] || $a['opt_out'] != $addressMeta['opt_out']) {
597
+                    if (!empty($a)) {
598
+                        if (isset($a['invalid_email']) && isset($addressMeta['invalid_email']) && isset($addressMeta['opt_out']) && $a['invalid_email'] != $addressMeta['invalid_email'] || $a['opt_out'] != $addressMeta['opt_out']) {
599 599
                             $qUpdate = "UPDATE email_addresses SET invalid_email = ".intval($addressMeta['invalid_email']).", opt_out = ".intval($addressMeta['opt_out']).", date_modified = '".TimeDate::getInstance()->nowDb()."' WHERE id = '".$this->db->quote($a['id'])."'";
600 600
                             $rUpdate = $this->db->query($qUpdate);
601 601
                         }
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
     public function splitEmailAddress($addr)
609 609
     {
610 610
         $email = $this->_cleanAddress($addr);
611
-        if(!preg_match($this->regex, $email)) {
611
+        if (!preg_match($this->regex, $email)) {
612 612
             $email = ''; // remove bad email addr
613 613
         }
614 614
         $name = trim(str_replace(array($email, '<', '>', '"', "'"), '', $addr));
@@ -624,8 +624,8 @@  discard block
 block discarded – undo
624 624
     function _cleanAddress($addr) {
625 625
         $addr = trim(from_html($addr));
626 626
 
627
-        if(strpos($addr, "<") !== false && strpos($addr, ">") !== false) {
628
-            $address = trim(substr($addr, strrpos($addr, "<") +1, strrpos($addr, ">") - strrpos($addr, "<") -1));
627
+        if (strpos($addr, "<") !== false && strpos($addr, ">") !== false) {
628
+            $address = trim(substr($addr, strrpos($addr, "<") + 1, strrpos($addr, ">") - strrpos($addr, "<") - 1));
629 629
         } else {
630 630
             $address = trim($addr);
631 631
         }
@@ -646,11 +646,11 @@  discard block
 block discarded – undo
646 646
         $r = $this->db->query($q);
647 647
         $a = $this->db->fetchByAssoc($r);
648 648
 
649
-        if(!empty($a) && !empty($a['id'])) {
649
+        if (!empty($a) && !empty($a['id'])) {
650 650
             return $a['id'];
651 651
         } else {
652 652
             $guid = '';
653
-            if(!empty($address)){
653
+            if (!empty($address)) {
654 654
                 $guid = create_guid();
655 655
                 $now = TimeDate::getInstance()->nowDb();
656 656
                 $qa = "INSERT INTO email_addresses (id, email_address, email_address_caps, date_created, date_modified, deleted)
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
      *        to propagate to the new SugarEmailAddress - see bug 39188
673 673
      * @return String GUID of Email Address or '' if cleaned address was empty.
674 674
      */
675
-    public function AddUpdateEmailAddress($addr,$invalid=0,$opt_out=0,$id=null)
675
+    public function AddUpdateEmailAddress($addr, $invalid = 0, $opt_out = 0, $id = null)
676 676
     {
677 677
         // sanity checks to avoid SQL injection.
678 678
         $invalid = intval($invalid);
@@ -722,12 +722,12 @@  discard block
 block discarded – undo
722 722
             if ($duplicate_email['invalid_email'] != $new_invalid ||
723 723
                 $duplicate_email['opt_out'] != $new_opt_out ||
724 724
                 (trim($duplicate_email['email_address']) != $address)) {
725
-                $upd_q = 'UPDATE ' . $this->table_name . ' ' .
726
-                    'SET email_address=\'' . $address . '\', ' .
727
-                    'invalid_email=' . $new_invalid . ', ' .
728
-                    'opt_out=' . $new_opt_out . ', ' .
729
-                    'date_modified=' . $this->db->now() . ' ' .
730
-                    'WHERE id=\'' . $this->db->quote($duplicate_email['id']) . '\'';
725
+                $upd_q = 'UPDATE '.$this->table_name.' '.
726
+                    'SET email_address=\''.$address.'\', '.
727
+                    'invalid_email='.$new_invalid.', '.
728
+                    'opt_out='.$new_opt_out.', '.
729
+                    'date_modified='.$this->db->now().' '.
730
+                    'WHERE id=\''.$this->db->quote($duplicate_email['id']).'\'';
731 731
                 $upd_r = $this->db->query($upd_q);
732 732
             }
733 733
             return $duplicate_email['id'];
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
         else {
736 736
             // no case-insensitive address match - it's new, or undeleted.
737 737
             $guid = '';
738
-            if(!empty($address)){
738
+            if (!empty($address)) {
739 739
                 $guid = create_guid();
740 740
                 $now = TimeDate::getInstance()->nowDb();
741 741
                 $qa = "INSERT INTO email_addresses (id, email_address, email_address_caps, date_created, date_modified, deleted, invalid_email, opt_out)
@@ -751,12 +751,12 @@  discard block
 block discarded – undo
751 751
      * @param object $focus Object in focus
752 752
      * @return string email
753 753
      */
754
-    function getPrimaryAddress($focus,$parent_id=null,$parent_type=null) {
754
+    function getPrimaryAddress($focus, $parent_id = null, $parent_type = null) {
755 755
 
756
-        $parent_type=empty($parent_type) ? $focus->module_dir : $parent_type;
756
+        $parent_type = empty($parent_type) ? $focus->module_dir : $parent_type;
757 757
         // Bug63174: Email address is not shown in the list view for employees
758 758
         $parent_type = $this->getCorrectedModule($parent_type);
759
-        $parent_id=empty($parent_id) ? $focus->id : $parent_id;
759
+        $parent_id = empty($parent_id) ? $focus->id : $parent_id;
760 760
 
761 761
         $q = "SELECT ea.email_address FROM email_addresses ea
762 762
                 LEFT JOIN email_addr_bean_rel ear ON ea.id = ear.email_address_id
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
         $r = $this->db->limitQuery($q, 0, 1);
769 769
         $a = $this->db->fetchByAssoc($r);
770 770
 
771
-        if(isset($a['email_address'])) {
771
+        if (isset($a['email_address'])) {
772 772
             return $a['email_address'];
773 773
         }
774 774
         return '';
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
         $r = $this->db->query($q);
810 810
         $a = $this->db->fetchByAssoc($r);
811 811
 
812
-        if(isset($a['email_address'])) {
812
+        if (isset($a['email_address'])) {
813 813
             return $a['email_address'];
814 814
         }
815 815
         return '';
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
                 ORDER BY ear.reply_to_address, ear.primary_address DESC";
835 835
         $r = $this->db->query($q);
836 836
 
837
-        while($a = $this->db->fetchByAssoc($r, FALSE)) {
837
+        while ($a = $this->db->fetchByAssoc($r, FALSE)) {
838 838
             $return[] = $a;
839 839
         }
840 840
 
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
      * @param bool asMetadata Default false
849 849
      * @return string HTML/JS for widget
850 850
      */
851
-    function getEmailAddressWidgetEditView($id, $module, $asMetadata=false, $tpl='',$tabindex='0')
851
+    function getEmailAddressWidgetEditView($id, $module, $asMetadata = false, $tpl = '', $tabindex = '0')
852 852
     {
853
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
853
+        if (!($this->smarty instanceOf Sugar_Smarty))
854 854
             $this->smarty = new Sugar_Smarty();
855 855
 
856 856
         global $app_strings, $dictionary, $beanList;
@@ -861,33 +861,33 @@  discard block
 block discarded – undo
861 861
         $passedModule = $module;
862 862
         $module = $this->getCorrectedModule($module);
863 863
         $saveModule = $module;
864
-        if(isset($_POST['is_converted']) && $_POST['is_converted']==true){
865
-            $id=$_POST['return_id'];
866
-            $module=$_POST['return_module'];
864
+        if (isset($_POST['is_converted']) && $_POST['is_converted'] == true) {
865
+            $id = $_POST['return_id'];
866
+            $module = $_POST['return_module'];
867 867
         }
868 868
         $prefillDataArr = array();
869
-        if(!empty($id)) {
869
+        if (!empty($id)) {
870 870
             $prefillDataArr = $this->getAddressesByGUID($id, $module);
871 871
             //When coming from convert leads, sometimes module is Contacts while the id is for a lead.
872 872
             if (empty($prefillDataArr) && $module == "Contacts")
873 873
                 $prefillDataArr = $this->getAddressesByGUID($id, "Leads");
874
-        } else if(isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])){
875
-            $widget_id = isset($_REQUEST[$module . '_email_widget_id']) ? $_REQUEST[$module . '_email_widget_id'] : '0';
874
+        } else if (isset($_REQUEST['full_form']) && !empty($_REQUEST['emailAddressWidget'])) {
875
+            $widget_id = isset($_REQUEST[$module.'_email_widget_id']) ? $_REQUEST[$module.'_email_widget_id'] : '0';
876 876
             $count = 0;
877
-            $key = $module . $widget_id . 'emailAddress'.$count;
878
-            while(isset($_REQUEST[$key])) {
877
+            $key = $module.$widget_id.'emailAddress'.$count;
878
+            while (isset($_REQUEST[$key])) {
879 879
                    $email = $_REQUEST[$key];
880
-                   $prefillDataArr[] =  array('email_address'=>$email,
880
+                   $prefillDataArr[] = array('email_address'=>$email,
881 881
                                              'primary_address'=>isset($_REQUEST['emailAddressPrimaryFlag']) && $_REQUEST['emailAddressPrimaryFlag'] == $key,
882 882
                                              'invalid_email'=>isset($_REQUEST['emailAddressInvalidFlag']) && in_array($key, $_REQUEST['emailAddressInvalidFlag']),
883 883
                                              'opt_out'=>isset($_REQUEST['emailAddressOptOutFlag']) && in_array($key, $_REQUEST['emailAddressOptOutFlag']),
884 884
                                              'reply_to_address'=>false
885 885
                                         );
886
-                   $key = $module . $widget_id . 'emailAddress' . ++$count;
886
+                   $key = $module.$widget_id.'emailAddress'.++$count;
887 887
             } //while
888 888
         }
889 889
 
890
-        if(!empty($prefillDataArr)) {
890
+        if (!empty($prefillDataArr)) {
891 891
             $json = new JSON(JSON_LOOSE_TYPE);
892 892
             $prefillData = $json->encode($prefillDataArr);
893 893
             $prefill = !empty($prefillDataArr) ? 'true' : 'false';
@@ -910,23 +910,23 @@  discard block
 block discarded – undo
910 910
         $form = $this->view;
911 911
 
912 912
         //determine if this should be a quickcreate form, or a quick create form under subpanels
913
-        if ($this->view == "QuickCreate"){
913
+        if ($this->view == "QuickCreate") {
914 914
             // Fixed #1120 - fixed email validation for: Accounts -> Contacts subpanel -> Select -> Create Contact -> Save.
915 915
             // If email is required it should highlight this field and show an error message.
916 916
             // It didnt because the the form was named form_DCSubpanelQuickCreate_Contacts instead of expected form_SubpanelQuickCreate_Contacts
917
-            if($this->object_name = 'EmailAddress' && $saveModule == 'Contacts') {
918
-                $form = 'form_'.$this->view .'_'.$module;
917
+            if ($this->object_name = 'EmailAddress' && $saveModule == 'Contacts') {
918
+                $form = 'form_'.$this->view.'_'.$module;
919 919
             } else {
920
-                $form = 'form_DC'.$this->view .'_'.$module;
920
+                $form = 'form_DC'.$this->view.'_'.$module;
921 921
             }
922
-            if(isset($_REQUEST['action']) && $_REQUEST['action']=='SubpanelCreates' ||  $_REQUEST['action']=='SubpanelEdits'){
923
-                $form = 'form_Subpanel'.$this->view .'_'.$module;
922
+            if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'SubpanelCreates' || $_REQUEST['action'] == 'SubpanelEdits') {
923
+                $form = 'form_Subpanel'.$this->view.'_'.$module;
924 924
             }
925 925
         }
926 926
 
927 927
         $this->smarty->assign('emailView', $form);
928 928
 
929
-        if($module == 'Users') {
929
+        if ($module == 'Users') {
930 930
             $this->smarty->assign('useReplyTo', true);
931 931
         } else {
932 932
             $this->smarty->assign('useOptOut', true);
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
         $newEmail = $this->smarty->fetch($template);
938 938
 
939 939
 
940
-        if($asMetadata) {
940
+        if ($asMetadata) {
941 941
             // used by Email 2.0
942 942
             $ret = array();
943 943
             $ret['prefillData'] = $prefillDataArr;
@@ -955,18 +955,18 @@  discard block
 block discarded – undo
955 955
      * @param object $focus Bean in focus
956 956
      * @return string HTML/JS for widget
957 957
      */
958
-    function getEmailAddressWidgetDetailView($focus, $tpl='')
958
+    function getEmailAddressWidgetDetailView($focus, $tpl = '')
959 959
     {
960
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
960
+        if (!($this->smarty instanceOf Sugar_Smarty))
961 961
             $this->smarty = new Sugar_Smarty();
962 962
 
963 963
         global $app_strings;
964 964
         global $current_user;
965 965
         $assign = array();
966
-        if(empty($focus->id))return '';
966
+        if (empty($focus->id))return '';
967 967
         $prefillData = $this->getAddressesByGUID($focus->id, $focus->module_dir);
968 968
 
969
-        foreach($prefillData as $addressItem) {
969
+        foreach ($prefillData as $addressItem) {
970 970
             $key = ($addressItem['primary_address'] == 1) ? 'primary' : "";
971 971
             $key = ($addressItem['reply_to_address'] == 1) ? 'reply_to' : $key;
972 972
             $key = ($addressItem['opt_out'] == 1) ? 'opt_out' : $key;
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
      */
993 993
     function getEmailAddressWidgetDuplicatesView($focus)
994 994
     {
995
-        if ( !($this->smarty instanceOf Sugar_Smarty ) )
995
+        if (!($this->smarty instanceOf Sugar_Smarty))
996 996
             $this->smarty = new Sugar_Smarty();
997 997
 
998 998
         $count = 0;
@@ -1002,49 +1002,49 @@  discard block
 block discarded – undo
1002 1002
         $invalid = array();
1003 1003
         $mod = isset($focus) ? $focus->module_dir : "";
1004 1004
 
1005
-        $widget_id = $_POST[$mod .'_email_widget_id'];
1006
-        $this->smarty->assign('email_widget_id',$widget_id);
1007
-        $this->smarty->assign('emailAddressWidget',$_POST['emailAddressWidget']);
1005
+        $widget_id = $_POST[$mod.'_email_widget_id'];
1006
+        $this->smarty->assign('email_widget_id', $widget_id);
1007
+        $this->smarty->assign('emailAddressWidget', $_POST['emailAddressWidget']);
1008 1008
 
1009
-        if(isset($_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'])) {
1010
-           $primary = $_POST[$mod . $widget_id . 'emailAddressPrimaryFlag'];
1009
+        if (isset($_POST[$mod.$widget_id.'emailAddressPrimaryFlag'])) {
1010
+           $primary = $_POST[$mod.$widget_id.'emailAddressPrimaryFlag'];
1011 1011
         }
1012 1012
 
1013
-        while(isset($_POST[$mod . $widget_id . "emailAddress" . $count])) {
1014
-            $emails[] = $_POST[$mod . $widget_id . 'emailAddress' . $count];
1013
+        while (isset($_POST[$mod.$widget_id."emailAddress".$count])) {
1014
+            $emails[] = $_POST[$mod.$widget_id.'emailAddress'.$count];
1015 1015
             $count++;
1016 1016
         }
1017 1017
 
1018
-        if($count == 0) {
1018
+        if ($count == 0) {
1019 1019
            return "";
1020 1020
         }
1021 1021
 
1022
-        if(isset($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'])) {
1023
-           foreach($_POST[$mod . $widget_id . 'emailAddressOptOutFlag'] as $v) {
1022
+        if (isset($_POST[$mod.$widget_id.'emailAddressOptOutFlag'])) {
1023
+           foreach ($_POST[$mod.$widget_id.'emailAddressOptOutFlag'] as $v) {
1024 1024
               $optOut[] = $v;
1025 1025
            }
1026 1026
         }
1027 1027
 
1028
-        if(isset($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'])) {
1029
-           foreach($_POST[$mod . $widget_id . 'emailAddressInvalidFlag'] as $v) {
1028
+        if (isset($_POST[$mod.$widget_id.'emailAddressInvalidFlag'])) {
1029
+           foreach ($_POST[$mod.$widget_id.'emailAddressInvalidFlag'] as $v) {
1030 1030
               $invalid[] = $v;
1031 1031
            }
1032 1032
         }
1033 1033
 
1034
-        if(isset($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'])) {
1035
-           foreach($_POST[$mod . $widget_id . 'emailAddressReplyToFlag'] as $v) {
1034
+        if (isset($_POST[$mod.$widget_id.'emailAddressReplyToFlag'])) {
1035
+           foreach ($_POST[$mod.$widget_id.'emailAddressReplyToFlag'] as $v) {
1036 1036
               $replyTo[] = $v;
1037 1037
            }
1038 1038
         }
1039 1039
 
1040
-        if(isset($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'])) {
1041
-           foreach($_POST[$mod . $widget_id . 'emailAddressDeleteFlag'] as $v) {
1040
+        if (isset($_POST[$mod.$widget_id.'emailAddressDeleteFlag'])) {
1041
+           foreach ($_POST[$mod.$widget_id.'emailAddressDeleteFlag'] as $v) {
1042 1042
               $delete[] = $v;
1043 1043
            }
1044 1044
         }
1045 1045
 
1046
-        while(isset($_POST[$mod . $widget_id . "emailAddressVerifiedValue" . $count])) {
1047
-            $verified[] = $_POST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count];
1046
+        while (isset($_POST[$mod.$widget_id."emailAddressVerifiedValue".$count])) {
1047
+            $verified[] = $_POST[$mod.$widget_id.'emailAddressVerifiedValue'.$count];
1048 1048
             $count++;
1049 1049
         }
1050 1050
 
@@ -1069,33 +1069,33 @@  discard block
 block discarded – undo
1069 1069
         $count = 0;
1070 1070
         $mod = isset($focus) ? $focus->module_dir : "";
1071 1071
 
1072
-        $widget_id = $_POST[$mod .'_email_widget_id'];
1073
-        $get .= '&' . $mod . '_email_widget_id='. $widget_id;
1072
+        $widget_id = $_POST[$mod.'_email_widget_id'];
1073
+        $get .= '&'.$mod.'_email_widget_id='.$widget_id;
1074 1074
         $get .= '&emailAddressWidget='.$_POST['emailAddressWidget'];
1075 1075
 
1076
-        while(isset($_REQUEST[$mod . $widget_id . 'emailAddress' . $count])) {
1077
-              $get .= "&" . $mod . $widget_id . "emailAddress" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddress' . $count]);
1076
+        while (isset($_REQUEST[$mod.$widget_id.'emailAddress'.$count])) {
1077
+              $get .= "&".$mod.$widget_id."emailAddress".$count."=".urlencode($_REQUEST[$mod.$widget_id.'emailAddress'.$count]);
1078 1078
               $count++;
1079 1079
         } //while
1080 1080
 
1081
-        while(isset($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count])) {
1082
-              $get .= "&" . $mod . $widget_id . "emailAddressVerifiedValue" . $count . "=" . urlencode($_REQUEST[$mod . $widget_id . 'emailAddressVerifiedValue' . $count]);
1081
+        while (isset($_REQUEST[$mod.$widget_id.'emailAddressVerifiedValue'.$count])) {
1082
+              $get .= "&".$mod.$widget_id."emailAddressVerifiedValue".$count."=".urlencode($_REQUEST[$mod.$widget_id.'emailAddressVerifiedValue'.$count]);
1083 1083
               $count++;
1084 1084
         } //while
1085 1085
 
1086 1086
         $options = array('emailAddressPrimaryFlag', 'emailAddressOptOutFlag', 'emailAddressInvalidFlag', 'emailAddressDeleteFlag', 'emailAddressReplyToFlag');
1087 1087
 
1088
-        foreach($options as $option) {
1088
+        foreach ($options as $option) {
1089 1089
             $count = 0;
1090 1090
             $optionIdentifier = $mod.$widget_id.$option;
1091
-            if(isset($_REQUEST[$optionIdentifier])) {
1092
-               if(is_array($_REQUEST[$optionIdentifier])) {
1093
-                   foreach($_REQUEST[$optionIdentifier] as $optOut) {
1094
-                      $get .= "&" . $optionIdentifier . "[" . $count . "]=" . $optOut;
1091
+            if (isset($_REQUEST[$optionIdentifier])) {
1092
+               if (is_array($_REQUEST[$optionIdentifier])) {
1093
+                   foreach ($_REQUEST[$optionIdentifier] as $optOut) {
1094
+                      $get .= "&".$optionIdentifier."[".$count."]=".$optOut;
1095 1095
                       $count++;
1096 1096
                    } //foreach
1097 1097
                } else {
1098
-                   $get .= "&" . $optionIdentifier . "=" . $_REQUEST[$optionIdentifier];
1098
+                   $get .= "&".$optionIdentifier."=".$_REQUEST[$optionIdentifier];
1099 1099
                }
1100 1100
             } //if
1101 1101
         } //foreach
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
  * @return string The value for the bean_module column in the email_addr_bean_rel table
1114 1114
  */
1115 1115
     function getCorrectedModule(&$module) {
1116
-        return ($module == "Employees")? "Users" : $module;
1116
+        return ($module == "Employees") ? "Users" : $module;
1117 1117
     }
1118 1118
 
1119 1119
     public function stash($parentBeanId, $moduleName)
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
         $ids = array();
1124 1124
         while ($row = $this->db->fetchByAssoc($result, false))
1125 1125
         {
1126
-            $ids[] =$this->db->quote($row['email_address_id']); // avoid 2nd order SQL Injection
1126
+            $ids[] = $this->db->quote($row['email_address_id']); // avoid 2nd order SQL Injection
1127 1127
         }
1128 1128
         if (!empty($ids))
1129 1129
         {
@@ -1147,15 +1147,15 @@  discard block
 block discarded – undo
1147 1147
  * @param string $view DetailView or EditView
1148 1148
  * @return string
1149 1149
  */
1150
-function getEmailAddressWidget($focus, $field, $value, $view, $tabindex='0') {
1150
+function getEmailAddressWidget($focus, $field, $value, $view, $tabindex = '0') {
1151 1151
     $sea = new SugarEmailAddress();
1152 1152
     $sea->setView($view);
1153 1153
 
1154
-        if($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
1154
+        if ($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
1155 1155
             $module = $focus->module_dir;
1156 1156
             if ($view == 'ConvertLead' && $module == "Contacts")  $module = "Leads";
1157 1157
 
1158
-            return $sea->getEmailAddressWidgetEditView($focus->id, $module, false,'',$tabindex);
1158
+            return $sea->getEmailAddressWidgetEditView($focus->id, $module, false, '', $tabindex);
1159 1159
         }
1160 1160
 
1161 1161
     return $sea->getEmailAddressWidgetDetailView($focus);
Please login to merge, or discard this patch.
include/SugarOauth.php 3 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -145,34 +145,34 @@  discard block
 block discarded – undo
145 145
          * @return array
146 146
          */
147 147
         public function getAccessToken($url,
148
-                                       Zend_Oauth_Token_Request $token = null,
149
-                                       $httpMethod = null,
150
-                                       Zend_Oauth_Http_AccessToken $request = null)
148
+                                        Zend_Oauth_Token_Request $token = null,
149
+                                        $httpMethod = null,
150
+                                        Zend_Oauth_Http_AccessToken $request = null)
151 151
         {
152 152
             $this->setAccessTokenUrl($url);
153 153
             $this->_last = $token = parent::getAccessToken($_REQUEST, $this->makeRequestToken());
154 154
             return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret());
155 155
         }
156 156
 
157
-       /**
158
-        * Fetch URL with OAuth
159
-        * @param string $url
160
-        * @param string $params Query params
161
-        * @param string $method HTTP method
162
-        * @param array $headers HTTP headers
163
-        * @return string
164
-        */
157
+        /**
158
+         * Fetch URL with OAuth
159
+         * @param string $url
160
+         * @param string $params Query params
161
+         * @param string $method HTTP method
162
+         * @param array $headers HTTP headers
163
+         * @return string
164
+         */
165 165
         
166 166
         public function fetch($url, $params = null, $method = 'GET', $headers = null)
167 167
         {
168 168
             $acc = $this->makeAccessToken();
169 169
             if ( strpos($url,'?') ) {
170
-               list($clean_url, $query) = explode('?', $url);
171
-               if($query) {
172
-                   $url = $clean_url;
173
-                   parse_str($query, $query_params);
174
-                   $params = array_merge($params?$params:array(), $query_params);
175
-               }
170
+                list($clean_url, $query) = explode('?', $url);
171
+                if($query) {
172
+                    $url = $clean_url;
173
+                    parse_str($query, $query_params);
174
+                    $params = array_merge($params?$params:array(), $query_params);
175
+                }
176 176
             }
177 177
             $client = $acc->getHttpClient($this->_oauth_config, $url);
178 178
             
@@ -212,33 +212,33 @@  discard block
 block discarded – undo
212 212
             $this->_last = $resp = $client->request();
213 213
             $this->_lastReq = $client->getLastRequest();
214 214
             return $resp->getBody();
215
-       }
215
+        }
216 216
 
217
-       /**
218
-        * Get HTTP client
219
-        * @return Zend_Oauth_Client
220
-        */
221
-       public function getClient()
222
-       {
217
+        /**
218
+         * Get HTTP client
219
+         * @return Zend_Oauth_Client
220
+         */
221
+        public function getClient()
222
+        {
223 223
             $acc = $this->makeAccessToken();
224 224
             return $acc->getHttpClient($this->_oauth_config);
225
-       }
225
+        }
226 226
 
227
-       /**
228
-        * Get last response
229
-        * @return string
230
-        */
231
-       public function getLastResponse()
232
-       {
227
+        /**
228
+         * Get last response
229
+         * @return string
230
+         */
231
+        public function getLastResponse()
232
+        {
233 233
             return $this->_last;
234
-       }
234
+        }
235 235
 
236
-       /**
237
-        * Get last request
238
-        * @return string
239
-        */
240
-       public function getLastRequest()
241
-       {
236
+        /**
237
+         * Get last request
238
+         * @return string
239
+         */
240
+        public function getLastRequest()
241
+        {
242 242
             return $this->_lastReq;
243
-       }
243
+        }
244 244
     }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
          * @param string $consumer_secret
56 56
          * @param array $params OAuth options
57 57
          */
58
-        public function __construct($consumer_key , $consumer_secret, $params = null)
58
+        public function __construct($consumer_key, $consumer_secret, $params = null)
59 59
         {
60 60
             $this->_oauth_config = array(
61 61
                 'consumerKey' => $consumer_key,
62 62
                 'consumerSecret' => $consumer_secret,
63 63
             );
64
-            if(!empty($params)) {
64
+            if (!empty($params)) {
65 65
                 $this->_oauth_config = array_merge($this->_oauth_config, $params);
66 66
             }
67 67
             parent::__construct($this->_oauth_config);
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
          */
121 121
         public function getRequestTokenByUrl($url, $callback = null, $params = array())
122 122
         {
123
-            if(!empty($callback)) {
123
+            if (!empty($callback)) {
124 124
                 $this->setCallbackUrl($callback);
125 125
             }
126 126
             list($clean_url, $query) = explode('?', $url);
127
-            if($query) {
127
+            if ($query) {
128 128
                 $url = $clean_url;
129 129
                 parse_str($query, $query_params);
130 130
                 $params = array_merge($params, $query_params);
131 131
             }
132 132
             $this->setRequestTokenUrl($url);
133
-            try{
133
+            try {
134 134
                 $this->_last = $token = parent::getRequestToken($params);
135 135
                 return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret());
136
-            }catch(Zend_Oauth_Exception $e){
136
+            }catch (Zend_Oauth_Exception $e) {
137 137
                 return array('oauth_token' => '', 'oauth_token_secret' => '');
138 138
             }
139 139
         }
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
         public function fetch($url, $params = null, $method = 'GET', $headers = null)
167 167
         {
168 168
             $acc = $this->makeAccessToken();
169
-            if ( strpos($url,'?') ) {
169
+            if (strpos($url, '?')) {
170 170
                list($clean_url, $query) = explode('?', $url);
171
-               if($query) {
171
+               if ($query) {
172 172
                    $url = $clean_url;
173 173
                    parse_str($query, $query_params);
174
-                   $params = array_merge($params?$params:array(), $query_params);
174
+                   $params = array_merge($params ? $params : array(), $query_params);
175 175
                }
176 176
             }
177 177
             $client = $acc->getHttpClient($this->_oauth_config, $url);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             $proxy_config = SugarModule::get('Administration')->loadBean();
181 181
             $proxy_config->retrieveSettings('proxy');
182 182
             
183
-            if( !empty($proxy_config) && 
183
+            if (!empty($proxy_config) && 
184 184
                 !empty($proxy_config->settings['proxy_on']) &&
185 185
                 $proxy_config->settings['proxy_on'] == 1) {
186 186
                 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 $proxy_settings['proxy_host'] = $proxy_config->settings['proxy_host'];
189 189
                 $proxy_settings['proxy_port'] = $proxy_config->settings['proxy_port'];
190 190
     
191
-                if(!empty($proxy_config->settings['proxy_auth'])){
191
+                if (!empty($proxy_config->settings['proxy_auth'])) {
192 192
                     $proxy_settings['proxy_user'] = $proxy_config->settings['proxy_username'];
193 193
                     $proxy_settings['proxy_pass'] = $proxy_config->settings['proxy_password'];
194 194
                 }
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
             }
200 200
             
201 201
             $client->setMethod($method);
202
-            if(!empty($headers)) {
202
+            if (!empty($headers)) {
203 203
                 $client->setHeaders($headers);
204 204
             }
205
-            if(!empty($params)) {
206
-                if($method == 'GET') {
205
+            if (!empty($params)) {
206
+                if ($method == 'GET') {
207 207
                     $client->setParameterGet($params);
208 208
                 } else {
209 209
                     $client->setParameterPost($params);
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
             try{
134 134
                 $this->_last = $token = parent::getRequestToken($params);
135 135
                 return array('oauth_token' => $token->getToken(), 'oauth_token_secret' => $token->getTokenSecret());
136
-            }catch(Zend_Oauth_Exception $e){
136
+            } catch(Zend_Oauth_Exception $e){
137 137
                 return array('oauth_token' => '', 'oauth_token_secret' => '');
138 138
             }
139 139
         }
Please login to merge, or discard this patch.