Copyright (c) 2007 Victor Vikene This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *********************************************************************************** */ include('init.php'); include($includedir . 'header.php'); /* Set the correct templatefile for the templatesystem */ $xtpl = new XTemplate('stats.xtpl',$tpldir); $db = new dbcon(); $db->query("SELECT * FROM `%sfiles` WHERE `private` != '1' ORDER BY `views` DESC LIMIT 0,10"); $rows = array(); $teller = 0; while ($item = mysql_fetch_array($db->result)) { $teller++; $rows[$teller] = array('ITEMVIEWS' => $item['views'], 'ITEMOWNER' => $item['owner'], 'ITEMID' => $item['id'], 'USERURL' => SHOWPROFILE . $item['owner'] ); } for ($i = 1; $i <= count($rows); $i++) { $xtpl->assign('NUMBER', $i); $xtpl->assign('ITEMVIEWS', $rows[$i]['ITEMVIEWS']); $xtpl->assign('ITEMOWNER', $rows[$i]['ITEMOWNER']); $xtpl->assign('ITEMID', $rows[$i]['ITEMID']); $xtpl->assign('USERURL', $rows[$i]['USERURL']); if(is_odd($i)) { $xtpl->assign('ODDOREVEN', 'odd'); } else { $xtpl->assign('ODDOREVEN', 'even'); } $xtpl->parse('main.table.row'); } // parse the table $xtpl->assign('TEXT_NUMBER', $lang['number']); $xtpl->assign('TEXT_SHOWS', $lang['shows']); $xtpl->assign('TEXT_URL', $lang['url']); $xtpl->parse('main.table'); $result = $db->query("SELECT SUM(`views`) AS `%stotal` FROM `files`"); $views = mysql_fetch_array($db->result); $tmp = preg_replace("/%c/", $views['total'], $lang['totalimageshowings']); $xtpl->assign('TEXT_ALLVIEWS', $tmp); /* Finally we parse the variables to the templatefile */ $xtpl->parse('main'); $xtpl->out('main'); include($includedir . 'tail.php'); ?>