@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -135,8 +137,9 @@ discard block |
||
| 135 | 137 | $result = $suppress?@mysqli_query($this->database,$sql):mysqli_query($this->database,$sql); |
| 136 | 138 | $md5 = md5($sql); |
| 137 | 139 | |
| 138 | - if (empty($queryMD5[$md5])) |
|
| 139 | - $queryMD5[$md5] = true; |
|
| 140 | + if (empty($queryMD5[$md5])) { |
|
| 141 | + $queryMD5[$md5] = true; |
|
| 142 | + } |
|
| 140 | 143 | |
| 141 | 144 | $this->query_time = microtime(true) - $this->query_time; |
| 142 | 145 | $GLOBALS['log']->info('Query Execution Time:'.$this->query_time); |
@@ -154,8 +157,9 @@ discard block |
||
| 154 | 157 | */ |
| 155 | 158 | |
| 156 | 159 | |
| 157 | - if($keepResult) |
|
| 158 | - $this->lastResult = $result; |
|
| 160 | + if($keepResult) { |
|
| 161 | + $this->lastResult = $result; |
|
| 162 | + } |
|
| 159 | 163 | $this->checkError($msg.' Query Failed: ' . $sql, $dieOnError); |
| 160 | 164 | |
| 161 | 165 | return $result; |
@@ -208,8 +212,9 @@ discard block |
||
| 208 | 212 | */ |
| 209 | 213 | protected function freeDbResult($dbResult) |
| 210 | 214 | { |
| 211 | - if(!empty($dbResult)) |
|
| 212 | - mysqli_free_result($dbResult); |
|
| 215 | + if(!empty($dbResult)) { |
|
| 216 | + mysqli_free_result($dbResult); |
|
| 217 | + } |
|
| 213 | 218 | } |
| 214 | 219 | |
| 215 | 220 | /** |
@@ -219,17 +224,20 @@ discard block |
||
| 219 | 224 | { |
| 220 | 225 | $field_array = array(); |
| 221 | 226 | |
| 222 | - if (!isset($result) || empty($result)) |
|
| 223 | - return 0; |
|
| 227 | + if (!isset($result) || empty($result)) { |
|
| 228 | + return 0; |
|
| 229 | + } |
|
| 224 | 230 | |
| 225 | 231 | $i = 0; |
| 226 | 232 | while ($i < mysqli_num_fields($result)) { |
| 227 | 233 | $meta = mysqli_fetch_field_direct($result, $i); |
| 228 | - if (!$meta) |
|
| 229 | - return 0; |
|
| 234 | + if (!$meta) { |
|
| 235 | + return 0; |
|
| 236 | + } |
|
| 230 | 237 | |
| 231 | - if($make_lower_case == true) |
|
| 232 | - $meta->name = strtolower($meta->name); |
|
| 238 | + if($make_lower_case == true) { |
|
| 239 | + $meta->name = strtolower($meta->name); |
|
| 240 | + } |
|
| 233 | 241 | |
| 234 | 242 | $field_array[] = $meta->name; |
| 235 | 243 | |
@@ -244,10 +252,15 @@ discard block |
||
| 244 | 252 | */ |
| 245 | 253 | public function fetchRow($result) |
| 246 | 254 | { |
| 247 | - if (empty($result)) return false; |
|
| 255 | + if (empty($result)) { |
|
| 256 | + return false; |
|
| 257 | + } |
|
| 248 | 258 | |
| 249 | 259 | $row = mysqli_fetch_assoc($result); |
| 250 | - if($row == null) $row = false; //Make sure MySQLi driver results are consistent with other database drivers |
|
| 260 | + if($row == null) { |
|
| 261 | + $row = false; |
|
| 262 | + } |
|
| 263 | + //Make sure MySQLi driver results are consistent with other database drivers |
|
| 251 | 264 | return $row; |
| 252 | 265 | } |
| 253 | 266 | |
@@ -266,8 +279,9 @@ discard block |
||
| 266 | 279 | { |
| 267 | 280 | global $sugar_config; |
| 268 | 281 | |
| 269 | - if (is_null($configOptions)) |
|
| 270 | - $configOptions = $sugar_config['dbconfig']; |
|
| 282 | + if (is_null($configOptions)) { |
|
| 283 | + $configOptions = $sugar_config['dbconfig']; |
|
| 284 | + } |
|
| 271 | 285 | |
| 272 | 286 | if(!isset($this->database)) { |
| 273 | 287 | |
@@ -318,8 +332,9 @@ discard block |
||
| 318 | 332 | } |
| 319 | 333 | mysqli_query($this->database,$names); |
| 320 | 334 | |
| 321 | - if($this->checkError('Could Not Connect', $dieOnError)) |
|
| 322 | - $GLOBALS['log']->info("connected to db"); |
|
| 335 | + if($this->checkError('Could Not Connect', $dieOnError)) { |
|
| 336 | + $GLOBALS['log']->info("connected to db"); |
|
| 337 | + } |
|
| 323 | 338 | |
| 324 | 339 | $this->connectOptions = $configOptions; |
| 325 | 340 | return true; |
@@ -1,5 +1,7 @@ discard block |
||
| 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. |
@@ -191,15 +193,25 @@ discard block |
||
| 191 | 193 | */ |
| 192 | 194 | protected static function scanDriverDir($dir, &$drivers, $validate = true) |
| 193 | 195 | { |
| 194 | - if(!is_dir($dir)) return; |
|
| 196 | + if(!is_dir($dir)) { |
|
| 197 | + return; |
|
| 198 | + } |
|
| 195 | 199 | $scandir = opendir($dir); |
| 196 | - if($scandir === false) return; |
|
| 200 | + if($scandir === false) { |
|
| 201 | + return; |
|
| 202 | + } |
|
| 197 | 203 | while(($name = readdir($scandir)) !== false) { |
| 198 | - if(substr($name, -11) != "Manager.php") continue; |
|
| 199 | - if($name == "DBManager.php") continue; |
|
| 204 | + if(substr($name, -11) != "Manager.php") { |
|
| 205 | + continue; |
|
| 206 | + } |
|
| 207 | + if($name == "DBManager.php") { |
|
| 208 | + continue; |
|
| 209 | + } |
|
| 200 | 210 | require_once("$dir/$name"); |
| 201 | 211 | $classname = substr($name, 0, -4); |
| 202 | - if(!class_exists($classname)) continue; |
|
| 212 | + if(!class_exists($classname)) { |
|
| 213 | + continue; |
|
| 214 | + } |
|
| 203 | 215 | $driver = new $classname; |
| 204 | 216 | if(!$validate || $driver->valid()) { |
| 205 | 217 | if(empty($drivers[$driver->dbType])) { |
@@ -236,7 +248,9 @@ discard block |
||
| 236 | 248 | |
| 237 | 249 | $result = array(); |
| 238 | 250 | foreach($drivers as $type => $tdrivers) { |
| 239 | - if(empty($tdrivers)) continue; |
|
| 251 | + if(empty($tdrivers)) { |
|
| 252 | + continue; |
|
| 253 | + } |
|
| 240 | 254 | if(count($tdrivers) > 1) { |
| 241 | 255 | usort($tdrivers, array(__CLASS__, "_compareDrivers")); |
| 242 | 256 | } |
@@ -57,23 +57,23 @@ |
||
| 57 | 57 | require_once('custom/modules/'.$module.'/controller.php'); |
| 58 | 58 | if(class_exists($customClass)){ |
| 59 | 59 | $controller = new $customClass(); |
| 60 | - }else if(class_exists($class)){ |
|
| 60 | + } else if(class_exists($class)){ |
|
| 61 | 61 | $controller = new $class(); |
| 62 | 62 | } |
| 63 | - }elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
| 63 | + } elseif(file_exists('modules/'.$module.'/controller.php')){ |
|
| 64 | 64 | require_once('modules/'.$module.'/controller.php'); |
| 65 | 65 | if(class_exists($customClass)){ |
| 66 | 66 | $controller = new $customClass(); |
| 67 | - }else if(class_exists($class)){ |
|
| 67 | + } else if(class_exists($class)){ |
|
| 68 | 68 | $controller = new $class(); |
| 69 | 69 | } |
| 70 | - }else{ |
|
| 70 | + } else{ |
|
| 71 | 71 | if(file_exists('custom/include/MVC/Controller/SugarController.php')){ |
| 72 | 72 | require_once('custom/include/MVC/Controller/SugarController.php'); |
| 73 | 73 | } |
| 74 | 74 | if(class_exists('CustomSugarController')){ |
| 75 | 75 | $controller = new CustomSugarController(); |
| 76 | - }else{ |
|
| 76 | + } else{ |
|
| 77 | 77 | $controller = new SugarController(); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -1,5 +1,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | { |
@@ -1,5 +1,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -1,5 +1,7 @@ discard block |
||
| 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 |
||
| 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(); |
@@ -1,5 +1,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -68,15 +68,18 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (!isset($options) && !isset($values)) |
|
| 72 | - return ''; /* raise error here? */ |
|
| 71 | + if (!isset($options) && !isset($values)) { |
|
| 72 | + return ''; |
|
| 73 | + } |
|
| 74 | + /* raise error here? */ |
|
| 73 | 75 | |
| 74 | 76 | $_html_result = ''; |
| 75 | 77 | |
| 76 | 78 | if (isset($options)) { |
| 77 | 79 | |
| 78 | - foreach ($options as $_key=>$_val) |
|
| 79 | - $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); |
|
| 80 | + foreach ($options as $_key=>$_val) { |
|
| 81 | + $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected); |
|
| 82 | + } |
|
| 80 | 83 | |
| 81 | 84 | } else { |
| 82 | 85 | |
@@ -99,8 +102,9 @@ discard block |
||
| 99 | 102 | if(!is_array($value)) { |
| 100 | 103 | $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' . |
| 101 | 104 | smarty_function_escape_special_chars($key) . '"'; |
| 102 | - if (in_array((string)$key, $selected)) |
|
| 103 | - $_html_result .= ' selected="selected"'; |
|
| 105 | + if (in_array((string)$key, $selected)) { |
|
| 106 | + $_html_result .= ' selected="selected"'; |
|
| 107 | + } |
|
| 104 | 108 | $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n"; |
| 105 | 109 | } else { |
| 106 | 110 | $_html_result = smarty_function_html_options_optgroup($key, $value, $selected); |
@@ -100,15 +100,18 @@ discard block |
||
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - if (!isset($options) && !isset($values)) |
|
| 104 | - return ''; /* raise error here? */ |
|
| 103 | + if (!isset($options) && !isset($values)) { |
|
| 104 | + return ''; |
|
| 105 | + } |
|
| 106 | + /* raise error here? */ |
|
| 105 | 107 | |
| 106 | 108 | $_html_result = array(); |
| 107 | 109 | |
| 108 | 110 | if (isset($options)) { |
| 109 | 111 | |
| 110 | - foreach ($options as $_key=>$_val) |
|
| 111 | - $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids); |
|
| 112 | + foreach ($options as $_key=>$_val) { |
|
| 113 | + $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids); |
|
| 114 | + } |
|
| 112 | 115 | |
| 113 | 116 | } else { |
| 114 | 117 | |
@@ -141,13 +144,17 @@ discard block |
||
| 141 | 144 | . smarty_function_escape_special_chars($name) . '" value="' |
| 142 | 145 | . smarty_function_escape_special_chars($value) . '"'; |
| 143 | 146 | |
| 144 | - if ($labels && $label_ids) $_output .= ' id="' . $_id . '"'; |
|
| 147 | + if ($labels && $label_ids) { |
|
| 148 | + $_output .= ' id="' . $_id . '"'; |
|
| 149 | + } |
|
| 145 | 150 | |
| 146 | 151 | if ((string)$value==$selected) { |
| 147 | 152 | $_output .= ' checked="checked"'; |
| 148 | 153 | } |
| 149 | 154 | $_output .= $extra . ' />' . $output; |
| 150 | - if ($labels) $_output .= '</label>'; |
|
| 155 | + if ($labels) { |
|
| 156 | + $_output .= '</label>'; |
|
| 157 | + } |
|
| 151 | 158 | $_output .= $separator; |
| 152 | 159 | |
| 153 | 160 | return $_output; |