|
@@ -16,17 +16,20 @@ Doo::loadClass('mailer');
|
|
// 列表停用 编辑 重置密码
|
|
// 列表停用 编辑 重置密码
|
|
// 管理员权限管理
|
|
// 管理员权限管理
|
|
// 管理员修改密码
|
|
// 管理员修改密码
|
|
-class AdminController extends DooController {
|
|
|
|
|
|
+class AdminController extends DooController
|
|
|
|
+{
|
|
|
|
|
|
private $data, $users, $user, $profile, $ph, $userz, $mailer;
|
|
private $data, $users, $user, $profile, $ph, $userz, $mailer;
|
|
|
|
|
|
- public function beforeRun($resource, $action) {
|
|
|
|
|
|
+ public function beforeRun($resource, $action)
|
|
|
|
+ {
|
|
if (!isset($_SESSION['auid'])) {
|
|
if (!isset($_SESSION['auid'])) {
|
|
return Doo::conf()->APP_URL . 'manage';
|
|
return Doo::conf()->APP_URL . 'manage';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- public function __construct() {
|
|
|
|
|
|
+ public function __construct()
|
|
|
|
+ {
|
|
$this->users = new AUsers();
|
|
$this->users = new AUsers();
|
|
$this->user = new AUser();
|
|
$this->user = new AUser();
|
|
$this->userz = new Users();
|
|
$this->userz = new Users();
|
|
@@ -36,7 +39,8 @@ class AdminController extends DooController {
|
|
$this->data['rootUrl'] = Doo::conf()->APP_URL;
|
|
$this->data['rootUrl'] = Doo::conf()->APP_URL;
|
|
}
|
|
}
|
|
|
|
|
|
- function addUser() {
|
|
|
|
|
|
+ function addUser()
|
|
|
|
+ {
|
|
$params = NULL;
|
|
$params = NULL;
|
|
if (isset($_POST['email'])) {
|
|
if (isset($_POST['email'])) {
|
|
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
|
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
|
@@ -62,7 +66,8 @@ class AdminController extends DooController {
|
|
$this->render('admin-addUser', $this->data, TRUE);
|
|
$this->render('admin-addUser', $this->data, TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
- public function randomPassword() {
|
|
|
|
|
|
+ public function randomPassword()
|
|
|
|
+ {
|
|
$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
|
|
$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
|
|
$pass = array(); //remember to declare $pass as an array
|
|
$pass = array(); //remember to declare $pass as an array
|
|
$alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
|
|
$alphaLength = strlen($alphabet) - 1; //put the length -1 in cache
|
|
@@ -73,7 +78,8 @@ class AdminController extends DooController {
|
|
return implode($pass); //turn the array into a string
|
|
return implode($pass); //turn the array into a string
|
|
}
|
|
}
|
|
|
|
|
|
- function editUser() {
|
|
|
|
|
|
+ function editUser()
|
|
|
|
+ {
|
|
$this->data['users'] = $this->users->getOne(array('where' => 'uid = ?', 'param' => array($this->params['uid']), 'asArray' => TRUE));
|
|
$this->data['users'] = $this->users->getOne(array('where' => 'uid = ?', 'param' => array($this->params['uid']), 'asArray' => TRUE));
|
|
$this->data['profile'] = $this->profile->getProWithUid($this->params['uid']);
|
|
$this->data['profile'] = $this->profile->getProWithUid($this->params['uid']);
|
|
if (isset($_POST['email']) && ($_POST['email'] != $this->data['users']['uemail']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
|
if (isset($_POST['email']) && ($_POST['email'] != $this->data['users']['uemail']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
|
|
@@ -82,14 +88,15 @@ class AdminController extends DooController {
|
|
$this->userz->update(array('where' => 'uid = ?', 'param' => array($this->params['uid'])));
|
|
$this->userz->update(array('where' => 'uid = ?', 'param' => array($this->params['uid'])));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['name']) && isset($_POST['phone']) && isset($_POST['mobile'])) {
|
|
|
|
|
|
+ if (isset($_POST['company']) && isset($_POST['jobs']) && isset($_POST['name']) && isset($_POST['phone'])) {
|
|
$this->profile->upProfile($this->params['uid'], $_POST);
|
|
$this->profile->upProfile($this->params['uid'], $_POST);
|
|
return Doo::conf()->APP_URL . 'manage/user/list';
|
|
return Doo::conf()->APP_URL . 'manage/user/list';
|
|
}
|
|
}
|
|
$this->render('admin-editUser', $this->data, TRUE);
|
|
$this->render('admin-editUser', $this->data, TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
- function option() {
|
|
|
|
|
|
+ function option()
|
|
|
|
+ {
|
|
$this->data['auser'] = $this->user->getOne(array('where' => 'auid = ?', 'param' => array($_SESSION['auid']), 'asArray' => TRUE));
|
|
$this->data['auser'] = $this->user->getOne(array('where' => 'auid = ?', 'param' => array($_SESSION['auid']), 'asArray' => TRUE));
|
|
if (isset($_POST['oldpasswd']) && isset($_POST['newpasswd']) && isset($_POST['renewpasswd']) && ($_POST['newpasswd'] == $_POST['renewpasswd']) && $this->ph->CheckPassword($_POST['oldpasswd'], $this->data['auser']['aupass'])) {
|
|
if (isset($_POST['oldpasswd']) && isset($_POST['newpasswd']) && isset($_POST['renewpasswd']) && ($_POST['newpasswd'] == $_POST['renewpasswd']) && $this->ph->CheckPassword($_POST['oldpasswd'], $this->data['auser']['aupass'])) {
|
|
$this->user->upPasswWd($_SESSION['auid'], $this->ph->HashPassword($_POST['newpasswd']));
|
|
$this->user->upPasswWd($_SESSION['auid'], $this->ph->HashPassword($_POST['newpasswd']));
|
|
@@ -98,7 +105,8 @@ class AdminController extends DooController {
|
|
$this->render('admin-option', $this->data, TRUE);
|
|
$this->render('admin-option', $this->data, TRUE);
|
|
}
|
|
}
|
|
|
|
|
|
- function userSwitch() {
|
|
|
|
|
|
+ function userSwitch()
|
|
|
|
+ {
|
|
$userzArray = $this->userz->getOne(array('where' => 'uid = ?', 'param' => array($this->params['uid']), 'asArray' => TRUE));
|
|
$userzArray = $this->userz->getOne(array('where' => 'uid = ?', 'param' => array($this->params['uid']), 'asArray' => TRUE));
|
|
if (isset($userzArray['uid']) && $userzArray['isstop']) {
|
|
if (isset($userzArray['uid']) && $userzArray['isstop']) {
|
|
$this->userz->isstop = 0;
|
|
$this->userz->isstop = 0;
|
|
@@ -109,7 +117,8 @@ class AdminController extends DooController {
|
|
return Doo::conf()->APP_URL . 'manage/user/list';
|
|
return Doo::conf()->APP_URL . 'manage/user/list';
|
|
}
|
|
}
|
|
|
|
|
|
- function userRepasswd() {
|
|
|
|
|
|
+ function userRepasswd()
|
|
|
|
+ {
|
|
$userzArray = $this->userz->getOne(array('where' => 'uid = ?', 'param' => array($this->params['uid']), 'asArray' => TRUE));
|
|
$userzArray = $this->userz->getOne(array('where' => 'uid = ?', 'param' => array($this->params['uid']), 'asArray' => TRUE));
|
|
if (isset($userzArray['uemail'])) {
|
|
if (isset($userzArray['uemail'])) {
|
|
$passwdStr = $this->randomPassword();
|
|
$passwdStr = $this->randomPassword();
|
|
@@ -127,7 +136,8 @@ class AdminController extends DooController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- function userList() {
|
|
|
|
|
|
+ function userList()
|
|
|
|
+ {
|
|
if (isset($_SESSION['passwd'])) {
|
|
if (isset($_SESSION['passwd'])) {
|
|
echo '添加用户的密码是:' . $_SESSION['passwd'];
|
|
echo '添加用户的密码是:' . $_SESSION['passwd'];
|
|
}
|
|
}
|