| version 1.44, 2003/11/20 14:07:26 |
version 1.45, 2003/12/18 17:54:54 |
|
|
| * http://platon.sk/projects/phpWebFileManager/ |
* http://platon.sk/projects/phpWebFileManager/ |
| */ |
*/ |
| |
|
| /* $Platon: phpWebFileManager/index.php,v 1.43 2003/05/14 14:03:52 nepto Exp $ */ |
/* $Platon: phpWebFileManager/index.php,v 1.44 2003/11/20 14:07:26 nepto Exp $ */ |
| |
|
| /* |
/* |
| * phpWebFileManager initialization |
* phpWebFileManager initialization |
| Line 395 function fm_main() /* {{{ */ |
|
| Line 395 function fm_main() /* {{{ */ |
|
| * Form |
* Form |
| */ |
*/ |
| |
|
| echo '<form enctype="multipart/form-data" method=post' |
echo '<form enctype="multipart/form-data" method="post"' |
| . ' action="' . htmlspecialchars($PHP_SELF) . '">'."\n"; |
. ' action="' . htmlspecialchars($PHP_SELF) . '">'."\n"; |
| echo '<input type=hidden value="'.$fm_filename_he.'" name="'.$fm_cfg['cgi'].'filename">'."\n"; |
echo '<input type="hidden" value="'.$fm_filename_he.'" name="'.$fm_cfg['cgi'].'filename">'."\n"; |
| echo '<input type=hidden value="'.$fm_dir_he.'" name="'.$fm_cfg['cgi'].'dir">'."\n"; |
echo '<input type="hidden" value="'.$fm_dir_he.'" name="'.$fm_cfg['cgi'].'dir">'."\n"; |
| echo fm_get_origvars_html($fm_origvars); |
echo fm_get_origvars_html($fm_origvars); |
| |
|
| /* |
/* |
| Line 429 function fm_main() /* {{{ */ |
|
| Line 429 function fm_main() /* {{{ */ |
|
| * confirm delete files action |
* confirm delete files action |
| */ |
*/ |
| case 'confirm_delete_file': |
case 'confirm_delete_file': |
| echo '<input type=hidden value=delete_file name="'.$fm_cfg['cgi'].'action">'; |
echo '<input type="hidden" value="delete_file" name="'.$fm_cfg['cgi'].'action">'; |
| echo _FM_REALLY_DELETE.'<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
echo _FM_REALLY_DELETE.'<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
| echo $fm_dir == '' |
echo $fm_dir == '' |
| ? _FM_FROM_ROOT_DIR.'?<br><br>' |
? _FM_FROM_ROOT_DIR.'?<br><br>' |
| : _FM_FROM_DIR.'<br><br><i>'.$fm_dir_he2.'</i><br><br>'; |
: _FM_FROM_DIR.'<br><br><i>'.$fm_dir_he2.'</i><br><br>'; |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_DELETE.'"> '; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_DELETE.'"> '; |
| 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; |
| |
|
| /* |
/* |
| * confirm remove directory action |
* confirm remove directory action |
| */ |
*/ |
| case 'confirm_remove_directory': |
case 'confirm_remove_directory': |
| echo '<input type=hidden value=remove_directory name="'.$fm_cfg['cgi'].'action">'; |
echo '<input type="hidden" value="remove_directory" name="'.$fm_cfg['cgi'].'action">'; |
| echo _FM_REALLY_REMOVE.'<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
echo _FM_REALLY_REMOVE.'<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
| echo _FM_MUST_BE_EMPTY.'<br><br>'; |
echo _FM_MUST_BE_EMPTY.'<br><br>'; |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'._FM_DIR_REMOVE.'"> '; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_DIR_REMOVE.'"> '; |
| 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 454 function fm_main() /* {{{ */ |
|
| Line 454 function fm_main() /* {{{ */ |
|
| */ |
*/ |
| case 'confirm_rename_file': |
case 'confirm_rename_file': |
| case 'confirm_rename_directory': |
case 'confirm_rename_directory': |
| echo '<input type=hidden value="'; |
echo '<input type="hidden" value="'; |
| echo $fm_action == 'confirm_rename_directory' ? 'rename_directory' : 'rename_file'; |
echo $fm_action == 'confirm_rename_directory' ? 'rename_directory' : 'rename_file'; |
| 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="" name="'.$fm_cfg['cgi'].'new_filename"><br><br>'; |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'; |
echo '<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.'">'; |
| break; |
break; |
| |
|
| /* |
/* |
| Line 475 function fm_main() /* {{{ */ |
|
| Line 475 function fm_main() /* {{{ */ |
|
| case _FM_DIR_CREATE: |
case _FM_DIR_CREATE: |
| $create_dir = $fm_action == 'confirm_create_directory' |
$create_dir = $fm_action == 'confirm_create_directory' |
| || $fm_action == _FM_DIR_CREATE; |
|| $fm_action == _FM_DIR_CREATE; |
| echo '<input type=hidden value="'; |
echo '<input type="hidden" value="'; |
| echo $create_dir ? 'create_directory' : 'create_file'; |
echo $create_dir ? 'create_directory' : 'create_file'; |
| echo '" name="'.$fm_cfg['cgi'].'action">'; |
echo '" name="'.$fm_cfg['cgi'].'action">'; |
| echo _FM_ENTER_NAME . ':<br><br>'; |
echo _FM_ENTER_NAME . ':<br><br>'; |
| echo '<input type=text value="" name="'.$fm_cfg['cgi'].'new_filename"><br><br>'; |
echo '<input type="text" value="" name="'.$fm_cfg['cgi'].'new_filename"><br><br>'; |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'; |
| echo $create_dir ? _FM_DIR_CREATE : _FM_FILE_CREATE; |
echo $create_dir ? _FM_DIR_CREATE : _FM_FILE_CREATE; |
| 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.'">'; |
| break; |
break; |
| |
|
| /* |
/* |
| Line 491 function fm_main() /* {{{ */ |
|
| Line 491 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_SELECT_LOCAL . ':<br><br>'; |
| echo '<input type=file value="" name="'.$fm_cfg['cgi'].'userfile"><br><br>'; |
echo '<input type="file" value="" name="'.$fm_cfg['cgi'].'userfile"><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 526 function fm_main() /* {{{ */ |
|
| Line 526 function fm_main() /* {{{ */ |
|
| } |
} |
| } |
} |
| if ($file_edit_delayed) { |
if ($file_edit_delayed) { |
| echo '<input type=hidden value="edit_file" name="'.$fm_cfg['cgi'].'action">'; |
echo '<input type="hidden" value="edit_file" name="'.$fm_cfg['cgi'].'action">'; |
| echo _FM_REALLY_EDIT |
echo _FM_REALLY_EDIT |
| . '<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
. '<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
| echo $fm_dir == '' |
echo $fm_dir == '' |
| ? _FM_IN_ROOT_DIR . '?<br><br>' |
? _FM_IN_ROOT_DIR . '?<br><br>' |
| : _FM_IN_DIR . '<br><br><i>'.$fm_dir_he2.'</i><br><br>'; |
: _FM_IN_DIR . '<br><br><i>'.$fm_dir_he2.'</i><br><br>'; |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_EDIT.'"> '; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_EDIT.'"> '; |
| 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; |
| } |
} |
| } |
} |
| case 'edit_file': |
case 'edit_file': |
| if (count($action_message) <= 0 && ($fp = @fopen($fm_filename, 'r')) != false) { |
if (count($action_message) <= 0 && ($fp = @fopen($fm_filename, 'r')) != false) { |
| echo '<input type=hidden value="save_file" name="'.$fm_cfg['cgi'].'action">'; |
echo '<input type="hidden" value="save_file" name="'.$fm_cfg['cgi'].'action">'; |
| // Please write me, if you want to have cols and rows configurable. |
// Please write me, if you want to have cols and rows configurable. |
| echo '<textarea name="'.$fm_cfg['cgi'].'file_data" cols=50 rows=15>'; |
echo '<textarea name="'.$fm_cfg['cgi'].'file_data" cols="50" rows="15">'; |
| while (! @feof($fp)) { |
while (! @feof($fp)) { |
| echo htmlspecialchars(@fread($fp, 1024)); |
echo htmlspecialchars(@fread($fp, 1024)); |
| } |
} |
| @fclose($fp); |
@fclose($fp); |
| echo '</textarea><br><br>'; |
echo '</textarea><br><br>'; |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_SAVE.'"> '; |
echo '<input type="submit" name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_SAVE.'"> '; |
| 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 603 function fm_main() /* {{{ */ |
|
| Line 603 function fm_main() /* {{{ */ |
|
| * Table tag and parent directory link |
* Table tag and parent directory link |
| */ |
*/ |
| |
|
| echo '<table cellpadding="2" class=phpWebFileManager>' . "\n"; |
echo '<table cellpadding="2" class="phpWebFileManager">' . "\n"; |
| |
|
| $line = 0; |
$line = 0; |
| if (strlen(getcwd()) > strlen($fm_root_dir)) { |
if (strlen(getcwd()) > strlen($fm_root_dir)) { |
| echo '<tr valign=middle'; |
echo '<tr valign="middle"'; |
| if (! empty($fm_cfg['color']['odd'])) |
if (! empty($fm_cfg['color']['odd'])) |
| echo ' bgcolor="'.$fm_cfg['color']['odd'].'"'; |
echo ' bgcolor="'.$fm_cfg['color']['odd'].'"'; |
| echo '>'; |
echo '>'; |
| if ($fm_cfg['show']['icons']) { |
if ($fm_cfg['show']['icons']) { |
| echo '<td align=center>'; |
echo '<td align="center">'; |
| echo '<a href="'.$PHP_SELF_origvars_ue.$fm_cfg['cgi'].'dir='.$fm_dir_ue.'..">'; |
echo '<a href="'.$PHP_SELF_origvars_ue.$fm_cfg['cgi'].'dir='.$fm_dir_ue.'..">'; |
| echo '<img alt="'._FM_BACK.'" border=0 src="' |
echo '<img alt="'._FM_BACK.'" title="'._FM_BACK.'" border="0" src="' |
| . $fm_cfg['url']['icons'].$fm_cfg['icons']['sys']['UP-DIR'].'"></a>'; |
. $fm_cfg['url']['icons'].$fm_cfg['icons']['sys']['UP-DIR'].'"></a>'; |
| echo '</td>'; |
echo '</td>'; |
| } |
} |
| Line 669 function fm_main() /* {{{ */ |
|
| Line 669 function fm_main() /* {{{ */ |
|
| $entry_he2 = str_replace(' ', ' ', $entry_he); |
$entry_he2 = str_replace(' ', ' ', $entry_he); |
| $entry_ue = htmlspecialchars(rawurlencode($entry)); |
$entry_ue = htmlspecialchars(rawurlencode($entry)); |
| |
|
| echo '<tr valign=middle'; |
echo '<tr valign="middle"'; |
| $line++; |
$line++; |
| if ($line % 2) { |
if ($line % 2) { |
| if (! empty($fm_cfg['color']['odd'])) |
if (! empty($fm_cfg['color']['odd'])) |
| Line 681 function fm_main() /* {{{ */ |
|
| Line 681 function fm_main() /* {{{ */ |
|
| echo '>',"\n"; |
echo '>',"\n"; |
| if ($is_dir) { |
if ($is_dir) { |
| if ($fm_cfg['show']['icons']) { |
if ($fm_cfg['show']['icons']) { |
| echo '<td align=center>'; |
echo '<td align="center">'; |
| if (is_link($entry)) { |
if (is_link($entry)) { |
| echo '<b>~</b>'; |
echo '<b>~</b>'; |
| } else { |
} else { |
| Line 689 function fm_main() /* {{{ */ |
|
| Line 689 function fm_main() /* {{{ */ |
|
| echo '<a href="'.$PHP_SELF_origvars_ue; |
echo '<a href="'.$PHP_SELF_origvars_ue; |
| echo $fm_cfg['cgi'].'dir='.$fm_dir_ue.$entry_ue.'">'; |
echo $fm_cfg['cgi'].'dir='.$fm_dir_ue.$entry_ue.'">'; |
| } |
} |
| echo '<img alt="'._FM_DIR.'" border=0 src="' |
echo '<img alt="'._FM_DIR.'" title="'._FM_DIR.'" border="0" src="' |
| . $fm_cfg['url']['icons'].$fm_cfg['icons']['sys']['DIR'].'">'; |
. $fm_cfg['url']['icons'].$fm_cfg['icons']['sys']['DIR'].'">'; |
| if ($fm_cfg['perm']['dir']['enter']) |
if ($fm_cfg['perm']['dir']['enter']) |
| echo '</a>'; |
echo '</a>'; |
| Line 708 function fm_main() /* {{{ */ |
|
| Line 708 function fm_main() /* {{{ */ |
|
| } |
} |
| } else { |
} else { |
| if ($fm_cfg['show']['icons']) { |
if ($fm_cfg['show']['icons']) { |
| echo '<td align=center>'; |
echo '<td align="center">'; |
| if (is_link($entry)) { |
if (is_link($entry)) { |
| echo '<b>@</b>'; |
echo '<b>@</b>'; |
| } else { |
} else { |
| Line 726 function fm_main() /* {{{ */ |
|
| Line 726 function fm_main() /* {{{ */ |
|
| echo ' '; |
echo ' '; |
| } else { |
} else { |
| if ($fm_cfg['perm']['file']['view']) { |
if ($fm_cfg['perm']['file']['view']) { |
| echo '<a target=_blank href="'.$view_url_prefix_ue.$entry_ue.'">'; |
echo '<a target="_blank" href="'.$view_url_prefix_ue.$entry_ue.'">'; |
| } |
} |
| echo '<img alt="'.$icon_alt.'" border=0 src="' |
echo '<img alt="'.$icon_alt.'" title="'.$icon_alt.'" border="0" src="' |
| . $fm_cfg['url']['icons'].$icon_file.'">'; |
. $fm_cfg['url']['icons'].$icon_file.'">'; |
| if ($fm_cfg['perm']['file']['view']) { |
if ($fm_cfg['perm']['file']['view']) { |
| echo '</a>'; |
echo '</a>'; |
| Line 743 function fm_main() /* {{{ */ |
|
| Line 743 function fm_main() /* {{{ */ |
|
| |
|
| if (! $is_dir) { |
if (! $is_dir) { |
| if ($fm_cfg['show']['size']) { |
if ($fm_cfg['show']['size']) { |
| echo '<td align=right nowrap><small>'; |
echo '<td align="right" nowrap="nowrap"><small>'; |
| $size = @filesize($entry); |
$size = @filesize($entry); |
| if (is_numeric($size)) { |
if (is_numeric($size)) { |
| $unit = 'B'; |
$unit = 'B'; |
| Line 762 function fm_main() /* {{{ */ |
|
| Line 762 function fm_main() /* {{{ */ |
|
| echo '</small></td>',"\n"; |
echo '</small></td>',"\n"; |
| } |
} |
| if ($fm_cfg['show']['date']) { |
if ($fm_cfg['show']['date']) { |
| echo '<td align=center nowrap><small>'; |
echo '<td align="center" nowrap="nowrap"><small>'; |
| echo date($fm_cfg['format']['date'], @filemtime($entry)); |
echo date($fm_cfg['format']['date'], @filemtime($entry)); |
| echo '</small></td>',"\n"; |
echo '</small></td>',"\n"; |
| } |
} |
| Line 791 function fm_main() /* {{{ */ |
|
| Line 791 function fm_main() /* {{{ */ |
|
| if ($view_column) { |
if ($view_column) { |
| echo '<td><small>'; |
echo '<td><small>'; |
| if ($fm_cfg['perm']['file']['view']) { |
if ($fm_cfg['perm']['file']['view']) { |
| echo '[<a target=_blank href="'.$view_url_prefix_ue.$entry_ue.'">' |
echo '[<a target="_blank" href="'.$view_url_prefix_ue.$entry_ue.'">' |
| . _FM_FILE_VIEW.'</a>]'; |
. _FM_FILE_VIEW.'</a>]'; |
| } |
} |
| echo '</small></td>',"\n"; |
echo '</small></td>',"\n"; |
| Line 811 function fm_main() /* {{{ */ |
|
| Line 811 function fm_main() /* {{{ */ |
|
| } |
} |
| } else { |
} else { |
| if ($fm_cfg['show']['size']) { |
if ($fm_cfg['show']['size']) { |
| echo '<td></td>',"\n"; |
echo '<td><small> </small></td>',"\n"; |
| } |
} |
| if ($fm_cfg['show']['date']) { |
if ($fm_cfg['show']['date']) { |
| echo '<td></td>',"\n"; |
echo '<td><small> </small></td>',"\n"; |
| } |
} |
| if ($rename_column) { |
if ($rename_column) { |
| echo '<td><small>'; |
echo '<td><small>'; |