-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.php
71 lines (57 loc) · 2.16 KB
/
settings.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
if (!defined("PHORUM_ADMIN")) return;
require_once './include/admin/PhorumInputForm.php';
require_once dirname(__FILE__) . '/api.php';
// Get the current list of available authentication providers.
$providers = mod_social_authentication_list_providers();
if (!isset($PHORUM['mod_social_authentication'])) {
$PHORUM['mod_social_authentication'] = $providers;
}
// ---------------------------------------------------------------------------
// Process posted settings
// ---------------------------------------------------------------------------
if (!empty($_POST))
{
foreach ($providers as $id => $provider) {
if (isset($_POST['provider'][$id])) {
$providers[$id]['active'] = 1;
} else {
$providers[$id]['active'] = 0;
}
}
$PHORUM['mod_social_authentication'] = array(
'providers' => $providers
);
phorum_db_update_settings(array(
'mod_social_authentication' => $PHORUM['mod_social_authentication']
));
phorum_admin_okmsg('Your settings have been saved successfully');
}
// ---------------------------------------------------------------------------
// Display the settings page
// ---------------------------------------------------------------------------
$frm = new PhorumInputForm ("", "post", 'Save settings');
$frm->hidden("module", "modsettings");
$frm->hidden("mod", "social_authentication");
$frm->addbreak("Social Authentication module Settings");
$frm->addbreak("Select the authentication providers to present to the user");
$select_providers = '';
foreach ($providers as $id => $provider)
{
$select_providers .=
"<div style=\"float:left; padding: 10px 15px\">" .
"<label>" .
$frm->checkbox(
"provider[$id]", "1", "",
!empty($PHORUM["mod_social_authentication"]["providers"][$id]['active'])
) . ' ' .
"<img align=\"absmiddle\" " .
"src=\"{$PHORUM['http_path']}/mods/social_authentication/" .
"providers/$id/button.png\" title=\"" .
htmlspecialchars($provider['provider']['name']) . "\"/>" .
"</label>" .
"</div>";
}
$frm->addmessage($select_providers);
$frm->show();
?>