1 | <?php |
---|
2 | define('PHPWG_ROOT_PATH','../../'); |
---|
3 | include_once(PHPWG_ROOT_PATH.'include/common.inc.php'); |
---|
4 | |
---|
5 | $m_p = get_plugin_data('music_player'); |
---|
6 | |
---|
7 | |
---|
8 | $page['body_id'] = 'lecteur'; |
---|
9 | |
---|
10 | //css et js |
---|
11 | /* |
---|
12 | $title= 'Lecteur'; |
---|
13 | $template -> assign_block_vars( |
---|
14 | 'head_element', array ( |
---|
15 | 'CONTENT' => '<link rel="stylesheet" type="text/css" href="./template/lecteur.css">' |
---|
16 | ) |
---|
17 | ); |
---|
18 | $template -> assign_block_vars( |
---|
19 | 'head_element', array ( |
---|
20 | 'CONTENT' => '<script type="text/javascript" src="./player/swfobject.js"></script>' |
---|
21 | ) |
---|
22 | ); |
---|
23 | $template -> assign_block_vars( |
---|
24 | 'head_element', array ( |
---|
25 | 'CONTENT' => '<script type="text/javascript"> |
---|
26 | |
---|
27 | function loadFile(obj) { thisMovie("playlist").loadFile(obj); }; |
---|
28 | // This is a javascript handler for the player and is always needed. |
---|
29 | function thisMovie(movieName) { |
---|
30 | if(navigator.appName.indexOf("Microsoft") != -1) { |
---|
31 | return window[movieName]; |
---|
32 | } else { |
---|
33 | return document[movieName]; |
---|
34 | } |
---|
35 | }; |
---|
36 | |
---|
37 | </script>' |
---|
38 | ) |
---|
39 | );*/ |
---|
40 | global $conf; |
---|
41 | $conf_plugin = explode("," , $conf['mp_plugin']); |
---|
42 | $template->assign( |
---|
43 | array( |
---|
44 | 'conf_plugin_1' => $conf_plugin[1], |
---|
45 | 'conf_plugin_2' => $conf_plugin[2], |
---|
46 | ) |
---|
47 | ); |
---|
48 | |
---|
49 | /*if ($conf_plugin[1]!='true') |
---|
50 | { |
---|
51 | $template -> assign_block_vars( |
---|
52 | 'head_element', array ( |
---|
53 | 'CONTENT' => '<style type="text/css"> |
---|
54 | #theHeader |
---|
55 | { |
---|
56 | display:none; |
---|
57 | } |
---|
58 | </style>' |
---|
59 | ) |
---|
60 | ); |
---|
61 | } |
---|
62 | if ($conf_plugin[2]!='true') |
---|
63 | { |
---|
64 | $template -> assign_block_vars( |
---|
65 | 'head_element', array ( |
---|
66 | 'CONTENT' => '<style type="text/css"> |
---|
67 | #copyright |
---|
68 | { |
---|
69 | display:none; |
---|
70 | } </style>' |
---|
71 | ) |
---|
72 | ); |
---|
73 | }*/ |
---|
74 | |
---|
75 | /////[ si metre en evidence |
---|
76 | if ($conf_plugin[0]=="true") |
---|
77 | { |
---|
78 | $mp_ses = pwg_get_session_var( 'pwg_music_player', '' ); |
---|
79 | //si on a cliqué oui pour afficher, en fait on change les var pour n'afficher qu'une fois le lecteur |
---|
80 | if ( $_COOKIE['pwg_music_player'] == 'open') |
---|
81 | { |
---|
82 | setcookie( 'pwg_music_player', 'open_once', time()+60*60*24*10, cookie_path() ); |
---|
83 | } |
---|
84 | elseif ($mp_ses == 'open') |
---|
85 | { |
---|
86 | pwg_set_session_var( 'pwg_music_player', 'open_once' ); |
---|
87 | } |
---|
88 | } |
---|
89 | /// |
---|
90 | |
---|
91 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
92 | load_language('plugin.lang', $m_p->plugin_path); |
---|
93 | |
---|
94 | $template->assign( |
---|
95 | array( |
---|
96 | 'PLUGIN_NAME' => $m_p->plugin_name |
---|
97 | )); |
---|
98 | |
---|
99 | // +-----------------------------------------------------------------------+ |
---|
100 | // | affichage des playlist existante | |
---|
101 | // +-----------------------------------------------------------------------+ |
---|
102 | $playlist = array(); |
---|
103 | $query = 'SELECT url, texte FROM '.MP_PLAYLIST.' WHERE type IN (\'local\') ORDER BY id ;'; |
---|
104 | $result = pwg_query($query); |
---|
105 | while ($row = mysql_fetch_assoc($result)) { |
---|
106 | array_push($playlist, $row); |
---|
107 | } |
---|
108 | |
---|
109 | foreach ($playlist as $list) { |
---|
110 | |
---|
111 | $txt = stripslashes($list['texte']); |
---|
112 | $template->append('playlist', |
---|
113 | array('URL' => 'music/'.$list['url'].'/'.$list['url'].'.xml', |
---|
114 | 'TEXTE' => $txt, |
---|
115 | )); |
---|
116 | } |
---|
117 | |
---|
118 | $pl_ex = array(); |
---|
119 | $query = 'SELECT id, texte FROM '.MP_PLAYLIST.' WHERE type IN (\'externe\') ORDER BY id ;'; |
---|
120 | $result = pwg_query($query); |
---|
121 | while ($row = mysql_fetch_assoc($result)) { |
---|
122 | array_push($pl_ex, $row); |
---|
123 | } |
---|
124 | |
---|
125 | foreach ($pl_ex as $list) { |
---|
126 | |
---|
127 | $txt = stripslashes($list['texte']); |
---|
128 | $template->append('playlist', |
---|
129 | array('URL' => 'music/externe/'.$list['id'].'.php', |
---|
130 | 'TEXTE' => $txt, |
---|
131 | )); |
---|
132 | } |
---|
133 | // +-----------------------------------------------------------------------+ |
---|
134 | // | Configuration du lecteur | |
---|
135 | // +-----------------------------------------------------------------------+ |
---|
136 | |
---|
137 | $conf_lecteur = explode("," , $conf['mp_lecteur']); |
---|
138 | |
---|
139 | if ($conf_lecteur[5]=='true') $shuffle=$conf_lecteur[5]; else $shuffle="false"; |
---|
140 | if ($conf_lecteur[6]=='true') $repeat=$conf_lecteur[6]; else $repeat="list"; |
---|
141 | if ($conf_lecteur[8]=='true') $autoscroll=$conf_lecteur[8]; else $autoscroll="false"; |
---|
142 | |
---|
143 | if ($conf_lecteur[7]!='0') |
---|
144 | { |
---|
145 | $rep = pwg_query('SELECT url FROM '.MP_PLAYLIST.' WHERE id IN (\''.$conf_lecteur[7].'\') ;'); |
---|
146 | $pl = mysql_fetch_array($rep); |
---|
147 | $url=$pl['url']; |
---|
148 | $url='music/'.$url.'/'.$url.'.xml'; |
---|
149 | $autostart='true'; |
---|
150 | } |
---|
151 | else { |
---|
152 | $url='player/playlist.xml'; |
---|
153 | $autostart='false'; |
---|
154 | } |
---|
155 | |
---|
156 | ////assignement des valeurs |
---|
157 | $template->assign( |
---|
158 | array( |
---|
159 | 'H_TT' => $conf_lecteur[0], |
---|
160 | 'L_TT' => $conf_lecteur[1], |
---|
161 | 'H' => $conf_lecteur[2], |
---|
162 | 'L' => $conf_lecteur[4], |
---|
163 | 'SHUFFLE' => $shuffle, |
---|
164 | 'REPEAT' => $repeat, |
---|
165 | 'AUTOSTART' => $autostart, |
---|
166 | 'URL' => $url, |
---|
167 | 'AUTOSCROLL' => $autoscroll, |
---|
168 | ) |
---|
169 | ); |
---|
170 | |
---|
171 | $template->set_filename('lecteur', $m_p->plugin_path.'template/lecteur.tpl'); |
---|
172 | |
---|
173 | // +-----------------------------------------------------------------------+ |
---|
174 | // | html code display | |
---|
175 | // +-----------------------------------------------------------------------+ |
---|
176 | $template->parse('lecteur'); |
---|
177 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
178 | //$template->p(); |
---|
179 | ?> |
---|