@@ -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; |
@@ -54,26 +54,33 @@ |
||
| 54 | 54 | function smarty_function_sugar_getimage($params, &$smarty) { |
| 55 | 55 | |
| 56 | 56 | // error checking for required parameters |
| 57 | - if(!isset($params['name'])) |
|
| 58 | - $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name'); |
|
| 57 | + if(!isset($params['name'])) { |
|
| 58 | + $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name'); |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | // temp hack to deprecate the use of other_attributes |
| 61 | - if(isset($params['other_attributes'])) |
|
| 62 | - $params['attr'] = $params['other_attributes']; |
|
| 62 | + if(isset($params['other_attributes'])) { |
|
| 63 | + $params['attr'] = $params['other_attributes']; |
|
| 64 | + } |
|
| 63 | 65 | |
| 64 | 66 | // set defaults |
| 65 | - if(!isset($params['attr'])) |
|
| 66 | - $params['attr'] = ''; |
|
| 67 | - if(!isset($params['width'])) |
|
| 68 | - $params['width'] = null; |
|
| 69 | - if(!isset($params['height'])) |
|
| 70 | - $params['height'] = null; |
|
| 71 | - if(!isset($params['alt'])) |
|
| 72 | - $params['alt'] = ''; |
|
| 67 | + if(!isset($params['attr'])) { |
|
| 68 | + $params['attr'] = ''; |
|
| 69 | + } |
|
| 70 | + if(!isset($params['width'])) { |
|
| 71 | + $params['width'] = null; |
|
| 72 | + } |
|
| 73 | + if(!isset($params['height'])) { |
|
| 74 | + $params['height'] = null; |
|
| 75 | + } |
|
| 76 | + if(!isset($params['alt'])) { |
|
| 77 | + $params['alt'] = ''; |
|
| 78 | + } |
|
| 73 | 79 | |
| 74 | 80 | // deprecated ? |
| 75 | - if(!isset($params['ext'])) |
|
| 76 | - $params['ext'] = null; |
|
| 81 | + if(!isset($params['ext'])) { |
|
| 82 | + $params['ext'] = null; |
|
| 83 | + } |
|
| 77 | 84 | |
| 78 | 85 | return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']); |
| 79 | 86 | } |
@@ -60,10 +60,11 @@ |
||
| 60 | 60 | 'get_source' => false); |
| 61 | 61 | $smarty->_parse_resource_name($_params); |
| 62 | 62 | $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; |
| 63 | - if (isset($_section)) |
|
| 64 | - $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
|
| 65 | - else |
|
| 66 | - $_compile_file = $smarty->_get_compile_path($_file_path); |
|
| 63 | + if (isset($_section)) { |
|
| 64 | + $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
|
| 65 | + } else { |
|
| 66 | + $_compile_file = $smarty->_get_compile_path($_file_path); |
|
| 67 | + } |
|
| 67 | 68 | |
| 68 | 69 | if($smarty->force_compile || !file_exists($_compile_file)) { |
| 69 | 70 | $_compile = true; |
@@ -47,10 +47,12 @@ discard block |
||
| 47 | 47 | function smarty_function_sugar_evalcolumn_old($params, &$smarty) |
| 48 | 48 | { |
| 49 | 49 | if (!isset($params['var']) || !isset($params['rowData'])) { |
| 50 | - if(!isset($params['var'])) |
|
| 51 | - $smarty->trigger_error("evalcolumn: missing 'var' parameter"); |
|
| 52 | - if(!isset($params['rowData'])) |
|
| 53 | - $smarty->trigger_error("evalcolumn: missing 'rowData' parameter"); |
|
| 50 | + if(!isset($params['var'])) { |
|
| 51 | + $smarty->trigger_error("evalcolumn: missing 'var' parameter"); |
|
| 52 | + } |
|
| 53 | + if(!isset($params['rowData'])) { |
|
| 54 | + $smarty->trigger_error("evalcolumn: missing 'rowData' parameter"); |
|
| 55 | + } |
|
| 54 | 56 | return; |
| 55 | 57 | } |
| 56 | 58 | |
@@ -62,8 +64,7 @@ discard block |
||
| 62 | 64 | foreach($params['var'] as $key => $value) { |
| 63 | 65 | $params['var'][$key] = searchReplace($value, $params['rowData']); |
| 64 | 66 | } |
| 65 | - } |
|
| 66 | - else { |
|
| 67 | + } else { |
|
| 67 | 68 | $params['var'] = searchReplace($params['var'], $params['rowData']); |
| 68 | 69 | } |
| 69 | 70 | |
@@ -83,10 +84,11 @@ discard block |
||
| 83 | 84 | preg_match_all('/\{\$(.*)\}/U', $value, $matches); |
| 84 | 85 | |
| 85 | 86 | for($wp = 0; $wp < count($matches[0]); $wp++) { |
| 86 | - if(isset($rowData[$matches[1][$wp]])) |
|
| 87 | - $value = str_replace($matches[0][$wp], $rowData[$matches[1][$wp]], $value); |
|
| 88 | - else |
|
| 89 | - $value = str_replace($matches[0][$wp], '', $value); |
|
| 87 | + if(isset($rowData[$matches[1][$wp]])) { |
|
| 88 | + $value = str_replace($matches[0][$wp], $rowData[$matches[1][$wp]], $value); |
|
| 89 | + } else { |
|
| 90 | + $value = str_replace($matches[0][$wp], '', $value); |
|
| 91 | + } |
|
| 90 | 92 | } |
| 91 | 93 | return $value; |
| 92 | 94 | } |
@@ -58,8 +58,9 @@ discard block |
||
| 58 | 58 | for($i = 0; $i < $count; $i++) { |
| 59 | 59 | $match = $matches[1][$i]; |
| 60 | 60 | //List views will have fields be an array where all the keys are upper case and the values are jsut strings |
| 61 | - if (!isset($fields[$match]) && isset($fields[strtoupper($match)])) |
|
| 62 | - $match = strtoupper($match); |
|
| 61 | + if (!isset($fields[$match]) && isset($fields[strtoupper($match)])) { |
|
| 62 | + $match = strtoupper($match); |
|
| 63 | + } |
|
| 63 | 64 | |
| 64 | 65 | $value = isset($fields[$match]) ? $fields[$match] : null; |
| 65 | 66 | if (!is_null($value)) { |
@@ -67,8 +68,7 @@ discard block |
||
| 67 | 68 | { |
| 68 | 69 | $bean = $smarty->get_template_vars('bean'); |
| 69 | 70 | $value = $bean->$match; |
| 70 | - } |
|
| 71 | - else if (is_array($value) && isset($value['value'])) |
|
| 71 | + } else if (is_array($value) && isset($value['value'])) |
|
| 72 | 72 | { |
| 73 | 73 | $value = $value['value']; |
| 74 | 74 | } |
@@ -95,16 +95,19 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - if (!isset($options) && !isset($values)) |
|
| 99 | - return ''; /* raise error here? */ |
|
| 98 | + if (!isset($options) && !isset($values)) { |
|
| 99 | + return ''; |
|
| 100 | + } |
|
| 101 | + /* raise error here? */ |
|
| 100 | 102 | |
| 101 | 103 | settype($selected, 'array'); |
| 102 | 104 | $_html_result = array(); |
| 103 | 105 | |
| 104 | 106 | if (isset($options)) { |
| 105 | 107 | |
| 106 | - foreach ($options as $_key=>$_val) |
|
| 107 | - $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); |
|
| 108 | + foreach ($options as $_key=>$_val) { |
|
| 109 | + $_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels); |
|
| 110 | + } |
|
| 108 | 111 | |
| 109 | 112 | |
| 110 | 113 | } else { |
@@ -125,7 +128,9 @@ discard block |
||
| 125 | 128 | |
| 126 | 129 | function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels) { |
| 127 | 130 | $_output = ''; |
| 128 | - if ($labels) $_output .= '<label>'; |
|
| 131 | + if ($labels) { |
|
| 132 | + $_output .= '<label>'; |
|
| 133 | + } |
|
| 129 | 134 | $_output .= '<input type="checkbox" name="' |
| 130 | 135 | . smarty_function_escape_special_chars($name) . '[]" value="' |
| 131 | 136 | . smarty_function_escape_special_chars($value) . '"'; |
@@ -134,7 +139,9 @@ discard block |
||
| 134 | 139 | $_output .= ' checked="checked"'; |
| 135 | 140 | } |
| 136 | 141 | $_output .= $extra . ' />' . $output; |
| 137 | - if ($labels) $_output .= '</label>'; |
|
| 142 | + if ($labels) { |
|
| 143 | + $_output .= '</label>'; |
|
| 144 | + } |
|
| 138 | 145 | $_output .= $separator; |
| 139 | 146 | |
| 140 | 147 | return $_output; |
@@ -29,8 +29,9 @@ discard block |
||
| 29 | 29 | case 'function': |
| 30 | 30 | case 'inarray': |
| 31 | 31 | $$_key = (string)$_value; |
| 32 | - if ($_key == 'function' || $_key == 'inarray') |
|
| 33 | - $append .= ',' . strtoupper($_key) . ",'$_value'"; |
|
| 32 | + if ($_key == 'function' || $_key == 'inarray') { |
|
| 33 | + $append .= ',' . strtoupper($_key) . ",'$_value'"; |
|
| 34 | + } |
|
| 34 | 35 | break; |
| 35 | 36 | |
| 36 | 37 | case 'caption': |
@@ -90,7 +91,9 @@ discard block |
||
| 90 | 91 | case 'mouseoff': |
| 91 | 92 | case 'followmouse': |
| 92 | 93 | case 'closeclick': |
| 93 | - if ($_value) $append .= ',' . strtoupper($_key); |
|
| 94 | + if ($_value) { |
|
| 95 | + $append .= ',' . strtoupper($_key); |
|
| 96 | + } |
|
| 94 | 97 | break; |
| 95 | 98 | |
| 96 | 99 | default: |
@@ -107,8 +110,9 @@ discard block |
||
| 107 | 110 | |
| 108 | 111 | $retval = $trigger . '="return overlib(\''.preg_replace(array("!'!","![\r\n]!"),array("\'",'\r'),$text).'\''; |
| 109 | 112 | $retval .= $append . ');"'; |
| 110 | - if ($trigger == 'onmouseover') |
|
| 111 | - $retval .= ' onmouseout="nd();"'; |
|
| 113 | + if ($trigger == 'onmouseover') { |
|
| 114 | + $retval .= ' onmouseout="nd();"'; |
|
| 115 | + } |
|
| 112 | 116 | |
| 113 | 117 | |
| 114 | 118 | return $retval; |