人人商城

notify.ctrl.php 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. load()->func('communication');
  8. $dos = array('mail');
  9. $do = in_array($do, $dos) ? $do : 'mail';
  10. permission_check_account_user('profile_setting');
  11. $_W['page']['title'] = '邮件通知参数配置';
  12. if ($do == 'mail') {
  13. if (checksubmit('submit')) {
  14. $notify['mail'] = array(
  15. 'username' => $_GPC['username'],
  16. 'password' => $_GPC['password'],
  17. 'smtp' => $_GPC['smtp'],
  18. 'sender' => $_GPC['sender'],
  19. 'signature' => $_GPC['signature'],
  20. );
  21. $setting = array('notify' => iserializer($notify));
  22. $original_setting = uni_setting_load('notify');
  23. pdo_update('uni_settings', $setting, array('uniacid' => $_W['uniacid']));
  24. $result = ihttp_email($notify['mail']['username'], $_W['account']['name'] . '验证邮件'.date('Y-m-d H:i:s'), '如果您收到这封邮件则表示您系统的发送邮件配置成功!');
  25. if (is_error($result)) {
  26. $setting = iserializer($original_setting);
  27. pdo_update('uni_settings', $setting, array('uniacid' => $_W['uniacid']));
  28. itoast('配置失败,请检查配置信息', url('profile/notify'), 'info');
  29. } else {
  30. cache_delete(cache_system_key('unisetting', array('uniacid' => $_W['uniacid'])));
  31. itoast('配置成功!', url('profile/notify',array('do' => 'mail')), 'success');
  32. }
  33. }
  34. $notify_setting = uni_setting_load('notify');
  35. $mail_setting = empty($notify_setting['notify']['mail'])? array() : $notify_setting['notify']['mail'];
  36. }
  37. template('profile/notify');