65 |
TODO: |
TODO: |
66 |
mixed file/directory output (add type to each entry, |
mixed file/directory output (add type to each entry, |
67 |
real support for links) |
real support for links) |
68 |
add more content-management (like cms.sourceforge.net): |
retrieve old versions of files (overwritten) |
69 |
check-out/check-in/reserve |
show last lock date |
70 |
comments to files |
|
71 |
*/ |
*/ |
72 |
|
|
73 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
108 |
if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) { |
if ($user[0] == $GLOBALS["PHP_AUTH_USER"]) { |
109 |
$gblUserName=$user[1]; |
$gblUserName=$user[1]; |
110 |
$gblPw=$user[2]; |
$gblPw=$user[2]; |
111 |
|
$gblEmail=$user[3]; |
112 |
continue ; |
continue ; |
113 |
} |
} |
114 |
} |
} |
121 |
$gblDateFmt="Y-m-d"; |
$gblDateFmt="Y-m-d"; |
122 |
$gblTimeFmt="H:i:s"; |
$gblTimeFmt="H:i:s"; |
123 |
|
|
124 |
// Number of backup files to keep |
// Number of backup files to keep |
125 |
$gblNumBackups=5; |
$gblNumBackups=3; |
126 |
|
|
127 |
|
// show red star if newer than ... days |
128 |
|
$gblModDays=1; |
129 |
|
|
130 |
// choose GifIcon below unless you have the M$ |
// choose GifIcon below unless you have the M$ |
131 |
// WingDings font installed on your system |
// WingDings font installed on your system |
198 |
</small> |
</small> |
199 |
</P> |
</P> |
200 |
<BR> |
<BR> |
201 |
<? include(".debug.inc") ?> |
<? //include(".debug.inc") ?> |
202 |
<BR><BR></BODY></HTML> |
<BR><BR></BODY></HTML> |
203 |
|
|
204 |
<?php |
<?php |
298 |
</FORM> |
</FORM> |
299 |
|
|
300 |
<?php |
<?php |
301 |
} else if ( strstr( join(" ",$gblImages), $ext ) ) { |
} |
302 |
|
if ( !$file_lock && $ext!="" && strstr(join(' ',$gblImages),$ext) ) { |
303 |
$info = getimagesize($fsPath) ; |
$info = getimagesize($fsPath) ; |
304 |
$tstr = "<IMG SRC=\"". $relPath . "\" BORDER=0 " ; |
$tstr = "<IMG SRC=\"".urlpath($relPath)."\" BORDER=0 " ; |
305 |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
$tstr .= $info[3] . " ALT=\"" . $fn . " - " ; |
306 |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
$tstr .= (int)(($fsize+1023)/1024) . "Kb\">" ; |
307 |
echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
// echo htmlentities($tstr) . "<BR><BR>" . $tstr ; |
308 |
|
echo $tstr ; |
309 |
} |
} |
310 |
|
|
311 |
?> |
?> |
368 |
|
|
369 |
<?php |
<?php |
370 |
|
|
371 |
|
$name=basename("$fsDir/$fn"); |
372 |
$logname=dirname("$fsDir/$fn")."/.log/".basename("$fsDir/$fn"); |
$logname=dirname("$fsDir/$fn")."/.log/$name"; |
373 |
|
$bakdir=dirname("$fsDir/$fn")."/.bak"; |
374 |
if (file_exists($logname)) { |
if (file_exists($logname)) { |
|
print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n"; |
|
375 |
$log=fopen($logname,"r"); |
$log=fopen($logname,"r"); |
376 |
$cl1=" class=lst"; $cl2=""; |
$cl1=" class=lst"; $cl2=""; |
377 |
|
$logarr = array(); |
378 |
while($line = fgetcsv($log,255,"\t")) { |
while($line = fgetcsv($log,255,"\t")) { |
379 |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
$cl=$cl1; $cl1=$cl2; $cl2=$cl; |
380 |
print "<tr><td$cl>$line[0]</td><td$cl>$line[1]</td><td$cl>$line[2]</td><td$cl>$line[3]</td></tr>\n"; |
array_unshift($logarr,array($cl,$line[0],$line[1],$line[2],$line[3])); |
381 |
} |
} |
382 |
fclose($log); |
fclose($log); |
383 |
|
print "<hr><br><b>CHANGES TO THIS FILE</b><br><table border=0 width=100%>\n"; |
384 |
|
$bakcount = 0; // start from 0, skip fist backup (it's current) |
385 |
|
while ($e = array_shift($logarr)) { |
386 |
|
if (strstr($e[4],"upload")) { |
387 |
|
if (file_exists("$bakdir/$bakcount/$name")) { |
388 |
|
$e[4]="<a href=\"".dirname($relPath)."/.bak/$bakcount/$name\">$e[4]</a>"; |
389 |
|
} |
390 |
|
$bakcount++; |
391 |
|
} |
392 |
|
print "<tr><td$e[0]>$e[1]</td><td$e[0]>$e[2]</td><td$e[0]>$e[3]</td><td$e[0]>$e[4]</td></tr>\n"; |
393 |
|
} |
394 |
print "</table>"; |
print "</table>"; |
395 |
} |
} |
396 |
|
|
646 |
|
|
647 |
function Navigate($fsRoot,$relDir) { |
function Navigate($fsRoot,$relDir) { |
648 |
|
|
649 |
global $gblEditable, $gblIcon ; |
global $gblEditable, $gblIcon, $gblModDays ; |
650 |
|
|
651 |
$self = $GLOBALS["PHP_SELF"] ; |
$self = $GLOBALS["PHP_SELF"] ; |
652 |
if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") { |
if (isset($GLOBALS["HTTPS"]) && $GLOBALS["HTTPS"] == "on") { |
761 |
|
|
762 |
$info_url=$self."?A=E&F=".urlencode($file)."&D=".urlencode($relDir); |
$info_url=$self."?A=E&F=".urlencode($file)."&D=".urlencode($relDir); |
763 |
|
|
764 |
if ( ($mod + 30*86400) > time() ) { |
if ( ($mod + $gblModDays*86400) > time() ) { |
765 |
$a = "<SPAN CLASS=RED TITLE=\"Newer" ; |
$a = "<SPAN CLASS=RED TITLE=\"Newer" ; |
766 |
$a .= " than 30 days\"> * </SPAN>" ; |
$a .= " than $gblModDays days\"> * </SPAN>" ; |
767 |
} |
} |
768 |
|
|
769 |
$file_lock=CheckLock($path); |
$file_lock=CheckLock($path); |
849 |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
850 |
|
|
851 |
<TR><TD></TD><TD COLSPAN=5> |
<TR><TD></TD><TD COLSPAN=5> |
852 |
To just view file without editing, select it's filename (<b>don't edit files which are opened this way!</b>)<br> |
<? |
853 |
To <b>edit</b> file select <?= $gblIcon("checkout") ?> to check-out |
if (file_exists(".info.inc")) { |
854 |
and edit it locally. After editing is over, select filename or <?= $gblIcon("checkin") ?> to check-in (update copy of file on server).<br> |
include(".info.inc"); |
855 |
<by>If you select icon left from filename, you will get detailed information |
} |
856 |
about file, as well as delete, rename and annotation options. |
?> |
857 |
</TD></TR> |
</TD></TR> |
858 |
|
|
859 |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
<TR><TD></TD><TD COLSPAN=5><HR></TD></TR> |
866 |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE"> |
<INPUT TYPE="HIDDEN" NAME="POSTACTION" VALUE="CREATE"> |
867 |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
<INPUT TYPE="HIDDEN" NAME="DIR" VALUE="<?= $relDir ?>"> |
868 |
<INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR> |
<INPUT TYPE="SUBMIT" VALUE="CREATE"></NOBR> |
869 |
<NOBR>OR <A HREF="<?= $self |
<NOBR>OR <A HREF="<?= $self ?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE |
|
?>?A=U&D=<?= urlencode($relDir) ?>">UPLOAD</A> A FILE |
|
870 |
</NOBR> |
</NOBR> |
871 |
</TD></TR> |
</TD></TR> |
872 |
</FORM> |
</FORM> |
1087 |
|
|
1088 |
////////////////////////////////////////////////////////////////// |
////////////////////////////////////////////////////////////////// |
1089 |
|
|
1090 |
|
function urlpath($url) { |
1091 |
|
$url=urlencode(StripSlashes("$url")); |
1092 |
|
$url=str_replace("%2F","/",$url); |
1093 |
|
$url=str_replace("+","%20",$url); |
1094 |
|
return($url); |
1095 |
|
} |
1096 |
|
|
1097 |
|
////////////////////////////////////////////////////////////////// |
1098 |
|
|
1099 |
|
function safe_rename($from,$to) { |
1100 |
|
if (file_exists($from) && is_writable(dirname($to))) { |
1101 |
|
rename($from,$to); |
1102 |
|
} |
1103 |
|
} |
1104 |
|
|
1105 |
|
////////////////////////////////////////////////////////////////// |
1106 |
|
|
1107 |
|
// recursivly delete directory |
1108 |
|
|
1109 |
|
function rrmdir($dir) { |
1110 |
|
$handle=opendir($dir); |
1111 |
|
while ($file = readdir($handle)) { |
1112 |
|
if ($file != "." && $file != "..") { |
1113 |
|
if (is_dir("$dir/$file")) |
1114 |
|
rrmdir("$dir/$file"); |
1115 |
|
else |
1116 |
|
if (! @unlink("$dir/$file")) return(0); |
1117 |
|
} |
1118 |
|
} |
1119 |
|
closedir($handle); |
1120 |
|
return @rmdir($dir); |
1121 |
|
} |
1122 |
|
|
1123 |
|
////////////////////////////////////////////////////////////////// |
1124 |
|
|
1125 |
// MAIN PROGRAM |
// MAIN PROGRAM |
1126 |
// ============ |
// ============ |
1127 |
// query parameters: capital letters |
// query parameters: capital letters |
1218 |
break ; |
break ; |
1219 |
|
|
1220 |
case "SAVE" : |
case "SAVE" : |
1221 |
$path = $gblFsRoot . escapeshellcmd($RELPATH) ; |
$path = $gblFsRoot . $RELPATH ; |
1222 |
$writable = is_writeable($path) ; |
$writable = is_writeable($path) ; |
1223 |
$legaldir = is_writeable(dirname($path)) ; |
$legaldir = is_writeable(dirname($path)) ; |
1224 |
$exists = (file_exists($path)) ? 1 : 0 ; |
$exists = (file_exists($path)) ? 1 : 0 ; |
1292 |
} |
} |
1293 |
} |
} |
1294 |
else { // delete directory |
else { // delete directory |
1295 |
if ( ! @rmdir($fsDir) ) { |
if ( ! @rrmdir($fsDir) ) { |
1296 |
Error("Rmdir failed", $tstr . $fsDir) ; |
Error("Rmdir failed", $tstr . $fsDir) ; |
1297 |
} |
} |
1298 |
else { |
else { |
1319 |
if ( $CONFIRM != "on" ) break ; |
if ( $CONFIRM != "on" ) break ; |
1320 |
|
|
1321 |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
Logit("$fsDir/$FN","renamed $FN to $NEWNAME"); |
1322 |
rename("$fsDir/$FN","$fsDir/$NEWNAME"); |
safe_rename("$fsDir/$FN","$fsDir/$NEWNAME"); |
1323 |
rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME"); |
safe_rename("$fsDir/.log/$FN","$fsDir/.log/$NEWNAME"); |
1324 |
rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME"); |
safe_rename("$fsDir/.note/$FN","$fsDir/.note/$NEWNAME"); |
1325 |
rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME"); |
safe_rename("$fsDir/.lock/$FN","$fsDir/.lock/$NEWNAME"); |
1326 |
|
for($i=0;$i<=$GLOBALS[gblNumBackups];$i++) { |
1327 |
|
safe_rename("$fsDir/.bak/$i/$FN","$fsDir/.bak/$i/$NEWNAME"); |
1328 |
|
} |
1329 |
|
|
1330 |
break ; |
break ; |
1331 |
|
|
1380 |
case "Co" : |
case "Co" : |
1381 |
// checkout |
// checkout |
1382 |
Lock("$gblFsRoot/$relDir/$F"); |
Lock("$gblFsRoot/$relDir/$F"); |
1383 |
$url="$relDir/$F"; $url=str_replace(" ","%20",$url); |
header("Content-Disposition: attachment; filename=$F" ); |
1384 |
Header("Location: $url"); |
Header("Location: ".urlpath("$relDir/$F")); |
1385 |
exit; |
exit; |
1386 |
case "Ci" : |
case "Ci" : |
1387 |
// upload && update to $relDir |
// upload && update to $relDir |
1395 |
exit ; |
exit ; |
1396 |
case "V" : |
case "V" : |
1397 |
// view |
// view |
1398 |
Log("viewed"); |
LogIt("$gblFsRoot/$relDir/$F","viewed"); |
1399 |
$url="$relDir/$F"; $url=str_replace(" ","%20",$url); |
header("Content-Disposition: attachment; filename=$F" ); |
1400 |
Header("Location: $url"); |
Header("Location: ".urlpath("$relDir/$F")); |
1401 |
exit; |
exit; |
1402 |
} |
} |
1403 |
|
|