Revision [16739]

This is an old revision of ListfilesAction made by XdnVsx on 2007-05-31 10:43:15.


Listfiles Action

This is the development page for the Listfiles action.

This is another (complete) transformation of the files action from Mod015fFilesAction (check also the FilesManagementHandler).
It allows to get the links to the attached files but not to upload nor to delete any.


This relies of the WikkaBugsResolved ExistsPage function developed by JavaWoman and part of release You can find this version at WikkaBugsResolved under the heading "check of user-names against page-names"..

The code

* PARAMETERS Interface *
$uPage = $vars['page'];
if ($uPage) $page = $uPage;
else $page = $this->GetPageTag();

$uFile = $vars['file'];
if ($uFile) $file = $uFile;

it is not useful to provide a title if there is no file parameter
if ($file) {
$uTitle = $vars['title'];
if ($uTitle) $title = $uTitle;
* End PARAMETERS Interface *

check if the page exists (the function exists from wikka
if ($this->ExistsPage($page)) {
check if the user is allowed to read
if ($this->HasAccess('read', $page)) {
upload path
$upload_path = $this->config['upload_path'].'/'.$page;
check if the upload path does not exist
if(is_dir($upload_path) ){
$handle = opendir($upload_path);
while( (gettype( $name = readdir($handle)) != "boolean")){
$name_array[] = $name;
foreach($name_array as $temp) $folder_content .= $temp;
print "<div class=\."emptylist\.">"; the upload path is empty
print "There are no files attached to this page.";
} else {
uploaded files
$dir = opendir($upload_path);
if a file parameter has been provided
if ($file) {
$pathandfile = $upload_path."/".urlencode($file);
if (file_exists($pathandfile)) {
print "<div class=\."singlelist\.">"; only one file to list
if ($title) $thetitle = $title;
else $thetitle = $file;
$download_link = "<a href=\.$pathandfile."\">".$thetitle.""; print $download_link; } else { print "
."errorlist\.">"; print "The file (".$file.") does not exist on this page (".$page.")."; } } // all files have to be listed else { print "
."fulllist\"".">"; the upload path contains attachements
while ($file = readdir($dir)) {
if ($file != '.'
There are 6 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki