Comparing revisions for FileView

Additions:
>>{{lastedit}}>>fileview.php action:
(Not recomended for large directories or files tested on FreeBSD, Apache Server. I don't know what windows would do ##leave comment##)
Please comment if you find this action helpful It is my first "published" code and I would love to hear back from the community
KNOWN BUGS: file names with spaces ie. "This windows file.zip" will not link correctly.
Table formatting (css) obstructs other objects in Wikka - working on a fix
<style type="text/css">
</style>
$md5checksum_on = 1; /* calculate md5 checksums (1 = yes | 0 = no) */
/* Taken from WikkaWakka actions/files.php */
/* End of borrowed Code */
echo "<tr class=\"fv\" ><th class=\"fv\" scope=\"col\"> </th><th class=\"fv\" scope=\"col\">File</th><th class=\"fv\" scope=\"col\">Size</th><th class=\"fv\" scope=\"col\">Modified</th>";
if ($md5checksum_on == 1) echo "<th class=\"fv\" scope=\"col\">md5 Checksum</th></tr>\n"; else echo "</tr>\n";
echo '<td class="fv" id="nm"><a href='."$filename>$filedesc</a>";
echo "<td class=\"fv\" id=\"sz\">".bytesToHumanReadableUsage(filesize($filename))."</td>";
echo "<td class=\"fv\" id=\"mf\">".date ("m/d/Y", filemtime($filename))."</td>";
if ($md5checksum_on == 1) echo "<td class=\"fv\" id=\"cd\">".md5_file($filename)."</td>";
echo "</table>";
Deletions:
>>Download the latest [[http://www.paranoidpress.com/files/fileview.zip Version]] Updated: July 24, 2006
{{lastedit}}>>fileview.php action:
(Not recomended for large directories or files.)
Tested on FreeBSD, Apache Server. I don't know what windows would do ##leave comment##
Please comment if you find this action helpful It is my first "published" code and I would love to hear back from the community.
#
# Displays a table of specified files from a local directory.
#
# *** SECURITY NOTICE ***
# Currently this script has the ability to show ANY file on the local system
# I am working on a fix. I believe that a fix could be made that would only
# show files in the ./uploads/UserName/directory I just have to write it.
#
# Credit:
# This action is derived from a script I wrote to display downloads for php-nuke
# Credit should be given to the author of the files action for the funtion
# bytesToHumanReadableUsage (see below)
#
# @package Actions
# @name FileView
#
# @author {@link http://wikkawiki.org/SmaugDragon SmaugDragon}
# @version 0.9
# @since Wikka 1.1.6.0
#
# @input Url $location optional: the url of the files you want displayed.
#
# wildcards work fine ie.
#
# uploads /*/*.* all files in all directories under uploads
# uploads/ps_*.jpg all jpg files in uploads with names starting with ps_
#
# @Other Settings on|off $md5checksum_on off by default set to 1 for md5 checksum of files or 0 for off
#
# @todo 1.) Restrict which files a user can show
# 2.) I have to make files download instead of displaying that should fix 90% of my security worries.
#
/* CSS Info */
echo '<style type="text/css">
</style>';
$md5checksum_on = 0; /* calculate md5 checksums (1 = yes | 0 = no) */
/* Taken from WikkaWakka actions/files.php */
/* End of borrowed Code */
/* Comment the next 2 lines to remove the table header.*/
echo '<tr class="fv"><th class="fv" scope="col"> </th><th class="fv" scope="col">File</th><th class="fv" scope="col">Size</th><th class="fv" scope="col">Modified</th>';
if ($md5checksum_on == 1) echo '<th class="fv" scope="col">md5 Checksum</th></tr>'."\n"; else echo "</tr>\n";
echo '<td class="fv" id="nm"><a href='.str_replace(" ", "%20", $filename).">$filedesc</a>";
echo '<td class="fv" id="sz">'.bytesToHumanReadableUsage(filesize($filename)).'</td>';
echo '<td class="fv" id="mf">'.date ("m/d/Y", filemtime($filename)).'</td>';
if ($md5checksum_on == 1) echo '<td class="fv" id="cd">'.md5_file($filename).'</td>';
echo '</table>';
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki