1: <?php
2: 3: 4: 5:
6:
7: if (!defined('XOOPS_ROOT_PATH')) exit();
8:
9: require_once XOOPS_MODULE_PATH . "/user/class/AbstractEditAction.class.php";
10: require_once XOOPS_MODULE_PATH . "/user/class/RegistMailBuilder.class.php";
11:
12: class User_UserActivateAction extends User_AbstractEditAction
13: {
14: function _getId()
15: {
16: return isset($_REQUEST['uid']) ? intval(xoops_getrequest('uid')) : 0;
17: }
18:
19: function &_getHandler()
20: {
21: $handler =& xoops_getmodulehandler('users', 'user');
22: return $handler;
23: }
24:
25: 26: 27: 28:
29: function isEnableCreate()
30: {
31: return false;
32: }
33:
34: 35: 36: 37:
38: function isSecure()
39: {
40: return false;
41: }
42:
43: function getDefaultView(&$controller, &$xoopsUser)
44: {
45: if ((!isset($_REQUEST['actkey'])) || (!$this->mObject)) {
46: $controller->executeForward(XOOPS_URL . '/');
47: }
48:
49: if ($this->mObject->get('actkey') != xoops_getrequest('actkey')) {
50: $controller->executeRedirect(XOOPS_URL . '/', 3, _MD_USER_MESSAGE_ACTKEYNOT);
51: }
52:
53: if ($this->mObject->get('level') > 0) {
54: $controller->executeRedirect(XOOPS_URL . '/user.php', 3, _MD_USER_MESSAGE_ACONTACT);
55: }
56:
57: $this->mObject->set('level', '1');
58:
59:
60:
61:
62: $this->mObjectHandler->insert($this->mObject, true);
63:
64: if ($this->mConfig['activation_type'] == 2) {
65: $builder =new User_RegistAdminCommitMailBuilder();
66: $director =new User_UserRegistMailDirector($builder, $this->mObject, $controller->mRoot->mContext->getXoopsConfig(), $this->mConfig);
67: $director->contruct();
68: $mailer=&$builder->getResult();
69: if ($mailer->send()) {
70: $controller->executeRedirect(XOOPS_URL . '/', 5, sprintf(_MD_USER_MESSAGE_ACTVMAILOK, $this->mObject->get('uname')));
71: } else {
72: $controller->executeRedirect(XOOPS_URL . '/', 5, sprintf(_MD_USER_MESSAGE_ACTVMAILNG, $this->mObject->get('uname')));
73: }
74: } else {
75: $controller->executeRedirect(XOOPS_URL . '/user.php', 5, _MD_USER_MESSAGE_ACTLOGIN);
76: }
77: }
78: }
79: ?>
80: