log.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /*
  3. [UCenter] (C)2001-2099 Comsenz Inc.
  4. This is NOT a freeware, use is subject to license terms
  5. $Id: log.php 1059 2011-03-01 07:25:09Z monkey $
  6. */
  7. !defined('IN_UC') && exit('Access Denied');
  8. class control extends adminbase {
  9. function __construct() {
  10. $this->control();
  11. }
  12. function control() {
  13. parent::__construct();
  14. $this->check_priv();
  15. if(!$this->user['isfounder'] && !$this->user['allowadminlog']) {
  16. $this->message('no_permission_for_this_module');
  17. }
  18. $this->check_priv();
  19. }
  20. function onls() {
  21. $logdir = UC_ROOT.'data/logs/';
  22. $dir = opendir($logdir);
  23. $logs = $loglist = array();
  24. while($entry = readdir($dir)) {
  25. if(is_file($logdir.$entry) && strpos($entry, '.php') !== FALSE) {
  26. $logs = array_merge($logs, file($logdir.$entry));
  27. }
  28. }
  29. closedir($dir);
  30. $logs = array_reverse($logs);
  31. foreach($logs AS $k => $v) {
  32. if(count($v = explode("\t", $v)) > 1) {
  33. $v[3] = $this->date($v[3]);
  34. $v[4] = $this->lang[$v[4]];
  35. $loglist[$k] = $v;
  36. }
  37. }
  38. $page = max(1, intval($_GET['page']));
  39. $start = ($page - 1) * UC_PPP;
  40. $num = count($loglist);
  41. $multipage = $this->page($num, UC_PPP, $page, 'admin.php?m=log&a=ls');
  42. $loglist = array_slice($loglist, $start, UC_PPP);
  43. $this->view->assign('loglist', $loglist);
  44. $this->view->assign('multipage', $multipage);
  45. $this->view->display('admin_log');
  46. }
  47. }
  48. ?>