1: <?php
2: 3: 4: 5:
6:
7: if (!defined('XOOPS_ROOT_PATH')) exit();
8:
9: require_once XOOPS_MODULE_PATH . "/user/forms/UserRegisterEditForm.class.php";
10:
11: 12: 13: 14: 15: 16: 17: 18: 19:
20: class User_UserRegisterAction extends User_Action
21: {
22: var $mActionForm = null;
23: var $mConfig;
24: var $mEnableAgreeFlag = false;
25:
26: function prepare(&$controller, &$xoopsUser, $moduleConfig)
27: {
28: $this->mConfig = $moduleConfig;
29:
30: if(is_object($xoopsUser)) {
31:
32:
33:
34: $controller->executeForward(XOOPS_URL . "/user.php");
35: }
36: if (empty($this->mConfig['allow_register'])) {
37: $controller->executeRedirect(XOOPS_URL . '/', 6, _MD_USER_LANG_NOREGISTER);
38: }
39: }
40:
41: function execute(&$controller, &$xoopsUser)
42: {
43: $this->_processActionForm();
44: $this->mActionForm->fetch();
45: $this->mActionForm->validate();
46:
47: if ($this->mActionForm->hasError()) {
48: return USER_FRAME_VIEW_INPUT;
49: } else {
50: $_SESSION['user_register_actionform'] = serialize($this->mActionForm);
51: $controller->executeForward('./register.php?action=confirm');
52: }
53: }
54:
55: function getDefaultView(&$controller,&$xoopsUser)
56: {
57: $this->_processActionForm();
58: return USER_FRAME_VIEW_INPUT;
59: }
60:
61: function _processActionForm()
62: {
63: if(isset($_SESSION['user_register_actionform'])){
64: $this->mActionForm = unserialize($_SESSION['user_register_actionform']);
65: unset($_SESSION['user_register_actionform']);
66: return;
67: }
68:
69: if ($this->mConfig['reg_dispdsclmr'] != 0 && $this->mConfig['reg_disclaimer'] != null) {
70: $this->mEnableAgreeFlag = true;
71: $this->mActionForm =new User_RegisterAgreeEditForm($this->mConfig);
72: } else {
73: $this->mActionForm =new User_RegisterEditForm($this->mConfig);
74: }
75:
76: $this->mActionForm->prepare();
77:
78: $root =& XCube_Root::getSingleton();
79: $this->mActionForm->set('timezone_offset', $root->mContext->getXoopsConfig('default_TZ'));
80: }
81:
82: function executeViewInput(&$controller,&$xoopsUser,&$renderSystem)
83: {
84: $renderSystem->setTemplateName("user_register_form.html");
85:
86:
87:
88: $tzoneHandler =& xoops_gethandler('timezone');
89: $timezones =& $tzoneHandler->getObjects();
90: $renderSystem->setAttribute('timezones', $timezones);
91: $renderSystem->setAttribute("actionForm", $this->mActionForm);
92: $renderSystem->setAttribute("enableAgree", $this->mEnableAgreeFlag);
93: if($this->mEnableAgreeFlag) {
94: $renderSystem->setAttribute("disclaimer", $this->mConfig['reg_disclaimer']);
95: }
96: }
97: }
98:
99: ?>
100: