source: extensions/music_player/lecteur.php @ 7690

Last change on this file since 7690 was 6887, checked in by flop25, 14 years ago

now the plugin manage the style as before (end try)

File size: 5.9 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$title="Music Player";
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');
78load_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 style                        |
121// +-----------------------------------------------------------------------+
122$conf_lecteur = explode("," , $conf['mp_lecteur']);
123global $template;
124$r_theme_file=array();
125if ($conf_lecteur[10]=='true' and isset($template->smarty->template_dir) )
126{
127
128        $file = 'lecteur.conf.php';
129        $dir = MP_LOCALEDIT_PATH.'template/style/';
130       
131        foreach( $template->smarty->template_dir as $style)
132        {
133                $theme_file = explode("/", $style);
134                $pos = count($theme_file) - 2 ;
135                $theme_file = $dir.$theme_file[$pos].'/'.$file;
136                if (file_exists($theme_file))
137                {
138                        $r_theme_file[]=$theme_file;
139                }
140        }
141       
142       
143}
144if (!empty($r_theme_file))
145{
146        foreach( $r_theme_file as $style)
147        {
148                include($style);
149        }
150}
151else
152{
153        include_once($conf_lecteur[9]);
154}
155
156$template->assign(array( 'STYLE_FILE' => $STYLE_FILE ) );
157
158// +-----------------------------------------------------------------------+
159// |                         Configuration du lecteur                      |
160// +-----------------------------------------------------------------------+
161
162
163if ($conf_lecteur[5]=='true') $shuffle=$conf_lecteur[5]; else $shuffle="false";
164if ($conf_lecteur[6]=='true') $repeat=$conf_lecteur[6]; else $repeat="list";
165if ($conf_lecteur[8]=='true') $autoscroll=$conf_lecteur[8]; else $autoscroll="false";
166
167if ($conf_lecteur[7]!='0')
168{
169$rep = pwg_query('SELECT url FROM '.MP_PLAYLIST.' WHERE id IN (\''.$conf_lecteur[7].'\') ;');
170$pl = mysql_fetch_array($rep);
171$url=$pl['url'];
172$url='music/'.$url.'/'.$url.'.xml';
173$autostart='true';
174}
175else {
176$url='player/playlist.xml';
177$autostart='false';
178}
179
180////assignement des valeurs
181$template->assign(
182    array(
183      'H_TT' => $conf_lecteur[0],
184      'L_TT' => $conf_lecteur[1],
185//      'L_TABLE' => $conf_lecteur[1]+125,
186      'H' => $conf_lecteur[2],
187      'L' => $conf_lecteur[4],
188      'SHUFFLE' => $shuffle,
189      'REPEAT' => $repeat,
190      'AUTOSTART' => $autostart,
191      'URL' => $url,
192      'AUTOSCROLL' => $autoscroll,
193      'BACK_COLOR' => $BACK_COLOR,
194      'FRONT_COLOR' => $FRONT_COLOR,
195      'LIGHT_COLOR' => $LIGHT_COLOR,
196    )
197  );
198$template->set_filename('lecteur', $TPL_FILE);
199
200// +-----------------------------------------------------------------------+
201// | html code display                                                     |
202// +-----------------------------------------------------------------------+
203$template->parse('lecteur');
204include(PHPWG_ROOT_PATH.'include/page_tail.php');
205}//else groupe
206//$template->p();
207?>
Note: See TracBrowser for help on using the repository browser.