@@ -45,35 +45,35 @@ discard block |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelRemoveButtonMeetings extends SugarWidgetField |
47 | 47 | { |
48 | - function displayHeaderCell($layout_def) |
|
49 | - { |
|
50 | - return ' '; |
|
51 | - } |
|
48 | + function displayHeaderCell($layout_def) |
|
49 | + { |
|
50 | + return ' '; |
|
51 | + } |
|
52 | 52 | |
53 | - function displayList($layout_def) |
|
54 | - { |
|
55 | - global $app_strings; |
|
53 | + function displayList($layout_def) |
|
54 | + { |
|
55 | + global $app_strings; |
|
56 | 56 | |
57 | 57 | |
58 | - $parent_record_id = $_REQUEST['record']; |
|
59 | - $parent_module = $_REQUEST['module']; |
|
58 | + $parent_record_id = $_REQUEST['record']; |
|
59 | + $parent_module = $_REQUEST['module']; |
|
60 | 60 | |
61 | - $action = 'DeleteRelationship'; |
|
62 | - $record = $layout_def['fields']['ID']; |
|
61 | + $action = 'DeleteRelationship'; |
|
62 | + $record = $layout_def['fields']['ID']; |
|
63 | 63 | |
64 | - $return_module = $_REQUEST['module']; |
|
65 | - $return_action = 'SubPanelViewer'; |
|
66 | - $subpanel = $layout_def['subpanel_id']; |
|
67 | - $return_id = $_REQUEST['record']; |
|
64 | + $return_module = $_REQUEST['module']; |
|
65 | + $return_action = 'SubPanelViewer'; |
|
66 | + $subpanel = $layout_def['subpanel_id']; |
|
67 | + $return_id = $_REQUEST['record']; |
|
68 | 68 | |
69 | 69 | |
70 | - if(isset($GLOBALS['FOCUS'])) { |
|
71 | - $focus = $GLOBALS['FOCUS']; |
|
72 | - } |
|
70 | + if(isset($GLOBALS['FOCUS'])) { |
|
71 | + $focus = $GLOBALS['FOCUS']; |
|
72 | + } |
|
73 | 73 | |
74 | 74 | /* Handle case where we generate subpanels from MySettings/LoadTabSubpanels.php */ |
75 | 75 | else if($return_module == 'MySettings') { |
76 | - global $beanList, $beanFiles; |
|
76 | + global $beanList, $beanFiles; |
|
77 | 77 | $return_module = $_REQUEST['loadModule']; |
78 | 78 | |
79 | 79 | $class = $beanList[$return_module]; |
@@ -83,37 +83,37 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | //CCL - Comment out restriction to not remove assigned user |
86 | - //if($focus->assigned_user_id == $record) return ''; |
|
86 | + //if($focus->assigned_user_id == $record) return ''; |
|
87 | 87 | |
88 | - if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
89 | - $linked_field= $layout_def['linked_field_set'] ; |
|
90 | - } else { |
|
91 | - $linked_field = $layout_def['linked_field']; |
|
92 | - } |
|
93 | - $refresh_page = 0; |
|
94 | - if(!empty($layout_def['refresh_page'])){ |
|
95 | - $refresh_page = 1; |
|
96 | - } |
|
97 | - $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1"; |
|
88 | + if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
89 | + $linked_field= $layout_def['linked_field_set'] ; |
|
90 | + } else { |
|
91 | + $linked_field = $layout_def['linked_field']; |
|
92 | + } |
|
93 | + $refresh_page = 0; |
|
94 | + if(!empty($layout_def['refresh_page'])){ |
|
95 | + $refresh_page = 1; |
|
96 | + } |
|
97 | + $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1"; |
|
98 | 98 | |
99 | - $icon_remove_text = strtolower($app_strings['LBL_ID_FF_REMOVE']); |
|
100 | - $remove_url = $layout_def['start_link_wrapper'] |
|
101 | - . "index.php?module=$parent_module" |
|
102 | - . "&action=$action" |
|
103 | - . "&record=$parent_record_id" |
|
104 | - . "&linked_field=$linked_field" |
|
105 | - . "&linked_id=$record" |
|
106 | - . "&return_url=" . urlencode(urlencode($return_url)) |
|
107 | - . "&refresh_page=$refresh_page" |
|
108 | - . $layout_def['end_link_wrapper']; |
|
109 | - $remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION']; |
|
110 | - //based on listview since that lets you select records |
|
111 | - if($layout_def['ListView']) { |
|
99 | + $icon_remove_text = strtolower($app_strings['LBL_ID_FF_REMOVE']); |
|
100 | + $remove_url = $layout_def['start_link_wrapper'] |
|
101 | + . "index.php?module=$parent_module" |
|
102 | + . "&action=$action" |
|
103 | + . "&record=$parent_record_id" |
|
104 | + . "&linked_field=$linked_field" |
|
105 | + . "&linked_id=$record" |
|
106 | + . "&return_url=" . urlencode(urlencode($return_url)) |
|
107 | + . "&refresh_page=$refresh_page" |
|
108 | + . $layout_def['end_link_wrapper']; |
|
109 | + $remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION']; |
|
110 | + //based on listview since that lets you select records |
|
111 | + if($layout_def['ListView']) { |
|
112 | 112 | return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" .", '$record', $refresh_page);\"" |
113 | - . ' class="listViewTdToolsS1"' . " onclick=\"return sp_rem_conf();\"" . ">$icon_remove_text</a>"; |
|
114 | - }else{ |
|
115 | - return ''; |
|
116 | - } |
|
117 | - } |
|
113 | + . ' class="listViewTdToolsS1"' . " onclick=\"return sp_rem_conf();\"" . ">$icon_remove_text</a>"; |
|
114 | + }else{ |
|
115 | + return ''; |
|
116 | + } |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | ?> |
120 | 120 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
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,12 +67,12 @@ discard block |
||
67 | 67 | $return_id = $_REQUEST['record']; |
68 | 68 | |
69 | 69 | |
70 | - if(isset($GLOBALS['FOCUS'])) { |
|
70 | + if (isset($GLOBALS['FOCUS'])) { |
|
71 | 71 | $focus = $GLOBALS['FOCUS']; |
72 | 72 | } |
73 | 73 | |
74 | 74 | /* Handle case where we generate subpanels from MySettings/LoadTabSubpanels.php */ |
75 | - else if($return_module == 'MySettings') { |
|
75 | + else if ($return_module == 'MySettings') { |
|
76 | 76 | global $beanList, $beanFiles; |
77 | 77 | $return_module = $_REQUEST['loadModule']; |
78 | 78 | |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | //if($focus->assigned_user_id == $record) return ''; |
87 | 87 | |
88 | 88 | if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
89 | - $linked_field= $layout_def['linked_field_set'] ; |
|
89 | + $linked_field = $layout_def['linked_field_set']; |
|
90 | 90 | } else { |
91 | 91 | $linked_field = $layout_def['linked_field']; |
92 | 92 | } |
93 | 93 | $refresh_page = 0; |
94 | - if(!empty($layout_def['refresh_page'])){ |
|
94 | + if (!empty($layout_def['refresh_page'])) { |
|
95 | 95 | $refresh_page = 1; |
96 | 96 | } |
97 | 97 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1"; |
@@ -103,15 +103,15 @@ discard block |
||
103 | 103 | . "&record=$parent_record_id" |
104 | 104 | . "&linked_field=$linked_field" |
105 | 105 | . "&linked_id=$record" |
106 | - . "&return_url=" . urlencode(urlencode($return_url)) |
|
106 | + . "&return_url=".urlencode(urlencode($return_url)) |
|
107 | 107 | . "&refresh_page=$refresh_page" |
108 | 108 | . $layout_def['end_link_wrapper']; |
109 | 109 | $remove_confirmation_text = $app_strings['NTC_REMOVE_CONFIRMATION']; |
110 | 110 | //based on listview since that lets you select records |
111 | - if($layout_def['ListView']) { |
|
112 | - return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" .", '$record', $refresh_page);\"" |
|
113 | - . ' class="listViewTdToolsS1"' . " onclick=\"return sp_rem_conf();\"" . ">$icon_remove_text</a>"; |
|
114 | - }else{ |
|
111 | + if ($layout_def['ListView']) { |
|
112 | + return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'".", '$record', $refresh_page);\"" |
|
113 | + . ' class="listViewTdToolsS1"'." onclick=\"return sp_rem_conf();\"".">$icon_remove_text</a>"; |
|
114 | + } else { |
|
115 | 115 | return ''; |
116 | 116 | } |
117 | 117 | } |
@@ -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. |
@@ -111,7 +113,7 @@ discard block |
||
111 | 113 | if($layout_def['ListView']) { |
112 | 114 | return "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" .", '$record', $refresh_page);\"" |
113 | 115 | . ' class="listViewTdToolsS1"' . " onclick=\"return sp_rem_conf();\"" . ">$icon_remove_text</a>"; |
114 | - }else{ |
|
116 | + } else{ |
|
115 | 117 | return ''; |
116 | 118 | } |
117 | 119 | } |
@@ -43,12 +43,12 @@ |
||
43 | 43 | |
44 | 44 | class SugarWidgetFielduser_name extends SugarWidgetFieldname |
45 | 45 | { |
46 | - function displayInput(&$layout_def) |
|
47 | - { |
|
46 | + function displayInput(&$layout_def) |
|
47 | + { |
|
48 | 48 | $selected_users = empty($layout_def['input_name0']) ? '' : $layout_def['input_name0']; |
49 | - $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>'; |
|
50 | - return $str; |
|
51 | - } |
|
49 | + $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>'; |
|
50 | + return $str; |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | function displayInput(&$layout_def) |
47 | 47 | { |
48 | 48 | $selected_users = empty($layout_def['input_name0']) ? '' : $layout_def['input_name0']; |
49 | - $str = '<select multiple="true" size="3" name="' . $layout_def['name'] . '[]">' . get_select_options_with_id(get_user_array(false), $selected_users) . '</select>'; |
|
49 | + $str = '<select multiple="true" size="3" name="'.$layout_def['name'].'[]">'.get_select_options_with_id(get_user_array(false), $selected_users).'</select>'; |
|
50 | 50 | return $str; |
51 | 51 | } |
52 | 52 | } |
@@ -1,5 +1,7 @@ |
||
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. |
@@ -45,77 +45,77 @@ discard block |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelIcon extends SugarWidgetField |
47 | 47 | { |
48 | - function displayHeaderCell($layout_def) |
|
49 | - { |
|
50 | - return ' '; |
|
51 | - } |
|
52 | - |
|
53 | - function displayList($layout_def) |
|
54 | - { |
|
55 | - global $app_strings; |
|
56 | - global $app_list_strings; |
|
57 | - global $current_user; |
|
58 | - |
|
59 | - if(isset($layout_def['varname'])) |
|
60 | - { |
|
61 | - $key = strtoupper($layout_def['varname']); |
|
62 | - } |
|
63 | - else |
|
64 | - { |
|
65 | - $key = $this->_get_column_alias($layout_def); |
|
66 | - $key = strtoupper($key); |
|
67 | - } |
|
48 | + function displayHeaderCell($layout_def) |
|
49 | + { |
|
50 | + return ' '; |
|
51 | + } |
|
52 | + |
|
53 | + function displayList($layout_def) |
|
54 | + { |
|
55 | + global $app_strings; |
|
56 | + global $app_list_strings; |
|
57 | + global $current_user; |
|
58 | + |
|
59 | + if(isset($layout_def['varname'])) |
|
60 | + { |
|
61 | + $key = strtoupper($layout_def['varname']); |
|
62 | + } |
|
63 | + else |
|
64 | + { |
|
65 | + $key = $this->_get_column_alias($layout_def); |
|
66 | + $key = strtoupper($key); |
|
67 | + } |
|
68 | 68 | //add module image |
69 | - //add module image |
|
70 | - if(!empty($layout_def['target_module_key'])) { |
|
71 | - if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) { |
|
72 | - $module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
73 | - } |
|
74 | - } |
|
69 | + //add module image |
|
70 | + if(!empty($layout_def['target_module_key'])) { |
|
71 | + if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) { |
|
72 | + $module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
73 | + } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | if (empty($module)) { |
77 | - if(empty($layout_def['target_module'])) |
|
78 | - { |
|
79 | - $module = $layout_def['module']; |
|
80 | - } |
|
81 | - else |
|
82 | - { |
|
83 | - $module = $layout_def['target_module']; |
|
84 | - } |
|
85 | - } |
|
86 | - $action = 'DetailView'; |
|
87 | - if(empty($layout_def['target_record_key'])) |
|
88 | - { |
|
89 | - $record = $layout_def['fields']['ID']; |
|
90 | - } |
|
91 | - else |
|
92 | - { |
|
93 | - $record_key = strtoupper($layout_def['target_record_key']); |
|
94 | - $record = $layout_def['fields'][$record_key]; |
|
95 | - } |
|
96 | - $action_access = false; |
|
97 | - if(!empty($record) && |
|
98 | - ($layout_def[$action] && !$layout_def['owner_module'] |
|
99 | - || $layout_def[$action] && !ACLController::moduleSupportsACL($layout_def['owner_module']) |
|
100 | - || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) { |
|
101 | - $action_access = true; |
|
102 | - } |
|
103 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $module . '', 'border="0"',null,null,'.gif',$app_list_strings['moduleList'][$module]); |
|
104 | - if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) { |
|
105 | - $ret=""; |
|
106 | - } else { |
|
107 | - if ($action_access) { |
|
108 | - $ret = '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" >' . $icon_img_html . "</a>"; |
|
109 | - } else { |
|
110 | - $ret = $icon_img_html; |
|
111 | - } |
|
112 | - } |
|
113 | - |
|
114 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])){ |
|
115 | - |
|
116 | - if (!empty($layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])])) { |
|
117 | - $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
118 | - } |
|
77 | + if(empty($layout_def['target_module'])) |
|
78 | + { |
|
79 | + $module = $layout_def['module']; |
|
80 | + } |
|
81 | + else |
|
82 | + { |
|
83 | + $module = $layout_def['target_module']; |
|
84 | + } |
|
85 | + } |
|
86 | + $action = 'DetailView'; |
|
87 | + if(empty($layout_def['target_record_key'])) |
|
88 | + { |
|
89 | + $record = $layout_def['fields']['ID']; |
|
90 | + } |
|
91 | + else |
|
92 | + { |
|
93 | + $record_key = strtoupper($layout_def['target_record_key']); |
|
94 | + $record = $layout_def['fields'][$record_key]; |
|
95 | + } |
|
96 | + $action_access = false; |
|
97 | + if(!empty($record) && |
|
98 | + ($layout_def[$action] && !$layout_def['owner_module'] |
|
99 | + || $layout_def[$action] && !ACLController::moduleSupportsACL($layout_def['owner_module']) |
|
100 | + || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) { |
|
101 | + $action_access = true; |
|
102 | + } |
|
103 | + $icon_img_html = SugarThemeRegistry::current()->getImage( $module . '', 'border="0"',null,null,'.gif',$app_list_strings['moduleList'][$module]); |
|
104 | + if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) { |
|
105 | + $ret=""; |
|
106 | + } else { |
|
107 | + if ($action_access) { |
|
108 | + $ret = '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" >' . $icon_img_html . "</a>"; |
|
109 | + } else { |
|
110 | + $ret = $icon_img_html; |
|
111 | + } |
|
112 | + } |
|
113 | + |
|
114 | + if(!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])){ |
|
115 | + |
|
116 | + if (!empty($layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])])) { |
|
117 | + $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
118 | + } |
|
119 | 119 | |
120 | 120 | $imagePath = ''; |
121 | 121 | if ( $layout_def['image2'] == '__VARIABLE' ) { |
@@ -132,34 +132,34 @@ discard block |
||
132 | 132 | } |
133 | 133 | } |
134 | 134 | //if requested, add attachment icon. |
135 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])){ |
|
135 | + if(!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])){ |
|
136 | 136 | |
137 | - if (is_array($layout_def['image2_url_field'])) { |
|
138 | - //Generate file url. |
|
139 | - if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]) |
|
140 | - and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]) ) { |
|
137 | + if (is_array($layout_def['image2_url_field'])) { |
|
138 | + //Generate file url. |
|
139 | + if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]) |
|
140 | + and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]) ) { |
|
141 | 141 | |
142 | - $key=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
142 | + $key=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
143 | 143 | $file=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]; |
144 | 144 | $filepath="index.php?entryPoint=download&id=".$key."&type=".$layout_def['module']; |
145 | - } |
|
146 | - } else { |
|
147 | - if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) { |
|
148 | - $filepath="index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
149 | - } |
|
150 | - } |
|
151 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $layout_def['image2'] . '', 'border="0"',null,null,'.gif',$layout_def['image2']); |
|
152 | - if ($action_access && !empty($filepath)) { |
|
153 | - $ret .= '<a href="' . $filepath. '" >' . "$icon_img_html</a>"; |
|
154 | - } elseif (!empty($filepath)) { |
|
155 | - $ret .= $icon_img_html; |
|
156 | - } |
|
157 | - } |
|
158 | - // now handle attachments for Emails |
|
159 | - else if(!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | - $ret.= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
161 | - } |
|
162 | - return $ret; |
|
163 | - } |
|
145 | + } |
|
146 | + } else { |
|
147 | + if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) { |
|
148 | + $filepath="index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
149 | + } |
|
150 | + } |
|
151 | + $icon_img_html = SugarThemeRegistry::current()->getImage( $layout_def['image2'] . '', 'border="0"',null,null,'.gif',$layout_def['image2']); |
|
152 | + if ($action_access && !empty($filepath)) { |
|
153 | + $ret .= '<a href="' . $filepath. '" >' . "$icon_img_html</a>"; |
|
154 | + } elseif (!empty($filepath)) { |
|
155 | + $ret .= $icon_img_html; |
|
156 | + } |
|
157 | + } |
|
158 | + // now handle attachments for Emails |
|
159 | + else if(!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | + $ret.= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
161 | + } |
|
162 | + return $ret; |
|
163 | + } |
|
164 | 164 | } |
165 | 165 | ?> |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | global $app_list_strings; |
57 | 57 | global $current_user; |
58 | 58 | |
59 | - if(isset($layout_def['varname'])) |
|
59 | + if (isset($layout_def['varname'])) |
|
60 | 60 | { |
61 | 61 | $key = strtoupper($layout_def['varname']); |
62 | 62 | } |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | } |
68 | 68 | //add module image |
69 | 69 | //add module image |
70 | - if(!empty($layout_def['target_module_key'])) { |
|
70 | + if (!empty($layout_def['target_module_key'])) { |
|
71 | 71 | if (!empty($layout_def['fields'][strtoupper($layout_def['target_module_key'])])) { |
72 | - $module=$layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
72 | + $module = $layout_def['fields'][strtoupper($layout_def['target_module_key'])]; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | 76 | if (empty($module)) { |
77 | - if(empty($layout_def['target_module'])) |
|
77 | + if (empty($layout_def['target_module'])) |
|
78 | 78 | { |
79 | 79 | $module = $layout_def['module']; |
80 | 80 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | $action = 'DetailView'; |
87 | - if(empty($layout_def['target_record_key'])) |
|
87 | + if (empty($layout_def['target_record_key'])) |
|
88 | 88 | { |
89 | 89 | $record = $layout_def['fields']['ID']; |
90 | 90 | } |
@@ -94,70 +94,70 @@ discard block |
||
94 | 94 | $record = $layout_def['fields'][$record_key]; |
95 | 95 | } |
96 | 96 | $action_access = false; |
97 | - if(!empty($record) && |
|
97 | + if (!empty($record) && |
|
98 | 98 | ($layout_def[$action] && !$layout_def['owner_module'] |
99 | 99 | || $layout_def[$action] && !ACLController::moduleSupportsACL($layout_def['owner_module']) |
100 | 100 | || ACLController::checkAccess($layout_def['owner_module'], 'view', $layout_def['owner_id'] == $current_user->id))) { |
101 | 101 | $action_access = true; |
102 | 102 | } |
103 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $module . '', 'border="0"',null,null,'.gif',$app_list_strings['moduleList'][$module]); |
|
103 | + $icon_img_html = SugarThemeRegistry::current()->getImage($module.'', 'border="0"', null, null, '.gif', $app_list_strings['moduleList'][$module]); |
|
104 | 104 | if (!empty($layout_def['attachment_image_only']) && $layout_def['attachment_image_only'] == true) { |
105 | - $ret=""; |
|
105 | + $ret = ""; |
|
106 | 106 | } else { |
107 | 107 | if ($action_access) { |
108 | - $ret = '<a href="index.php?module=' . $module . '&action=' . $action . '&record=' . $record . '" >' . $icon_img_html . "</a>"; |
|
108 | + $ret = '<a href="index.php?module='.$module.'&action='.$action.'&record='.$record.'" >'.$icon_img_html."</a>"; |
|
109 | 109 | } else { |
110 | 110 | $ret = $icon_img_html; |
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])){ |
|
114 | + if (!empty($layout_def['image2']) && !empty($layout_def['image2_ext_url_field'])) { |
|
115 | 115 | |
116 | 116 | if (!empty($layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])])) { |
117 | - $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
117 | + $link_url = $layout_def['fields'][strtoupper($layout_def['image2_ext_url_field'])]; |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $imagePath = ''; |
121 | - if ( $layout_def['image2'] == '__VARIABLE' ) { |
|
122 | - if ( !empty($layout_def['fields'][$key.'_ICON']) ) { |
|
121 | + if ($layout_def['image2'] == '__VARIABLE') { |
|
122 | + if (!empty($layout_def['fields'][$key.'_ICON'])) { |
|
123 | 123 | $imagePath = $layout_def['fields'][$key.'_ICON']; |
124 | 124 | } |
125 | 125 | } else { |
126 | 126 | $imagePath = $layout_def['image2']; |
127 | 127 | } |
128 | 128 | |
129 | - if ( !empty($imagePath) ) { |
|
130 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $imagePath . '', 'border="0"',null,null,'.gif',$imagePath); |
|
131 | - $ret.= (empty($link_url)) ? '' : ' <a href="' . $link_url. '" TARGET = "_blank">' . "$icon_img_html</a>"; |
|
129 | + if (!empty($imagePath)) { |
|
130 | + $icon_img_html = SugarThemeRegistry::current()->getImage($imagePath.'', 'border="0"', null, null, '.gif', $imagePath); |
|
131 | + $ret .= (empty($link_url)) ? '' : ' <a href="'.$link_url.'" TARGET = "_blank">'."$icon_img_html</a>"; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | //if requested, add attachment icon. |
135 | - if(!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])){ |
|
135 | + if (!empty($layout_def['image2']) && !empty($layout_def['image2_url_field'])) { |
|
136 | 136 | |
137 | 137 | if (is_array($layout_def['image2_url_field'])) { |
138 | 138 | //Generate file url. |
139 | 139 | if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]) |
140 | - and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]) ) { |
|
140 | + and !empty($layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])])) { |
|
141 | 141 | |
142 | - $key=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
143 | - $file=$layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]; |
|
144 | - $filepath="index.php?entryPoint=download&id=".$key."&type=".$layout_def['module']; |
|
142 | + $key = $layout_def['fields'][strtoupper($layout_def['image2_url_field']['id_field'])]; |
|
143 | + $file = $layout_def['fields'][strtoupper($layout_def['image2_url_field']['filename_field'])]; |
|
144 | + $filepath = "index.php?entryPoint=download&id=".$key."&type=".$layout_def['module']; |
|
145 | 145 | } |
146 | 146 | } else { |
147 | 147 | if (!empty($layout_def['fields'][strtoupper($layout_def['image2_url_field'])])) { |
148 | - $filepath="index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
148 | + $filepath = "index.php?entryPoint=download&id=".$layout_def['fields']['ID']."&type=".$layout_def['module']; |
|
149 | 149 | } |
150 | 150 | } |
151 | - $icon_img_html = SugarThemeRegistry::current()->getImage( $layout_def['image2'] . '', 'border="0"',null,null,'.gif',$layout_def['image2']); |
|
151 | + $icon_img_html = SugarThemeRegistry::current()->getImage($layout_def['image2'].'', 'border="0"', null, null, '.gif', $layout_def['image2']); |
|
152 | 152 | if ($action_access && !empty($filepath)) { |
153 | - $ret .= '<a href="' . $filepath. '" >' . "$icon_img_html</a>"; |
|
153 | + $ret .= '<a href="'.$filepath.'" >'."$icon_img_html</a>"; |
|
154 | 154 | } elseif (!empty($filepath)) { |
155 | 155 | $ret .= $icon_img_html; |
156 | 156 | } |
157 | 157 | } |
158 | 158 | // now handle attachments for Emails |
159 | - else if(!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | - $ret.= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
159 | + else if (!empty($layout_def['module']) && $layout_def['module'] == 'Emails' && !empty($layout_def['fields']['ATTACHMENT_IMAGE'])) { |
|
160 | + $ret .= $layout_def['fields']['ATTACHMENT_IMAGE']; |
|
161 | 161 | } |
162 | 162 | return $ret; |
163 | 163 | } |
@@ -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. |
@@ -59,8 +61,7 @@ discard block |
||
59 | 61 | if(isset($layout_def['varname'])) |
60 | 62 | { |
61 | 63 | $key = strtoupper($layout_def['varname']); |
62 | - } |
|
63 | - else |
|
64 | + } else |
|
64 | 65 | { |
65 | 66 | $key = $this->_get_column_alias($layout_def); |
66 | 67 | $key = strtoupper($key); |
@@ -77,8 +78,7 @@ discard block |
||
77 | 78 | if(empty($layout_def['target_module'])) |
78 | 79 | { |
79 | 80 | $module = $layout_def['module']; |
80 | - } |
|
81 | - else |
|
81 | + } else |
|
82 | 82 | { |
83 | 83 | $module = $layout_def['target_module']; |
84 | 84 | } |
@@ -87,8 +87,7 @@ discard block |
||
87 | 87 | if(empty($layout_def['target_record_key'])) |
88 | 88 | { |
89 | 89 | $record = $layout_def['fields']['ID']; |
90 | - } |
|
91 | - else |
|
90 | + } else |
|
92 | 91 | { |
93 | 92 | $record_key = strtoupper($layout_def['target_record_key']); |
94 | 93 | $record = $layout_def['fields'][$record_key]; |
@@ -45,21 +45,21 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelConcat extends SugarWidgetField |
47 | 47 | { |
48 | - function displayList(&$layout_def) |
|
49 | - { |
|
50 | - $value=''; |
|
51 | - if (isset($layout_def['source']) and is_array($layout_def['source']) and isset($layout_def['fields']) and is_array($layout_def['fields'])) { |
|
48 | + function displayList(&$layout_def) |
|
49 | + { |
|
50 | + $value=''; |
|
51 | + if (isset($layout_def['source']) and is_array($layout_def['source']) and isset($layout_def['fields']) and is_array($layout_def['fields'])) { |
|
52 | 52 | |
53 | - foreach ($layout_def['source'] as $field) { |
|
53 | + foreach ($layout_def['source'] as $field) { |
|
54 | 54 | |
55 | - if (isset($layout_def['fields'][strtoupper($field)])) { |
|
56 | - $value.=$layout_def['fields'][strtoupper($field)]; |
|
57 | - } else { |
|
58 | - $value.=$field; |
|
59 | - } |
|
60 | - } |
|
61 | - } |
|
62 | - return $value; |
|
63 | - } |
|
55 | + if (isset($layout_def['fields'][strtoupper($field)])) { |
|
56 | + $value.=$layout_def['fields'][strtoupper($field)]; |
|
57 | + } else { |
|
58 | + $value.=$field; |
|
59 | + } |
|
60 | + } |
|
61 | + } |
|
62 | + return $value; |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | ?> |
66 | 66 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -47,15 +47,15 @@ discard block |
||
47 | 47 | { |
48 | 48 | function displayList(&$layout_def) |
49 | 49 | { |
50 | - $value=''; |
|
50 | + $value = ''; |
|
51 | 51 | if (isset($layout_def['source']) and is_array($layout_def['source']) and isset($layout_def['fields']) and is_array($layout_def['fields'])) { |
52 | 52 | |
53 | 53 | foreach ($layout_def['source'] as $field) { |
54 | 54 | |
55 | 55 | if (isset($layout_def['fields'][strtoupper($field)])) { |
56 | - $value.=$layout_def['fields'][strtoupper($field)]; |
|
56 | + $value .= $layout_def['fields'][strtoupper($field)]; |
|
57 | 57 | } else { |
58 | - $value.=$field; |
|
58 | + $value .= $field; |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | } |
@@ -1,5 +1,7 @@ |
||
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. |
@@ -45,81 +45,81 @@ |
||
45 | 45 | |
46 | 46 | class SugarWidgetSubPanelRemoveButton extends SugarWidgetField |
47 | 47 | { |
48 | - function displayHeaderCell($layout_def) |
|
49 | - { |
|
50 | - return ' '; |
|
51 | - } |
|
48 | + function displayHeaderCell($layout_def) |
|
49 | + { |
|
50 | + return ' '; |
|
51 | + } |
|
52 | 52 | |
53 | - function displayList($layout_def) |
|
54 | - { |
|
53 | + function displayList($layout_def) |
|
54 | + { |
|
55 | 55 | |
56 | - global $app_strings; |
|
56 | + global $app_strings; |
|
57 | 57 | global $subpanel_item_count; |
58 | 58 | |
59 | - $unique_id = $layout_def['subpanel_id']."_remove_".$subpanel_item_count; //bug 51512 |
|
59 | + $unique_id = $layout_def['subpanel_id']."_remove_".$subpanel_item_count; //bug 51512 |
|
60 | 60 | |
61 | - $parent_record_id = $_REQUEST['record']; |
|
62 | - $parent_module = $_REQUEST['module']; |
|
61 | + $parent_record_id = $_REQUEST['record']; |
|
62 | + $parent_module = $_REQUEST['module']; |
|
63 | 63 | |
64 | - $action = 'DeleteRelationship'; |
|
65 | - $record = $layout_def['fields']['ID']; |
|
66 | - $current_module=$layout_def['module']; |
|
67 | - //in document revisions subpanel ,users are now allowed to |
|
68 | - //delete the latest revsion of a document. this will be tested here |
|
69 | - //and if the condition is met delete button will be removed. |
|
70 | - $hideremove=false; |
|
71 | - if ($current_module=='DocumentRevisions') { |
|
72 | - if ($layout_def['fields']['ID']==$layout_def['fields']['LATEST_REVISION_ID']) { |
|
73 | - $hideremove=true; |
|
74 | - } |
|
75 | - } |
|
76 | - // Implicit Team-memberships are not "removeable" |
|
77 | - elseif ($_REQUEST['module'] == 'Teams' && $current_module == 'Users') { |
|
78 | - if($layout_def['fields']['UPLINE'] != translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) { |
|
79 | - $hideremove = true; |
|
80 | - } |
|
64 | + $action = 'DeleteRelationship'; |
|
65 | + $record = $layout_def['fields']['ID']; |
|
66 | + $current_module=$layout_def['module']; |
|
67 | + //in document revisions subpanel ,users are now allowed to |
|
68 | + //delete the latest revsion of a document. this will be tested here |
|
69 | + //and if the condition is met delete button will be removed. |
|
70 | + $hideremove=false; |
|
71 | + if ($current_module=='DocumentRevisions') { |
|
72 | + if ($layout_def['fields']['ID']==$layout_def['fields']['LATEST_REVISION_ID']) { |
|
73 | + $hideremove=true; |
|
74 | + } |
|
75 | + } |
|
76 | + // Implicit Team-memberships are not "removeable" |
|
77 | + elseif ($_REQUEST['module'] == 'Teams' && $current_module == 'Users') { |
|
78 | + if($layout_def['fields']['UPLINE'] != translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) { |
|
79 | + $hideremove = true; |
|
80 | + } |
|
81 | 81 | |
82 | - //We also cannot remove the user whose private team is set to the parent_record_id value |
|
83 | - $user = new User(); |
|
84 | - $user->retrieve($layout_def['fields']['ID']); |
|
85 | - if($parent_record_id == $user->getPrivateTeamID()) |
|
86 | - { |
|
87 | - $hideremove = true; |
|
88 | - } |
|
89 | - } |
|
82 | + //We also cannot remove the user whose private team is set to the parent_record_id value |
|
83 | + $user = new User(); |
|
84 | + $user->retrieve($layout_def['fields']['ID']); |
|
85 | + if($parent_record_id == $user->getPrivateTeamID()) |
|
86 | + { |
|
87 | + $hideremove = true; |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - $return_module = $_REQUEST['module']; |
|
93 | - $return_action = 'SubPanelViewer'; |
|
94 | - $subpanel = $layout_def['subpanel_id']; |
|
95 | - $return_id = $_REQUEST['record']; |
|
96 | - if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
97 | - $linked_field= $layout_def['linked_field_set'] ; |
|
98 | - } else { |
|
99 | - $linked_field = $layout_def['linked_field']; |
|
100 | - } |
|
101 | - $refresh_page = 0; |
|
102 | - if(!empty($layout_def['refresh_page'])){ |
|
103 | - $refresh_page = 1; |
|
104 | - } |
|
105 | - $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
|
92 | + $return_module = $_REQUEST['module']; |
|
93 | + $return_action = 'SubPanelViewer'; |
|
94 | + $subpanel = $layout_def['subpanel_id']; |
|
95 | + $return_id = $_REQUEST['record']; |
|
96 | + if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
|
97 | + $linked_field= $layout_def['linked_field_set'] ; |
|
98 | + } else { |
|
99 | + $linked_field = $layout_def['linked_field']; |
|
100 | + } |
|
101 | + $refresh_page = 0; |
|
102 | + if(!empty($layout_def['refresh_page'])){ |
|
103 | + $refresh_page = 1; |
|
104 | + } |
|
105 | + $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
|
106 | 106 | |
107 | - $icon_remove_text = mb_strtolower($app_strings['LBL_ID_FF_REMOVE'], 'UTF-8'); |
|
107 | + $icon_remove_text = mb_strtolower($app_strings['LBL_ID_FF_REMOVE'], 'UTF-8'); |
|
108 | 108 | |
109 | - if($linked_field == 'get_emails_by_assign_or_link') |
|
109 | + if($linked_field == 'get_emails_by_assign_or_link') |
|
110 | 110 | $linked_field = 'emails'; |
111 | - //based on listview since that lets you select records |
|
112 | - if($layout_def['ListView'] && !$hideremove) { |
|
111 | + //based on listview since that lets you select records |
|
112 | + if($layout_def['ListView'] && !$hideremove) { |
|
113 | 113 | $retStr = "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" |
114 | 114 | .", '$record', $refresh_page);\"" |
115 | - . ' class="listViewTdToolsS1"' |
|
115 | + . ' class="listViewTdToolsS1"' |
|
116 | 116 | . "id=$unique_id" |
117 | - . " onclick=\"return sp_rem_conf();\"" |
|
118 | - . ">$icon_remove_text</a>"; |
|
117 | + . " onclick=\"return sp_rem_conf();\"" |
|
118 | + . ">$icon_remove_text</a>"; |
|
119 | 119 | return $retStr; |
120 | 120 | |
121 | - }else{ |
|
122 | - return ''; |
|
123 | - } |
|
124 | - } |
|
121 | + }else{ |
|
122 | + return ''; |
|
123 | + } |
|
124 | + } |
|
125 | 125 | } |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -63,26 +63,26 @@ discard block |
||
63 | 63 | |
64 | 64 | $action = 'DeleteRelationship'; |
65 | 65 | $record = $layout_def['fields']['ID']; |
66 | - $current_module=$layout_def['module']; |
|
66 | + $current_module = $layout_def['module']; |
|
67 | 67 | //in document revisions subpanel ,users are now allowed to |
68 | 68 | //delete the latest revsion of a document. this will be tested here |
69 | 69 | //and if the condition is met delete button will be removed. |
70 | - $hideremove=false; |
|
71 | - if ($current_module=='DocumentRevisions') { |
|
72 | - if ($layout_def['fields']['ID']==$layout_def['fields']['LATEST_REVISION_ID']) { |
|
73 | - $hideremove=true; |
|
70 | + $hideremove = false; |
|
71 | + if ($current_module == 'DocumentRevisions') { |
|
72 | + if ($layout_def['fields']['ID'] == $layout_def['fields']['LATEST_REVISION_ID']) { |
|
73 | + $hideremove = true; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | // Implicit Team-memberships are not "removeable" |
77 | 77 | elseif ($_REQUEST['module'] == 'Teams' && $current_module == 'Users') { |
78 | - if($layout_def['fields']['UPLINE'] != translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) { |
|
78 | + if ($layout_def['fields']['UPLINE'] != translate('LBL_TEAM_UPLINE_EXPLICIT', 'Users')) { |
|
79 | 79 | $hideremove = true; |
80 | 80 | } |
81 | 81 | |
82 | 82 | //We also cannot remove the user whose private team is set to the parent_record_id value |
83 | 83 | $user = new User(); |
84 | 84 | $user->retrieve($layout_def['fields']['ID']); |
85 | - if($parent_record_id == $user->getPrivateTeamID()) |
|
85 | + if ($parent_record_id == $user->getPrivateTeamID()) |
|
86 | 86 | { |
87 | 87 | $hideremove = true; |
88 | 88 | } |
@@ -94,22 +94,22 @@ discard block |
||
94 | 94 | $subpanel = $layout_def['subpanel_id']; |
95 | 95 | $return_id = $_REQUEST['record']; |
96 | 96 | if (isset($layout_def['linked_field_set']) && !empty($layout_def['linked_field_set'])) { |
97 | - $linked_field= $layout_def['linked_field_set'] ; |
|
97 | + $linked_field = $layout_def['linked_field_set']; |
|
98 | 98 | } else { |
99 | 99 | $linked_field = $layout_def['linked_field']; |
100 | 100 | } |
101 | 101 | $refresh_page = 0; |
102 | - if(!empty($layout_def['refresh_page'])){ |
|
102 | + if (!empty($layout_def['refresh_page'])) { |
|
103 | 103 | $refresh_page = 1; |
104 | 104 | } |
105 | 105 | $return_url = "index.php?module=$return_module&action=$return_action&subpanel=$subpanel&record=$return_id&sugar_body_only=1&inline=1"; |
106 | 106 | |
107 | 107 | $icon_remove_text = mb_strtolower($app_strings['LBL_ID_FF_REMOVE'], 'UTF-8'); |
108 | 108 | |
109 | - if($linked_field == 'get_emails_by_assign_or_link') |
|
109 | + if ($linked_field == 'get_emails_by_assign_or_link') |
|
110 | 110 | $linked_field = 'emails'; |
111 | 111 | //based on listview since that lets you select records |
112 | - if($layout_def['ListView'] && !$hideremove) { |
|
112 | + if ($layout_def['ListView'] && !$hideremove) { |
|
113 | 113 | $retStr = "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" |
114 | 114 | .", '$record', $refresh_page);\"" |
115 | 115 | . ' class="listViewTdToolsS1"' |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | . ">$icon_remove_text</a>"; |
119 | 119 | return $retStr; |
120 | 120 | |
121 | - }else{ |
|
121 | + } else { |
|
122 | 122 | return ''; |
123 | 123 | } |
124 | 124 | } |
@@ -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. |
@@ -106,8 +108,9 @@ discard block |
||
106 | 108 | |
107 | 109 | $icon_remove_text = mb_strtolower($app_strings['LBL_ID_FF_REMOVE'], 'UTF-8'); |
108 | 110 | |
109 | - if($linked_field == 'get_emails_by_assign_or_link') |
|
110 | - $linked_field = 'emails'; |
|
111 | + if($linked_field == 'get_emails_by_assign_or_link') { |
|
112 | + $linked_field = 'emails'; |
|
113 | + } |
|
111 | 114 | //based on listview since that lets you select records |
112 | 115 | if($layout_def['ListView'] && !$hideremove) { |
113 | 116 | $retStr = "<a href=\"javascript:sub_p_rem('$subpanel', '$linked_field'" |
@@ -118,7 +121,7 @@ discard block |
||
118 | 121 | . ">$icon_remove_text</a>"; |
119 | 122 | return $retStr; |
120 | 123 | |
121 | - }else{ |
|
124 | + } else{ |
|
122 | 125 | return ''; |
123 | 126 | } |
124 | 127 | } |
@@ -66,55 +66,55 @@ discard block |
||
66 | 66 | |
67 | 67 | require_once('include/formbase.php'); |
68 | 68 | |
69 | - global $beanFiles,$beanList; |
|
70 | - $bean_name = $beanList[$_REQUEST['module']]; |
|
71 | - require_once($beanFiles[$bean_name]); |
|
72 | - $focus = new $bean_name(); |
|
73 | - if ( empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record'])) |
|
74 | - { |
|
75 | - die("need linked_field, linked_id and record fields"); |
|
76 | - } |
|
77 | - $linked_field = $_REQUEST['linked_field']; |
|
78 | - $record = $_REQUEST['record']; |
|
79 | - $linked_id = $_REQUEST['linked_id']; |
|
80 | - if($bean_name == 'Team') |
|
81 | - { |
|
82 | - $focus->retrieve($record); |
|
83 | - $focus->remove_user_from_team($linked_id); |
|
84 | - } |
|
85 | - else |
|
86 | - { |
|
87 | - // cut it off: |
|
88 | - $focus->load_relationship($linked_field); |
|
89 | - if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') |
|
90 | - unset($focus->$linked_field->_relationship->relationship_role_column); |
|
91 | - $focus->$linked_field->delete($record,$linked_id); |
|
92 | - } |
|
93 | - if ($bean_name == 'Campaign' and $linked_field=='prospectlists' ) { |
|
69 | + global $beanFiles,$beanList; |
|
70 | + $bean_name = $beanList[$_REQUEST['module']]; |
|
71 | + require_once($beanFiles[$bean_name]); |
|
72 | + $focus = new $bean_name(); |
|
73 | + if ( empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record'])) |
|
74 | + { |
|
75 | + die("need linked_field, linked_id and record fields"); |
|
76 | + } |
|
77 | + $linked_field = $_REQUEST['linked_field']; |
|
78 | + $record = $_REQUEST['record']; |
|
79 | + $linked_id = $_REQUEST['linked_id']; |
|
80 | + if($bean_name == 'Team') |
|
81 | + { |
|
82 | + $focus->retrieve($record); |
|
83 | + $focus->remove_user_from_team($linked_id); |
|
84 | + } |
|
85 | + else |
|
86 | + { |
|
87 | + // cut it off: |
|
88 | + $focus->load_relationship($linked_field); |
|
89 | + if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') |
|
90 | + unset($focus->$linked_field->_relationship->relationship_role_column); |
|
91 | + $focus->$linked_field->delete($record,$linked_id); |
|
92 | + } |
|
93 | + if ($bean_name == 'Campaign' and $linked_field=='prospectlists' ) { |
|
94 | 94 | |
95 | - $query="SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists "; |
|
96 | - $query.=" left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id"; |
|
97 | - $query.=" where email_marketing.campaign_id='$record'"; |
|
98 | - $query.=" and email_marketing_prospect_lists.prospect_list_id='$linked_id'"; |
|
95 | + $query="SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists "; |
|
96 | + $query.=" left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id"; |
|
97 | + $query.=" where email_marketing.campaign_id='$record'"; |
|
98 | + $query.=" and email_marketing_prospect_lists.prospect_list_id='$linked_id'"; |
|
99 | 99 | |
100 | - $result=$focus->db->query($query); |
|
101 | - while (($row=$focus->db->fetchByAssoc($result)) != null) { |
|
102 | - $del_query =" update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=".$focus->db->convert("'".TimeDate::getInstance()->nowDb()."'",'datetime'); |
|
103 | - $del_query.=" WHERE email_marketing_prospect_lists.id='{$row['id']}'"; |
|
104 | - $focus->db->query($del_query); |
|
105 | - } |
|
106 | - $focus->db->query($query); |
|
107 | - } |
|
100 | + $result=$focus->db->query($query); |
|
101 | + while (($row=$focus->db->fetchByAssoc($result)) != null) { |
|
102 | + $del_query =" update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=".$focus->db->convert("'".TimeDate::getInstance()->nowDb()."'",'datetime'); |
|
103 | + $del_query.=" WHERE email_marketing_prospect_lists.id='{$row['id']}'"; |
|
104 | + $focus->db->query($del_query); |
|
105 | + } |
|
106 | + $focus->db->query($query); |
|
107 | + } |
|
108 | 108 | if ($bean_name == "Meeting") { |
109 | 109 | $focus->retrieve($record); |
110 | 110 | $user = new User(); |
111 | 111 | $user->retrieve($linked_id); |
112 | 112 | if (!empty($user->id)) { //make sure that record exists. we may have a contact on our hands. |
113 | 113 | |
114 | - if($focus->update_vcal) |
|
115 | - { |
|
116 | - vCal::cache_sugar_vcal($user); |
|
117 | - } |
|
114 | + if($focus->update_vcal) |
|
115 | + { |
|
116 | + vCal::cache_sugar_vcal($user); |
|
117 | + } |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | if ($bean_name == "User" && $linked_field == 'eapm') { |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | } |
124 | 124 | |
125 | 125 | if(!empty($_REQUEST['return_url'])){ |
126 | - $_REQUEST['return_url'] =urldecode($_REQUEST['return_url']); |
|
126 | + $_REQUEST['return_url'] =urldecode($_REQUEST['return_url']); |
|
127 | 127 | } |
128 | 128 | $GLOBALS['log']->debug("deleted relationship: bean: $bean_name, linked_field: $linked_field, linked_id:$linked_id" ); |
129 | 129 | if(empty($_REQUEST['refresh_page'])){ |
130 | - handleRedirect(); |
|
130 | + handleRedirect(); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | |
67 | 67 | require_once('include/formbase.php'); |
68 | 68 | |
69 | - global $beanFiles,$beanList; |
|
69 | + global $beanFiles, $beanList; |
|
70 | 70 | $bean_name = $beanList[$_REQUEST['module']]; |
71 | 71 | require_once($beanFiles[$bean_name]); |
72 | 72 | $focus = new $bean_name(); |
73 | - if ( empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record'])) |
|
73 | + if (empty($_REQUEST['linked_id']) || empty($_REQUEST['linked_field']) || empty($_REQUEST['record'])) |
|
74 | 74 | { |
75 | 75 | die("need linked_field, linked_id and record fields"); |
76 | 76 | } |
77 | 77 | $linked_field = $_REQUEST['linked_field']; |
78 | 78 | $record = $_REQUEST['record']; |
79 | 79 | $linked_id = $_REQUEST['linked_id']; |
80 | - if($bean_name == 'Team') |
|
80 | + if ($bean_name == 'Team') |
|
81 | 81 | { |
82 | 82 | $focus->retrieve($record); |
83 | 83 | $focus->remove_user_from_team($linked_id); |
@@ -86,21 +86,21 @@ discard block |
||
86 | 86 | { |
87 | 87 | // cut it off: |
88 | 88 | $focus->load_relationship($linked_field); |
89 | - if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') |
|
89 | + if ($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') |
|
90 | 90 | unset($focus->$linked_field->_relationship->relationship_role_column); |
91 | - $focus->$linked_field->delete($record,$linked_id); |
|
91 | + $focus->$linked_field->delete($record, $linked_id); |
|
92 | 92 | } |
93 | - if ($bean_name == 'Campaign' and $linked_field=='prospectlists' ) { |
|
93 | + if ($bean_name == 'Campaign' and $linked_field == 'prospectlists') { |
|
94 | 94 | |
95 | - $query="SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists "; |
|
96 | - $query.=" left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id"; |
|
97 | - $query.=" where email_marketing.campaign_id='$record'"; |
|
98 | - $query.=" and email_marketing_prospect_lists.prospect_list_id='$linked_id'"; |
|
95 | + $query = "SELECT email_marketing_prospect_lists.id from email_marketing_prospect_lists "; |
|
96 | + $query .= " left join email_marketing on email_marketing.id=email_marketing_prospect_lists.email_marketing_id"; |
|
97 | + $query .= " where email_marketing.campaign_id='$record'"; |
|
98 | + $query .= " and email_marketing_prospect_lists.prospect_list_id='$linked_id'"; |
|
99 | 99 | |
100 | - $result=$focus->db->query($query); |
|
101 | - while (($row=$focus->db->fetchByAssoc($result)) != null) { |
|
102 | - $del_query =" update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=".$focus->db->convert("'".TimeDate::getInstance()->nowDb()."'",'datetime'); |
|
103 | - $del_query.=" WHERE email_marketing_prospect_lists.id='{$row['id']}'"; |
|
100 | + $result = $focus->db->query($query); |
|
101 | + while (($row = $focus->db->fetchByAssoc($result)) != null) { |
|
102 | + $del_query = " update email_marketing_prospect_lists set email_marketing_prospect_lists.deleted=1, email_marketing_prospect_lists.date_modified=".$focus->db->convert("'".TimeDate::getInstance()->nowDb()."'", 'datetime'); |
|
103 | + $del_query .= " WHERE email_marketing_prospect_lists.id='{$row['id']}'"; |
|
104 | 104 | $focus->db->query($del_query); |
105 | 105 | } |
106 | 106 | $focus->db->query($query); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $user->retrieve($linked_id); |
112 | 112 | if (!empty($user->id)) { //make sure that record exists. we may have a contact on our hands. |
113 | 113 | |
114 | - if($focus->update_vcal) |
|
114 | + if ($focus->update_vcal) |
|
115 | 115 | { |
116 | 116 | vCal::cache_sugar_vcal($user); |
117 | 117 | } |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | $eapm->mark_deleted($linked_id); |
123 | 123 | } |
124 | 124 | |
125 | -if(!empty($_REQUEST['return_url'])){ |
|
126 | - $_REQUEST['return_url'] =urldecode($_REQUEST['return_url']); |
|
125 | +if (!empty($_REQUEST['return_url'])) { |
|
126 | + $_REQUEST['return_url'] = urldecode($_REQUEST['return_url']); |
|
127 | 127 | } |
128 | -$GLOBALS['log']->debug("deleted relationship: bean: $bean_name, linked_field: $linked_field, linked_id:$linked_id" ); |
|
129 | -if(empty($_REQUEST['refresh_page'])){ |
|
128 | +$GLOBALS['log']->debug("deleted relationship: bean: $bean_name, linked_field: $linked_field, linked_id:$linked_id"); |
|
129 | +if (empty($_REQUEST['refresh_page'])) { |
|
130 | 130 | handleRedirect(); |
131 | 131 | } |
132 | 132 |
@@ -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. |
@@ -81,13 +83,13 @@ discard block |
||
81 | 83 | { |
82 | 84 | $focus->retrieve($record); |
83 | 85 | $focus->remove_user_from_team($linked_id); |
84 | - } |
|
85 | - else |
|
86 | + } else |
|
86 | 87 | { |
87 | 88 | // cut it off: |
88 | 89 | $focus->load_relationship($linked_field); |
89 | - if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') |
|
90 | - unset($focus->$linked_field->_relationship->relationship_role_column); |
|
90 | + if($focus->$linked_field->_relationship->relationship_name == 'quotes_contacts_shipto') { |
|
91 | + unset($focus->$linked_field->_relationship->relationship_role_column); |
|
92 | + } |
|
91 | 93 | $focus->$linked_field->delete($record,$linked_id); |
92 | 94 | } |
93 | 95 | if ($bean_name == 'Campaign' and $linked_field=='prospectlists' ) { |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | */ |
247 | 247 | private $_templateCache = array(); |
248 | 248 | |
249 | - /** |
|
250 | - * Cache built of sprite meta data |
|
251 | - * |
|
252 | - * @var array |
|
253 | - */ |
|
254 | - private $_spriteCache = array(); |
|
249 | + /** |
|
250 | + * Cache built of sprite meta data |
|
251 | + * |
|
252 | + * @var array |
|
253 | + */ |
|
254 | + private $_spriteCache = array(); |
|
255 | 255 | |
256 | 256 | /** |
257 | 257 | * Size of the caches after the are initialized in the constructor |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | 'imageCache' => 0, |
264 | 264 | 'jsCache' => 0, |
265 | 265 | 'templateCache' => 0, |
266 | - 'spriteCache' => 0, |
|
266 | + 'spriteCache' => 0, |
|
267 | 267 | ); |
268 | 268 | |
269 | 269 | /** |
@@ -329,21 +329,21 @@ discard block |
||
329 | 329 | $this->_templateCache = $caches['templateCache']; |
330 | 330 | } |
331 | 331 | $cachedfile = sugar_cached($this->getFilePath().'/spriteCache.php'); |
332 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && sugar_is_file($cachedfile)) { |
|
333 | - $this->_spriteCache = unserialize(sugar_file_get_contents($cachedfile)); |
|
334 | - } |
|
332 | + if(!empty($GLOBALS['sugar_config']['use_sprites']) && sugar_is_file($cachedfile)) { |
|
333 | + $this->_spriteCache = unserialize(sugar_file_get_contents($cachedfile)); |
|
334 | + } |
|
335 | 335 | } |
336 | 336 | $this->_initialCacheSize = array( |
337 | 337 | 'jsCache' => count($this->_jsCache), |
338 | 338 | 'cssCache' => count($this->_cssCache), |
339 | 339 | 'imageCache' => count($this->_imageCache), |
340 | 340 | 'templateCache' => count($this->_templateCache), |
341 | - 'spriteCache' => count($this->_spriteCache), |
|
341 | + 'spriteCache' => count($this->_spriteCache), |
|
342 | 342 | ); |
343 | 343 | } |
344 | 344 | |
345 | 345 | /** |
346 | - * This is needed to prevent unserialize vulnerability |
|
346 | + * This is needed to prevent unserialize vulnerability |
|
347 | 347 | */ |
348 | 348 | public function __wakeup() |
349 | 349 | { |
@@ -380,8 +380,8 @@ discard block |
||
380 | 380 | |
381 | 381 | if (is_file("$cachedir/pathCache.php")) |
382 | 382 | unlink("$cachedir/pathCache.php"); |
383 | - if (is_file("$cachedir/spriteCache.php")) |
|
384 | - unlink("$cachedir/spriteCache.php"); |
|
383 | + if (is_file("$cachedir/spriteCache.php")) |
|
384 | + unlink("$cachedir/spriteCache.php"); |
|
385 | 385 | |
386 | 386 | } |
387 | 387 | elseif ( !inDeveloperMode() ) { |
@@ -404,12 +404,12 @@ discard block |
||
404 | 404 | ); |
405 | 405 | |
406 | 406 | } |
407 | - if ( count($this->_spriteCache) != $this->_initialCacheSize['spriteCache']) { |
|
408 | - sugar_file_put_contents( |
|
409 | - "$cachedir/spriteCache.php", |
|
410 | - serialize($this->_spriteCache) |
|
411 | - ); |
|
412 | - } |
|
407 | + if ( count($this->_spriteCache) != $this->_initialCacheSize['spriteCache']) { |
|
408 | + sugar_file_put_contents( |
|
409 | + "$cachedir/spriteCache.php", |
|
410 | + serialize($this->_spriteCache) |
|
411 | + ); |
|
412 | + } |
|
413 | 413 | } |
414 | 414 | } |
415 | 415 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | public function __isset($key){ |
441 | - return isset($this->$key); |
|
441 | + return isset($this->$key); |
|
442 | 442 | |
443 | 443 | } |
444 | 444 | |
@@ -603,27 +603,27 @@ discard block |
||
603 | 603 | $html .= '<link rel="stylesheet" type="text/css" href="'.$this->getCSSURL('style.css').'" />'; |
604 | 604 | |
605 | 605 | |
606 | - // sprites |
|
607 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
606 | + // sprites |
|
607 | + if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
608 | 608 | |
609 | - // system wide sprites |
|
610 | - if(file_exists("cache/sprites/default/sprites.css")) |
|
611 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />'; |
|
609 | + // system wide sprites |
|
610 | + if(file_exists("cache/sprites/default/sprites.css")) |
|
611 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />'; |
|
612 | 612 | |
613 | - // theme specific sprites |
|
614 | - if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) |
|
615 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />'; |
|
613 | + // theme specific sprites |
|
614 | + if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) |
|
615 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />'; |
|
616 | 616 | |
617 | - // parent sprites |
|
618 | - if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
619 | - if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) |
|
620 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />'; |
|
621 | - } |
|
617 | + // parent sprites |
|
618 | + if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
619 | + if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) |
|
620 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />'; |
|
621 | + } |
|
622 | 622 | |
623 | - // repeatable sprites |
|
624 | - if(file_exists("cache/sprites/Repeatable/sprites.css")) |
|
625 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />'; |
|
626 | - } |
|
623 | + // repeatable sprites |
|
624 | + if(file_exists("cache/sprites/Repeatable/sprites.css")) |
|
625 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />'; |
|
626 | + } |
|
627 | 627 | |
628 | 628 | // for BC during upgrade |
629 | 629 | if ( !empty($this->colors) ) { |
@@ -700,180 +700,180 @@ discard block |
||
700 | 700 | * |
701 | 701 | * @param string $image image name |
702 | 702 | * @param string $other_attributes optional, other attributes to add to the image tag, not cached |
703 | - * @param string $width optional, defaults to the actual image's width |
|
704 | - * @param string $height optional, defaults to the actual image's height |
|
705 | - * @param string $ext optional, image extension (TODO can we deprecate this one ?) |
|
703 | + * @param string $width optional, defaults to the actual image's width |
|
704 | + * @param string $height optional, defaults to the actual image's height |
|
705 | + * @param string $ext optional, image extension (TODO can we deprecate this one ?) |
|
706 | 706 | * @param string $alt optional, only used when image contains something useful, i.e. "Sally's profile pic" |
707 | 707 | * @return string HTML image tag or sprite |
708 | 708 | */ |
709 | 709 | public function getImage( |
710 | 710 | $imageName, |
711 | 711 | $other_attributes = '', |
712 | - $width = null, |
|
713 | - $height = null, |
|
714 | - $ext = null, |
|
712 | + $width = null, |
|
713 | + $height = null, |
|
714 | + $ext = null, |
|
715 | 715 | $alt = '' |
716 | 716 | ) |
717 | 717 | { |
718 | 718 | |
719 | 719 | static $cached_results = array(); |
720 | 720 | |
721 | - // trap deprecated use of image extension |
|
722 | - if(is_null($ext)) { |
|
723 | - $imageNameExp = explode('.',$imageName); |
|
724 | - if(count($imageNameExp) == 1) |
|
725 | - $imageName .= '.gif'; |
|
726 | - } else { |
|
727 | - $imageName .= $ext; |
|
728 | - } |
|
729 | - |
|
730 | - // trap alt attributes in other_attributes |
|
731 | - if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) |
|
732 | - $GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName"); |
|
733 | - // sprite handler, makes use of own caching mechanism |
|
734 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
735 | - // get sprite metadata |
|
736 | - if($sp = $this->getSpriteMeta($imageName)) { |
|
737 | - // requested size should match |
|
738 | - if( (!is_null($width) && $sp['width'] == $width) || (is_null($width)) && |
|
739 | - (!is_null($height) && $sp['height'] == $height) || (is_null($height)) ) |
|
740 | - { |
|
721 | + // trap deprecated use of image extension |
|
722 | + if(is_null($ext)) { |
|
723 | + $imageNameExp = explode('.',$imageName); |
|
724 | + if(count($imageNameExp) == 1) |
|
725 | + $imageName .= '.gif'; |
|
726 | + } else { |
|
727 | + $imageName .= $ext; |
|
728 | + } |
|
729 | + |
|
730 | + // trap alt attributes in other_attributes |
|
731 | + if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) |
|
732 | + $GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName"); |
|
733 | + // sprite handler, makes use of own caching mechanism |
|
734 | + if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
735 | + // get sprite metadata |
|
736 | + if($sp = $this->getSpriteMeta($imageName)) { |
|
737 | + // requested size should match |
|
738 | + if( (!is_null($width) && $sp['width'] == $width) || (is_null($width)) && |
|
739 | + (!is_null($height) && $sp['height'] == $height) || (is_null($height)) ) |
|
740 | + { |
|
741 | 741 | $other_attributes .= ' data-orig="'.$imageName.'"'; |
742 | 742 | |
743 | - if($sprite = $this->getSprite($sp['class'], $other_attributes, $alt)) |
|
744 | - { |
|
745 | - return $sprite; |
|
746 | - } |
|
747 | - } |
|
748 | - } |
|
749 | - } |
|
750 | - |
|
751 | - // img caching |
|
752 | - if(empty($cached_results[$imageName])) { |
|
753 | - $imageURL = $this->getImageURL($imageName,false); |
|
754 | - if ( empty($imageURL) ) |
|
755 | - return false; |
|
743 | + if($sprite = $this->getSprite($sp['class'], $other_attributes, $alt)) |
|
744 | + { |
|
745 | + return $sprite; |
|
746 | + } |
|
747 | + } |
|
748 | + } |
|
749 | + } |
|
750 | + |
|
751 | + // img caching |
|
752 | + if(empty($cached_results[$imageName])) { |
|
753 | + $imageURL = $this->getImageURL($imageName,false); |
|
754 | + if ( empty($imageURL) ) |
|
755 | + return false; |
|
756 | 756 | if(strpos($imageURL, '.svg', strlen($imageURL)-4)){ |
757 | 757 | $cached_results[$imageName] = file_get_contents($imageURL); |
758 | 758 | } else { |
759 | 759 | $cached_results[$imageName] = '<img src="'.getJSPath($imageURL).'" '; |
760 | 760 | } |
761 | 761 | |
762 | - } |
|
762 | + } |
|
763 | 763 | |
764 | - $attr_width = (is_null($width)) ? "" : "width=\"$width\""; |
|
765 | - $attr_height = (is_null($height)) ? "" : "height=\"$height\""; |
|
764 | + $attr_width = (is_null($width)) ? "" : "width=\"$width\""; |
|
765 | + $attr_height = (is_null($height)) ? "" : "height=\"$height\""; |
|
766 | 766 | |
767 | 767 | if(strpos($cached_results[$imageName], 'svg') !== false){ |
768 | 768 | return $cached_results[$imageName]; |
769 | 769 | } |
770 | - return $cached_results[$imageName] . " $attr_width $attr_height $other_attributes alt=\"$alt\" />"; |
|
770 | + return $cached_results[$imageName] . " $attr_width $attr_height $other_attributes alt=\"$alt\" />"; |
|
771 | + } |
|
772 | + |
|
773 | + /** |
|
774 | + * Returns sprite meta data |
|
775 | + * |
|
776 | + * @param string $imageName Image filename including extension |
|
777 | + * @return array Sprite meta data |
|
778 | + */ |
|
779 | + public function getSpriteMeta($imageName) { |
|
780 | + |
|
781 | + // return from cache |
|
782 | + if(isset($this->_spriteCache[$imageName])) |
|
783 | + return $this->_spriteCache[$imageName]; |
|
784 | + |
|
785 | + // sprite keys are base on imageURL |
|
786 | + $imageURL = $this->getImageURL($imageName,false); |
|
787 | + if(empty($imageURL)) { |
|
788 | + $this->_spriteCache[$imageName] = false; |
|
789 | + return false; |
|
790 | + } |
|
791 | + |
|
792 | + // load meta data, includes default images |
|
793 | + require_once("include/SugarTheme/SugarSprites.php"); |
|
794 | + $meta = SugarSprites::getInstance(); |
|
795 | + // add current theme dir |
|
796 | + $meta->loadSpriteMeta($this->dirName); |
|
797 | + // add parent theme dir |
|
798 | + if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
799 | + $meta->loadSpriteMeta($parent->dirName); |
|
800 | + } |
|
801 | + |
|
802 | + // add to cache |
|
803 | + if(isset($meta->sprites[$imageURL])) { |
|
804 | + $this->_spriteCache[$imageName] = $meta->sprites[$imageURL]; |
|
805 | + // add imageURL to cache |
|
806 | + //$this->_spriteCache[$imageName]['imageURL'] = $imageURL; |
|
807 | + } else { |
|
808 | + $this->_spriteCache[$imageName] = false; |
|
809 | + $GLOBALS['log']->debug("Sprites: miss for $imageURL"); |
|
810 | + } |
|
811 | + return $this->_spriteCache[$imageName]; |
|
812 | + } |
|
813 | + |
|
814 | + /** |
|
815 | + * Returns sprite HTML span tag |
|
816 | + * |
|
817 | + * @param string class The md5 id used in the CSS sprites class |
|
818 | + * @param string attr optional, list of additional html attributes |
|
819 | + * @param string title optional, the title (equivalent to alt on img) |
|
820 | + * @return string HTML span tag |
|
821 | + */ |
|
822 | + public function getSprite($class, $attr, $title) { |
|
823 | + |
|
824 | + // handle multiple class tags |
|
825 | + $class_regex = '/class=["\']([^\'"]+)["\']/i'; |
|
826 | + preg_match($class_regex, $attr, $match); |
|
827 | + if(isset($match[1])) { |
|
828 | + $attr = preg_replace($class_regex, 'class="spr_'.$class.' ${1}"', $attr); |
|
829 | + |
|
830 | + // single class |
|
831 | + } else { |
|
832 | + $attr .= ' class="spr_'.$class.'"'; |
|
833 | + } |
|
834 | + |
|
835 | + if($title) |
|
836 | + $attr .= ' title="'.$title.'"'; |
|
837 | + |
|
838 | + // use </span> instead of /> to prevent weird UI results |
|
839 | + $GLOBALS['log']->debug("Sprites: generated sprite -> $attr"); |
|
840 | + return "<span {$attr}></span>"; |
|
771 | 841 | } |
772 | 842 | |
773 | - /** |
|
774 | - * Returns sprite meta data |
|
775 | - * |
|
776 | - * @param string $imageName Image filename including extension |
|
777 | - * @return array Sprite meta data |
|
778 | - */ |
|
779 | - public function getSpriteMeta($imageName) { |
|
780 | - |
|
781 | - // return from cache |
|
782 | - if(isset($this->_spriteCache[$imageName])) |
|
783 | - return $this->_spriteCache[$imageName]; |
|
784 | - |
|
785 | - // sprite keys are base on imageURL |
|
786 | - $imageURL = $this->getImageURL($imageName,false); |
|
787 | - if(empty($imageURL)) { |
|
788 | - $this->_spriteCache[$imageName] = false; |
|
789 | - return false; |
|
790 | - } |
|
791 | - |
|
792 | - // load meta data, includes default images |
|
793 | - require_once("include/SugarTheme/SugarSprites.php"); |
|
794 | - $meta = SugarSprites::getInstance(); |
|
795 | - // add current theme dir |
|
796 | - $meta->loadSpriteMeta($this->dirName); |
|
797 | - // add parent theme dir |
|
798 | - if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
799 | - $meta->loadSpriteMeta($parent->dirName); |
|
800 | - } |
|
801 | - |
|
802 | - // add to cache |
|
803 | - if(isset($meta->sprites[$imageURL])) { |
|
804 | - $this->_spriteCache[$imageName] = $meta->sprites[$imageURL]; |
|
805 | - // add imageURL to cache |
|
806 | - //$this->_spriteCache[$imageName]['imageURL'] = $imageURL; |
|
807 | - } else { |
|
808 | - $this->_spriteCache[$imageName] = false; |
|
809 | - $GLOBALS['log']->debug("Sprites: miss for $imageURL"); |
|
810 | - } |
|
811 | - return $this->_spriteCache[$imageName]; |
|
812 | - } |
|
813 | - |
|
814 | - /** |
|
815 | - * Returns sprite HTML span tag |
|
816 | - * |
|
817 | - * @param string class The md5 id used in the CSS sprites class |
|
818 | - * @param string attr optional, list of additional html attributes |
|
819 | - * @param string title optional, the title (equivalent to alt on img) |
|
820 | - * @return string HTML span tag |
|
821 | - */ |
|
822 | - public function getSprite($class, $attr, $title) { |
|
823 | - |
|
824 | - // handle multiple class tags |
|
825 | - $class_regex = '/class=["\']([^\'"]+)["\']/i'; |
|
826 | - preg_match($class_regex, $attr, $match); |
|
827 | - if(isset($match[1])) { |
|
828 | - $attr = preg_replace($class_regex, 'class="spr_'.$class.' ${1}"', $attr); |
|
829 | - |
|
830 | - // single class |
|
831 | - } else { |
|
832 | - $attr .= ' class="spr_'.$class.'"'; |
|
833 | - } |
|
834 | - |
|
835 | - if($title) |
|
836 | - $attr .= ' title="'.$title.'"'; |
|
837 | - |
|
838 | - // use </span> instead of /> to prevent weird UI results |
|
839 | - $GLOBALS['log']->debug("Sprites: generated sprite -> $attr"); |
|
840 | - return "<span {$attr}></span>"; |
|
841 | - } |
|
842 | - |
|
843 | - /** |
|
844 | - * Returns a link HTML tag with or without an embedded image |
|
845 | - */ |
|
843 | + /** |
|
844 | + * Returns a link HTML tag with or without an embedded image |
|
845 | + */ |
|
846 | 846 | public function getLink( |
847 | - $url, |
|
848 | - $title, |
|
849 | - $other_attributes = '', |
|
847 | + $url, |
|
848 | + $title, |
|
849 | + $other_attributes = '', |
|
850 | 850 | $img_name = '', |
851 | 851 | $img_other_attributes = '', |
852 | - $img_width = null, |
|
853 | - $img_height = null, |
|
854 | - $img_alt = '', |
|
855 | - $img_placement = 'imageonly' |
|
852 | + $img_width = null, |
|
853 | + $img_height = null, |
|
854 | + $img_alt = '', |
|
855 | + $img_placement = 'imageonly' |
|
856 | 856 | ) |
857 | 857 | { |
858 | 858 | |
859 | - if($img_name) { |
|
860 | - $img = $this->getImage($img_name, $img_other_attributes, $img_width, $img_height, null, $img_alt); |
|
861 | - if($img == false) { |
|
862 | - $GLOBALS['log']->debug('Sprites: unknown image getLink'); |
|
863 | - $img = 'unknown'; |
|
864 | - } |
|
865 | - switch($img_placement) { |
|
866 | - case 'left': $inner_html = $img."<span class='title'>".$title."</span>"; break; |
|
867 | - case 'right': $inner_html = "<span class='title'>".$title."</span>".$img; break; |
|
868 | - default: $inner_html = $img; break; |
|
869 | - } |
|
870 | - } else { |
|
871 | - $inner_html = $title; |
|
872 | - } |
|
859 | + if($img_name) { |
|
860 | + $img = $this->getImage($img_name, $img_other_attributes, $img_width, $img_height, null, $img_alt); |
|
861 | + if($img == false) { |
|
862 | + $GLOBALS['log']->debug('Sprites: unknown image getLink'); |
|
863 | + $img = 'unknown'; |
|
864 | + } |
|
865 | + switch($img_placement) { |
|
866 | + case 'left': $inner_html = $img."<span class='title'>".$title."</span>"; break; |
|
867 | + case 'right': $inner_html = "<span class='title'>".$title."</span>".$img; break; |
|
868 | + default: $inner_html = $img; break; |
|
869 | + } |
|
870 | + } else { |
|
871 | + $inner_html = $title; |
|
872 | + } |
|
873 | 873 | |
874 | - return '<a href="'.$url.'" title="'.$title.'" '.$other_attributes.'>'.$inner_html.'</a>'; |
|
874 | + return '<a href="'.$url.'" title="'.$title.'" '.$other_attributes.'>'.$inner_html.'</a>'; |
|
875 | 875 | |
876 | - } |
|
876 | + } |
|
877 | 877 | |
878 | 878 | /** |
879 | 879 | * Returns the URL for an image in the current theme. If not found in the current theme, will revert |
@@ -905,8 +905,8 @@ discard block |
||
905 | 905 | $imagePath = $filename; |
906 | 906 | elseif (($filename = $this->_getImageFileName($this->getDefaultImagePath().'/'.$imageName)) != '') |
907 | 907 | $imagePath = $filename; |
908 | - elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '') |
|
909 | - $imagePath = $filename; |
|
908 | + elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '') |
|
909 | + $imagePath = $filename; |
|
910 | 910 | else { |
911 | 911 | $GLOBALS['log']->warn("Image $imageName not found"); |
912 | 912 | return false; |
@@ -1040,8 +1040,8 @@ discard block |
||
1040 | 1040 | if (isset($this->parentTheme) |
1041 | 1041 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
1042 | 1042 | && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName,false)) != '' && !in_array($jsFileName,$this->ignoreParentFiles)) { |
1043 | - $jsFileContents .= file_get_contents($filename); |
|
1044 | - } else { |
|
1043 | + $jsFileContents .= file_get_contents($filename); |
|
1044 | + } else { |
|
1045 | 1045 | if (sugar_is_file($defaultFileName)) |
1046 | 1046 | $jsFileContents .= file_get_contents($defaultFileName); |
1047 | 1047 | if (sugar_is_file('custom/'.$defaultFileName)) |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * theme basis. |
47 | 47 | ********************************************************************************/ |
48 | 48 | |
49 | -if(!defined('JSMIN_AS_LIB')) |
|
49 | +if (!defined('JSMIN_AS_LIB')) |
|
50 | 50 | define('JSMIN_AS_LIB', true); |
51 | 51 | |
52 | 52 | require_once("include/SugarTheme/cssmin.php"); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @deprecated only here for BC during upgrades |
115 | 115 | * @var array |
116 | 116 | */ |
117 | - protected $fonts = array(); |
|
117 | + protected $fonts = array(); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Maximum sugar version this theme is for; defaults to 5.5.1 as all the themes without this |
@@ -292,44 +292,44 @@ discard block |
||
292 | 292 | ) |
293 | 293 | { |
294 | 294 | // apply parent theme's properties first |
295 | - if ( isset($defaults['parentTheme']) ) { |
|
295 | + if (isset($defaults['parentTheme'])) { |
|
296 | 296 | $themedef = array(); |
297 | 297 | include("themes/{$defaults['parentTheme']}/themedef.php"); |
298 | - foreach ( $themedef as $key => $value ) { |
|
299 | - if ( property_exists(__CLASS__,$key) ) { |
|
298 | + foreach ($themedef as $key => $value) { |
|
299 | + if (property_exists(__CLASS__, $key)) { |
|
300 | 300 | // For all arrays ( except colors and fonts ) you can just specify the items |
301 | 301 | // to change instead of all of the values |
302 | - if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) |
|
303 | - $this->$key = array_merge($this->$key,$value); |
|
302 | + if (is_array($this->$key) && !in_array($key, array('colors', 'fonts'))) |
|
303 | + $this->$key = array_merge($this->$key, $value); |
|
304 | 304 | else |
305 | 305 | $this->$key = $value; |
306 | 306 | } |
307 | 307 | } |
308 | 308 | } |
309 | - foreach ( $defaults as $key => $value ) { |
|
310 | - if ( property_exists(__CLASS__,$key) ) { |
|
309 | + foreach ($defaults as $key => $value) { |
|
310 | + if (property_exists(__CLASS__, $key)) { |
|
311 | 311 | // For all arrays ( except colors and fonts ) you can just specify the items |
312 | 312 | // to change instead of all of the values |
313 | - if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) |
|
314 | - $this->$key = array_merge($this->$key,$value); |
|
313 | + if (is_array($this->$key) && !in_array($key, array('colors', 'fonts'))) |
|
314 | + $this->$key = array_merge($this->$key, $value); |
|
315 | 315 | else |
316 | 316 | $this->$key = $value; |
317 | 317 | } |
318 | 318 | } |
319 | - if ( !inDeveloperMode() ) { |
|
320 | - if ( sugar_is_file($cachedfile = sugar_cached($this->getFilePath().'/pathCache.php'))) { |
|
319 | + if (!inDeveloperMode()) { |
|
320 | + if (sugar_is_file($cachedfile = sugar_cached($this->getFilePath().'/pathCache.php'))) { |
|
321 | 321 | $caches = unserialize(file_get_contents($cachedfile)); |
322 | - if ( isset($caches['jsCache']) ) |
|
322 | + if (isset($caches['jsCache'])) |
|
323 | 323 | $this->_jsCache = $caches['jsCache']; |
324 | - if ( isset($caches['cssCache']) ) |
|
324 | + if (isset($caches['cssCache'])) |
|
325 | 325 | $this->_cssCache = $caches['cssCache']; |
326 | - if ( isset($caches['imageCache']) ) |
|
326 | + if (isset($caches['imageCache'])) |
|
327 | 327 | $this->_imageCache = $caches['imageCache']; |
328 | - if ( isset($caches['templateCache']) ) |
|
328 | + if (isset($caches['templateCache'])) |
|
329 | 329 | $this->_templateCache = $caches['templateCache']; |
330 | 330 | } |
331 | 331 | $cachedfile = sugar_cached($this->getFilePath().'/spriteCache.php'); |
332 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && sugar_is_file($cachedfile)) { |
|
332 | + if (!empty($GLOBALS['sugar_config']['use_sprites']) && sugar_is_file($cachedfile)) { |
|
333 | 333 | $this->_spriteCache = unserialize(sugar_file_get_contents($cachedfile)); |
334 | 334 | } |
335 | 335 | } |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | public function __wakeup() |
349 | 349 | { |
350 | 350 | // clean all properties |
351 | - foreach(get_object_vars($this) as $k => $v) { |
|
351 | + foreach (get_object_vars($this) as $k => $v) { |
|
352 | 352 | $this->$k = null; |
353 | 353 | } |
354 | 354 | throw new Exception("Not a serializable object"); |
@@ -361,14 +361,14 @@ discard block |
||
361 | 361 | public function __destruct() |
362 | 362 | { |
363 | 363 | // Set the current directory to one which we expect it to be (i.e. the root directory of the install |
364 | - $dir = realpath(dirname(__FILE__) . '/../..'); |
|
364 | + $dir = realpath(dirname(__FILE__).'/../..'); |
|
365 | 365 | static $includePathIsPatched = false; |
366 | 366 | if ($includePathIsPatched == false) |
367 | 367 | { |
368 | 368 | $path = explode(PATH_SEPARATOR, get_include_path()); |
369 | 369 | if (in_array($dir, $path) == false) |
370 | 370 | { |
371 | - set_include_path($dir . PATH_SEPARATOR . get_include_path()); |
|
371 | + set_include_path($dir.PATH_SEPARATOR.get_include_path()); |
|
372 | 372 | } |
373 | 373 | $includePathIsPatched = true; |
374 | 374 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $cachedir = sugar_cached($this->getFilePath()); |
377 | 377 | sugar_mkdir($cachedir, 0775, true); |
378 | 378 | // clear out the cache on destroy if we are asked to |
379 | - if ( $this->_clearCacheOnDestroy ) { |
|
379 | + if ($this->_clearCacheOnDestroy) { |
|
380 | 380 | |
381 | 381 | if (is_file("$cachedir/pathCache.php")) |
382 | 382 | unlink("$cachedir/pathCache.php"); |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | unlink("$cachedir/spriteCache.php"); |
385 | 385 | |
386 | 386 | } |
387 | - elseif ( !inDeveloperMode() ) { |
|
387 | + elseif (!inDeveloperMode()) { |
|
388 | 388 | // only update the caches if they have been changed in this request |
389 | - if ( count($this->_jsCache) != $this->_initialCacheSize['jsCache'] |
|
389 | + if (count($this->_jsCache) != $this->_initialCacheSize['jsCache'] |
|
390 | 390 | || count($this->_cssCache) != $this->_initialCacheSize['cssCache'] |
391 | 391 | || count($this->_imageCache) != $this->_initialCacheSize['imageCache'] |
392 | 392 | || count($this->_templateCache) != $this->_initialCacheSize['templateCache'] |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | ); |
405 | 405 | |
406 | 406 | } |
407 | - if ( count($this->_spriteCache) != $this->_initialCacheSize['spriteCache']) { |
|
407 | + if (count($this->_spriteCache) != $this->_initialCacheSize['spriteCache']) { |
|
408 | 408 | sugar_file_put_contents( |
409 | 409 | "$cachedir/spriteCache.php", |
410 | 410 | serialize($this->_spriteCache) |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | $key |
434 | 434 | ) |
435 | 435 | { |
436 | - if ( isset($this->$key) ) |
|
436 | + if (isset($this->$key)) |
|
437 | 437 | return $this->$key; |
438 | 438 | } |
439 | 439 | |
440 | - public function __isset($key){ |
|
440 | + public function __isset($key) { |
|
441 | 441 | return isset($this->$key); |
442 | 442 | |
443 | 443 | } |
@@ -604,38 +604,38 @@ discard block |
||
604 | 604 | |
605 | 605 | |
606 | 606 | // sprites |
607 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
607 | + if (!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
608 | 608 | |
609 | 609 | // system wide sprites |
610 | - if(file_exists("cache/sprites/default/sprites.css")) |
|
610 | + if (file_exists("cache/sprites/default/sprites.css")) |
|
611 | 611 | $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />'; |
612 | 612 | |
613 | 613 | // theme specific sprites |
614 | - if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) |
|
614 | + if (file_exists("cache/sprites/{$this->dirName}/sprites.css")) |
|
615 | 615 | $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />'; |
616 | 616 | |
617 | 617 | // parent sprites |
618 | - if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
619 | - if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) |
|
618 | + if ($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
619 | + if (file_exists("cache/sprites/{$parent->dirName}/sprites.css")) |
|
620 | 620 | $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />'; |
621 | 621 | } |
622 | 622 | |
623 | 623 | // repeatable sprites |
624 | - if(file_exists("cache/sprites/Repeatable/sprites.css")) |
|
624 | + if (file_exists("cache/sprites/Repeatable/sprites.css")) |
|
625 | 625 | $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />'; |
626 | 626 | } |
627 | 627 | |
628 | 628 | // for BC during upgrade |
629 | - if ( !empty($this->colors) ) { |
|
630 | - if ( isset($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $this->colors)) |
|
629 | + if (!empty($this->colors)) { |
|
630 | + if (isset($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $this->colors)) |
|
631 | 631 | $color = $_SESSION['authenticated_user_theme_color']; |
632 | 632 | else |
633 | 633 | $color = $this->colors[0]; |
634 | 634 | $html .= '<link rel="stylesheet" type="text/css" href="'.$this->getCSSURL('colors.'.$color.'.css').'" id="current_color_style" />'; |
635 | 635 | } |
636 | 636 | |
637 | - if ( !empty($this->fonts) ) { |
|
638 | - if ( isset($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $this->fonts)) |
|
637 | + if (!empty($this->fonts)) { |
|
638 | + if (isset($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $this->fonts)) |
|
639 | 639 | $font = $_SESSION['authenticated_user_theme_font']; |
640 | 640 | else |
641 | 641 | $font = $this->fonts[0]; |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | $templateName |
670 | 670 | ) |
671 | 671 | { |
672 | - if ( isset($this->_templateCache[$templateName]) ) |
|
672 | + if (isset($this->_templateCache[$templateName])) |
|
673 | 673 | return $this->_templateCache[$templateName]; |
674 | 674 | |
675 | 675 | $templatePath = ''; |
@@ -719,28 +719,28 @@ discard block |
||
719 | 719 | static $cached_results = array(); |
720 | 720 | |
721 | 721 | // trap deprecated use of image extension |
722 | - if(is_null($ext)) { |
|
723 | - $imageNameExp = explode('.',$imageName); |
|
724 | - if(count($imageNameExp) == 1) |
|
722 | + if (is_null($ext)) { |
|
723 | + $imageNameExp = explode('.', $imageName); |
|
724 | + if (count($imageNameExp) == 1) |
|
725 | 725 | $imageName .= '.gif'; |
726 | 726 | } else { |
727 | 727 | $imageName .= $ext; |
728 | 728 | } |
729 | 729 | |
730 | 730 | // trap alt attributes in other_attributes |
731 | - if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) |
|
731 | + if (preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) |
|
732 | 732 | $GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName"); |
733 | 733 | // sprite handler, makes use of own caching mechanism |
734 | - if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
734 | + if (!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
|
735 | 735 | // get sprite metadata |
736 | - if($sp = $this->getSpriteMeta($imageName)) { |
|
736 | + if ($sp = $this->getSpriteMeta($imageName)) { |
|
737 | 737 | // requested size should match |
738 | - if( (!is_null($width) && $sp['width'] == $width) || (is_null($width)) && |
|
739 | - (!is_null($height) && $sp['height'] == $height) || (is_null($height)) ) |
|
738 | + if ((!is_null($width) && $sp['width'] == $width) || (is_null($width)) && |
|
739 | + (!is_null($height) && $sp['height'] == $height) || (is_null($height))) |
|
740 | 740 | { |
741 | 741 | $other_attributes .= ' data-orig="'.$imageName.'"'; |
742 | 742 | |
743 | - if($sprite = $this->getSprite($sp['class'], $other_attributes, $alt)) |
|
743 | + if ($sprite = $this->getSprite($sp['class'], $other_attributes, $alt)) |
|
744 | 744 | { |
745 | 745 | return $sprite; |
746 | 746 | } |
@@ -749,11 +749,11 @@ discard block |
||
749 | 749 | } |
750 | 750 | |
751 | 751 | // img caching |
752 | - if(empty($cached_results[$imageName])) { |
|
753 | - $imageURL = $this->getImageURL($imageName,false); |
|
754 | - if ( empty($imageURL) ) |
|
752 | + if (empty($cached_results[$imageName])) { |
|
753 | + $imageURL = $this->getImageURL($imageName, false); |
|
754 | + if (empty($imageURL)) |
|
755 | 755 | return false; |
756 | - if(strpos($imageURL, '.svg', strlen($imageURL)-4)){ |
|
756 | + if (strpos($imageURL, '.svg', strlen($imageURL) - 4)) { |
|
757 | 757 | $cached_results[$imageName] = file_get_contents($imageURL); |
758 | 758 | } else { |
759 | 759 | $cached_results[$imageName] = '<img src="'.getJSPath($imageURL).'" '; |
@@ -764,10 +764,10 @@ discard block |
||
764 | 764 | $attr_width = (is_null($width)) ? "" : "width=\"$width\""; |
765 | 765 | $attr_height = (is_null($height)) ? "" : "height=\"$height\""; |
766 | 766 | |
767 | - if(strpos($cached_results[$imageName], 'svg') !== false){ |
|
767 | + if (strpos($cached_results[$imageName], 'svg') !== false) { |
|
768 | 768 | return $cached_results[$imageName]; |
769 | 769 | } |
770 | - return $cached_results[$imageName] . " $attr_width $attr_height $other_attributes alt=\"$alt\" />"; |
|
770 | + return $cached_results[$imageName]." $attr_width $attr_height $other_attributes alt=\"$alt\" />"; |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | /** |
@@ -779,12 +779,12 @@ discard block |
||
779 | 779 | public function getSpriteMeta($imageName) { |
780 | 780 | |
781 | 781 | // return from cache |
782 | - if(isset($this->_spriteCache[$imageName])) |
|
782 | + if (isset($this->_spriteCache[$imageName])) |
|
783 | 783 | return $this->_spriteCache[$imageName]; |
784 | 784 | |
785 | 785 | // sprite keys are base on imageURL |
786 | - $imageURL = $this->getImageURL($imageName,false); |
|
787 | - if(empty($imageURL)) { |
|
786 | + $imageURL = $this->getImageURL($imageName, false); |
|
787 | + if (empty($imageURL)) { |
|
788 | 788 | $this->_spriteCache[$imageName] = false; |
789 | 789 | return false; |
790 | 790 | } |
@@ -795,12 +795,12 @@ discard block |
||
795 | 795 | // add current theme dir |
796 | 796 | $meta->loadSpriteMeta($this->dirName); |
797 | 797 | // add parent theme dir |
798 | - if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
798 | + if ($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
|
799 | 799 | $meta->loadSpriteMeta($parent->dirName); |
800 | 800 | } |
801 | 801 | |
802 | 802 | // add to cache |
803 | - if(isset($meta->sprites[$imageURL])) { |
|
803 | + if (isset($meta->sprites[$imageURL])) { |
|
804 | 804 | $this->_spriteCache[$imageName] = $meta->sprites[$imageURL]; |
805 | 805 | // add imageURL to cache |
806 | 806 | //$this->_spriteCache[$imageName]['imageURL'] = $imageURL; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | // handle multiple class tags |
825 | 825 | $class_regex = '/class=["\']([^\'"]+)["\']/i'; |
826 | 826 | preg_match($class_regex, $attr, $match); |
827 | - if(isset($match[1])) { |
|
827 | + if (isset($match[1])) { |
|
828 | 828 | $attr = preg_replace($class_regex, 'class="spr_'.$class.' ${1}"', $attr); |
829 | 829 | |
830 | 830 | // single class |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $attr .= ' class="spr_'.$class.'"'; |
833 | 833 | } |
834 | 834 | |
835 | - if($title) |
|
835 | + if ($title) |
|
836 | 836 | $attr .= ' title="'.$title.'"'; |
837 | 837 | |
838 | 838 | // use </span> instead of /> to prevent weird UI results |
@@ -856,13 +856,13 @@ discard block |
||
856 | 856 | ) |
857 | 857 | { |
858 | 858 | |
859 | - if($img_name) { |
|
859 | + if ($img_name) { |
|
860 | 860 | $img = $this->getImage($img_name, $img_other_attributes, $img_width, $img_height, null, $img_alt); |
861 | - if($img == false) { |
|
861 | + if ($img == false) { |
|
862 | 862 | $GLOBALS['log']->debug('Sprites: unknown image getLink'); |
863 | 863 | $img = 'unknown'; |
864 | 864 | } |
865 | - switch($img_placement) { |
|
865 | + switch ($img_placement) { |
|
866 | 866 | case 'left': $inner_html = $img."<span class='title'>".$title."</span>"; break; |
867 | 867 | case 'right': $inner_html = "<span class='title'>".$title."</span>".$img; break; |
868 | 868 | default: $inner_html = $img; break; |
@@ -885,9 +885,9 @@ discard block |
||
885 | 885 | public function getImageURL( |
886 | 886 | $imageName, |
887 | 887 | $addJSPath = true |
888 | - ){ |
|
889 | - if ( isset($this->_imageCache[$imageName]) ) { |
|
890 | - if ( $addJSPath ) |
|
888 | + ) { |
|
889 | + if (isset($this->_imageCache[$imageName])) { |
|
890 | + if ($addJSPath) |
|
891 | 891 | return getJSPath($this->_imageCache[$imageName]); |
892 | 892 | else |
893 | 893 | return $this->_imageCache[$imageName]; |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | $imagePath = $filename; |
900 | 900 | elseif (isset($this->parentTheme) |
901 | 901 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
902 | - && ($filename = SugarThemeRegistry::get($this->parentTheme)->getImageURL($imageName,false)) != '') |
|
902 | + && ($filename = SugarThemeRegistry::get($this->parentTheme)->getImageURL($imageName, false)) != '') |
|
903 | 903 | $imagePath = $filename; |
904 | 904 | elseif (($filename = $this->_getImageFileName('custom/'.$this->getDefaultImagePath().'/'.$imageName)) != '') |
905 | 905 | $imagePath = $filename; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | |
915 | 915 | $this->_imageCache[$imageName] = $imagePath; |
916 | 916 | |
917 | - if ( $addJSPath ) |
|
917 | + if ($addJSPath) |
|
918 | 918 | return getJSPath($imagePath); |
919 | 919 | |
920 | 920 | return $imagePath; |
@@ -931,13 +931,13 @@ discard block |
||
931 | 931 | ) |
932 | 932 | { |
933 | 933 | // return now if the extension matches that of which we are looking for |
934 | - if ( sugar_is_file($imageName) ) |
|
934 | + if (sugar_is_file($imageName)) |
|
935 | 935 | return $imageName; |
936 | 936 | $pathParts = pathinfo($imageName); |
937 | - foreach ( $this->imageExtensions as $extension ) |
|
938 | - if ( isset($pathParts['extension']) ) |
|
939 | - if ( ( $extension != $pathParts['extension'] ) |
|
940 | - && sugar_is_file($pathParts['dirname'].'/'.$pathParts['filename'].'.'.$extension) ) |
|
937 | + foreach ($this->imageExtensions as $extension) |
|
938 | + if (isset($pathParts['extension'])) |
|
939 | + if (($extension != $pathParts['extension']) |
|
940 | + && sugar_is_file($pathParts['dirname'].'/'.$pathParts['filename'].'.'.$extension)) |
|
941 | 941 | return $pathParts['dirname'].'/'.$pathParts['filename'].'.'.$extension; |
942 | 942 | |
943 | 943 | return ''; |
@@ -953,8 +953,8 @@ discard block |
||
953 | 953 | */ |
954 | 954 | public function getCSSURL($cssFileName, $returnURL = true) |
955 | 955 | { |
956 | - if ( isset($this->_cssCache[$cssFileName]) && sugar_is_file(sugar_cached($this->_cssCache[$cssFileName])) ) { |
|
957 | - if ( $returnURL ) |
|
956 | + if (isset($this->_cssCache[$cssFileName]) && sugar_is_file(sugar_cached($this->_cssCache[$cssFileName]))) { |
|
957 | + if ($returnURL) |
|
958 | 958 | return getJSPath("cache/".$this->_cssCache[$cssFileName]); |
959 | 959 | else |
960 | 960 | return sugar_cached($this->_cssCache[$cssFileName]); |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $fullFileName = $this->getCSSPath().'/'.$cssFileName; |
966 | 966 | if (isset($this->parentTheme) |
967 | 967 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
968 | - && ($filename = SugarThemeRegistry::get($this->parentTheme)->getCSSURL($cssFileName,false)) != '') |
|
968 | + && ($filename = SugarThemeRegistry::get($this->parentTheme)->getCSSURL($cssFileName, false)) != '') |
|
969 | 969 | $cssFileContents .= file_get_contents($filename); |
970 | 970 | else { |
971 | 971 | if (sugar_is_file($defaultFileName)) |
@@ -994,24 +994,24 @@ discard block |
||
994 | 994 | |
995 | 995 | // if this is the style.css file, prepend the base.css and calendar-win2k-cold-1.css |
996 | 996 | // files before the theme styles |
997 | - if ( $cssFileName == 'style.css' && !isset($this->parentTheme) ) { |
|
998 | - if ( inDeveloperMode() ) |
|
999 | - $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css') . $cssFileContents; |
|
997 | + if ($cssFileName == 'style.css' && !isset($this->parentTheme)) { |
|
998 | + if (inDeveloperMode()) |
|
999 | + $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css').$cssFileContents; |
|
1000 | 1000 | else |
1001 | - $cssFileContents = file_get_contents('include/javascript/yui/build/base/base-min.css') . $cssFileContents; |
|
1001 | + $cssFileContents = file_get_contents('include/javascript/yui/build/base/base-min.css').$cssFileContents; |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | // minify the css |
1005 | - if ( !inDeveloperMode() && !sugar_is_file($cssFilePath) ) { |
|
1005 | + if (!inDeveloperMode() && !sugar_is_file($cssFilePath)) { |
|
1006 | 1006 | $cssFileContents = cssmin::minify($cssFileContents); |
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | // now write the css to cache |
1010 | - sugar_file_put_contents($cssFilePath,$cssFileContents); |
|
1010 | + sugar_file_put_contents($cssFilePath, $cssFileContents); |
|
1011 | 1011 | |
1012 | 1012 | $this->_cssCache[$cssFileName] = $fullFileName; |
1013 | 1013 | |
1014 | - if ( $returnURL ) |
|
1014 | + if ($returnURL) |
|
1015 | 1015 | return getJSPath("cache/".$fullFileName); |
1016 | 1016 | |
1017 | 1017 | return sugar_cached($fullFileName); |
@@ -1027,8 +1027,8 @@ discard block |
||
1027 | 1027 | */ |
1028 | 1028 | public function getJSURL($jsFileName, $returnURL = true) |
1029 | 1029 | { |
1030 | - if ( isset($this->_jsCache[$jsFileName]) && sugar_is_file(sugar_cached($this->_jsCache[$jsFileName])) ) { |
|
1031 | - if ( $returnURL ) |
|
1030 | + if (isset($this->_jsCache[$jsFileName]) && sugar_is_file(sugar_cached($this->_jsCache[$jsFileName]))) { |
|
1031 | + if ($returnURL) |
|
1032 | 1032 | return getJSPath("cache/".$this->_jsCache[$jsFileName]); |
1033 | 1033 | else |
1034 | 1034 | return sugar_cached($this->_jsCache[$jsFileName]); |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | $defaultFileName = $this->getDefaultJSPath().'/'.$jsFileName; |
1040 | 1040 | if (isset($this->parentTheme) |
1041 | 1041 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
1042 | - && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName,false)) != '' && !in_array($jsFileName,$this->ignoreParentFiles)) { |
|
1042 | + && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName, false)) != '' && !in_array($jsFileName, $this->ignoreParentFiles)) { |
|
1043 | 1043 | $jsFileContents .= file_get_contents($filename); |
1044 | 1044 | } else { |
1045 | 1045 | if (sugar_is_file($defaultFileName)) |
@@ -1060,18 +1060,18 @@ discard block |
||
1060 | 1060 | $jsFilePath = create_cache_directory($fullFileName); |
1061 | 1061 | |
1062 | 1062 | // minify the js |
1063 | - if ( !inDeveloperMode()&& !sugar_is_file(str_replace('.js','-min.js',$jsFilePath)) ) { |
|
1063 | + if (!inDeveloperMode() && !sugar_is_file(str_replace('.js', '-min.js', $jsFilePath))) { |
|
1064 | 1064 | $jsFileContents = SugarMin::minify($jsFileContents); |
1065 | - $jsFilePath = str_replace('.js','-min.js',$jsFilePath); |
|
1066 | - $fullFileName = str_replace('.js','-min.js',$fullFileName); |
|
1065 | + $jsFilePath = str_replace('.js', '-min.js', $jsFilePath); |
|
1066 | + $fullFileName = str_replace('.js', '-min.js', $fullFileName); |
|
1067 | 1067 | } |
1068 | 1068 | |
1069 | 1069 | // now write the js to cache |
1070 | - sugar_file_put_contents($jsFilePath,$jsFileContents); |
|
1070 | + sugar_file_put_contents($jsFilePath, $jsFileContents); |
|
1071 | 1071 | |
1072 | 1072 | $this->_jsCache[$jsFileName] = $fullFileName; |
1073 | 1073 | |
1074 | - if ( $returnURL ) |
|
1074 | + if ($returnURL) |
|
1075 | 1075 | return getJSPath("cache/".$fullFileName); |
1076 | 1076 | |
1077 | 1077 | return sugar_cached($fullFileName); |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | // first, lets get all the paths of where to look |
1088 | 1088 | $pathsToSearch = array($this->getImagePath()); |
1089 | 1089 | $theme = $this; |
1090 | - while (isset($theme->parentTheme) && SugarThemeRegistry::get($theme->parentTheme) instanceOf SugarTheme ) { |
|
1090 | + while (isset($theme->parentTheme) && SugarThemeRegistry::get($theme->parentTheme) instanceOf SugarTheme) { |
|
1091 | 1091 | $theme = SugarThemeRegistry::get($theme->parentTheme); |
1092 | 1092 | $pathsToSearch[] = $theme->getImagePath(); |
1093 | 1093 | } |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | // now build the array |
1097 | 1097 | $imageArray = array(); |
1098 | - foreach ( $pathsToSearch as $path ) |
|
1098 | + foreach ($pathsToSearch as $path) |
|
1099 | 1099 | { |
1100 | 1100 | if (!sugar_is_dir($path)) $path = "custom/$path"; |
1101 | 1101 | if (sugar_is_dir($path) && is_readable($path) && $dir = opendir($path)) { |
@@ -1107,8 +1107,8 @@ discard block |
||
1107 | 1107 | || $file == "Attic" |
1108 | 1108 | ) |
1109 | 1109 | continue; |
1110 | - if ( !isset($imageArray[$file]) ) |
|
1111 | - $imageArray[$file] = $this->getImageURL($file,false); |
|
1110 | + if (!isset($imageArray[$file])) |
|
1111 | + $imageArray[$file] = $this->getImageURL($file, false); |
|
1112 | 1112 | } |
1113 | 1113 | closedir($dir); |
1114 | 1114 | } |
@@ -1130,13 +1130,13 @@ discard block |
||
1130 | 1130 | |
1131 | 1131 | $config = array(); |
1132 | 1132 | |
1133 | - foreach($this->config_options as $name => $def){ |
|
1133 | + foreach ($this->config_options as $name => $def) { |
|
1134 | 1134 | $config[$name] = $def; |
1135 | 1135 | |
1136 | 1136 | $value = ''; |
1137 | - if(isset($sugar_config['theme_settings'][$this->dirName][$name])){ |
|
1137 | + if (isset($sugar_config['theme_settings'][$this->dirName][$name])) { |
|
1138 | 1138 | $value = $sugar_config['theme_settings'][$this->dirName][$name]; |
1139 | - } else if(isset($def['default'])){ |
|
1139 | + } else if (isset($def['default'])) { |
|
1140 | 1140 | $value = $def['default']; |
1141 | 1141 | } |
1142 | 1142 | $config[$name] = $value; |
@@ -1189,28 +1189,28 @@ discard block |
||
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | // Assume theme is designed for 5.5.x if not specified otherwise |
1192 | - if ( !isset($themedef['version']) ) |
|
1192 | + if (!isset($themedef['version'])) |
|
1193 | 1193 | $themedef['version']['regex_matches'] = array('5\.5\.*'); |
1194 | 1194 | |
1195 | 1195 | // Check to see if theme is valid for this version of Sugar; return false if not |
1196 | 1196 | $version_ok = false; |
1197 | - if( isset($themedef['version']['exact_matches']) ){ |
|
1197 | + if (isset($themedef['version']['exact_matches'])) { |
|
1198 | 1198 | $matches_empty = false; |
1199 | - foreach( $themedef['version']['exact_matches'] as $match ){ |
|
1200 | - if( $match == $GLOBALS['sugar_version'] ){ |
|
1199 | + foreach ($themedef['version']['exact_matches'] as $match) { |
|
1200 | + if ($match == $GLOBALS['sugar_version']) { |
|
1201 | 1201 | $version_ok = true; |
1202 | 1202 | } |
1203 | 1203 | } |
1204 | 1204 | } |
1205 | - if( !$version_ok && isset($themedef['version']['regex_matches']) ){ |
|
1205 | + if (!$version_ok && isset($themedef['version']['regex_matches'])) { |
|
1206 | 1206 | $matches_empty = false; |
1207 | - foreach( $themedef['version']['regex_matches'] as $match ){ |
|
1208 | - if( preg_match( "/$match/", $GLOBALS['sugar_version'] ) ){ |
|
1207 | + foreach ($themedef['version']['regex_matches'] as $match) { |
|
1208 | + if (preg_match("/$match/", $GLOBALS['sugar_version'])) { |
|
1209 | 1209 | $version_ok = true; |
1210 | 1210 | } |
1211 | 1211 | } |
1212 | 1212 | } |
1213 | - if ( !$version_ok ) |
|
1213 | + if (!$version_ok) |
|
1214 | 1214 | return false; |
1215 | 1215 | |
1216 | 1216 | $theme = new SugarTheme($themedef); |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | $themeName |
1227 | 1227 | ) |
1228 | 1228 | { |
1229 | - if ( self::exists($themeName) ) |
|
1229 | + if (self::exists($themeName)) |
|
1230 | 1230 | unset(self::$_themes[$themeName]); |
1231 | 1231 | } |
1232 | 1232 | |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | $themeName |
1240 | 1240 | ) |
1241 | 1241 | { |
1242 | - if ( isset(self::$_themes[$themeName]) ) |
|
1242 | + if (isset(self::$_themes[$themeName])) |
|
1243 | 1243 | return self::$_themes[$themeName]; |
1244 | 1244 | } |
1245 | 1245 | |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | */ |
1251 | 1251 | public static function current() |
1252 | 1252 | { |
1253 | - if ( !isset(self::$_currentTheme) ) |
|
1253 | + if (!isset(self::$_currentTheme)) |
|
1254 | 1254 | self::buildRegistry(); |
1255 | 1255 | |
1256 | 1256 | return self::$_themes[self::$_currentTheme]; |
@@ -1263,10 +1263,10 @@ discard block |
||
1263 | 1263 | */ |
1264 | 1264 | public static function getDefault() |
1265 | 1265 | { |
1266 | - if ( !isset(self::$_currentTheme) ) |
|
1266 | + if (!isset(self::$_currentTheme)) |
|
1267 | 1267 | self::buildRegistry(); |
1268 | 1268 | |
1269 | - if ( isset($GLOBALS['sugar_config']['default_theme']) && self::exists($GLOBALS['sugar_config']['default_theme']) ) { |
|
1269 | + if (isset($GLOBALS['sugar_config']['default_theme']) && self::exists($GLOBALS['sugar_config']['default_theme'])) { |
|
1270 | 1270 | return self::get($GLOBALS['sugar_config']['default_theme']); |
1271 | 1271 | } |
1272 | 1272 | $array_keys = array_keys(self::availableThemes()); |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $themeName |
1296 | 1296 | ) |
1297 | 1297 | { |
1298 | - if ( !self::exists($themeName) ) |
|
1298 | + if (!self::exists($themeName)) |
|
1299 | 1299 | return false; |
1300 | 1300 | |
1301 | 1301 | self::$_currentTheme = $themeName; |
@@ -1312,17 +1312,17 @@ discard block |
||
1312 | 1312 | public static function buildRegistry() |
1313 | 1313 | { |
1314 | 1314 | self::$_themes = array(); |
1315 | - $dirs = array("themes/","custom/themes/"); |
|
1315 | + $dirs = array("themes/", "custom/themes/"); |
|
1316 | 1316 | |
1317 | 1317 | // check for a default themedef file |
1318 | 1318 | $themedefDefault = array(); |
1319 | - if ( sugar_is_file("custom/themes/default/themedef.php") ) { |
|
1319 | + if (sugar_is_file("custom/themes/default/themedef.php")) { |
|
1320 | 1320 | $themedef = array(); |
1321 | 1321 | require("custom/themes/default/themedef.php"); |
1322 | 1322 | $themedefDefault = $themedef; |
1323 | 1323 | } |
1324 | 1324 | |
1325 | - foreach ($dirs as $dirPath ) { |
|
1325 | + foreach ($dirs as $dirPath) { |
|
1326 | 1326 | if (sugar_is_dir('./'.$dirPath) && is_readable('./'.$dirPath) && $dir = opendir('./'.$dirPath)) { |
1327 | 1327 | while (($file = readdir($dir)) !== false) { |
1328 | 1328 | if ($file == ".." |
@@ -1337,18 +1337,18 @@ discard block |
||
1337 | 1337 | continue; |
1338 | 1338 | $themedef = array(); |
1339 | 1339 | require("./{$dirPath}{$file}/themedef.php"); |
1340 | - $themedef = array_merge($themedef,$themedefDefault); |
|
1340 | + $themedef = array_merge($themedef, $themedefDefault); |
|
1341 | 1341 | $themedef['dirName'] = $file; |
1342 | 1342 | // check for theme already existing in the registry |
1343 | 1343 | // if so, then it will override the current one |
1344 | - if ( self::exists($themedef['dirName']) ) { |
|
1344 | + if (self::exists($themedef['dirName'])) { |
|
1345 | 1345 | $existingTheme = self::get($themedef['dirName']); |
1346 | - foreach ( SugarTheme::getThemeDefFields() as $field ) |
|
1347 | - if ( !isset($themedef[$field]) ) |
|
1346 | + foreach (SugarTheme::getThemeDefFields() as $field) |
|
1347 | + if (!isset($themedef[$field])) |
|
1348 | 1348 | $themedef[$field] = $existingTheme->$field; |
1349 | 1349 | self::remove($themedef['dirName']); |
1350 | 1350 | } |
1351 | - if ( isset($themedef['name']) ) { |
|
1351 | + if (isset($themedef['name'])) { |
|
1352 | 1352 | self::add($themedef); |
1353 | 1353 | } |
1354 | 1354 | } |
@@ -1356,8 +1356,8 @@ discard block |
||
1356 | 1356 | } |
1357 | 1357 | } |
1358 | 1358 | // default to setting the default theme as the current theme |
1359 | - if ( !isset($GLOBALS['sugar_config']['default_theme']) || !self::set($GLOBALS['sugar_config']['default_theme']) ) { |
|
1360 | - if ( count(self::availableThemes()) == 0 ) |
|
1359 | + if (!isset($GLOBALS['sugar_config']['default_theme']) || !self::set($GLOBALS['sugar_config']['default_theme'])) { |
|
1360 | + if (count(self::availableThemes()) == 0) |
|
1361 | 1361 | { |
1362 | 1362 | sugar_die('No valid themes are found on this instance'); |
1363 | 1363 | } else { |
@@ -1379,9 +1379,9 @@ discard block |
||
1379 | 1379 | private static function getDefaultThemeKey() |
1380 | 1380 | { |
1381 | 1381 | $availableThemes = self::availableThemes(); |
1382 | - foreach($availableThemes as $key=>$theme) |
|
1382 | + foreach ($availableThemes as $key=>$theme) |
|
1383 | 1383 | { |
1384 | - if(strtolower($key) == 'sugar') |
|
1384 | + if (strtolower($key) == 'sugar') |
|
1385 | 1385 | { |
1386 | 1386 | return $key; |
1387 | 1387 | } |
@@ -1400,11 +1400,11 @@ discard block |
||
1400 | 1400 | { |
1401 | 1401 | $themelist = array(); |
1402 | 1402 | $disabledThemes = array(); |
1403 | - if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) |
|
1404 | - $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']); |
|
1403 | + if (isset($GLOBALS['sugar_config']['disabled_themes'])) |
|
1404 | + $disabledThemes = explode(',', $GLOBALS['sugar_config']['disabled_themes']); |
|
1405 | 1405 | |
1406 | - foreach ( self::$_themes as $themename => $themeobject ) { |
|
1407 | - if ( in_array($themename,$disabledThemes) ) |
|
1406 | + foreach (self::$_themes as $themename => $themeobject) { |
|
1407 | + if (in_array($themename, $disabledThemes)) |
|
1408 | 1408 | continue; |
1409 | 1409 | $themelist[$themeobject->dirName] = $themeobject->name; |
1410 | 1410 | } |
@@ -1421,11 +1421,11 @@ discard block |
||
1421 | 1421 | { |
1422 | 1422 | $themelist = array(); |
1423 | 1423 | $disabledThemes = array(); |
1424 | - if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) |
|
1425 | - $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']); |
|
1424 | + if (isset($GLOBALS['sugar_config']['disabled_themes'])) |
|
1425 | + $disabledThemes = explode(',', $GLOBALS['sugar_config']['disabled_themes']); |
|
1426 | 1426 | |
1427 | - foreach ( self::$_themes as $themename => $themeobject ) { |
|
1428 | - if ( in_array($themename,$disabledThemes) ) |
|
1427 | + foreach (self::$_themes as $themename => $themeobject) { |
|
1428 | + if (in_array($themename, $disabledThemes)) |
|
1429 | 1429 | $themelist[$themeobject->dirName] = $themeobject->name; |
1430 | 1430 | } |
1431 | 1431 | |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | { |
1442 | 1442 | $themelist = array(); |
1443 | 1443 | |
1444 | - foreach ( self::$_themes as $themename => $themeobject ) |
|
1444 | + foreach (self::$_themes as $themename => $themeobject) |
|
1445 | 1445 | $themelist[$themeobject->dirName] = $themeobject->name; |
1446 | 1446 | |
1447 | 1447 | return $themelist; |
@@ -1478,18 +1478,18 @@ discard block |
||
1478 | 1478 | { |
1479 | 1479 | global $sugar_config; |
1480 | 1480 | |
1481 | - if ( !self::exists($themeName) ) |
|
1481 | + if (!self::exists($themeName)) |
|
1482 | 1482 | return false; |
1483 | 1483 | |
1484 | 1484 | $config = array(); |
1485 | 1485 | |
1486 | - foreach(self::$_themes[$themeName]->config_options as $name => $def){ |
|
1486 | + foreach (self::$_themes[$themeName]->config_options as $name => $def) { |
|
1487 | 1487 | $config[$name] = $def; |
1488 | 1488 | |
1489 | 1489 | $value = ''; |
1490 | - if(isset($sugar_config['theme_settings'][$themeName][$name])){ |
|
1490 | + if (isset($sugar_config['theme_settings'][$themeName][$name])) { |
|
1491 | 1491 | $value = $sugar_config['theme_settings'][$themeName][$name]; |
1492 | - } else if(isset($def['default'])){ |
|
1492 | + } else if (isset($def['default'])) { |
|
1493 | 1493 | $value = $def['default']; |
1494 | 1494 | } |
1495 | 1495 | $config[$name]['value'] = $value; |
@@ -1505,7 +1505,7 @@ discard block |
||
1505 | 1505 | */ |
1506 | 1506 | public static function clearAllCaches() |
1507 | 1507 | { |
1508 | - foreach ( self::$_themes as $themeobject ) { |
|
1508 | + foreach (self::$_themes as $themeobject) { |
|
1509 | 1509 | $themeobject->clearCache(); |
1510 | 1510 | } |
1511 | 1511 | } |
@@ -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. |
@@ -46,8 +48,9 @@ discard block |
||
46 | 48 | * theme basis. |
47 | 49 | ********************************************************************************/ |
48 | 50 | |
49 | -if(!defined('JSMIN_AS_LIB')) |
|
51 | +if(!defined('JSMIN_AS_LIB')) { |
|
50 | 52 | define('JSMIN_AS_LIB', true); |
53 | +} |
|
51 | 54 | |
52 | 55 | require_once("include/SugarTheme/cssmin.php"); |
53 | 56 | require_once("jssource/jsmin.php"); |
@@ -299,10 +302,11 @@ discard block |
||
299 | 302 | if ( property_exists(__CLASS__,$key) ) { |
300 | 303 | // For all arrays ( except colors and fonts ) you can just specify the items |
301 | 304 | // to change instead of all of the values |
302 | - if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) |
|
303 | - $this->$key = array_merge($this->$key,$value); |
|
304 | - else |
|
305 | - $this->$key = $value; |
|
305 | + if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) { |
|
306 | + $this->$key = array_merge($this->$key,$value); |
|
307 | + } else { |
|
308 | + $this->$key = $value; |
|
309 | + } |
|
306 | 310 | } |
307 | 311 | } |
308 | 312 | } |
@@ -310,23 +314,28 @@ discard block |
||
310 | 314 | if ( property_exists(__CLASS__,$key) ) { |
311 | 315 | // For all arrays ( except colors and fonts ) you can just specify the items |
312 | 316 | // to change instead of all of the values |
313 | - if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) |
|
314 | - $this->$key = array_merge($this->$key,$value); |
|
315 | - else |
|
316 | - $this->$key = $value; |
|
317 | + if ( is_array($this->$key) && !in_array($key,array('colors','fonts')) ) { |
|
318 | + $this->$key = array_merge($this->$key,$value); |
|
319 | + } else { |
|
320 | + $this->$key = $value; |
|
321 | + } |
|
317 | 322 | } |
318 | 323 | } |
319 | 324 | if ( !inDeveloperMode() ) { |
320 | 325 | if ( sugar_is_file($cachedfile = sugar_cached($this->getFilePath().'/pathCache.php'))) { |
321 | 326 | $caches = unserialize(file_get_contents($cachedfile)); |
322 | - if ( isset($caches['jsCache']) ) |
|
323 | - $this->_jsCache = $caches['jsCache']; |
|
324 | - if ( isset($caches['cssCache']) ) |
|
325 | - $this->_cssCache = $caches['cssCache']; |
|
326 | - if ( isset($caches['imageCache']) ) |
|
327 | - $this->_imageCache = $caches['imageCache']; |
|
328 | - if ( isset($caches['templateCache']) ) |
|
329 | - $this->_templateCache = $caches['templateCache']; |
|
327 | + if ( isset($caches['jsCache']) ) { |
|
328 | + $this->_jsCache = $caches['jsCache']; |
|
329 | + } |
|
330 | + if ( isset($caches['cssCache']) ) { |
|
331 | + $this->_cssCache = $caches['cssCache']; |
|
332 | + } |
|
333 | + if ( isset($caches['imageCache']) ) { |
|
334 | + $this->_imageCache = $caches['imageCache']; |
|
335 | + } |
|
336 | + if ( isset($caches['templateCache']) ) { |
|
337 | + $this->_templateCache = $caches['templateCache']; |
|
338 | + } |
|
330 | 339 | } |
331 | 340 | $cachedfile = sugar_cached($this->getFilePath().'/spriteCache.php'); |
332 | 341 | if(!empty($GLOBALS['sugar_config']['use_sprites']) && sugar_is_file($cachedfile)) { |
@@ -378,13 +387,14 @@ discard block |
||
378 | 387 | // clear out the cache on destroy if we are asked to |
379 | 388 | if ( $this->_clearCacheOnDestroy ) { |
380 | 389 | |
381 | - if (is_file("$cachedir/pathCache.php")) |
|
382 | - unlink("$cachedir/pathCache.php"); |
|
383 | - if (is_file("$cachedir/spriteCache.php")) |
|
384 | - unlink("$cachedir/spriteCache.php"); |
|
390 | + if (is_file("$cachedir/pathCache.php")) { |
|
391 | + unlink("$cachedir/pathCache.php"); |
|
392 | + } |
|
393 | + if (is_file("$cachedir/spriteCache.php")) { |
|
394 | + unlink("$cachedir/spriteCache.php"); |
|
395 | + } |
|
385 | 396 | |
386 | - } |
|
387 | - elseif ( !inDeveloperMode() ) { |
|
397 | + } elseif ( !inDeveloperMode() ) { |
|
388 | 398 | // only update the caches if they have been changed in this request |
389 | 399 | if ( count($this->_jsCache) != $this->_initialCacheSize['jsCache'] |
390 | 400 | || count($this->_cssCache) != $this->_initialCacheSize['cssCache'] |
@@ -433,8 +443,9 @@ discard block |
||
433 | 443 | $key |
434 | 444 | ) |
435 | 445 | { |
436 | - if ( isset($this->$key) ) |
|
437 | - return $this->$key; |
|
446 | + if ( isset($this->$key) ) { |
|
447 | + return $this->$key; |
|
448 | + } |
|
438 | 449 | } |
439 | 450 | |
440 | 451 | public function __isset($key){ |
@@ -607,38 +618,44 @@ discard block |
||
607 | 618 | if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
608 | 619 | |
609 | 620 | // system wide sprites |
610 | - if(file_exists("cache/sprites/default/sprites.css")) |
|
611 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />'; |
|
621 | + if(file_exists("cache/sprites/default/sprites.css")) { |
|
622 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/default/sprites.css').'" />'; |
|
623 | + } |
|
612 | 624 | |
613 | 625 | // theme specific sprites |
614 | - if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) |
|
615 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />'; |
|
626 | + if(file_exists("cache/sprites/{$this->dirName}/sprites.css")) { |
|
627 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$this->dirName.'/sprites.css').'" />'; |
|
628 | + } |
|
616 | 629 | |
617 | 630 | // parent sprites |
618 | 631 | if($this->parentTheme && $parent = SugarThemeRegistry::get($this->parentTheme)) { |
619 | - if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) |
|
620 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />'; |
|
632 | + if(file_exists("cache/sprites/{$parent->dirName}/sprites.css")) { |
|
633 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/'.$parent->dirName.'/sprites.css').'" />'; |
|
634 | + } |
|
621 | 635 | } |
622 | 636 | |
623 | 637 | // repeatable sprites |
624 | - if(file_exists("cache/sprites/Repeatable/sprites.css")) |
|
625 | - $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />'; |
|
638 | + if(file_exists("cache/sprites/Repeatable/sprites.css")) { |
|
639 | + $html .= '<link rel="stylesheet" type="text/css" href="'.getJSPath('cache/sprites/Repeatable/sprites.css').'" />'; |
|
640 | + } |
|
626 | 641 | } |
627 | 642 | |
628 | 643 | // for BC during upgrade |
629 | 644 | if ( !empty($this->colors) ) { |
630 | - if ( isset($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $this->colors)) |
|
631 | - $color = $_SESSION['authenticated_user_theme_color']; |
|
632 | - else |
|
633 | - $color = $this->colors[0]; |
|
645 | + if ( isset($_SESSION['authenticated_user_theme_color']) && in_array($_SESSION['authenticated_user_theme_color'], $this->colors)) { |
|
646 | + $color = $_SESSION['authenticated_user_theme_color']; |
|
647 | + } else { |
|
648 | + $color = $this->colors[0]; |
|
649 | + } |
|
634 | 650 | $html .= '<link rel="stylesheet" type="text/css" href="'.$this->getCSSURL('colors.'.$color.'.css').'" id="current_color_style" />'; |
635 | 651 | } |
636 | 652 | |
637 | 653 | if ( !empty($this->fonts) ) { |
638 | - if ( isset($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $this->fonts)) |
|
639 | - $font = $_SESSION['authenticated_user_theme_font']; |
|
640 | - else |
|
641 | - $font = $this->fonts[0]; |
|
654 | + if ( isset($_SESSION['authenticated_user_theme_font']) && in_array($_SESSION['authenticated_user_theme_font'], $this->fonts)) { |
|
655 | + $font = $_SESSION['authenticated_user_theme_font']; |
|
656 | + } else { |
|
657 | + $font = $this->fonts[0]; |
|
658 | + } |
|
642 | 659 | $html .= '<link rel="stylesheet" type="text/css" href="'.$this->getCSSURL('fonts.'.$font.'.css').'" id="current_font_style" />'; |
643 | 660 | } |
644 | 661 | |
@@ -669,23 +686,24 @@ discard block |
||
669 | 686 | $templateName |
670 | 687 | ) |
671 | 688 | { |
672 | - if ( isset($this->_templateCache[$templateName]) ) |
|
673 | - return $this->_templateCache[$templateName]; |
|
689 | + if ( isset($this->_templateCache[$templateName]) ) { |
|
690 | + return $this->_templateCache[$templateName]; |
|
691 | + } |
|
674 | 692 | |
675 | 693 | $templatePath = ''; |
676 | - if (sugar_is_file('custom/'.$this->getTemplatePath().'/'.$templateName)) |
|
677 | - $templatePath = 'custom/'.$this->getTemplatePath().'/'.$templateName; |
|
678 | - elseif (sugar_is_file($this->getTemplatePath().'/'.$templateName)) |
|
679 | - $templatePath = $this->getTemplatePath().'/'.$templateName; |
|
680 | - elseif (isset($this->parentTheme) |
|
694 | + if (sugar_is_file('custom/'.$this->getTemplatePath().'/'.$templateName)) { |
|
695 | + $templatePath = 'custom/'.$this->getTemplatePath().'/'.$templateName; |
|
696 | + } elseif (sugar_is_file($this->getTemplatePath().'/'.$templateName)) { |
|
697 | + $templatePath = $this->getTemplatePath().'/'.$templateName; |
|
698 | + } elseif (isset($this->parentTheme) |
|
681 | 699 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
682 | - && ($filename = SugarThemeRegistry::get($this->parentTheme)->getTemplate($templateName)) != '') |
|
683 | - $templatePath = $filename; |
|
684 | - elseif (sugar_is_file('custom/'.$this->getDefaultTemplatePath().'/'.$templateName)) |
|
685 | - $templatePath = 'custom/'.$this->getDefaultTemplatePath().'/'.$templateName; |
|
686 | - elseif (sugar_is_file($this->getDefaultTemplatePath().'/'.$templateName)) |
|
687 | - $templatePath = $this->getDefaultTemplatePath().'/'.$templateName; |
|
688 | - else { |
|
700 | + && ($filename = SugarThemeRegistry::get($this->parentTheme)->getTemplate($templateName)) != '') { |
|
701 | + $templatePath = $filename; |
|
702 | + } elseif (sugar_is_file('custom/'.$this->getDefaultTemplatePath().'/'.$templateName)) { |
|
703 | + $templatePath = 'custom/'.$this->getDefaultTemplatePath().'/'.$templateName; |
|
704 | + } elseif (sugar_is_file($this->getDefaultTemplatePath().'/'.$templateName)) { |
|
705 | + $templatePath = $this->getDefaultTemplatePath().'/'.$templateName; |
|
706 | + } else { |
|
689 | 707 | $GLOBALS['log']->warn("Template $templateName not found"); |
690 | 708 | return false; |
691 | 709 | } |
@@ -721,15 +739,17 @@ discard block |
||
721 | 739 | // trap deprecated use of image extension |
722 | 740 | if(is_null($ext)) { |
723 | 741 | $imageNameExp = explode('.',$imageName); |
724 | - if(count($imageNameExp) == 1) |
|
725 | - $imageName .= '.gif'; |
|
742 | + if(count($imageNameExp) == 1) { |
|
743 | + $imageName .= '.gif'; |
|
744 | + } |
|
726 | 745 | } else { |
727 | 746 | $imageName .= $ext; |
728 | 747 | } |
729 | 748 | |
730 | 749 | // trap alt attributes in other_attributes |
731 | - if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) |
|
732 | - $GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName"); |
|
750 | + if(preg_match('/alt=["\']([^\'"]+)["\']/i', $other_attributes)) { |
|
751 | + $GLOBALS['log']->debug("Sprites: alt attribute detected for $imageName"); |
|
752 | + } |
|
733 | 753 | // sprite handler, makes use of own caching mechanism |
734 | 754 | if(!empty($GLOBALS['sugar_config']['use_sprites']) && $GLOBALS['sugar_config']['use_sprites']) { |
735 | 755 | // get sprite metadata |
@@ -751,8 +771,9 @@ discard block |
||
751 | 771 | // img caching |
752 | 772 | if(empty($cached_results[$imageName])) { |
753 | 773 | $imageURL = $this->getImageURL($imageName,false); |
754 | - if ( empty($imageURL) ) |
|
755 | - return false; |
|
774 | + if ( empty($imageURL) ) { |
|
775 | + return false; |
|
776 | + } |
|
756 | 777 | if(strpos($imageURL, '.svg', strlen($imageURL)-4)){ |
757 | 778 | $cached_results[$imageName] = file_get_contents($imageURL); |
758 | 779 | } else { |
@@ -779,8 +800,9 @@ discard block |
||
779 | 800 | public function getSpriteMeta($imageName) { |
780 | 801 | |
781 | 802 | // return from cache |
782 | - if(isset($this->_spriteCache[$imageName])) |
|
783 | - return $this->_spriteCache[$imageName]; |
|
803 | + if(isset($this->_spriteCache[$imageName])) { |
|
804 | + return $this->_spriteCache[$imageName]; |
|
805 | + } |
|
784 | 806 | |
785 | 807 | // sprite keys are base on imageURL |
786 | 808 | $imageURL = $this->getImageURL($imageName,false); |
@@ -832,8 +854,9 @@ discard block |
||
832 | 854 | $attr .= ' class="spr_'.$class.'"'; |
833 | 855 | } |
834 | 856 | |
835 | - if($title) |
|
836 | - $attr .= ' title="'.$title.'"'; |
|
857 | + if($title) { |
|
858 | + $attr .= ' title="'.$title.'"'; |
|
859 | + } |
|
837 | 860 | |
838 | 861 | // use </span> instead of /> to prevent weird UI results |
839 | 862 | $GLOBALS['log']->debug("Sprites: generated sprite -> $attr"); |
@@ -887,35 +910,37 @@ discard block |
||
887 | 910 | $addJSPath = true |
888 | 911 | ){ |
889 | 912 | if ( isset($this->_imageCache[$imageName]) ) { |
890 | - if ( $addJSPath ) |
|
891 | - return getJSPath($this->_imageCache[$imageName]); |
|
892 | - else |
|
893 | - return $this->_imageCache[$imageName]; |
|
913 | + if ( $addJSPath ) { |
|
914 | + return getJSPath($this->_imageCache[$imageName]); |
|
915 | + } else { |
|
916 | + return $this->_imageCache[$imageName]; |
|
917 | + } |
|
894 | 918 | } |
895 | 919 | $imagePath = ''; |
896 | - if (($filename = $this->_getImageFileName('custom/'.$this->getImagePath().'/'.$imageName)) != '') |
|
897 | - $imagePath = $filename; |
|
898 | - elseif (($filename = $this->_getImageFileName($this->getImagePath().'/'.$imageName)) != '') |
|
899 | - $imagePath = $filename; |
|
900 | - elseif (isset($this->parentTheme) |
|
920 | + if (($filename = $this->_getImageFileName('custom/'.$this->getImagePath().'/'.$imageName)) != '') { |
|
921 | + $imagePath = $filename; |
|
922 | + } elseif (($filename = $this->_getImageFileName($this->getImagePath().'/'.$imageName)) != '') { |
|
923 | + $imagePath = $filename; |
|
924 | + } elseif (isset($this->parentTheme) |
|
901 | 925 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
902 | - && ($filename = SugarThemeRegistry::get($this->parentTheme)->getImageURL($imageName,false)) != '') |
|
903 | - $imagePath = $filename; |
|
904 | - elseif (($filename = $this->_getImageFileName('custom/'.$this->getDefaultImagePath().'/'.$imageName)) != '') |
|
905 | - $imagePath = $filename; |
|
906 | - elseif (($filename = $this->_getImageFileName($this->getDefaultImagePath().'/'.$imageName)) != '') |
|
907 | - $imagePath = $filename; |
|
908 | - elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '') |
|
909 | - $imagePath = $filename; |
|
910 | - else { |
|
926 | + && ($filename = SugarThemeRegistry::get($this->parentTheme)->getImageURL($imageName,false)) != '') { |
|
927 | + $imagePath = $filename; |
|
928 | + } elseif (($filename = $this->_getImageFileName('custom/'.$this->getDefaultImagePath().'/'.$imageName)) != '') { |
|
929 | + $imagePath = $filename; |
|
930 | + } elseif (($filename = $this->_getImageFileName($this->getDefaultImagePath().'/'.$imageName)) != '') { |
|
931 | + $imagePath = $filename; |
|
932 | + } elseif (($filename = $this->_getImageFileName('include/images/'.$imageName)) != '') { |
|
933 | + $imagePath = $filename; |
|
934 | + } else { |
|
911 | 935 | $GLOBALS['log']->warn("Image $imageName not found"); |
912 | 936 | return false; |
913 | 937 | } |
914 | 938 | |
915 | 939 | $this->_imageCache[$imageName] = $imagePath; |
916 | 940 | |
917 | - if ( $addJSPath ) |
|
918 | - return getJSPath($imagePath); |
|
941 | + if ( $addJSPath ) { |
|
942 | + return getJSPath($imagePath); |
|
943 | + } |
|
919 | 944 | |
920 | 945 | return $imagePath; |
921 | 946 | } |
@@ -931,14 +956,16 @@ discard block |
||
931 | 956 | ) |
932 | 957 | { |
933 | 958 | // return now if the extension matches that of which we are looking for |
934 | - if ( sugar_is_file($imageName) ) |
|
935 | - return $imageName; |
|
959 | + if ( sugar_is_file($imageName) ) { |
|
960 | + return $imageName; |
|
961 | + } |
|
936 | 962 | $pathParts = pathinfo($imageName); |
937 | - foreach ( $this->imageExtensions as $extension ) |
|
938 | - if ( isset($pathParts['extension']) ) |
|
963 | + foreach ( $this->imageExtensions as $extension ) { |
|
964 | + if ( isset($pathParts['extension']) ) |
|
939 | 965 | if ( ( $extension != $pathParts['extension'] ) |
940 | 966 | && sugar_is_file($pathParts['dirname'].'/'.$pathParts['filename'].'.'.$extension) ) |
941 | 967 | return $pathParts['dirname'].'/'.$pathParts['filename'].'.'.$extension; |
968 | + } |
|
942 | 969 | |
943 | 970 | return ''; |
944 | 971 | } |
@@ -954,10 +981,11 @@ discard block |
||
954 | 981 | public function getCSSURL($cssFileName, $returnURL = true) |
955 | 982 | { |
956 | 983 | if ( isset($this->_cssCache[$cssFileName]) && sugar_is_file(sugar_cached($this->_cssCache[$cssFileName])) ) { |
957 | - if ( $returnURL ) |
|
958 | - return getJSPath("cache/".$this->_cssCache[$cssFileName]); |
|
959 | - else |
|
960 | - return sugar_cached($this->_cssCache[$cssFileName]); |
|
984 | + if ( $returnURL ) { |
|
985 | + return getJSPath("cache/".$this->_cssCache[$cssFileName]); |
|
986 | + } else { |
|
987 | + return sugar_cached($this->_cssCache[$cssFileName]); |
|
988 | + } |
|
961 | 989 | } |
962 | 990 | |
963 | 991 | $cssFileContents = ''; |
@@ -965,13 +993,15 @@ discard block |
||
965 | 993 | $fullFileName = $this->getCSSPath().'/'.$cssFileName; |
966 | 994 | if (isset($this->parentTheme) |
967 | 995 | && SugarThemeRegistry::get($this->parentTheme) instanceOf SugarTheme |
968 | - && ($filename = SugarThemeRegistry::get($this->parentTheme)->getCSSURL($cssFileName,false)) != '') |
|
969 | - $cssFileContents .= file_get_contents($filename); |
|
970 | - else { |
|
971 | - if (sugar_is_file($defaultFileName)) |
|
972 | - $cssFileContents .= file_get_contents($defaultFileName); |
|
973 | - if (sugar_is_file('custom/'.$defaultFileName)) |
|
974 | - $cssFileContents .= file_get_contents('custom/'.$defaultFileName); |
|
996 | + && ($filename = SugarThemeRegistry::get($this->parentTheme)->getCSSURL($cssFileName,false)) != '') { |
|
997 | + $cssFileContents .= file_get_contents($filename); |
|
998 | + } else { |
|
999 | + if (sugar_is_file($defaultFileName)) { |
|
1000 | + $cssFileContents .= file_get_contents($defaultFileName); |
|
1001 | + } |
|
1002 | + if (sugar_is_file('custom/'.$defaultFileName)) { |
|
1003 | + $cssFileContents .= file_get_contents('custom/'.$defaultFileName); |
|
1004 | + } |
|
975 | 1005 | } |
976 | 1006 | if (sugar_is_file($fullFileName)) { |
977 | 1007 | $cssFileContents .= file_get_contents($fullFileName); |
@@ -995,10 +1025,11 @@ discard block |
||
995 | 1025 | // if this is the style.css file, prepend the base.css and calendar-win2k-cold-1.css |
996 | 1026 | // files before the theme styles |
997 | 1027 | if ( $cssFileName == 'style.css' && !isset($this->parentTheme) ) { |
998 | - if ( inDeveloperMode() ) |
|
999 | - $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css') . $cssFileContents; |
|
1000 | - else |
|
1001 | - $cssFileContents = file_get_contents('include/javascript/yui/build/base/base-min.css') . $cssFileContents; |
|
1028 | + if ( inDeveloperMode() ) { |
|
1029 | + $cssFileContents = file_get_contents('include/javascript/yui/build/base/base.css') . $cssFileContents; |
|
1030 | + } else { |
|
1031 | + $cssFileContents = file_get_contents('include/javascript/yui/build/base/base-min.css') . $cssFileContents; |
|
1032 | + } |
|
1002 | 1033 | } |
1003 | 1034 | |
1004 | 1035 | // minify the css |
@@ -1011,8 +1042,9 @@ discard block |
||
1011 | 1042 | |
1012 | 1043 | $this->_cssCache[$cssFileName] = $fullFileName; |
1013 | 1044 | |
1014 | - if ( $returnURL ) |
|
1015 | - return getJSPath("cache/".$fullFileName); |
|
1045 | + if ( $returnURL ) { |
|
1046 | + return getJSPath("cache/".$fullFileName); |
|
1047 | + } |
|
1016 | 1048 | |
1017 | 1049 | return sugar_cached($fullFileName); |
1018 | 1050 | } |
@@ -1028,10 +1060,11 @@ discard block |
||
1028 | 1060 | public function getJSURL($jsFileName, $returnURL = true) |
1029 | 1061 | { |
1030 | 1062 | if ( isset($this->_jsCache[$jsFileName]) && sugar_is_file(sugar_cached($this->_jsCache[$jsFileName])) ) { |
1031 | - if ( $returnURL ) |
|
1032 | - return getJSPath("cache/".$this->_jsCache[$jsFileName]); |
|
1033 | - else |
|
1034 | - return sugar_cached($this->_jsCache[$jsFileName]); |
|
1063 | + if ( $returnURL ) { |
|
1064 | + return getJSPath("cache/".$this->_jsCache[$jsFileName]); |
|
1065 | + } else { |
|
1066 | + return sugar_cached($this->_jsCache[$jsFileName]); |
|
1067 | + } |
|
1035 | 1068 | } |
1036 | 1069 | |
1037 | 1070 | $jsFileContents = ''; |
@@ -1042,15 +1075,19 @@ discard block |
||
1042 | 1075 | && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName,false)) != '' && !in_array($jsFileName,$this->ignoreParentFiles)) { |
1043 | 1076 | $jsFileContents .= file_get_contents($filename); |
1044 | 1077 | } else { |
1045 | - if (sugar_is_file($defaultFileName)) |
|
1046 | - $jsFileContents .= file_get_contents($defaultFileName); |
|
1047 | - if (sugar_is_file('custom/'.$defaultFileName)) |
|
1048 | - $jsFileContents .= file_get_contents('custom/'.$defaultFileName); |
|
1078 | + if (sugar_is_file($defaultFileName)) { |
|
1079 | + $jsFileContents .= file_get_contents($defaultFileName); |
|
1080 | + } |
|
1081 | + if (sugar_is_file('custom/'.$defaultFileName)) { |
|
1082 | + $jsFileContents .= file_get_contents('custom/'.$defaultFileName); |
|
1083 | + } |
|
1084 | + } |
|
1085 | + if (sugar_is_file($fullFileName)) { |
|
1086 | + $jsFileContents .= file_get_contents($fullFileName); |
|
1087 | + } |
|
1088 | + if (sugar_is_file('custom/'.$fullFileName)) { |
|
1089 | + $jsFileContents .= file_get_contents('custom/'.$fullFileName); |
|
1049 | 1090 | } |
1050 | - if (sugar_is_file($fullFileName)) |
|
1051 | - $jsFileContents .= file_get_contents($fullFileName); |
|
1052 | - if (sugar_is_file('custom/'.$fullFileName)) |
|
1053 | - $jsFileContents .= file_get_contents('custom/'.$fullFileName); |
|
1054 | 1091 | if (empty($jsFileContents)) { |
1055 | 1092 | $GLOBALS['log']->warn("Javascript File $jsFileName not found"); |
1056 | 1093 | return false; |
@@ -1071,8 +1108,9 @@ discard block |
||
1071 | 1108 | |
1072 | 1109 | $this->_jsCache[$jsFileName] = $fullFileName; |
1073 | 1110 | |
1074 | - if ( $returnURL ) |
|
1075 | - return getJSPath("cache/".$fullFileName); |
|
1111 | + if ( $returnURL ) { |
|
1112 | + return getJSPath("cache/".$fullFileName); |
|
1113 | + } |
|
1076 | 1114 | |
1077 | 1115 | return sugar_cached($fullFileName); |
1078 | 1116 | } |
@@ -1097,7 +1135,9 @@ discard block |
||
1097 | 1135 | $imageArray = array(); |
1098 | 1136 | foreach ( $pathsToSearch as $path ) |
1099 | 1137 | { |
1100 | - if (!sugar_is_dir($path)) $path = "custom/$path"; |
|
1138 | + if (!sugar_is_dir($path)) { |
|
1139 | + $path = "custom/$path"; |
|
1140 | + } |
|
1101 | 1141 | if (sugar_is_dir($path) && is_readable($path) && $dir = opendir($path)) { |
1102 | 1142 | while (($file = readdir($dir)) !== false) { |
1103 | 1143 | if ($file == ".." |
@@ -1105,10 +1145,12 @@ discard block |
||
1105 | 1145 | || $file == ".svn" |
1106 | 1146 | || $file == "CVS" |
1107 | 1147 | || $file == "Attic" |
1108 | - ) |
|
1109 | - continue; |
|
1110 | - if ( !isset($imageArray[$file]) ) |
|
1111 | - $imageArray[$file] = $this->getImageURL($file,false); |
|
1148 | + ) { |
|
1149 | + continue; |
|
1150 | + } |
|
1151 | + if ( !isset($imageArray[$file]) ) { |
|
1152 | + $imageArray[$file] = $this->getImageURL($file,false); |
|
1153 | + } |
|
1112 | 1154 | } |
1113 | 1155 | closedir($dir); |
1114 | 1156 | } |
@@ -1189,8 +1231,9 @@ discard block |
||
1189 | 1231 | } |
1190 | 1232 | |
1191 | 1233 | // Assume theme is designed for 5.5.x if not specified otherwise |
1192 | - if ( !isset($themedef['version']) ) |
|
1193 | - $themedef['version']['regex_matches'] = array('5\.5\.*'); |
|
1234 | + if ( !isset($themedef['version']) ) { |
|
1235 | + $themedef['version']['regex_matches'] = array('5\.5\.*'); |
|
1236 | + } |
|
1194 | 1237 | |
1195 | 1238 | // Check to see if theme is valid for this version of Sugar; return false if not |
1196 | 1239 | $version_ok = false; |
@@ -1210,8 +1253,9 @@ discard block |
||
1210 | 1253 | } |
1211 | 1254 | } |
1212 | 1255 | } |
1213 | - if ( !$version_ok ) |
|
1214 | - return false; |
|
1256 | + if ( !$version_ok ) { |
|
1257 | + return false; |
|
1258 | + } |
|
1215 | 1259 | |
1216 | 1260 | $theme = new SugarTheme($themedef); |
1217 | 1261 | self::$_themes[$theme->dirName] = $theme; |
@@ -1226,8 +1270,9 @@ discard block |
||
1226 | 1270 | $themeName |
1227 | 1271 | ) |
1228 | 1272 | { |
1229 | - if ( self::exists($themeName) ) |
|
1230 | - unset(self::$_themes[$themeName]); |
|
1273 | + if ( self::exists($themeName) ) { |
|
1274 | + unset(self::$_themes[$themeName]); |
|
1275 | + } |
|
1231 | 1276 | } |
1232 | 1277 | |
1233 | 1278 | /** |
@@ -1239,8 +1284,9 @@ discard block |
||
1239 | 1284 | $themeName |
1240 | 1285 | ) |
1241 | 1286 | { |
1242 | - if ( isset(self::$_themes[$themeName]) ) |
|
1243 | - return self::$_themes[$themeName]; |
|
1287 | + if ( isset(self::$_themes[$themeName]) ) { |
|
1288 | + return self::$_themes[$themeName]; |
|
1289 | + } |
|
1244 | 1290 | } |
1245 | 1291 | |
1246 | 1292 | /** |
@@ -1250,8 +1296,9 @@ discard block |
||
1250 | 1296 | */ |
1251 | 1297 | public static function current() |
1252 | 1298 | { |
1253 | - if ( !isset(self::$_currentTheme) ) |
|
1254 | - self::buildRegistry(); |
|
1299 | + if ( !isset(self::$_currentTheme) ) { |
|
1300 | + self::buildRegistry(); |
|
1301 | + } |
|
1255 | 1302 | |
1256 | 1303 | return self::$_themes[self::$_currentTheme]; |
1257 | 1304 | } |
@@ -1263,8 +1310,9 @@ discard block |
||
1263 | 1310 | */ |
1264 | 1311 | public static function getDefault() |
1265 | 1312 | { |
1266 | - if ( !isset(self::$_currentTheme) ) |
|
1267 | - self::buildRegistry(); |
|
1313 | + if ( !isset(self::$_currentTheme) ) { |
|
1314 | + self::buildRegistry(); |
|
1315 | + } |
|
1268 | 1316 | |
1269 | 1317 | if ( isset($GLOBALS['sugar_config']['default_theme']) && self::exists($GLOBALS['sugar_config']['default_theme']) ) { |
1270 | 1318 | return self::get($GLOBALS['sugar_config']['default_theme']); |
@@ -1295,8 +1343,9 @@ discard block |
||
1295 | 1343 | $themeName |
1296 | 1344 | ) |
1297 | 1345 | { |
1298 | - if ( !self::exists($themeName) ) |
|
1299 | - return false; |
|
1346 | + if ( !self::exists($themeName) ) { |
|
1347 | + return false; |
|
1348 | + } |
|
1300 | 1349 | |
1301 | 1350 | self::$_currentTheme = $themeName; |
1302 | 1351 | |
@@ -1333,8 +1382,9 @@ discard block |
||
1333 | 1382 | || $file == "default" |
1334 | 1383 | || !sugar_is_dir("./$dirPath".$file) |
1335 | 1384 | || !sugar_is_file("./{$dirPath}{$file}/themedef.php") |
1336 | - ) |
|
1337 | - continue; |
|
1385 | + ) { |
|
1386 | + continue; |
|
1387 | + } |
|
1338 | 1388 | $themedef = array(); |
1339 | 1389 | require("./{$dirPath}{$file}/themedef.php"); |
1340 | 1390 | $themedef = array_merge($themedef,$themedefDefault); |
@@ -1343,9 +1393,10 @@ discard block |
||
1343 | 1393 | // if so, then it will override the current one |
1344 | 1394 | if ( self::exists($themedef['dirName']) ) { |
1345 | 1395 | $existingTheme = self::get($themedef['dirName']); |
1346 | - foreach ( SugarTheme::getThemeDefFields() as $field ) |
|
1347 | - if ( !isset($themedef[$field]) ) |
|
1396 | + foreach ( SugarTheme::getThemeDefFields() as $field ) { |
|
1397 | + if ( !isset($themedef[$field]) ) |
|
1348 | 1398 | $themedef[$field] = $existingTheme->$field; |
1399 | + } |
|
1349 | 1400 | self::remove($themedef['dirName']); |
1350 | 1401 | } |
1351 | 1402 | if ( isset($themedef['name']) ) { |
@@ -1400,12 +1451,14 @@ discard block |
||
1400 | 1451 | { |
1401 | 1452 | $themelist = array(); |
1402 | 1453 | $disabledThemes = array(); |
1403 | - if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) |
|
1404 | - $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']); |
|
1454 | + if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) { |
|
1455 | + $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']); |
|
1456 | + } |
|
1405 | 1457 | |
1406 | 1458 | foreach ( self::$_themes as $themename => $themeobject ) { |
1407 | - if ( in_array($themename,$disabledThemes) ) |
|
1408 | - continue; |
|
1459 | + if ( in_array($themename,$disabledThemes) ) { |
|
1460 | + continue; |
|
1461 | + } |
|
1409 | 1462 | $themelist[$themeobject->dirName] = $themeobject->name; |
1410 | 1463 | } |
1411 | 1464 | asort($themelist, SORT_STRING); |
@@ -1421,12 +1474,14 @@ discard block |
||
1421 | 1474 | { |
1422 | 1475 | $themelist = array(); |
1423 | 1476 | $disabledThemes = array(); |
1424 | - if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) |
|
1425 | - $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']); |
|
1477 | + if ( isset($GLOBALS['sugar_config']['disabled_themes']) ) { |
|
1478 | + $disabledThemes = explode(',',$GLOBALS['sugar_config']['disabled_themes']); |
|
1479 | + } |
|
1426 | 1480 | |
1427 | 1481 | foreach ( self::$_themes as $themename => $themeobject ) { |
1428 | - if ( in_array($themename,$disabledThemes) ) |
|
1429 | - $themelist[$themeobject->dirName] = $themeobject->name; |
|
1482 | + if ( in_array($themename,$disabledThemes) ) { |
|
1483 | + $themelist[$themeobject->dirName] = $themeobject->name; |
|
1484 | + } |
|
1430 | 1485 | } |
1431 | 1486 | |
1432 | 1487 | return $themelist; |
@@ -1441,8 +1496,9 @@ discard block |
||
1441 | 1496 | { |
1442 | 1497 | $themelist = array(); |
1443 | 1498 | |
1444 | - foreach ( self::$_themes as $themename => $themeobject ) |
|
1445 | - $themelist[$themeobject->dirName] = $themeobject->name; |
|
1499 | + foreach ( self::$_themes as $themename => $themeobject ) { |
|
1500 | + $themelist[$themeobject->dirName] = $themeobject->name; |
|
1501 | + } |
|
1446 | 1502 | |
1447 | 1503 | return $themelist; |
1448 | 1504 | } |
@@ -1456,8 +1512,9 @@ discard block |
||
1456 | 1512 | { |
1457 | 1513 | $themelist = array(); |
1458 | 1514 | $disabledThemes = array(); |
1459 | - if (isset($GLOBALS['sugar_config']['disabled_themes'])) |
|
1460 | - $disabledThemes = explode(',', $GLOBALS['sugar_config']['disabled_themes']); |
|
1515 | + if (isset($GLOBALS['sugar_config']['disabled_themes'])) { |
|
1516 | + $disabledThemes = explode(',', $GLOBALS['sugar_config']['disabled_themes']); |
|
1517 | + } |
|
1461 | 1518 | |
1462 | 1519 | foreach (self::$_themes as $themename => $themeobject) { |
1463 | 1520 | $themearray['name'] = $themeobject->name; |
@@ -1478,8 +1535,9 @@ discard block |
||
1478 | 1535 | { |
1479 | 1536 | global $sugar_config; |
1480 | 1537 | |
1481 | - if ( !self::exists($themeName) ) |
|
1482 | - return false; |
|
1538 | + if ( !self::exists($themeName) ) { |
|
1539 | + return false; |
|
1540 | + } |
|
1483 | 1541 | |
1484 | 1542 | $config = array(); |
1485 | 1543 |
@@ -44,226 +44,226 @@ discard block |
||
44 | 44 | class LanguageManager |
45 | 45 | { |
46 | 46 | |
47 | - /** |
|
48 | - * Called from VardefManager to allow for caching a lang file for a module |
|
49 | - * @param module - the name of the module we are working with |
|
50 | - * @param templates - an array of templates this module uses |
|
51 | - */ |
|
52 | - static function createLanguageFile($module , $templates=array('default'), $refresh = false){ |
|
53 | - global $mod_strings, $current_language; |
|
54 | - if(inDeveloperMode() || !empty($_SESSION['developerMode'])){ |
|
55 | - $refresh = true; |
|
56 | - } |
|
57 | - $temp_mod_strings = $mod_strings; |
|
58 | - $lang = $current_language; |
|
47 | + /** |
|
48 | + * Called from VardefManager to allow for caching a lang file for a module |
|
49 | + * @param module - the name of the module we are working with |
|
50 | + * @param templates - an array of templates this module uses |
|
51 | + */ |
|
52 | + static function createLanguageFile($module , $templates=array('default'), $refresh = false){ |
|
53 | + global $mod_strings, $current_language; |
|
54 | + if(inDeveloperMode() || !empty($_SESSION['developerMode'])){ |
|
55 | + $refresh = true; |
|
56 | + } |
|
57 | + $temp_mod_strings = $mod_strings; |
|
58 | + $lang = $current_language; |
|
59 | 59 | if(empty($lang)) |
60 | 60 | $lang = $GLOBALS['sugar_config']['default_language']; |
61 | - static $createdModules = array(); |
|
62 | - if(empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))){ |
|
63 | - $loaded_mod_strings = array(); |
|
64 | - $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
65 | - $createdModules[$module] = true; |
|
66 | - LanguageManager::refreshLanguage($module,$lang, $loaded_mod_strings); |
|
67 | - } |
|
68 | - } |
|
61 | + static $createdModules = array(); |
|
62 | + if(empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))){ |
|
63 | + $loaded_mod_strings = array(); |
|
64 | + $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
65 | + $createdModules[$module] = true; |
|
66 | + LanguageManager::refreshLanguage($module,$lang, $loaded_mod_strings); |
|
67 | + } |
|
68 | + } |
|
69 | 69 | |
70 | - /** |
|
71 | - * Load the module tempalte lauguage files |
|
72 | - * @param module - the name of the module we are working with |
|
73 | - * @param templates - an array of templates this module uses |
|
74 | - * @param lang - current language this module use |
|
75 | - * @param loaded_mod_strings - the string that we will add the module template language into |
|
76 | - */ |
|
77 | - static function loadTemplateLanguage($module , $templates , $lang, $loaded_mod_strings){ |
|
78 | - $templates = array_reverse($templates); |
|
79 | - foreach($templates as $template){ |
|
80 | - $temp = LanguageManager::addTemplate($module,$lang, $template); |
|
81 | - $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $temp); |
|
82 | - } |
|
83 | - return $loaded_mod_strings; |
|
84 | - } |
|
70 | + /** |
|
71 | + * Load the module tempalte lauguage files |
|
72 | + * @param module - the name of the module we are working with |
|
73 | + * @param templates - an array of templates this module uses |
|
74 | + * @param lang - current language this module use |
|
75 | + * @param loaded_mod_strings - the string that we will add the module template language into |
|
76 | + */ |
|
77 | + static function loadTemplateLanguage($module , $templates , $lang, $loaded_mod_strings){ |
|
78 | + $templates = array_reverse($templates); |
|
79 | + foreach($templates as $template){ |
|
80 | + $temp = LanguageManager::addTemplate($module,$lang, $template); |
|
81 | + $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $temp); |
|
82 | + } |
|
83 | + return $loaded_mod_strings; |
|
84 | + } |
|
85 | 85 | |
86 | - static function addTemplate($module, $lang, $template){ |
|
87 | - if($template == 'default')$template = 'basic'; |
|
88 | - $templates = array(); |
|
89 | - $fields = array(); |
|
90 | - if(empty($templates[$template])){ |
|
91 | - $path = 'include/SugarObjects/templates/' . $template . '/language/'.$lang.'.lang.php'; |
|
92 | - if(file_exists($path)){ |
|
93 | - require($path); |
|
94 | - $templates[$template] = $mod_strings; |
|
95 | - }else{ |
|
96 | - $path = 'include/SugarObjects/implements/' . $template . '/language/'.$lang.'.lang.php'; |
|
97 | - if(file_exists($path)){ |
|
98 | - require($path); |
|
99 | - $templates[$template] = $mod_strings; |
|
100 | - } |
|
101 | - } |
|
102 | - } |
|
103 | - if(!empty($templates[$template])){ |
|
104 | - return $templates[$template]; |
|
105 | - } |
|
106 | - } |
|
86 | + static function addTemplate($module, $lang, $template){ |
|
87 | + if($template == 'default')$template = 'basic'; |
|
88 | + $templates = array(); |
|
89 | + $fields = array(); |
|
90 | + if(empty($templates[$template])){ |
|
91 | + $path = 'include/SugarObjects/templates/' . $template . '/language/'.$lang.'.lang.php'; |
|
92 | + if(file_exists($path)){ |
|
93 | + require($path); |
|
94 | + $templates[$template] = $mod_strings; |
|
95 | + }else{ |
|
96 | + $path = 'include/SugarObjects/implements/' . $template . '/language/'.$lang.'.lang.php'; |
|
97 | + if(file_exists($path)){ |
|
98 | + require($path); |
|
99 | + $templates[$template] = $mod_strings; |
|
100 | + } |
|
101 | + } |
|
102 | + } |
|
103 | + if(!empty($templates[$template])){ |
|
104 | + return $templates[$template]; |
|
105 | + } |
|
106 | + } |
|
107 | 107 | |
108 | - static function saveCache($module,$lang, $loaded_mod_strings, $additonal_objects= array()){ |
|
109 | - if(empty($lang)) |
|
110 | - $lang = $GLOBALS['sugar_config']['default_language']; |
|
108 | + static function saveCache($module,$lang, $loaded_mod_strings, $additonal_objects= array()){ |
|
109 | + if(empty($lang)) |
|
110 | + $lang = $GLOBALS['sugar_config']['default_language']; |
|
111 | 111 | |
112 | - $file = create_cache_directory('modules/' . $module . '/language/'.$lang.'.lang.php'); |
|
113 | - write_array_to_file('mod_strings',$loaded_mod_strings, $file); |
|
114 | - include($file); |
|
112 | + $file = create_cache_directory('modules/' . $module . '/language/'.$lang.'.lang.php'); |
|
113 | + write_array_to_file('mod_strings',$loaded_mod_strings, $file); |
|
114 | + include($file); |
|
115 | 115 | |
116 | - // put the item in the sugar cache. |
|
117 | - $key = self::getLanguageCacheKey($module,$lang); |
|
118 | - sugar_cache_put($key,$loaded_mod_strings); |
|
119 | - } |
|
116 | + // put the item in the sugar cache. |
|
117 | + $key = self::getLanguageCacheKey($module,$lang); |
|
118 | + sugar_cache_put($key,$loaded_mod_strings); |
|
119 | + } |
|
120 | 120 | |
121 | - /** |
|
122 | - * clear out the language cache. |
|
123 | - * @param string module_dir the module_dir to clear, if not specified then clear |
|
124 | - * clear language cache for all modules. |
|
125 | - * @param string lang the name of the object we are clearing this is for sugar_cache |
|
126 | - */ |
|
127 | - static function clearLanguageCache($module_dir = '', $lang = ''){ |
|
128 | - if(empty($lang)) { |
|
129 | - $languages = array_keys($GLOBALS['sugar_config']['languages']); |
|
130 | - } else { |
|
131 | - $languages = array($lang); |
|
132 | - } |
|
133 | - //if we have a module name specified then just remove that language file |
|
134 | - //otherwise go through each module and clean up the language |
|
135 | - if(!empty($module_dir)) { |
|
136 | - foreach($languages as $clean_lang) { |
|
137 | - LanguageManager::_clearCache($module_dir, $clean_lang); |
|
138 | - } |
|
139 | - } else { |
|
140 | - $cache_dir = sugar_cached('modules/'); |
|
141 | - if(file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
|
142 | - while(($entry = readdir($dir)) !== false) { |
|
143 | - if ($entry == "." || $entry == "..") continue; |
|
144 | - foreach($languages as $clean_lang) { |
|
145 | - LanguageManager::_clearCache($entry, $clean_lang); |
|
146 | - } |
|
147 | - } |
|
148 | - closedir($dir); |
|
149 | - } |
|
150 | - } |
|
151 | - } |
|
121 | + /** |
|
122 | + * clear out the language cache. |
|
123 | + * @param string module_dir the module_dir to clear, if not specified then clear |
|
124 | + * clear language cache for all modules. |
|
125 | + * @param string lang the name of the object we are clearing this is for sugar_cache |
|
126 | + */ |
|
127 | + static function clearLanguageCache($module_dir = '', $lang = ''){ |
|
128 | + if(empty($lang)) { |
|
129 | + $languages = array_keys($GLOBALS['sugar_config']['languages']); |
|
130 | + } else { |
|
131 | + $languages = array($lang); |
|
132 | + } |
|
133 | + //if we have a module name specified then just remove that language file |
|
134 | + //otherwise go through each module and clean up the language |
|
135 | + if(!empty($module_dir)) { |
|
136 | + foreach($languages as $clean_lang) { |
|
137 | + LanguageManager::_clearCache($module_dir, $clean_lang); |
|
138 | + } |
|
139 | + } else { |
|
140 | + $cache_dir = sugar_cached('modules/'); |
|
141 | + if(file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
|
142 | + while(($entry = readdir($dir)) !== false) { |
|
143 | + if ($entry == "." || $entry == "..") continue; |
|
144 | + foreach($languages as $clean_lang) { |
|
145 | + LanguageManager::_clearCache($entry, $clean_lang); |
|
146 | + } |
|
147 | + } |
|
148 | + closedir($dir); |
|
149 | + } |
|
150 | + } |
|
151 | + } |
|
152 | 152 | |
153 | - /** |
|
154 | - * PRIVATE function used within clearLanguageCache so we do not repeat logic |
|
155 | - * @param string module_dir the module_dir to clear |
|
156 | - * @param string lang the name of the language file we are clearing this is for sugar_cache |
|
157 | - */ |
|
158 | - static function _clearCache($module_dir = '', $lang){ |
|
159 | - if(!empty($module_dir) && !empty($lang)){ |
|
160 | - $file = sugar_cached('modules/').$module_dir.'/language/'.$lang.'.lang.php'; |
|
161 | - if(file_exists($file)){ |
|
162 | - unlink($file); |
|
163 | - $key = self::getLanguageCacheKey($module_dir,$lang); |
|
164 | - sugar_cache_clear($key); |
|
165 | - } |
|
166 | - } |
|
167 | - } |
|
153 | + /** |
|
154 | + * PRIVATE function used within clearLanguageCache so we do not repeat logic |
|
155 | + * @param string module_dir the module_dir to clear |
|
156 | + * @param string lang the name of the language file we are clearing this is for sugar_cache |
|
157 | + */ |
|
158 | + static function _clearCache($module_dir = '', $lang){ |
|
159 | + if(!empty($module_dir) && !empty($lang)){ |
|
160 | + $file = sugar_cached('modules/').$module_dir.'/language/'.$lang.'.lang.php'; |
|
161 | + if(file_exists($file)){ |
|
162 | + unlink($file); |
|
163 | + $key = self::getLanguageCacheKey($module_dir,$lang); |
|
164 | + sugar_cache_clear($key); |
|
165 | + } |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - /** |
|
170 | - * Given a module, search all of the specified locations, and any others as specified |
|
171 | - * in order to refresh the cache file |
|
172 | - * |
|
173 | - * @param string $module the given module we want to load the vardefs for |
|
174 | - * @param string $lang the given language we wish to load |
|
175 | - * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search |
|
176 | - */ |
|
177 | - static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null){ |
|
178 | - // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
179 | - $lang_paths = array( |
|
180 | - 'modules/'.$module.'/language/'.$lang.'.lang.php', |
|
181 | - 'modules/'.$module.'/language/'.$lang.'.lang.override.php', |
|
182 | - 'custom/modules/'.$module.'/language/'.$lang.'.lang.php', |
|
183 | - 'custom/modules/'.$module.'/Ext/Language/'.$lang.'.lang.ext.php', |
|
184 | - ); |
|
169 | + /** |
|
170 | + * Given a module, search all of the specified locations, and any others as specified |
|
171 | + * in order to refresh the cache file |
|
172 | + * |
|
173 | + * @param string $module the given module we want to load the vardefs for |
|
174 | + * @param string $lang the given language we wish to load |
|
175 | + * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search |
|
176 | + */ |
|
177 | + static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null){ |
|
178 | + // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
179 | + $lang_paths = array( |
|
180 | + 'modules/'.$module.'/language/'.$lang.'.lang.php', |
|
181 | + 'modules/'.$module.'/language/'.$lang.'.lang.override.php', |
|
182 | + 'custom/modules/'.$module.'/language/'.$lang.'.lang.php', |
|
183 | + 'custom/modules/'.$module.'/Ext/Language/'.$lang.'.lang.ext.php', |
|
184 | + ); |
|
185 | 185 | |
186 | - #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files. |
|
187 | - static $createdModules; |
|
188 | - if(empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])){ |
|
189 | - $object = $GLOBALS['beanList'][$module]; |
|
186 | + #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files. |
|
187 | + static $createdModules; |
|
188 | + if(empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])){ |
|
189 | + $object = $GLOBALS['beanList'][$module]; |
|
190 | 190 | |
191 | - if ($object == 'aCase') |
|
192 | - $object = 'Case'; |
|
191 | + if ($object == 'aCase') |
|
192 | + $object = 'Case'; |
|
193 | 193 | |
194 | - if(!empty($GLOBALS["dictionary"]["$object"]["templates"])){ |
|
195 | - $templates = $GLOBALS["dictionary"]["$object"]["templates"]; |
|
196 | - $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
197 | - $createdModules[$module] = true; |
|
198 | - } |
|
199 | - } |
|
200 | - //end of fix #27023 |
|
194 | + if(!empty($GLOBALS["dictionary"]["$object"]["templates"])){ |
|
195 | + $templates = $GLOBALS["dictionary"]["$object"]["templates"]; |
|
196 | + $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
197 | + $createdModules[$module] = true; |
|
198 | + } |
|
199 | + } |
|
200 | + //end of fix #27023 |
|
201 | 201 | |
202 | - // Add in additional search paths if they were provided. |
|
203 | - if(!empty($additional_search_paths) && is_array($additional_search_paths)) |
|
204 | - { |
|
205 | - $lang_paths = array_merge($lang_paths, $additional_search_paths); |
|
206 | - } |
|
202 | + // Add in additional search paths if they were provided. |
|
203 | + if(!empty($additional_search_paths) && is_array($additional_search_paths)) |
|
204 | + { |
|
205 | + $lang_paths = array_merge($lang_paths, $additional_search_paths); |
|
206 | + } |
|
207 | 207 | |
208 | - //search a predefined set of locations for the vardef files |
|
209 | - foreach($lang_paths as $path){ |
|
210 | - if(file_exists($path)){ |
|
211 | - require($path); |
|
212 | - if(!empty($mod_strings)){ |
|
213 | - if (function_exists('sugarArrayMergeRecursive')){ |
|
214 | - $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings); |
|
215 | - } |
|
216 | - else{ |
|
217 | - $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings); |
|
218 | - } |
|
219 | - } |
|
220 | - } |
|
221 | - } |
|
208 | + //search a predefined set of locations for the vardef files |
|
209 | + foreach($lang_paths as $path){ |
|
210 | + if(file_exists($path)){ |
|
211 | + require($path); |
|
212 | + if(!empty($mod_strings)){ |
|
213 | + if (function_exists('sugarArrayMergeRecursive')){ |
|
214 | + $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings); |
|
215 | + } |
|
216 | + else{ |
|
217 | + $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings); |
|
218 | + } |
|
219 | + } |
|
220 | + } |
|
221 | + } |
|
222 | 222 | |
223 | - //great! now that we have loaded all of our vardefs. |
|
224 | - //let's go save them to the cache file. |
|
225 | - if(!empty($loaded_mod_strings)) |
|
226 | - LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
227 | - } |
|
223 | + //great! now that we have loaded all of our vardefs. |
|
224 | + //let's go save them to the cache file. |
|
225 | + if(!empty($loaded_mod_strings)) |
|
226 | + LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
227 | + } |
|
228 | 228 | |
229 | - static function loadModuleLanguage($module, $lang, $refresh=false){ |
|
230 | - //here check if the cache file exists, if it does then load it, if it doesn't |
|
231 | - //then call refreshVardef |
|
232 | - //if either our session or the system is set to developerMode then refresh is set to true |
|
229 | + static function loadModuleLanguage($module, $lang, $refresh=false){ |
|
230 | + //here check if the cache file exists, if it does then load it, if it doesn't |
|
231 | + //then call refreshVardef |
|
232 | + //if either our session or the system is set to developerMode then refresh is set to true |
|
233 | 233 | |
234 | - // Retrieve the vardefs from cache. |
|
235 | - $key = self::getLanguageCacheKey($module,$lang); |
|
234 | + // Retrieve the vardefs from cache. |
|
235 | + $key = self::getLanguageCacheKey($module,$lang); |
|
236 | 236 | |
237 | - if(!$refresh) |
|
238 | - { |
|
239 | - $return_result = sugar_cache_retrieve($key); |
|
240 | - if(!empty($return_result) && is_array($return_result)){ |
|
241 | - return $return_result; |
|
242 | - } |
|
243 | - } |
|
237 | + if(!$refresh) |
|
238 | + { |
|
239 | + $return_result = sugar_cache_retrieve($key); |
|
240 | + if(!empty($return_result) && is_array($return_result)){ |
|
241 | + return $return_result; |
|
242 | + } |
|
243 | + } |
|
244 | 244 | |
245 | - // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
246 | - $cachedfile = sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'; |
|
247 | - if($refresh || !file_exists($cachedfile)){ |
|
248 | - LanguageManager::refreshLanguage($module, $lang); |
|
249 | - } |
|
245 | + // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
|
246 | + $cachedfile = sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'; |
|
247 | + if($refresh || !file_exists($cachedfile)){ |
|
248 | + LanguageManager::refreshLanguage($module, $lang); |
|
249 | + } |
|
250 | 250 | |
251 | - //at this point we should have the cache/modules/... file |
|
252 | - //which was created from the refreshVardefs so let's try to load it. |
|
253 | - if(file_exists($cachedfile)){ |
|
254 | - global $mod_strings; |
|
251 | + //at this point we should have the cache/modules/... file |
|
252 | + //which was created from the refreshVardefs so let's try to load it. |
|
253 | + if(file_exists($cachedfile)){ |
|
254 | + global $mod_strings; |
|
255 | 255 | |
256 | - require $cachedfile; |
|
256 | + require $cachedfile; |
|
257 | 257 | |
258 | - // now that we hae loaded the data from disk, put it in the cache. |
|
259 | - if(!empty($mod_strings)) |
|
260 | - sugar_cache_put($key,$mod_strings); |
|
261 | - if(!empty($_SESSION['translation_mode'])){ |
|
262 | - $mod_strings = array_map('translated_prefix', $mod_strings); |
|
263 | - } |
|
264 | - return $mod_strings; |
|
265 | - } |
|
266 | - } |
|
258 | + // now that we hae loaded the data from disk, put it in the cache. |
|
259 | + if(!empty($mod_strings)) |
|
260 | + sugar_cache_put($key,$mod_strings); |
|
261 | + if(!empty($_SESSION['translation_mode'])){ |
|
262 | + $mod_strings = array_map('translated_prefix', $mod_strings); |
|
263 | + } |
|
264 | + return $mod_strings; |
|
265 | + } |
|
266 | + } |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Return the cache key for the module language definition |
@@ -274,9 +274,9 @@ discard block |
||
274 | 274 | * @return string |
275 | 275 | */ |
276 | 276 | public static function getLanguageCacheKey($module, $lang) |
277 | - { |
|
278 | - return "LanguageManager.$module.$lang"; |
|
279 | - } |
|
277 | + { |
|
278 | + return "LanguageManager.$module.$lang"; |
|
279 | + } |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Remove any cached js language strings. |
@@ -302,5 +302,5 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | function translated_prefix($key){ |
305 | - return '[translated]' . $key; |
|
305 | + return '[translated]' . $key; |
|
306 | 306 | } |
@@ -49,21 +49,21 @@ discard block |
||
49 | 49 | * @param module - the name of the module we are working with |
50 | 50 | * @param templates - an array of templates this module uses |
51 | 51 | */ |
52 | - static function createLanguageFile($module , $templates=array('default'), $refresh = false){ |
|
52 | + static function createLanguageFile($module, $templates = array('default'), $refresh = false) { |
|
53 | 53 | global $mod_strings, $current_language; |
54 | - if(inDeveloperMode() || !empty($_SESSION['developerMode'])){ |
|
54 | + if (inDeveloperMode() || !empty($_SESSION['developerMode'])) { |
|
55 | 55 | $refresh = true; |
56 | 56 | } |
57 | 57 | $temp_mod_strings = $mod_strings; |
58 | 58 | $lang = $current_language; |
59 | - if(empty($lang)) |
|
59 | + if (empty($lang)) |
|
60 | 60 | $lang = $GLOBALS['sugar_config']['default_language']; |
61 | 61 | static $createdModules = array(); |
62 | - if(empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))){ |
|
62 | + if (empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))) { |
|
63 | 63 | $loaded_mod_strings = array(); |
64 | - $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
64 | + $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings); |
|
65 | 65 | $createdModules[$module] = true; |
66 | - LanguageManager::refreshLanguage($module,$lang, $loaded_mod_strings); |
|
66 | + LanguageManager::refreshLanguage($module, $lang, $loaded_mod_strings); |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
@@ -74,48 +74,48 @@ discard block |
||
74 | 74 | * @param lang - current language this module use |
75 | 75 | * @param loaded_mod_strings - the string that we will add the module template language into |
76 | 76 | */ |
77 | - static function loadTemplateLanguage($module , $templates , $lang, $loaded_mod_strings){ |
|
77 | + static function loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings) { |
|
78 | 78 | $templates = array_reverse($templates); |
79 | - foreach($templates as $template){ |
|
80 | - $temp = LanguageManager::addTemplate($module,$lang, $template); |
|
79 | + foreach ($templates as $template) { |
|
80 | + $temp = LanguageManager::addTemplate($module, $lang, $template); |
|
81 | 81 | $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $temp); |
82 | 82 | } |
83 | 83 | return $loaded_mod_strings; |
84 | 84 | } |
85 | 85 | |
86 | - static function addTemplate($module, $lang, $template){ |
|
87 | - if($template == 'default')$template = 'basic'; |
|
86 | + static function addTemplate($module, $lang, $template) { |
|
87 | + if ($template == 'default')$template = 'basic'; |
|
88 | 88 | $templates = array(); |
89 | 89 | $fields = array(); |
90 | - if(empty($templates[$template])){ |
|
91 | - $path = 'include/SugarObjects/templates/' . $template . '/language/'.$lang.'.lang.php'; |
|
92 | - if(file_exists($path)){ |
|
90 | + if (empty($templates[$template])) { |
|
91 | + $path = 'include/SugarObjects/templates/'.$template.'/language/'.$lang.'.lang.php'; |
|
92 | + if (file_exists($path)) { |
|
93 | 93 | require($path); |
94 | 94 | $templates[$template] = $mod_strings; |
95 | - }else{ |
|
96 | - $path = 'include/SugarObjects/implements/' . $template . '/language/'.$lang.'.lang.php'; |
|
97 | - if(file_exists($path)){ |
|
95 | + } else { |
|
96 | + $path = 'include/SugarObjects/implements/'.$template.'/language/'.$lang.'.lang.php'; |
|
97 | + if (file_exists($path)) { |
|
98 | 98 | require($path); |
99 | 99 | $templates[$template] = $mod_strings; |
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | - if(!empty($templates[$template])){ |
|
103 | + if (!empty($templates[$template])) { |
|
104 | 104 | return $templates[$template]; |
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - static function saveCache($module,$lang, $loaded_mod_strings, $additonal_objects= array()){ |
|
109 | - if(empty($lang)) |
|
108 | + static function saveCache($module, $lang, $loaded_mod_strings, $additonal_objects = array()) { |
|
109 | + if (empty($lang)) |
|
110 | 110 | $lang = $GLOBALS['sugar_config']['default_language']; |
111 | 111 | |
112 | - $file = create_cache_directory('modules/' . $module . '/language/'.$lang.'.lang.php'); |
|
113 | - write_array_to_file('mod_strings',$loaded_mod_strings, $file); |
|
112 | + $file = create_cache_directory('modules/'.$module.'/language/'.$lang.'.lang.php'); |
|
113 | + write_array_to_file('mod_strings', $loaded_mod_strings, $file); |
|
114 | 114 | include($file); |
115 | 115 | |
116 | 116 | // put the item in the sugar cache. |
117 | - $key = self::getLanguageCacheKey($module,$lang); |
|
118 | - sugar_cache_put($key,$loaded_mod_strings); |
|
117 | + $key = self::getLanguageCacheKey($module, $lang); |
|
118 | + sugar_cache_put($key, $loaded_mod_strings); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
@@ -124,24 +124,24 @@ discard block |
||
124 | 124 | * clear language cache for all modules. |
125 | 125 | * @param string lang the name of the object we are clearing this is for sugar_cache |
126 | 126 | */ |
127 | - static function clearLanguageCache($module_dir = '', $lang = ''){ |
|
128 | - if(empty($lang)) { |
|
127 | + static function clearLanguageCache($module_dir = '', $lang = '') { |
|
128 | + if (empty($lang)) { |
|
129 | 129 | $languages = array_keys($GLOBALS['sugar_config']['languages']); |
130 | 130 | } else { |
131 | 131 | $languages = array($lang); |
132 | 132 | } |
133 | 133 | //if we have a module name specified then just remove that language file |
134 | 134 | //otherwise go through each module and clean up the language |
135 | - if(!empty($module_dir)) { |
|
136 | - foreach($languages as $clean_lang) { |
|
135 | + if (!empty($module_dir)) { |
|
136 | + foreach ($languages as $clean_lang) { |
|
137 | 137 | LanguageManager::_clearCache($module_dir, $clean_lang); |
138 | 138 | } |
139 | 139 | } else { |
140 | 140 | $cache_dir = sugar_cached('modules/'); |
141 | - if(file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
|
142 | - while(($entry = readdir($dir)) !== false) { |
|
141 | + if (file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
|
142 | + while (($entry = readdir($dir)) !== false) { |
|
143 | 143 | if ($entry == "." || $entry == "..") continue; |
144 | - foreach($languages as $clean_lang) { |
|
144 | + foreach ($languages as $clean_lang) { |
|
145 | 145 | LanguageManager::_clearCache($entry, $clean_lang); |
146 | 146 | } |
147 | 147 | } |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | * @param string module_dir the module_dir to clear |
156 | 156 | * @param string lang the name of the language file we are clearing this is for sugar_cache |
157 | 157 | */ |
158 | - static function _clearCache($module_dir = '', $lang){ |
|
159 | - if(!empty($module_dir) && !empty($lang)){ |
|
158 | + static function _clearCache($module_dir = '', $lang) { |
|
159 | + if (!empty($module_dir) && !empty($lang)) { |
|
160 | 160 | $file = sugar_cached('modules/').$module_dir.'/language/'.$lang.'.lang.php'; |
161 | - if(file_exists($file)){ |
|
161 | + if (file_exists($file)) { |
|
162 | 162 | unlink($file); |
163 | - $key = self::getLanguageCacheKey($module_dir,$lang); |
|
163 | + $key = self::getLanguageCacheKey($module_dir, $lang); |
|
164 | 164 | sugar_cache_clear($key); |
165 | 165 | } |
166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param string $lang the given language we wish to load |
175 | 175 | * @param array $additional_search_paths an array which allows a consumer to pass in additional vardef locations to search |
176 | 176 | */ |
177 | - static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null){ |
|
177 | + static function refreshLanguage($module, $lang, $loaded_mod_strings = array(), $additional_search_paths = null) { |
|
178 | 178 | // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
179 | 179 | $lang_paths = array( |
180 | 180 | 'modules/'.$module.'/language/'.$lang.'.lang.php', |
@@ -185,35 +185,35 @@ discard block |
||
185 | 185 | |
186 | 186 | #27023, if this module template language file was not attached , get the template from this module vardef cache file if exsits and load the template language files. |
187 | 187 | static $createdModules; |
188 | - if(empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])){ |
|
188 | + if (empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])) { |
|
189 | 189 | $object = $GLOBALS['beanList'][$module]; |
190 | 190 | |
191 | 191 | if ($object == 'aCase') |
192 | 192 | $object = 'Case'; |
193 | 193 | |
194 | - if(!empty($GLOBALS["dictionary"]["$object"]["templates"])){ |
|
194 | + if (!empty($GLOBALS["dictionary"]["$object"]["templates"])) { |
|
195 | 195 | $templates = $GLOBALS["dictionary"]["$object"]["templates"]; |
196 | - $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module , $templates, $lang , $loaded_mod_strings); |
|
196 | + $loaded_mod_strings = LanguageManager::loadTemplateLanguage($module, $templates, $lang, $loaded_mod_strings); |
|
197 | 197 | $createdModules[$module] = true; |
198 | 198 | } |
199 | 199 | } |
200 | 200 | //end of fix #27023 |
201 | 201 | |
202 | 202 | // Add in additional search paths if they were provided. |
203 | - if(!empty($additional_search_paths) && is_array($additional_search_paths)) |
|
203 | + if (!empty($additional_search_paths) && is_array($additional_search_paths)) |
|
204 | 204 | { |
205 | 205 | $lang_paths = array_merge($lang_paths, $additional_search_paths); |
206 | 206 | } |
207 | 207 | |
208 | 208 | //search a predefined set of locations for the vardef files |
209 | - foreach($lang_paths as $path){ |
|
210 | - if(file_exists($path)){ |
|
209 | + foreach ($lang_paths as $path) { |
|
210 | + if (file_exists($path)) { |
|
211 | 211 | require($path); |
212 | - if(!empty($mod_strings)){ |
|
213 | - if (function_exists('sugarArrayMergeRecursive')){ |
|
212 | + if (!empty($mod_strings)) { |
|
213 | + if (function_exists('sugarArrayMergeRecursive')) { |
|
214 | 214 | $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings); |
215 | 215 | } |
216 | - else{ |
|
216 | + else { |
|
217 | 217 | $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings); |
218 | 218 | } |
219 | 219 | } |
@@ -222,43 +222,43 @@ discard block |
||
222 | 222 | |
223 | 223 | //great! now that we have loaded all of our vardefs. |
224 | 224 | //let's go save them to the cache file. |
225 | - if(!empty($loaded_mod_strings)) |
|
225 | + if (!empty($loaded_mod_strings)) |
|
226 | 226 | LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
227 | 227 | } |
228 | 228 | |
229 | - static function loadModuleLanguage($module, $lang, $refresh=false){ |
|
229 | + static function loadModuleLanguage($module, $lang, $refresh = false) { |
|
230 | 230 | //here check if the cache file exists, if it does then load it, if it doesn't |
231 | 231 | //then call refreshVardef |
232 | 232 | //if either our session or the system is set to developerMode then refresh is set to true |
233 | 233 | |
234 | 234 | // Retrieve the vardefs from cache. |
235 | - $key = self::getLanguageCacheKey($module,$lang); |
|
235 | + $key = self::getLanguageCacheKey($module, $lang); |
|
236 | 236 | |
237 | - if(!$refresh) |
|
237 | + if (!$refresh) |
|
238 | 238 | { |
239 | 239 | $return_result = sugar_cache_retrieve($key); |
240 | - if(!empty($return_result) && is_array($return_result)){ |
|
240 | + if (!empty($return_result) && is_array($return_result)) { |
|
241 | 241 | return $return_result; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | 245 | // Some of the vardefs do not correctly define dictionary as global. Declare it first. |
246 | 246 | $cachedfile = sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'; |
247 | - if($refresh || !file_exists($cachedfile)){ |
|
247 | + if ($refresh || !file_exists($cachedfile)) { |
|
248 | 248 | LanguageManager::refreshLanguage($module, $lang); |
249 | 249 | } |
250 | 250 | |
251 | 251 | //at this point we should have the cache/modules/... file |
252 | 252 | //which was created from the refreshVardefs so let's try to load it. |
253 | - if(file_exists($cachedfile)){ |
|
253 | + if (file_exists($cachedfile)) { |
|
254 | 254 | global $mod_strings; |
255 | 255 | |
256 | 256 | require $cachedfile; |
257 | 257 | |
258 | 258 | // now that we hae loaded the data from disk, put it in the cache. |
259 | - if(!empty($mod_strings)) |
|
260 | - sugar_cache_put($key,$mod_strings); |
|
261 | - if(!empty($_SESSION['translation_mode'])){ |
|
259 | + if (!empty($mod_strings)) |
|
260 | + sugar_cache_put($key, $mod_strings); |
|
261 | + if (!empty($_SESSION['translation_mode'])) { |
|
262 | 262 | $mod_strings = array_map('translated_prefix', $mod_strings); |
263 | 263 | } |
264 | 264 | return $mod_strings; |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | { |
289 | 289 | $jsFiles = array(); |
290 | 290 | getFiles($jsFiles, sugar_cached('jsLanguage')); |
291 | - foreach($jsFiles as $file) { |
|
291 | + foreach ($jsFiles as $file) { |
|
292 | 292 | unlink($file); |
293 | 293 | } |
294 | 294 | |
295 | - if( empty($GLOBALS['sugar_config']['js_lang_version']) ) |
|
295 | + if (empty($GLOBALS['sugar_config']['js_lang_version'])) |
|
296 | 296 | $GLOBALS['sugar_config']['js_lang_version'] = 1; |
297 | 297 | else |
298 | 298 | $GLOBALS['sugar_config']['js_lang_version'] += 1; |
299 | 299 | |
300 | - write_array_to_file( "sugar_config", $GLOBALS['sugar_config'], "config.php"); |
|
300 | + write_array_to_file("sugar_config", $GLOBALS['sugar_config'], "config.php"); |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | -function translated_prefix($key){ |
|
305 | - return '[translated]' . $key; |
|
304 | +function translated_prefix($key) { |
|
305 | + return '[translated]'.$key; |
|
306 | 306 | } |
@@ -56,8 +56,9 @@ discard block |
||
56 | 56 | } |
57 | 57 | $temp_mod_strings = $mod_strings; |
58 | 58 | $lang = $current_language; |
59 | - if(empty($lang)) |
|
60 | - $lang = $GLOBALS['sugar_config']['default_language']; |
|
59 | + if(empty($lang)) { |
|
60 | + $lang = $GLOBALS['sugar_config']['default_language']; |
|
61 | + } |
|
61 | 62 | static $createdModules = array(); |
62 | 63 | if(empty($createdModules[$module]) && ($refresh || !file_exists(sugar_cached('modules/').$module.'/language/'.$lang.'.lang.php'))){ |
63 | 64 | $loaded_mod_strings = array(); |
@@ -84,7 +85,9 @@ discard block |
||
84 | 85 | } |
85 | 86 | |
86 | 87 | static function addTemplate($module, $lang, $template){ |
87 | - if($template == 'default')$template = 'basic'; |
|
88 | + if($template == 'default') { |
|
89 | + $template = 'basic'; |
|
90 | + } |
|
88 | 91 | $templates = array(); |
89 | 92 | $fields = array(); |
90 | 93 | if(empty($templates[$template])){ |
@@ -92,7 +95,7 @@ discard block |
||
92 | 95 | if(file_exists($path)){ |
93 | 96 | require($path); |
94 | 97 | $templates[$template] = $mod_strings; |
95 | - }else{ |
|
98 | + } else{ |
|
96 | 99 | $path = 'include/SugarObjects/implements/' . $template . '/language/'.$lang.'.lang.php'; |
97 | 100 | if(file_exists($path)){ |
98 | 101 | require($path); |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | } |
107 | 110 | |
108 | 111 | static function saveCache($module,$lang, $loaded_mod_strings, $additonal_objects= array()){ |
109 | - if(empty($lang)) |
|
110 | - $lang = $GLOBALS['sugar_config']['default_language']; |
|
112 | + if(empty($lang)) { |
|
113 | + $lang = $GLOBALS['sugar_config']['default_language']; |
|
114 | + } |
|
111 | 115 | |
112 | 116 | $file = create_cache_directory('modules/' . $module . '/language/'.$lang.'.lang.php'); |
113 | 117 | write_array_to_file('mod_strings',$loaded_mod_strings, $file); |
@@ -140,7 +144,9 @@ discard block |
||
140 | 144 | $cache_dir = sugar_cached('modules/'); |
141 | 145 | if(file_exists($cache_dir) && $dir = @opendir($cache_dir)) { |
142 | 146 | while(($entry = readdir($dir)) !== false) { |
143 | - if ($entry == "." || $entry == "..") continue; |
|
147 | + if ($entry == "." || $entry == "..") { |
|
148 | + continue; |
|
149 | + } |
|
144 | 150 | foreach($languages as $clean_lang) { |
145 | 151 | LanguageManager::_clearCache($entry, $clean_lang); |
146 | 152 | } |
@@ -188,8 +194,9 @@ discard block |
||
188 | 194 | if(empty($createdModules[$module]) && isset($GLOBALS['beanList'][$module])){ |
189 | 195 | $object = $GLOBALS['beanList'][$module]; |
190 | 196 | |
191 | - if ($object == 'aCase') |
|
192 | - $object = 'Case'; |
|
197 | + if ($object == 'aCase') { |
|
198 | + $object = 'Case'; |
|
199 | + } |
|
193 | 200 | |
194 | 201 | if(!empty($GLOBALS["dictionary"]["$object"]["templates"])){ |
195 | 202 | $templates = $GLOBALS["dictionary"]["$object"]["templates"]; |
@@ -212,8 +219,7 @@ discard block |
||
212 | 219 | if(!empty($mod_strings)){ |
213 | 220 | if (function_exists('sugarArrayMergeRecursive')){ |
214 | 221 | $loaded_mod_strings = sugarArrayMergeRecursive($loaded_mod_strings, $mod_strings); |
215 | - } |
|
216 | - else{ |
|
222 | + } else{ |
|
217 | 223 | $loaded_mod_strings = sugarLangArrayMerge($loaded_mod_strings, $mod_strings); |
218 | 224 | } |
219 | 225 | } |
@@ -222,8 +228,9 @@ discard block |
||
222 | 228 | |
223 | 229 | //great! now that we have loaded all of our vardefs. |
224 | 230 | //let's go save them to the cache file. |
225 | - if(!empty($loaded_mod_strings)) |
|
226 | - LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
231 | + if(!empty($loaded_mod_strings)) { |
|
232 | + LanguageManager::saveCache($module, $lang, $loaded_mod_strings); |
|
233 | + } |
|
227 | 234 | } |
228 | 235 | |
229 | 236 | static function loadModuleLanguage($module, $lang, $refresh=false){ |
@@ -256,8 +263,9 @@ discard block |
||
256 | 263 | require $cachedfile; |
257 | 264 | |
258 | 265 | // now that we hae loaded the data from disk, put it in the cache. |
259 | - if(!empty($mod_strings)) |
|
260 | - sugar_cache_put($key,$mod_strings); |
|
266 | + if(!empty($mod_strings)) { |
|
267 | + sugar_cache_put($key,$mod_strings); |
|
268 | + } |
|
261 | 269 | if(!empty($_SESSION['translation_mode'])){ |
262 | 270 | $mod_strings = array_map('translated_prefix', $mod_strings); |
263 | 271 | } |
@@ -292,10 +300,11 @@ discard block |
||
292 | 300 | unlink($file); |
293 | 301 | } |
294 | 302 | |
295 | - if( empty($GLOBALS['sugar_config']['js_lang_version']) ) |
|
296 | - $GLOBALS['sugar_config']['js_lang_version'] = 1; |
|
297 | - else |
|
298 | - $GLOBALS['sugar_config']['js_lang_version'] += 1; |
|
303 | + if( empty($GLOBALS['sugar_config']['js_lang_version']) ) { |
|
304 | + $GLOBALS['sugar_config']['js_lang_version'] = 1; |
|
305 | + } else { |
|
306 | + $GLOBALS['sugar_config']['js_lang_version'] += 1; |
|
307 | + } |
|
299 | 308 | |
300 | 309 | write_array_to_file( "sugar_config", $GLOBALS['sugar_config'], "config.php"); |
301 | 310 | } |
@@ -1,5 +1,7 @@ |
||
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. |