1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23:
24: class cSetupAdminPassword extends cSetupMask {
25: function cSetupAdminPassword($step, $previous, $next) {
26: global $cfg;
27:
28: cSetupMask::cSetupMask("templates/setup/forms/adminpassword.tpl", $step);
29:
30: cArray::initializeKey($_SESSION, "adminmail", "");
31: cArray::initializeKey($_SESSION, "adminpass", "");
32: cArray::initializeKey($_SESSION, "adminpassrepeat", "");
33:
34: $this->setHeader(i18n("Administrator password", "setup"));
35: $this->_oStepTemplate->set("s", "TITLE", i18n("Administrator password", "setup"));
36:
37: $this->_oStepTemplate->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"));
38:
39: if ($_SESSION["adminpass"] != "") {
40: $displayadminpass = str_repeat("*", strlen($_SESSION["adminpass"]));
41: } else {
42: $displayadminpass = "";
43: }
44:
45: if ($_SESSION["adminpassrepeat"] != "") {
46: $displayadminpassrepeat = str_repeat("*", strlen($_SESSION["adminpassrepeat"]));
47: } else {
48: $displayadminpassrepeat = "";
49: }
50:
51: $adminmail = new cHTMLTextbox("adminmail", $_SESSION["adminmail"], 30, 255);
52: $adminpass = new cHTMLPasswordbox("adminpass", $displayadminpass, 30, 255);
53: $adminpassrepeat = new cHTMLPasswordbox("adminpassrepeat", $displayadminpassrepeat, 30, 255);
54:
55: $adminpass->attachEventDefinition("onchange handler", "onchange", "document.setupform.adminpass_changed.value = 'true';");
56: $adminpass->attachEventDefinition("onchange handler", "onkeypress", "document.setupform.adminpass_changed.value = 'true';");
57:
58: $adminpassrepeat->attachEventDefinition("onchange handler", "onchange", "document.setupform.adminpassrepeat_changed.value = 'true';");
59: $adminpassrepeat->attachEventDefinition("onchange handler", "onkeypress", "document.setupform.adminpassrepeat_changed.value = 'true';");
60:
61: $adminpass_hidden = new cHTMLHiddenField("adminpass_changed", "false");
62: $adminpassrepeat_hidden = new cHTMLHiddenField("adminpassrepeat_changed", "false");
63:
64: $this->_oStepTemplate->set("s", "LABEL_ADMINPASS", i18n("Administrator password", "setup"));
65: $this->_oStepTemplate->set("s", "LABEL_ADMINPASSREPEAT", i18n("Administrator password", "setup") . " " . i18n("(repeat)", "setup"));
66: $this->_oStepTemplate->set("s", "LABEL_ADMINMAIL", i18n("Administrator mail address", "setup"));
67:
68: $this->_oStepTemplate->set("s", "INPUT_ADMINPASS", $adminpass->render().$adminpass_hidden->render());
69: $this->_oStepTemplate->set("s", "INPUT_ADMINPASSREPEAT", $adminpassrepeat->render().$adminpassrepeat_hidden->render());
70: $this->_oStepTemplate->set("s", "INPUT_ADMINMAIL", $adminmail->render());
71:
72: $this->setNavigation($previous, $next);
73: }
74:
75: function _createNavigation()
76: {
77: $link = new cHTMLLink("#");
78:
79:
80: $checkScript = sprintf(
81: "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); }",
82: i18n("You need to enter a password.", "setup"),
83: i18n("The entered passwords are not matching.", "setup"),
84: i18n("You need to enter a mail address.", "setup")
85: );
86:
87: $link->attachEventDefinition("pageAttach", "onclick", "document.setupform.step.value = '".$this->_bNextstep."';");
88: $link->attachEventDefinition("submitAttach", "onclick", $checkScript);
89:
90:
91:
92: $link->setClass("nav");
93: $link->setContent("<span>»</span>");
94: $this->_oStepTemplate->set("s", "NEXT", $link->render());
95:
96: $backlink = new cHTMLLink("#");
97: $backlink->attachEventDefinition("pageAttach", "onclick", "document.setupform.step.value = '".$this->_bBackstep."';");
98: $backlink->attachEventDefinition("submitAttach", "onclick", "document.setupform.submit();");
99: $backlink->setClass("nav navBack");
100: $backlink->setContent("<span>»</span>");
101: $this->_oStepTemplate->set("s", "BACK", $backlink->render());
102: }
103: }
104:
105: ?>