SysController.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. session_start(); // starts new or resumes existing session
  3. Doo::loadModelAt('aconfig', 'admin');
  4. Doo::loadModelAt('auser', 'admin');
  5. Doo::loadClass('mailer');
  6. /*
  7. * To change this license header, choose License Headers in Project Properties.
  8. * To change this template file, choose Tools | Templates
  9. * and open the template in the editor.
  10. */
  11. // 列表停用 编辑 重置密码
  12. // 管理员权限管理
  13. // 管理员修改密码
  14. class SysController extends DooController {
  15. private $data, $aconfig, $auser, $profile, $ph, $userz, $mailer;
  16. public function beforeRun($resource, $action) {
  17. if (!isset($_SESSION['auid'])) {
  18. return Doo::conf()->APP_URL . 'manage';
  19. }
  20. }
  21. public function __construct() {
  22. $this->aconfig = new AConfig();
  23. $this->auser = new AUser();
  24. $this->mailer = new Mailer();
  25. $this->data['rootUrl'] = Doo::conf()->APP_URL;
  26. }
  27. function sysinfo() {
  28. if (isset($_POST['proname']) || isset($_POST['aemail'])) {
  29. if ($_POST['proname']) {
  30. $this->aconfig->proname = $_POST['proname'];
  31. $this->aconfig->update(array('where' => 'conid = 1'));
  32. }
  33. if ($_POST['aemail'] && filter_var($_POST['aemail'], FILTER_VALIDATE_EMAIL)) {
  34. $this->auser->aemail = $_POST['aemail'];
  35. $this->auser->update(array('where' => 'auid = 1'));
  36. $this->mailer->setEmails($_POST['aemail']);
  37. $this->mailer->seteTitle('管理员邮箱地址已修改');
  38. $this->mailer->setClientName($_SESSION['aname']);
  39. $signupConfigStr = '<h3>管理员邮箱地址已修改</h3><p><h2>' . $_POST['aemail'] . '</h2></p>';
  40. $this->mailer->setContent($signupConfigStr);
  41. $this->mailer->send_mail();
  42. }
  43. return Doo::conf()->APP_URL . 'manage/sys/info';
  44. }
  45. $this->data['proName'] = $this->aconfig->getOne(array('select' => 'proName', 'asArray' => TRUE))['proName'];
  46. $this->data['aemail'] = $this->aconfig->getOne(array('select' => 'aemail', 'asArray' => TRUE))['aemail'];
  47. $this->data['ver'] = DOO::conf()->ver;
  48. $this->data['aname'] = $_SESSION['aname'];
  49. $this->render('admin-sysinfo', $this->data, TRUE);
  50. }
  51. }