| 1 |
<?php
|
| 2 |
|
| 3 |
// $Header: /cvsroot/tikiwiki/tiki/tiki-referer_stats.php,v 1.9.2.3 2005/01/05 19:45:28 jburleyebuilt Exp $
|
| 4 |
|
| 5 |
// Copyright (c) 2002-2005, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
|
| 6 |
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
|
| 7 |
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
|
| 8 |
|
| 9 |
// Initialization
|
| 10 |
require_once ('tiki-setup.php');
|
| 11 |
|
| 12 |
include_once ('lib/refererstats/refererlib.php');
|
| 13 |
|
| 14 |
if ($feature_referer_stats != 'y') {
|
| 15 |
$smarty->assign('msg', tra("This feature is disabled").": feature_referer_stats");
|
| 16 |
|
| 17 |
$smarty->display("error.tpl");
|
| 18 |
die;
|
| 19 |
}
|
| 20 |
|
| 21 |
if ($tiki_p_view_referer_stats != 'y') {
|
| 22 |
$smarty->assign('msg', tra("You do not have permission to use this feature"));
|
| 23 |
|
| 24 |
$smarty->display("error.tpl");
|
| 25 |
die;
|
| 26 |
}
|
| 27 |
|
| 28 |
if (isset($_REQUEST["clear"])) {
|
| 29 |
$area = 'delrefstats';
|
| 30 |
if ($feature_ticketlib2 != 'y' or (isset($_POST['daconfirm']) and isset($_SESSION["ticket_$area"]))) {
|
| 31 |
key_check($area);
|
| 32 |
$refererlib->clear_referer_stats();
|
| 33 |
} else {
|
| 34 |
key_get($area);
|
| 35 |
}
|
| 36 |
}
|
| 37 |
|
| 38 |
/*
|
| 39 |
if($tiki_p_take_quiz != 'y') {
|
| 40 |
$smarty->assign('msg',tra("You do not have permission to use this feature"));
|
| 41 |
$smarty->display("error.tpl");
|
| 42 |
die;
|
| 43 |
}
|
| 44 |
*/
|
| 45 |
if (!isset($_REQUEST["sort_mode"])) {
|
| 46 |
$sort_mode = 'hits_desc';
|
| 47 |
} else {
|
| 48 |
$sort_mode = $_REQUEST["sort_mode"];
|
| 49 |
}
|
| 50 |
|
| 51 |
if (!isset($_REQUEST["offset"])) {
|
| 52 |
$offset = 0;
|
| 53 |
} else {
|
| 54 |
$offset = $_REQUEST["offset"];
|
| 55 |
}
|
| 56 |
|
| 57 |
$smarty->assign_by_ref('offset', $offset);
|
| 58 |
|
| 59 |
if (isset($_REQUEST["find"])) {
|
| 60 |
$find = $_REQUEST["find"];
|
| 61 |
} else {
|
| 62 |
$find = '';
|
| 63 |
}
|
| 64 |
|
| 65 |
$smarty->assign('find', $find);
|
| 66 |
|
| 67 |
$smarty->assign_by_ref('sort_mode', $sort_mode);
|
| 68 |
$channels = $refererlib->list_referer_stats($offset, $maxRecords, $sort_mode, $find);
|
| 69 |
|
| 70 |
$cant_pages = ceil($channels["cant"] / $maxRecords);
|
| 71 |
$smarty->assign_by_ref('cant_pages', $cant_pages);
|
| 72 |
$smarty->assign('actual_page', 1 + ($offset / $maxRecords));
|
| 73 |
|
| 74 |
if ($channels["cant"] > ($offset + $maxRecords)) {
|
| 75 |
$smarty->assign('next_offset', $offset + $maxRecords);
|
| 76 |
} else {
|
| 77 |
$smarty->assign('next_offset', -1);
|
| 78 |
}
|
| 79 |
|
| 80 |
// If offset is > 0 then prev_offset
|
| 81 |
if ($offset > 0) {
|
| 82 |
$smarty->assign('prev_offset', $offset - $maxRecords);
|
| 83 |
} else {
|
| 84 |
$smarty->assign('prev_offset', -1);
|
| 85 |
}
|
| 86 |
|
| 87 |
$smarty->assign_by_ref('channels', $channels["data"]);
|
| 88 |
|
| 89 |
ask_ticket('referer-stats');
|
| 90 |
|
| 91 |
// Display the template
|
| 92 |
$smarty->assign('mid', 'tiki-referer_stats.tpl');
|
| 93 |
$smarty->display("tiki.tpl");
|
| 94 |
|
| 95 |
?>
|