Passed
Push — scrutinizer-code-quality ( eedb15...27193c )
by Adam
54:15 queued 15s
created
include/MVC/Controller/file_access_control_map.php 3 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -46,29 +46,29 @@
 block discarded – undo
46 46
  * Contributor(s): ______________________________________..
47 47
  ********************************************************************************/
48 48
 $file_access_control_map = array(
49
-	'modules' => array(
50
-		'administration' => array(
51
-			'actions' => array(
52
-				'backups',
53
-				'updater',
54
-			),
55
-			'links'	=> array(
56
-				'update',
57
-				'backup_management',
58
-				'upgrade_wizard',
59
-				'moduleBuilder',
60
-			),
61
-		),
62
-		'upgradewizard' => array(
63
-				'actions' => array(
64
-					'index',
65
-				),
66
-		),
67
-		'modulebuilder' => array(
68
-				'actions' => array(
69
-					'index' => array('params' => array('type' => array('mb'))),
70
-				),
71
-		),
72
-	)
49
+    'modules' => array(
50
+        'administration' => array(
51
+            'actions' => array(
52
+                'backups',
53
+                'updater',
54
+            ),
55
+            'links'	=> array(
56
+                'update',
57
+                'backup_management',
58
+                'upgrade_wizard',
59
+                'moduleBuilder',
60
+            ),
61
+        ),
62
+        'upgradewizard' => array(
63
+                'actions' => array(
64
+                    'index',
65
+                ),
66
+        ),
67
+        'modulebuilder' => array(
68
+                'actions' => array(
69
+                    'index' => array('params' => array('type' => array('mb'))),
70
+                ),
71
+        ),
72
+    )
73 73
 );
74 74
 ?>
75 75
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 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.
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
include/javascript/getYUIComboFile.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 
43 43
 $yui_path = array(
44 44
     "2.9.0" => "include/javascript/yui",
45
-	"2_9_0" => "include/javascript/yui",
46
-	"3.3.0" => "include/javascript/yui3",
47
-	"3_3_0" => "include/javascript/yui3"
45
+    "2_9_0" => "include/javascript/yui",
46
+    "3.3.0" => "include/javascript/yui3",
47
+    "3_3_0" => "include/javascript/yui3"
48 48
 );
49 49
 $types = array(
50 50
     "js" => "application/javascript",
51
-	"css" => "text/css",
51
+    "css" => "text/css",
52 52
 );
53 53
 $out = "";
54 54
 
@@ -57,36 +57,36 @@  discard block
 block discarded – undo
57 57
 
58 58
 foreach ($_REQUEST as $param => $val)
59 59
 {
60
-	//No backtracking in the path
61
-	if (strpos($param, "..") !== false)
60
+    //No backtracking in the path
61
+    if (strpos($param, "..") !== false)
62 62
         continue;
63 63
 
64
-	$version = explode("/", $param);
65
-	$version = $version[0];
64
+    $version = explode("/", $param);
65
+    $version = $version[0];
66 66
     if (empty($yui_path[$version])) continue;
67 67
 
68 68
     $path = $yui_path[$version] . substr($param, strlen($version));
69 69
 
70
-	$extension = substr($path, strrpos($path, "_") + 1);
70
+    $extension = substr($path, strrpos($path, "_") + 1);
71 71
 
72
-	//Only allowed file extensions
73
-	if (empty($types[$extension]))
74
-	   continue;
72
+    //Only allowed file extensions
73
+    if (empty($types[$extension]))
74
+        continue;
75 75
 
76
-	if (empty($contentType))
76
+    if (empty($contentType))
77 77
     {
78 78
         $contentType = $types[$extension];
79 79
     }
80
-	//Put together the final filepath
81
-	$path = substr($path, 0, strrpos($path, "_")) . "." . $extension;
82
-	$contents = '';
83
-	if (is_file($path)) {
84
-	   $out .= "/*" . $path . "*/\n";
85
-	   $contents =  file_get_contents($path);
86
-	   $out .= $contents . "\n";
87
-	}
88
-	$path = empty($contents) ? $path : $contents;
89
-	$allpath .= md5($path);
80
+    //Put together the final filepath
81
+    $path = substr($path, 0, strrpos($path, "_")) . "." . $extension;
82
+    $contents = '';
83
+    if (is_file($path)) {
84
+        $out .= "/*" . $path . "*/\n";
85
+        $contents =  file_get_contents($path);
86
+        $out .= $contents . "\n";
87
+    }
88
+    $path = empty($contents) ? $path : $contents;
89
+    $allpath .= md5($path);
90 90
 }
91 91
 
92 92
 $etag = '"'.md5($allpath).'"';
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 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.
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	$version = $version[0];
66 66
     if (empty($yui_path[$version])) continue;
67 67
 
68
-    $path = $yui_path[$version] . substr($param, strlen($version));
68
+    $path = $yui_path[$version].substr($param, strlen($version));
69 69
 
70 70
 	$extension = substr($path, strrpos($path, "_") + 1);
71 71
 
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
         $contentType = $types[$extension];
79 79
     }
80 80
 	//Put together the final filepath
81
-	$path = substr($path, 0, strrpos($path, "_")) . "." . $extension;
81
+	$path = substr($path, 0, strrpos($path, "_")).".".$extension;
82 82
 	$contents = '';
83 83
 	if (is_file($path)) {
84
-	   $out .= "/*" . $path . "*/\n";
85
-	   $contents =  file_get_contents($path);
86
-	   $out .= $contents . "\n";
84
+	   $out .= "/*".$path."*/\n";
85
+	   $contents = file_get_contents($path);
86
+	   $out .= $contents."\n";
87 87
 	}
88 88
 	$path = empty($contents) ? $path : $contents;
89 89
 	$allpath .= md5($path);
@@ -95,6 +95,6 @@  discard block
 block discarded – undo
95 95
 header("Cache-Control: private");
96 96
 header("Pragma: dummy=bogus");
97 97
 header("Etag: $etag");
98
-header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000));
98
+header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 2592000));
99 99
 header("Content-Type: $contentType");
100 100
 echo ($out);
101 101
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -38,7 +40,9 @@  discard block
 block discarded – undo
38 40
  * display the words  "Powered by SugarCRM" and "Supercharged by SuiteCRM".
39 41
  ********************************************************************************/
40 42
 
41
-if (empty($_REQUEST)) die();
43
+if (empty($_REQUEST)) {
44
+    die();
45
+}
42 46
 
43 47
 $yui_path = array(
44 48
     "2.9.0" => "include/javascript/yui",
@@ -58,20 +62,24 @@  discard block
 block discarded – undo
58 62
 foreach ($_REQUEST as $param => $val)
59 63
 {
60 64
 	//No backtracking in the path
61
-	if (strpos($param, "..") !== false)
62
-        continue;
65
+	if (strpos($param, "..") !== false) {
66
+	        continue;
67
+	}
63 68
 
64 69
 	$version = explode("/", $param);
65 70
 	$version = $version[0];
66
-    if (empty($yui_path[$version])) continue;
71
+    if (empty($yui_path[$version])) {
72
+        continue;
73
+    }
67 74
 
68 75
     $path = $yui_path[$version] . substr($param, strlen($version));
69 76
 
70 77
 	$extension = substr($path, strrpos($path, "_") + 1);
71 78
 
72 79
 	//Only allowed file extensions
73
-	if (empty($types[$extension]))
74
-	   continue;
80
+	if (empty($types[$extension])) {
81
+		   continue;
82
+	}
75 83
 
76 84
 	if (empty($contentType))
77 85
     {
Please login to merge, or discard this patch.
include/Dashlets/DashletGenericChart.php 4 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function setRefreshIcon()
141 141
     {
142
-    	$additionalTitle = '';
142
+        $additionalTitle = '';
143 143
         if($this->isRefreshable)
144 144
 
145 145
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     public function displayScript()
166 166
     {
167 167
 
168
-		require_once('include/SugarCharts/SugarChartFactory.php');
169
-		$sugarChart = SugarChartFactory::getInstance();
170
-		return $sugarChart->getDashletScript($this->id);
168
+        require_once('include/SugarCharts/SugarChartFactory.php');
169
+        $sugarChart = SugarChartFactory::getInstance();
170
+        return $sugarChart->getDashletScript($this->id);
171 171
 
172 172
     }
173 173
 
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
         $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown);
273 273
         
274 274
         if($this->isAutoRefreshable()) {
275
-       		$this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276
-			$this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277
-			$this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278
-			$this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279
-		}
275
+                $this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276
+            $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277
+            $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278
+            $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279
+        }
280 280
 
281 281
         return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
282 282
     }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             $dashletOffset = 0;
340 340
             $module = $_REQUEST['module'];
341 341
             if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
342
-            	$dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
342
+                $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
343 343
             }
344 344
         }
345 345
 
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 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.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @see Dashlet::$isRefreshable
61 61
      */
62
-    public $isRefreshable  = true;
62
+    public $isRefreshable = true;
63 63
 
64 64
     /**
65 65
      * location of smarty template file for configuring
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
     {
106 106
         parent::Dashlet($id);
107 107
 
108
-        if ( isset($options) ) {
109
-            foreach ( $options as $key => $value ) {
108
+        if (isset($options)) {
109
+            foreach ($options as $key => $value) {
110 110
                 $this->$key = $value;
111 111
             }
112 112
         }
113 113
 
114 114
         // load searchfields
115 115
         $classname = get_class($this);
116
-        if ( is_file("modules/Charts/Dashlets/$classname/$classname.data.php") ) {
116
+        if (is_file("modules/Charts/Dashlets/$classname/$classname.data.php")) {
117 117
             require("modules/Charts/Dashlets/$classname/$classname.data.php");
118 118
             $this->_searchFields = $dashletData[$classname]['searchFields'];
119 119
         }
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
         // load language files
122 122
         $this->loadLanguage($classname, 'modules/Charts/Dashlets/');
123 123
 
124
-        if ( empty($options['title']) )
124
+        if (empty($options['title']))
125 125
             $this->title = $this->dashletStrings['LBL_TITLE'];
126
-        if ( isset($options['autoRefresh']) )
126
+        if (isset($options['autoRefresh']))
127 127
             $this->autoRefresh = $options['autoRefresh'];
128 128
 
129 129
         $this->layoutManager = new LayoutManager();
130 130
         $this->layoutManager->setAttribute('context', 'Report');
131 131
         // fake a reporter object here just to pass along the db type used in many widgets.
132 132
         // this should be taken out when sugarwidgets change
133
-        $temp = (object) array('db' => &$GLOBALS['db'], 'report_def_str' => '');
133
+        $temp = (object)array('db' => &$GLOBALS['db'], 'report_def_str' => '');
134 134
         $this->layoutManager->setAttributePtr('reporter', $temp);
135 135
     }
136 136
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
     public function setRefreshIcon()
141 141
     {
142 142
     	$additionalTitle = '';
143
-        if($this->isRefreshable)
143
+        if ($this->isRefreshable)
144 144
 
145 145
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
146 146
                 . $this->id
147 147
                 . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->'
148 148
                 . SugarThemeRegistry::current()->getImage(
149 149
                     'dashlet-header-refresh',
150
-                    'border="0" align="absmiddle" title="'. translate('LBL_DASHLET_REFRESH', 'Home') . '"',
150
+                    'border="0" align="absmiddle" title="'.translate('LBL_DASHLET_REFRESH', 'Home').'"',
151 151
                     null,
152 152
                     null,
153 153
                     '.gif',
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     protected function getConfigureSmartyInstance()
179 179
     {
180
-        if ( !($this->_configureSS instanceof Sugar_Smarty) ) {
180
+        if (!($this->_configureSS instanceof Sugar_Smarty)) {
181 181
 
182 182
             $this->_configureSS = new Sugar_Smarty();
183 183
         }
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 
201 201
         $options = array();
202 202
 
203
-        foreach($req as $name => $value)
204
-            if(!is_array($value)) $req[$name] = trim($value);
203
+        foreach ($req as $name => $value)
204
+            if (!is_array($value)) $req[$name] = trim($value);
205 205
 
206
-        foreach($this->_searchFields as $name => $params) {
206
+        foreach ($this->_searchFields as $name => $params) {
207 207
             $widgetDef = $params;
208
-            if ( isset($this->getSeedBean()->field_defs[$name]) )
208
+            if (isset($this->getSeedBean()->field_defs[$name]))
209 209
                 $widgetDef = $this->getSeedBean()->field_defs[$name];
210
-            if ( $widgetDef['type'] == 'date')           // special case date types
210
+            if ($widgetDef['type'] == 'date')           // special case date types
211 211
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
212
-            elseif ( $widgetDef['type'] == 'time')       // special case time types
212
+            elseif ($widgetDef['type'] == 'time')       // special case time types
213 213
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat);
214
-            elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types
214
+            elseif ($widgetDef['type'] == 'datepicker') // special case datepicker types
215 215
                 $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
216 216
             elseif (!empty($req[$widgetDef['name']]))
217 217
                 $options[$widgetDef['name']] = $req[$widgetDef['name']];
@@ -234,36 +234,36 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $currentSearchFields = array();
236 236
 
237
-        if ( is_array($this->_searchFields) ) {
238
-            foreach($this->_searchFields as $name=>$params) {
239
-                if(!empty($name)) {
237
+        if (is_array($this->_searchFields)) {
238
+            foreach ($this->_searchFields as $name=>$params) {
239
+                if (!empty($name)) {
240 240
                     $name = strtolower($name);
241 241
                     $currentSearchFields[$name] = array();
242 242
 
243 243
                     $widgetDef = $params;
244
-                    if ( isset($this->getSeedBean()->field_defs[$name]) )
244
+                    if (isset($this->getSeedBean()->field_defs[$name]))
245 245
                         $widgetDef = $this->getSeedBean()->field_defs[$name];
246 246
 
247
-                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
247
+                    if ($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
248 248
 
249
-                    if ( empty($widgetDef['input_name0']) )
249
+                    if (empty($widgetDef['input_name0']))
250 250
                         $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
251 251
                     $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir);
252
-                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] )
252
+                    if ($currentSearchFields[$name]['label'] == $widgetDef['vname'])
253 253
                         $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
254 254
                     $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name));
255 255
                 }
256 256
                 else { // ability to create spacers in input fields
257
-                    $currentSearchFields['blank' + $count]['label'] = '';
258
-                    $currentSearchFields['blank' + $count]['input'] = '';
257
+                    $currentSearchFields['blank' +$count]['label'] = '';
258
+                    $currentSearchFields['blank' +$count]['input'] = '';
259 259
                     $count++;
260 260
                 }
261 261
             }
262 262
         }
263 263
         $this->currentSearchFields = $currentSearchFields;
264
-        $this->getConfigureSmartyInstance()->assign('title',translate('LBL_TITLE','Charts'));
265
-        $this->getConfigureSmartyInstance()->assign('save',$GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']);
266
-        $this->getConfigureSmartyInstance()->assign('clear',$GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']);
264
+        $this->getConfigureSmartyInstance()->assign('title', translate('LBL_TITLE', 'Charts'));
265
+        $this->getConfigureSmartyInstance()->assign('save', $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']);
266
+        $this->getConfigureSmartyInstance()->assign('clear', $GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']);
267 267
         $this->getConfigureSmartyInstance()->assign('id', $this->id);
268 268
         $this->getConfigureSmartyInstance()->assign('searchFields', $this->currentSearchFields);
269 269
         $this->getConfigureSmartyInstance()->assign('dashletTitle', $this->title);
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
         $this->getConfigureSmartyInstance()->assign('module', $_REQUEST['module']);
272 272
         $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown);
273 273
         
274
-        if($this->isAutoRefreshable()) {
274
+        if ($this->isAutoRefreshable()) {
275 275
        		$this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276 276
 			$this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277 277
 			$this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278 278
 			$this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279 279
 		}
280 280
 
281
-        return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
281
+        return parent::displayOptions().$this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
282 282
     }
283 283
 
284 284
     /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     protected function getSeedBean()
291 291
     {
292
-        if ( !($this->_seedBean instanceof SugarBean) )
292
+        if (!($this->_seedBean instanceof SugarBean))
293 293
             $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
294 294
 
295 295
         return $this->_seedBean;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function display()
324 324
     {
325
-        return parent::display() . $this->processAutoRefresh();
325
+        return parent::display().$this->processAutoRefresh();
326 326
     }
327 327
 
328 328
     /**
@@ -335,28 +335,28 @@  discard block
 block discarded – undo
335 335
     {
336 336
         global $sugar_config;
337 337
 
338
-        if ( empty($dashletOffset) ) {
338
+        if (empty($dashletOffset)) {
339 339
             $dashletOffset = 0;
340 340
             $module = $_REQUEST['module'];
341
-            if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
341
+            if (isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
342 342
             	$dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
343 343
             }
344 344
         }
345 345
 
346
-        if ( !$this->isRefreshable ) {
346
+        if (!$this->isRefreshable) {
347 347
             return '';
348 348
         }
349
-        if ( !empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1 ) {
349
+        if (!empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1) {
350 350
             return '';
351 351
         }
352 352
         $autoRefreshSS = new Sugar_Smarty();
353 353
         $autoRefreshSS->assign('dashletOffset', $dashletOffset);
354 354
         $autoRefreshSS->assign('dashletId', $this->id);
355
-        $autoRefreshSS->assign('strippedDashletId', str_replace("-","",$this->id)); //javascript doesn't like "-" in function names
355
+        $autoRefreshSS->assign('strippedDashletId', str_replace("-", "", $this->id)); //javascript doesn't like "-" in function names
356 356
         $autoRefreshSS->assign('dashletRefreshInterval', $this->getAutoRefresh());
357 357
         $autoRefreshSS->assign('url', "predefined_chart");
358 358
         $tpl = 'include/Dashlets/DashletGenericAutoRefresh.tpl';
359
-        if ( $_REQUEST['action'] == "DynamicAction" ) {
359
+        if ($_REQUEST['action'] == "DynamicAction") {
360 360
             $tpl = 'include/Dashlets/DashletGenericAutoRefreshDynamic.tpl';
361 361
         }
362 362
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
         $row = $db->fetchByAssoc($result);
374 374
 
375
-        while ($row != null){
375
+        while ($row != null) {
376 376
             $dataSet[] = $row;
377 377
             $row = $db->fetchByAssoc($result);
378 378
         }
@@ -392,19 +392,19 @@  discard block
 block discarded – undo
392 392
     bool $ifsort2                 Whether to sort by the second column or just translate the second column.
393 393
      * @return        The sorted and translated data.
394 394
      */
395
-    function sortData($data_set, $keycolname1=null, $translate1=false, $keycolname2=null, $translate2=false, $ifsort2=false) {
395
+    function sortData($data_set, $keycolname1 = null, $translate1 = false, $keycolname2 = null, $translate2 = false, $ifsort2 = false) {
396 396
         //You can set whether the columns need to be translated or sorted. It the column needn't to be translated, the sorting must be done in SQL, this function will not do the sorting.
397 397
         global $app_list_strings;
398 398
         $sortby1[] = array();
399 399
         foreach ($data_set as $row) {
400
-            $sortby1[]  = $row[$keycolname1];
400
+            $sortby1[] = $row[$keycolname1];
401 401
         }
402 402
         $sortby1 = array_unique($sortby1);
403 403
         //The data is from the database, the sorting should be done in the sql. So I will not do the sort here.
404
-        if($translate1) {
404
+        if ($translate1) {
405 405
             $temp_sortby1 = array();
406
-            foreach(array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) {
407
-                if(in_array($sortby1_value, $sortby1)) {
406
+            foreach (array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) {
407
+                if (in_array($sortby1_value, $sortby1)) {
408 408
                     $temp_sortby1[] = $sortby1_value;
409 409
                 }
410 410
             }
@@ -412,21 +412,21 @@  discard block
 block discarded – undo
412 412
         }
413 413
 
414 414
         //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank.
415
-        if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank.
415
+        if (isset($sortby1[0]) && $sortby1[0] == array()) unset($sortby1[0]); //the beginning of month after search is blank.
416 416
 
417
-        if($ifsort2==false) $sortby2=array(0);
417
+        if ($ifsort2 == false) $sortby2 = array(0);
418 418
 
419
-        if($keycolname2!=null) {
419
+        if ($keycolname2 != null) {
420 420
             $sortby2 = array();
421 421
             foreach ($data_set as $row) {
422
-                $sortby2[]  = $row[$keycolname2];
422
+                $sortby2[] = $row[$keycolname2];
423 423
             }
424 424
             //The data is from the database, the sorting should be done in the sql. So I will not do the sort here.
425 425
             $sortby2 = array_unique($sortby2);
426
-            if($translate2) {
426
+            if ($translate2) {
427 427
                 $temp_sortby2 = array();
428
-                foreach(array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) {
429
-                    if(in_array($sortby2_value, $sortby2)) {
428
+                foreach (array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) {
429
+                    if (in_array($sortby2_value, $sortby2)) {
430 430
                         $temp_sortby2[] = $sortby2_value;
431 431
                     }
432 432
                 }
@@ -434,42 +434,42 @@  discard block
 block discarded – undo
434 434
             }
435 435
         }
436 436
 
437
-        $data=array();
437
+        $data = array();
438 438
 
439
-        foreach($sortby1 as $sort1) {
440
-            foreach($sortby2 as $sort2) {
441
-                if($ifsort2) $a=0;
442
-                foreach($data_set as $key => $value){
443
-                    if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) {
444
-                        if($translate1) {
439
+        foreach ($sortby1 as $sort1) {
440
+            foreach ($sortby2 as $sort2) {
441
+                if ($ifsort2) $a = 0;
442
+                foreach ($data_set as $key => $value) {
443
+                    if ($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2] == $sort2)) {
444
+                        if ($translate1) {
445 445
                             $value[$keycolname1.'_dom_option'] = $value[$keycolname1];
446 446
                             $value[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$value[$keycolname1]];
447 447
                         }
448
-                        if($translate2) {
448
+                        if ($translate2) {
449 449
                             $value[$keycolname2.'_dom_option'] = $value[$keycolname2];
450 450
                             $value[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$value[$keycolname2]];
451 451
                         }
452 452
                         array_push($data, $value);
453 453
                         unset($data_set[$key]);
454
-                        $a=1;
454
+                        $a = 1;
455 455
                     }
456 456
                 }
457
-                if($ifsort2 && $a==0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0.
458
-                    $val=array();
457
+                if ($ifsort2 && $a == 0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0.
458
+                    $val = array();
459 459
                     $val['total'] = 0;
460 460
                     $val['count'] = 0;
461
-                    if($translate1) {
461
+                    if ($translate1) {
462 462
                         $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1];
463 463
                         $val[$keycolname1.'_dom_option'] = $sort1;
464 464
                     }
465 465
                     else {
466 466
                         $val[$keycolname1] = $sort1;
467 467
                     }
468
-                    if($translate2) {
468
+                    if ($translate2) {
469 469
                         $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2];
470 470
                         $val[$keycolname2.'_dom_option'] = $sort2;
471 471
                     }
472
-                    elseif($keycolname2!=null) {
472
+                    elseif ($keycolname2 != null) {
473 473
                         $val[$keycolname2] = $sort2;
474 474
                     }
475 475
                     array_push($data, $val);
Please login to merge, or discard this patch.
Braces   +59 added lines, -36 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.
@@ -121,10 +123,12 @@  discard block
 block discarded – undo
121 123
         // load language files
122 124
         $this->loadLanguage($classname, 'modules/Charts/Dashlets/');
123 125
 
124
-        if ( empty($options['title']) )
125
-            $this->title = $this->dashletStrings['LBL_TITLE'];
126
-        if ( isset($options['autoRefresh']) )
127
-            $this->autoRefresh = $options['autoRefresh'];
126
+        if ( empty($options['title']) ) {
127
+                    $this->title = $this->dashletStrings['LBL_TITLE'];
128
+        }
129
+        if ( isset($options['autoRefresh']) ) {
130
+                    $this->autoRefresh = $options['autoRefresh'];
131
+        }
128 132
 
129 133
         $this->layoutManager = new LayoutManager();
130 134
         $this->layoutManager->setAttribute('context', 'Report');
@@ -140,8 +144,8 @@  discard block
 block discarded – undo
140 144
     public function setRefreshIcon()
141 145
     {
142 146
     	$additionalTitle = '';
143
-        if($this->isRefreshable)
144
-
147
+        if($this->isRefreshable) {
148
+        
145 149
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
146 150
                 . $this->id
147 151
                 . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->'
@@ -154,6 +158,7 @@  discard block
 block discarded – undo
154 158
                     translate('LBL_DASHLET_REFRESH', 'Home')
155 159
                 )
156 160
                 . '</a>';
161
+        }
157 162
         return $additionalTitle;
158 163
     }
159 164
 
@@ -200,25 +205,32 @@  discard block
 block discarded – undo
200 205
 
201 206
         $options = array();
202 207
 
203
-        foreach($req as $name => $value)
204
-            if(!is_array($value)) $req[$name] = trim($value);
208
+        foreach($req as $name => $value) {
209
+                    if(!is_array($value)) $req[$name] = trim($value);
210
+        }
205 211
 
206 212
         foreach($this->_searchFields as $name => $params) {
207 213
             $widgetDef = $params;
208
-            if ( isset($this->getSeedBean()->field_defs[$name]) )
209
-                $widgetDef = $this->getSeedBean()->field_defs[$name];
210
-            if ( $widgetDef['type'] == 'date')           // special case date types
214
+            if ( isset($this->getSeedBean()->field_defs[$name]) ) {
215
+                            $widgetDef = $this->getSeedBean()->field_defs[$name];
216
+            }
217
+            if ( $widgetDef['type'] == 'date') {
218
+                // special case date types
211 219
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
212
-            elseif ( $widgetDef['type'] == 'time')       // special case time types
220
+            } elseif ( $widgetDef['type'] == 'time') {
221
+                // special case time types
213 222
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat);
214
-            elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types
223
+            } elseif ( $widgetDef['type'] == 'datepicker') {
224
+                // special case datepicker types
215 225
                 $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
216
-            elseif (!empty($req[$widgetDef['name']]))
217
-                $options[$widgetDef['name']] = $req[$widgetDef['name']];
226
+            } elseif (!empty($req[$widgetDef['name']])) {
227
+                            $options[$widgetDef['name']] = $req[$widgetDef['name']];
228
+            }
218 229
         }
219 230
 
220
-        if (!empty($req['dashletTitle']))
221
-            $options['title'] = $req['dashletTitle'];
231
+        if (!empty($req['dashletTitle'])) {
232
+                    $options['title'] = $req['dashletTitle'];
233
+        }
222 234
 
223 235
         $options['autoRefresh'] = empty($req['autoRefresh']) ? '0' : $req['autoRefresh'];
224 236
 
@@ -241,19 +253,24 @@  discard block
 block discarded – undo
241 253
                     $currentSearchFields[$name] = array();
242 254
 
243 255
                     $widgetDef = $params;
244
-                    if ( isset($this->getSeedBean()->field_defs[$name]) )
245
-                        $widgetDef = $this->getSeedBean()->field_defs[$name];
256
+                    if ( isset($this->getSeedBean()->field_defs[$name]) ) {
257
+                                            $widgetDef = $this->getSeedBean()->field_defs[$name];
258
+                    }
246 259
 
247
-                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
260
+                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') {
261
+                        $widgetDef['remove_blank'] = true;
262
+                    }
263
+                    // remove the blank option for the dropdown
248 264
 
249
-                    if ( empty($widgetDef['input_name0']) )
250
-                        $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
265
+                    if ( empty($widgetDef['input_name0']) ) {
266
+                                            $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
267
+                    }
251 268
                     $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir);
252
-                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] )
253
-                        $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
269
+                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) {
270
+                                            $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
271
+                    }
254 272
                     $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name));
255
-                }
256
-                else { // ability to create spacers in input fields
273
+                } else { // ability to create spacers in input fields
257 274
                     $currentSearchFields['blank' + $count]['label'] = '';
258 275
                     $currentSearchFields['blank' + $count]['input'] = '';
259 276
                     $count++;
@@ -289,8 +306,9 @@  discard block
 block discarded – undo
289 306
      */
290 307
     protected function getSeedBean()
291 308
     {
292
-        if ( !($this->_seedBean instanceof SugarBean) )
293
-            $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
309
+        if ( !($this->_seedBean instanceof SugarBean) ) {
310
+                    $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
311
+        }
294 312
 
295 313
         return $this->_seedBean;
296 314
     }
@@ -412,9 +430,14 @@  discard block
 block discarded – undo
412 430
         }
413 431
 
414 432
         //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank.
415
-        if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank.
433
+        if(isset($sortby1[0]) && $sortby1[0]==array()) {
434
+            unset($sortby1[0]);
435
+        }
436
+        //the beginning of month after search is blank.
416 437
 
417
-        if($ifsort2==false) $sortby2=array(0);
438
+        if($ifsort2==false) {
439
+            $sortby2=array(0);
440
+        }
418 441
 
419 442
         if($keycolname2!=null) {
420 443
             $sortby2 = array();
@@ -438,7 +461,9 @@  discard block
 block discarded – undo
438 461
 
439 462
         foreach($sortby1 as $sort1) {
440 463
             foreach($sortby2 as $sort2) {
441
-                if($ifsort2) $a=0;
464
+                if($ifsort2) {
465
+                    $a=0;
466
+                }
442 467
                 foreach($data_set as $key => $value){
443 468
                     if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) {
444 469
                         if($translate1) {
@@ -461,15 +486,13 @@  discard block
 block discarded – undo
461 486
                     if($translate1) {
462 487
                         $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1];
463 488
                         $val[$keycolname1.'_dom_option'] = $sort1;
464
-                    }
465
-                    else {
489
+                    } else {
466 490
                         $val[$keycolname1] = $sort1;
467 491
                     }
468 492
                     if($translate2) {
469 493
                         $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2];
470 494
                         $val[$keycolname2.'_dom_option'] = $sort2;
471
-                    }
472
-                    elseif($keycolname2!=null) {
495
+                    } elseif($keycolname2!=null) {
473 496
                         $val[$keycolname2] = $sort2;
474 497
                     }
475 498
                     array_push($data, $val);
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -364,6 +364,10 @@  discard block
 block discarded – undo
364 364
     }
365 365
 
366 366
     //Added as the rgraph charts do not use SugarCharts and this is where this method was previously
367
+
368
+    /**
369
+     * @param string $query
370
+     */
367 371
     function getChartData($query)
368 372
     {
369 373
         global $app_list_strings, $db;
@@ -390,6 +394,8 @@  discard block
 block discarded – undo
390 394
     string $keycolname1      We will sort by this key secondly, and  it can be null, then it will only sort by the first column.
391 395
     bool $translate1            Whether to trabslate the second column
392 396
     bool $ifsort2                 Whether to sort by the second column or just translate the second column.
397
+    * @param string $keycolname1
398
+    * @param string $keycolname2
393 399
      * @return        The sorted and translated data.
394 400
      */
395 401
     function sortData($data_set, $keycolname1=null, $translate1=false, $keycolname2=null, $translate2=false, $ifsort2=false) {
Please login to merge, or discard this patch.
include/Dashlets/DashletCacheBuilder.php 2 patches
Spacing   +7 added lines, -7 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.
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
         $cacheDir = create_cache_directory('dashlets/');
65 65
         $allDashlets = array_merge($dashletFiles, $dashletFilesCustom);
66 66
         $dashletFiles = array();
67
-        foreach($allDashlets as $num => $file) {
68
-            if(substr_count($file, '.meta') == 0) { // ignore meta data files
67
+        foreach ($allDashlets as $num => $file) {
68
+            if (substr_count($file, '.meta') == 0) { // ignore meta data files
69 69
                 $class = substr($file, strrpos($file, '/') + 1, -4);
70 70
                 $dashletFiles[$class] = array();
71 71
                 $dashletFiles[$class]['file'] = $file;
72 72
                 $dashletFiles[$class]['class'] = $class;
73
-                if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
73
+                if (is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
74 74
                     $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file);
75 75
                     require($dashletFiles[$class]['meta']);
76
-                    if ( isset($dashletMeta[$class]['module']) )
76
+                    if (isset($dashletMeta[$class]['module']))
77 77
                         $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
78 78
                 }
79 79
                 
80 80
                 $filesInDirectory = array();
81 81
                 getFiles($filesInDirectory, substr($file, 0, strrpos($file, '/')), '/^.*\/Dashlets\/[^\.]*\.icon\.(jpg|jpeg|gif|png)$/i');
82
-                if(!empty($filesInDirectory)) {
82
+                if (!empty($filesInDirectory)) {
83 83
                     $dashletFiles[$class]['icon'] = $filesInDirectory[0]; // take the first icon we see
84 84
                 }
85 85
             }
86 86
         }
87 87
         
88
-        write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir . 'dashlets.php');
88
+        write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir.'dashlets.php');
89 89
     }
90 90
 }
91 91
 ?>
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
                 if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
74 76
                     $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file);
75 77
                     require($dashletFiles[$class]['meta']);
76
-                    if ( isset($dashletMeta[$class]['module']) )
77
-                        $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
78
+                    if ( isset($dashletMeta[$class]['module']) ) {
79
+                                            $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
80
+                    }
78 81
                 }
79 82
                 
80 83
                 $filesInDirectory = array();
Please login to merge, or discard this patch.
include/Dashlets/DashletRssFeedTitle.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -43,79 +43,79 @@
 block discarded – undo
43 43
  * Created: Sep 12, 2011
44 44
  */
45 45
 class DashletRssFeedTitle {
46
-	public $defaultEncoding = "UTF-8";
47
-	public $readBytes = 8192;
48
-	public $url;
49
-	public $cut = 70;
50
-	public $contents = "";
51
-	public $title = "";
52
-	public $endWith = "...";
53
-	public $xmlEncoding = false;
54
-	public $fileOpen = false;
46
+    public $defaultEncoding = "UTF-8";
47
+    public $readBytes = 8192;
48
+    public $url;
49
+    public $cut = 70;
50
+    public $contents = "";
51
+    public $title = "";
52
+    public $endWith = "...";
53
+    public $xmlEncoding = false;
54
+    public $fileOpen = false;
55 55
 
56
-	public function __construct($url) {
57
-		$this->url = $url;
58
-	}
56
+    public function __construct($url) {
57
+        $this->url = $url;
58
+    }
59 59
 
60
-	public function generateTitle() {
61
-		if ($this->readFeed()) {
62
-			$this->getTitle();
63
-			if (!empty($this->title)) {
64
-				$this->convertEncoding();
65
-				$this->cutLength();
66
-			}
67
-		}
68
-		return $this->title;
69
-	}
60
+    public function generateTitle() {
61
+        if ($this->readFeed()) {
62
+            $this->getTitle();
63
+            if (!empty($this->title)) {
64
+                $this->convertEncoding();
65
+                $this->cutLength();
66
+            }
67
+        }
68
+        return $this->title;
69
+    }
70 70
 
71
-	/**
72
-	 * @todo use curl with waiting timeout instead of fopen
73
-	 */
74
-	public function readFeed() {
75
-		if ($this->url) {
71
+    /**
72
+     * @todo use curl with waiting timeout instead of fopen
73
+     */
74
+    public function readFeed() {
75
+        if ($this->url) {
76 76
                     if (!in_array(strtolower(parse_url($this->url, PHP_URL_SCHEME)), array("http", "https"), true)) {
77 77
                         return false;
78 78
                     }
79
-			$fileOpen = @fopen($this->url, 'r');
80
-			if ($fileOpen) {
81
-				$this->fileOpen = true;
82
-				$this->contents = fread($fileOpen, $this->readBytes);
83
-				fclose($fileOpen);
84
-				return true;
85
-			}
86
-		}
87
-		return false;
88
-	}
79
+            $fileOpen = @fopen($this->url, 'r');
80
+            if ($fileOpen) {
81
+                $this->fileOpen = true;
82
+                $this->contents = fread($fileOpen, $this->readBytes);
83
+                fclose($fileOpen);
84
+                return true;
85
+            }
86
+        }
87
+        return false;
88
+    }
89 89
 
90
-	/**
91
-	 *
92
-	 */
93
-	public function getTitle() {
94
-		$matches = array ();
95
-		preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96
-		if (isset($matches[0])) {
97
-			$this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
98
-		}
99
-	}
90
+    /**
91
+     *
92
+     */
93
+    public function getTitle() {
94
+        $matches = array ();
95
+        preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96
+        if (isset($matches[0])) {
97
+            $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
98
+        }
99
+    }
100 100
 
101
-	public function cutLength() {
102
-		if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
-			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
104
-		}
105
-	}
101
+    public function cutLength() {
102
+        if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
+            $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
104
+        }
105
+    }
106 106
 
107
-	private function _identifyXmlEncoding() {
108
-		$matches = array ();
109
-		preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110
-		if (isset($matches[0])) {
111
-			$this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
112
-		}
113
-	}
107
+    private function _identifyXmlEncoding() {
108
+        $matches = array ();
109
+        preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110
+        if (isset($matches[0])) {
111
+            $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
112
+        }
113
+    }
114 114
 
115
-	public function convertEncoding() {
116
-		$this->_identifyXmlEncoding();
117
-		if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) {
118
-			$this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title);
119
-		}
120
-	}
115
+    public function convertEncoding() {
116
+        $this->_identifyXmlEncoding();
117
+        if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) {
118
+            $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title);
119
+        }
120
+    }
121 121
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 */
93 93
 	public function getTitle() {
94
-		$matches = array ();
94
+		$matches = array();
95 95
 		preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96 96
 		if (isset($matches[0])) {
97 97
 			$this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 	public function cutLength() {
102 102
 		if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
-			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
103
+			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding).$this->endWith;
104 104
 		}
105 105
 	}
106 106
 
107 107
 	private function _identifyXmlEncoding() {
108
-		$matches = array ();
108
+		$matches = array();
109 109
 		preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110 110
 		if (isset($matches[0])) {
111 111
 			$this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
Please login to merge, or discard this patch.
include/SugarPHPMailer.php 3 patches
Spacing   +37 added lines, -37 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.
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		$admin = new Administration();
68 68
 		$admin->retrieveSettings();
69 69
 
70
-		if(isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
70
+		if (isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
71 71
 			$this->disclosureEnabled = true;
72 72
 			$this->disclosureText = $admin->settings['disclosure_text'];
73 73
 		}
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
 		$this->oe->getUserMailerSettings($current_user);
77 77
 
78 78
 		$this->SetLanguage('en', 'include/phpmailer/language/');
79
-		$this->PluginDir	= 'include/phpmailer/';
80
-		$this->Mailer	 	= 'smtp';
79
+		$this->PluginDir = 'include/phpmailer/';
80
+		$this->Mailer = 'smtp';
81 81
         // cn: i18n
82 82
         $this->CharSet		= $locale->getPrecedentPreference('default_email_charset');
83
-		$this->Encoding		= 'quoted-printable';
84
-        $this->IsHTML(false);  // default to plain-text email
83
+		$this->Encoding = 'quoted-printable';
84
+        $this->IsHTML(false); // default to plain-text email
85 85
         $this->Hostname = $sugar_config['host_name'];
86
-        $this->WordWrap		= 996;
86
+        $this->WordWrap = 996;
87 87
 		// cn: gmail fix
88 88
 		$this->protocol = ($this->oe->mail_smtpssl == 1) ? "ssl://" : $this->protocol;
89 89
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		// ssl or tcp - keeping outside isSMTP b/c a default may inadvertently set ssl://
104 104
 		$this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
105 105
 
106
-		if($oe->mail_sendtype == "SMTP")
106
+		if ($oe->mail_sendtype == "SMTP")
107 107
 		{
108 108
     		//Set mail send type information
109 109
     		$this->Mailer = "smtp";
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
             	$this->SMTPSecure = 'tls';
117 117
             } // if
118 118
 
119
-    		if($oe->mail_smtpauth_req) {
119
+    		if ($oe->mail_smtpauth_req) {
120 120
     			$this->SMTPAuth = TRUE;
121 121
     			$this->Username = $oe->mail_smtpuser;
122 122
     			$this->Password = $oe->mail_smtppass;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 		// ssl or tcp - keeping outside isSMTP b/c a default may inadvertantly set ssl://
138 138
 		$this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
139 139
 
140
-		if($oe->mail_sendtype == "SMTP")
140
+		if ($oe->mail_sendtype == "SMTP")
141 141
 		{
142 142
     		//Set mail send type information
143 143
     		$this->Mailer = "smtp";
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
             if ($oe->mail_smtpssl == 2) {
150 150
             	$this->SMTPSecure = 'tls';
151 151
             } // if
152
-    		if($oe->mail_smtpauth_req) {
152
+    		if ($oe->mail_smtpauth_req) {
153 153
     			$this->SMTPAuth = TRUE;
154 154
     			$this->Username = $oe->mail_smtpuser;
155 155
     			$this->Password = $oe->mail_smtppass;
@@ -223,31 +223,31 @@  discard block
 block discarded – undo
223 223
 	function prepForOutbound() {
224 224
 		global $locale;
225 225
 
226
-		if($this->preppedForOutbound == false) {
226
+		if ($this->preppedForOutbound == false) {
227 227
 			//bug 28534. We should not set it to true to circumvent the following conversion as each email is independent.
228 228
 			//$this->preppedForOutbound = true; // flag so we don't redo this
229 229
 			$OBCharset = $locale->getPrecedentPreference('default_email_charset');
230 230
 
231 231
 			// handle disclosure
232
-			if($this->disclosureEnabled) {
232
+			if ($this->disclosureEnabled) {
233 233
 				$this->Body .= "<br />&nbsp;<br />{$this->disclosureText}";
234 234
 				$this->AltBody .= "\r\r{$this->disclosureText}";
235 235
 			}
236 236
 
237 237
 			// body text
238
-			$this->Body		= from_html($locale->translateCharset(trim($this->Body), 'UTF-8', $OBCharset));
239
-			$this->AltBody		= from_html($locale->translateCharset(trim($this->AltBody), 'UTF-8', $OBCharset));
240
-            $subjectUTF8		= from_html(trim($this->Subject));
241
-            $subject			= $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
242
-            $this->Subject		= $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
238
+			$this->Body = from_html($locale->translateCharset(trim($this->Body), 'UTF-8', $OBCharset));
239
+			$this->AltBody = from_html($locale->translateCharset(trim($this->AltBody), 'UTF-8', $OBCharset));
240
+            $subjectUTF8 = from_html(trim($this->Subject));
241
+            $subject = $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
242
+            $this->Subject = $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
243 243
 
244 244
 			// HTML email RFC compliance
245
-			if($this->ContentType == "text/html") {
246
-				if(strpos($this->Body, '<html') === false) {
245
+			if ($this->ContentType == "text/html") {
246
+				if (strpos($this->Body, '<html') === false) {
247 247
 
248 248
                     $langHeader = get_language_header();
249 249
 
250
-					$head=<<<eoq
250
+					$head = <<<eoq
251 251
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
252 252
 <html xmlns="http://www.w3.org/1999/xhtml" {$langHeader}>
253 253
 <head>
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 			// Headers /////////////////////////////////
264 264
 			// the below is done in PHPMailer::CreateHeader();
265 265
 			//$this->Subject			= $locale->translateCharsetMIME(trim($this->Subject), 'UTF-8', $locale->getPrecedentPreference('default_email_charset'));
266
-			$this->FromName		= $locale->translateCharset(trim($this->FromName), 'UTF-8', $OBCharset);
266
+			$this->FromName = $locale->translateCharset(trim($this->FromName), 'UTF-8', $OBCharset);
267 267
 			/*
268 268
 			foreach($this->ReplyTo as $k => $v) {
269 269
 				$this->ReplyTo[$k][1] = $locale->translateCharset(trim($v[1]), 'UTF-8', $OBCharset);
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
 	{
297 297
 		preg_match_all("#<img[^>]*[\s]+src[^=]*=[\s]*[\"']($regex)(.+?)[\"']#si", $this->Body, $matches);
298 298
 		$i = 0;
299
-        foreach($matches[2] as $match) {
299
+        foreach ($matches[2] as $match) {
300 300
 			$filename = urldecode($match);
301 301
 			$cid = $filename;
302 302
 			$file_location = $local_prefix.$filename;
303
-			if(!file_exists($file_location)) continue;
304
-			if($object) {
305
-			    if(preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) {
306
-			        switch(strtolower($typematch[1])) {
303
+			if (!file_exists($file_location)) continue;
304
+			if ($object) {
305
+			    if (preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) {
306
+			        switch (strtolower($typematch[1])) {
307 307
 			            case 'documents':
308 308
 			                $beanname = 'DocumentRevisions';
309 309
 			                break;
@@ -313,10 +313,10 @@  discard block
 block discarded – undo
313 313
 			        }
314 314
 			    }
315 315
 			    $mime_type = "application/octet-stream";
316
-			    if(isset($beanname)) {
316
+			    if (isset($beanname)) {
317 317
 			        $bean = SugarModule::get($beanname)->loadBean();
318 318
     			    $bean->retrieve($filename);
319
-    			    if(!empty($bean->id)) {
319
+    			    if (!empty($bean->id)) {
320 320
         			    $mime_type = $bean->file_mime_type;
321 321
         			    $filename = $bean->filename;
322 322
     			    }
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		    $i++;
331 331
         }
332 332
 		//replace references to cache with cid tag
333
-		$this->Body = preg_replace("|\"$regex|i",'"cid:',$this->Body);
333
+		$this->Body = preg_replace("|\"$regex|i", '"cid:', $this->Body);
334 334
 		// remove bad img line from outbound email
335 335
 		$this->Body = preg_replace('#<img[^>]+src[^=]*=\"\/([^>]*?[^>]*)>#sim', '', $this->Body);
336 336
 	}
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
 		$this->ClearAttachments();
346 346
 
347 347
 		//replace references to cache/images with cid tag
348
-        $this->Body = preg_replace(';=\s*"'.preg_quote(sugar_cached('images/'), ';').';','="cid:',$this->Body);
348
+        $this->Body = preg_replace(';=\s*"'.preg_quote(sugar_cached('images/'), ';').';', '="cid:', $this->Body);
349 349
 
350 350
 		$this->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?cache/images/", sugar_cached("images/"));
351 351
 
@@ -356,13 +356,13 @@  discard block
 block discarded – undo
356 356
 				return;
357 357
 		}
358 358
 		//Handle regular attachments.
359
-		foreach($notes as $note) {
359
+		foreach ($notes as $note) {
360 360
 				$mime_type = 'text/plain';
361 361
 				$file_location = '';
362 362
 				$filename = '';
363 363
 
364
-				if($note->object_name == 'Note') {
365
-					if (! empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
364
+				if ($note->object_name == 'Note') {
365
+					if (!empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
366 366
 						$file_location = $note->file->temp_file_location;
367 367
 						$filename = $note->file->original_file_name;
368 368
 						$mime_type = $note->file->mime_type;
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 						$filename = $note->id.$note->filename;
372 372
 						$mime_type = $note->file_mime_type;
373 373
 					}
374
-				} elseif($note->object_name == 'DocumentRevision') { // from Documents
374
+				} elseif ($note->object_name == 'DocumentRevision') { // from Documents
375 375
 					$filename = $note->id.$note->filename;
376 376
 					$file_location = "upload://$filename";
377 377
 					$mime_type = $note->file_mime_type;
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 		$connection = parent::SmtpConnect();
398 398
 		if (!$connection) {
399 399
 			global $app_strings;
400
-			if(isset($this->oe) && $this->oe->type == "system") {
400
+			if (isset($this->oe) && $this->oe->type == "system") {
401 401
 				$this->SetError($app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND']);
402 402
 			} else {
403 403
 				$this->SetError($app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND']);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
      */
412 412
     public function PreSend() {
413 413
         //check to see if message body is empty
414
-        if(empty($this->Body)){
414
+        if (empty($this->Body)) {
415 415
             //PHPMailer will throw an error if the body is empty, so insert a blank space if body is empty
416 416
             $this->Body = " ";
417 417
         }
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 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.
@@ -121,9 +123,9 @@  discard block
 block discarded – undo
121 123
     			$this->Username = $oe->mail_smtpuser;
122 124
     			$this->Password = $oe->mail_smtppass;
123 125
     		}
126
+		} else {
127
+					$this->Mailer = "sendmail";
124 128
 		}
125
-		else
126
-			$this->Mailer = "sendmail";
127 129
 	}
128 130
 
129 131
 	/**
@@ -154,9 +156,9 @@  discard block
 block discarded – undo
154 156
     			$this->Username = $oe->mail_smtpuser;
155 157
     			$this->Password = $oe->mail_smtppass;
156 158
     		}
159
+		} else {
160
+				  $this->Mailer = "sendmail";
157 161
 		}
158
-		else
159
-		  $this->Mailer = "sendmail";
160 162
 	}
161 163
 
162 164
     /**
@@ -300,7 +302,9 @@  discard block
 block discarded – undo
300 302
 			$filename = urldecode($match);
301 303
 			$cid = $filename;
302 304
 			$file_location = $local_prefix.$filename;
303
-			if(!file_exists($file_location)) continue;
305
+			if(!file_exists($file_location)) {
306
+			    continue;
307
+			}
304 308
 			if($object) {
305 309
 			    if(preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) {
306 310
 			        switch(strtolower($typematch[1])) {
Please login to merge, or discard this patch.
Indentation   +236 added lines, -236 removed lines patch added patch discarded remove patch
@@ -48,117 +48,117 @@  discard block
 block discarded – undo
48 48
  */
49 49
 class SugarPHPMailer extends PHPMailer
50 50
 {
51
-	var $oe; // OutboundEmail
52
-	var $protocol = "tcp://";
53
-	var $preppedForOutbound = false;
54
-	var $disclosureEnabled;
55
-	var $disclosureText;
56
-	var $isHostEmpty = false;
57
-	var $opensslOpened = true;
58
-
59
-	/**
60
-	 * Sole constructor
61
-	 */
62
-	public function __construct() {
51
+    var $oe; // OutboundEmail
52
+    var $protocol = "tcp://";
53
+    var $preppedForOutbound = false;
54
+    var $disclosureEnabled;
55
+    var $disclosureText;
56
+    var $isHostEmpty = false;
57
+    var $opensslOpened = true;
58
+
59
+    /**
60
+     * Sole constructor
61
+     */
62
+    public function __construct() {
63 63
         parent::__construct();
64
-		global $locale;
65
-		global $current_user;
66
-		global $sugar_config;
64
+        global $locale;
65
+        global $current_user;
66
+        global $sugar_config;
67 67
 
68
-		$admin = new Administration();
69
-		$admin->retrieveSettings();
68
+        $admin = new Administration();
69
+        $admin->retrieveSettings();
70 70
 
71
-		if(isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
72
-			$this->disclosureEnabled = true;
73
-			$this->disclosureText = $admin->settings['disclosure_text'];
74
-		}
71
+        if(isset($admin->settings['disclosure_enable']) && !empty($admin->settings['disclosure_enable'])) {
72
+            $this->disclosureEnabled = true;
73
+            $this->disclosureText = $admin->settings['disclosure_text'];
74
+        }
75 75
 
76
-		$this->oe = new OutboundEmail();
77
-		$this->oe->getUserMailerSettings($current_user);
76
+        $this->oe = new OutboundEmail();
77
+        $this->oe->getUserMailerSettings($current_user);
78 78
 
79
-		$this->SetLanguage('en', 'include/phpmailer/language/');
80
-		$this->PluginDir	= 'include/phpmailer/';
81
-		$this->Mailer	 	= 'smtp';
79
+        $this->SetLanguage('en', 'include/phpmailer/language/');
80
+        $this->PluginDir	= 'include/phpmailer/';
81
+        $this->Mailer	 	= 'smtp';
82 82
         // cn: i18n
83 83
         $this->CharSet		= $locale->getPrecedentPreference('default_email_charset');
84
-		$this->Encoding		= 'quoted-printable';
84
+        $this->Encoding		= 'quoted-printable';
85 85
         $this->IsHTML(false);  // default to plain-text email
86 86
         $this->Hostname = $sugar_config['host_name'];
87 87
         $this->WordWrap		= 996;
88
-		// cn: gmail fix
89
-		$this->protocol = ($this->oe->mail_smtpssl == 1) ? "ssl://" : $this->protocol;
88
+        // cn: gmail fix
89
+        $this->protocol = ($this->oe->mail_smtpssl == 1) ? "ssl://" : $this->protocol;
90 90
 
91
-	}
91
+    }
92 92
 
93 93
 
94
-	/**
95
-	 * Prefills outbound details
96
-	 */
97
-	function setMailer() {
98
-		global $current_user;
94
+    /**
95
+     * Prefills outbound details
96
+     */
97
+    function setMailer() {
98
+        global $current_user;
99 99
 
100
-		require_once("include/OutboundEmail/OutboundEmail.php");
101
-		$oe = new OutboundEmail();
102
-		$oe = $oe->getUserMailerSettings($current_user);
100
+        require_once("include/OutboundEmail/OutboundEmail.php");
101
+        $oe = new OutboundEmail();
102
+        $oe = $oe->getUserMailerSettings($current_user);
103 103
 
104
-		// ssl or tcp - keeping outside isSMTP b/c a default may inadvertently set ssl://
105
-		$this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
104
+        // ssl or tcp - keeping outside isSMTP b/c a default may inadvertently set ssl://
105
+        $this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
106 106
 
107
-		if($oe->mail_sendtype == "SMTP")
108
-		{
109
-    		//Set mail send type information
110
-    		$this->Mailer = "smtp";
111
-    		$this->Host = $oe->mail_smtpserver;
112
-    		$this->Port = $oe->mail_smtpport;
107
+        if($oe->mail_sendtype == "SMTP")
108
+        {
109
+            //Set mail send type information
110
+            $this->Mailer = "smtp";
111
+            $this->Host = $oe->mail_smtpserver;
112
+            $this->Port = $oe->mail_smtpport;
113 113
             if ($oe->mail_smtpssl == 1) {
114
-            	$this->SMTPSecure = 'ssl';
114
+                $this->SMTPSecure = 'ssl';
115 115
             } // if
116 116
             if ($oe->mail_smtpssl == 2) {
117
-            	$this->SMTPSecure = 'tls';
117
+                $this->SMTPSecure = 'tls';
118 118
             } // if
119 119
 
120
-    		if($oe->mail_smtpauth_req) {
121
-    			$this->SMTPAuth = TRUE;
122
-    			$this->Username = $oe->mail_smtpuser;
123
-    			$this->Password = $oe->mail_smtppass;
124
-    		}
125
-		}
126
-		else
127
-			$this->Mailer = "sendmail";
128
-	}
129
-
130
-	/**
131
-	 * Prefills mailer for system
132
-	 */
133
-	function setMailerForSystem() {
134
-		require_once("include/OutboundEmail/OutboundEmail.php");
135
-		$oe = new OutboundEmail();
136
-		$oe = $oe->getSystemMailerSettings();
137
-
138
-		// ssl or tcp - keeping outside isSMTP b/c a default may inadvertantly set ssl://
139
-		$this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
140
-
141
-		if($oe->mail_sendtype == "SMTP")
142
-		{
143
-    		//Set mail send type information
144
-    		$this->Mailer = "smtp";
145
-    		$this->Host = $oe->mail_smtpserver;
146
-    		$this->Port = $oe->mail_smtpport;
120
+            if($oe->mail_smtpauth_req) {
121
+                $this->SMTPAuth = TRUE;
122
+                $this->Username = $oe->mail_smtpuser;
123
+                $this->Password = $oe->mail_smtppass;
124
+            }
125
+        }
126
+        else
127
+            $this->Mailer = "sendmail";
128
+    }
129
+
130
+    /**
131
+     * Prefills mailer for system
132
+     */
133
+    function setMailerForSystem() {
134
+        require_once("include/OutboundEmail/OutboundEmail.php");
135
+        $oe = new OutboundEmail();
136
+        $oe = $oe->getSystemMailerSettings();
137
+
138
+        // ssl or tcp - keeping outside isSMTP b/c a default may inadvertantly set ssl://
139
+        $this->protocol = ($oe->mail_smtpssl) ? "ssl://" : "tcp://";
140
+
141
+        if($oe->mail_sendtype == "SMTP")
142
+        {
143
+            //Set mail send type information
144
+            $this->Mailer = "smtp";
145
+            $this->Host = $oe->mail_smtpserver;
146
+            $this->Port = $oe->mail_smtpport;
147 147
             if ($oe->mail_smtpssl == 1) {
148 148
                 $this->SMTPSecure = 'ssl';
149 149
             } // if
150 150
             if ($oe->mail_smtpssl == 2) {
151
-            	$this->SMTPSecure = 'tls';
151
+                $this->SMTPSecure = 'tls';
152 152
             } // if
153
-    		if($oe->mail_smtpauth_req) {
154
-    			$this->SMTPAuth = TRUE;
155
-    			$this->Username = $oe->mail_smtpuser;
156
-    			$this->Password = $oe->mail_smtppass;
157
-    		}
158
-		}
159
-		else
160
-		  $this->Mailer = "sendmail";
161
-	}
153
+            if($oe->mail_smtpauth_req) {
154
+                $this->SMTPAuth = TRUE;
155
+                $this->Username = $oe->mail_smtpuser;
156
+                $this->Password = $oe->mail_smtppass;
157
+            }
158
+        }
159
+        else
160
+            $this->Mailer = "sendmail";
161
+    }
162 162
 
163 163
     /**
164 164
      * Attaches all fs, string, and binary attachments to the message.
@@ -217,38 +217,38 @@  discard block
 block discarded – undo
217 217
         return join("", $mime);
218 218
     }*/
219 219
 
220
-	/**
221
-	 * handles Charset translation for all visual parts of the email.
222
-	 * @param string charset Default = ''
223
-	 */
224
-	function prepForOutbound() {
225
-		global $locale;
226
-
227
-		if($this->preppedForOutbound == false) {
228
-			//bug 28534. We should not set it to true to circumvent the following conversion as each email is independent.
229
-			//$this->preppedForOutbound = true; // flag so we don't redo this
230
-			$OBCharset = $locale->getPrecedentPreference('default_email_charset');
231
-
232
-			// handle disclosure
233
-			if($this->disclosureEnabled) {
234
-				$this->Body .= "<br />&nbsp;<br />{$this->disclosureText}";
235
-				$this->AltBody .= "\r\r{$this->disclosureText}";
236
-			}
220
+    /**
221
+     * handles Charset translation for all visual parts of the email.
222
+     * @param string charset Default = ''
223
+     */
224
+    function prepForOutbound() {
225
+        global $locale;
226
+
227
+        if($this->preppedForOutbound == false) {
228
+            //bug 28534. We should not set it to true to circumvent the following conversion as each email is independent.
229
+            //$this->preppedForOutbound = true; // flag so we don't redo this
230
+            $OBCharset = $locale->getPrecedentPreference('default_email_charset');
231
+
232
+            // handle disclosure
233
+            if($this->disclosureEnabled) {
234
+                $this->Body .= "<br />&nbsp;<br />{$this->disclosureText}";
235
+                $this->AltBody .= "\r\r{$this->disclosureText}";
236
+            }
237 237
 
238
-			// body text
239
-			$this->Body		= from_html($locale->translateCharset(trim($this->Body), 'UTF-8', $OBCharset));
240
-			$this->AltBody		= from_html($locale->translateCharset(trim($this->AltBody), 'UTF-8', $OBCharset));
238
+            // body text
239
+            $this->Body		= from_html($locale->translateCharset(trim($this->Body), 'UTF-8', $OBCharset));
240
+            $this->AltBody		= from_html($locale->translateCharset(trim($this->AltBody), 'UTF-8', $OBCharset));
241 241
             $subjectUTF8		= from_html(trim($this->Subject));
242 242
             $subject			= $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
243 243
             $this->Subject		= $locale->translateCharset($subjectUTF8, 'UTF-8', $OBCharset);
244 244
 
245
-			// HTML email RFC compliance
246
-			if($this->ContentType == "text/html") {
247
-				if(strpos($this->Body, '<html') === false) {
245
+            // HTML email RFC compliance
246
+            if($this->ContentType == "text/html") {
247
+                if(strpos($this->Body, '<html') === false) {
248 248
 
249 249
                     $langHeader = get_language_header();
250 250
 
251
-					$head=<<<eoq
251
+                    $head=<<<eoq
252 252
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
253 253
 <html xmlns="http://www.w3.org/1999/xhtml" {$langHeader}>
254 254
 <head>
@@ -257,15 +257,15 @@  discard block
 block discarded – undo
257 257
 </head>
258 258
 <body>
259 259
 eoq;
260
-					$this->Body = $head.$this->Body."</body></html>";
261
-				}
262
-			}
260
+                    $this->Body = $head.$this->Body."</body></html>";
261
+                }
262
+            }
263 263
 
264
-			// Headers /////////////////////////////////
265
-			// the below is done in PHPMailer::CreateHeader();
266
-			//$this->Subject			= $locale->translateCharsetMIME(trim($this->Subject), 'UTF-8', $locale->getPrecedentPreference('default_email_charset'));
267
-			$this->FromName		= $locale->translateCharset(trim($this->FromName), 'UTF-8', $OBCharset);
268
-			/*
264
+            // Headers /////////////////////////////////
265
+            // the below is done in PHPMailer::CreateHeader();
266
+            //$this->Subject			= $locale->translateCharsetMIME(trim($this->Subject), 'UTF-8', $locale->getPrecedentPreference('default_email_charset'));
267
+            $this->FromName		= $locale->translateCharset(trim($this->FromName), 'UTF-8', $OBCharset);
268
+            /*
269 269
 			foreach($this->ReplyTo as $k => $v) {
270 270
 				$this->ReplyTo[$k][1] = $locale->translateCharset(trim($v[1]), 'UTF-8', $OBCharset);
271 271
 			}
@@ -283,129 +283,129 @@  discard block
 block discarded – undo
283 283
 			}
284 284
 			*/
285 285
 
286
-		}
287
-	}
288
-
289
-	/**
290
-	 * Replace images with locations specified by regex with cid: images
291
-	 * and attach needed files
292
-	 * @param string $regex Regular expression
293
-	 * @param string $local_prefix Prefix where local files are stored
294
-	 * @param bool $object Use attachment object
295
-	 */
296
-	public function replaceImageByRegex($regex, $local_prefix, $object = false)
297
-	{
298
-		preg_match_all("#<img[^>]*[\s]+src[^=]*=[\s]*[\"']($regex)(.+?)[\"']#si", $this->Body, $matches);
299
-		$i = 0;
286
+        }
287
+    }
288
+
289
+    /**
290
+     * Replace images with locations specified by regex with cid: images
291
+     * and attach needed files
292
+     * @param string $regex Regular expression
293
+     * @param string $local_prefix Prefix where local files are stored
294
+     * @param bool $object Use attachment object
295
+     */
296
+    public function replaceImageByRegex($regex, $local_prefix, $object = false)
297
+    {
298
+        preg_match_all("#<img[^>]*[\s]+src[^=]*=[\s]*[\"']($regex)(.+?)[\"']#si", $this->Body, $matches);
299
+        $i = 0;
300 300
         foreach($matches[2] as $match) {
301
-			$filename = urldecode($match);
302
-			$cid = $filename;
303
-			$file_location = $local_prefix.$filename;
304
-			if(!file_exists($file_location)) continue;
305
-			if($object) {
306
-			    if(preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) {
307
-			        switch(strtolower($typematch[1])) {
308
-			            case 'documents':
309
-			                $beanname = 'DocumentRevisions';
310
-			                break;
311
-			            case 'notes':
312
-			                $beanname = 'Notes';
313
-			                break;
314
-			        }
315
-			    }
316
-			    $mime_type = "application/octet-stream";
317
-			    if(isset($beanname)) {
318
-			        $bean = SugarModule::get($beanname)->loadBean();
319
-    			    $bean->retrieve($filename);
320
-    			    if(!empty($bean->id)) {
321
-        			    $mime_type = $bean->file_mime_type;
322
-        			    $filename = $bean->filename;
323
-    			    }
324
-			    }
325
-			} else {
326
-			    $mime_type = "image/".strtolower(pathinfo($filename, PATHINFO_EXTENSION));
327
-			}
328
-		    if (!$this->embeddedAttachmentExists($cid)) {
329
-		    	$this->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type);
330
-		    }
331
-		    $i++;
301
+            $filename = urldecode($match);
302
+            $cid = $filename;
303
+            $file_location = $local_prefix.$filename;
304
+            if(!file_exists($file_location)) continue;
305
+            if($object) {
306
+                if(preg_match('#&(?:amp;)?type=([\w]+)#i', $matches[0][$i], $typematch)) {
307
+                    switch(strtolower($typematch[1])) {
308
+                        case 'documents':
309
+                            $beanname = 'DocumentRevisions';
310
+                            break;
311
+                        case 'notes':
312
+                            $beanname = 'Notes';
313
+                            break;
314
+                    }
315
+                }
316
+                $mime_type = "application/octet-stream";
317
+                if(isset($beanname)) {
318
+                    $bean = SugarModule::get($beanname)->loadBean();
319
+                    $bean->retrieve($filename);
320
+                    if(!empty($bean->id)) {
321
+                        $mime_type = $bean->file_mime_type;
322
+                        $filename = $bean->filename;
323
+                    }
324
+                }
325
+            } else {
326
+                $mime_type = "image/".strtolower(pathinfo($filename, PATHINFO_EXTENSION));
327
+            }
328
+            if (!$this->embeddedAttachmentExists($cid)) {
329
+                $this->AddEmbeddedImage($file_location, $cid, $filename, 'base64', $mime_type);
330
+            }
331
+            $i++;
332 332
         }
333
-		//replace references to cache with cid tag
334
-		$this->Body = preg_replace("|\"$regex|i",'"cid:',$this->Body);
335
-		// remove bad img line from outbound email
336
-		$this->Body = preg_replace('#<img[^>]+src[^=]*=\"\/([^>]*?[^>]*)>#sim', '', $this->Body);
337
-	}
338
-
339
-	/**
340
-	 * @param notes	array of note beans
341
-	 */
342
-	function handleAttachments($notes) {
343
-		global $sugar_config;
344
-
345
-		// cn: bug 4864 - reusing same SugarPHPMailer class, need to clear attachments
346
-		$this->ClearAttachments();
347
-
348
-		//replace references to cache/images with cid tag
333
+        //replace references to cache with cid tag
334
+        $this->Body = preg_replace("|\"$regex|i",'"cid:',$this->Body);
335
+        // remove bad img line from outbound email
336
+        $this->Body = preg_replace('#<img[^>]+src[^=]*=\"\/([^>]*?[^>]*)>#sim', '', $this->Body);
337
+    }
338
+
339
+    /**
340
+     * @param notes	array of note beans
341
+     */
342
+    function handleAttachments($notes) {
343
+        global $sugar_config;
344
+
345
+        // cn: bug 4864 - reusing same SugarPHPMailer class, need to clear attachments
346
+        $this->ClearAttachments();
347
+
348
+        //replace references to cache/images with cid tag
349 349
         $this->Body = preg_replace(';=\s*"'.preg_quote(sugar_cached('images/'), ';').';','="cid:',$this->Body);
350 350
 
351
-		$this->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?cache/images/", sugar_cached("images/"));
352
-
353
-		//Replace any embeded images using the secure entryPoint for src url.
354
-		$this->replaceImageByRegex("(?:{$sugar_config['site_url']})?index.php[?]entryPoint=download&(?:amp;)?[^\"]+?id=", "upload://", true);
355
-
356
-		if (empty($notes)) {
357
-				return;
358
-		}
359
-		//Handle regular attachments.
360
-		foreach($notes as $note) {
361
-				$mime_type = 'text/plain';
362
-				$file_location = '';
363
-				$filename = '';
364
-
365
-				if($note->object_name == 'Note') {
366
-					if (! empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
367
-						$file_location = $note->file->temp_file_location;
368
-						$filename = $note->file->original_file_name;
369
-						$mime_type = $note->file->mime_type;
370
-					} else {
371
-						$file_location = "upload://{$note->id}";
372
-						$filename = $note->id.$note->filename;
373
-						$mime_type = $note->file_mime_type;
374
-					}
375
-				} elseif($note->object_name == 'DocumentRevision') { // from Documents
376
-					$filename = $note->id.$note->filename;
377
-					$file_location = "upload://$filename";
378
-					$mime_type = $note->file_mime_type;
379
-				}
380
-
381
-				$filename = substr($filename, 36, strlen($filename)); // strip GUID	for PHPMailer class to name outbound file
382
-				if (!$note->embed_flag) {
383
-					$this->AddAttachment($file_location, $filename, 'base64', $mime_type);
384
-				} // else
385
-			}
386
-	}
387
-
388
-	/**
389
-	 * overloads class.phpmailer's SetError() method so that we can log errors in sugarcrm.log
390
-	 *
391
-	 */
392
-	function SetError($msg) {
393
-		$GLOBALS['log']->fatal("SugarPHPMailer encountered an error: {$msg}");
394
-		parent::SetError($msg);
395
-	}
396
-
397
-	function SmtpConnect($options = array()) {
398
-		$connection = parent::SmtpConnect();
399
-		if (!$connection) {
400
-			global $app_strings;
401
-			if(isset($this->oe) && $this->oe->type == "system") {
402
-				$this->SetError($app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND']);
403
-			} else {
404
-				$this->SetError($app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND']);
405
-			} // else
406
-		}
407
-		return $connection;
408
-	} // fn
351
+        $this->replaceImageByRegex("(?:{$sugar_config['site_url']})?/?cache/images/", sugar_cached("images/"));
352
+
353
+        //Replace any embeded images using the secure entryPoint for src url.
354
+        $this->replaceImageByRegex("(?:{$sugar_config['site_url']})?index.php[?]entryPoint=download&(?:amp;)?[^\"]+?id=", "upload://", true);
355
+
356
+        if (empty($notes)) {
357
+                return;
358
+        }
359
+        //Handle regular attachments.
360
+        foreach($notes as $note) {
361
+                $mime_type = 'text/plain';
362
+                $file_location = '';
363
+                $filename = '';
364
+
365
+                if($note->object_name == 'Note') {
366
+                    if (! empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
367
+                        $file_location = $note->file->temp_file_location;
368
+                        $filename = $note->file->original_file_name;
369
+                        $mime_type = $note->file->mime_type;
370
+                    } else {
371
+                        $file_location = "upload://{$note->id}";
372
+                        $filename = $note->id.$note->filename;
373
+                        $mime_type = $note->file_mime_type;
374
+                    }
375
+                } elseif($note->object_name == 'DocumentRevision') { // from Documents
376
+                    $filename = $note->id.$note->filename;
377
+                    $file_location = "upload://$filename";
378
+                    $mime_type = $note->file_mime_type;
379
+                }
380
+
381
+                $filename = substr($filename, 36, strlen($filename)); // strip GUID	for PHPMailer class to name outbound file
382
+                if (!$note->embed_flag) {
383
+                    $this->AddAttachment($file_location, $filename, 'base64', $mime_type);
384
+                } // else
385
+            }
386
+    }
387
+
388
+    /**
389
+     * overloads class.phpmailer's SetError() method so that we can log errors in sugarcrm.log
390
+     *
391
+     */
392
+    function SetError($msg) {
393
+        $GLOBALS['log']->fatal("SugarPHPMailer encountered an error: {$msg}");
394
+        parent::SetError($msg);
395
+    }
396
+
397
+    function SmtpConnect($options = array()) {
398
+        $connection = parent::SmtpConnect();
399
+        if (!$connection) {
400
+            global $app_strings;
401
+            if(isset($this->oe) && $this->oe->type == "system") {
402
+                $this->SetError($app_strings['LBL_EMAIL_INVALID_SYSTEM_OUTBOUND']);
403
+            } else {
404
+                $this->SetError($app_strings['LBL_EMAIL_INVALID_PERSONAL_OUTBOUND']);
405
+            } // else
406
+        }
407
+        return $connection;
408
+    } // fn
409 409
 
410 410
     /*
411 411
      * overloads PHPMailer::PreSend() to allow for empty messages to go out.
Please login to merge, or discard this patch.
include/MySugar/retrieve_dash_page.php 2 patches
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 require_once('include/MySugar/MySugar.php');
43 43
 
44 44
 // build dashlet cache file if not found
45
-if(!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) {
45
+if (!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) {
46 46
     require_once('include/Dashlets/DashletCacheBuilder.php');
47 47
 
48 48
     $dc = new DashletCacheBuilder();
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 
61 61
 $hasUserPreferences = (!isset($pages) || empty($pages) || !isset($dashlets) || empty($dashlets)) ? false : true;
62 62
 
63
-if(!$hasUserPreferences){
63
+if (!$hasUserPreferences) {
64 64
     $dashlets = array();
65 65
 
66 66
     //list of preferences to move over and to where
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     $old_columns = $current_user->getPreference('columns', 'home');
86 86
     $old_dashlets = $current_user->getPreference('dashlets', 'home');
87 87
 
88
-    if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)){
88
+    if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)) {
89 89
         $columns = $old_columns;
90 90
         $dashlets = $old_dashlets;
91 91
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $current_user->setPreference('columns', $old_columns, 0, 'home');
96 96
         $current_user->setPreference('dashlets', $old_dashlets, 0, 'home');
97 97
     }
98
-    else{
98
+    else {
99 99
         // This is here to get Sugar dashlets added above the rest
100 100
         $dashlets[create_guid()] = array('className' => 'iFrameDashlet',
101 101
             'module' => 'Home',
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 'height' => 315,
107 107
             ));
108 108
 
109
-        $dashlets[create_guid()] = array ('className' => 'SugarFeedDashlet',
109
+        $dashlets[create_guid()] = array('className' => 'SugarFeedDashlet',
110 110
             'module' => 'SugarFeed',
111 111
             'forceColumn' => 1,
112 112
             'fileLocation' => $dashletsFiles['SugarFeedDashlet']['file'],
@@ -121,15 +121,15 @@  discard block
 block discarded – undo
121 121
                 'height' => 315,
122 122
             ));
123 123
 
124
-        foreach($defaultDashlets as $dashletName=>$module){
124
+        foreach ($defaultDashlets as $dashletName=>$module) {
125 125
             // clint - fixes bug #20398
126 126
             // only display dashlets that are from visibile modules and that the user has permission to list
127 127
             $myDashlet = new MySugar($module);
128 128
             $displayDashlet = $myDashlet->checkDashletDisplay();
129
-            if (isset($dashletsFiles[$dashletName]) && $displayDashlet){
129
+            if (isset($dashletsFiles[$dashletName]) && $displayDashlet) {
130 130
                 $options = array();
131
-                $prefsforthisdashlet = array_keys($prefstomove,$dashletName);
132
-                foreach ( $prefsforthisdashlet as $pref ) {
131
+                $prefsforthisdashlet = array_keys($prefstomove, $dashletName);
132
+                foreach ($prefsforthisdashlet as $pref) {
133 133
                     $options[$pref] = $current_user->getPreference($pref);
134 134
                 }
135 135
                 $dashlets[create_guid()] = array('className' => $dashletName,
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
         $columns[1]['width'] = '40%';
150 150
         $columns[1]['dashlets'] = array();
151 151
 
152
-        foreach($dashlets as $guid=>$dashlet) {
153
-            if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid);
152
+        foreach ($dashlets as $guid=>$dashlet) {
153
+            if ($dashlet['forceColumn'] == 0) array_push($columns[0]['dashlets'], $guid);
154 154
             else array_push($columns[1]['dashlets'], $guid);
155 155
             $count++;
156 156
         }
@@ -165,29 +165,29 @@  discard block
 block discarded – undo
165 165
 // handles upgrading from versions that had the 'Dashboard' module; move those items over to the Home page
166 166
 $pagesDashboard = $current_user->getPreference('pages', 'Dashboard');
167 167
 $dashletsDashboard = $current_user->getPreference('dashlets', 'Dashboard');
168
-if ( !empty($pagesDashboard) ) {
168
+if (!empty($pagesDashboard)) {
169 169
     // move dashlets from the dashboard to be at the end of the home screen dashlets
170
-    foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn ) {
171
-        foreach ($dashboardColumn['dashlets'] as $dashletItem ) {
170
+    foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn) {
171
+        foreach ($dashboardColumn['dashlets'] as $dashletItem) {
172 172
             $pages[0]['columns'][$dashboardColumnKey]['dashlets'][] = $dashletItem;
173 173
         }
174 174
     }
175
-    $pages = array_merge($pages,$pagesDashboard);
175
+    $pages = array_merge($pages, $pagesDashboard);
176 176
     $current_user->setPreference('pages', $pages, 0, 'Home');
177 177
 }
178
-if ( !empty($dashletsDashboard) ) {
179
-    $dashlets = array_merge($dashlets,$dashletsDashboard);
178
+if (!empty($dashletsDashboard)) {
179
+    $dashlets = array_merge($dashlets, $dashletsDashboard);
180 180
     $current_user->setPreference('dashlets', $dashlets, 0, 'Home');
181 181
 }
182
-if ( !empty($pagesDashboard) || !empty($dashletsDashboard) )
182
+if (!empty($pagesDashboard) || !empty($dashletsDashboard))
183 183
     $current_user->resetPreferences('Dashboard');
184 184
 
185
-if (empty($pages)){
185
+if (empty($pages)) {
186 186
     $pages = array();
187 187
     $pageIndex = 0;
188 188
     $pages[0]['columns'] = $columns;
189 189
     $pages[0]['numColumns'] = '2';
190
-    $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME';	// "My Sugar"
190
+    $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // "My Sugar"
191 191
     $pageIndex++;
192 192
     $current_user->setPreference('pages', $pages, 0, 'Home');
193 193
     $activePage = 0;
@@ -206,32 +206,32 @@  discard block
 block discarded – undo
206 206
 $dashletIds = array(); // collect ids to pass to javascript
207 207
 $display = array();
208 208
 
209
-foreach($pages[$activePage]['columns'] as $colNum => $column) {
210
-    if ($colNum == $numCols){
209
+foreach ($pages[$activePage]['columns'] as $colNum => $column) {
210
+    if ($colNum == $numCols) {
211 211
         break;
212 212
     }
213 213
     $display[$colNum]['width'] = $column['width'];
214 214
     $display[$colNum]['dashlets'] = array();
215
-    foreach($column['dashlets'] as $num => $id) {
215
+    foreach ($column['dashlets'] as $num => $id) {
216 216
         // clint - fixes bug #20398
217 217
         // only display dashlets that are from visibile modules and that the user has permission to list
218
-        if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
218
+        if (!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
219 219
             $module = 'Home';
220
-            if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) )
220
+            if (!empty($dashletsFiles[$dashlets[$id]['className']]['module']))
221 221
                 $module = $dashletsFiles[$dashlets[$id]['className']]['module'];
222 222
             // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case
223 223
             //             of the Report Chart dashlets.
224
-            elseif ( !empty($dashlets[$id]['module']) )
224
+            elseif (!empty($dashlets[$id]['module']))
225 225
                 $module = $dashlets[$id]['module'];
226 226
 
227 227
             $myDashlet = new MySugar($module);
228 228
 
229
-            if($myDashlet->checkDashletDisplay()) {
229
+            if ($myDashlet->checkDashletDisplay()) {
230 230
                 require_once($dashlets[$id]['fileLocation']);
231 231
                 $dashlet = new $dashlets[$id]['className']($id, (isset($dashlets[$id]['options']) ? $dashlets[$id]['options'] : array()));
232 232
                 // Need to add support to dynamically display/hide dashlets
233 233
                 // If it has a method 'shouldDisplay' we will call it to see if we should display it or not
234
-                if (method_exists($dashlet,'shouldDisplay')) {
234
+                if (method_exists($dashlet, 'shouldDisplay')) {
235 235
                     if (!$dashlet->shouldDisplay()) {
236 236
                         // This dashlet doesn't want us to show it, skip it.
237 237
                         continue;
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
                 $dashlets = $current_user->getPreference('dashlets', 'Home'); // Using hardcoded 'Home' because DynamicAction.php $_REQUEST['module'] value is always Home
244 244
                 $lvsParams = array();
245
-                if(!empty($dashlets[$id]['sort_options'])){
245
+                if (!empty($dashlets[$id]['sort_options'])) {
246 246
                     $lvsParams = $dashlets[$id]['sort_options'];
247 247
                 }
248 248
 
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
                     $display[$colNum]['dashlets'][$id]['display'] = $dashlet->display();
252 252
                     $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader();
253 253
                     $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter();
254
-                    if($dashlet->hasScript) {
254
+                    if ($dashlet->hasScript) {
255 255
                         $display[$colNum]['dashlets'][$id]['script'] = $dashlet->displayScript();
256 256
                     }
257
-                } catch (Exception $ex) {
257
+                }catch (Exception $ex) {
258 258
                     $display[$colNum]['dashlets'][$id]['display'] = $ex->getMessage();
259 259
                     $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader();
260 260
                     $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter();
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 $_SESSION['current_tab'] = $activePage;
268 268
 
269 269
 
270
-if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
270
+if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
271 271
 
272 272
 
273 273
 $sugar_smarty->assign('sugarVersion', $sugar_version);
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
 $sugar_smarty->assign('maxCount', empty($sugar_config['max_dashlets_homepage']) ? 15 : $sugar_config['max_dashlets_homepage']);
279 279
 $sugar_smarty->assign('dashletCount', $count);
280
-$sugar_smarty->assign('dashletIds', '["' . implode('","', $dashletIds) . '"]');
280
+$sugar_smarty->assign('dashletIds', '["'.implode('","', $dashletIds).'"]');
281 281
 $sugar_smarty->assign('columns', $display);
282 282
 
283 283
 global $theme;
Please login to merge, or discard this patch.
Braces   +20 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -94,8 +96,7 @@  discard block
 block discarded – undo
94 96
         $old_dashlets = array();
95 97
         $current_user->setPreference('columns', $old_columns, 0, 'home');
96 98
         $current_user->setPreference('dashlets', $old_dashlets, 0, 'home');
97
-    }
98
-    else{
99
+    } else{
99 100
         // This is here to get Sugar dashlets added above the rest
100 101
         $dashlets[create_guid()] = array('className' => 'iFrameDashlet',
101 102
             'module' => 'Home',
@@ -150,8 +151,11 @@  discard block
 block discarded – undo
150 151
         $columns[1]['dashlets'] = array();
151 152
 
152 153
         foreach($dashlets as $guid=>$dashlet) {
153
-            if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid);
154
-            else array_push($columns[1]['dashlets'], $guid);
154
+            if( $dashlet['forceColumn'] == 0 ) {
155
+                array_push($columns[0]['dashlets'], $guid);
156
+            } else {
157
+                array_push($columns[1]['dashlets'], $guid);
158
+            }
155 159
             $count++;
156 160
         }
157 161
     }
@@ -179,8 +183,9 @@  discard block
 block discarded – undo
179 183
     $dashlets = array_merge($dashlets,$dashletsDashboard);
180 184
     $current_user->setPreference('dashlets', $dashlets, 0, 'Home');
181 185
 }
182
-if ( !empty($pagesDashboard) || !empty($dashletsDashboard) )
186
+if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) {
183 187
     $current_user->resetPreferences('Dashboard');
188
+}
184 189
 
185 190
 if (empty($pages)){
186 191
     $pages = array();
@@ -217,12 +222,14 @@  discard block
 block discarded – undo
217 222
         // only display dashlets that are from visibile modules and that the user has permission to list
218 223
         if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) {
219 224
             $module = 'Home';
220
-            if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) )
221
-                $module = $dashletsFiles[$dashlets[$id]['className']]['module'];
225
+            if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) {
226
+                            $module = $dashletsFiles[$dashlets[$id]['className']]['module'];
227
+            }
222 228
             // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case
223 229
             //             of the Report Chart dashlets.
224
-            elseif ( !empty($dashlets[$id]['module']) )
225
-                $module = $dashlets[$id]['module'];
230
+            elseif ( !empty($dashlets[$id]['module']) ) {
231
+                            $module = $dashlets[$id]['module'];
232
+            }
226 233
 
227 234
             $myDashlet = new MySugar($module);
228 235
 
@@ -267,7 +274,9 @@  discard block
 block discarded – undo
267 274
 $_SESSION['current_tab'] = $activePage;
268 275
 
269 276
 
270
-if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true);
277
+if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) {
278
+    $sugar_smarty->assign('lock_homepage', true);
279
+}
271 280
 
272 281
 
273 282
 $sugar_smarty->assign('sugarVersion', $sugar_version);
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_number_format.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 function smarty_function_sugar_number_format($params, &$smarty) {
38 38
     global $locale;
39 39
     
40
-	if(!isset($params['var']) || $params['var'] === '') {  
40
+    if(!isset($params['var']) || $params['var'] === '') {  
41 41
         return '';
42 42
     } 
43 43
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@
 block discarded – undo
37 37
 function smarty_function_sugar_number_format($params, &$smarty) {
38 38
     global $locale;
39 39
     
40
-	if(!isset($params['var']) || $params['var'] === '') {  
40
+	if (!isset($params['var']) || $params['var'] === '') {  
41 41
         return '';
42 42
     } 
43 43
 
44
-    if ( !isset($params['precision']) ) {
44
+    if (!isset($params['precision'])) {
45 45
         $params['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits');
46 46
     }
47 47
 
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.wordwrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
  * @param boolean
22 22
  * @return string
23 23
  */
24
-function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
24
+function smarty_modifier_wordwrap($string, $length = 80, $break = "\n", $cut = false)
25 25
 {
26
-    return wordwrap($string,$length,$break,$cut);
26
+    return wordwrap($string, $length, $break, $cut);
27 27
 }
28 28
 
29 29
 ?>
Please login to merge, or discard this patch.