This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point'); |
||
3 | /********************************************************************************* |
||
4 | * SugarCRM Community Edition is a customer relationship management program developed by |
||
5 | * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. |
||
6 | |||
7 | * SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd. |
||
8 | * Copyright (C) 2011 - 2014 Salesagility Ltd. |
||
9 | * |
||
10 | * This program is free software; you can redistribute it and/or modify it under |
||
11 | * the terms of the GNU Affero General Public License version 3 as published by the |
||
12 | * Free Software Foundation with the addition of the following permission added |
||
13 | * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK |
||
14 | * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY |
||
15 | * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. |
||
16 | * |
||
17 | * This program is distributed in the hope that it will be useful, but WITHOUT |
||
18 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
19 | * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more |
||
20 | * details. |
||
21 | * |
||
22 | * You should have received a copy of the GNU Affero General Public License along with |
||
23 | * this program; if not, see http://www.gnu.org/licenses or write to the Free |
||
24 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
||
25 | * 02110-1301 USA. |
||
26 | * |
||
27 | * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, |
||
28 | * SW2-130, Cupertino, CA 95014, USA. or at email address [email protected]. |
||
29 | * |
||
30 | * The interactive user interfaces in modified source and object code versions |
||
31 | * of this program must display Appropriate Legal Notices, as required under |
||
32 | * Section 5 of the GNU Affero General Public License version 3. |
||
33 | * |
||
34 | * In accordance with Section 7(b) of the GNU Affero General Public License version 3, |
||
35 | * these Appropriate Legal Notices must retain the display of the "Powered by |
||
36 | * SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not |
||
37 | * reasonably feasible for technical reasons, the Appropriate Legal Notices must |
||
38 | * display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM". |
||
39 | ********************************************************************************/ |
||
40 | |||
41 | |||
42 | |||
43 | |||
44 | |||
45 | require_once('modules/Administration/UpgradeWizardCommon.php'); |
||
46 | |||
47 | |||
48 | unset($_SESSION['rebuild_relationships']); |
||
49 | unset($_SESSION['rebuild_extensions']); |
||
50 | // process commands |
||
51 | if(empty($_REQUEST['install_file'])){ |
||
52 | die( "File to install not specified." ); |
||
53 | } |
||
54 | if( !isset($_REQUEST['mode']) || ($_REQUEST['mode'] == "") ){ |
||
55 | die( "No mode specified." ); |
||
56 | } |
||
57 | |||
58 | if(!file_exists($base_tmp_upgrade_dir)) { |
||
59 | mkdir($base_tmp_upgrade_dir, 0755, true); |
||
60 | } |
||
61 | |||
62 | $unzip_dir = mk_temp_dir( $base_tmp_upgrade_dir ); |
||
63 | $install_file = hashToFile($_REQUEST['install_file']); |
||
64 | $hidden_fields = ""; |
||
65 | $new_lang_name = ""; |
||
66 | $new_lang_desc = ""; |
||
67 | |||
68 | $mode = $_REQUEST['mode']; |
||
69 | $hidden_fields .= "<input type=hidden name=\"mode\" value=\"$mode\"/>"; |
||
70 | |||
71 | |||
72 | $install_type = getInstallType( $install_file ); |
||
73 | |||
74 | $version = ""; |
||
75 | $previous_version = ""; |
||
76 | $show_files = true; |
||
77 | |||
78 | $zip_from_dir = "."; |
||
79 | $zip_to_dir = "."; |
||
80 | $zip_force_copy = array(); |
||
81 | $license_file = $unzip_dir.'/LICENSE.txt'; |
||
82 | $readme_file = $unzip_dir.'/README.txt'; |
||
83 | $require_license = false; |
||
84 | $found_readme = false; |
||
85 | $author = ''; |
||
86 | $name = ''; |
||
87 | $description = ''; |
||
88 | $is_uninstallable = true; |
||
89 | $id_name = ''; |
||
90 | $dependencies = array(); |
||
91 | $remove_tables = 'true'; |
||
92 | |||
93 | unzip( $install_file, $unzip_dir ); |
||
94 | if($install_type == 'module' && $mode != 'Uninstall'){ |
||
95 | if(file_exists($license_file)){ |
||
96 | $require_license = true; |
||
97 | } |
||
98 | } |
||
99 | |||
100 | //Scan the unzip dir for unsafe files |
||
101 | if (((defined('MODULE_INSTALLER_PACKAGE_SCAN') && MODULE_INSTALLER_PACKAGE_SCAN) |
||
102 | || !empty($GLOBALS['sugar_config']['moduleInstaller']['packageScan'])) && $install_type != 'patch') { |
||
103 | require_once('ModuleInstall/ModuleScanner.php'); |
||
104 | $ms = new ModuleScanner(); |
||
105 | $ms->scanPackage($unzip_dir); |
||
106 | if($ms->hasIssues()){ |
||
107 | rmdir_recursive($unzip_dir); |
||
108 | $ms->displayIssues(); |
||
109 | sugar_cleanup(true); |
||
110 | } |
||
111 | } |
||
112 | |||
113 | // assumption -- already validated manifest.php at time of upload |
||
114 | require( "$unzip_dir/manifest.php" ); |
||
115 | |||
116 | |||
117 | |||
118 | if( isset( $manifest['copy_files']['from_dir'] ) && $manifest['copy_files']['from_dir'] != "" ){ |
||
119 | $zip_from_dir = $manifest['copy_files']['from_dir']; |
||
120 | } |
||
121 | if( isset( $manifest['copy_files']['to_dir'] ) && $manifest['copy_files']['to_dir'] != "" ){ |
||
122 | $zip_to_dir = $manifest['copy_files']['to_dir']; |
||
123 | } |
||
124 | if( isset( $manifest['copy_files']['force_copy'] ) && $manifest['copy_files']['force_copy'] != "" ){ |
||
125 | $zip_force_copy = $manifest['copy_files']['force_copy']; |
||
126 | } |
||
127 | if( isset( $manifest['version'] ) ){ |
||
128 | $version = $manifest['version']; |
||
129 | } |
||
130 | if( isset( $manifest['author'] ) ){ |
||
131 | $author = $manifest['author']; |
||
132 | } |
||
133 | if( isset( $manifest['name'] ) ){ |
||
134 | $name = $manifest['name']; |
||
135 | } |
||
136 | if( isset( $manifest['description'] ) ){ |
||
137 | $description = $manifest['description']; |
||
138 | } |
||
139 | if( isset( $manifest['is_uninstallable'] ) ){ |
||
140 | $is_uninstallable = $manifest['is_uninstallable']; |
||
141 | } |
||
142 | if(isset($installdefs) && isset( $installdefs['id'] ) ){ |
||
143 | $id_name = $installdefs['id']; |
||
144 | } |
||
145 | if( isset( $manifest['dependencies']) ){ |
||
146 | $dependencies = $manifest['dependencies']; |
||
147 | } |
||
148 | if( isset( $manifest['remove_tables']) ){ |
||
149 | $remove_tables = $manifest['remove_tables']; |
||
150 | } |
||
151 | |||
152 | if($remove_tables != 'prompt'){ |
||
153 | $hidden_fields .= "<input type=hidden name=\"remove_tables\" value='".$remove_tables."'>"; |
||
154 | } |
||
155 | if(file_exists($readme_file) || !empty($manifest['readme'])){ |
||
156 | $found_readme = true; |
||
157 | } |
||
158 | $uh = new UpgradeHistory(); |
||
159 | //check dependencies first |
||
160 | if(!empty($dependencies)){ |
||
161 | $not_found = $uh->checkDependencies($dependencies); |
||
162 | if(!empty($not_found) && count($not_found) > 0){ |
||
163 | die( $mod_strings['ERR_UW_NO_DEPENDENCY']."[".implode(',', $not_found)."]"); |
||
164 | }//fi |
||
165 | } |
||
166 | switch( $install_type ){ |
||
167 | case "full": |
||
168 | case "patch": |
||
169 | if( !is_writable( "config.php" ) ){ |
||
170 | die( $mod_strings['ERR_UW_CONFIG'] ); |
||
171 | } |
||
172 | break; |
||
173 | case "theme": |
||
174 | break; |
||
175 | case "langpack": |
||
176 | // find name of language pack: find single file in include/language/xx_xx.lang.php |
||
177 | $d = dir( "$unzip_dir/$zip_from_dir/include/language" ); |
||
178 | while( $f = $d->read() ){ |
||
179 | if( $f == "." || $f == ".." ){ |
||
180 | continue; |
||
181 | } |
||
182 | else if( preg_match("/(.*)\.lang\.php\$/", $f, $match) ){ |
||
183 | $new_lang_name = $match[1]; |
||
184 | } |
||
185 | } |
||
186 | if( $new_lang_name == "" ){ |
||
187 | die( $mod_strings['ERR_UW_NO_LANGPACK'].$install_file ); |
||
188 | } |
||
189 | $hidden_fields .= "<input type=hidden name=\"new_lang_name\" value=\"$new_lang_name\"/>"; |
||
190 | |||
191 | $new_lang_desc = getLanguagePackName( "$unzip_dir/$zip_from_dir/include/language/$new_lang_name.lang.php" ); |
||
192 | if( $new_lang_desc == "" ){ |
||
193 | die( $mod_strings['ERR_UW_NO_LANG_DESC_1']."include/language/$new_lang_name.lang.php".$mod_strings['ERR_UW_NO_LANG_DESC_2']."$install_file." ); |
||
194 | } |
||
195 | $hidden_fields .= "<input type=hidden name=\"new_lang_desc\" value=\"$new_lang_desc\"/>"; |
||
196 | |||
197 | if( !is_writable( "config.php" ) ){ |
||
198 | die( $mod_strings['ERR_UW_CONFIG'] ); |
||
199 | } |
||
200 | break; |
||
201 | case "module": |
||
202 | $previous_install = array(); |
||
203 | if(!empty($id_name) & !empty($version)) |
||
204 | $previous_install = $uh->determineIfUpgrade($id_name, $version); |
||
205 | $previous_version = (empty($previous_install['version'])) ? '' : $previous_install['version']; |
||
206 | $previous_id = (empty($previous_install['id'])) ? '' : $previous_install['id']; |
||
207 | $show_files = false; |
||
208 | //rrs pull out unique_key |
||
209 | $hidden_fields .= "<input type=hidden name=\"author\" value=\"$author\"/>"; |
||
210 | $hidden_fields .= "<input type=hidden name=\"name\" value=\"$name\"/>"; |
||
211 | $hidden_fields .= "<input type=hidden name=\"description\" value=\"$description\"/>"; |
||
212 | $hidden_fields .= "<input type=hidden name=\"is_uninstallable\" value=\"$is_uninstallable\"/>"; |
||
213 | $hidden_fields .= "<input type=hidden name=\"id_name\" value=\"$id_name\"/>"; |
||
214 | $hidden_fields .= "<input type=hidden name=\"previous_version\" value=\"$previous_version\"/>"; |
||
215 | $hidden_fields .= "<input type=hidden name=\"previous_id\" value=\"$previous_id\"/>"; |
||
216 | break; |
||
217 | default: |
||
218 | die( $mod_strings['ERR_UW_WRONG_TYPE'].$install_type ); |
||
219 | } |
||
220 | |||
221 | |||
222 | $new_files = findAllFilesRelative( "$unzip_dir/$zip_from_dir", array() ); |
||
223 | $hidden_fields .= "<input type=hidden name=\"version\" value=\"$version\"/>"; |
||
224 | $serial_manifest = array(); |
||
225 | $serial_manifest['manifest'] = (isset($manifest) ? $manifest : ''); |
||
226 | $serial_manifest['installdefs'] = (isset($installdefs) ? $installdefs : ''); |
||
227 | $serial_manifest['upgrade_manifest'] = (isset($upgrade_manifest) ? $upgrade_manifest : ''); |
||
228 | $hidden_fields .= "<input type=hidden name=\"s_manifest\" value='".base64_encode(serialize($serial_manifest))."'>"; |
||
229 | // present list to user |
||
230 | ?> |
||
231 | <form action="<?php print( $form_action . "_commit" ); ?>" name="files" method="post" onSubmit="return validateForm(<?php print($require_license); ?>);"> |
||
232 | <?php |
||
233 | if(empty($new_studio_mod_files)) { |
||
234 | if(!empty($mode) && $mode == 'Uninstall') |
||
235 | echo $mod_strings['LBL_UW_UNINSTALL_READY']; |
||
236 | else if($mode == 'Disable') |
||
237 | echo $mod_strings['LBL_UW_DISABLE_READY']; |
||
238 | else if($mode == 'Enable') |
||
239 | echo $mod_strings['LBL_UW_ENABLE_READY']; |
||
240 | else |
||
241 | echo $mod_strings['LBL_UW_PATCH_READY']; |
||
242 | } else { |
||
243 | echo $mod_strings['LBL_UW_PATCH_READY2']; |
||
244 | echo '<input type="checkbox" onclick="toggle_these(0, ' . count($new_studio_mod_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL']; |
||
245 | foreach($new_studio_mod_files as $the_file) { |
||
246 | $new_file = clean_path( "$zip_to_dir/$the_file" ); |
||
247 | print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\"> " . $new_file . "</li>"); |
||
248 | $count++; |
||
249 | } |
||
250 | } |
||
251 | echo '<br>'; |
||
252 | if($require_license){ |
||
253 | $contents = sugar_file_get_contents($license_file); |
||
254 | $readme_contents = ''; |
||
255 | if($found_readme){ |
||
256 | if(file_exists($readme_file) && filesize($readme_file) > 0){ |
||
257 | $readme_contents = file_get_contents($readme_file); |
||
258 | }elseif(!empty($manifest['readme'])){ |
||
259 | $readme_contents = $manifest['readme']; |
||
260 | } |
||
261 | } |
||
262 | $license_final =<<<eoq2 |
||
263 | <table width='100%'> |
||
264 | <tr> |
||
265 | <td colspan="3"><ul class="tablist"> |
||
266 | <li id="license_li" class="active"><a id="license_link" class="current" href="javascript:selectTabCSS('license');">{$mod_strings['LBL_LICENSE']}</a></li> |
||
267 | <li class="active" id="readme_li"><a id="readme_link" href="javascript:selectTabCSS('readme');">{$mod_strings['LBL_README']}</a></li> |
||
268 | </ul></td> |
||
269 | </tr> |
||
270 | </table> |
||
271 | <div id='license_div'> |
||
272 | <table> |
||
273 | <tr> |
||
274 | <td colspan="3"> </td> |
||
275 | </tr> |
||
276 | <tr> |
||
277 | <td align="left" valign="top" colspan=2> |
||
278 | <b>{$mod_strings['LBL_MODULE_LICENSE']}</b> |
||
279 | </td> |
||
280 | </tr> |
||
281 | <tr> |
||
282 | <td align="left" valign="top" colspan=2> |
||
283 | <textarea cols="100" rows="8" readonly>{$contents}</textarea> |
||
284 | </td> |
||
285 | |||
286 | </tr> |
||
287 | <tr> |
||
288 | <td align="left" valign="top" colspan=2> |
||
289 | <input type='radio' id='radio_license_agreement_accept' name='radio_license_agreement' value='accept'>{$mod_strings['LBL_ACCEPT']} |
||
290 | <input type='radio' id='radio_license_agreement_reject' name='radio_license_agreement' value='reject' checked>{$mod_strings['LBL_DENY']} |
||
291 | </td> |
||
292 | |||
293 | </tr></table> |
||
294 | </div> |
||
295 | <div id='readme_div' style='display: none;'> |
||
296 | <table> |
||
297 | <tr> |
||
298 | <td colspan="3"> </td> |
||
299 | </tr> |
||
300 | <tr> |
||
301 | <td align="left" valign="top" colspan=2> |
||
302 | <b>{$mod_strings['LBL_README']}</b> |
||
303 | </td> |
||
304 | </tr> |
||
305 | <tr> |
||
306 | <td align="left" valign="top" colspan=2> |
||
307 | <textarea cols="100" rows="8" readonly>{$readme_contents}</textarea> |
||
308 | </td> |
||
309 | |||
310 | </tr> |
||
311 | </table> |
||
312 | </div> |
||
313 | |||
314 | eoq2; |
||
315 | echo $license_final; |
||
316 | echo "<br>"; |
||
317 | } |
||
318 | |||
319 | switch( $mode ){ |
||
320 | case "Install": |
||
321 | if( $install_type == "langpack") { |
||
322 | print( $mod_strings['LBL_UW_LANGPACK_READY'] ); |
||
323 | echo '<br><br>'; |
||
324 | } |
||
325 | break; |
||
326 | case "Uninstall": |
||
327 | if( $install_type == "langpack" ){ |
||
328 | print( $mod_strings['LBL_UW_LANGPACK_READY_UNISTALL'] ); |
||
329 | echo '<br><br>'; |
||
330 | } |
||
331 | else if($install_type != "module"){ |
||
332 | print( $mod_strings['LBL_UW_FILES_REMOVED'] ); |
||
333 | } |
||
334 | break; |
||
335 | case "Disable": |
||
336 | if( $install_type == "langpack" ){ |
||
337 | print( $mod_strings['LBL_UW_LANGPACK_READY_DISABLE'] ); |
||
338 | echo '<br><br>'; |
||
339 | } |
||
340 | break; |
||
341 | case "Enable": |
||
342 | if( $install_type == "langpack" ){ |
||
343 | print( $mod_strings['LBL_UW_LANGPACK_READY_ENABLE'] ); |
||
344 | echo '<br><br>'; |
||
345 | } |
||
346 | break; |
||
347 | } |
||
348 | |||
349 | |||
350 | ?> |
||
351 | <input type=submit value="<?php echo $mod_strings['LBL_ML_COMMIT'];?>" class="button" id="submit_button" /> |
||
352 | <input type=button value="<?php echo $mod_strings['LBL_ML_CANCEL'];?>" class="button" onClick="location.href='index.php?module=Administration&action=UpgradeWizard&view=module';"/> |
||
353 | |||
354 | <?php |
||
355 | |||
356 | if($remove_tables == 'prompt' && $mode == 'Uninstall'){ |
||
357 | print ("<br/><br/>"); |
||
358 | print ("<input type='radio' id='remove_tables_true' name='remove_tables' value='true' checked>".$mod_strings['ML_LBL_REMOVE_TABLES']." "); |
||
359 | print ("<input type='radio' id='remove_tables_false' name='remove_tables' value='false'>".$mod_strings['ML_LBL_DO_NOT_REMOVE_TABLES']."<br>"); |
||
360 | } |
||
361 | $count = 0; |
||
362 | |||
363 | if( $show_files == true ){ |
||
0 ignored issues
–
show
|
|||
364 | $count = 0; |
||
365 | |||
366 | $new_studio_mod_files = array(); |
||
367 | $new_sugar_mod_files = array(); |
||
368 | |||
369 | $cache_html_files = findAllFilesRelative( sugar_cached("layout"), array()); |
||
370 | |||
371 | foreach($new_files as $the_file) { |
||
372 | if(substr(strtolower($the_file), -5, 5) == '.html' && in_array($the_file, $cache_html_files)) |
||
373 | array_push($new_studio_mod_files, $the_file); |
||
374 | else |
||
375 | array_push($new_sugar_mod_files, $the_file); |
||
376 | } |
||
377 | |||
378 | echo '<script> |
||
379 | function toggle_these(start, end, ca) { |
||
380 | while(start < end) { |
||
381 | elem = eval("document.forms.files.copy_" + start); |
||
382 | if(!ca.checked) elem.checked = false; |
||
383 | else elem.checked = true; |
||
384 | start++; |
||
385 | } |
||
386 | } |
||
387 | </script>'; |
||
388 | |||
389 | |||
390 | |||
391 | global $theme; |
||
392 | |||
393 | echo '<br/><br/>'; |
||
394 | |||
395 | echo '<div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;'.(($mode == 'Enable' || $mode == 'Disable')?'display:none;':'').'" onclick=\'this.style.display="none"; toggleDisplay("more");\'id="all_text"> |
||
396 | '.SugarThemeRegistry::current()->getImage('advanced_search', '', null, null, ".gif", $mod_strings['LBL_ADVANCED_SEARCH']).$mod_strings['LBL_UW_SHOW_DETAILS'].'</div><div id=\'more\' style=\'display: none\'> |
||
397 | <div style="text-align: left; cursor: hand; cursor: pointer; text-decoration: underline;" onclick=\'document.getElementById("all_text").style.display=""; toggleDisplay("more");\'>' |
||
398 | .SugarThemeRegistry::current()->getImage('basic_search', '', null, null, ".gif", $mod_strings['LBL_BASIC_SEARCH']).$mod_strings['LBL_UW_HIDE_DETAILS'].'</div><br>'; |
||
399 | echo '<input type="checkbox" checked onclick="toggle_these(' . count($new_studio_mod_files) . ',' . count($new_files) . ', this)"> '.$mod_strings['LBL_UW_CHECK_ALL']; |
||
400 | echo '<ul>'; |
||
401 | foreach( $new_sugar_mod_files as $the_file ){ |
||
402 | $highlight_start = ""; |
||
403 | $highlight_end = ""; |
||
404 | $checked = ""; |
||
405 | $disabled = ""; |
||
406 | $unzip_file = "$unzip_dir/$zip_from_dir/$the_file"; |
||
407 | $new_file = clean_path( "$zip_to_dir/$the_file" ); |
||
408 | $forced_copy = false; |
||
409 | |||
410 | if( $mode == "Install" ){ |
||
411 | $checked = "checked"; |
||
412 | foreach( $zip_force_copy as $pattern ){ |
||
413 | if( preg_match("#" . $pattern . "#", $unzip_file) ){ |
||
414 | $disabled = "disabled=\"true\""; |
||
415 | $forced_copy = true; |
||
416 | } |
||
417 | } |
||
418 | if( !$forced_copy && is_file( $new_file ) && (md5_file( $unzip_file ) == md5_file( $new_file )) ){ |
||
419 | $disabled = "disabled=\"true\""; |
||
420 | //$checked = ""; |
||
421 | } |
||
422 | if( $checked != "" && $disabled != "" ){ // need to put a hidden field |
||
423 | print( "<input name=\"copy_$count\" type=\"hidden\" value=\"" . $the_file . "\">\n" ); |
||
424 | } |
||
425 | print( "<li><input id=\"copy_$count\" name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end ); |
||
426 | if( $checked == "" && $disabled != "" ){ // need to explain this file hasn't changed |
||
427 | print( " (no changes)" ); |
||
428 | } |
||
429 | print( "<br>\n" ); |
||
430 | } |
||
431 | else if( $mode == "Uninstall" && file_exists( $new_file ) ){ |
||
432 | if( md5_file( $unzip_file ) == md5_file( $new_file ) ){ |
||
433 | $checked = "checked=\"true\""; |
||
434 | } |
||
435 | else{ |
||
436 | $highlight_start = "<font color=red>"; |
||
437 | $highlight_end = "</font>"; |
||
438 | } |
||
439 | print( "<li><input name=\"copy_$count\" type=\"checkbox\" value=\"" . $the_file . "\" $checked $disabled > " . $highlight_start . $new_file . $highlight_end . "<br>\n" ); |
||
440 | } |
||
441 | $count++; |
||
442 | } |
||
443 | print( "</ul>\n" ); |
||
444 | } |
||
445 | // echo '</div>'; |
||
446 | if($mode == "Disable" || $mode == "Enable"){ |
||
447 | //check to see if any files have been modified |
||
448 | $modified_files = getDiffFiles($unzip_dir, $install_file, ($mode == 'Enable'), $previous_version); |
||
449 | if(count($modified_files) > 0){ |
||
450 | //we need to tell the user that some files have been modified since they last did an install |
||
451 | echo '<script>' . |
||
452 | 'function handleFileChange(){'; |
||
453 | if(count($modified_files) > 0){ |
||
454 | echo 'if(document.getElementById("radio_overwrite_files") != null && document.getElementById("radio_do_not_overwrite_files") != null){ |
||
455 | var overwrite = false; |
||
456 | if(document.getElementById("radio_overwrite_files").checked){ |
||
457 | overwrite = true |
||
458 | } |
||
459 | } |
||
460 | return true;'; |
||
461 | }else{ |
||
462 | echo 'return true;'; |
||
463 | } |
||
464 | echo '}</script>'; |
||
465 | print('<b>'.$mod_strings['ML_LBL_OVERWRITE_FILES'].'</b>'); |
||
466 | print('<table><td align="left" valign="top" colspan=2>'); |
||
467 | print("<input type='radio' id='radio_overwrite_files' name='radio_overwrite' value='overwrite'>{$mod_strings['LBL_OVERWRITE_FILES']} "); |
||
468 | print("<input type='radio' id='radio_do_not_overwrite_files' name='radio_overwrite' value='do_not_overwrite' checked>{$mod_strings['LBL_DO_OVERWRITE_FILES']}"); |
||
469 | print("</td></tr></table>"); |
||
470 | print('<ul>'); |
||
471 | foreach($modified_files as $modified_file){ |
||
472 | print('<li>'.$modified_file.'</li>'); |
||
473 | } |
||
474 | print('</ul>'); |
||
475 | }else{ |
||
476 | echo '<script>' . |
||
477 | 'function handleFileChange(){'; |
||
478 | echo 'return true;'; |
||
479 | echo '}</script>'; |
||
480 | } |
||
481 | }else{ |
||
482 | echo '<script>' . |
||
483 | 'function handleFileChange(){'; |
||
484 | echo 'return true;'; |
||
485 | echo '}</script>'; |
||
486 | } |
||
487 | echo '<script>' . |
||
488 | 'function validateForm(process){'. |
||
489 | 'return (handleCommit(process) && handleFileChange());'. |
||
490 | '}'. |
||
491 | 'function handleCommit(process){ |
||
492 | if(process == 1) { |
||
493 | if(document.getElementById("radio_license_agreement_reject") != null && document.getElementById("radio_license_agreement_accept") != null){ |
||
494 | var accept = false; |
||
495 | if(document.getElementById("radio_license_agreement_accept").checked){ |
||
496 | accept = true |
||
497 | } |
||
498 | if(!accept){ |
||
499 | //do not allow the form to submit |
||
500 | alert("'.$mod_strings['ERR_UW_ACCEPT_LICENSE'].'"); |
||
501 | return false; |
||
502 | } |
||
503 | } |
||
504 | } |
||
505 | document.getElementById("submit_button").disabled = true; |
||
506 | return true; |
||
507 | } |
||
508 | var keys = [ "license","readme"]; |
||
509 | function selectTabCSS(key){ |
||
510 | for( var i=0; i<keys.length;i++) |
||
511 | { |
||
512 | var liclass = ""; |
||
513 | var linkclass = ""; |
||
514 | |||
515 | if ( key == keys[i]) |
||
516 | { |
||
517 | var liclass = "active"; |
||
518 | var linkclass = "current"; |
||
519 | document.getElementById(keys[i]+"_div").style.display = "block"; |
||
520 | }else{ |
||
521 | document.getElementById(keys[i]+"_div").style.display = "none"; |
||
522 | } |
||
523 | document.getElementById(keys[i]+"_li").className = liclass; |
||
524 | document.getElementById(keys[i]+"_link").className = linkclass; |
||
525 | } |
||
526 | tabPreviousKey = key; |
||
527 | } |
||
528 | </script>'; |
||
529 | |||
530 | $fileHash = fileToHash($install_file ); |
||
531 | ?> |
||
532 | <?php print( $hidden_fields ); ?> |
||
533 | <input type="hidden" name="copy_count" value="<?php print( $count );?>"/> |
||
534 | <input type="hidden" name="run" value="commit" /> |
||
535 | <input type="hidden" name="install_file" value="<?php echo $fileHash; ?>" /> |
||
536 | <input type="hidden" name="unzip_dir" value="<?php echo basename($unzip_dir); ?>" /> |
||
537 | <input type="hidden" name="zip_from_dir" value="<?php echo $zip_from_dir; ?>" /> |
||
538 | <input type="hidden" name="zip_to_dir" value="<?php echo $zip_to_dir; ?>" /> |
||
539 | </form> |
||
540 | |||
541 | <?php |
||
542 | $GLOBALS['log']->info( "Upgrade Wizard patches" ); |
||
543 | ?> |
||
544 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.