Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
class.action.genSslCertificate.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2026 Bearsampp
4
* License: GNU General Public License version 3 or later; see LICENSE.txt
5
* Author: Bear
6
* Website: https://bearsampp.com
7
* Github: https://github.com/Bearsampp
8
*/
9
17
class
ActionGenSslCertificate
18
{
20
private
$wbWindow
;
22
private
$wbLabelName
;
24
private
$wbInputName
;
26
private
$wbLabelDest
;
28
private
$wbInputDest
;
30
private
$wbBtnDest
;
32
private
$wbProgressBar
;
34
private
$wbBtnSave
;
36
private
$wbBtnCancel
;
37
39
const
GAUGE_SAVE
= 2;
40
48
public
function
__construct
($args)
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
}
73
86
public
function
processWindow
($window, $id, $ctrl, $param1, $param2)
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),
109
$bearsamppLang
->getValue(
Lang::GENSSL_TITLE
)
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
}
123
}
124
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
$bearsamppRoot
global $bearsamppRoot
Definition
ajax.apache.php:16
ActionGenSslCertificate
Definition
class.action.genSslCertificate.php:18
ActionGenSslCertificate\$wbInputDest
$wbInputDest
Definition
class.action.genSslCertificate.php:28
ActionGenSslCertificate\$wbLabelName
$wbLabelName
Definition
class.action.genSslCertificate.php:22
ActionGenSslCertificate\$wbWindow
$wbWindow
Definition
class.action.genSslCertificate.php:20
ActionGenSslCertificate\$wbBtnDest
$wbBtnDest
Definition
class.action.genSslCertificate.php:30
ActionGenSslCertificate\__construct
__construct($args)
Definition
class.action.genSslCertificate.php:48
ActionGenSslCertificate\$wbLabelDest
$wbLabelDest
Definition
class.action.genSslCertificate.php:26
ActionGenSslCertificate\$wbInputName
$wbInputName
Definition
class.action.genSslCertificate.php:24
ActionGenSslCertificate\$wbBtnCancel
$wbBtnCancel
Definition
class.action.genSslCertificate.php:36
ActionGenSslCertificate\$wbBtnSave
$wbBtnSave
Definition
class.action.genSslCertificate.php:34
ActionGenSslCertificate\GAUGE_SAVE
const GAUGE_SAVE
Definition
class.action.genSslCertificate.php:39
ActionGenSslCertificate\processWindow
processWindow($window, $id, $ctrl, $param1, $param2)
Definition
class.action.genSslCertificate.php:86
ActionGenSslCertificate\$wbProgressBar
$wbProgressBar
Definition
class.action.genSslCertificate.php:32
Lang\GENSSL_TITLE
const GENSSL_TITLE
Definition
class.lang.php:348
Lang\GENSSL_CREATED
const GENSSL_CREATED
Definition
class.lang.php:350
Lang\NAME
const NAME
Definition
class.lang.php:57
Lang\BUTTON_BROWSE
const BUTTON_BROWSE
Definition
class.lang.php:380
Lang\BUTTON_CANCEL
const BUTTON_CANCEL
Definition
class.lang.php:377
Lang\GENSSL_PATH
const GENSSL_PATH
Definition
class.lang.php:349
Lang\BUTTON_SAVE
const BUTTON_SAVE
Definition
class.lang.php:375
Lang\GENSSL_CREATED_ERROR
const GENSSL_CREATED_ERROR
Definition
class.lang.php:351
Lang\TARGET
const TARGET
Definition
class.lang.php:72
Path\getSslPath
static getSslPath($aetrayPath=false)
Definition
class.path.php:1086
Path\formatWindowsPath
static formatWindowsPath($path)
Definition
class.path.php:127
Path\formatUnixPath
static formatUnixPath($path)
Definition
class.path.php:166
WinBinder\CTRL_ID
const CTRL_ID
Definition
class.winbinder.php:21
WinBinder\CTRL_OBJ
const CTRL_OBJ
Definition
class.winbinder.php:22
sandbox
core
classes
actions
class.action.genSslCertificate.php
Generated by
1.17.0