modcp_home.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: modcp_home.php 25246 2011-11-02 03:34:53Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ') || !defined('IN_MODCP')) {
  9. exit('Access Denied');
  10. }
  11. if($op == 'addnote' && submitcheck('submit')) {
  12. $newaccess = 4 + ($_GET['newaccess'][2] << 1) + $_GET['newaccess'][3];
  13. $newexpiration = TIMESTAMP + (intval($_GET['newexpiration']) > 0 ? intval($_GET['newexpiration']) : 30) * 86400;
  14. $newmessage = nl2br(dhtmlspecialchars(trim($_GET['newmessage'])));
  15. if($newmessage != '') {
  16. C::t('common_adminnote')->insert(array(
  17. 'admin' => $_G['username'],
  18. 'access' => $newaccess,
  19. 'adminid' => $_G['adminid'],
  20. 'dateline' => $_G['timestamp'],
  21. 'expiration' => $newexpiration,
  22. 'message' => $newmessage,
  23. ));
  24. }
  25. }
  26. if($op == 'delete' && submitcheck('notlistsubmit')) {
  27. if(is_array($_GET['delete']) && $deleteids = dimplode($_GET['delete'])) {
  28. C::t('common_adminnote')->delete($_GET['delete'], ($_G['adminid'] == 1 ? '' : $_G['username']));
  29. }
  30. }
  31. switch($_G['adminid']) {
  32. case 1: $access = '1,2,3,4,5,6,7'; break;
  33. case 2: $access = '2,3,6,7'; break;
  34. default: $access = '1,3,5,7'; break;
  35. }
  36. $notelist = array();
  37. foreach(C::t('common_adminnote')->fetch_all_by_access(explode(',', $access)) as $note) {
  38. if($note['expiration'] < TIMESTAMP) {
  39. C::t('common_adminnote')->delete($note['id']);
  40. } else {
  41. $note['expiration'] = ceil(($note['expiration'] - $note['dateline']) / 86400);
  42. $note['dateline'] = dgmdate($note['dateline']);
  43. $note['checkbox'] = '<input type="checkbox" name="delete[]" class="pc" '.($note['admin'] == $_G['member']['username'] || $_G['adminid'] == 1 ? "value=\"$note[id]\"" : 'disabled').'>';
  44. $note['admin'] = '<a href="home.php?mod=space&username='.rawurlencode($note['admin']).'" target="_blank">'.$note['admin'].'</a>';
  45. $notelist[] = $note;
  46. }
  47. }
  48. ?>