1 | <?php |
---|
2 | define('PHPWG_ROOT_PATH','../../'); |
---|
3 | include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); |
---|
4 | |
---|
5 | /////////////// PAS DE MENU ! |
---|
6 | if ( function_exists( 'add_menu_on_public_pages' ) or function_exists( 'spread_menus_on_public_pages' ) ) |
---|
7 | { |
---|
8 | remove_event_handler('loc_after_page_header', 'add_menu_on_public_pages', 20); |
---|
9 | remove_event_handler('loc_after_page_header', 'spread_menus_on_public_pages', 20); |
---|
10 | |
---|
11 | } |
---|
12 | |
---|
13 | $m_p = get_plugin_data('music_player'); |
---|
14 | $title="Music Player"; |
---|
15 | ///////////[ interdiction groupe |
---|
16 | global $prefixeTable; |
---|
17 | $query = ' |
---|
18 | SELECT COUNT(*) AS result FROM '.GROUPS_TABLE.' |
---|
19 | WHERE name IN (\'music_group\') ;'; |
---|
20 | $data_grp = pwg_db_fetch_array(pwg_query($query)); |
---|
21 | $exist_group = $data_grp['result']; |
---|
22 | if ( $exist_group == 1 ) |
---|
23 | { |
---|
24 | $display=0; |
---|
25 | $query = 'SELECT group_id FROM '.USER_GROUP_TABLE.' WHERE user_id IN (\''.$user['id'].'\');'; |
---|
26 | $result = pwg_query($query); |
---|
27 | $grp_id = array(); |
---|
28 | while ($row = pwg_db_fetch_assoc($result)) { |
---|
29 | array_push($grp_id, $row); |
---|
30 | } |
---|
31 | |
---|
32 | foreach ($grp_id as $grp) |
---|
33 | { |
---|
34 | $query = 'SELECT id FROM '.GROUPS_TABLE.' WHERE name IN (\'music_group\') ;'; |
---|
35 | $rep = pwg_db_fetch_array(pwg_query($query)); |
---|
36 | if ($rep['id']==$grp['group_id'] ) |
---|
37 | { |
---|
38 | $display=1; |
---|
39 | } |
---|
40 | } |
---|
41 | |
---|
42 | } |
---|
43 | if (isset($display) and $display==0) |
---|
44 | { |
---|
45 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
46 | load_language('plugin.lang', $m_p->plugin_path); |
---|
47 | $template->set_filename('lecteur', $m_p->plugin_path.'template/no.tpl'); |
---|
48 | $template->parse('lecteur'); |
---|
49 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
50 | |
---|
51 | |
---|
52 | } |
---|
53 | ////////// |
---|
54 | else { |
---|
55 | |
---|
56 | $page['body_id'] = 'theMPlecteur'; |
---|
57 | global $conf; |
---|
58 | $conf_plugin = explode("," , $conf['mp_plugin']); |
---|
59 | $template->assign( |
---|
60 | array( |
---|
61 | 'conf_plugin_1' => $conf_plugin[1], |
---|
62 | 'conf_plugin_2' => $conf_plugin[2], |
---|
63 | ) |
---|
64 | ); |
---|
65 | |
---|
66 | |
---|
67 | /* |
---|
68 | /////[ si metre en evidence |
---|
69 | if ($conf_plugin[0]=="true") |
---|
70 | { |
---|
71 | $mp_ses = pwg_get_session_var( 'pwg_music_player', '' ); |
---|
72 | //si on a cliqué oui pour afficher, en fait on change les var pour n'afficher qu'une fois le lecteur |
---|
73 | if ( $_COOKIE['pwg_music_player'] == 'open') |
---|
74 | { |
---|
75 | setcookie( 'pwg_music_player', 'open_once', time()+60*60*24*10, cookie_path() ); |
---|
76 | } |
---|
77 | elseif ($mp_ses == 'open') |
---|
78 | { |
---|
79 | pwg_set_session_var( 'pwg_music_player', 'open_once' ); |
---|
80 | } |
---|
81 | } |
---|
82 | /// |
---|
83 | */ |
---|
84 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
85 | load_language('plugin.lang', $m_p->plugin_path); |
---|
86 | |
---|
87 | $template->assign( |
---|
88 | array( |
---|
89 | 'PLUGIN_NAME' => $m_p->plugin_name |
---|
90 | )); |
---|
91 | |
---|
92 | // +-----------------------------------------------------------------------+ |
---|
93 | // | affichage des playlist existante | |
---|
94 | // +-----------------------------------------------------------------------+ |
---|
95 | $playlist = array(); |
---|
96 | $query = 'SELECT url, texte FROM '.MP_PLAYLIST.' WHERE type IN (\'local\') ORDER BY id ;'; |
---|
97 | $result = pwg_query($query); |
---|
98 | while ($row = pwg_db_fetch_assoc($result)) { |
---|
99 | array_push($playlist, $row); |
---|
100 | } |
---|
101 | |
---|
102 | foreach ($playlist as $list) { |
---|
103 | |
---|
104 | $txt = stripslashes($list['texte']); |
---|
105 | $template->append('playlist', |
---|
106 | array('URL' => 'music/'.$list['url'].'/'.$list['url'].'.xml', |
---|
107 | 'TEXTE' => $txt, |
---|
108 | )); |
---|
109 | } |
---|
110 | |
---|
111 | $pl_ex = array(); |
---|
112 | $query = 'SELECT id, texte FROM '.MP_PLAYLIST.' WHERE type IN (\'externe\') ORDER BY id ;'; |
---|
113 | $result = pwg_query($query); |
---|
114 | while ($row = pwg_db_fetch_assoc($result)) { |
---|
115 | array_push($pl_ex, $row); |
---|
116 | } |
---|
117 | |
---|
118 | foreach ($pl_ex as $list) { |
---|
119 | |
---|
120 | $txt = stripslashes($list['texte']); |
---|
121 | $template->append('playlist', |
---|
122 | array('URL' => 'music/externe/'.$list['id'].'.php', |
---|
123 | 'TEXTE' => $txt, |
---|
124 | )); |
---|
125 | } |
---|
126 | // +-----------------------------------------------------------------------+ |
---|
127 | // | Configuration du style | |
---|
128 | // +-----------------------------------------------------------------------+ |
---|
129 | $conf_lecteur = explode("," , $conf['mp_lecteur']); |
---|
130 | global $template; |
---|
131 | $r_theme_file=array(); |
---|
132 | if ($conf_lecteur[10]=='true' and isset($template->smarty->template_dir) ) |
---|
133 | { |
---|
134 | |
---|
135 | $file = 'lecteur.conf.php'; |
---|
136 | $dir = MP_LOCALEDIT_PATH.'template/style/'; |
---|
137 | |
---|
138 | foreach( $template->smarty->template_dir as $style) |
---|
139 | { |
---|
140 | $theme_file = explode("/", $style); |
---|
141 | $pos = count($theme_file) - 2 ; |
---|
142 | $theme_file = $dir.$theme_file[$pos].'/'.$file; |
---|
143 | if (file_exists($theme_file)) |
---|
144 | { |
---|
145 | $r_theme_file[]=$theme_file; |
---|
146 | } |
---|
147 | } |
---|
148 | |
---|
149 | |
---|
150 | } |
---|
151 | if (!empty($r_theme_file)) |
---|
152 | { |
---|
153 | foreach( $r_theme_file as $style) |
---|
154 | { |
---|
155 | include($style); |
---|
156 | } |
---|
157 | } |
---|
158 | else |
---|
159 | { |
---|
160 | include_once($conf_lecteur[9]); |
---|
161 | } |
---|
162 | |
---|
163 | $template->assign(array( 'STYLE_FILE' => $STYLE_FILE ) ); |
---|
164 | |
---|
165 | // +-----------------------------------------------------------------------+ |
---|
166 | // | Configuration du lecteur | |
---|
167 | // +-----------------------------------------------------------------------+ |
---|
168 | |
---|
169 | |
---|
170 | if ($conf_lecteur[5]=='true') $shuffle=$conf_lecteur[5]; else $shuffle="false"; |
---|
171 | if ($conf_lecteur[6]=='true') $repeat=$conf_lecteur[6]; else $repeat="list"; |
---|
172 | if ($conf_lecteur[8]=='true') $autoscroll=$conf_lecteur[8]; else $autoscroll="false"; |
---|
173 | |
---|
174 | if ($conf_lecteur[7]!='0') |
---|
175 | { |
---|
176 | $rep = pwg_query('SELECT url FROM '.MP_PLAYLIST.' WHERE id IN (\''.$conf_lecteur[7].'\') ;'); |
---|
177 | $pl = pwg_db_fetch_array($rep); |
---|
178 | $url=$pl['url']; |
---|
179 | $url='music/'.$url.'/'.$url.'.xml'; |
---|
180 | $autostart='true'; |
---|
181 | } |
---|
182 | else { |
---|
183 | $url='player/playlist.xml'; |
---|
184 | $autostart='false'; |
---|
185 | } |
---|
186 | |
---|
187 | ////assignement des valeurs |
---|
188 | $template->assign( |
---|
189 | array( |
---|
190 | 'H_TT' => $conf_lecteur[0], |
---|
191 | 'L_TT' => $conf_lecteur[1], |
---|
192 | // 'L_TABLE' => $conf_lecteur[1]+125, |
---|
193 | 'H' => $conf_lecteur[2], |
---|
194 | 'L' => $conf_lecteur[4], |
---|
195 | 'SHUFFLE' => $shuffle, |
---|
196 | 'REPEAT' => $repeat, |
---|
197 | 'AUTOSTART' => $autostart, |
---|
198 | 'URL' => $url, |
---|
199 | 'AUTOSCROLL' => $autoscroll, |
---|
200 | 'BACK_COLOR' => $BACK_COLOR, |
---|
201 | 'FRONT_COLOR' => $FRONT_COLOR, |
---|
202 | 'LIGHT_COLOR' => $LIGHT_COLOR, |
---|
203 | ) |
---|
204 | ); |
---|
205 | $template->set_filename('lecteur', $TPL_FILE); |
---|
206 | |
---|
207 | // +-----------------------------------------------------------------------+ |
---|
208 | // | html code display | |
---|
209 | // +-----------------------------------------------------------------------+ |
---|
210 | $template->parse('lecteur'); |
---|
211 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
212 | }//else groupe |
---|
213 | //$template->p(); |
---|
214 | ?> |
---|