1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | load_language('plugin.lang', WFS_PATH); |
---|
5 | |
---|
6 | global $conf, $template, $lang; |
---|
7 | |
---|
8 | $wfs_conf = explode ("," , $conf['wired_for_sound']); |
---|
9 | // Enregistrement de la configuration |
---|
10 | if (isset($_POST['submit'])) |
---|
11 | { |
---|
12 | if (strrpos($_POST['default_path'] , '/') != (strlen($_POST['default_path']) - 1)) |
---|
13 | { |
---|
14 | $_POST['default_path'] .= '/'; |
---|
15 | } |
---|
16 | if (!is_dir('./' . $_POST['default_path'])) |
---|
17 | { |
---|
18 | $wfs_conf[0] = $_POST['default_path']; |
---|
19 | array_push($page['errors'], l10n('wfs_no_path')); |
---|
20 | } |
---|
21 | else |
---|
22 | { |
---|
23 | $wfs_conf = array($_POST['default_path'], |
---|
24 | $_POST['default_volume'], |
---|
25 | $_POST['width_player'], |
---|
26 | $_POST['autostart'], |
---|
27 | $_POST['autoreplay']); |
---|
28 | $new_wfs_conf = implode ("," , $wfs_conf); |
---|
29 | $query = ' |
---|
30 | UPDATE ' . CONFIG_TABLE . ' |
---|
31 | SET value="' . $new_wfs_conf . '" |
---|
32 | WHERE param="wired_for_sound" |
---|
33 | LIMIT 1'; |
---|
34 | pwg_query($query); |
---|
35 | array_push($page['infos'], l10n('wfs_conf_saved')); |
---|
36 | } |
---|
37 | } |
---|
38 | // Parametrage du template |
---|
39 | $template->assign(array( |
---|
40 | 'DEFAULT_PATH' => $wfs_conf[0], |
---|
41 | 'DEFAULT_VOLUME' => $wfs_conf[1])); |
---|
42 | if ($wfs_conf[2] == '44') $template->assign(array('SMALL_PLAYER' => 'checked="checked"')); |
---|
43 | if ($wfs_conf[2] == '64') $template->assign(array('MEDIUM_PLAYER' => 'checked="checked"')); |
---|
44 | if ($wfs_conf[2] == '202') $template->assign(array('BIG_PLAYER' => 'checked="checked"')); |
---|
45 | if ($wfs_conf[3] == '1') |
---|
46 | { |
---|
47 | $template->assign(array('AUTOSTART_ON' => 'checked="checked"')); |
---|
48 | } |
---|
49 | else |
---|
50 | { |
---|
51 | $template->assign(array('AUTOSTART_OFF' => 'checked="checked"')); |
---|
52 | } |
---|
53 | if ($wfs_conf[4] == '1') |
---|
54 | { |
---|
55 | $template->assign(array('AUTOREPLAY_ON' => 'checked="checked"')); |
---|
56 | } |
---|
57 | else |
---|
58 | { |
---|
59 | $template->assign(array('AUTOREPLAY_OFF' => 'checked="checked"')); |
---|
60 | } |
---|
61 | |
---|
62 | $template->set_filenames(array('plugin_admin_content' => realpath(WFS_PATH . 'template/admin.tpl'))); |
---|
63 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
64 | |
---|
65 | ?> |
---|