Bearsampp 2026.9.23
Loading...
Searching...
No Matches
ActionGenSslCertificate Class Reference

Public Member Functions

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

Data Fields

const GAUGE_SAVE = 2

Private Attributes

 $wbBtnCancel
 $wbBtnDest
 $wbBtnSave
 $wbInputDest
 $wbInputName
 $wbLabelDest
 $wbLabelName
 $wbProgressBar
 $wbWindow

Detailed Description

Class ActionGenSslCertificate

This class handles the generation of SSL certificates through a WinBinder GUI. It provides a user interface for inputting the server name and target directory, and includes functionality for browsing directories, saving the certificate, and displaying progress.

Definition at line 17 of file class.action.genSslCertificate.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( $args)

Constructor for ActionGenSslCertificate.

Initializes the WinBinder window and its controls, sets up event handlers, and starts the main loop.

Parameters
array$argsCommand line arguments passed to the script.

Definition at line 48 of file class.action.genSslCertificate.php.

49 {
50 global $bearsamppRoot, $bearsamppLang, $bearsamppWinbinder;
51
52 $initServerName = 'test.local';
53 $initDocumentRoot = Path::formatWindowsPath(Path::getSslPath());
54
55 $bearsamppWinbinder->reset();
56 $this->wbWindow = $bearsamppWinbinder->createAppWindow($bearsamppLang->getValue(Lang::GENSSL_TITLE), 490, 160, WBC_NOTIFY, WBC_KEYDOWN | WBC_KEYUP);
57
58 $this->wbLabelName = $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::NAME) . ' :', 15, 15, 85, null, WBC_RIGHT);
59 $this->wbInputName = $bearsamppWinbinder->createInputText($this->wbWindow, $initServerName, 105, 13, 150, null);
60
61 $this->wbLabelDest = $bearsamppWinbinder->createLabel($this->wbWindow, $bearsamppLang->getValue(Lang::TARGET) . ' :', 15, 45, 85, null, WBC_RIGHT);
62 $this->wbInputDest = $bearsamppWinbinder->createInputText($this->wbWindow, $initDocumentRoot, 105, 43, 190, null, null, WBC_READONLY);
63 $this->wbBtnDest = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_BROWSE), 300, 43, 110);
64
65 $this->wbProgressBar = $bearsamppWinbinder->createProgressBar($this->wbWindow, self::GAUGE_SAVE + 1, 15, 97, 275);
66 $this->wbBtnSave = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_SAVE), 300, 92);
67 $this->wbBtnCancel = $bearsamppWinbinder->createButton($this->wbWindow, $bearsamppLang->getValue(Lang::BUTTON_CANCEL), 387, 92);
68
69 $bearsamppWinbinder->setHandler($this->wbWindow, $this, 'processWindow');
70 $bearsamppWinbinder->mainLoop();
71 $bearsamppWinbinder->reset();
72 }
global $bearsamppLang
global $bearsamppRoot
const GENSSL_TITLE
const NAME
const BUTTON_BROWSE
const BUTTON_CANCEL
const BUTTON_SAVE
const TARGET
static getSslPath($aetrayPath=false)
static formatWindowsPath($path)

References $bearsamppLang, $bearsamppRoot, Lang\BUTTON_BROWSE, Lang\BUTTON_CANCEL, Lang\BUTTON_SAVE, Path\formatWindowsPath(), Lang\GENSSL_TITLE, Path\getSslPath(), Lang\NAME, and Lang\TARGET.

Here is the call graph for this function:

Member Function Documentation

◆ processWindow()

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

Processes window events.

Handles button clicks and other window events, such as browsing for a directory, saving the SSL certificate, and closing the window.

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

Definition at line 86 of file class.action.genSslCertificate.php.

87 {
88 global $bearsamppLang, $bearsamppOpenSsl, $bearsamppWinbinder;
89
90 $name = $bearsamppWinbinder->getText($this->wbInputName[WinBinder::CTRL_OBJ]);
91 $target = $bearsamppWinbinder->getText($this->wbInputDest[WinBinder::CTRL_OBJ]);
92
93 switch ($id) {
94 case $this->wbBtnDest[WinBinder::CTRL_ID]:
95 $target = $bearsamppWinbinder->sysDlgPath($window, $bearsamppLang->getValue(Lang::GENSSL_PATH), $target);
96 if ($target && is_dir($target)) {
97 $bearsamppWinbinder->setText($this->wbInputDest[WinBinder::CTRL_OBJ], $target . '\\');
98 }
99 break;
100 case $this->wbBtnSave[WinBinder::CTRL_ID]:
101 $bearsamppWinbinder->setProgressBarMax($this->wbProgressBar, self::GAUGE_SAVE + 1);
102 $bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
103
104 $target = Path::formatUnixPath($target);
105 if ($bearsamppOpenSsl->createCrt($name, $target)) {
106 $bearsamppWinbinder->incrProgressBar($this->wbProgressBar);
107 $bearsamppWinbinder->messageBoxInfo(
108 sprintf($bearsamppLang->getValue(Lang::GENSSL_CREATED), $name),
110 );
111 $bearsamppWinbinder->destroyWindow($window);
112 } else {
113 $bearsamppWinbinder->messageBoxError($bearsamppLang->getValue(Lang::GENSSL_CREATED_ERROR), $bearsamppLang->getValue(Lang::GENSSL_TITLE));
114 $bearsamppWinbinder->resetProgressBar($this->wbProgressBar);
115 }
116 break;
117 case IDCLOSE:
118 case $this->wbBtnCancel[WinBinder::CTRL_ID]:
119 $bearsamppWinbinder->destroyWindow($window);
120 break;
121 }
122 }
const GENSSL_CREATED
const GENSSL_PATH
const GENSSL_CREATED_ERROR
static formatUnixPath($path)

References $bearsamppLang, WinBinder\CTRL_ID, WinBinder\CTRL_OBJ, Path\formatUnixPath(), Lang\GENSSL_CREATED, Lang\GENSSL_CREATED_ERROR, Lang\GENSSL_PATH, and Lang\GENSSL_TITLE.

Here is the call graph for this function:

Field Documentation

◆ $wbBtnCancel

$wbBtnCancel
private

Definition at line 36 of file class.action.genSslCertificate.php.

◆ $wbBtnDest

$wbBtnDest
private

Definition at line 30 of file class.action.genSslCertificate.php.

◆ $wbBtnSave

$wbBtnSave
private

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

◆ $wbInputDest

$wbInputDest
private

Definition at line 28 of file class.action.genSslCertificate.php.

◆ $wbInputName

$wbInputName
private

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

◆ $wbLabelDest

$wbLabelDest
private

Definition at line 26 of file class.action.genSslCertificate.php.

◆ $wbLabelName

$wbLabelName
private

Definition at line 22 of file class.action.genSslCertificate.php.

◆ $wbProgressBar

$wbProgressBar
private

Definition at line 32 of file class.action.genSslCertificate.php.

◆ $wbWindow

$wbWindow
private

Definition at line 20 of file class.action.genSslCertificate.php.

◆ GAUGE_SAVE

const GAUGE_SAVE = 2

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


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