source: extensions/WiredForSound/wfs_on_picture.php @ 15555

Last change on this file since 15555 was 3609, checked in by patdenice, 15 years ago

Convert all php and tpl files in Unix format for my plugins.

File size: 1.8 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4load_language('plugin.lang', WFS_PATH);
5
6$wfs_conf = explode(',' , $conf['wired_for_sound']);
7$img_id = $page['image_id'];
8if (isset($page['category']['id']))
9{
10  $cat_id = $page['category']['id'];
11  $clause = '(cat_id = ' . $cat_id . ' OR cat_id IS NULL)';
12}
13else
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
20FROM ' . WFS_SOUNDS_TABLE . ' AS sound
21INNER JOIN ' . WFS_IMG_CAT_TABLE . ' AS ic
22ON sound.id = ic.sound_id
23WHERE ic.image_id = ' . $img_id . '  AND ' . $clause . '
24ORDER BY ic.cat_id DESC;';
25
26$result = mysql_fetch_assoc(pwg_query($q));
27
28if (is_admin())
29{
30  $template->assign('mp3_button', array(
31    'URL' => PHPWG_ROOT_PATH . 'admin.php?page=plugin&amp;section=' . WFS_DIR . '%2Fadmin%2Fadd_page_on_picture.php&amp;catid=' . $cat_id . '&amp;imgid=' . $img_id . '&amp;backurl=' . $_SERVER['REQUEST_URI'],
32    'ICON' => WFS_PATH . 'template/add_button.png'));
33}
34
35if (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?>
Note: See TracBrowser for help on using the repository browser.