Cheetah
modules
cheetah
oauth2
classes
ChOAuthFormAdd.php
Go to the documentation of this file.
1
<?
php
2
8
ch_import
(
'ChTemplFormView'
);
9
10
class
ChOAuthFormAdd
extends
ChTemplFormView
11
{
12
protected
static
$LENGTH_ID
= 10;
13
protected
static
$LENGTH_SECRET
= 32;
14
15
function
__construct
(
$oModule
)
16
{
17
$aCustomForm = array(
18
19
'form_attrs'
=> array(
20
'id'
=>
'ch-oauth-add'
,
21
'name'
=>
'ch-oauth-add'
,
22
'action'
=> CH_WSB_URL_ROOT .
$oModule
->_oConfig->getBaseUri() .
'administration'
,
23
'method'
=>
'post'
,
24
),
25
26
'params'
=> array (
27
'db'
=> array(
28
'table'
=>
'ch_oauth_clients'
,
29
'key'
=>
'id'
,
30
'submit_name'
=>
'client_add'
,
31
),
32
),
33
34
'inputs'
=> array(
35
36
'title'
=> array(
37
'type'
=>
'text'
,
38
'name'
=>
'title'
,
39
'caption'
=>
_t
(
'_Title'
),
40
'required'
=>
true
,
41
'checker'
=> array (
42
'func'
=>
'avail'
,
43
'error'
=>
_t
(
'_sys_adm_form_err_required_field'
),
44
),
45
'db'
=> array (
46
'pass'
=>
'Xss'
,
47
),
48
),
49
50
'redirect_uri'
=> array(
51
'type'
=>
'text'
,
52
'name'
=>
'redirect_uri'
,
53
'caption'
=>
_t
(
'_URL'
),
54
'required'
=>
true
,
55
'checker'
=> array (
56
'func'
=>
'avail'
,
57
'error'
=>
_t
(
'_sys_adm_form_err_required_field'
),
58
),
59
'db'
=> array (
60
'pass'
=>
'Xss'
,
61
),
62
),
63
64
'Submit'
=> array (
65
'type'
=>
'submit'
,
66
'name'
=>
'client_add'
,
67
'value'
=>
_t
(
'_Submit'
),
68
'colspan'
=>
true
,
69
),
70
),
71
);
72
73
parent::__construct ($aCustomForm);
74
}
75
76
function
insert
($aValsToAdd = array())
77
{
78
$aValsToAdd[
'client_id'
] = strtolower(
genRndPwd
(self::$LENGTH_ID,
false
));
79
$aValsToAdd[
'client_secret'
] = strtolower(
genRndPwd
(self::$LENGTH_SECRET,
false
));
80
$aValsToAdd[
'scope'
] =
'basic'
;
81
$aValsToAdd[
'user_id'
] =
getLoggedId
();
82
return
parent::insert($aValsToAdd);
83
}
84
}
$oModule
if(! @isAdmin()) $oModule
Definition:
admin.php:25
ChTemplFormView
Definition:
ChTemplFormView.php:11
ch_import
ch_import($sClassName, $aModule=array())
Definition:
utils.inc.php:1218
php
ChOAuthFormAdd\$LENGTH_SECRET
static $LENGTH_SECRET
Definition:
ChOAuthFormAdd.php:13
getLoggedId
getLoggedId()
Definition:
profiles.inc.php:32
genRndPwd
genRndPwd($iLength=8, $bSpecialCharacters=true)
Definition:
utils.inc.php:1618
_t
_t($key, $arg0="", $arg1="", $arg2="")
Definition:
languages.inc.php:509
ChOAuthFormAdd\__construct
__construct($oModule)
Definition:
ChOAuthFormAdd.php:15
ChOAuthFormAdd
Definition:
ChOAuthFormAdd.php:11
ChOAuthFormAdd\$LENGTH_ID
static $LENGTH_ID
Definition:
ChOAuthFormAdd.php:12
ChOAuthFormAdd\insert
insert($aValsToAdd=array())
Definition:
ChOAuthFormAdd.php:76
Generated by
1.8.20