2024.8.23
Loading...
Searching...
No Matches
ActionChangeDbRootPwd Class Reference

Public Member Functions

 __construct ($args)
 
 processWindow ($window, $id, $ctrl, $param1, $param2)
 

Private Attributes

 $bin
 
 $cntProcessActions
 
 $wbBtnCancel
 
 $wbBtnFinish
 
 $wbInputCurrentPwd
 
 $wbInputNewPwd1
 
 $wbInputNewPwd2
 
 $wbLabelCurrentPwd
 
 $wbLabelNewPwd1
 
 $wbLabelNewPwd2
 
 $wbProgressBar
 
 $wbWindow
 

Detailed Description

Class ActionChangeDbRootPwd Handles the process of changing the root password for various database systems.

Definition at line 14 of file class.action.changeDbRootPwd.php.

Constructor & Destructor Documentation

◆ __construct()

ActionChangeDbRootPwd::__construct ( $args)

ActionChangeDbRootPwd constructor. Initializes the window and controls for changing the database root password.

Parameters
array$argsThe arguments passed to the constructor, typically containing the database type.

Definition at line 82 of file class.action.changeDbRootPwd.php.

83 {
84 global $bearsamppLang, $bearsamppBins, $bearsamppWinbinder;
85
86 if (isset($args[0]) && !empty($args[0])) {
87 $this->bin = $bearsamppBins->getMysql();
88 $this->cntProcessActions = 11;
89 if ($args[0] == $bearsamppBins->getMariadb()->getName()) {
90 $this->bin = $bearsamppBins->getMariadb();
91 $this->cntProcessActions = 11;
92 } elseif ($args[0] == $bearsamppBins->getPostgresql()->getName()) {
93 $this->bin = $bearsamppBins->getPostgresql();
94 $this->cntProcessActions = 10;
95 }
96
97 $bearsamppWinbinder->reset();
98 $this->wbWindow = $bearsamppWinbinder->createAppWindow(sprintf($bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_TITLE), $args[0]), 400, 290, WBC_NOTIFY, WBC_KEYDOWN | WBC_KEYUP);
99
100 $this->wbLabelCurrentPwd = $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_CURRENTPWD_LABEL), 15, 15, 280);
101 $this->wbInputCurrentPwd = $bearsamppWinbinder->createInputText($this->wbWindow, null, 15, 40, 200, null, null, WBC_MASKED);
102
103 $this->wbLabelNewPwd1 = $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_NEWPWD1_LABEL), 15, 80, 280);
104 $this->wbInputNewPwd1 = $bearsamppWinbinder->createInputText($this->wbWindow, null, 15, 105, 200, null, null, WBC_MASKED);
105
106 $this->wbLabelNewPwd2 = $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_NEWPWD2_LABEL), 15, 145, 280);
107 $this->wbInputNewPwd2 = $bearsamppWinbinder->createInputText($this->wbWindow, null, 15, 170, 200, null, null, WBC_MASKED);
108
109 $this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, $this->cntProcessActions + 1, 15, 227, 190);
110 $this->wbBtnFinish = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_FINISH), 210, 222);
111 $this->wbBtnCancel = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_CANCEL), 297, 222);
112
113 $bearsamppWinbinder->setHandler($this->wbWindow, $this, 'processWindow');
114 $bearsamppWinbinder->setFocus($this->wbInputCurrentPwd[WinBinder::CTRL_OBJ]);
115 $bearsamppWinbinder->mainLoop();
116 $bearsamppWinbinder->reset();
117 }
118 }
global $bearsamppBins
global $bearsamppLang
const CHANGE_DB_ROOT_PWD_NEWPWD1_LABEL
const BUTTON_CANCEL
const BUTTON_FINISH
const CHANGE_DB_ROOT_PWD_NEWPWD2_LABEL
const CHANGE_DB_ROOT_PWD_TITLE
const CHANGE_DB_ROOT_PWD_CURRENTPWD_LABEL

References $bearsamppBins, $bearsamppLang, Lang\BUTTON_CANCEL, Lang\BUTTON_FINISH, Lang\CHANGE_DB_ROOT_PWD_CURRENTPWD_LABEL, Lang\CHANGE_DB_ROOT_PWD_NEWPWD1_LABEL, Lang\CHANGE_DB_ROOT_PWD_NEWPWD2_LABEL, Lang\CHANGE_DB_ROOT_PWD_TITLE, and WinBinder\CTRL_OBJ.

Member Function Documentation

◆ processWindow()

ActionChangeDbRootPwd::processWindow ( $window,
$id,
$ctrl,
$param1,
$param2 )

Processes the window events and handles the password change logic.

Parameters
object$windowThe window object.
int$idThe control ID that triggered the event.
object$ctrlThe control object that triggered the event.
mixed$param1Additional parameter 1.
mixed$param2Additional parameter 2.

Definition at line 129 of file class.action.changeDbRootPwd.php.

130 {
131 global $bearsamppLang, $bearsamppWinbinder;
132 $boxTitle = sprintf($bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_TITLE), $this->bin);
133 $currentPwd = $bearsamppWinbinder->getText($this->wbInputCurrentPwd[WinBinder::CTRL_OBJ]);
134 $newPwd1 = $bearsamppWinbinder->getText($this->wbInputNewPwd1[WinBinder::CTRL_OBJ]);
135 $newPwd2 = $bearsamppWinbinder->getText($this->wbInputNewPwd2[WinBinder::CTRL_OBJ]);
136
137 switch ($id) {
138 case $this->wbBtnFinish[WinBinder::CTRL_ID]:
139 $bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
140 if ($newPwd1 != $newPwd2) {
141 $bearsamppWinbinder->messageBoxWarning($bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_NOTSAME_ERROR), $boxTitle);
142 $bearsamppWinbinder->setText($this->wbInputNewPwd1[WinBinder::CTRL_OBJ], '');
143 $bearsamppWinbinder->setText($this->wbInputNewPwd2[WinBinder::CTRL_OBJ], '');
144 $bearsamppWinbinder->setFocus($this->wbInputNewPwd1[WinBinder::CTRL_OBJ]);
145 $bearsamppWinbinder->resetProgressBar($this->wbProgressBar);
146 break;
147 }
148
149 $checkRootPwd = $this->bin->checkRootPassword($currentPwd, $this->wbProgressBar);
150 if ($checkRootPwd !== true) {
151 $bearsamppWinbinder->messageBoxError(
152 sprintf($bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_INCORRECT_ERROR), $this->bin->getName(), $checkRootPwd),
153 $boxTitle
154 );
155 $bearsamppWinbinder->setText($this->wbInputCurrentPwd[WinBinder::CTRL_OBJ], '');
156 $bearsamppWinbinder->setFocus($this->wbInputCurrentPwd[WinBinder::CTRL_OBJ]);
157 $bearsamppWinbinder->resetProgressBar($this->wbProgressBar);
158 break;
159 }
160
161 $changeRootPwd = $this->bin->changeRootPassword($currentPwd, $newPwd1, $this->wbProgressBar);
162 if ($changeRootPwd !== true) {
163 $bearsamppWinbinder->messageBoxError(
164 sprintf($bearsamppLang->getValue(Lang::CHANGE_DB_ROOT_PWD_INCORRECT_ERROR), $this->bin->getName(), $changeRootPwd),
165 $boxTitle
166 );
167 $bearsamppWinbinder->resetProgressBar($this->wbProgressBar);
168 break;
169 }
170
171 $bearsamppWinbinder->messageBoxInfo(
173 $boxTitle);
174 $bearsamppWinbinder->destroyWindow($window);
175 break;
176 case IDCLOSE:
177 case $this->wbBtnCancel[WinBinder::CTRL_ID]:
178 $bearsamppWinbinder->destroyWindow($window);
179 break;
180 }
181 }
const CHANGE_DB_ROOT_PWD_NOTSAME_ERROR
const CHANGE_DB_ROOT_PWD_INCORRECT_ERROR
const CHANGE_DB_ROOT_PWD_TEXT

References $bearsamppLang, Lang\CHANGE_DB_ROOT_PWD_INCORRECT_ERROR, Lang\CHANGE_DB_ROOT_PWD_NOTSAME_ERROR, Lang\CHANGE_DB_ROOT_PWD_TEXT, Lang\CHANGE_DB_ROOT_PWD_TITLE, WinBinder\CTRL_ID, and WinBinder\CTRL_OBJ.

Field Documentation

◆ $bin

ActionChangeDbRootPwd::$bin
private

Definition at line 19 of file class.action.changeDbRootPwd.php.

◆ $cntProcessActions

ActionChangeDbRootPwd::$cntProcessActions
private

Definition at line 24 of file class.action.changeDbRootPwd.php.

◆ $wbBtnCancel

ActionChangeDbRootPwd::$wbBtnCancel
private

Definition at line 74 of file class.action.changeDbRootPwd.php.

◆ $wbBtnFinish

ActionChangeDbRootPwd::$wbBtnFinish
private

Definition at line 69 of file class.action.changeDbRootPwd.php.

◆ $wbInputCurrentPwd

ActionChangeDbRootPwd::$wbInputCurrentPwd
private

Definition at line 39 of file class.action.changeDbRootPwd.php.

◆ $wbInputNewPwd1

ActionChangeDbRootPwd::$wbInputNewPwd1
private

Definition at line 49 of file class.action.changeDbRootPwd.php.

◆ $wbInputNewPwd2

ActionChangeDbRootPwd::$wbInputNewPwd2
private

Definition at line 59 of file class.action.changeDbRootPwd.php.

◆ $wbLabelCurrentPwd

ActionChangeDbRootPwd::$wbLabelCurrentPwd
private

Definition at line 34 of file class.action.changeDbRootPwd.php.

◆ $wbLabelNewPwd1

ActionChangeDbRootPwd::$wbLabelNewPwd1
private

Definition at line 44 of file class.action.changeDbRootPwd.php.

◆ $wbLabelNewPwd2

ActionChangeDbRootPwd::$wbLabelNewPwd2
private

Definition at line 54 of file class.action.changeDbRootPwd.php.

◆ $wbProgressBar

ActionChangeDbRootPwd::$wbProgressBar
private

Definition at line 64 of file class.action.changeDbRootPwd.php.

◆ $wbWindow

ActionChangeDbRootPwd::$wbWindow
private

Definition at line 29 of file class.action.changeDbRootPwd.php.


The documentation for this class was generated from the following file: