| version 1.37, 2003/02/11 20:04:21 |
version 1.38, 2003/02/12 19:35:16 |
|
|
| * http://www.platon.sk/projects/phpWebFileManager/ |
* http://www.platon.sk/projects/phpWebFileManager/ |
| */ |
*/ |
| |
|
| /* $Platon: phpWebFileManager/index.php,v 1.36 2003/02/04 21:52:54 nepto Exp $ */ |
/* $Platon: phpWebFileManager/index.php,v 1.37 2003/02/11 20:04:21 nepto Exp $ */ |
| |
|
| /* |
/* |
| * phpWebFileManager initialization |
* phpWebFileManager initialization |
| Line 47 if (! function_exists('fm_header')) { |
|
| Line 47 if (! function_exists('fm_header')) { |
|
| extract($var_ar); |
extract($var_ar); |
| $message = htmlspecialchars(join("\n", $fm_action_message)); |
$message = htmlspecialchars(join("\n", $fm_action_message)); |
| if (defined('LOADED_AS_MODULE')) { |
if (defined('LOADED_AS_MODULE')) { |
| if (strlen($message) > 0) { |
|
| $message = ' '.$message; |
|
| } |
|
| OpenTable(); |
OpenTable(); |
| echo '<font class="pn-title">',_FM_FILE_MANAGER, |
echo '<font class="pn-title">',_FM_FILE_MANAGER, |
| (strlen($fm_dir) > 0 ? ": $fm_dir_he" : ''), |
(strlen($fm_dir) > 0 ? ": $fm_dir_he" : ''), |
| '</font>', $message; |
'</font></td><td align="right">', $message; |
| |
|
| CloseTable(); |
CloseTable(); |
| OpenTable(); |
OpenTable(); |
| } else { |
} else { |
| Line 77 if (! function_exists('fm_footer')) { |
|
| Line 73 if (! function_exists('fm_footer')) { |
|
| OpenTable(); |
OpenTable(); |
| } else { |
} else { |
| echo '<hr>',"\n"; |
echo '<hr>',"\n"; |
| |
echo '<table cellpadding="0" cellspacing="0" border="0" width="100%"><tr>'; |
| |
echo '<td align="left"><b>', _FM_DIR, ':</b> /', @$fm_dir_he2, '</td>'; |
| |
echo '<td align="right">'; |
| } |
} |
| if ($fm_cfg['perm']['dir']['create']) { |
if ($fm_cfg['perm']['dir']['create']) { |
| echo '<a href="'.$PHP_SELF_origvars_ue |
echo '<a href="'.$PHP_SELF_origvars_ue |
| Line 107 if (! function_exists('fm_footer')) { |
|
| Line 106 if (! function_exists('fm_footer')) { |
|
| if (defined('LOADED_AS_MODULE')) { |
if (defined('LOADED_AS_MODULE')) { |
| CloseTable(); |
CloseTable(); |
| include 'footer.php'; |
include 'footer.php'; |
| |
} else { |
| |
echo "\n", '</td></tr></table>', "\n"; |
| } |
} |
| } /* }}} */ |
} /* }}} */ |
| } |
} |
| Line 377 function fm_main() /* {{{ */ |
|
| Line 378 function fm_main() /* {{{ */ |
|
| /* |
/* |
| * file edit action |
* file edit action |
| */ |
*/ |
| if ($fm_action == 'edit_file' && $fm_cfg['perm']['file']['edit']) { /* {{{ */ |
if (in_array($fm_action, array('confirm_edit_file', 'edit_file')) /* {{{ */ |
| |
&& $fm_cfg['perm']['file']['edit']) { |
| if (is_readable($fm_filename) && is_writeable($fm_filename)) { |
if (is_readable($fm_filename) && is_writeable($fm_filename)) { |
| if ($fm_submit == _FM_FILE_EDIT) { |
if ($fm_action == 'confirm_edit_file' || $fm_submit == _FM_FILE_EDIT) { |
| // will display edit dialog |
// will display edit dialog |
| } else { |
} else { |
| $action_message[] = _FM_CANCELED; |
$action_message[] = _FM_CANCELED; |
| Line 399 function fm_main() /* {{{ */ |
|
| Line 401 function fm_main() /* {{{ */ |
|
| 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); |
| |
|
| /* PN: PostNuke module calls */ |
|
| if (defined('LOADED_AS_MODULE')) { |
|
| echo '<input type=hidden name="op" value="modload">'."\n"; |
|
| echo '<input type=hidden name="name" value="'.$ModName.'">'."\n"; |
|
| echo '<input type=hidden name="file" value="index">'."\n"; |
|
| } |
|
| |
|
| /* |
/* |
| * Variable array |
* Variable array |
| */ |
*/ |
| Line 502 function fm_main() /* {{{ */ |
|
| Line 497 function fm_main() /* {{{ */ |
|
| * confirm edit file and edit file form |
* confirm edit file and edit file form |
| */ |
*/ |
| case 'confirm_edit_file': |
case 'confirm_edit_file': |
| // TODO: |
if (count($action_message) <= 0) { |
| // 1. check file type - if binary, ask if really edit |
// Two file checks: |
| // 2. check file size - if too big, ask if really edit |
// 1. File size check - if too big, ask if really edit |
| echo '<input type=hidden value="edit_file" name="'.$fm_cfg['cgi'].'action">'; |
// 2. File content check - if looks binary, ask if really edit |
| echo _FM_REALLY_EDIT |
$max_size = 10 * 1024; |
| . '<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
if (($size = @filesize($fm_filename)) > $max_size) { |
| echo $fm_dir == '' |
$file_edit_delayed = 1; |
| ? _FM_IN_ROOT_DIR . '?<br><br>' |
} else { |
| : _FM_IN_DIR . '<br><br><i>'.$fm_dir_he2.'</i><br><br>'; |
if (! is_resource($fp = @fopen($fm_filename, 'r'))) { |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'._FM_FILE_EDIT.'"> '; |
$file_edit_delayed = 1; |
| echo '<input type=submit name="'.$fm_cfg['cgi'].'submit" value="'._FM_CANCEL.'">'; |
} else { |
| break; |
$tmp_buf = @fread($fp, $max_size); |
| |
@fclose($fp); |
| |
if (! is_string($tmp_buf)) { |
| |
$file_edit_delayed = 1; |
| |
} else { |
| |
$tmp_buf = @preg_replace('|[^\x00-\x1f]|', '', $tmp_buf); |
| |
$tmp_buf = @preg_replace("|[\n\r\t]|", '', $tmp_buf); |
| |
$file_edit_delayed = @strlen($tmp_buf) > 0; |
| |
} |
| |
unset($tmp_buf); |
| |
} |
| |
} |
| |
if ($file_edit_delayed) { |
| |
echo '<input type=hidden value="edit_file" name="'.$fm_cfg['cgi'].'action">'; |
| |
echo _FM_REALLY_EDIT |
| |
. '<br><br><i>'.$fm_filename_he2.'</i><br><br>'; |
| |
echo $fm_dir == '' |
| |
? _FM_IN_ROOT_DIR . '?<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_CANCEL.'">'; |
| |
break; |
| |
} |
| |
} |
| case 'edit_file': |
case 'edit_file': |
| if (is_readable($fm_filename) && is_writeable($fm_filename) && $fm_submit == _FM_FILE_EDIT) { |
if (count($action_message) <= 0) { |
| 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>'; |