--- docman.php 2000/08/04 10:07:04 1.6 +++ docman.php 2000/08/04 10:43:23 1.9 @@ -65,9 +65,7 @@ TODO: mixed file/directory output (add type to each entry, real support for links) - add more content-management (like cms.sourceforge.net): - check-out/check-in/reserve - comments to files + retrieve old versions of files (overwritten) */ ////////////////////////////////////////////////////////////////// @@ -194,7 +192,7 @@


- +

" ; - echo htmlentities($tstr) . "

" . $tstr ; +// echo htmlentities($tstr) . "

" . $tstr ; + echo $tstr ; } ?> @@ -848,8 +848,7 @@ - OR UPLOAD A FILE + OR UPLOAD A FILE @@ -1070,6 +1069,23 @@ ////////////////////////////////////////////////////////////////// +function urlpath($url) { + $url=urlencode(StripSlashes("$url")); + $url=str_replace("%2F","/",$url); + $url=str_replace("+","%20",$url); + return($url); +} + +////////////////////////////////////////////////////////////////// + +function safe_rename($from,$to) { + if (file_exists($from) && is_writable(dirname($to))) { + rename($from,$to); + } +} + +////////////////////////////////////////////////////////////////// + // MAIN PROGRAM // ============ // query parameters: capital letters @@ -1267,10 +1283,10 @@ if ( $CONFIRM != "on" ) break ; Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); - rename("$fsDir/$FN","$fsDir/$NEWNAME"); - rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME"); - rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME"); - rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME"); + safe_rename("$fsDir/$FN","$fsDir/$NEWNAME"); + safe_rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME"); + safe_rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME"); + safe_rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME"); break ; @@ -1325,8 +1341,7 @@ case "Co" : // checkout Lock("$gblFsRoot/$relDir/$F"); - $url="$relDir/$F"; $url=str_replace(" ","%20",$url); - Header("Location: $url"); + Header("Location: ".urlpath("$relDir/$F")); exit; case "Ci" : // upload && update to $relDir @@ -1340,9 +1355,8 @@ exit ; case "V" : // view - Log("viewed"); - $url="$relDir/$F"; $url=str_replace(" ","%20",$url); - Header("Location: $url"); + LogIt("$gblFsRoot/$relDir/$F","viewed"); + Header("Location: ".urlpath("$relDir/$F")); exit; }