-
Notifications
You must be signed in to change notification settings - Fork 5
/
admin.php
59 lines (52 loc) · 1.67 KB
/
admin.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
<?php
// Chech whether we are indeed included by Piwigo.
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
// Fetch the template.
global $template, $conf;
// Load parameter
$skin = $conf['jplayer_skin'];
$autoplay = $conf['jplayer_autoplay'];
$poster = $conf['jplayer_representative_as_poster'];
// Available skins
$available_skins = array(
'bm' => 'Blue Monday',
'pf' => 'Pink Flag',
'naive' => 'naive',
);
// Update conf if submitted in admin site
if (isset($_POST['submit'])) {
if (!empty($_POST['skin'])) {
$query = 'UPDATE ' . CONFIG_TABLE .
' SET value="' . $_POST['skin'] . '"
WHERE param="jplayer_skin"';
pwg_query($query);
// keep this selected in the admin form
$skin = $_POST['skin'];
}
$autoplay = isset($_POST['autoplay']) ? "true" : "false";
$query = 'UPDATE ' . CONFIG_TABLE .
' SET value="' . $autoplay . '"
WHERE param="jplayer_autoplay"';
pwg_query($query);
$poster = isset($_POST['poster']) ? "true" : "false";
$query = 'UPDATE ' . CONFIG_TABLE .
' SET value="' . $poster . '"
WHERE param="jplayer_representative_as_poster"';
pwg_query($query);
}
//
$template->assign(array(
'SELECTED_SKIN' => $skin,
'AVAILABLE_SKINS' => $available_skins,
'AUTOPLAY' => $autoplay,
'POSTER' => $poster,
));
// Add our template to the global template
$template->set_filenames(
array(
'plugin_admin_content' => dirname(__FILE__).'/admin.tpl'
)
);
// Assign the template contents to ADMIN_CONTENT
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
?>