function getparentlink($parentid, $title) { global $downloadsprefix, $db; $row = $db->sql_ufetchrow("SELECT cid, title, parentid FROM " . $downloadsprefix . "_categories WHERE cid='{$parentid}'", SQL_ASSOC, __FILE__); $ptitle = $row['title']; $pparentid = $row['parentid']; if (!empty($row['title'])) { $title = '<a href="' . getlink("&d_op=viewdownload&cid={$row['cid']}") . "\">{$row['title']}</a>/" . $title; } if ($row['parentid'] > 0) { $title = getparentlink($row['parentid'], $title); } return $title; }
function getparentlink($parentid, $title) { global $prefix, $db, $module_name; $sql = "SELECT cid, title, parentid FROM " . $prefix . "_downloads_categories WHERE cid='{$parentid}'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $cid = $row[cid]; $ptitle = $row[title]; $pparentid = $row[parentid]; if ($ptitle != "") { $title = "<a href=modules.php?name={$module_name}&d_op=viewdownload&cid={$cid}>{$ptitle}</a>/" . $title; } if ($pparentid != 0) { $title = getparentlink($pparentid, $ptitle); } return $title; }
function viewsdownload($sid, $min, $orderby, $show) { global $prefix, $db, $admin, $module_name, $user, $admin_file, $datetime, $transfertitle, $locale; include "modules/{$module_name}/d_config.php"; include "header.php"; $sid = intval($sid); menu(1); if (!isset($min)) { $min = 0; } if (!isset($max)) { $max = $min + $perpage; } if (!empty($orderby)) { $orderby = convertorderbyin($orderby); } else { $orderby = "title ASC"; } if (!empty($show)) { $perpage = $show; } else { $show = $perpage; } echo "<br>"; OpenTable(); $cid = intval(trim($cid)); $result = $db->sql_query("SELECT title,parentid FROM " . $prefix . "_downloads_categories WHERE cid='{$cid}'"); list($title, $parentid) = $result->fetch_row(); $title = filter($title, "nohtml"); $parentid = intval($parentid); $title = getparentlink($parentid, $title); $title = "<a href=modules.php?name={$module_name}>" . _MAIN . "</a>/{$title}"; echo "<center><font class=\"option\"><b>" . _CATEGORY . ": {$title}</b></font></center><br>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>"; $result2 = $db->sql_query("SELECT cid, title, cdescription FROM " . $prefix . "_downloads_categories WHERE parentid='{$cid}' order by title"); $count = 0; while (list($cid2, $title2, $cdescription2) = $result2->fetch_row()) { $cid2 = intval($cid2); $title = filter($title, "nohtml"); $cdescription = filter($cdescription); echo "<td><font class=\"option\"><strong><big>·</big></strong> <a href=\"modules.php?name={$module_name}&d_op=viewdownload&cid={$cid2}\"><b>{$title2}</b></a></font>"; categorynewdownloadgraphic($cid2); if ($cdescription2) { echo "<font class=\"content\">{$cdescription2}</font><br>"; } else { echo "<br>"; } $result3 = $db->sql_query("SELECT cid, title FROM " . $prefix . "_downloads_categories WHERE parentid='{$cid2}' order by title limit 0,3"); $space = 0; while (list($cid3, $title3) = $result3->fetch_row()) { $cid3 = intval($cid3); $title3 = filter($title3, "nohtml"); if ($space > 0) { echo ", "; } echo "<font class=\"content\"><a href=\"modules.php?name={$module_name}&d_op=viewdownload&cid={$cid3}\">{$title3}</a></font>"; $space++; } if ($count < 1) { echo "</td><td> </td>"; $dum = 1; } $count++; if ($count == 2) { echo "</td></tr><tr>"; $count = 0; $dum = 0; } } if ($dum == 1) { echo "</tr></table>"; } elseif ($dum == 0) { echo "<td></td></tr></table>"; } echo "<hr noshade size=\"1\">"; $orderbyTrans = convertorderbytrans($orderby); echo "<br><center><font class=\"content\">" . _SORTDOWNLOADSBY . ": " . "" . _TITLE . " (<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=titleA\">A</a>\\<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=titleD\">D</a>)" . " " . _DATE . " (<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=dateA\">A</a>\\<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=dateD\">D</a>)" . " " . _RATING . " (<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=ratingA\">A</a>\\<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=ratingD\">D</a>)" . " " . _POPULARITY . " (<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=hitsA\">A</a>\\<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&orderby=hitsD\">D</a>)" . "<br><b>" . _RESSORTED . ": {$orderbyTrans}</b></font></center><br><br>"; if (!is_numeric($min)) { $min = 0; } $result = $db->sql_query("SELECT lid, url, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage FROM " . $prefix . "_downloads_downloads WHERE sid='{$sid}' order by {$orderby} limit {$min},{$perpage}"); $fullcountresult = $db->sql_query("SELECT lid, title, description, date, hits, downloadratingsummary, totalvotes, totalcomments FROM " . $prefix . "_downloads_downloads WHERE sid='{$sid}'"); $totalselecteddownloads = $db->sql_numrows($fullcountresult); echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">"; $x = 0; while (list($lid, $url, $title, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage) = $result->fetch_row()) { $lid = intval($lid); $hits = intval($hits); $totalvotes = intval($totalvotes); $totalcomments = intval($totalcomments); $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal); $title = filter($title, "nohtml"); $description = filter($description); global $prefix, $db, $admin; if (is_admin($admin)) { echo "<a href=\"" . $admin_file . ".php?op=DownloadsModDownload&lid={$lid}\"><img src=\"modules/{$module_name}/images/lwin.gif\" border=\"0\" alt=\"" . _EDIT . "\"></a> "; } else { echo "<img src=\"modules/{$module_name}/images/lwin.gif\" border=\"0\" alt=\"\"> "; } echo "<a href=\"modules.php?name={$module_name}&d_op=getit&lid={$lid}\">{$title}</a>"; newdownloadgraphic($datetime, $time); popgraphic($hits); /* code for *editor review* insert here */ detecteditorial($lid, $transfertitle, 1); echo "<br><b>" . _DESCRIPTION . ":</b> {$description}<br>"; setlocale(LC_TIME, $locale); ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime); $datetime = strftime("" . _LINKSDATESTRING . "", mktime($datetime[4], $datetime[5], $datetime[6], $datetime[2], $datetime[3], $datetime[1])); $datetime = ucfirst($datetime); echo "<b>" . _VERSION . ":</b> {$version} <b>" . _FILESIZE . ":</b> " . CoolSize($filesize) . "<br>"; echo "<b>" . _ADDEDON . ":</b> {$datetime} <b>" . _UDOWNLOADS . ":</b> {$hits}"; $transfertitle = str_replace(" ", "_", $title); /* voting & comments stats */ if ($totalvotes == 1) { $votestring = _VOTE; } else { $votestring = _VOTES; } if ($downloadratingsummary != "0" || $downloadratingsummary != "0.0") { echo " <b>" . _RATING . ":</b> {$downloadratingsummary} ({$totalvotes} {$votestring})"; } if (empty($homepage)) { echo "<br>"; } else { echo "<br><a href=\"{$homepage}\" target=\"new\">" . _HOMEPAGE . "</a> | "; } echo "<a href=\"modules.php?name={$module_name}&d_op=ratedownload&lid={$lid}\">" . _RATERESOURCE . "</a>"; if (is_user($user)) { echo " | <a href=\"modules.php?name={$module_name}&d_op=brokendownload&lid={$lid}\">" . _REPORTBROKEN . "</a>"; } echo " | <a href=\"modules.php?name={$module_name}&d_op=viewdownloaddetails&lid={$lid}\">" . _DETAILS . "</a>"; if ($totalcomments != 0) { echo " | <a href=\"modules.php?name={$module_name}&d_op=viewdownloadcomments&lid={$lid}\">" . _SCOMMENTS . " ({$totalcomments})</a>"; } detecteditorial($lid, $transfertitle, 0); echo "<br><br>"; $x++; } echo "</font>"; $orderby = convertorderbyout($orderby); /* Calculates how many pages exist. Which page one should be on, etc... */ $downloadpagesint = $totalselecteddownloads / $perpage; $downloadpageremainder = $totalselecteddownloads % $perpage; if ($downloadpageremainder != 0) { $downloadpages = ceil($downloadpagesint); if ($totalselecteddownloads < $perpage) { $downloadpageremainder = 0; } } else { $downloadpages = $downloadpagesint; } /* Page Numbering */ if ($downloadpages != 1 && $downloadpages != 0) { echo "<br><br>" . "" . _SELECTPAGE . ": "; $prev = $min - $perpage; if ($prev >= 0) { echo " <b>[ <a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&min={$prev}&orderby={$orderby}&show={$show}\">" . " << " . _PREVIOUS . "</a> ]</b> "; } $counter = 1; $currentpage = $max / $perpage; while ($counter <= $downloadpages) { $cpage = $counter; $mintemp = $perpage * $counter - $perpage; if ($counter == $currentpage) { echo "<b>{$counter}</b> "; } else { echo "<a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&min={$mintemp}&orderby={$orderby}&show={$show}\">{$counter}</a> "; } $counter++; } $next = $min + $perpage; if ($x >= $perpage) { echo " <b>[ <a href=\"modules.php?name={$module_name}&d_op=viewdownload&sid={$sid}&min={$max}&orderby={$orderby}&show={$show}\">" . " " . _NEXT . " >></a> ]</b> "; } } echo "</td></tr></table>"; CloseTable(); include "footer.php"; }
function viewlink($cid, $min, $orderby, $show) { global $prefix, $db, $admin, $perpage, $module_name, $user; $show = intval($show); if (empty($show)) { $show = ''; } if (isset($orderby)) { $orderby = htmlspecialchars($orderby); } $admin = base64_decode($admin); $admin = addslashes($admin); $admin = explode(":", $admin); $aid = "{$admin['0']}"; $row = $db->sql_fetchrow($db->sql_query("SELECT radminsuper from " . $prefix . "_authors where aid='{$aid}'")); $radminsuper = intval($row['radminsuper']); include "header.php"; if (!isset($min)) { $min = 0; } if (!isset($max)) { $max = $min + $perpage; } if (isset($orderby)) { $orderby = convertorderbyin($orderby); } else { $orderby = "title ASC"; } if ($show != "") { $perpage = $show; } else { $show = $perpage; } menu(1); echo "<br>"; OpenTable(); $cid = intval($cid); $row_two = $db->sql_fetchrow($db->sql_query("SELECT title,parentid FROM " . $prefix . "_links_categories WHERE cid='{$cid}'")); $title = stripslashes(check_html($row_two['title'], "nohtml")); $parentid = intval($row_two['parentid']); $title = getparentlink($parentid, $title); $title = "<a href=modules.php?name={$module_name}>" . _MAIN . "</a>/{$title}"; echo "<center><font class=\"option\"><b>" . _CATEGORY . ": {$title}</b></font></center><br>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>"; $cid = intval($cid); $result2 = $db->sql_query("SELECT cid, title, cdescription from " . $prefix . "_links_categories where parentid='{$cid}' order by title"); $count = 0; while ($row2 = $db->sql_fetchrow($result2)) { $cid2 = intval($row2['cid']); $title2 = stripslashes(check_html($row2['title'], "nohtml")); $cdescription2 = stripslashes($row2['cdescription']); echo "<td><font class=\"option\"><strong><big>·</big></strong> <a href=\"modules.php?name=Web_Links&l_op=viewlink&cid={$cid2}\"><b>{$title2}</b></a></font>"; categorynewlinkgraphic($cid2); if ($description) { echo "<font class=\"content\">{$cdescription2}</font><br>"; } else { echo "<br>"; } $result3 = $db->sql_query("SELECT cid, title from " . $prefix . "_links_categories where parentid='{$cid2}' order by title limit 0,3"); $space = 0; while ($row3 = $db->sql_fetchrow($result3)) { $cid3 = intval($row3['cid']); $title3 = stripslashes(check_html($row3['title'], "nohtml")); if ($space > 0) { echo ", "; } echo "<font class=\"content\"><a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid3}\">{$title3}</a></font>"; $space++; } if ($count < 1) { echo "</td><td> </td>"; $dum = 1; } $count++; if ($count == 2) { echo "</td></tr><tr>"; $count = 0; $dum = 0; } } if ($dum == 1) { echo "</tr></table>"; } elseif ($dum == 0) { echo "<td></td></tr></table>"; } echo "<hr noshade size=\"1\">"; $orderbyTrans = convertorderbytrans($orderby); echo "<center><font class=\"content\">" . _SORTLINKSBY . ": " . "" . _TITLE . " (<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=titleA\">A</a>\\<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=titleD\">D</a>) " . "" . _DATE . " (<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=dateA\">A</a>\\<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=dateD\">D</a>) " . "" . _RATING . " (<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=ratingA\">A</a>\\<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=ratingD\">D</a>) " . "" . _POPULARITY . " (<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=hitsA\">A</a>\\<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&orderby=hitsD\">D</a>)" . "<br><b>" . _SITESSORTED . ": {$orderbyTrans}</b></font></center><br><br>"; $result4 = $db->sql_query("SELECT lid, title, description, date, hits, linkratingsummary, totalvotes, totalcomments from " . $prefix . "_links_links where cid='{$cid}' order by {$orderby} limit {$min},{$perpage}"); $fullcountresult = $db->sql_query("SELECT lid, title, description, date, hits, linkratingsummary, totalvotes, totalcomments from " . $prefix . "_links_links where cid='{$cid}'"); $totalselectedlinks = $db->sql_numrows($fullcountresult); echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">"; $x = 0; while ($row4 = $db->sql_fetchrow($result4)) { $lid = intval($row4['lid']); $title = stripslashes(check_html($row4['title'], "nohtml")); $description = stripslashes($row4['description']); $time = $row4['date']; $hits = intval($row4['hits']); $linkratingsummary = $row4['linkratingsummary']; $totalvotes = intval($row4['totalvotes']); $totalcomments = intval($row4['totalcomments']); $linkratingsummary = number_format($linkratingsummary, $mainvotedecimal); echo "<a href=\"modules.php?name={$module_name}&l_op=visit&lid={$lid}\" target=\"new\"><b>{$title}</b></a>"; newlinkgraphic($datetime, $time); popgraphic($hits); /* INSERT code for *editor review* here */ echo "<br>"; echo "" . _DESCRIPTION . ": {$description}<br>"; setlocale(LC_TIME, $locale); ereg("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $time, $datetime); $datetime = strftime("" . _LINKSDATESTRING . "", mktime($datetime[4], $datetime[5], $datetime[6], $datetime[2], $datetime[3], $datetime[1])); $datetime = ucfirst($datetime); echo "" . _ADDEDON . ": {$datetime} " . _HITS . ": {$hits}"; $transfertitle = str_replace(" ", "_", $title); /* voting & comments stats */ if ($totalvotes == 1) { $votestring = _VOTE; } else { $votestring = _VOTES; } if ($linkratingsummary != "0" || $linkratingsummary != "0.0") { echo " " . _RATING . ": {$linkratingsummary} ({$totalvotes} {$votestring})"; } echo "<br>"; if ($radminsuper == 1) { echo "<a href=\"admin.php?op=LinksModLink&lid={$lid}\">" . _EDIT . "</a> | "; } echo "<a href=\"modules.php?name={$module_name}&l_op=ratelink&lid={$lid}&ttitle={$transfertitle}\">" . _RATESITE . "</a>"; if (is_user($user)) { echo " | <a href=\"modules.php?name={$module_name}&l_op=brokenlink&lid={$lid}\">" . _REPORTBROKEN . "</a>"; } if ($totalvotes != 0) { echo " | <a href=\"modules.php?name={$module_name}&l_op=viewlinkdetails&lid={$lid}&ttitle={$transfertitle}\">" . _DETAILS . "</a>"; } if ($totalcomments != 0) { echo " | <a href=\"modules.php?name={$module_name}&l_op=viewlinkcomments&lid={$lid}&ttitle={$transfertitle}\">" . _SCOMMENTS . " ({$totalcomments})</a>"; } detecteditorial($lid, $transfertitle); echo "<br><br>"; $x++; } echo "</font>"; $orderby = convertorderbyout($orderby); /* Calculates how many pages exist. Which page one should be on, etc... */ $linkpagesint = $totalselectedlinks / $perpage; $linkpageremainder = $totalselectedlinks % $perpage; if ($linkpageremainder != 0) { $linkpages = ceil($linkpagesint); if ($totalselectedlinks < $perpage) { $linkpageremainder = 0; } } else { $linkpages = $linkpagesint; } /* Page Numbering */ if ($linkpages != 1 && $linkpages != 0) { echo "<br><br>"; echo "" . _SELECTPAGE . ": "; $prev = $min - $perpage; if ($prev >= 0) { echo " <b>[ <a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&min={$prev}&orderby={$orderby}&show={$show}\">"; echo " << " . _PREVIOUS . "</a> ]</b> "; } $counter = 1; $currentpage = $max / $perpage; while ($counter <= $linkpages) { $cpage = $counter; $mintemp = $perpage * $counter - $perpage; if ($counter == $currentpage) { echo "<b>{$counter}</b> "; } else { echo "<a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&min={$mintemp}&orderby={$orderby}&show={$show}\">{$counter}</a> "; } $counter++; } $next = $min + $perpage; if ($x >= $perpage) { echo " <b>[ <a href=\"modules.php?name={$module_name}&l_op=viewlink&cid={$cid}&min={$max}&orderby={$orderby}&show={$show}\">"; echo " " . _NEXT . " >></a> ]</b> "; } } echo "</td></tr></table>"; CloseTable(); include "footer.php"; }
function getparentlink($parentid, $title, $cid) { global $db_prefix, $locale, $data, $cdata; $data = dbarray(dbquery("select cid, title, parentid from " . $db_prefix . "kroax_kategori where cid={$parentid}")); if ($data['title'] != "") { $title = '<a href="' . INFUSIONS . 'the_kroax/kroax.php?category=' . $data['cid'] . '"><b>' . $data['title'] . '</b></a> » <a href="' . INFUSIONS . 'the_kroax/kroax.php?category=' . $cid . '"><b>' . $title . '</b></a>'; } if ($data['parentid'] != 0) { $title = getparentlink($data['parentid'], $title, $cid); } if ($data['parentid'] == 0) { $title = '<a href="' . INFUSIONS . 'the_kroax/kroax.php?category=' . $cid . '"><b>' . $title . '</b></a>'; } return $title; }
function viewdownload() { global $downloadsprefix, $db, $perpage, $module_name, $bgcolor1, $bgcolor3, $show_links_num; $cid = intval($_GET['cid']); $min = isset($_GET['min']) ? intval($_GET['min']) : 0; $orderby = convertorderbyin($_GET['orderby']); $max = $min + $perpage; include "header.php"; $result = $db->sql_query("SELECT title,cdescription,ldescription,parentid FROM " . $downloadsprefix . "_categories WHERE cid={$cid}"); list($title, $cdescription, $ldescription, $parentid) = $db->sql_fetchrow($result); $title = getparentlink($parentid, $title); $title = "<a href=" . getlink() . ">" . _MAIN . "</a>/{$title}"; downl_menu_tpl(1); echo '<br />'; if ($ldescription != '') { OpenTable2(); echo "{$ldescription}"; CloseTable2(); echo '<br />'; } OpenTable(); if ($cdescription != '') { $cdescription = "<br />" . $cdescription; } echo "<center><font class=\"title\"><b>" . _CATEGORY . ": {$title}</b></font>{$cdescription}</center>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\" align=\"center\"><tr>"; $result2 = $db->sql_query("SELECT cid, title, cdescription FROM " . $downloadsprefix . "_categories WHERE parentid={$cid} order by title"); $count = 0; while (list($cid2, $title2, $cdescription2) = $db->sql_fetchrow($result2)) { if ($show_links_num == 1) { $cresult = $db->sql_query("SELECT * FROM " . $downloadsprefix . "_downloads WHERE cid={$cid2}"); $cnumrows = $db->sql_numrows($cresult); $cnumm = " ({$cnumrows})"; } else { $cnum = ""; } if ($cnumrows > 0) { $folder = "modules/Downloads/images/openfolder.gif"; } else { $folder = "modules/Downloads/images/closedfolder.gif"; } if (can_admin('downloads')) { $folderImg = "<A HREF=\"" . adminlink("{$module_name}&mode=DownloadsModCat&cat={$cid2}") . "\"><IMG SRC=\"{$folder}\" BORDER=0 ALT=\"" . _EDIT . "\"></A>"; } else { $folderImg = "<IMG SRC=\"{$folder}\" BORDER=0 ALT=\"{$title2}\">"; } echo "<td valign=\"top\"><font class=\"title\">{$folderImg} <a href=\"" . getlink("&d_op=viewdownload&cid={$cid2}") . "\"><b>{$title2}</b></a></font>{$cnumm}"; categorynewdownloadgraphic($cid2); if ($cdescription2) { echo "<br /><font class=\"content\">{$cdescription2}</font><br />"; } else { echo '<br />'; } $result3 = $db->sql_query("SELECT cid, title FROM " . $downloadsprefix . "_categories WHERE parentid={$cid2} order by title limit 0,3"); $space = 0; while (list($cid3, $title3) = $db->sql_fetchrow($result3)) { if ($space > 0) { echo ", "; } if ($show_links_num == 1) { $cresult2 = $db->sql_query("SELECT * FROM " . $downloadsprefix . "_downloads WHERE cid={$cid3}"); $cnumrows2 = $db->sql_numrows($cresult2); $cnum = " ({$cnumrows2})"; } else { $cnum = ""; } echo "<font class=\"content\"><a href=\"" . getlink("&d_op=viewdownload&cid={$cid3}") . "\">{$title3}</a></font>{$cnum}"; $space++; } if ($count < 1) { echo "</td><td> </td>"; $dum = 1; } $count++; if ($count == 2) { echo "</td></tr><tr>"; $count = 0; $dum = 0; } } if ($dum == 1) { echo "</tr></table>"; } elseif ($dum == 0) { echo "<td></td></tr></table>"; } echo "<hr noshade size=\"1\">"; $orderbyTrans = convertorderbytrans($orderby); echo "<center><font class=\"content\">" . _SORTDOWNLOADSBY . ": " . _TITLE . " (<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=titleA") . "\">A</a>\\<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=titleD") . "\">D</a>) " . _DATE . " (<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=dateA") . "\">A</a>\\<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=dateD") . "\">D</a>) " . _RATING . " (<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=ratingA") . "\">A</a>\\<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=ratingD") . "\">D</a>) " . _POPULARITY . " (<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=hitsA") . "\">A</a>\\<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&orderby=hitsD") . "\">D</a>)" . "<br /><b>" . _RESSORTED . ": {$orderbyTrans}</b></font></center>"; echo "<hr noshade size=\"1\">"; $result = $db->sql_query("SELECT lid, title, url, description, date, hits, downloadratingsummary, totalvotes, totalcomments, filesize, version, homepage FROM " . $downloadsprefix . "_downloads WHERE cid={$cid} order by {$orderby} limit {$min},{$perpage} "); $fullcountresult = $db->sql_query("SELECT lid FROM " . $downloadsprefix . "_downloads WHERE cid={$cid}"); $totalselecteddownloads = $db->sql_numrows($fullcountresult); echo "<table width=\"100%\" cellspacing=\"0\" cellpadding=\"10\" border=\"0\"><tr><td><font class=\"content\">"; $x = 0; $color = $bgcolor3; while (list($lid, $title, $url, $description, $time, $hits, $downloadratingsummary, $totalvotes, $totalcomments, $filesize, $version, $homepage) = $db->sql_fetchrow($result)) { $downloadratingsummary = number_format($downloadratingsummary, $mainvotedecimal); $color = $color == $bgcolor3 ? $bgcolor1 : $bgcolor3; echo "<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=0 WIDTH=100%><TR BGCOLOR=\"{$color}\"><TD>"; if (can_admin('downloads')) { if (eregi("http", $url)) { echo "<a href=\"" . adminlink("{$module_name}&mode=DownloadsModDownload&lid={$lid}") . "\"><img src=\"modules/{$module_name}/images/icon30.gif\" border=\"0\" alt=\"" . _EDIT . "\"></a>"; } else { echo "<a href=\"" . adminlink("{$module_name}&mode=DownloadsModDownload&lid={$lid}") . "\"><img src=\"modules/{$module_name}/images/download.gif\" border=\"0\" alt=\"" . _EDIT . "\"></a>"; } } else { if (eregi("http", $url)) { echo "<img src=\"modules/{$module_name}/images/icon30.gif\" border=\"0\" alt=\"\">"; } else { echo "<img src=\"modules/{$module_name}/images/download.gif\" border=\"0\" alt=\"\">"; } } echo "</td><td width=\"100%\" class=\"title\" valign=\"top\"><a href=\"" . getlink("&d_op=getit&lid={$lid}") . "\"><B>{$title}</b></a>"; $datetime = formatDateTime($time . ' 00:00:00', _DATESTRING3); newdownloadgraphic($datetime); popgraphic($hits); detecteditorial($lid, 1); echo "</td></tr><TR BGCOLOR=\"{$color}\"><TD COLSPAN=2>"; echo "<DIV ALIGN=\"JUSTIFY\"><b>" . _DESCRIPTION . ":</b> {$description}</td></tr><TR BGCOLOR=\"{$color}\"><TD COLSPAN=2>"; echo "<b>" . _VERSION . ":</b> {$version} <b>" . _FILESIZE . ":</b> " . CoolSize($filesize) . "<br />"; echo "<b>" . _ADDEDON . ":</b> {$datetime} <b>" . _UDOWNLOADS . ":</b> {$hits}"; $transfertitle = str_replace(" ", "_", $title); /* voting & comments stats */ if ($totalvotes == 1) { $votestring = _VOTE; } else { $votestring = _VOTES; } if ($downloadratingsummary != "0" || $downloadratingsummary != "0.0") { echo " <b>" . _RATING . ":</b> {$downloadratingsummary} ({$totalvotes} {$votestring})"; } if ($homepage == "") { echo '<br />'; } else { echo "<br /><a href=\"{$homepage}\" target=\"new\">" . _HOMEPAGE . "</a> | "; } echo "<a href=\"" . getlink("&d_op=ratedownload&lid={$lid}") . "\">" . _RATERESOURCE . "</a>"; if (is_user()) { echo " | <a href=\"" . getlink("&d_op=brokendownload&lid={$lid}") . "\">" . _REPORTBROKEN . "</a>"; } echo " | <a href=\"" . getlink("&d_op=viewdownloaddetails&lid={$lid}") . "\">" . _DETAILS . "</a>"; if ($totalcomments != 0) { echo " | <a href=\"" . getlink("&d_op=viewdownloadcomments&lid={$lid}") . "\">" . _SCOMMENTS . " ({$totalcomments})</a>"; } detecteditorial($lid, 0); echo "</div></td></tr></table><br />"; $x++; } echo "</font>"; $orderby = convertorderbyout($orderby); /* Calculates how many pages exist. Which page one should be on, etc... */ $downloadpagesint = $totalselecteddownloads / $perpage; $downloadpageremainder = $totalselecteddownloads % $perpage; if ($downloadpageremainder != 0) { $downloadpages = ceil($downloadpagesint); if ($totalselecteddownloads < $perpage) { $downloadpageremainder = 0; } } else { $downloadpages = $downloadpagesint; } /* Page Numbering */ if ($downloadpages != 1 && $downloadpages != 0) { echo "<br /><br />"; echo _SELECTPAGE . ": "; $prev = $min - $perpage; if ($prev >= 0) { echo " <b>[ <a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&min={$prev}&orderby={$orderby}") . "\">"; echo " << " . _PREVIOUSPAGE . "</a> ]</b> "; } $counter = 1; $currentpage = $max / $perpage; while ($counter <= $downloadpages) { $cpage = $counter; $mintemp = $perpage * $counter - $perpage; if ($counter == $currentpage) { echo "<b>{$counter}</b> "; } else { echo "<a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&min={$mintemp}&orderby={$orderby}") . "\">{$counter}</a> "; } $counter++; } $next = $min + $perpage; if ($x >= $perpage) { echo " <b>[ <a href=\"" . getlink("&d_op=viewdownload&cid={$cid}&min={$max}&orderby={$orderby}") . "\">" . _NEXTPAGE . " >></a> ]</b> "; } } echo "</td></tr></table>"; CloseTable(); include "footer.php"; }
function viewlink($cid, $min, $orderby, $show) { global $linksprefix, $db, $weblinks_config, $pagetitle, $bgcolor2, $bgcolor3; $perpage = $weblinks_config['perpage']; $min = !isset($_GET['min']) ? 0 : $_GET['min']; if (!isset($_GET['max'])) { $max = $min + $perpage; } $orderby = isset($_GET['orderby']) ? convertorderbyin($_GET['orderby']) : 'title ASC'; $orderbyTrans = isset($_GET['orderby']) ? convertorderbytrans($_GET['orderby']) : _TITLEAZ; if (!empty($_GET['show'])) { $perpage = $_GET['show']; } elseif (!empty($_GET['perpage'])) { $show = $_GET['perpage']; } else { $show = 0; } if (!($result = $db->sql_ufetchrow("SELECT title, parentid FROM " . $linksprefix . "_categories WHERE cid={$cid}"))) { cpg_error('Link doesn\'t exist', 404); } list($title, $parentid) = $result; $title = getparentlink($parentid, $title); $pagetitle .= ' ' . _BC_DELIM . ' ' . strip_tags($title); require_once 'header.php'; menu(1); echo '<br />'; OpenTable(); $title = '<a href="' . URL::index() . '">' . _MAIN . '</a> ' . _BC_DELIM . ' <b>' . $title . '</b>'; echo '<div style="margin-left:10px; margin-right:10px;"><p style="text-align:center; margin:5px;" class="option">' . _CATEGORY . ': ' . $title . '</p>'; echo '<p style="text-align:center; width:420px; margin:auto; padding:5px; border:2px solid ' . $bgcolor2 . '; background:' . $bgcolor3 . ';" class="content">' . _SORTLINKSBY . ': ' . _TITLE . ' (<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=titlea") . '">▲</a>\\<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=titled") . '">▼</a>) ' . _DATE . ' (<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=datea") . '">▲</a>\\<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=dated") . '">▼</a>) ' . _RATING . ' (<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=ratinga") . '">▲</a>\\<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=ratingd") . '">▼</a>) ' . _POPULARITY . ' (<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=hitsa") . '">▲</a>\\<a href="' . URL::index("&l_op=viewlink&cid={$cid}&orderby=hitsd") . '">▼</a>)' . '<br /><b>' . _SITESSORTED . ': ' . $orderbyTrans . '</b></p><br />'; $result = $db->sql_query("SELECT lid, title, description, date, hits, linkratingsummary, totalvotes, totalcomments from " . $linksprefix . "_links where cid={$cid} order by {$orderby} limit {$min}, {$perpage}"); $fullcountresult = $db->sql_query("SELECT COUNT(*) FROM " . $linksprefix . "_links WHERE cid={$cid}"); list($totalselectedlinks) = $db->sql_fetchrow($fullcountresult); $x = 0; while (list($lid, $title, $description, $time, $hits, $linkratingsummary, $totalvotes, $totalcomments) = $db->sql_fetchrow($result)) { $linkratingsummary = number_format($linkratingsummary, $weblinks_config['mainvotedecimal']); echo '<p style="margin-top:0; text-align:left; float:left; width:70%;">► <a class="option" href="' . URL::index('&l_op=visit&lid=' . $lid) . '" target="_blank">' . $title . '</a>'; $datetime = formatDateTime($time . ' 00:00:00', _DATESTRING3); newlinkgraphic($datetime); popgraphic($hits); $transfertitle = ereg_replace(' ', '_', $title); echo '<br />'; echo '<b>' . _DESCRIPTION . "</b>: {$description}<br /><br />"; if (can_admin('web_links')) { echo '<a href="' . URL::admin('&mode=linksmodlink&lid=' . $lid) . '">' . _EDIT . '</a> | '; } echo '<a href="' . URL::index('&l_op=ratelink&lid=' . $lid . '&ttitle=' . $transfertitle) . '">' . _RATESITE . '</a>'; if (is_user()) { echo ' | <a href="' . URL::index('&l_op=brokenlink&lid=' . $lid) . '">' . _REPORTBROKEN . '</a>'; } if ($totalvotes != 0) { echo ' | <a href="' . URL::index('&l_op=viewlinkdetails&lid=' . $lid . '&ttitle=' . $transfertitle) . '">' . _DETAILS . '</a>'; } if ($totalcomments != 0) { echo ' | <a href="' . URL::index('&l_op=viewlinkcomments&lid=' . $lid . '&ttitle=' . $transfertitle) . '">' . _SCOMMENTS . ' (' . $totalcomments . ')</a>'; } detecteditorial($lid, $transfertitle); echo '</p>'; echo '<p style="text-align:left; float:right; border:2px solid ' . $bgcolor2 . '; background:' . $bgcolor3 . ';">'; echo '<b>' . _ADDEDON . "</b>: {$datetime} <br /><b>" . _HITS . "</b>: {$hits}<br />"; $transfertitle = str_replace(' ', '_', $title); /* voting & comments stats */ $votestring = $totalvotes == 1 ? _VOTE : _VOTES; if ($linkratingsummary != '0' || $linkratingsummary != '0.0') { echo '<b>' . _RATING . "</b>: {$linkratingsummary} ({$totalvotes} {$votestring})"; } echo '<br />'; echo '</p>'; echo '<hr style="clear:both; width:100%;" />'; $x++; } $orderby = isset($_GET['orderby']) ? convertorderbyout($_GET['orderby']) : 'title ASC'; /* Calculates how many pages exist. Which page one should be on, etc... */ $linkpagesint = $totalselectedlinks / $perpage; $linkpageremainder = $totalselectedlinks % $perpage; if ($linkpageremainder != 0) { $linkpages = ceil($linkpagesint); if ($totalselectedlinks < $perpage) { $linkpageremainder = 0; } } else { $linkpages = $linkpagesint; } $result2 = $db->sql_query("SELECT cid, title, cdescription FROM " . $linksprefix . "_categories WHERE parentid={$cid} ORDER BY title"); $count = 0; $dum = 0; if ($db->sql_numrows($result2)) { echo '<br /><b>' . _USUBCATEGORIES . '</b>'; } while (list($cid2, $title2, $cdescription2) = $db->sql_fetchrow($result2)) { echo '<p class="option" style="margin-left:5px;"><b>•</b> <a href="' . URL::index('&l_op=viewlink&cid=' . $cid2) . '"><b>' . $title2 . '</b></a>'; categorynewlinkgraphic($cid2); if ($cdescription2) { echo '<br /><span style="margin-left:5px;" class="content">' . $cdescription2 . '</span>'; } echo '</p>'; $result3 = $db->sql_query("SELECT cid, title FROM " . $linksprefix . "_categories WHERE parentid={$cid2} ORDER BY title LIMIT 0,{$weblinks_config['subcats']}"); $space = 0; while (list($cid3, $title3) = $db->sql_fetchrow($result3)) { if ($space > 0) { echo '<br />'; } echo '<p style="margin:0 0 0 15px;" class="content"><b>•</b> <a href="' . URL::index('&l_op=viewlink&cid=' . $cid3) . '">' . $title3 . '</a></p>'; $space++; } } /* Page Numbering */ if ($linkpages != 1 && $linkpages != 0) { echo '<br /><br />'; echo _SELECTPAGE . ': '; $prev = $min - $perpage; if ($prev >= 0) { echo ' <b>[ <a href="' . URL::index("&l_op=viewlink&cid={$cid}&min={$prev}&orderby={$orderby}&show={$show}") . '">'; echo ' « ' . _PREVIOUSPAGE . '</a> ]</b> '; } $counter = 1; $currentpage = $max / $perpage; while ($counter <= $linkpages) { $cpage = $counter; $mintemp = $perpage * $counter - $perpage; if ($counter == $currentpage) { echo "<b>{$counter}</b> "; } else { echo "<a href=\"" . URL::index("&l_op=viewlink&cid={$cid}&min={$mintemp}&orderby={$orderby}&show={$show}") . "\">{$counter}</a> "; } $counter++; } $next = $min + $perpage; if ($x >= $perpage) { echo ' <b>[ <a href="' . URL::index("&l_op=viewlink&cid={$cid}&min={$max}&orderby={$orderby}&show={$show}") . '">'; echo ' ' . _NEXTPAGE . ' »</a> ]</b> '; } } echo '<br /></div>'; CloseTable(); }