remUser = $interface->getUser(); /*********************Configuration*********************/ // Type of module - popular, downloads, newest $this->modtype = $this->remos_get_module_parm($params,'modtype','newest'); // Type of output - list of files or RSS link $this->listtype = $this->remos_get_module_parm($params,'listtype','list'); // Set to 1 to show container, set to 0 to omit $this->showcat = $this->remos_get_module_parm($params,'showcat',0); // Set to 1 to show the file thumbnail (if any), set to 0 to not show thumbnail $this->showthumb = $this->remos_get_module_parm($params,'showthumb',0); // Set to 1 to show the file version (if any), set to 0 to not show version $this->showversion = $this->remos_get_module_parm($params,'showversion',0); // Set to non zero pixel size to show file icon, 0 to not show $this->iconsize = $this->remos_get_module_parm($params,'iconsize',16); // Set to non zero pixel size to show date icon, 0 to not show $this->diconsize = $this->remos_get_module_parm($params,'diconsize',16); // Set to 1 to show the date, set to 0 to not show date $this->showdate = $this->remos_get_module_parm($params,'showdate',0); // Set to 1 to show the number of downloads, set to 0 to not show downloads $this->showdownloads = $this->remos_get_module_parm($params,'showdownloads',0); // Max number of entries to show $this->max = $this->remos_get_module_parm($params,'max',5 ); // Max number of description characters, 0 for no description $this->maxchars = $this->remos_get_module_parm($params,'maxchars',100); // Date format for display, 'none' if no display required $this->date_format = $this->remos_get_module_parm($params,'dateformat','%b.%g'); // Category from which to select files $this->category = $this->remos_get_module_parm($params,'category', 0); // if (!$this->category) $this->showcat = 0; // Maximum number of days to consider where log file is used $this->days = $this->remos_get_module_parm($params, 'days', 30); $this->max = max($this->max,1); /*******************************************************/ if ($this->listtype == 'list') { switch ($this->modtype) { case 'random': $files = remositoryFile::randomFiles ($this->category, $this->max, $this->remUser); break; case 'popular': $files = remositoryFile::popularLoggedFiles ($this->category, $this->max, $this->days, $this->remUser); break; case 'download': $files = remositoryFile::popularDownloadedFiles ($this->category, $this->max, $this->remUser); break; case 'newest': default: $files = remositoryFile::newestFiles ($this->category, $this->max, $this->remUser); } foreach ($files as $file) $this->displayFile($file); } else $this->displayRSS(); $content = $this->html; } private function displayFile ($file) { $repository = remositoryRepository::getInstance(); if ($this->showcat) $caturl = $repository->RemositoryFunctionURL('select', $file->containerid); if ($this->iconsize) { if ($file->icon) $icon = $file->icon; else $icon = 'generic.png'; $iconurl = $repository->RemositoryImageURL('file_icons/'.$icon, $this->iconsize, $this->iconsize); } else $iconurl = ''; if ($this->showthumb) $thumbnails = new remositoryThumbnails($file); if (strtolower($this->date_format) != 'none') { if ($this->diconsize) $dateurl = $repository->RemositoryImageURL('calendar.gif', $this->diconsize, $this->diconsize); else $dateurl = ''; $time = strtotime($file->filedate); if ($repository->Set_date_locale) setlocale(LC_TIME, $repository->Set_date_locale); $datetext = strftime($this->date_format, $time); } if ($this->maxchars) { if (strlen($file->smalldesc) > $this->maxchars-3) $desc = substr($file->smalldesc,0,$this->maxchars-3).'...'; else $desc = $file->smalldesc; } $link = $repository->RemositoryFunctionURL('fileinfo', $file->id); $ampencode = '/(&(?!(#[0-9]{1,5};))(?!([0-9a-zA-Z]{1,10};)))/'; $link = preg_replace($ampencode, '&', $link); $this->html .= "\n
$desc
"; $this->html .= "\n