YaWK
24.1
Yet another WebKit
backend.php
Go to the documentation of this file.
1
<?php
2
/** Signup Backend Class */
3
namespace
YAWK\PLUGINS\SIGNUP
{
4
/**
5
* <b>backend helper functions for signup plugin.</b>
6
* <p><i>This class covers backend functionality. See Methods Summary for Details!</i></p>
7
*
8
* @author Daniel Retzl <
[email protected]
>
9
* @version 1.0.0
10
* @brief Handles the Blog System.
11
*/
12
class
backend
13
{
14
/**
15
* @brief allow user group to signup
16
* @param object $db database
17
* @param int $gid group ID to allow signup
18
* @return bool
19
*/
20
public
static
function
setAllowedGroup(
$db
,
$gid
)
21
{
/** @var $db \YAWK\db */
22
foreach
(
$gid
as
$id
) {
23
if
(
$id
===
'0'
)
24
{
25
if
(!
$res
=
$db
->query(
"UPDATE {user_groups} SET signup_allowed = '0'"
))
26
{
// q failed
27
return
false
;
28
}
29
}
30
if
(!
$res
=
$db
->query(
"UPDATE {user_groups} SET signup_allowed = 1 WHERE id = '"
.$id.
"'"
))
31
{
32
// q failed
33
return
false
;
34
}
35
}
36
return
true
;
37
}
38
39
/**
40
* @brief get user groups and draw select option value
41
* @param object $db database
42
* @return bool|null
43
*/
44
static
function
getUserGroupSelector(
$db
)
45
{
/** @var $db \YAWK\db */
46
if
(
$res
=
$db
->query(
"SELECT id, value, signup_allowed FROM {user_groups}"
))
47
{
48
echo
"<option value=\"0\">none</option>"
;
49
while
($row = mysqli_fetch_assoc(
$res
)) {
50
echo
"<option value=\""
. $row[
'id'
] .
"\""
;
51
if
($row[
'signup_allowed'
] ===
'1'
) {
52
echo
" selected=\"selected\""
;
53
}
54
echo
">"
. $row[
'value'
] .
"</option>"
;
55
}
56
return
null
;
57
}
58
else
59
{
// q failed
60
return
false
;
61
}
62
}
63
64
/**
65
* @brief frontend? group selector
66
* @param object $db database
67
* @return bool
68
*/
69
static
function
getGroupSelector(
$db
)
70
{
/** @var $db \YAWK\db */
71
if
(
$res
=
$db
->query(
"SELECT id, value FROM {user_groups}"
))
72
{
73
echo
"<option value=\"0\">default</option>"
;
74
while
($row = mysqli_fetch_assoc(
$res
)) {
75
echo
"<option value=\""
. $row[
'id'
] .
"\">"
.$row[
'value'
].
"</option>"
;
76
}
77
return
true
;
78
}
79
else
80
{
81
return
false
;
82
}
83
}
84
}
85
}
YAWK\PLUGINS\SIGNUP\backend
Handles the Blog System.
Definition:
backend.php:13
$id
if(!isset($db)) $id
Definition:
decline-friend.php:13
$db
$db
Definition:
dismiss-notifications.php:4
YAWK\PLUGINS\SIGNUP
Definition:
backend.php:3
$res
$res
Definition:
settings-assets.php:149
$gid
$gid
Definition:
user-new.php:104
yawk.io
system
plugins
signup
classes
backend.php
Generated on Tue Jan 16 2024 21:58:59 for YaWK by
doxygen 1.9.1