1<?php 2/** 3 * @package tikiwiki 4 */ 5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 6// 7// All Rights Reserved. See copyright.txt for details and a complete list of authors. 8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 9// $Id$ 10 11require_once('tiki-setup.php'); 12include_once('lib/rankings/ranklib.php'); 13$access->check_feature(['feature_file_galleries','feature_file_galleries_rankings']); 14 15if ((isset($tiki_p_list_file_galleries) && $tiki_p_list_file_galleries != 'y') || (! isset($tiki_p_list_file_galleries) && $tiki_p_view_file_gallery != 'y')) { 16 $smarty->assign('errortype', 401); 17 $smarty->assign('msg', tra("You do not have permission to view this section")); 18 $smarty->display("error.tpl"); 19 die; 20} 21 22$allrankings = [ 23 [ 24 'name' => tra('Most-visited file galleries'), 25 'value' => 'filegal_ranking_top_galleries' 26 ], 27 [ 28 'name' => tra('Most downloaded files'), 29 'value' => 'filegal_ranking_top_files' 30 ], 31 [ 32 'name' => tra('Last files'), 33 'value' => 'filegal_ranking_last_files' 34 ], 35]; 36 37$smarty->assign('allrankings', $allrankings); 38 39if (! isset($_REQUEST["which"])) { 40 $which = 'filegal_ranking_top_files'; 41} else { 42 $which = $_REQUEST["which"]; 43} 44 45$smarty->assign('which', $which); 46 47// Get the page from the request var or default it to HomePage 48if (! isset($_REQUEST["limit"])) { 49 $limit = 10; 50} else { 51 $limit = $_REQUEST["limit"]; 52} 53 54$smarty->assign_by_ref('limit', $limit); 55 56// Rankings: 57// Top Pages 58// Last pages 59// Top Authors 60$rankings = []; 61 62$rk = $ranklib->$which($limit); 63$rank["data"] = $rk["data"]; 64$rank["title"] = $rk["title"]; 65$rank["y"] = $rk["y"]; 66$rank["type"] = $rk["type"]; 67$rankings[] = $rank; 68 69$smarty->assign_by_ref('rankings', $rankings); 70$smarty->assign('rpage', 'tiki-file_galleries_rankings.php'); 71ask_ticket('fgal-rankings'); 72 73// Display the template 74$smarty->assign('mid', 'tiki-ranking.tpl'); 75$smarty->display("tiki.tpl"); 76