mail.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /*
  3. [UCenter] (C)2001-2099 Comsenz Inc.
  4. This is NOT a freeware, use is subject to license terms
  5. $Id: mail.php 1059 2011-03-01 07:25:09Z monkey $
  6. */
  7. !defined('IN_UC') && exit('Access Denied');
  8. class control extends adminbase {
  9. var $apps = array();
  10. var $operations = array();
  11. function __construct() {
  12. $this->control();
  13. }
  14. function control() {
  15. parent::__construct();
  16. $this->check_priv();
  17. $this->load('mail');
  18. $this->check_priv();
  19. }
  20. function onls() {
  21. $page = getgpc('page');
  22. $delete = getgpc('delete', 'P');
  23. $status = 0;
  24. if(!empty($delete)) {
  25. $_ENV['mail']->delete_mail($delete);
  26. $status = 2;
  27. $this->writelog('mail_delete', "delete=".implode(',', $delete));
  28. }
  29. $num = $_ENV['mail']->get_total_num();
  30. $maillist = $_ENV['mail']->get_list($page, UC_PPP, $num);
  31. $multipage = $this->page($num, UC_PPP, $page, 'admin.php?m=mail&a=ls');
  32. $this->view->assign('status', $status);
  33. $this->view->assign('maillist', $maillist);
  34. $this->view->assign('multipage', $multipage);
  35. $this->view->display('admin_mail');
  36. }
  37. function onsend() {
  38. $mailid = intval(getgpc('mailid'));
  39. $result = $_ENV['mail']->send_by_id($mailid);
  40. if($result) {
  41. $this->writelog('mail_send', "appid=$appid&noteid=$noteid");
  42. $this->message('mail_succeed', $_SERVER['HTTP_REFERER']);
  43. } else {
  44. $this->writelog('mail_send', 'failed');
  45. $this->message('mail_false', $_SERVER['HTTP_REFERER']);
  46. }
  47. }
  48. function _note_status($status, $appid, $noteid, $args, $operation) {
  49. if($status > 0) {
  50. return '<font color="green">'.$this->lang['note_succeed'].'</font>';
  51. } elseif($status == 0) {
  52. $url = 'admin.php?m=note&a=send&appid='.$appid.'&noteid='.$noteid;
  53. return '<a href="'.$url.'" class="red">'.$this->lang['note_na'].'</a>';
  54. } elseif($status < 0) {
  55. $url = 'admin.php?m=note&a=send&appid='.$appid.'&noteid='.$noteid;
  56. return '<a href="'.$url.'"><font color="red">'.$this->lang['note_false'].(-$status).$this->lang['note_times'].'</font></a>';
  57. }
  58. }
  59. function _format_maillist(&$maillist) {
  60. if(is_array($maillist)) {
  61. foreach($maillist AS $key => $note) {
  62. $maillist[$key]['operation'] = $this->lang['note_'.$note['operation']];//$this->operations[$note['operation']][0];
  63. foreach($this->apps AS $appid => $app) {
  64. $maillist[$key]['status'][$appid] = $this->_note_status($note['app'.$appid], $appid, $note['noteid'], $note['args'], $note['operation']);
  65. }
  66. }
  67. }
  68. }
  69. }
  70. ?>