These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * |
||
4 | * Module: WF-Links |
||
5 | * Version: v1.0.3 |
||
6 | * Release Date: 21 June 2005 |
||
7 | * Developer: John N |
||
8 | * Team: WF-Projects |
||
9 | * Licence: GNU |
||
10 | */ |
||
11 | |||
12 | require_once __DIR__ . '/header.php'; |
||
13 | |||
14 | $GLOBALS['xoopsOption']['template_main'] = 'wflinks_topten.tpl'; |
||
15 | include XOOPS_ROOT_PATH . '/header.php'; |
||
16 | |||
17 | $mytree = new WflinksXoopsTree($xoopsDB->prefix('wflinks_cat'), 'cid', 'pid'); |
||
18 | |||
19 | $action_array = array('hit' => 0, 'rate' => 1); |
||
20 | $list_array = array('hits', 'rating'); |
||
21 | $lang_array = array(_MD_WFL_HITS, _MD_WFL_RATING); |
||
22 | $rankings = array(); |
||
23 | |||
24 | $sort = (isset($_GET['list']) && in_array($_GET['list'], $action_array)) ? $_GET['list'] : 'rate'; |
||
25 | $sort_arr = $action_array[$sort]; |
||
26 | $sortDB = $list_array[$sort_arr]; |
||
27 | |||
28 | $catarray['imageheader'] = wfl_imageheader(); |
||
29 | $catarray['letters'] = wfl_letters(); |
||
30 | $catarray['toolbar'] = wfl_toolbar(); |
||
31 | $xoopsTpl->assign('catarray', $catarray); |
||
32 | |||
33 | $arr = array(); |
||
34 | $result = $xoopsDB->query('SELECT cid, title, pid FROM ' . $xoopsDB->prefix('wflinks_cat') . ' WHERE pid=0 ORDER BY ' . $xoopsModuleConfig['sortcats']); |
||
35 | |||
36 | $e = 0; |
||
37 | while (list($cid, $ctitle) = $xoopsDB->fetchRow($result)) { |
||
38 | if (true == wfl_checkgroups($cid)) { |
||
0 ignored issues
–
show
|
|||
39 | $query = 'SELECT lid, cid, title, hits, rating, votes FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE published > 0 AND published <= ' . time() . ' AND (expired = 0 OR expired > ' . time() . ') AND offline = 0 AND (cid=' . (int)$cid; |
||
40 | $arr = $mytree->getAllChildId($cid); |
||
41 | for ($i = 0, $iMax = count($arr); $i < $iMax; ++$i) { |
||
42 | $query .= ' or cid=' . $arr[$i] . ''; |
||
43 | } |
||
44 | $query .= ') order by ' . $sortDB . ' DESC'; |
||
45 | $result2 = $xoopsDB->query($query, 10, 0); |
||
46 | $filecount = $xoopsDB->getRowsNum($result2); |
||
47 | |||
48 | if ($filecount > 0) { |
||
49 | $rankings[$e]['title'] = $wfmyts->htmlSpecialCharsStrip($ctitle); |
||
50 | $rank = 1; |
||
51 | while (list($did, $dcid, $dtitle, $hits, $rating, $votes) = $xoopsDB->fetchRow($result2)) { |
||
52 | $catpath = basename($mytree->getPathFromId($dcid, 'title')); |
||
53 | $dtitle = $wfmyts->htmlSpecialCharsStrip($dtitle); |
||
54 | $rankings[$e]['file'][] = array( |
||
55 | 'id' => $did, |
||
56 | 'cid' => $dcid, |
||
57 | 'rank' => $rank, |
||
58 | 'title' => $dtitle, |
||
59 | 'category' => $catpath, |
||
60 | 'hits' => $hits, |
||
61 | 'rating' => number_format($rating, 2), |
||
62 | 'votes' => $votes |
||
63 | ); |
||
64 | ++$rank; |
||
65 | } |
||
66 | ++$e; |
||
67 | } |
||
68 | } |
||
69 | } |
||
70 | $xoopsTpl->assign('back', '<a href="javascript:history.go(-1)"><img src="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/icon/back.png"></a>'); |
||
71 | $xoopsTpl->assign('lang_sortby', $lang_array[$sort_arr]); |
||
72 | $xoopsTpl->assign('rankings', $rankings); |
||
73 | $xoopsTpl->assign('module_dir', $xoopsModule->getVar('dirname')); |
||
74 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
75 |
When comparing two booleans, it is generally considered safer to use the strict comparison operator.