source: extensions/music_player/lecteur.php @ 5279

Last change on this file since 5279 was 3561, checked in by flop25, 15 years ago

-all floPure/*/*.conf.php are independant and can ecrase style of user
-many test have been made !!
=> ready for 2.1.1 [traduction always needed]

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