function index() { global $ModPath, $ModStart, $links_DB; $lili = $links_DB; include "modules/{$ModPath}/links.conf.php"; include "header.php"; // Include cache manager global $SuperCache; if ($SuperCache) { $cache_obj = new cacheManager(); $cache_obj->startCachingPage(); } else { $cache_obj = new SuperCacheEmpty(); } if ($cache_obj->genereting_output == 1 or $cache_obj->genereting_output == -1 or !$SuperCache) { $mainlink = 'in_l'; menu($mainlink); SearchForm(); $filen = "modules/{$ModPath}/links.ban_01.php"; if (file_exists($filen)) { include $filen; } echo $lili . ' <table class="table table-bordered table-striped table-hover">'; $result = sql_query("SELECT cid, title, cdescription FROM " . $links_DB . "links_categories ORDER BY title"); if ($result) { while (list($cid, $title, $cdescription) = sql_fetch_row($result)) { $cresult = sql_query("SELECT lid FROM " . $links_DB . "links_links WHERE cid='{$cid}'"); $cnumrows = sql_num_rows($cresult); echo ' <tr> <td> <h4><a href="modules.php?ModStart=' . $ModStart . '&ModPath=' . $ModPath . '&op=viewlink&cid=' . $cid . '">' . aff_langue($title) . '</a> <span class="tag tag-default pull-right">' . $cnumrows . '</span></h4>'; categorynewlinkgraphic($cid); if ($cdescription) { echo ' <p>' . aff_langue($cdescription) . '</p>'; } $result2 = sql_query("SELECT sid, title FROM " . $links_DB . "links_subcategories WHERE cid='{$cid}' ORDER BY title {$subcat_limit}"); while (list($sid, $stitle) = sql_fetch_row($result2)) { $cresult3 = sql_query("SELECT lid FROM " . $links_DB . "links_links WHERE sid='{$sid}'"); $cnumrows = sql_num_rows($cresult3); echo ' <h5><a href="modules.php?ModStart=' . $ModStart . '&ModPath=' . $ModPath . '&op=viewslink&sid=' . $sid . '">' . aff_langue($stitle) . '</a> <span class="tag tag-default pull-right">' . $cnumrows . '</span></h5>'; } echo ' </td> </tr>'; } } echo ' </table>'; $result = sql_query("SELECT lid from " . $links_DB . "links_links"); if ($result) { $numrows = sql_num_rows($result); echo ' <p class="lead" align="center"><span>' . translate("There are") . ' <b>' . $numrows . '</b> ' . translate("Links in our Database") . ' <span class="btn btn-danger btn-sm" title="' . translate("New Links in this Category Added Today") . '" data-toggle="tooltip" >N</span> <span class="btn btn-success btn-sm" title="' . translate("New Links in this Category Added in the last 3 days") . '" data-toggle="tooltip" >N</span> <span class="btn btn-primary btn-sm" title="' . translate("New Links in this Category Added this week") . '" data-toggle="tooltip" >N</span> </p>'; } } if ($SuperCache) { $cache_obj->endCachingPage(); } global $admin; if ($admin) { $result = sql_query("SELECT requestid FROM " . $links_DB . "links_modrequest WHERE brokenlink=1"); if ($result) { $totalbrokenlinks = sql_num_rows($result); $result2 = sql_query("SELECT requestid FROM " . $links_DB . "links_modrequest WHERE brokenlink=0"); $totalmodrequests = sql_num_rows($result2); $result = sql_query("SELECT lid FROM " . $links_DB . "links_newlink"); $num = sql_num_rows($result); echo ' <div class="card card-block"> <a href="modules.php?ModStart=' . $ModStart . '&ModPath=' . $ModPath . '/admin"><i class="fa fa-cogs fa-2x" title="Admin" data-toggle="tooltip"></i></a> ' . translate("Waiting Links") . ' : <span class="tag tag-danger" title="' . translate("Links Waiting for Validation") . '" data-toggle="tooltip">' . $num . '</span> <span class="tag tag-danger" title="' . translate("User Reported Broken Links") . '" data-toggle="tooltip">' . $totalbrokenlinks . '</span> <span class="tag tag-danger" title="' . translate("Request Link Modification") . '" data-toggle="tooltip">' . $totalmodrequests . '</span> '; if ($links_DB != '') { echo 'Ref Tables => <strong>' . $links_DB . '</strong>'; } echo ' </div>'; } else { echo "<p align=\"center\"><span> -: [ <a href=\"modules.php?ModStart=create_tables&ModPath={$ModPath}/admin/\">" . translate("Create") . "</a> Tables : {$links_DB} ] :-</span></p>"; } } 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 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(); }