| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 | <?phpini_set('display_errors', 1);session_start(); // starts new or resumes existing sessionDoo::loadModelAt('aconfig', 'admin');Doo::loadModelAt('auser', 'admin');Doo::loadClass('mailer');/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */// 列表停用 编辑 重置密码// 管理员权限管理// 管理员修改密码class SysController extends DooController{    private $data, $aconfig, $auser, $profile, $ph, $userz, $mailer;    public function beforeRun($resource, $action)    {        if (!isset($_SESSION['auid'])) {            return Doo::conf()->APP_URL . 'manage';        }    }    public function __construct()    {        $this->aconfig = new AConfig();        $this->auser = new AUser();        $this->mailer = new Mailer();        $this->data['rootUrl'] = Doo::conf()->APP_URL;    }    function sysinfo()    {        if (isset($_POST['proname']) || isset($_POST['aemail'])) {            if ($_POST['proname']) {                $this->aconfig->proname = $_POST['proname'];                $this->aconfig->update(array('where' => 'conid = 1'));            }            if ($_POST['aemail'] && filter_var($_POST['aemail'], FILTER_VALIDATE_EMAIL)) {                $this->auser->aemail = $_POST['aemail'];                $this->auser->update(array('where' => 'auid = 1'));                $this->mailer->setEmails($_POST['aemail']);                $this->mailer->seteTitle('管理员邮箱地址已修改');                $this->mailer->setClientName($_SESSION['aname']);                $signupConfigStr = '<h3>管理员邮箱地址已修改</h3><p><h2>' . $_POST['aemail'] . '</h2></p>';                $this->mailer->setContent($signupConfigStr);                $this->mailer->send_mail();            }            return Doo::conf()->APP_URL . 'manage/sys/info';        }        $this->data['proName'] = $this->aconfig->getOne(array('select' => 'proName', 'asArray' => TRUE))['proName'];        $this->data['aemail'] = $this->auser->getOne(array('select' => 'aemail', 'asArray' => TRUE))['aemail'];        $this->data['ver'] = DOO::conf()->ver;        $this->data['aname'] = $_SESSION['aname'];        $this->data['menu'] = 1;        $this->render('admin-sysinfo', $this->data, TRUE);    }    function smsSwitch()    {        if (isset($_POST['switch'])) {            if ($_POST['switch'] == 'off') {                $this->aconfig->smsswitch = 0;                if ($this->aconfig->update(array('where' => "conid = 1")) > 0)                    exit(json_encode(array('switch' => 'off')));            }            if ($_POST['switch'] == 'on') {                $this->aconfig->smsswitch = 1;                if ($this->aconfig->update(array('where' => "conid = 1")) > 0)                    exit(json_encode(array('switch' => 'on')));            }        }        $this->data['smsSwitch'] = $this->aconfig->getOne(array('select' => 'smsswitch', 'asArray' => TRUE))['smsswitch'];        $this->data['menu'] = 4;        $this->render('admin-sms', $this->data, TRUE);    }}
 |