| version 1.1, 2005/06/05 12:15:15 |
version 1.2, 2005/10/01 23:59:39 |
|
|
| * ____________________________________________________________ |
* ____________________________________________________________ |
| * |
* |
| * Developed by Ondrej Jombik <nepto@platon.sk> |
* Developed by Ondrej Jombik <nepto@platon.sk> |
| * Copyright (c) 2001-2003 Platon SDG, http://platon.sk/ |
* Copyright (c) 2001-2005 Platon Group, http://platon.sk/ |
| * All rights reserved. |
* All rights reserved. |
| * |
* |
| * See README file for more information about this software. |
* See README file for more information about this software. |
|
|
| * http://platon.sk/projects/phpWebFileManager/ |
* http://platon.sk/projects/phpWebFileManager/ |
| */ |
*/ |
| |
|
| /* $Platon: phpWebFileManager/index.php,v 1.46 2003/12/20 18:44:15 nepto Exp $ */ |
/* $Platon: phpWebFileManager/index.php,v 1.53 2005/10/01 17:17:34 nepto Exp $ */ |
| |
|
| /* |
/* |
| * phpWebFileManager initialization |
* phpWebFileManager initialization |
| Line 118 if (! function_exists('fm_footer')) { |
|
| Line 118 if (! function_exists('fm_footer')) { |
|
| function fm_main() /* {{{ */ |
function fm_main() /* {{{ */ |
| { |
{ |
| global $fm_cfg; |
global $fm_cfg; |
| global $HTTP_SERVER_VARS; |
|
| |
|
| /* Hidden parameters */ |
/* Hidden parameters */ |
| $fm_origvars = fm_append_slash($fm_cfg['origvars'], '&'); |
$fm_origvars = fm_append_slash($fm_cfg['origvars'], '&'); |
| Line 138 function fm_main() /* {{{ */ |
|
| Line 137 function fm_main() /* {{{ */ |
|
| $fm_filename = fm_get_cgi_var($fm_cfg['cgi'].'filename', ''); |
$fm_filename = fm_get_cgi_var($fm_cfg['cgi'].'filename', ''); |
| $fm_new_filename = fm_get_cgi_var($fm_cfg['cgi'].'new_filename', ''); |
$fm_new_filename = fm_get_cgi_var($fm_cfg['cgi'].'new_filename', ''); |
| $fm_file_data = fm_get_cgi_var($fm_cfg['cgi'].'file_data', ''); |
$fm_file_data = fm_get_cgi_var($fm_cfg['cgi'].'file_data', ''); |
| $PHP_SELF = @$HTTP_SERVER_VARS['PHP_SELF']; |
$PHP_SELF = @$_SERVER['PHP_SELF']; |
| $PHP_SELF_origvars_ue = htmlspecialchars("$PHP_SELF?$fm_origvars"); |
$PHP_SELF_origvars_ue = htmlspecialchars("$PHP_SELF?$fm_origvars"); |
| |
|
| /* |
/* |
| Line 345 function fm_main() /* {{{ */ |
|
| Line 344 function fm_main() /* {{{ */ |
|
| * file upload action |
* file upload action |
| */ |
*/ |
| if ($fm_action == 'upload_file' && $fm_cfg['perm']['file']['upload']) { /* {{{ */ |
if ($fm_action == 'upload_file' && $fm_cfg['perm']['file']['upload']) { /* {{{ */ |
| global $HTTP_POST_FILES; |
for ($j = 0; $j < $fm_cfg['perm']['file']['upload']; $j++) { |
| $fm_userfile = @$HTTP_POST_FILES[$fm_cfg['cgi'].'userfile']['tmp_name']; |
$fm_userfile = @$_FILES[$fm_cfg['cgi'].'userfile']['tmp_name'][$j]; |
| $fm_userfile_name = @$HTTP_POST_FILES[$fm_cfg['cgi'].'userfile']['name']; |
$fm_userfile_name = @$_FILES[$fm_cfg['cgi'].'userfile']['name'][$j]; |
| |
|
| if ($fm_submit == _FM_FILE_UPLOAD && $fm_userfile_name != '') { |
if ($fm_submit == _FM_FILE_UPLOAD && $fm_userfile_name != '') { |
| $tmp_target_filename = $target_filename = $fm_userfile_name; |
$tmp_target_filename = $target_filename = $fm_userfile_name; |
| for ($i = 2; file_exists($tmp_target_filename); $i++) { |
for ($i = 2; file_exists($tmp_target_filename); $i++) { |
| if ($i == 2) { |
if ($i == 2) { |
| $action_message[] = _FM_FILENAME_CHANGED; |
$action_message[] = _FM_FILENAME_CHANGED; |
| |
} |
| |
$tmp_target_filename = $target_filename . '-' . $i; |
| } |
} |
| $tmp_target_filename = $target_filename . '-' . $i; |
$target_filename = $tmp_target_filename; |
| } |
if (@copy($fm_userfile, $target_filename)) { |
| $target_filename = $tmp_target_filename; |
$action_message[] = _FM_FILE_UPLOAD_OK; |
| if (@copy($fm_userfile, $target_filename)) { |
if ($fm_cfg['mode']['file'] != 0) { |
| $action_message[] = _FM_FILE_UPLOAD_OK; |
if (@chmod($target_filename, $fm_cfg['mode']['file']) == false) { |
| if ($fm_cfg['mode']['file'] != 0) { |
$action_message[] = ' '._FM_CHMOD_ERR; |
| if (@chmod($target_filename, $fm_cfg['mode']['file']) == false) { |
} else { |
| $action_message[] = ' '._FM_CHMOD_ERR; |
$action_message[] = ' '._FM_CHMOD_OK; |
| } else { |
} |
| $action_message[] = ' '._FM_CHMOD_OK; |
|
| } |
} |
| |
} else { |
| |
$action_message[] = _FM_FILE_UPLOAD_ERR; |
| } |
} |
| } else { |
} else { |
| $action_message[] = _FM_FILE_UPLOAD_ERR; |
$action_message[] = _FM_CANCELED; |
| } |
} |
| } else { |
|
| $action_message[] = _FM_CANCELED; |
|
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| |
|
| Line 412 function fm_main() /* {{{ */ |
|
| Line 412 function fm_main() /* {{{ */ |
|
| 'fm_dir_he' => $fm_dir_he, |
'fm_dir_he' => $fm_dir_he, |
| 'fm_dir_he2' => $fm_dir_he2, |
'fm_dir_he2' => $fm_dir_he2, |
| 'fm_dir_ue' => $fm_dir_ue, |
'fm_dir_ue' => $fm_dir_ue, |
| 'fm_action_message' => $action_message, |
'fm_action_message' => array_unique($action_message), |
| 'PHP_SELF' => $PHP_SELF, |
'PHP_SELF' => $PHP_SELF, |
| 'PHP_SELF_origvars_ue' => $PHP_SELF_origvars_ue, |
'PHP_SELF_origvars_ue' => $PHP_SELF_origvars_ue, |
| ); |
); |
| Line 459 function fm_main() /* {{{ */ |
|
| Line 459 function fm_main() /* {{{ */ |
|
| echo '" name="'.$fm_cfg['cgi'].'action">'; |
echo '" name="'.$fm_cfg['cgi'].'action">'; |
| echo _FM_RENAME_FROM.'<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
echo _FM_RENAME_FROM.'<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
| echo _FM_RENAME_TO.'<br><br>'; |
echo _FM_RENAME_TO.'<br><br>'; |
| echo '<input type="text" value="" name="'.$fm_cfg['cgi'].'new_filename"><br><br>'; |
echo '<input type="text" value="'.$fm_filename_he2.'" name="'.$fm_cfg['cgi'].'new_filename">'; |
| echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'; |
echo '<br><br><input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'; |
| echo $fm_action == 'confirm_rename_directory' ? _FM_DIR_RENAME : _FM_FILE_RENAME; |
echo $fm_action == 'confirm_rename_directory' ? _FM_DIR_RENAME : _FM_FILE_RENAME; |
| echo '"> '; |
echo '"> '; |
| echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_CANCEL.'">'; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_CANCEL.'">'; |
| Line 492 function fm_main() /* {{{ */ |
|
| Line 492 function fm_main() /* {{{ */ |
|
| case 'confirm_upload_file': |
case 'confirm_upload_file': |
| case _FM_FILE_UPLOAD: |
case _FM_FILE_UPLOAD: |
| echo '<input type="hidden" value="upload_file" name="'.$fm_cfg['cgi'].'action">'; |
echo '<input type="hidden" value="upload_file" name="'.$fm_cfg['cgi'].'action">'; |
| echo _FM_SELECT_LOCAL . ':<br><br>'; |
echo ($fm_cfg['perm']['file']['upload'] > 1 ? _FM_SELECT_LOCALS : _FM_SELECT_LOCAL).':<br><br>'; |
| echo '<input type="file" value="" name="'.$fm_cfg['cgi'].'userfile"><br><br>'; |
for ($i = 0; $i < $fm_cfg['perm']['file']['upload']; $i++) { |
| |
echo '<input type="file" value="" name="'.$fm_cfg['cgi'].'userfile['.$i.']"><br><br>'; |
| |
} |
| echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_UPLOAD.'"> '; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_UPLOAD.'"> '; |
| echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_CANCEL.'">'; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_CANCEL.'">'; |
| break; |
break; |
| Line 569 function fm_main() /* {{{ */ |
|
| Line 571 function fm_main() /* {{{ */ |
|
| */ |
*/ |
| if ($view_column && $fm_cfg['perm']['file']['view']) { |
if ($view_column && $fm_cfg['perm']['file']['view']) { |
| if (strlen($fm_cfg['url']['root']) > 0 && $fm_cfg['url']['root']{0} == '/') { |
if (strlen($fm_cfg['url']['root']) > 0 && $fm_cfg['url']['root']{0} == '/') { |
| $view_url_prefix_ue = rawurlencode($fm_cfg['url']['root']).$fm_dir_ue; |
$view_url_prefix_ue = $fm_cfg['url']['root'].$fm_dir_ue; |
| } else { |
} else { |
| $view_url = parse_url((strcasecmp($HTTP_SERVER_VARS, 'on') ? 'http' : 'https') |
$view_url = parse_url((strcasecmp($_SERVER['HTTPS'], 'on') ? 'http' : 'https') |
| .'://'.$HTTP_SERVER_VARS['HTTP_HOST'].$HTTP_SERVER_VARS['REQUEST_URI']); |
.'://'.$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']); |
| $view_url['path'] = fm_get_path_without_scriptname($view_url) |
$view_url['path'] = fm_get_path_without_scriptname($view_url) |
| . rawurlencode(strlen($fm_cfg['url']['root']) > 0 |
. (strlen($fm_cfg['url']['root']) > 0 ? $fm_cfg['url']['root'] : $fm_cfg['dir']['root']) |
| ? $fm_cfg['url']['root'] : $fm_cfg['dir']['root']) |
|
| . $fm_dir_ue; |
. $fm_dir_ue; |
| unset($view_url['fragment']); |
unset($view_url['fragment']); |
| unset($view_url['query']); |
unset($view_url['query']); |