notice_help.php 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. if(!DEFINED('EGP'))
  3. exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
  4. class notice_help extends cron
  5. {
  6. function __construct()
  7. {
  8. global $cfg, $sql, $start_point;
  9. $time = $start_point-3600;
  10. $helps = $sql->query('SELECT `id`, `user`, `time` FROM `help` WHERE `status`="0" AND `time`<"'.$time.'" AND `notice`="0" AND `close`="0"');
  11. while($help = $sql->get($helps))
  12. {
  13. $sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$help['user'].'" AND `time`<"'.$help['time'].'" AND `notice_help`="1" LIMIT 1');
  14. if(!$sql->num())
  15. continue;
  16. $user = $sql->get();
  17. if(!sys::mail('Техническая поддержка', sys::updtext(sys::text('mail', 'notice_help'), array('site' => $cfg['name'], 'url' => $cfg['http'].'help/section/dialog/id/'.$help['id'])), $user['mail']))
  18. continue;
  19. $sql->query('UPDATE `help` set `notice`="1" WHERE `id`="'.$help['id'].'" LIMIT 1');
  20. }
  21. return NULL;
  22. }
  23. }
  24. ?>