source: extensions/music_player/lecteur.php @ 3501

Last change on this file since 3501 was 3501, checked in by flop25, 15 years ago
File size: 4.8 KB
Line 
1<?php
2define('PHPWG_ROOT_PATH','../../');
3include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
4
5$m_p = get_plugin_data('music_player');
6
7///////////[ interdiction groupe
8global $prefixeTable;
9$query = '
10SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.'
11  WHERE name IN (\'music_group\') ;';
12$data_grp = mysql_fetch_array(pwg_query($query));
13$exist_group = $data_grp['result'];   
14if ( $exist_group == 1 )
15{
16        $display=0;
17        $query = 'SELECT group_id FROM '.USER_GROUP_TABLE.' WHERE user_id IN (\''.$user['id'].'\');';
18        $result = pwg_query($query);
19        $grp_id = array();
20        while ($row = mysql_fetch_assoc($result)) {
21                array_push($grp_id, $row);
22        }
23       
24        foreach ($grp_id as $grp)
25        {
26                $query = 'SELECT id FROM '.GROUPS_TABLE.' WHERE name IN (\'music_group\') ;';
27                $rep = mysql_fetch_array(pwg_query($query));
28                if ($rep['id']==$grp['group_id'] )
29                {
30                        $display=1;
31                }
32        }
33
34}
35if (isset($display) and $display==0)
36{
37        include(PHPWG_ROOT_PATH.'include/page_header.php');
38        load_language('plugin.lang', $m_p->plugin_path);
39        $template->set_filename('lecteur', $m_p->plugin_path.'template/no.tpl');
40        $template->parse('lecteur');
41        include(PHPWG_ROOT_PATH.'include/page_tail.php');
42       
43       
44}
45//////////
46else {
47
48$page['body_id'] = 'lecteur';
49
50  global $conf;
51  $conf_plugin = explode("," , $conf['mp_plugin']);
52  $template->assign(
53    array(
54      'conf_plugin_1' => $conf_plugin[1],
55      'conf_plugin_2' => $conf_plugin[2],
56    )
57  );
58
59
60/*
61/////[ si metre en evidence
62        if ($conf_plugin[0]=="true")
63        {
64          $mp_ses = pwg_get_session_var( 'pwg_music_player', '' );
65          //si on a cliqué oui pour afficher, en fait on change les var pour n'afficher qu'une fois le lecteur
66      if ( $_COOKIE['pwg_music_player'] == 'open')
67      {
68          setcookie( 'pwg_music_player', 'open_once', time()+60*60*24*10, cookie_path() );
69          }
70          elseif ($mp_ses == 'open')
71          {
72          pwg_set_session_var( 'pwg_music_player', 'open_once' );
73          }
74        }
75///
76*/
77include(PHPWG_ROOT_PATH.'include/page_header.php');
78        load_language('plugin.lang', $m_p->plugin_path);
79
80$template->assign(
81  array(
82    'PLUGIN_NAME' => $m_p->plugin_name
83    ));
84
85// +-----------------------------------------------------------------------+
86// |                  affichage des playlist existante                     |
87// +-----------------------------------------------------------------------+
88$playlist = array();
89$query = 'SELECT url, texte FROM '.MP_PLAYLIST.' WHERE type IN (\'local\') ORDER BY id ;';
90$result = pwg_query($query);
91while ($row = mysql_fetch_assoc($result)) {
92    array_push($playlist, $row);
93}
94
95foreach ($playlist as $list) {
96
97    $txt = stripslashes($list['texte']);
98        $template->append('playlist',
99            array('URL' => 'music/'.$list['url'].'/'.$list['url'].'.xml',
100                'TEXTE' => $txt,
101                                ));
102}
103
104$pl_ex = array();
105$query = 'SELECT id, texte FROM '.MP_PLAYLIST.' WHERE type IN (\'externe\') ORDER BY id ;';
106$result = pwg_query($query);
107while ($row = mysql_fetch_assoc($result)) {
108    array_push($pl_ex, $row);
109}
110
111foreach ($pl_ex as $list) {
112
113    $txt = stripslashes($list['texte']);
114        $template->append('playlist',
115            array('URL' => 'music/externe/'.$list['id'].'.php',
116                'TEXTE' => $txt,
117                                ));
118}
119// +-----------------------------------------------------------------------+
120// |                         Configuration du lecteur                      |
121// +-----------------------------------------------------------------------+
122
123$conf_lecteur = explode("," , $conf['mp_lecteur']);
124
125if ($conf_lecteur[5]=='true') $shuffle=$conf_lecteur[5]; else $shuffle="false";
126if ($conf_lecteur[6]=='true') $repeat=$conf_lecteur[6]; else $repeat="list";
127if ($conf_lecteur[8]=='true') $autoscroll=$conf_lecteur[8]; else $autoscroll="false";
128
129if ($conf_lecteur[7]!='0')
130{
131$rep = pwg_query('SELECT url FROM '.MP_PLAYLIST.' WHERE id IN (\''.$conf_lecteur[7].'\') ;');
132$pl = mysql_fetch_array($rep);
133$url=$pl['url'];
134$url='music/'.$url.'/'.$url.'.xml';
135$autostart='true';
136}
137else {
138$url='player/playlist.xml';
139$autostart='false';
140}
141
142////assignement des valeurs
143$template->assign(
144    array(
145      'H_TT' => $conf_lecteur[0],
146      'L_TT' => $conf_lecteur[1],
147      'H' => $conf_lecteur[2],
148      'L' => $conf_lecteur[4],
149      'SHUFFLE' => $shuffle,
150      'REPEAT' => $repeat,
151      'AUTOSTART' => $autostart,
152      'URL' => $url,
153      'AUTOSCROLL' => $autoscroll,
154    )
155  );
156
157$template->set_filename('lecteur', $m_p->plugin_path.'template/lecteur.tpl');
158
159// +-----------------------------------------------------------------------+
160// | html code display                                                     |
161// +-----------------------------------------------------------------------+
162$template->parse('lecteur');
163include(PHPWG_ROOT_PATH.'include/page_tail.php');
164}//else groupe
165//$template->p();
166?>
Note: See TracBrowser for help on using the repository browser.