function preview($format = "Show", $page = -1, $pageurl = "") { $myts =& MyTextSanitizer::getInstance(); global $xoopsDB, $xoopsConfig, $xoopsModule, $xoopsUser, $popular, $groupid, $wfsConfig; $datetime = formatTimestamp(time(), $wfsConfig['timestamp']); $counter = 0; global $xoopsUser, $xoopsConfig, $wfsConfig; if ($this->uid > 0) { $user = new xoopsUser($this->uid); if ($wfsConfig['realname'] && $user->getvar('name')) { $poster = $user->getvar('name'); } else { $poster = $user->getvar('uname'); } $poster = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $this->uid() . "'>" . $poster . "</a>"; } else { $poster = $GLOBALS['xoopsConfig']['anonymous']; } // $datetime if (isset($this->published)) { $datetime = formatTimestamp($this->published, "{$wfsConfig['timestamp']}"); } // $title $title = $this->category->textLink() . ": "; $title .= $this->title(); //Counter if (isset($this->counter)) { $counter = $this->counter; } $pagenum = $this->maintextPages() - 1; if ($page > $pagenum) { $page = $pagenum; } $maintext = ""; if ($page == -2) { $page = 0; } if ($this->maintextFlag) { $maintext .= $this->maintextWithFile("P", $page); } else { $maintext .= $this->maintextWithFile("S", $page); } // Setup URL link for article $urllink = ''; if ($this->url && !$this->urlname) { $urllink = "<a href='" . $this->url() . "' target='_blank'>Url Link: " . $this->url() . "</a><br />"; } if ($this->urlname) { $urllink .= "<a href='" . $this->url() . "' target='_blank'>Url Link: " . $this->urlname() . "</a><br />"; } //maintext for articles //$maintext = $this->maintext; //Downloads links $workdir = XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath']; $downloadlink = "<table width='100%' cellspacing='1' cellpadding='2'>"; if (isset($this->articleid) && $this->getFilesCount() > 0) { $downloadlink .= "<tr><td >"; if ($format == "Show") { $downloadlink .= "<tr><td colspan='2' class='itemHead' align='left'><b>" . _WFS_DOWNLOADS . " {$this->title}</b></td></tr>"; } else { $downloadlink .= "<tr><td colspan='2' class='bg3' align='left'><b>" . _WFS_DOWNLOADS . " {$this->title}</b></td></tr>"; } foreach ($this->files as $file) { $filename = $file->getFileRealName(); $mimetype = new mimetype(); $icon = get_icon($workdir . "/" . $filename); $size = filesize(XOOPS_ROOT_PATH . "/" . $wfsConfig['filesbasepath'] . "/" . $filename); if (empty($size)) { $size = '0'; } $downloadlink .= "<tr><td valign ='middle' height='10' width='50%' class='even'><img src=" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/icon/" . $icon . " align='middle'> : " . $file->getLinkedName(XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/download.php?fileid=") . ""; $downloadlink .= "<br /><a href='brokenfile.php?lid={$file->fileid}'><div align = right><span class='comUserStat'></b>[" . _WFS_REPORTBROKEN . "]</span></div></a>"; $downloadlink .= "</td>"; $downloadlink .= "<td width='50%' class='even' align='left' valign='top'><b>" . _WFS_DESCRIPTION . ":</b><br>" . $file->getFiledescript('S') . "</td>"; $downloadlink .= "</tr>"; $downloadlink .= "<tr><td class='odd' align='right' width='50%'>"; $downloadlink .= "" . _WFS_FILETYPE . "" . $mimetype->getType($workdir . "/" . $filename) . ""; $downloadlink .= "</td>"; $downloadlink .= "<td class='odd' align='right' width='50%'>"; $downloadlink .= "<img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/counter.gif' border='0' alt='downloads' align='absmiddle'/>"; $downloadlink .= " " . $file->getCounter() . " <img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/size.gif' border='0' align='absmiddle' alt='" . _WFS_FILESIZE . "' />"; $downloadlink .= " " . PrettySize($size) . "</a>"; $downloadlink .= "</td></tr>"; } $downloadlink .= "</td></tr>"; $downloadlink .= "</table><br>"; } $imglink = ""; $adminlink = " "; $pagelink = ""; //Show page numbers if page > 0 if ($page != -1 && $pagenum) { $pagelink .= "Page: "; for ($i = 0; $i <= $pagenum; $i++) { if ($page == $i) { $pagelink .= "<a href='" . $pageurl . $i . "'><span style='color:#ee0000;font-weight:bold;'>" . ($i + 1) . "</span></a> "; } else { $pagelink .= "<a href='" . $pageurl . $i . "'>" . ($i + 1) . "</a> "; } } $title .= " (" . ($page + 1) . "/" . ($pagenum + 1) . ")"; } if ($xoopsUser && $format == "Show") { if ($xoopsUser->isAdmin($xoopsModule->mid())) { $adminlink = " [ <a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/index.php?op=edit&articleid=" . $this->articleid . "'>" . _EDIT . "</a> | <a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/index.php?op=delete&articleid=" . $this->articleid . "'>" . _DELETE . "</a> ] "; } } $maillink = "<a href='print.php?articleid=" . $this->articleid . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/print.gif' alt='" . _WFS_PRINTERFRIENDLY . "' /></a> "; $maillink .= "<a target='_top' href='mailto:?subject=" . rawurlencode(sprintf(_WFS_INTFILEAT, $xoopsConfig['sitename'])) . "&body=" . rawurlencode(sprintf(_WFS_INTFILEFOUND, $xoopsConfig['sitename']) . ": " . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/index.php?articleid=" . $this->articleid) . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/friend.gif' alt='" . _WFS_TELLAFRIEND . "' /></a>"; $ratethisfile = "<a href='ratefile.php?lid=" . $this->articleid . "'>" . _WFS_RATETHISFILE . "</a>"; $catlink = "<a href='./index.php?category=" . $this->categoryid() . "'>" . _WFS_BACK2CAT . "</a><b> | </b><a href='./index.php'>" . _WFS_RETURN2INDEX . "</a>"; $rating = "<b>" . sprintf(_WFS_RATINGA, number_format($this->rating, 2)) . "</b>"; $votes = "<b>(" . sprintf(_WFS_NUMVOTES, $this->votes) . ")</b>"; $fullcount = format_size(strlen($maintext)); if ($this->ishtml == '1' && $this->htmlpage()) { $maintext = XOOPS_ROOT_PATH . '/' . $wfsConfig['htmlpath'] . '/' . $this->htmlpage; $fullcount = prettysize(filesize($maintext)); } echo "<table width='100%' border='0' cellspacing='1' cellpadding='2' class = 'outer'>"; echo "<tr class='bg3' >"; echo "<td ><span class='itemTitle' align = 'left'>" . $title . "</b>"; echo "" . $adminlink . "</span></td>"; echo "</tr>"; echo "<tr>"; echo "<td valign='top' class='head' colspan='2'>"; echo "<table width='100%' border='0' cellspacing='0' cellpadding='0'>"; echo "<tr><td width=84% class= 'itemPoster' >"; echo "" . _WFS_AUTHER . " {$poster} <br>"; echo "" . _WFS_PUBLISHEDHOME . ": {$datetime} <br>"; echo "" . sprintf(_WFS_VIEWS, $counter) . "<br>"; echo "" . sprintf(_WFS_ARTSIZE, $fullcount) . ""; echo "</td>"; echo "<td width='16%' align='right' valign='middle'>{$maillink}</td>"; echo "</tr>"; echo "</table>"; echo "</td>"; echo "</tr>"; echo "<tr><td>"; if ($urllink) { echo $urllink . "<br />"; } else { echo " "; } echo "</td></tr>"; echo "<tr><td>"; if ($this->ishtml == '1' && $this->htmlpage()) { include $maintext; } else { echo $maintext . "</b>"; } echo "</td></tr>"; echo "<tr><td>"; echo " "; echo "</td></tr>"; echo "<tr><td>"; if ($pagelink) { echo $pagelink; } echo "</td></tr>"; echo "</table>"; }
} } $articletag['title'] .= " (" . ($page + 1) . "/" . ($pagenum + 1) . ")"; } if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid())) { $articletag['adminlink'] = " [ <a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/index.php?op=edit&articleid=" . $article->articleid . "'>" . _EDIT . "</a> | <a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/admin/index.php?op=delete&articleid=" . $article->articleid . "'>" . _DELETE . "</a> ] "; } $articletag['maillink'] = "<a href='print.php?articleid=" . $article->articleid . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/print.gif' alt='" . _WFS_PRINTERFRIENDLY . "' /></a> "; //$articletag['maillink'] .= "<a href='save.php?articleid=".$article->articleid."'><img src='".XOOPS_URL."/modules/".$xoopsModule->dirname()."/images/download.gif' alt='"._WFS_DOWNLOAD."' /></a> "; $articletag['maillink'] .= "<a target='_top' href='mailto:?subject=" . rawurlencode(sprintf(_WFS_INTFILEAT, $xoopsConfig['sitename'])) . "&body=" . rawurlencode(sprintf(_WFS_INTFILEFOUND, $xoopsConfig['sitename']) . ": " . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/index.php?articleid=" . $article->articleid) . "'><img src='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/images/friend.gif' alt='" . _WFS_TELLAFRIEND . "' /></a>"; $articletag['ratelink'] = "<a href='ratefile.php?lid=" . $article->articleid . "'>" . _WFS_RATETHISFILE . "</a>"; $articletag['catlink'] = "<a href='./index.php?category=" . $article->categoryid() . "'>" . _WFS_BACK2CAT . "</a><b> | </b><a href='./index.php'>" . _WFS_RETURN2INDEX . "</a>"; $articletag['rating'] = "<b>" . sprintf(_WFS_RATINGA, number_format($article->rating, 2)) . "</b>"; $articletag['votes'] = "<b>(" . sprintf(_WFS_NUMVOTES, $article->votes) . ")</b>"; $articletag['counter'] = sprintf(_WFS_VIEWS, $counter); $articletag['size'] = sprintf(_WFS_ARTSIZE, prettysize(strlen($articletag['maintext']))); // assign the article variables to template $xoopsTpl->assign('article', $articletag); if ($article->getFilesCount() > 0 && $accessnot >= 1) { $xoopsTpl->assign('showfiles', true); } if ($wfsConfig['novote'] == 1) { $xoopsTpl->assign('novote', true); } else { $xoopsTpl->assign('novote', false); } // assign lang phrases $xoopsTpl->assign(array('lang_author' => _WFS_AUTHER, 'lang_published' => _WFS_PUBLISHEDHOME, 'lang_downloadsfor' => _WFS_DOWNLOADS)); } $xoopsTpl->assign('xoops_pagetitle', htmlentities($xoopsModule->name() . ' - ' . $article->title())); if ($wfsConfig['comments']) {