1 | <?php |
---|
2 | |
---|
3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
4 | load_language('plugin.lang', WFS_PATH); |
---|
5 | |
---|
6 | $wfs_conf = explode(',' , $conf['wired_for_sound']); |
---|
7 | $img_id = $page['image_id']; |
---|
8 | if (isset($page['category']['id'])) |
---|
9 | { |
---|
10 | $cat_id = $page['category']['id']; |
---|
11 | $clause = '(cat_id = ' . $cat_id . ' OR cat_id IS NULL)'; |
---|
12 | } |
---|
13 | else |
---|
14 | { |
---|
15 | $cat_id = ''; |
---|
16 | $clause = 'cat_id IS NULL'; |
---|
17 | } |
---|
18 | |
---|
19 | $q = 'SELECT sound.id AS id, sound.file AS sound, ic.volume AS volume |
---|
20 | FROM ' . WFS_SOUNDS_TABLE . ' AS sound |
---|
21 | INNER JOIN ' . WFS_IMG_CAT_TABLE . ' AS ic |
---|
22 | ON sound.id = ic.sound_id |
---|
23 | WHERE ic.image_id = ' . $img_id . ' AND ' . $clause . ' |
---|
24 | ORDER BY ic.cat_id DESC;'; |
---|
25 | |
---|
26 | $result = mysql_fetch_assoc(pwg_query($q)); |
---|
27 | |
---|
28 | if (is_admin()) |
---|
29 | { |
---|
30 | $template->assign('mp3_button', array( |
---|
31 | 'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&section=' . WFS_DIR . '%2Fadmin%2Fadd_page_on_picture.php&catid=' . $cat_id . '&imgid=' . $img_id . '&backurl=' . $_SERVER['REQUEST_URI'], |
---|
32 | 'ICON' => WFS_PATH . 'template/add_button.png')); |
---|
33 | } |
---|
34 | |
---|
35 | if (isset($result['sound'])) |
---|
36 | { |
---|
37 | if (file_exists($result['sound'])) |
---|
38 | { |
---|
39 | if (!empty($result['volume'])) |
---|
40 | { |
---|
41 | $wfs_conf[1] = $result['volume']; |
---|
42 | } |
---|
43 | $template->assign('wfs', array( |
---|
44 | 'MP3' => WFS_PATH . 'dewplayer.swf?son=' . strtr($result['sound'] , array(' ' => '%20')), |
---|
45 | 'VOLUME' => $wfs_conf[1], |
---|
46 | 'PLAYER_WIDTH' => $wfs_conf[2] - 2, // 2px de moins pour la nouvelle version de dewplayer |
---|
47 | 'AUTOSTART' => $wfs_conf[3], |
---|
48 | 'AUTOREPLAY' => $wfs_conf[4])); |
---|
49 | } |
---|
50 | else |
---|
51 | { |
---|
52 | pwg_query('DELETE FROM ' . WFS_IMG_CAT_TABLE . ' WHERE sound_id = ' . $result['id'] . ';'); |
---|
53 | pwg_query('DELETE FROM ' . WFS_SOUNDS_TABLE . ' WHERE id = ' . $result['id'] . ';'); |
---|
54 | } |
---|
55 | } |
---|
56 | |
---|
57 | $template->set_filenames(array('wfs' => dirname(__FILE__) . '/template/wfs_on_picture.tpl')); |
---|
58 | $template->concat('PLUGIN_PICTURE_ACTIONS', $template->parse('wfs', true)); |
---|
59 | |
---|
60 | ?> |
---|