@@ -43,6 +43,6 @@ |
||
43 | 43 | |
44 | 44 | |
45 | 45 | $dashletStrings['CampaignROIChartDashlet'] = array('LBL_TITLE' => 'Campaign ROI', |
46 | - 'LBL_DESCRIPTION' => 'ROI Chart', |
|
47 | - 'LBL_REFRESH' => 'Refresh Chart'); |
|
46 | + 'LBL_DESCRIPTION' => 'ROI Chart', |
|
47 | + 'LBL_REFRESH' => 'Refresh Chart'); |
|
48 | 48 | ?> |
49 | 49 | \ No newline at end of file |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | global $currentModule; |
53 | 53 | |
54 | 54 | switch ($_REQUEST['view']) { |
55 | - case "support_portal": |
|
56 | - if (!is_admin($current_user)) sugar_die("Unauthorized access to administration."); |
|
57 | - $GLOBALS['log']->info("Administration SupportPortal"); |
|
55 | + case "support_portal": |
|
56 | + if (!is_admin($current_user)) sugar_die("Unauthorized access to administration."); |
|
57 | + $GLOBALS['log']->info("Administration SupportPortal"); |
|
58 | 58 | |
59 | - $iframe_url = add_http("www.sugarcrm.com/network/redirect.php?tmpl=network"); |
|
59 | + $iframe_url = add_http("www.sugarcrm.com/network/redirect.php?tmpl=network"); |
|
60 | 60 | |
61 | 61 | echo getClassicModuleTitle( |
62 | 62 | "Administration", |
63 | 63 | array( |
64 | 64 | "<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>", |
65 | - $mod_strings['LBL_SUPPORT_TITLE'], |
|
66 | - ), |
|
65 | + $mod_strings['LBL_SUPPORT_TITLE'], |
|
66 | + ), |
|
67 | 67 | false |
68 | 68 | ); |
69 | 69 | |
@@ -72,157 +72,157 @@ discard block |
||
72 | 72 | $sugar_smarty->assign('langHeader', get_language_header()); |
73 | 73 | echo $sugar_smarty->fetch('modules/Administration/SupportPortal.tpl'); |
74 | 74 | |
75 | - break; |
|
76 | - default: |
|
77 | - |
|
78 | - $send_version = isset($_REQUEST['version']) ? $_REQUEST['version'] : ""; |
|
79 | - $send_edition = isset($_REQUEST['edition']) ? $_REQUEST['edition'] : ""; |
|
80 | - $send_lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : ""; |
|
81 | - $send_module = isset($_REQUEST['help_module']) ? $_REQUEST['help_module'] : ""; |
|
82 | - $send_action = isset($_REQUEST['help_action']) ? $_REQUEST['help_action'] : ""; |
|
83 | - $send_key = isset($_REQUEST['key']) ? $_REQUEST['key'] : ""; |
|
84 | - $send_anchor = ''; |
|
85 | - // awu: Fixes the ProjectTasks pluralization issue -- must fix in later versions. |
|
86 | - if ($send_module == 'ProjectTasks') |
|
87 | - $send_module = 'ProjectTask'; |
|
75 | + break; |
|
76 | + default: |
|
77 | + |
|
78 | + $send_version = isset($_REQUEST['version']) ? $_REQUEST['version'] : ""; |
|
79 | + $send_edition = isset($_REQUEST['edition']) ? $_REQUEST['edition'] : ""; |
|
80 | + $send_lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : ""; |
|
81 | + $send_module = isset($_REQUEST['help_module']) ? $_REQUEST['help_module'] : ""; |
|
82 | + $send_action = isset($_REQUEST['help_action']) ? $_REQUEST['help_action'] : ""; |
|
83 | + $send_key = isset($_REQUEST['key']) ? $_REQUEST['key'] : ""; |
|
84 | + $send_anchor = ''; |
|
85 | + // awu: Fixes the ProjectTasks pluralization issue -- must fix in later versions. |
|
86 | + if ($send_module == 'ProjectTasks') |
|
87 | + $send_module = 'ProjectTask'; |
|
88 | 88 | if ($send_module == 'ProductCatalog') |
89 | 89 | $send_module = 'ProductTemplates'; |
90 | 90 | if ($send_module == 'TargetLists') |
91 | 91 | $send_module = 'ProspectLists'; |
92 | 92 | if ($send_module == 'Targets') |
93 | 93 | $send_module = 'Prospects'; |
94 | - // FG - Bug 39819 - Check for custom help files |
|
95 | - $helpPath = 'modules/'.$send_module.'/language/'.$send_lang.'.help.'.$send_action.'.html'; |
|
96 | - if (sugar_is_file("custom/" . $helpPath)) { |
|
97 | - $helpPath = 'custom/' . $helpPath; |
|
98 | - } |
|
99 | - $sugar_smarty = new Sugar_Smarty(); |
|
100 | - |
|
101 | - //go to the support portal if the file is not found. |
|
102 | - // FG - Bug 39820 - Devs can write help files also in english, so skip check for language not equals "en_us" ! |
|
103 | - if (file_exists($helpPath)) |
|
104 | - { |
|
105 | - $sugar_smarty->assign('helpFileExists', TRUE); |
|
106 | - $sugar_smarty->assign('MOD', $mod_strings); |
|
107 | - $sugar_smarty->assign('modulename', $send_module); |
|
108 | - $sugar_smarty->assign('helpPath', $helpPath); |
|
109 | - $sugar_smarty->assign('currentURL', getCurrentURL()); |
|
110 | - $sugar_smarty->assign('title', $mod_strings['LBL_SUGARCRM_HELP'] . " - " . $send_module); |
|
111 | - $sugar_smarty->assign('styleSheet', SugarThemeRegistry::current()->getCSS()); |
|
112 | - $sugar_smarty->assign('table', "<table class='tabForm'><tr><td>"); |
|
113 | - $sugar_smarty->assign('endtable', "</td></tr></table>"); |
|
114 | - $sugar_smarty->assign('charset', $app_strings['LBL_CHARSET']); |
|
94 | + // FG - Bug 39819 - Check for custom help files |
|
95 | + $helpPath = 'modules/'.$send_module.'/language/'.$send_lang.'.help.'.$send_action.'.html'; |
|
96 | + if (sugar_is_file("custom/" . $helpPath)) { |
|
97 | + $helpPath = 'custom/' . $helpPath; |
|
98 | + } |
|
99 | + $sugar_smarty = new Sugar_Smarty(); |
|
100 | + |
|
101 | + //go to the support portal if the file is not found. |
|
102 | + // FG - Bug 39820 - Devs can write help files also in english, so skip check for language not equals "en_us" ! |
|
103 | + if (file_exists($helpPath)) |
|
104 | + { |
|
105 | + $sugar_smarty->assign('helpFileExists', TRUE); |
|
106 | + $sugar_smarty->assign('MOD', $mod_strings); |
|
107 | + $sugar_smarty->assign('modulename', $send_module); |
|
108 | + $sugar_smarty->assign('helpPath', $helpPath); |
|
109 | + $sugar_smarty->assign('currentURL', getCurrentURL()); |
|
110 | + $sugar_smarty->assign('title', $mod_strings['LBL_SUGARCRM_HELP'] . " - " . $send_module); |
|
111 | + $sugar_smarty->assign('styleSheet', SugarThemeRegistry::current()->getCSS()); |
|
112 | + $sugar_smarty->assign('table', "<table class='tabForm'><tr><td>"); |
|
113 | + $sugar_smarty->assign('endtable', "</td></tr></table>"); |
|
114 | + $sugar_smarty->assign('charset', $app_strings['LBL_CHARSET']); |
|
115 | 115 | $sugar_smarty->assign('langHeader', get_language_header()); |
116 | - echo $sugar_smarty->fetch('modules/Administration/SupportPortal.tpl'); |
|
116 | + echo $sugar_smarty->fetch('modules/Administration/SupportPortal.tpl'); |
|
117 | 117 | |
118 | - } else { |
|
119 | - if(empty($send_module)){ |
|
120 | - $send_module = 'toc'; |
|
121 | - } |
|
118 | + } else { |
|
119 | + if(empty($send_module)){ |
|
120 | + $send_module = 'toc'; |
|
121 | + } |
|
122 | 122 | |
123 | - $dev_status = 'GA'; |
|
124 | - //If there is an alphabetic portion between the decimal prefix and integer suffix, then use the |
|
125 | - //value there as the dev_status value |
|
126 | - $dev_status = getVersionStatus($GLOBALS['sugar_version']); |
|
127 | - $send_version = getMajorMinorVersion($GLOBALS['sugar_version']); |
|
128 | - $editionMap = array('ENT' => 'Enterprise', 'PRO' => 'Professional', 'CE' => 'Community_Edition'); |
|
129 | - if(!empty($editionMap[$send_edition])){ |
|
130 | - $send_edition = $editionMap[$send_edition]; |
|
131 | - } |
|
123 | + $dev_status = 'GA'; |
|
124 | + //If there is an alphabetic portion between the decimal prefix and integer suffix, then use the |
|
125 | + //value there as the dev_status value |
|
126 | + $dev_status = getVersionStatus($GLOBALS['sugar_version']); |
|
127 | + $send_version = getMajorMinorVersion($GLOBALS['sugar_version']); |
|
128 | + $editionMap = array('ENT' => 'Enterprise', 'PRO' => 'Professional', 'CE' => 'Community_Edition'); |
|
129 | + if(!empty($editionMap[$send_edition])){ |
|
130 | + $send_edition = $editionMap[$send_edition]; |
|
131 | + } |
|
132 | 132 | |
133 | - //map certain modules |
|
134 | - $sendModuleMap = array( |
|
135 | - 'administration' => array( |
|
136 | - array('name' => 'Administration', 'action' => 'supportportal', 'anchor' => '1910574'), |
|
137 | - array('name' => 'Administration', 'action' => 'updater', 'anchor' => '1910574'), |
|
138 | - array('name' => 'Administration', 'action' => 'licensesettings', 'anchor' => '1910574'), |
|
139 | - array('name' => 'Administration', 'action' => 'diagnostic', 'anchor' => '1111949'), |
|
140 | - array('name' => 'Administration', 'action' => 'listviewofflineclient', 'anchor' => '1111949'), |
|
141 | - array('name' => 'Administration', 'action' => 'backups', 'anchor' => '1111949'), |
|
142 | - array('name' => 'Administration', 'action' => 'upgrade', 'anchor' => '1111949'), |
|
143 | - array('name' => 'Administration', 'action' => 'locale', 'anchor' => '1111949'), |
|
144 | - array('name' => 'Administration', 'action' => 'themesettings', 'anchor' => '1111949'), |
|
145 | - array('name' => 'Administration', 'action' => 'passwordmanager', 'anchor' => '1446494'), |
|
146 | - array('name' => 'Administration', 'action' => 'upgradewizard', 'anchor' => '1168410'), |
|
147 | - array('name' => 'Administration', 'action' => 'configuretabs', 'anchor' => '1168410'), |
|
148 | - array('name' => 'Administration', 'action' => 'configuresubpanels', 'anchor' => '1168410'), |
|
149 | - array('name' => 'Administration', 'action' => 'wizard', 'anchor' => '1168410'), |
|
150 | - ), |
|
151 | - 'calls' => array(array('name' => 'Activities')), |
|
152 | - 'tasks' => array(array('name' => 'Activities')), |
|
153 | - 'meetings' => array(array('name' => 'Activities')), |
|
154 | - 'notes' => array(array('name' => 'Activities')), |
|
155 | - 'calendar' => array(array('name' => 'Activities')), |
|
156 | - 'configurator' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
157 | - 'upgradewizard' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
158 | - 'schedulers' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
159 | - 'sugarfeed' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
160 | - 'connectors' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
161 | - 'trackers' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
162 | - 'currencies' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
163 | - 'aclroles' => array(array('name' => 'Administration', 'anchor' => '1916499')), |
|
164 | - 'roles' => array(array('name' => 'Administration', 'anchor' => '1916499')), |
|
165 | - 'teams' => array(array('name' => 'Administration', 'anchor' => '1916499')), |
|
166 | - 'users' => array(array('name' => 'Administration', 'anchor' => '1916499'), array('name' => 'Administration', 'action' => 'detailview', 'anchor' => '1916518')), |
|
167 | - 'modulebuilder' => array(array('name' => 'Administration', 'anchor' => '1168410')), |
|
168 | - 'studio' => array(array('name' => 'Administration', 'anchor' => '1168410')), |
|
169 | - 'workflow' => array(array('name' => 'Administration', 'anchor' => '1168410')), |
|
170 | - 'producttemplates' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
171 | - 'productcategories' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
172 | - 'producttypes' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
173 | - 'manufacturers' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
174 | - 'shippers' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
175 | - 'taxrates' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
176 | - 'releases' => array(array('name' => 'Administration', 'anchor' => '1868932')), |
|
177 | - 'timeperiods' => array(array('name' => 'Administration', 'anchor' => '1957639')), |
|
178 | - 'contracttypes' => array(array('name' => 'Administration', 'anchor' => '1957677')), |
|
179 | - 'contracttype' => array(array('name' => 'Administration', 'anchor' => '1957677')), |
|
180 | - 'emailman' => array(array('name' => 'Administration', 'anchor' => '1445484')), |
|
181 | - 'inboundemail' => array(array('name' => 'Administration', 'anchor' => '1445484')), |
|
182 | - 'emailtemplates' => array(array('name' => 'Emails')), |
|
183 | - 'prospects' => array(array('name' => 'Campaigns')), |
|
184 | - 'prospectlists' => array(array('name' => 'Campaigns')), |
|
185 | - 'reportmaker' => array(array('name' => 'Reports')), |
|
186 | - 'customqueries' => array(array('name' => 'Reports')), |
|
187 | - 'quotas' => array(array('name' => 'Forecasts')), |
|
188 | - 'projecttask' => array(array('name' => 'Projects')), |
|
189 | - 'project' => array(array('name' => 'Projects'), array('name' => 'Dashboard', 'action' => 'dashboard'), ), |
|
190 | - 'projecttemplate' => array(array('name' => 'Projects')), |
|
191 | - 'datasets' => array(array('name' => 'Reports')), |
|
192 | - 'dataformat' => array(array('name' => 'Reports')), |
|
193 | - 'employees' => array(array('name' => 'Administration', 'anchor' => '1957677')), |
|
194 | - 'kbdocuments' => array(array('name' => 'Administration', 'action' => 'kbadminview', 'anchor' => '1957677')), |
|
195 | - ); |
|
133 | + //map certain modules |
|
134 | + $sendModuleMap = array( |
|
135 | + 'administration' => array( |
|
136 | + array('name' => 'Administration', 'action' => 'supportportal', 'anchor' => '1910574'), |
|
137 | + array('name' => 'Administration', 'action' => 'updater', 'anchor' => '1910574'), |
|
138 | + array('name' => 'Administration', 'action' => 'licensesettings', 'anchor' => '1910574'), |
|
139 | + array('name' => 'Administration', 'action' => 'diagnostic', 'anchor' => '1111949'), |
|
140 | + array('name' => 'Administration', 'action' => 'listviewofflineclient', 'anchor' => '1111949'), |
|
141 | + array('name' => 'Administration', 'action' => 'backups', 'anchor' => '1111949'), |
|
142 | + array('name' => 'Administration', 'action' => 'upgrade', 'anchor' => '1111949'), |
|
143 | + array('name' => 'Administration', 'action' => 'locale', 'anchor' => '1111949'), |
|
144 | + array('name' => 'Administration', 'action' => 'themesettings', 'anchor' => '1111949'), |
|
145 | + array('name' => 'Administration', 'action' => 'passwordmanager', 'anchor' => '1446494'), |
|
146 | + array('name' => 'Administration', 'action' => 'upgradewizard', 'anchor' => '1168410'), |
|
147 | + array('name' => 'Administration', 'action' => 'configuretabs', 'anchor' => '1168410'), |
|
148 | + array('name' => 'Administration', 'action' => 'configuresubpanels', 'anchor' => '1168410'), |
|
149 | + array('name' => 'Administration', 'action' => 'wizard', 'anchor' => '1168410'), |
|
150 | + ), |
|
151 | + 'calls' => array(array('name' => 'Activities')), |
|
152 | + 'tasks' => array(array('name' => 'Activities')), |
|
153 | + 'meetings' => array(array('name' => 'Activities')), |
|
154 | + 'notes' => array(array('name' => 'Activities')), |
|
155 | + 'calendar' => array(array('name' => 'Activities')), |
|
156 | + 'configurator' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
157 | + 'upgradewizard' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
158 | + 'schedulers' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
159 | + 'sugarfeed' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
160 | + 'connectors' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
161 | + 'trackers' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
162 | + 'currencies' => array(array('name' => 'Administration', 'anchor' => '1878359')), |
|
163 | + 'aclroles' => array(array('name' => 'Administration', 'anchor' => '1916499')), |
|
164 | + 'roles' => array(array('name' => 'Administration', 'anchor' => '1916499')), |
|
165 | + 'teams' => array(array('name' => 'Administration', 'anchor' => '1916499')), |
|
166 | + 'users' => array(array('name' => 'Administration', 'anchor' => '1916499'), array('name' => 'Administration', 'action' => 'detailview', 'anchor' => '1916518')), |
|
167 | + 'modulebuilder' => array(array('name' => 'Administration', 'anchor' => '1168410')), |
|
168 | + 'studio' => array(array('name' => 'Administration', 'anchor' => '1168410')), |
|
169 | + 'workflow' => array(array('name' => 'Administration', 'anchor' => '1168410')), |
|
170 | + 'producttemplates' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
171 | + 'productcategories' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
172 | + 'producttypes' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
173 | + 'manufacturers' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
174 | + 'shippers' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
175 | + 'taxrates' => array(array('name' => 'Administration', 'anchor' => '1957376')), |
|
176 | + 'releases' => array(array('name' => 'Administration', 'anchor' => '1868932')), |
|
177 | + 'timeperiods' => array(array('name' => 'Administration', 'anchor' => '1957639')), |
|
178 | + 'contracttypes' => array(array('name' => 'Administration', 'anchor' => '1957677')), |
|
179 | + 'contracttype' => array(array('name' => 'Administration', 'anchor' => '1957677')), |
|
180 | + 'emailman' => array(array('name' => 'Administration', 'anchor' => '1445484')), |
|
181 | + 'inboundemail' => array(array('name' => 'Administration', 'anchor' => '1445484')), |
|
182 | + 'emailtemplates' => array(array('name' => 'Emails')), |
|
183 | + 'prospects' => array(array('name' => 'Campaigns')), |
|
184 | + 'prospectlists' => array(array('name' => 'Campaigns')), |
|
185 | + 'reportmaker' => array(array('name' => 'Reports')), |
|
186 | + 'customqueries' => array(array('name' => 'Reports')), |
|
187 | + 'quotas' => array(array('name' => 'Forecasts')), |
|
188 | + 'projecttask' => array(array('name' => 'Projects')), |
|
189 | + 'project' => array(array('name' => 'Projects'), array('name' => 'Dashboard', 'action' => 'dashboard'), ), |
|
190 | + 'projecttemplate' => array(array('name' => 'Projects')), |
|
191 | + 'datasets' => array(array('name' => 'Reports')), |
|
192 | + 'dataformat' => array(array('name' => 'Reports')), |
|
193 | + 'employees' => array(array('name' => 'Administration', 'anchor' => '1957677')), |
|
194 | + 'kbdocuments' => array(array('name' => 'Administration', 'action' => 'kbadminview', 'anchor' => '1957677')), |
|
195 | + ); |
|
196 | 196 | |
197 | - if(!empty($sendModuleMap[strtolower($send_module)])){ |
|
198 | - $mappings = $sendModuleMap[strtolower($send_module)]; |
|
197 | + if(!empty($sendModuleMap[strtolower($send_module)])){ |
|
198 | + $mappings = $sendModuleMap[strtolower($send_module)]; |
|
199 | 199 | |
200 | - foreach($mappings as $map){ |
|
201 | - if(!empty($map['action'])){ |
|
202 | - if($map['action'] == strtolower($send_action)){ |
|
203 | - $send_module = $map['name']; |
|
204 | - if(!empty($map['anchor'])){ |
|
205 | - $send_anchor = $map['anchor']; |
|
206 | - } |
|
207 | - } |
|
208 | - }else{ |
|
209 | - $send_module = $map['name']; |
|
210 | - if(!empty($map['anchor'])){ |
|
211 | - $send_anchor = $map['anchor']; |
|
212 | - } |
|
213 | - } |
|
214 | - } |
|
215 | - //$send_module = $sendModuleMap[strtolower($send_module)]; |
|
216 | - } |
|
200 | + foreach($mappings as $map){ |
|
201 | + if(!empty($map['action'])){ |
|
202 | + if($map['action'] == strtolower($send_action)){ |
|
203 | + $send_module = $map['name']; |
|
204 | + if(!empty($map['anchor'])){ |
|
205 | + $send_anchor = $map['anchor']; |
|
206 | + } |
|
207 | + } |
|
208 | + }else{ |
|
209 | + $send_module = $map['name']; |
|
210 | + if(!empty($map['anchor'])){ |
|
211 | + $send_anchor = $map['anchor']; |
|
212 | + } |
|
213 | + } |
|
214 | + } |
|
215 | + //$send_module = $sendModuleMap[strtolower($send_module)]; |
|
216 | + } |
|
217 | 217 | |
218 | 218 | |
219 | 219 | $iframe_url = get_help_url($send_edition, $send_version, $send_lang, $send_module, $send_action, $dev_status, $send_key, $send_anchor); |
220 | 220 | |
221 | - header("Location: {$iframe_url}"); |
|
221 | + header("Location: {$iframe_url}"); |
|
222 | 222 | |
223 | - //$sugar_smarty->assign('helpFileExists', FALSE); |
|
224 | - //$sugar_smarty->assign('iframeURL', $iframe_url); |
|
225 | - } |
|
226 | - break; |
|
223 | + //$sugar_smarty->assign('helpFileExists', FALSE); |
|
224 | + //$sugar_smarty->assign('iframeURL', $iframe_url); |
|
225 | + } |
|
226 | + break; |
|
227 | 227 | |
228 | 228 | } |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | global $db; |
70 | 70 | if(empty($db)) { |
71 | 71 | |
72 | - $db = DBManagerFactory::getInstance(); |
|
72 | + $db = DBManagerFactory::getInstance(); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | global $current_user; |
76 | 76 | if(!is_admin($current_user)){ |
77 | - die($mod_strings['LBL_DIAGNOSTIC_ACCESS']); |
|
77 | + die($mod_strings['LBL_DIAGNOSTIC_ACCESS']); |
|
78 | 78 | } |
79 | 79 | global $sugar_config; |
80 | 80 | global $beanFiles; |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | |
133 | 133 | $currentitems++; |
134 | 134 | if($currentitems == $totalitems) |
135 | - update_progress_bar("diagnostic", 100, 100); |
|
135 | + update_progress_bar("diagnostic", 100, 100); |
|
136 | 136 | else |
137 | 137 | { |
138 | - $progress_bar_percent += ($itemweight / $GLOBALS['totalweight'] * 100); |
|
139 | - update_progress_bar("diagnostic", $progress_bar_percent, 100); |
|
138 | + $progress_bar_percent += ($itemweight / $GLOBALS['totalweight'] * 100); |
|
139 | + update_progress_bar("diagnostic", $progress_bar_percent, 100); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | $contents .= "<tr colspan=\"$cols\">$header</tr><tr>"; |
160 | 160 | foreach($keys as $key) { |
161 | - $contents .= "<th class=\"tabDetailViewDL\"><b>$key</b></th>"; |
|
161 | + $contents .= "<th class=\"tabDetailViewDL\"><b>$key</b></th>"; |
|
162 | 162 | } |
163 | 163 | $contents .= "</tr>"; |
164 | 164 | foreach($values as $field) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // returns a string containing (in html) the dump of all rows |
181 | 181 | function getFullTableDump($tableName){ |
182 | 182 | |
183 | - global $db; |
|
183 | + global $db; |
|
184 | 184 | |
185 | 185 | $cols = $db->get_columns($tableName); |
186 | 186 | $indexes = $db->get_indices($tableName); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | $def_count = count($cols); |
194 | 194 | |
195 | - $td_result = $db->query("select * from ".$tableName); |
|
195 | + $td_result = $db->query("select * from ".$tableName); |
|
196 | 196 | if(!$td_result) { |
197 | 197 | return $db->lastError(); |
198 | 198 | } |
@@ -204,124 +204,124 @@ discard block |
||
204 | 204 | } |
205 | 205 | $returnString .= "</tr>"; |
206 | 206 | $row_counter = 1; |
207 | - while($row = $db->fetchByAssoc($td_result)) |
|
208 | - { |
|
209 | - $row = array_values($row); |
|
210 | - $returnString .= "<tr>"; |
|
211 | - $returnString .= "<td class=\"tabDetailViewDL\">".$row_counter."</td>"; |
|
212 | - for($counter = 0; $counter < $def_count; $counter++) { |
|
207 | + while($row = $db->fetchByAssoc($td_result)) |
|
208 | + { |
|
209 | + $row = array_values($row); |
|
210 | + $returnString .= "<tr>"; |
|
211 | + $returnString .= "<td class=\"tabDetailViewDL\">".$row_counter."</td>"; |
|
212 | + for($counter = 0; $counter < $def_count; $counter++) { |
|
213 | 213 | $replace_val = false; |
214 | - //perform this check when counter is set to two, which means it is on the 'value' column |
|
215 | - if($counter == 2) { |
|
216 | - //if the previous "name" column value was set to smtppass, set replace_val to true |
|
217 | - if(strcmp($row[$counter - 1], "smtppass") == 0 ) |
|
218 | - $replace_val = true; |
|
219 | - |
|
220 | - //if the previous "name" column value was set to smtppass, |
|
221 | - //and the "category" value set to ldap, set replace_val to true |
|
222 | - if (strcmp($row[$counter - 2], "ldap") == 0 && strcmp($row[$counter - 1], "admin_password") == 0) |
|
223 | - $replace_val = true; |
|
224 | - |
|
225 | - //if the previous "name" column value was set to password, |
|
226 | - //and the "category" value set to proxy, set replace_val to true |
|
227 | - if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 ) |
|
228 | - $replace_val = true; |
|
229 | - } |
|
230 | - |
|
231 | - if($replace_val) { |
|
232 | - $returnString .= "<td class=\"tabDetailViewDF\">********</td>"; |
|
214 | + //perform this check when counter is set to two, which means it is on the 'value' column |
|
215 | + if($counter == 2) { |
|
216 | + //if the previous "name" column value was set to smtppass, set replace_val to true |
|
217 | + if(strcmp($row[$counter - 1], "smtppass") == 0 ) |
|
218 | + $replace_val = true; |
|
219 | + |
|
220 | + //if the previous "name" column value was set to smtppass, |
|
221 | + //and the "category" value set to ldap, set replace_val to true |
|
222 | + if (strcmp($row[$counter - 2], "ldap") == 0 && strcmp($row[$counter - 1], "admin_password") == 0) |
|
223 | + $replace_val = true; |
|
224 | + |
|
225 | + //if the previous "name" column value was set to password, |
|
226 | + //and the "category" value set to proxy, set replace_val to true |
|
227 | + if(strcmp($row[$counter - 2], "proxy") == 0 && strcmp($row[$counter - 1], "password") == 0 ) |
|
228 | + $replace_val = true; |
|
229 | + } |
|
230 | + |
|
231 | + if($replace_val) { |
|
232 | + $returnString .= "<td class=\"tabDetailViewDF\">********</td>"; |
|
233 | 233 | } else { |
234 | - $returnString .= "<td class=\"tabDetailViewDF\">".($row[$counter] == "" ? " " : $row[$counter])."</td>"; |
|
235 | - } |
|
236 | - } |
|
234 | + $returnString .= "<td class=\"tabDetailViewDF\">".($row[$counter] == "" ? " " : $row[$counter])."</td>"; |
|
235 | + } |
|
236 | + } |
|
237 | 237 | $row_counter++; |
238 | 238 | $returnString .= "</tr>"; |
239 | 239 | } |
240 | - $returnString .= "</table>"; |
|
240 | + $returnString .= "</table>"; |
|
241 | 241 | |
242 | - return $returnString; |
|
242 | + return $returnString; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | // Deletes the directory recursively |
246 | 246 | function deleteDir($dir) |
247 | 247 | { |
248 | - if (substr($dir, strlen($dir)-1, 1) != '/') |
|
249 | - $dir .= '/'; |
|
250 | - |
|
251 | - if ($handle = opendir($dir)) |
|
252 | - { |
|
253 | - while ($obj = readdir($handle)) |
|
254 | - { |
|
255 | - if ($obj != '.' && $obj != '..') |
|
256 | - { |
|
257 | - if (is_dir($dir.$obj)) |
|
258 | - { |
|
259 | - if (!deleteDir($dir.$obj)) |
|
260 | - return false; |
|
261 | - } |
|
262 | - elseif (is_file($dir.$obj)) |
|
263 | - { |
|
264 | - if (!unlink($dir.$obj)) |
|
265 | - return false; |
|
266 | - } |
|
267 | - } |
|
268 | - } |
|
269 | - |
|
270 | - closedir($handle); |
|
271 | - |
|
272 | - if (!@rmdir($dir)) |
|
273 | - return false; |
|
274 | - return true; |
|
275 | - } |
|
276 | - return false; |
|
248 | + if (substr($dir, strlen($dir)-1, 1) != '/') |
|
249 | + $dir .= '/'; |
|
250 | + |
|
251 | + if ($handle = opendir($dir)) |
|
252 | + { |
|
253 | + while ($obj = readdir($handle)) |
|
254 | + { |
|
255 | + if ($obj != '.' && $obj != '..') |
|
256 | + { |
|
257 | + if (is_dir($dir.$obj)) |
|
258 | + { |
|
259 | + if (!deleteDir($dir.$obj)) |
|
260 | + return false; |
|
261 | + } |
|
262 | + elseif (is_file($dir.$obj)) |
|
263 | + { |
|
264 | + if (!unlink($dir.$obj)) |
|
265 | + return false; |
|
266 | + } |
|
267 | + } |
|
268 | + } |
|
269 | + |
|
270 | + closedir($handle); |
|
271 | + |
|
272 | + if (!@rmdir($dir)) |
|
273 | + return false; |
|
274 | + return true; |
|
275 | + } |
|
276 | + return false; |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | |
280 | 280 | function prepareDiag() |
281 | 281 | { |
282 | - global $getDumpsFrom; |
|
283 | - global $cacheDir; |
|
284 | - global $curdatetime; |
|
285 | - global $progress_bar_percent; |
|
286 | - global $skip_md5_diff; |
|
287 | - global $sod_guid; |
|
288 | - global $mod_strings; |
|
289 | - |
|
290 | - echo getClassicModuleTitle( |
|
282 | + global $getDumpsFrom; |
|
283 | + global $cacheDir; |
|
284 | + global $curdatetime; |
|
285 | + global $progress_bar_percent; |
|
286 | + global $skip_md5_diff; |
|
287 | + global $sod_guid; |
|
288 | + global $mod_strings; |
|
289 | + |
|
290 | + echo getClassicModuleTitle( |
|
291 | 291 | "Administration", |
292 | 292 | array( |
293 | 293 | "<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>", |
294 | - translate('LBL_DIAGNOSTIC_TITLE') |
|
295 | - ), |
|
294 | + translate('LBL_DIAGNOSTIC_TITLE') |
|
295 | + ), |
|
296 | 296 | false |
297 | 297 | ); |
298 | - echo "<BR>"; |
|
299 | - echo $mod_strings['LBL_DIAGNOSTIC_EXECUTING']; |
|
300 | - echo "<BR>"; |
|
298 | + echo "<BR>"; |
|
299 | + echo $mod_strings['LBL_DIAGNOSTIC_EXECUTING']; |
|
300 | + echo "<BR>"; |
|
301 | 301 | |
302 | 302 | |
303 | - //determine if files.md5 exists or not |
|
304 | - if(file_exists('files.md5')) |
|
305 | - $skip_md5_diff = false; |
|
306 | - else |
|
307 | - $skip_md5_diff = true; |
|
303 | + //determine if files.md5 exists or not |
|
304 | + if(file_exists('files.md5')) |
|
305 | + $skip_md5_diff = false; |
|
306 | + else |
|
307 | + $skip_md5_diff = true; |
|
308 | 308 | |
309 | - // array of all tables that we need to pull rows from below |
|
310 | - $getDumpsFrom = array('config' => 'config', |
|
311 | - 'fields_meta_data' => 'fields_meta_data', |
|
312 | - 'upgrade_history' => 'upgrade_history', |
|
313 | - 'versions' => 'versions', |
|
314 | - ); |
|
309 | + // array of all tables that we need to pull rows from below |
|
310 | + $getDumpsFrom = array('config' => 'config', |
|
311 | + 'fields_meta_data' => 'fields_meta_data', |
|
312 | + 'upgrade_history' => 'upgrade_history', |
|
313 | + 'versions' => 'versions', |
|
314 | + ); |
|
315 | 315 | |
316 | 316 | |
317 | - //Creates the diagnostic directory in the cache directory |
|
317 | + //Creates the diagnostic directory in the cache directory |
|
318 | 318 | $cacheDir = create_cache_directory("diagnostic/"); |
319 | 319 | $cacheDir = create_cache_directory("diagnostic/".$sod_guid); |
320 | 320 | $cacheDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/"); |
321 | 321 | |
322 | - display_progress_bar("diagnostic", $progress_bar_percent, 100); |
|
322 | + display_progress_bar("diagnostic", $progress_bar_percent, 100); |
|
323 | 323 | |
324 | - ob_flush(); |
|
324 | + ob_flush(); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | function executesugarlog() |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | //BEGIN COPY SUGARCRM.LOG |
330 | 330 | //Copies the Sugarcrm log to our diagnostic directory |
331 | 331 | global $cacheDir; |
332 | - require_once('include/SugarLogger/SugarLogger.php'); |
|
333 | - $logger = new SugarLogger(); |
|
332 | + require_once('include/SugarLogger/SugarLogger.php'); |
|
333 | + $logger = new SugarLogger(); |
|
334 | 334 | if(!copy($logger->getLogFileNameWithPath(), $cacheDir.'/'.$logger->getLogFileName())) { |
335 | - echo "Couldn't copy suitecrm.log to cacheDir.<br>"; |
|
335 | + echo "Couldn't copy suitecrm.log to cacheDir.<br>"; |
|
336 | 336 | } |
337 | 337 | //END COPY SUGARCRM.LOG |
338 | 338 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | $handle = sugar_fopen($cacheDir."phpinfo.html", "w"); |
355 | 355 | if(fwrite($handle, $phpinfo) === FALSE){ |
356 | - echo "Cannot write to file ".$cacheDir."phpinfo.html<br>"; |
|
356 | + echo "Cannot write to file ".$cacheDir."phpinfo.html<br>"; |
|
357 | 357 | } |
358 | 358 | fclose($handle); |
359 | 359 | //END GETPHPINFO |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | |
394 | 394 | //create directory for table definitions |
395 | 395 | if($getschema) |
396 | - $tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableSchema/"); |
|
396 | + $tablesSchemaDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableSchema/"); |
|
397 | 397 | |
398 | 398 | //make sure they checked the box to get basic info |
399 | 399 | if($getinfo) |
@@ -483,36 +483,36 @@ discard block |
||
483 | 483 | foreach($all_tables as $tablename){ |
484 | 484 | $cols = $db->get_columns($tablename); |
485 | 485 | $indexes = $db->get_indices($tablename); |
486 | - //setting up table header for each file |
|
486 | + //setting up table header for each file |
|
487 | 487 | $contents .= array_as_table("{$db->dbName} $tablename Definitions:", $cols); |
488 | 488 | $contents .= array_as_table("{$db->dbName} $tablename Keys:", $indexes); |
489 | - $contents .= "<BR><BR>"; |
|
490 | - } |
|
489 | + $contents .= "<BR><BR>"; |
|
490 | + } |
|
491 | 491 | |
492 | 492 | file_put_contents($tablesSchemaDir."{$db->dbName}TablesSchema.html", $contents); |
493 | - //END GET ALL TABLES SCHEMAS |
|
494 | - //BEGIN UPDATING PROGRESS BAR |
|
495 | - sodUpdateProgressBar(SQL_SCHEMA_WEIGHT); |
|
496 | - //END UPDATING PROGRESS BAR |
|
493 | + //END GET ALL TABLES SCHEMAS |
|
494 | + //BEGIN UPDATING PROGRESS BAR |
|
495 | + sodUpdateProgressBar(SQL_SCHEMA_WEIGHT); |
|
496 | + //END UPDATING PROGRESS BAR |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | if($getdumps) |
500 | 500 | { |
501 | - //BEGIN GET TABLEDUMPS |
|
502 | - $tableDumpsDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableDumps/"); |
|
501 | + //BEGIN GET TABLEDUMPS |
|
502 | + $tableDumpsDir = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/{$db->dbName}/TableDumps/"); |
|
503 | 503 | |
504 | 504 | |
505 | - foreach ($getDumpsFrom as $table) |
|
506 | - { |
|
507 | - //calling function defined above to get the string for dump |
|
508 | - $contents = $style .getFullTableDump($table); |
|
505 | + foreach ($getDumpsFrom as $table) |
|
506 | + { |
|
507 | + //calling function defined above to get the string for dump |
|
508 | + $contents = $style .getFullTableDump($table); |
|
509 | 509 | file_put_contents($tableDumpsDir.$table.".html", $contents); |
510 | - } |
|
511 | - //END GET TABLEDUMPS |
|
512 | - //BEGIN UPDATING PROGRESS BAR |
|
513 | - sodUpdateProgressBar(SQL_DUMPS_WEIGHT); |
|
514 | - //END UPDATING PROGRESS BAR |
|
515 | - } |
|
510 | + } |
|
511 | + //END GET TABLEDUMPS |
|
512 | + //BEGIN UPDATING PROGRESS BAR |
|
513 | + sodUpdateProgressBar(SQL_DUMPS_WEIGHT); |
|
514 | + //END UPDATING PROGRESS BAR |
|
515 | + } |
|
516 | 516 | //END GET DB INFO |
517 | 517 | } |
518 | 518 | |
@@ -542,27 +542,27 @@ discard block |
||
542 | 542 | echo "</font>"; |
543 | 543 | echo "<BR><BR>"; |
544 | 544 | |
545 | - foreach ($beanList as $beanz) |
|
546 | - { |
|
547 | - if(!isset($beanFiles[$beanz])) |
|
548 | - { |
|
549 | - echo "<font color=orange>NO! --- ".$beanz." is not an index in \$beanFiles</font><br>"; |
|
550 | - } |
|
551 | - else |
|
552 | - { |
|
553 | - if(file_exists($beanFiles[$beanz])) |
|
554 | - echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>"; |
|
555 | - else |
|
556 | - echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>"; |
|
557 | - } |
|
558 | - } |
|
559 | - |
|
560 | - $content = ob_get_contents(); |
|
561 | - ob_clean(); |
|
562 | - |
|
563 | - $handle = sugar_fopen($cacheDir."beanFiles.html", "w"); |
|
564 | - if(fwrite($handle, $content) === FALSE){ |
|
565 | - echo "Cannot write to file ".$cacheDir."beanFiles.html<br>"; |
|
545 | + foreach ($beanList as $beanz) |
|
546 | + { |
|
547 | + if(!isset($beanFiles[$beanz])) |
|
548 | + { |
|
549 | + echo "<font color=orange>NO! --- ".$beanz." is not an index in \$beanFiles</font><br>"; |
|
550 | + } |
|
551 | + else |
|
552 | + { |
|
553 | + if(file_exists($beanFiles[$beanz])) |
|
554 | + echo "<font color=green>YES --- ".$beanz." file \"".$beanFiles[$beanz]."\" exists</font><br>"; |
|
555 | + else |
|
556 | + echo "<font color=red>NO! --- ".$beanz." file \"".$beanFiles[$beanz]."\" does NOT exist</font><br>"; |
|
557 | + } |
|
558 | + } |
|
559 | + |
|
560 | + $content = ob_get_contents(); |
|
561 | + ob_clean(); |
|
562 | + |
|
563 | + $handle = sugar_fopen($cacheDir."beanFiles.html", "w"); |
|
564 | + if(fwrite($handle, $content) === FALSE){ |
|
565 | + echo "Cannot write to file ".$cacheDir."beanFiles.html<br>"; |
|
566 | 566 | } |
567 | 567 | fclose($handle); |
568 | 568 | //END CHECK BEANLIST FILES ARE AVAILABLE |
@@ -585,38 +585,38 @@ discard block |
||
585 | 585 | |
586 | 586 | function executemd5($filesmd5, $md5calculated) |
587 | 587 | { |
588 | - //BEGIN ALL MD5 CHECKS |
|
589 | - global $curdatetime; |
|
590 | - global $skip_md5_diff; |
|
591 | - global $sod_guid; |
|
592 | - if(file_exists('files.md5')) |
|
588 | + //BEGIN ALL MD5 CHECKS |
|
589 | + global $curdatetime; |
|
590 | + global $skip_md5_diff; |
|
591 | + global $sod_guid; |
|
592 | + if(file_exists('files.md5')) |
|
593 | 593 | include( 'files.md5'); |
594 | - //create dir for md5s |
|
595 | - $md5_directory = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/md5/"); |
|
594 | + //create dir for md5s |
|
595 | + $md5_directory = create_cache_directory("diagnostic/".$sod_guid."/diagnostic".$curdatetime."/md5/"); |
|
596 | 596 | |
597 | - //skip this if the files.md5 didn't exist |
|
598 | - if(!$skip_md5_diff) |
|
599 | - { |
|
600 | - //make sure the files.md5 |
|
601 | - if($filesmd5) |
|
602 | - if(!copy('files.md5', $md5_directory."files.md5")) |
|
603 | - echo "Couldn't copy files.md5 to ".$md5_directory."<br>Skipping md5 checks.<br>"; |
|
604 | - } |
|
597 | + //skip this if the files.md5 didn't exist |
|
598 | + if(!$skip_md5_diff) |
|
599 | + { |
|
600 | + //make sure the files.md5 |
|
601 | + if($filesmd5) |
|
602 | + if(!copy('files.md5', $md5_directory."files.md5")) |
|
603 | + echo "Couldn't copy files.md5 to ".$md5_directory."<br>Skipping md5 checks.<br>"; |
|
604 | + } |
|
605 | 605 | |
606 | - $md5_string_calculated = generateMD5array('./'); |
|
606 | + $md5_string_calculated = generateMD5array('./'); |
|
607 | 607 | |
608 | - if($md5calculated) |
|
609 | - write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php"); |
|
608 | + if($md5calculated) |
|
609 | + write_array_to_file('md5_string_calculated', $md5_string_calculated, $md5_directory."md5_array_calculated.php"); |
|
610 | 610 | |
611 | 611 | |
612 | - //if the files.md5 didn't exist, we can't do this |
|
613 | - if(!$skip_md5_diff) |
|
614 | - { |
|
615 | - $md5_string_diff = array_diff($md5_string_calculated, $md5_string); |
|
612 | + //if the files.md5 didn't exist, we can't do this |
|
613 | + if(!$skip_md5_diff) |
|
614 | + { |
|
615 | + $md5_string_diff = array_diff($md5_string_calculated, $md5_string); |
|
616 | 616 | |
617 | - write_array_to_file('md5_string_diff', $md5_string_diff, $md5_directory."md5_array_diff.php"); |
|
618 | - } |
|
619 | - //END ALL MD5 CHECKS |
|
617 | + write_array_to_file('md5_string_diff', $md5_string_diff, $md5_directory."md5_array_diff.php"); |
|
618 | + } |
|
619 | + //END ALL MD5 CHECKS |
|
620 | 620 | //BEGIN UPDATING PROGRESS BAR |
621 | 621 | sodUpdateProgressBar(MD5_WEIGHT); |
622 | 622 | //END UPDATING PROGRESS BAR |
@@ -639,14 +639,14 @@ discard block |
||
639 | 639 | |
640 | 640 | ob_start(); |
641 | 641 | foreach ( $beanList as $beanz ) { |
642 | - // echo "Module: ".$beanz."<br>"; |
|
643 | - |
|
644 | - $path_parts = pathinfo( $beanFiles[ $beanz ] ); |
|
645 | - $vardefFileName = $path_parts[ 'dirname' ]."/vardefs.php"; |
|
646 | - if( file_exists( $vardefFileName )) { |
|
647 | - // echo "<br>".$vardefFileName."<br>"; |
|
648 | - } |
|
649 | - include_once( $vardefFileName ); |
|
642 | + // echo "Module: ".$beanz."<br>"; |
|
643 | + |
|
644 | + $path_parts = pathinfo( $beanFiles[ $beanz ] ); |
|
645 | + $vardefFileName = $path_parts[ 'dirname' ]."/vardefs.php"; |
|
646 | + if( file_exists( $vardefFileName )) { |
|
647 | + // echo "<br>".$vardefFileName."<br>"; |
|
648 | + } |
|
649 | + include_once( $vardefFileName ); |
|
650 | 650 | } |
651 | 651 | |
652 | 652 | echo "<html lang='en'>"; |
@@ -659,22 +659,22 @@ discard block |
||
659 | 659 | |
660 | 660 | $tables = array(); |
661 | 661 | foreach($dictionary as $vardef) { |
662 | - $tables[] = $vardef['table']; |
|
663 | - $fields[$vardef['table']] = $vardef['fields']; |
|
664 | - $comments[$vardef['table']] = $vardef['comment']; |
|
662 | + $tables[] = $vardef['table']; |
|
663 | + $fields[$vardef['table']] = $vardef['fields']; |
|
664 | + $comments[$vardef['table']] = $vardef['comment']; |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | asort($tables); |
668 | 668 | |
669 | 669 | foreach($tables as $t) { |
670 | - $name = $t; |
|
671 | - if ( $name == "does_not_exist" ) |
|
672 | - continue; |
|
673 | - $comment = $comments[$t]; |
|
674 | - echo "<h2>Table: $t</h2> |
|
670 | + $name = $t; |
|
671 | + if ( $name == "does_not_exist" ) |
|
672 | + continue; |
|
673 | + $comment = $comments[$t]; |
|
674 | + echo "<h2>Table: $t</h2> |
|
675 | 675 | <p><i>{$comment}</i></p>"; |
676 | - echo "<table border=\"0\" cellpadding=\"3\" class=\"tabDetailView\">"; |
|
677 | - echo '<TR BGCOLOR="#DFDFDF"> |
|
676 | + echo "<table border=\"0\" cellpadding=\"3\" class=\"tabDetailView\">"; |
|
677 | + echo '<TR BGCOLOR="#DFDFDF"> |
|
678 | 678 | <TD NOWRAP ALIGN=left class=\"tabDetailViewDL\">Column</TD> |
679 | 679 | <TD NOWRAP class=\"tabDetailViewDL\">Type</TD> |
680 | 680 | <TD NOWRAP class=\"tabDetailViewDL\">Length</TD> |
@@ -682,36 +682,36 @@ discard block |
||
682 | 682 | <TD NOWRAP class=\"tabDetailViewDL\">Comment</TD> |
683 | 683 | </TR>'; |
684 | 684 | |
685 | - ksort( $fields[ $t ] ); |
|
686 | - |
|
687 | - foreach($fields[$t] as $k => $v) { |
|
688 | - // we only care about physical tables ('source' can be 'non-db' or 'nondb' or 'function' ) |
|
689 | - if ( isset( $v[ 'source' ] )) |
|
690 | - continue; |
|
691 | - $columnname = $v[ 'name' ]; |
|
692 | - $columntype = $v[ 'type' ]; |
|
693 | - $columndbtype = $v[ 'dbType' ]; |
|
694 | - $columnlen = $v[ 'len' ]; |
|
695 | - $columncomment = $v[ 'comment' ]; |
|
696 | - $columnrequired = $v[ 'required' ]; |
|
697 | - |
|
698 | - if ( empty( $columnlen ) ) $columnlen = '<i>n/a</i>'; |
|
699 | - if ( empty( $columncomment ) ) $columncomment = '<i>(none)</i>'; |
|
700 | - if ( !empty( $columndbtype ) ) $columntype = $columndbtype; |
|
701 | - if ( empty( $columnrequired ) || ( $columnrequired == false )) |
|
702 | - $columndisplayrequired = 'no'; |
|
703 | - else |
|
704 | - $columndisplayrequired = 'yes'; |
|
705 | - |
|
706 | - echo '<TR BGCOLOR="#FFFFFF" ALIGN=left> |
|
685 | + ksort( $fields[ $t ] ); |
|
686 | + |
|
687 | + foreach($fields[$t] as $k => $v) { |
|
688 | + // we only care about physical tables ('source' can be 'non-db' or 'nondb' or 'function' ) |
|
689 | + if ( isset( $v[ 'source' ] )) |
|
690 | + continue; |
|
691 | + $columnname = $v[ 'name' ]; |
|
692 | + $columntype = $v[ 'type' ]; |
|
693 | + $columndbtype = $v[ 'dbType' ]; |
|
694 | + $columnlen = $v[ 'len' ]; |
|
695 | + $columncomment = $v[ 'comment' ]; |
|
696 | + $columnrequired = $v[ 'required' ]; |
|
697 | + |
|
698 | + if ( empty( $columnlen ) ) $columnlen = '<i>n/a</i>'; |
|
699 | + if ( empty( $columncomment ) ) $columncomment = '<i>(none)</i>'; |
|
700 | + if ( !empty( $columndbtype ) ) $columntype = $columndbtype; |
|
701 | + if ( empty( $columnrequired ) || ( $columnrequired == false )) |
|
702 | + $columndisplayrequired = 'no'; |
|
703 | + else |
|
704 | + $columndisplayrequired = 'yes'; |
|
705 | + |
|
706 | + echo '<TR BGCOLOR="#FFFFFF" ALIGN=left> |
|
707 | 707 | <TD ALIGN=left class=\"tabDetailViewDF\">'.$columnname.'</TD> |
708 | 708 | <TD NOWRAP class=\"tabDetailViewDF\">'.$columntype.'</TD> |
709 | 709 | <TD NOWRAP class=\"tabDetailViewDF\">'.$columnlen.'</TD> |
710 | 710 | <TD NOWRAP class=\"tabDetailViewDF"\">'.$columndisplayrequired.'</TD> |
711 | 711 | <TD WRAP class=\"tabDetailViewDF\">'.$columncomment.'</TD></TR>'; |
712 | - } |
|
712 | + } |
|
713 | 713 | |
714 | - echo "</table></p>"; |
|
714 | + echo "</table></p>"; |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | echo "</body></html>"; |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | |
722 | 722 | $handle = sugar_fopen($cacheDir."vardefschema.html", "w"); |
723 | 723 | if(fwrite($handle, $vardefFormattedOutput) === FALSE){ |
724 | - echo "Cannot write to file ".$cacheDir."vardefschema.html<br>"; |
|
724 | + echo "Cannot write to file ".$cacheDir."vardefschema.html<br>"; |
|
725 | 725 | } |
726 | 726 | fclose($handle); |
727 | 727 | sodUpdateProgressBar(VARDEFS_WEIGHT); |
@@ -729,23 +729,23 @@ discard block |
||
729 | 729 | } |
730 | 730 | |
731 | 731 | function finishDiag(){ |
732 | - //BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT |
|
733 | - global $cacheDir; |
|
734 | - global $curdatetime; |
|
735 | - global $sod_guid; |
|
736 | - global $mod_strings; |
|
737 | - |
|
738 | - chdir($cacheDir); |
|
739 | - zip_dir(".", "../diagnostic".$curdatetime.".zip"); |
|
740 | - //END ZIP ALL FILES AND EXTRACT IN CACHE ROOT |
|
741 | - chdir(RETURN_FROM_DIAG_DIR); |
|
742 | - |
|
743 | - deleteDir($cacheDir); |
|
732 | + //BEGIN ZIP ALL FILES AND EXTRACT IN CACHE ROOT |
|
733 | + global $cacheDir; |
|
734 | + global $curdatetime; |
|
735 | + global $sod_guid; |
|
736 | + global $mod_strings; |
|
737 | + |
|
738 | + chdir($cacheDir); |
|
739 | + zip_dir(".", "../diagnostic".$curdatetime.".zip"); |
|
740 | + //END ZIP ALL FILES AND EXTRACT IN CACHE ROOT |
|
741 | + chdir(RETURN_FROM_DIAG_DIR); |
|
742 | + |
|
743 | + deleteDir($cacheDir); |
|
744 | 744 | |
745 | 745 | |
746 | - print "<a href=\"index.php?module=Administration&action=DiagnosticDownload&guid=$sod_guid&time=$curdatetime&to_pdf=1\">".$mod_strings['LBL_DIAGNOSTIC_DOWNLOADLINK']."</a><BR>"; |
|
746 | + print "<a href=\"index.php?module=Administration&action=DiagnosticDownload&guid=$sod_guid&time=$curdatetime&to_pdf=1\">".$mod_strings['LBL_DIAGNOSTIC_DOWNLOADLINK']."</a><BR>"; |
|
747 | 747 | |
748 | - print "<a href=\"index.php?module=Administration&action=DiagnosticDelete&file=diagnostic".$curdatetime."&guid=".$sod_guid."\">".$mod_strings['LBL_DIAGNOSTIC_DELETELINK']."</a><br>"; |
|
748 | + print "<a href=\"index.php?module=Administration&action=DiagnosticDelete&file=diagnostic".$curdatetime."&guid=".$sod_guid."\">".$mod_strings['LBL_DIAGNOSTIC_DELETELINK']."</a><br>"; |
|
749 | 749 | |
750 | 750 | } |
751 | 751 | |
@@ -786,55 +786,55 @@ discard block |
||
786 | 786 | |
787 | 787 | if($doconfigphp) |
788 | 788 | { |
789 | - echo $mod_strings['LBL_DIAGNOSTIC_GETCONFPHP']."<BR>"; |
|
790 | - executeconfigphp(); |
|
791 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
789 | + echo $mod_strings['LBL_DIAGNOSTIC_GETCONFPHP']."<BR>"; |
|
790 | + executeconfigphp(); |
|
791 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
792 | 792 | } |
793 | 793 | if($docustom_dir) |
794 | 794 | { |
795 | - echo $mod_strings['LBL_DIAGNOSTIC_GETCUSTDIR']."<BR>"; |
|
796 | - executecustom_dir(); |
|
797 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
795 | + echo $mod_strings['LBL_DIAGNOSTIC_GETCUSTDIR']."<BR>"; |
|
796 | + executecustom_dir(); |
|
797 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
798 | 798 | } |
799 | 799 | if($dophpinfo) |
800 | 800 | { |
801 | - echo $mod_strings['LBL_DIAGNOSTIC_GETPHPINFO']."<BR>"; |
|
802 | - executephpinfo(); |
|
803 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
801 | + echo $mod_strings['LBL_DIAGNOSTIC_GETPHPINFO']."<BR>"; |
|
802 | + executephpinfo(); |
|
803 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
804 | 804 | } |
805 | 805 | if($domysql_info || $domysql_dumps || $domysql_schema) |
806 | 806 | { |
807 | - echo $mod_strings['LBL_DIAGNOSTIC_GETTING']. |
|
808 | - ($domysql_info ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLINFO'] : " "). |
|
809 | - ($domysql_dumps ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTD'] : " "). |
|
810 | - ($domysql_schema ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTS'] : "..."). |
|
811 | - "<BR>"; |
|
812 | - execute_sql($domysql_info, $domysql_dumps, $domysql_schema); |
|
813 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
807 | + echo $mod_strings['LBL_DIAGNOSTIC_GETTING']. |
|
808 | + ($domysql_info ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLINFO'] : " "). |
|
809 | + ($domysql_dumps ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTD'] : " "). |
|
810 | + ($domysql_schema ? "... ".$mod_strings['LBL_DIAGNOSTIC_GETMYSQLTS'] : "..."). |
|
811 | + "<BR>"; |
|
812 | + execute_sql($domysql_info, $domysql_dumps, $domysql_schema); |
|
813 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
814 | 814 | } |
815 | 815 | if($domd5) |
816 | 816 | { |
817 | - echo $mod_strings['LBL_DIAGNOSTIC_GETMD5INFO']."<BR>"; |
|
818 | - executemd5($domd5filesmd5, $domd5calculated); |
|
819 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
817 | + echo $mod_strings['LBL_DIAGNOSTIC_GETMD5INFO']."<BR>"; |
|
818 | + executemd5($domd5filesmd5, $domd5calculated); |
|
819 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
820 | 820 | } |
821 | 821 | if($dobeanlistbeanfiles) |
822 | 822 | { |
823 | - echo $mod_strings['LBL_DIAGNOSTIC_GETBEANFILES']."<BR>"; |
|
824 | - executebeanlistbeanfiles(); |
|
825 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
823 | + echo $mod_strings['LBL_DIAGNOSTIC_GETBEANFILES']."<BR>"; |
|
824 | + executebeanlistbeanfiles(); |
|
825 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
826 | 826 | } |
827 | 827 | if($dosugarlog) |
828 | 828 | { |
829 | - echo $mod_strings['LBL_DIAGNOSTIC_GETSUGARLOG']."<BR>"; |
|
830 | - executesugarlog(); |
|
831 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
829 | + echo $mod_strings['LBL_DIAGNOSTIC_GETSUGARLOG']."<BR>"; |
|
830 | + executesugarlog(); |
|
831 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
832 | 832 | } |
833 | 833 | if($dovardefs) |
834 | 834 | { |
835 | - echo $mod_strings['LBL_DIAGNOSTIC_VARDEFS']."<BR>"; |
|
836 | - executevardefs(); |
|
837 | - echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
835 | + echo $mod_strings['LBL_DIAGNOSTIC_VARDEFS']."<BR>"; |
|
836 | + executevardefs(); |
|
837 | + echo $mod_strings['LBL_DIAGNOSTIC_DONE']."<BR><BR>"; |
|
838 | 838 | } |
839 | 839 | |
840 | 840 | //finish up the last steps |
@@ -42,27 +42,27 @@ discard block |
||
42 | 42 | |
43 | 43 | if(is_admin($current_user)){ |
44 | 44 | if(count($_POST)){ |
45 | - if(!empty($_POST['activate'])){ |
|
45 | + if(!empty($_POST['activate'])){ |
|
46 | 46 | |
47 | - $status = ''; |
|
48 | - if($_POST['activate'] == 'false'){ |
|
49 | - $status = 'Inactive'; |
|
50 | - }else{ |
|
51 | - $status = 'Active'; |
|
52 | - } |
|
53 | - } |
|
54 | - $query = "UPDATE users SET status = '$status' WHERE id LIKE 'seed%'"; |
|
55 | - $GLOBALS['db']->query($query); |
|
47 | + $status = ''; |
|
48 | + if($_POST['activate'] == 'false'){ |
|
49 | + $status = 'Inactive'; |
|
50 | + }else{ |
|
51 | + $status = 'Active'; |
|
52 | + } |
|
53 | + } |
|
54 | + $query = "UPDATE users SET status = '$status' WHERE id LIKE 'seed%'"; |
|
55 | + $GLOBALS['db']->query($query); |
|
56 | 56 | } |
57 | - $query = "SELECT status FROM users WHERE id LIKE 'seed%'"; |
|
58 | - $result = $GLOBALS['db']->query($query); |
|
59 | - $row = $GLOBALS['db']->fetchByAssoc($result); |
|
60 | - if(!empty($row['status'])){ |
|
61 | - $activate = 'false'; |
|
62 | - if($row['status'] == 'Inactive'){ |
|
63 | - $activate = 'true'; |
|
64 | - } |
|
65 | - ?> |
|
57 | + $query = "SELECT status FROM users WHERE id LIKE 'seed%'"; |
|
58 | + $result = $GLOBALS['db']->query($query); |
|
59 | + $row = $GLOBALS['db']->fetchByAssoc($result); |
|
60 | + if(!empty($row['status'])){ |
|
61 | + $activate = 'false'; |
|
62 | + if($row['status'] == 'Inactive'){ |
|
63 | + $activate = 'true'; |
|
64 | + } |
|
65 | + ?> |
|
66 | 66 | <p> |
67 | 67 | <form name="RepairSeedUsers" method="post" action="index.php"> |
68 | 68 | <input type="hidden" name="module" value="Administration"> |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | |
83 | - }else{ |
|
84 | - echo 'No seed Users'; |
|
85 | - } |
|
83 | + }else{ |
|
84 | + echo 'No seed Users'; |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | else{ |
88 | - sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); |
|
88 | + sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); |
|
89 | 89 | } |
90 | 90 | ?> |
91 | 91 | \ No newline at end of file |
@@ -42,9 +42,9 @@ |
||
42 | 42 | |
43 | 43 | if(isset($_REQUEST['perform_rebuild']) && $_REQUEST['perform_rebuild'] == 'true') { |
44 | 44 | |
45 | - require_once('install/install_utils.php'); |
|
46 | - $focus = new Scheduler(); |
|
47 | - $focus->rebuildDefaultSchedulers(); |
|
45 | + require_once('install/install_utils.php'); |
|
46 | + $focus = new Scheduler(); |
|
47 | + $focus->rebuildDefaultSchedulers(); |
|
48 | 48 | |
49 | 49 | $admin_mod_strings = return_module_language($current_language, 'Administration'); |
50 | 50 | ?> |
@@ -44,18 +44,18 @@ discard block |
||
44 | 44 | require_once('include/utils/encryption_utils.php'); |
45 | 45 | |
46 | 46 | function getSystemInfo($send_usage_info=true){ |
47 | - global $sugar_config; |
|
48 | - global $db, $administration, $timedate; |
|
49 | - $info=array(); |
|
50 | - $info = getBaseSystemInfo($send_usage_info); |
|
47 | + global $sugar_config; |
|
48 | + global $db, $administration, $timedate; |
|
49 | + $info=array(); |
|
50 | + $info = getBaseSystemInfo($send_usage_info); |
|
51 | 51 | if($send_usage_info){ |
52 | - $info['application_key']=$sugar_config['unique_key']; |
|
53 | - $info['php_version']=phpversion(); |
|
54 | - if(isset($_SERVER['SERVER_SOFTWARE'])) { |
|
55 | - $info['server_software'] = $_SERVER['SERVER_SOFTWARE']; |
|
56 | - } // if |
|
52 | + $info['application_key']=$sugar_config['unique_key']; |
|
53 | + $info['php_version']=phpversion(); |
|
54 | + if(isset($_SERVER['SERVER_SOFTWARE'])) { |
|
55 | + $info['server_software'] = $_SERVER['SERVER_SOFTWARE']; |
|
56 | + } // if |
|
57 | 57 | |
58 | - //get user count. |
|
58 | + //get user count. |
|
59 | 59 | |
60 | 60 | $query = "SELECT count(*) as total from users WHERE " . User::getLicensedUsersWhere(); |
61 | 61 | $result = $db->getOne($query, false, 'fetching active users count'); |
@@ -63,58 +63,58 @@ discard block |
||
63 | 63 | $info['users'] = $result; |
64 | 64 | } |
65 | 65 | |
66 | - if(empty($administration)){ |
|
66 | + if(empty($administration)){ |
|
67 | 67 | |
68 | - $administration = new Administration(); |
|
69 | - } |
|
70 | - $administration->retrieveSettings('system'); |
|
71 | - $info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):''; |
|
68 | + $administration = new Administration(); |
|
69 | + } |
|
70 | + $administration->retrieveSettings('system'); |
|
71 | + $info['system_name'] = (!empty($administration->settings['system_name']))?substr($administration->settings['system_name'], 0 ,255):''; |
|
72 | 72 | |
73 | 73 | |
74 | - $result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count'); |
|
75 | - if($result !== false) { |
|
76 | - $info['admin_users'] = $result; |
|
77 | - } |
|
74 | + $result=$db->getOne("select count(*) count from users where status='Active' and deleted=0 and is_admin='1'", false, 'fetching admin count'); |
|
75 | + if($result !== false) { |
|
76 | + $info['admin_users'] = $result; |
|
77 | + } |
|
78 | 78 | |
79 | 79 | |
80 | - $result=$db->getOne("select count(*) count from users", false, 'fetching all users count'); |
|
81 | - if($result !== false) { |
|
82 | - $info['registered_users'] = $result; |
|
83 | - } |
|
80 | + $result=$db->getOne("select count(*) count from users", false, 'fetching all users count'); |
|
81 | + if($result !== false) { |
|
82 | + $info['registered_users'] = $result; |
|
83 | + } |
|
84 | 84 | |
85 | - $lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime'); |
|
86 | - if( !$send_usage_info) { |
|
87 | - $info['users_active_30_days'] = -1; |
|
88 | - } else { |
|
89 | - $info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count'); |
|
90 | - } |
|
85 | + $lastMonth = $db->convert("'". $timedate->getNow()->modify("-30 days")->asDb(false) . "'", 'datetime'); |
|
86 | + if( !$send_usage_info) { |
|
87 | + $info['users_active_30_days'] = -1; |
|
88 | + } else { |
|
89 | + $info['users_active_30_days'] = $db->getOne("SELECT count( DISTINCT users.id ) user_count FROM tracker, users WHERE users.id = tracker.user_id AND tracker.date_modified >= $lastMonth", false, 'fetching last 30 users count'); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | 94 | |
95 | - if(!$send_usage_info){ |
|
96 | - $info['latest_tracker_id'] = -1; |
|
97 | - }else{ |
|
98 | - $id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry'); |
|
99 | - if ( $id !== false ) |
|
100 | - $info['latest_tracker_id'] = $id; |
|
101 | - } |
|
95 | + if(!$send_usage_info){ |
|
96 | + $info['latest_tracker_id'] = -1; |
|
97 | + }else{ |
|
98 | + $id=$db->getOne("select id from tracker order by date_modified desc", false, 'fetching most recent tracker entry'); |
|
99 | + if ( $id !== false ) |
|
100 | + $info['latest_tracker_id'] = $id; |
|
101 | + } |
|
102 | 102 | |
103 | - $info['db_type']=$sugar_config['dbconfig']['db_type']; |
|
104 | - $info['db_version']=$db->version(); |
|
105 | - } |
|
106 | - if(file_exists('distro.php')){ |
|
107 | - include('distro.php'); |
|
108 | - if(!empty($distro_name))$info['distro_name'] = $distro_name; |
|
109 | - } |
|
110 | - $info['os'] = php_uname('s'); |
|
111 | - $info['os_version'] = php_uname('r'); |
|
112 | - $info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone'); |
|
113 | - $info['timezone'] = date('e'); |
|
114 | - if($info['timezone'] == 'e'){ |
|
115 | - $info['timezone'] = date('T'); |
|
116 | - } |
|
117 | - return $info; |
|
103 | + $info['db_type']=$sugar_config['dbconfig']['db_type']; |
|
104 | + $info['db_version']=$db->version(); |
|
105 | + } |
|
106 | + if(file_exists('distro.php')){ |
|
107 | + include('distro.php'); |
|
108 | + if(!empty($distro_name))$info['distro_name'] = $distro_name; |
|
109 | + } |
|
110 | + $info['os'] = php_uname('s'); |
|
111 | + $info['os_version'] = php_uname('r'); |
|
112 | + $info['timezone_u'] = $GLOBALS['current_user']->getPreference('timezone'); |
|
113 | + $info['timezone'] = date('e'); |
|
114 | + if($info['timezone'] == 'e'){ |
|
115 | + $info['timezone'] = date('T'); |
|
116 | + } |
|
117 | + return $info; |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
@@ -137,28 +137,28 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | function check_now($send_usage_info=true, $get_request_data=false, $response_data = false, $from_install=false ) { |
140 | - global $sugar_config, $timedate; |
|
141 | - global $db, $license; |
|
140 | + global $sugar_config, $timedate; |
|
141 | + global $db, $license; |
|
142 | 142 | include('sugar_version.php'); |
143 | 143 | |
144 | 144 | |
145 | - $return_array=array(); |
|
145 | + $return_array=array(); |
|
146 | 146 | if(!$from_install && empty($license))loadLicense(true); |
147 | 147 | |
148 | - if(!$response_data){ |
|
148 | + if(!$response_data){ |
|
149 | 149 | |
150 | 150 | if($from_install){ |
151 | - $info = getBaseSystemInfo(false); |
|
151 | + $info = getBaseSystemInfo(false); |
|
152 | 152 | |
153 | 153 | }else{ |
154 | 154 | $info = getSystemInfo($send_usage_info); |
155 | 155 | } |
156 | 156 | |
157 | - require_once('include/nusoap/nusoap.php'); |
|
157 | + require_once('include/nusoap/nusoap.php'); |
|
158 | 158 | |
159 | - $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT'); |
|
160 | - $sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15); |
|
161 | - $ping = $sclient->call('sugarPing', array()); |
|
159 | + $GLOBALS['log']->debug('USING HTTPS TO CONNECT TO HEARTBEAT'); |
|
160 | + $sclient = new nusoapclient('https://updates.sugarcrm.com/heartbeat/soap.php', false, false, false, false, false, 15, 15); |
|
161 | + $ping = $sclient->call('sugarPing', array()); |
|
162 | 162 | if (empty($ping) || $sclient->getError()) { |
163 | 163 | if (!$get_request_data) { |
164 | 164 | return array( |
@@ -171,92 +171,92 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | |
174 | - $key = '4829482749329'; |
|
175 | - |
|
176 | - |
|
177 | - |
|
178 | - $encoded = sugarEncode($key, serialize($info)); |
|
179 | - |
|
180 | - if($get_request_data){ |
|
181 | - $request_data = array('key'=>$key, 'data'=>$encoded); |
|
182 | - return serialize($request_data); |
|
183 | - } |
|
184 | - $encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded)); |
|
185 | - |
|
186 | - }else{ |
|
187 | - $encodedResult = $response_data['data']; |
|
188 | - $key = $response_data['key']; |
|
189 | - |
|
190 | - } |
|
191 | - |
|
192 | - if($response_data || !$sclient->getError()){ |
|
193 | - $serializedResultData = sugarDecode($key,$encodedResult); |
|
194 | - $resultData = unserialize($serializedResultData); |
|
195 | - if($response_data && empty($resultData)) |
|
196 | - { |
|
197 | - $resultData = array(); |
|
198 | - $resultData['validation'] = 'invalid validation key'; |
|
199 | - } |
|
200 | - }else |
|
201 | - { |
|
202 | - $resultData = array(); |
|
203 | - $resultData['versions'] = array(); |
|
204 | - |
|
205 | - } |
|
206 | - |
|
207 | - if($response_data || !$sclient->getError() ) |
|
208 | - { |
|
209 | - if(!empty($resultData['msg'])){ |
|
210 | - if(!empty($resultData['msg']['admin'])){ |
|
211 | - $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin'])); |
|
212 | - }else{ |
|
213 | - $license->saveSetting('license', 'msg_admin',''); |
|
214 | - } |
|
215 | - if(!empty($resultData['msg']['all'])){ |
|
216 | - $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all'])); |
|
217 | - }else{ |
|
218 | - $license->saveSetting('license', 'msg_all',''); |
|
219 | - } |
|
220 | - }else{ |
|
221 | - $license->saveSetting('license', 'msg_admin',''); |
|
222 | - $license->saveSetting('license', 'msg_all',''); |
|
223 | - } |
|
224 | - $license->saveSetting('license', 'last_validation', 'success'); |
|
225 | - unset($_SESSION['COULD_NOT_CONNECT']); |
|
226 | - } |
|
227 | - else |
|
228 | - { |
|
229 | - $resultData = array(); |
|
230 | - $resultData['versions'] = array(); |
|
231 | - |
|
232 | - $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb()); |
|
233 | - $license->saveSetting('license', 'last_validation', 'no_connection'); |
|
234 | - |
|
235 | - if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){ |
|
236 | - $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb()); |
|
237 | - |
|
238 | - $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false)))); |
|
239 | - } |
|
240 | - $_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb(); |
|
241 | - |
|
242 | - } |
|
243 | - if(!empty($resultData['versions'])){ |
|
244 | - |
|
245 | - $license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions']))); |
|
246 | - }else{ |
|
247 | - $resultData['versions'] = array(); |
|
248 | - $license->saveSetting('license', 'latest_versions','') ; |
|
249 | - } |
|
250 | - |
|
251 | - if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) |
|
174 | + $key = '4829482749329'; |
|
175 | + |
|
176 | + |
|
177 | + |
|
178 | + $encoded = sugarEncode($key, serialize($info)); |
|
179 | + |
|
180 | + if($get_request_data){ |
|
181 | + $request_data = array('key'=>$key, 'data'=>$encoded); |
|
182 | + return serialize($request_data); |
|
183 | + } |
|
184 | + $encodedResult = $sclient->call('sugarHome', array('key'=>$key, 'data'=>$encoded)); |
|
185 | + |
|
186 | + }else{ |
|
187 | + $encodedResult = $response_data['data']; |
|
188 | + $key = $response_data['key']; |
|
189 | + |
|
190 | + } |
|
191 | + |
|
192 | + if($response_data || !$sclient->getError()){ |
|
193 | + $serializedResultData = sugarDecode($key,$encodedResult); |
|
194 | + $resultData = unserialize($serializedResultData); |
|
195 | + if($response_data && empty($resultData)) |
|
196 | + { |
|
197 | + $resultData = array(); |
|
198 | + $resultData['validation'] = 'invalid validation key'; |
|
199 | + } |
|
200 | + }else |
|
201 | + { |
|
202 | + $resultData = array(); |
|
203 | + $resultData['versions'] = array(); |
|
204 | + |
|
205 | + } |
|
206 | + |
|
207 | + if($response_data || !$sclient->getError() ) |
|
208 | + { |
|
209 | + if(!empty($resultData['msg'])){ |
|
210 | + if(!empty($resultData['msg']['admin'])){ |
|
211 | + $license->saveSetting('license', 'msg_admin', base64_encode($resultData['msg']['admin'])); |
|
212 | + }else{ |
|
213 | + $license->saveSetting('license', 'msg_admin',''); |
|
214 | + } |
|
215 | + if(!empty($resultData['msg']['all'])){ |
|
216 | + $license->saveSetting('license', 'msg_all', base64_encode($resultData['msg']['all'])); |
|
217 | + }else{ |
|
218 | + $license->saveSetting('license', 'msg_all',''); |
|
219 | + } |
|
220 | + }else{ |
|
221 | + $license->saveSetting('license', 'msg_admin',''); |
|
222 | + $license->saveSetting('license', 'msg_all',''); |
|
223 | + } |
|
224 | + $license->saveSetting('license', 'last_validation', 'success'); |
|
225 | + unset($_SESSION['COULD_NOT_CONNECT']); |
|
226 | + } |
|
227 | + else |
|
228 | + { |
|
229 | + $resultData = array(); |
|
230 | + $resultData['versions'] = array(); |
|
231 | + |
|
232 | + $license->saveSetting('license', 'last_connection_fail', TimeDate::getInstance()->nowDb()); |
|
233 | + $license->saveSetting('license', 'last_validation', 'no_connection'); |
|
234 | + |
|
235 | + if( empty($license->settings['license_last_validation_success']) && empty($license->settings['license_last_validation_fail']) && empty($license->settings['license_vk_end_date'])){ |
|
236 | + $license->saveSetting('license', 'vk_end_date', TimeDate::getInstance()->nowDb()); |
|
237 | + |
|
238 | + $license->saveSetting('license', 'validation_key', base64_encode(serialize(array('verified'=>false)))); |
|
239 | + } |
|
240 | + $_SESSION['COULD_NOT_CONNECT'] =TimeDate::getInstance()->nowDb(); |
|
241 | + |
|
242 | + } |
|
243 | + if(!empty($resultData['versions'])){ |
|
244 | + |
|
245 | + $license->saveSetting('license', 'latest_versions',base64_encode(serialize($resultData['versions']))); |
|
246 | + }else{ |
|
247 | + $resultData['versions'] = array(); |
|
248 | + $license->saveSetting('license', 'latest_versions','') ; |
|
249 | + } |
|
250 | + |
|
251 | + if(sizeof($resultData) == 1 && !empty($resultData['versions'][0]['version']) |
|
252 | 252 | && compareVersions($sugar_version, $resultData['versions'][0]['version'])) |
253 | - { |
|
254 | - $resultData['versions'][0]['version'] = $sugar_version; |
|
255 | - $resultData['versions'][0]['description'] = "You have the latest version."; |
|
256 | - } |
|
253 | + { |
|
254 | + $resultData['versions'][0]['version'] = $sugar_version; |
|
255 | + $resultData['versions'][0]['description'] = "You have the latest version."; |
|
256 | + } |
|
257 | 257 | |
258 | 258 | |
259 | - return $resultData['versions']; |
|
259 | + return $resultData['versions']; |
|
260 | 260 | } |
261 | 261 | /* |
262 | 262 | * returns true if $ver1 > $ver2 |
@@ -268,126 +268,126 @@ discard block |
||
268 | 268 | function set_CheckUpdates_config_setting($value) { |
269 | 269 | |
270 | 270 | |
271 | - $admin=new Administration(); |
|
272 | - $admin->saveSetting('Update','CheckUpdates',$value); |
|
271 | + $admin=new Administration(); |
|
272 | + $admin->saveSetting('Update','CheckUpdates',$value); |
|
273 | 273 | } |
274 | 274 | /* return's value for the 'CheckUpdates' config setting |
275 | 275 | * if the setting does not exist one gets created with a default value of automatic. |
276 | 276 | */ |
277 | 277 | function get_CheckUpdates_config_setting() { |
278 | 278 | |
279 | - $checkupdates='automatic'; |
|
279 | + $checkupdates='automatic'; |
|
280 | 280 | |
281 | 281 | |
282 | - $admin=new Administration(); |
|
283 | - $admin=$admin->retrieveSettings('Update',true); |
|
284 | - if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) { |
|
285 | - $admin->saveSetting('Update','CheckUpdates','automatic'); |
|
286 | - } else { |
|
287 | - $checkupdates=$admin->settings['Update_CheckUpdates']; |
|
288 | - } |
|
289 | - return $checkupdates; |
|
282 | + $admin=new Administration(); |
|
283 | + $admin=$admin->retrieveSettings('Update',true); |
|
284 | + if (empty($admin->settings) or empty($admin->settings['Update_CheckUpdates'])) { |
|
285 | + $admin->saveSetting('Update','CheckUpdates','automatic'); |
|
286 | + } else { |
|
287 | + $checkupdates=$admin->settings['Update_CheckUpdates']; |
|
288 | + } |
|
289 | + return $checkupdates; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | function set_last_check_version_config_setting($value) { |
293 | 293 | |
294 | 294 | |
295 | - $admin=new Administration(); |
|
296 | - $admin->saveSetting('Update','last_check_version',$value); |
|
295 | + $admin=new Administration(); |
|
296 | + $admin->saveSetting('Update','last_check_version',$value); |
|
297 | 297 | } |
298 | 298 | function get_last_check_version_config_setting() { |
299 | 299 | |
300 | 300 | |
301 | 301 | |
302 | - $admin=new Administration(); |
|
303 | - $admin=$admin->retrieveSettings('Update'); |
|
304 | - if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) { |
|
305 | - return null; |
|
306 | - } else { |
|
307 | - return $admin->settings['Update_last_check_version']; |
|
308 | - } |
|
302 | + $admin=new Administration(); |
|
303 | + $admin=$admin->retrieveSettings('Update'); |
|
304 | + if (empty($admin->settings) or empty($admin->settings['Update_last_check_version'])) { |
|
305 | + return null; |
|
306 | + } else { |
|
307 | + return $admin->settings['Update_last_check_version']; |
|
308 | + } |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
312 | 312 | function set_last_check_date_config_setting($value) { |
313 | 313 | |
314 | 314 | |
315 | - $admin=new Administration(); |
|
316 | - $admin->saveSetting('Update','last_check_date',$value); |
|
315 | + $admin=new Administration(); |
|
316 | + $admin->saveSetting('Update','last_check_date',$value); |
|
317 | 317 | } |
318 | 318 | function get_last_check_date_config_setting() { |
319 | 319 | |
320 | 320 | |
321 | 321 | |
322 | - $admin=new Administration(); |
|
323 | - $admin=$admin->retrieveSettings('Update'); |
|
324 | - if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) { |
|
325 | - return 0; |
|
326 | - } else { |
|
327 | - return $admin->settings['Update_last_check_date']; |
|
328 | - } |
|
322 | + $admin=new Administration(); |
|
323 | + $admin=$admin->retrieveSettings('Update'); |
|
324 | + if (empty($admin->settings) or empty($admin->settings['Update_last_check_date'])) { |
|
325 | + return 0; |
|
326 | + } else { |
|
327 | + return $admin->settings['Update_last_check_date']; |
|
328 | + } |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | function set_sugarbeat($value) { |
332 | - global $sugar_config; |
|
333 | - $_SUGARBEAT="sugarbeet"; |
|
334 | - $sugar_config[$_SUGARBEAT] = $value; |
|
335 | - write_array_to_file( "sugar_config", $sugar_config, "config.php" ); |
|
332 | + global $sugar_config; |
|
333 | + $_SUGARBEAT="sugarbeet"; |
|
334 | + $sugar_config[$_SUGARBEAT] = $value; |
|
335 | + write_array_to_file( "sugar_config", $sugar_config, "config.php" ); |
|
336 | 336 | } |
337 | 337 | function get_sugarbeat() { |
338 | 338 | |
339 | 339 | |
340 | - global $sugar_config; |
|
341 | - $_SUGARBEAT="sugarbeet"; |
|
340 | + global $sugar_config; |
|
341 | + $_SUGARBEAT="sugarbeet"; |
|
342 | 342 | |
343 | - if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) { |
|
344 | - return false; |
|
345 | - } |
|
346 | - return true; |
|
343 | + if (isset($sugar_config[$_SUGARBEAT]) && $sugar_config[$_SUGARBEAT] == false) { |
|
344 | + return false; |
|
345 | + } |
|
346 | + return true; |
|
347 | 347 | |
348 | 348 | } |
349 | 349 | |
350 | 350 | |
351 | 351 | |
352 | 352 | function shouldCheckSugar(){ |
353 | - global $license, $timedate; |
|
354 | - if( |
|
353 | + global $license, $timedate; |
|
354 | + if( |
|
355 | 355 | |
356 | - get_CheckUpdates_config_setting() == 'automatic' ){ |
|
357 | - return true; |
|
358 | - } |
|
356 | + get_CheckUpdates_config_setting() == 'automatic' ){ |
|
357 | + return true; |
|
358 | + } |
|
359 | 359 | |
360 | - return false; |
|
360 | + return false; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
364 | 364 | |
365 | 365 | function loadLicense($firstLogin=false){ |
366 | 366 | |
367 | - $GLOBALS['license']=new Administration(); |
|
368 | - $GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin); |
|
367 | + $GLOBALS['license']=new Administration(); |
|
368 | + $GLOBALS['license']=$GLOBALS['license']->retrieveSettings('license', $firstLogin); |
|
369 | 369 | |
370 | 370 | } |
371 | 371 | |
372 | 372 | function loginLicense(){ |
373 | - global $current_user, $license; |
|
374 | - loadLicense(true); |
|
373 | + global $current_user, $license; |
|
374 | + loadLicense(true); |
|
375 | 375 | |
376 | 376 | |
377 | - if (shouldCheckSugar()) { |
|
377 | + if (shouldCheckSugar()) { |
|
378 | 378 | |
379 | 379 | |
380 | - $last_check_date=get_last_check_date_config_setting(); |
|
381 | - $current_date_time=time(); |
|
382 | - $time_period=3*23*3600 ; |
|
383 | - if (($current_date_time - $last_check_date) > $time_period |
|
384 | - ) { |
|
385 | - $version = check_now(get_sugarbeat()); |
|
380 | + $last_check_date=get_last_check_date_config_setting(); |
|
381 | + $current_date_time=time(); |
|
382 | + $time_period=3*23*3600 ; |
|
383 | + if (($current_date_time - $last_check_date) > $time_period |
|
384 | + ) { |
|
385 | + $version = check_now(get_sugarbeat()); |
|
386 | 386 | |
387 | - unset($_SESSION['license_seats_needed']); |
|
388 | - loadLicense(); |
|
389 | - set_last_check_date_config_setting("$current_date_time"); |
|
390 | - include('sugar_version.php'); |
|
387 | + unset($_SESSION['license_seats_needed']); |
|
388 | + loadLicense(); |
|
389 | + set_last_check_date_config_setting("$current_date_time"); |
|
390 | + include('sugar_version.php'); |
|
391 | 391 | |
392 | 392 | $newVersion = ''; |
393 | 393 | if (!empty($version) && count($version) == 1) |
@@ -396,14 +396,14 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | if (version_compare($newVersion, $sugar_version, '>') && is_admin($current_user)) |
399 | - { |
|
400 | - //set session variables. |
|
401 | - $_SESSION['available_version']=$version[0]['version']; |
|
402 | - $_SESSION['available_version_description']=$version[0]['description']; |
|
403 | - set_last_check_version_config_setting($version[0]['version']); |
|
404 | - } |
|
405 | - } |
|
406 | - } |
|
399 | + { |
|
400 | + //set session variables. |
|
401 | + $_SESSION['available_version']=$version[0]['version']; |
|
402 | + $_SESSION['available_version_description']=$version[0]['description']; |
|
403 | + set_last_check_version_config_setting($version[0]['version']); |
|
404 | + } |
|
405 | + } |
|
406 | + } |
|
407 | 407 | |
408 | 408 | |
409 | 409 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | |
51 | 51 | if(!isset($_REQUEST['guid']) || !isset($_REQUEST['time'])) |
52 | 52 | { |
53 | - die('Did not receive a filename to download'); |
|
53 | + die('Did not receive a filename to download'); |
|
54 | 54 | } |
55 | 55 | $time = str_replace(array('.', '/', '\\'), '', $_REQUEST['time']); |
56 | 56 | $guid = str_replace(array('.', '/', '\\'), '', $_REQUEST['guid']); |
@@ -40,38 +40,38 @@ discard block |
||
40 | 40 | |
41 | 41 | $db = DBManagerFactory::getInstance(); |
42 | 42 | if(!$db->supports('fix:expandDatabase')) { |
43 | - echo "<BR>"; |
|
44 | - echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>"; |
|
45 | - echo "<BR>"; |
|
46 | - sugar_die(''); |
|
43 | + echo "<BR>"; |
|
44 | + echo "<p>".$mod_strings['ERR_NOT_IMPLEMENTED']."</p>"; |
|
45 | + echo "<BR>"; |
|
46 | + sugar_die(''); |
|
47 | 47 | } |
48 | 48 | global $current_user,$beanFiles; |
49 | 49 | |
50 | 50 | set_time_limit(3600); |
51 | 51 | if(is_admin($current_user) || isset($from_sync_client)){ |
52 | 52 | |
53 | - $execute = false; |
|
54 | - $export = false; |
|
55 | - |
|
56 | - |
|
57 | - if(isset($_REQUEST['do_action'])){ |
|
58 | - switch($_REQUEST['do_action']){ |
|
59 | - case 'display': |
|
60 | - break; |
|
61 | - case 'execute': |
|
62 | - $execute = true; |
|
63 | - break; |
|
64 | - case 'export': |
|
65 | - header('Location: index.php?module=Administration&action=expandDatabase&do_action=do_export&to_pdf=true'); |
|
66 | - die(); |
|
67 | - case 'do_export': |
|
68 | - $export = true; |
|
69 | - break; |
|
70 | - } |
|
71 | - |
|
72 | - if(!$export && empty($_REQUEST['repair_silent'])){ |
|
73 | - echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true); |
|
74 | - } |
|
53 | + $execute = false; |
|
54 | + $export = false; |
|
55 | + |
|
56 | + |
|
57 | + if(isset($_REQUEST['do_action'])){ |
|
58 | + switch($_REQUEST['do_action']){ |
|
59 | + case 'display': |
|
60 | + break; |
|
61 | + case 'execute': |
|
62 | + $execute = true; |
|
63 | + break; |
|
64 | + case 'export': |
|
65 | + header('Location: index.php?module=Administration&action=expandDatabase&do_action=do_export&to_pdf=true'); |
|
66 | + die(); |
|
67 | + case 'do_export': |
|
68 | + $export = true; |
|
69 | + break; |
|
70 | + } |
|
71 | + |
|
72 | + if(!$export && empty($_REQUEST['repair_silent'])){ |
|
73 | + echo getClassicModuleTitle($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'], array($mod_strings['LBL_EXPAND_DATABASE_COLUMNS'],$_REQUEST['do_action']), true); |
|
74 | + } |
|
75 | 75 | |
76 | 76 | $alter_queries = array(); |
77 | 77 | $restore_quries = array(); |
@@ -88,60 +88,60 @@ discard block |
||
88 | 88 | $theRestoreQueries = ''; |
89 | 89 | $alter_queries = array(); |
90 | 90 | while ($row = $db->fetchByAssoc($result)) { |
91 | - $length = (int)$row['length']; |
|
92 | - if($length < 255) { |
|
93 | - $newLength = ($length * 3 < 255) ? $length * 3 : 255; |
|
94 | - $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')'; |
|
95 | - $theAlterQueries .= $sql . "\n"; |
|
96 | - $alter_queries[] = $sql; |
|
97 | - |
|
98 | - $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')'; |
|
99 | - $theRestoreQueries .= $sql2 . "\n"; |
|
100 | - } |
|
91 | + $length = (int)$row['length']; |
|
92 | + if($length < 255) { |
|
93 | + $newLength = ($length * 3 < 255) ? $length * 3 : 255; |
|
94 | + $sql = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $newLength . ')'; |
|
95 | + $theAlterQueries .= $sql . "\n"; |
|
96 | + $alter_queries[] = $sql; |
|
97 | + |
|
98 | + $sql2 = 'ALTER TABLE ' . $row['table_name'] . ' ALTER COLUMN ' . $row['column_name'] . ' ' . $row['type'] . ' (' . $length . ')'; |
|
99 | + $theRestoreQueries .= $sql2 . "\n"; |
|
100 | + } |
|
101 | 101 | } //while |
102 | 102 | |
103 | 103 | //If there are no ALTER queries to run, echo message |
104 | 104 | if(count($alter_queries) == 0) { |
105 | - echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND']; |
|
105 | + echo $mod_strings['ERR_NO_COLUMNS_TO_EXPAND']; |
|
106 | 106 | } else { |
107 | 107 | |
108 | - // Create a backup file to restore columns to original length |
|
109 | - if($execute) { |
|
110 | - $fh = sugar_fopen('restoreExpand.sql', 'w'); |
|
111 | - if(-1 == fwrite($fh, $theRestoreQueries)) { |
|
112 | - $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']); |
|
113 | - echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']); |
|
114 | - } else { |
|
115 | - $GLOBALS['log']->info($mod_strings['LBL_CREATE_RESOTRE_FILE']); |
|
116 | - echo($mod_strings['LBL_CREATE_RESOTRE_FILE']); |
|
117 | - } |
|
118 | - |
|
119 | - foreach($alter_queries as $key=>$value) { |
|
120 | - $db->query($value); |
|
121 | - } |
|
122 | - } |
|
123 | - |
|
124 | - if($export) { |
|
125 | - header("Content-Disposition: attachment; filename=expandSugarDB.sql"); |
|
126 | - header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}"); |
|
127 | - header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); |
|
128 | - header( "Last-Modified: " . TimeDate::httpTime() ); |
|
129 | - header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
130 | - header("Content-Length: ".strlen($theAlterQueries)); |
|
131 | - echo $theAlterQueries; |
|
132 | - die(); |
|
133 | - } else { |
|
134 | - if(empty($_REQUEST['repair_silent'])) { |
|
135 | - echo nl2br($theAlterQueries); |
|
136 | - } |
|
137 | - } |
|
108 | + // Create a backup file to restore columns to original length |
|
109 | + if($execute) { |
|
110 | + $fh = sugar_fopen('restoreExpand.sql', 'w'); |
|
111 | + if(-1 == fwrite($fh, $theRestoreQueries)) { |
|
112 | + $GLOBALS['log']->error($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']); |
|
113 | + echo($mod_strings['ERR_CANNOT_CREATE_RESTORE_FILE']); |
|
114 | + } else { |
|
115 | + $GLOBALS['log']->info($mod_strings['LBL_CREATE_RESOTRE_FILE']); |
|
116 | + echo($mod_strings['LBL_CREATE_RESOTRE_FILE']); |
|
117 | + } |
|
118 | + |
|
119 | + foreach($alter_queries as $key=>$value) { |
|
120 | + $db->query($value); |
|
121 | + } |
|
122 | + } |
|
123 | + |
|
124 | + if($export) { |
|
125 | + header("Content-Disposition: attachment; filename=expandSugarDB.sql"); |
|
126 | + header("Content-Type: text/sql; charset={$app_strings['LBL_CHARSET']}"); |
|
127 | + header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" ); |
|
128 | + header( "Last-Modified: " . TimeDate::httpTime() ); |
|
129 | + header( "Cache-Control: post-check=0, pre-check=0", false ); |
|
130 | + header("Content-Length: ".strlen($theAlterQueries)); |
|
131 | + echo $theAlterQueries; |
|
132 | + die(); |
|
133 | + } else { |
|
134 | + if(empty($_REQUEST['repair_silent'])) { |
|
135 | + echo nl2br($theAlterQueries); |
|
136 | + } |
|
137 | + } |
|
138 | 138 | |
139 | 139 | } //if-else |
140 | - } // end do_action |
|
140 | + } // end do_action |
|
141 | 141 | |
142 | - if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) { |
|
143 | - if(!file_exists('restoreExpand.sql')) { |
|
144 | - echo " <b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br> |
|
142 | + if(empty($_REQUEST['repair_silent']) && empty($_REQUEST['do_action'])) { |
|
143 | + if(!file_exists('restoreExpand.sql')) { |
|
144 | + echo " <b>{$mod_strings['LBL_REPAIR_ACTION']}</b><br> |
|
145 | 145 | <form name='repairdb'> |
146 | 146 | <input type='hidden' name='action' value='expandDatabase'> |
147 | 147 | <input type='hidden' name='module' value='Administration'> |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | </select><input type='submit' class='button' value='".$mod_strings['LBL_GO']."'> |
154 | 154 | </form><br><br> |
155 | 155 | ".$mod_strings['LBL_EXPAND_DATABASE_TEXT']; |
156 | - } else { |
|
157 | - echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>"; |
|
158 | - } //if-else |
|
159 | - } //if |
|
156 | + } else { |
|
157 | + echo "<b>{$mod_strings['LBL_EXPAND_DATABASE_FINISHED_ERROR']}</b><br>"; |
|
158 | + } //if-else |
|
159 | + } //if |
|
160 | 160 | }else{ |
161 | - sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); |
|
161 | + sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 |
@@ -44,18 +44,18 @@ |
||
44 | 44 | echo $mod_strings['LBL_REBUILD_AUDIT_SEARCH'] . ' <BR>'; |
45 | 45 | foreach ($beanFiles as $bean => $file) |
46 | 46 | { |
47 | - if(strlen($file) > 0 && file_exists($file)) { |
|
48 | - require_once($file); |
|
49 | - $focus = new $bean(); |
|
50 | - if ($focus->is_AuditEnabled()) { |
|
51 | - if (!$focus->db->tableExists($focus->get_audit_table_name())) { |
|
52 | - printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name); |
|
53 | - $focus->create_audit_table(); |
|
54 | - } else { |
|
55 | - printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name); |
|
56 | - } |
|
57 | - } |
|
58 | - } |
|
47 | + if(strlen($file) > 0 && file_exists($file)) { |
|
48 | + require_once($file); |
|
49 | + $focus = new $bean(); |
|
50 | + if ($focus->is_AuditEnabled()) { |
|
51 | + if (!$focus->db->tableExists($focus->get_audit_table_name())) { |
|
52 | + printf($mod_strings['LBL_REBUILD_AUDIT_SEARCH'],$focus->get_audit_table_name(), $focus->object_name); |
|
53 | + $focus->create_audit_table(); |
|
54 | + } else { |
|
55 | + printf($mod_strings['LBL_REBUILD_AUDIT_SKIP'],$focus->object_name); |
|
56 | + } |
|
57 | + } |
|
58 | + } |
|
59 | 59 | } |
60 | 60 | echo $mod_strings['LBL_DONE']; |
61 | 61 | ?> |
62 | 62 | \ No newline at end of file |