history.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. /* $Id: history.php 2899 2007-04-14 15:01:32Z b4rt $ */
  3. /*******************************************************************************
  4. LICENSE
  5. This program is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU General Public License (GPL)
  7. as published by the Free Software Foundation; either version 2
  8. of the License, or (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. To read the license please visit http://www.gnu.org/copyleft/gpl.html
  14. *******************************************************************************/
  15. // prevent direct invocation
  16. if ((!isset($cfg['user'])) || (isset($_REQUEST['cfg']))) {
  17. @ob_end_clean();
  18. @header("location: ../../index.php");
  19. exit();
  20. }
  21. /******************************************************************************/
  22. // init template-instance
  23. tmplInitializeInstance($cfg["theme"], "page.history.tmpl");
  24. // prepare vars
  25. $offset = 50;
  26. $inx = 0;
  27. $min = 0;
  28. if (isset($_REQUEST['min']))
  29. $min = tfb_getRequestVar('min');
  30. $max = $min + $offset;
  31. if ($cfg['enable_restrictivetview'] == 0) {
  32. $sql = "SELECT user_id, file, time FROM tf_log WHERE action=".$db->qstr($cfg["constants"]["url_upload"])." OR action=".$db->qstr($cfg["constants"]["file_upload"])." ORDER BY time desc";
  33. } else {
  34. $sql = ($cfg['isAdmin'])
  35. ? "SELECT user_id, file, time FROM tf_log WHERE action=".$db->qstr($cfg["constants"]["url_upload"])." OR action=".$db->qstr($cfg["constants"]["file_upload"])." ORDER BY time desc"
  36. : "SELECT user_id, file, time FROM tf_log WHERE user_id=".$db->qstr($cfg["user"])." AND ( action=".$db->qstr($cfg["constants"]["url_upload"])." OR action=".$db->qstr($cfg["constants"]["file_upload"])." ) ORDER BY time desc";
  37. }
  38. $result = $db->SelectLimit($sql, $offset, $min);
  39. $file_result = array();
  40. while (list($user_id, $file, $time) = $result->FetchRow()) {
  41. $user_icon = (IsOnline($user_id)) ? "themes/".$cfg['theme']."/images/user.gif" : "themes/".$cfg['theme']."/images/user_offline.gif";
  42. array_push($file_result, array(
  43. 'user_id' => $user_id,
  44. 'user_icon' => $user_icon,
  45. 'file' => $file,
  46. 'date' => date($cfg['_DATETIMEFORMAT'], $time)
  47. )
  48. );
  49. $inx++;
  50. }
  51. // define vars
  52. if ($inx == 0) {
  53. $tmpl->setvar('inx', 1);
  54. $tmpl->setvar('_NORECORDSFOUND', $cfg['_NORECORDSFOUND']);
  55. }
  56. $tmpl->setloop('file_result', $file_result);
  57. $prev = ($min-$offset);
  58. if ($prev >= 0) {
  59. $tmpl->setvar('prevlink', 1);
  60. $prevlink = 1;
  61. } else {
  62. $tmpl->setvar('prevlink', 0);
  63. $prevlink = 0;
  64. }
  65. $next=$min+$offset;
  66. if ($inx >= $offset) {
  67. $tmpl->setvar('morelink', 1);
  68. $morelink = 1;
  69. } else {
  70. $tmpl->setvar('morelink', 0);
  71. $morelink = 0;
  72. }
  73. $tmpl->setvar('empty', 0);
  74. if (!empty($prevlink) && !empty($morelink))
  75. $tmpl->setvar('empty', 1);
  76. elseif ((!empty($prevlink)) && (empty($morelink)))
  77. $tmpl->setvar('empty', 2);
  78. elseif ((!empty($morelink)) && (empty($prevlink)))
  79. $tmpl->setvar('empty', 3);
  80. //
  81. $tmpl->setvar('prev', $prev);
  82. $tmpl->setvar('min', $min);
  83. $tmpl->setvar('max', $max);
  84. $tmpl->setvar('days_to_keep', $cfg["days_to_keep"]);
  85. //
  86. $tmpl->setvar('_SHOWPREVIOUS', $cfg['_SHOWPREVIOUS']);
  87. $tmpl->setvar('_SHOWMORE', $cfg['_SHOWMORE']);
  88. $tmpl->setvar('_UPLOADACTIVITY', $cfg['_UPLOADACTIVITY']);
  89. $tmpl->setvar('_DAYS', $cfg['_DAYS']);
  90. $tmpl->setvar('_USER', $cfg['_USER']);
  91. $tmpl->setvar('_FILE', $cfg['_FILE']);
  92. $tmpl->setvar('_TIMESTAMP', $cfg['_TIMESTAMP']);
  93. //
  94. $tmpl->setvar('table_admin_border', $cfg["table_admin_border"]);
  95. //
  96. tmplSetTitleBar($cfg["pagetitle"].' - '.$cfg['_UPLOADHISTORY']);
  97. tmplSetFoot();
  98. tmplSetIidVars();
  99. // parse template
  100. $tmpl->pparse();
  101. ?>