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>"; }
$xoopsOption['template_main'] = 'wfsection_article.html'; } include_once XOOPS_ROOT_PATH . "/header.php"; //$article = new WfsArticle($item_id); if (checkAccess($article->groupid)) { if (isset($HTTP_GET_VARS['page'])) { $page = intval($HTTP_GET_VARS['page']); } else { $page = 0; if (!($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid()))) { $article->updateCounter(); } } $articletag = array(); if ($article->uid > 0) { $user = new xoopsUser($article->uid); if ($wfsConfig['realname'] && $user->getvar('name') != '') { $articletag['poster'] = $user->getvar('name'); } else { $articletag['poster'] = $user->getvar('uname'); } $articletag['poster'] = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $user->getVar('uid') . "'>" . $articletag['poster'] . "</a>"; } else { $articletag['poster'] = $xoopsConfig['anonymous']; } // $datetime if (isset($article->published)) { $articletag['datetime'] = formatTimestamp($article->published, $wfsConfig['timestamp']); } // $title $articletag['title'] = $article->category->textLink() . ": ";
function listArticle($catid, $start = 0, $num = 20) { global $xoopsDB, $orderby, $xoopsConfig, $xoopsUser, $xoopsModule, $wfsConfig, $myts, $counter, $mydownloads_popular, $dataselect; global $wfsModule; // add $xt = new WfsCategory($catid); if (file_exists(XOOPS_ROOT_PATH . "/" . $wfsConfig['sgraphicspath'] . "/" . $xt->imgurl) && $xt->imgurl !='blank.gif' ) { $image = "<img src='" . XOOPS_URL . "/" . $wfsConfig['sgraphicspath'] . "/" . $xt->imgurl("S") . "'>"; } else { if ($xoopsUser && $xoopsUser->isAdmin($xoopsModule->mid()) && $xt->imgurl !='blank.gif') { // multi language // $image = "ERROR: Please check path/file for image"; $image = "<font color=red>"._WFS_ERROR_IMAGE."</font>"; } else { $image = ''; } } $title = $xt->title() ; $catdescription = $xt->catdescription('S'); echo "<table border='0' cellpadding='2' cellspacing='1' valign='top' align = 'center' width = '100%'>"; if ((!empty($xt->imgurl) && $xt->displayimg == 1)) { echo "<tr><td colspan='5' align='center'>".$image."</td></tr>\n"; } echo "<tr><td colspan='5' align='center'> </td></tr>\n"; echo "<tr><td colspan='5' align='center'><h3>".$title."</h3></td></tr>\n"; echo "<tr><td>"; // -- Skalpack2 [start] // easy to rename module and table // $jump = XOOPS_URL."/modules/wfsection/index.php?"; $jump = XOOPS_URL."/modules/$wfsModule/index.php?"; $tree = new wfsTree($xt->table, "id", "pid"); switch ($wfsConfig['aidxpathtype']) { case 1: // Local selectbox $tree->makeMyRootedSelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value"); break; case 2: // Linked path // BUG 217: category link is wrong // echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->id, "title", $jump)); echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->id, "title", $jump)); break; case 3: // Path and local select box // BUG 217: category link is wrong // echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->pid, "title", $jump)); echo preg_replace('/&id=/', '&category=', $tree->getNicePathFromId($xt->pid, "title", $jump)); // bug fix: it can't jump at Path and local select box // $tree->makeMySelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value"); $tree->makeMyRootedSelBox('title', 'title', $xt->id, true, $xt->id, true, "", "location.href='{$jump}category='+this.options[this.selectedIndex].value"); break; case 4: // None break; case 0: // Full selectbox default: $xt->makeSelBox(1, $xt->id, "pid", "location.href='{$jump}category='+this.options[this.selectedIndex].value").""; break; } // -- Skalpack2 [/end] echo "</td></td>"; echo "<tr><td colspan='5'><br />$catdescription<br /></td></tr>\n"; echo "<tr><td colspan='5'> </td></tr>\n"; echo "</table>\n"; $sarray = WfsArticle::getAllArticle($num, $start, $catid, $dataselect='4'); $articlecount = WfsArticle::countByCategory($catid); echo "<table border='0' cellpadding='2' cellspacing='1' width = '100%' class= 'outer'>"; If ($articlecount != 0) { echo "<tr align='left'>"; // These will always be shown echo "<td align='left' width = '30%' class='itemHead'><b>" . _WFS_ARTICLE . "</b></td>"; if ($wfsConfig['summary']) { echo "<td align='left' width = '50%' class='itemHead'><b>" . _WFS_SUMMARY . "</b></td>"; } // You can choose which of these to show if ($wfsConfig['showauthor']) echo "<td align='center' class='itemHead'><b>" . _WFS_AUTH . "</b></td>"; if ($wfsConfig['showhits']) echo "<td align='center' class='itemHead'><b>" . _WFS_HITS . "</b></td>"; if ($wfsConfig['showcomments']) { if ($wfsConfig['comments']) echo "<td align='center' class='itemHead'><b>" . _WFS_COMMENT . "</b></td>"; } if ($wfsConfig['showfile']) echo "<td align='center' class='itemHead'><b>" . _WFS_FILES . "</b></td>"; if ($wfsConfig['novote']) { if ($wfsConfig['showrated']) echo "<td align='center' class='itemHead'><b>" . _WFS_RATED . "</b></td>"; } if ($wfsConfig['novote']) { if ($wfsConfig['showvotes']) echo "<td align='center' class='itemHead'><b>" . _WFS_VOTES . "</b></td>"; } if ($wfsConfig['showupdated']) echo "<td align='center' class='itemHead'><b>" . _WFS_PUBLISHEDHOME . "</b></td>"; echo "</tr>\n"; foreach ($sarray as $article) { $counter = $article->counter(); $time = $article->created(); $stat = $article->changed(); $articlelink = "<a href='" . XOOPS_URL . "/modules/" . $xoopsModule->dirname() . "/article.php?articleid=" . $article->articleid() . "'>"; if ($wfsConfig['picon']) { $articlelink .= "".$article->iconLink("S") . "</a>"; } else { $articlelink .= "".$article->textLink("S") . "</a>"; } $summary = $article->summary(); $published = formatTimestamp($article->published(), $wfsConfig['timestamp']); $counter = $article->counter(); if ($wfsConfig['comments']) $commentcount = $article->getCommentsCount(); $attachedfiles = $article->getFilesCount(); if ($article->uid > 0) { $user = new xoopsUser($article->uid); if (($wfsConfig['realname']) && $user->getvar('name')) { $username = $user->getvar('name'); } else { $username = $user->getvar('uname'); } $username = "******".XOOPS_URL."/userinfo.php?uid=".$article->uid()."'>".$username."</a>"; } else { $username = $GLOBALS['xoopsConfig']['anonymous']; } //$username = "******" . XOOPS_URL . "/userinfo.php?uid=" . $article->uid() . "'>" . $article->uname() . "</a>"; if ($wfsConfig['novote']) $rating = number_format($article->rating, 2); $groupid = $article->groupid; if ($wfsConfig['novote']) $votes = $myts->makeTboxData4Show($article->votes) ; $status = 1; $orderbyTrans = convertorderbytrans($orderby); if ($stat != $time) $status = 2; if (checkAccess($groupid)) { echo "<tr><td valign='top' class='even'>$articlelink"; if ($wfsConfig['noicons']) { popgraphic($counter); newdownloadgraphic($time, $status); } echo "</td>"; if ($wfsConfig['summary']) echo "<td valign='top' class='even'>$summary</td>"; if ($wfsConfig['showauthor']) echo "<td align='center' valign='top' class='even' nowrap='nowrap'>$username</td>"; if ($wfsConfig['showhits']) echo "<td align='center' valign='top' class='even'>$counter</td>"; //if ($wfsConfig['comments']) { if ($wfsConfig['showcomments']) { if ($wfsConfig['comments']) echo "<td align='center' valign='top' class='even'>$commentcount</td>"; } if ($wfsConfig['showfile']) echo "<td align='center' valign='top' class='even'>$attachedfiles</td>"; if ($wfsConfig['novote']) { if ($wfsConfig['showrated']) echo "<td align='center' valign='top' class='even'>$rating</td>"; if ($wfsConfig['showvotes']) echo "<td align='center' valign='top' class='even'>$votes</td>"; } if ($wfsConfig['showupdated']) { echo "<td align='center' nowrap='nowrap' valign='top' class='even'>$published</td></tr>\n"; } } } //end check access } echo "</table>\n"; if ($articlecount > $num) { echo "<table border='0' width='100%' cellpadding='0' cellspacing='0' align='center' valign='top'><tr><td align='center'>"; // take over the order to previos and next page // if ($articlecount < $start + $num) echo "<a href='index.php?category=" . $catid . "&start=" . ($start - $num) . "'>" . _WFS_PREVPAGE . "</a> "; // if ($articlecount > $start + $num) echo "<a href='index.php?category=" . $catid . "&start=" . ($start + $num) . "'>" . _WFS_NEXTPAGE . "</a> "; $orderbyOut = convertorderbyout($orderby); if ($articlecount < $start + $num) echo "<a href='index.php?category=" . $catid . "&start=" . ($start - $num) . "&orderby=" . $orderbyOut . "'>" . _WFS_PREVPAGE . "</a> "; if ($articlecount > $start + $num) echo "<a href='index.php?category=" . $catid . "&start=" . ($start + $num) . "&orderby=" . $orderbyOut . "'>" . _WFS_NEXTPAGE . "</a> "; // BUG 8186: page number is displayed too many // for($i = 0, $j = 1; $i <= $articlecount; $i += $num, $j++) for($i = 0, $j = 1; $i < $articlecount; $i += $num, $j++) { if (($i <= $start) && ($start < ($i + $num))) { echo $j . " "; } else { // take over the order to previos and next page // echo "<a href='index.php?category=" . $catid . "&start=" . ($i) . "'>" . ($j) . "</a> "; echo "<a href='index.php?category=" . $catid . "&start=" . ($i) . "&orderby=" . $orderbyOut . "'>" . ($j) . "</a> "; } } echo "</td></tr></table>\n"; } echo "<table cellpadding='2' cellspacing='1' width='100%'>"; if ($xt->catfooter) { echo "<tr><td><br />\n"; echo $xt->catfooter('S') . "<br /><br />\n"; echo "</td></tr>\n"; } echo "</table>\n"; echo "<table border='0' cellpadding='1' cellspacing='1' width='100%'>"; if (!$xt->catfooter) echo "<br />"; echo "<tr><td align='center' class='head' >[ <a href='javascript:history.back(1)'>" . _WFS_BACK2 . "</a> | <a href='./index.php'>" . _WFS_RETURN2INDEX . "</a> ]</a></td></tr>\n"; echo "</table>\n"; echo "<br />"; if (($articlecount > 0)) { echo "<table border='0' cellpadding='1' cellspacing='1' width='100%' class = 'outer'>"; echo "<tr><td align='center' class='even'>"; $orderbyTrans = convertorderbytrans($orderby); // BUG 7854: redundant samll tag // echo "<small><center>" . _WFS_SORTBY1 . " "; echo "<center>" . _WFS_SORTBY1 . " "; echo " " . _WFS_TITLE1 . " (<a href='index.php?category=$catid&orderby=titleA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=titleD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)"; echo " " . _WFS_DATE1 . " (<a href='index.php?category=$catid&orderby=createdA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=createdD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)"; echo " " . _WFS_WEIGHT . " (<a href='index.php?category=$catid&orderby=weight'>Reset</a>)"; if ($wfsConfig['novote']) { echo " " . _WFS_RATING1 . " (<a href='index.php?category=$catid&orderby=ratingA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href=index.php?category=$catid&orderby=ratingD><img src='images/down.gif' border='0' align='middle' alt='' /></a>)"; } echo " " . _WFS_POPULARITY1 . " (<a href='index.php?category=$catid&orderby=counterA'><img src='images/up.gif' border='0' align='middle' alt='' /></a><a href='index.php?category=$catid&orderby=counterD'><img src='images/down.gif' border='0' align='middle' alt='' /></a>)"; echo "<br /><b><small>"; printf(_WFS_CURSORTBY1, $orderbyTrans); $orderby = convertorderbyout($orderby); echo "</small></b></center>"; echo "</td></tr></table>\n"; } }
echo "<tr valign='middle' >"; echo "<td align='left' class='bg3' colspan =5><b>" . _AM_FVAL . "</b></td>"; echo "</tr></table>"; echo "<br />"; echo "<div width='100%' colspan =5 ><b>New Submissions</b></div>"; echo "<br />"; echo "<table border='0' width='100%' cellspacing='1' cellpadding='2' class = 'outer'>"; echo "<td width='5%' align='center' valign='middle' class='bg3'><b>ID</b></td>"; echo "<td width='25%' align='left' valign='middle' class='bg3'><b>Title</b></td>"; echo "<td width='25%' align='center' valign='middle' class='bg3'><b>Author</b></td>"; echo "<td width='25%' align='center' valign='middle' class='bg3'><b>Submitted</b></td>"; echo "<td width='25%' align='center' colspan='2' class='bg3'><b>Action</b></td>"; echo "</tr>"; while (list($topicID, $catID, $question, $answer, $summary, $uid, $submit, $datesub) = $xoopsDB->fetchRow($results)) { if ($uid) { $user = new xoopsUser($uid); $poster = $user->getVar("uname"); $submitter = "<a href='" . XOOPS_URL . "/userinfo.php?uid=" . $uid . "'>{$poster}</a>"; //$thisUser->getVar("uname"); } else { $submitter = "Guest"; } $datesub = formatTimestamp($datesub, "D, d-M-Y, H:i"); echo "<tr>"; echo "<td class='head' align = 'center'>{$topicID}</td>"; echo "<td class='even'><a href='submissions.php?op=view&t={$topicID}&c={$catID}'>{$question}</a></td>"; echo "<td class='even'><p align='center'>{$submitter}</td>"; echo "<td class='even'><p align='center'>{$datesub}</td>"; echo "<td align='center' class='even' > <a href='submissions.php?op=allow&t={$topicID}&c={$catID}'>" . _AM_SUBALLOW . "</a></td>"; echo "<td align='center' class='even' > <a href='index.php?op=del&subm=1&t={$topicID}'>" . _AM_SUBDELETE . "</a>"; echo "</td></tr>";