1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
13:
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15:
16: 17: 18: 19: 20: 21:
22: class cSetupAdminPassword extends cSetupMask {
23:
24: 25: 26: 27: 28: 29:
30: public function __construct($step, $previous, $next) {
31:
32: cSetupMask::__construct("templates/setup/forms/adminpassword.tpl", $step);
33:
34: cArray::initializeKey($_SESSION, "adminmail", "");
35: cArray::initializeKey($_SESSION, "adminpass", "");
36: cArray::initializeKey($_SESSION, "adminpassrepeat", "");
37:
38: $this->setHeader(i18n("Administrator password", "setup"));
39: $this->_stepTemplateClass->set("s", "TITLE", i18n("Administrator password", "setup"));
40:
41: $this->_stepTemplateClass->set("s", "DESCRIPTION", i18n("Please enter the password for the default administrator account sysadmin and specify it's mail address in case you forgot your entered password.", "setup"));
42:
43: if ($_SESSION["adminpass"] != "") {
44: $displayadminpass = str_repeat("*", cString::getStringLength($_SESSION["adminpass"]));
45: } else {
46: $displayadminpass = "";
47: }
48:
49: if ($_SESSION["adminpassrepeat"] != "") {
50: $displayadminpassrepeat = str_repeat("*", cString::getStringLength($_SESSION["adminpassrepeat"]));
51: } else {
52: $displayadminpassrepeat = "";
53: }
54:
55: $adminmail = new cHTMLTextbox("adminmail", $_SESSION["adminmail"], 30, 255);
56: $adminpass = new cHTMLPasswordbox("adminpass", $displayadminpass, 30, 255);
57: $adminpassrepeat = new cHTMLPasswordbox("adminpassrepeat", $displayadminpassrepeat, 30, 255);
58:
59: $adminpass->attachEventDefinition("onchange handler", "onchange", "document.setupform.adminpass_changed.value = 'true';");
60: $adminpass->attachEventDefinition("onchange handler", "onkeypress", "document.setupform.adminpass_changed.value = 'true';");
61:
62: $adminpassrepeat->attachEventDefinition("onchange handler", "onchange", "document.setupform.adminpassrepeat_changed.value = 'true';");
63: $adminpassrepeat->attachEventDefinition("onchange handler", "onkeypress", "document.setupform.adminpassrepeat_changed.value = 'true';");
64:
65: $adminpass_hidden = new cHTMLHiddenField("adminpass_changed", "false");
66: $adminpassrepeat_hidden = new cHTMLHiddenField("adminpassrepeat_changed", "false");
67:
68: $this->_stepTemplateClass->set("s", "LABEL_ADMINPASS", i18n("Administrator password", "setup"));
69: $this->_stepTemplateClass->set("s", "LABEL_ADMINPASSREPEAT", i18n("Administrator password", "setup") . " " . i18n("(repeat)", "setup"));
70: $this->_stepTemplateClass->set("s", "LABEL_ADMINMAIL", i18n("Administrator mail address", "setup"));
71:
72: $this->_stepTemplateClass->set("s", "INPUT_ADMINPASS", $adminpass->render().$adminpass_hidden->render());
73: $this->_stepTemplateClass->set("s", "INPUT_ADMINPASSREPEAT", $adminpassrepeat->render().$adminpassrepeat_hidden->render());
74: $this->_stepTemplateClass->set("s", "INPUT_ADMINMAIL", $adminmail->render());
75:
76: $this->setNavigation($previous, $next);
77: }
78:
79: 80: 81: 82: 83: 84: 85:
86: public function cSetupAdminPassword($step, $previous, $next) {
87: cDeprecated('This method is deprecated and is not needed any longer. Please use __construct() as constructor function.');
88: $this->__construct($step, $previous, $next);
89: }
90:
91: protected function _createNavigation() {
92: $link = new cHTMLLink("#");
93:
94:
95: $checkScript = sprintf(
96: "var msg = ''; if (document.setupform.adminpass.value == '' || document.setupform.adminpassrepeat.value == '') { msg += '%s '; } if (msg == '' && document.setupform.adminpass.value != document.setupform.adminpassrepeat.value) { msg += '%s '; } if (msg == '' && document.setupform.adminmail.value == '') { msg += '%s '; } if (msg == '') { document.setupform.submit(); } else { alert(msg); }",
97: i18n("You need to enter a password.", "setup"),
98: i18n("The entered passwords are not matching.", "setup"),
99: i18n("You need to enter a mail address.", "setup")
100: );
101:
102: $link->attachEventDefinition("pageAttach", "onclick", "document.setupform.step.value = '".$this->_nextstep."';");
103: $link->attachEventDefinition("submitAttach", "onclick", $checkScript);
104:
105:
106:
107: $link->setClass("nav");
108: $link->setContent("<span>»</span>");
109: $this->_stepTemplateClass->set("s", "NEXT", $link->render());
110:
111: $backlink = new cHTMLLink("#");
112: $backlink->attachEventDefinition("pageAttach", "onclick", "document.setupform.step.value = '".$this->_backstep."';");
113: $backlink->attachEventDefinition("submitAttach", "onclick", "document.setupform.submit();");
114: $backlink->setClass("nav navBack");
115: $backlink->setContent("<span>»</span>");
116: $this->_stepTemplateClass->set("s", "BACK", $backlink->render());
117: }
118: }
119:
120: ?>