[3329] | 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 | |
---|
[3501] | 7 | ///////////[ interdiction groupe |
---|
| 8 | global $prefixeTable; |
---|
| 9 | $query = ' |
---|
| 10 | SELECT 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']; |
---|
| 14 | if ( $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 | } |
---|
[3329] | 33 | |
---|
[3501] | 34 | } |
---|
| 35 | if (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 | ////////// |
---|
| 46 | else { |
---|
| 47 | |
---|
[3329] | 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 | |
---|
[3501] | 59 | |
---|
| 60 | /* |
---|
[3329] | 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 | /// |
---|
[3501] | 76 | */ |
---|
[3329] | 77 | include(PHPWG_ROOT_PATH.'include/page_header.php'); |
---|
[3507] | 78 | load_language('plugin.lang', $m_p->plugin_path); |
---|
[3329] | 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); |
---|
| 91 | while ($row = mysql_fetch_assoc($result)) { |
---|
| 92 | array_push($playlist, $row); |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | foreach ($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); |
---|
| 107 | while ($row = mysql_fetch_assoc($result)) { |
---|
| 108 | array_push($pl_ex, $row); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | foreach ($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 | // +-----------------------------------------------------------------------+ |
---|
[3507] | 120 | // | Configuration du style | |
---|
| 121 | // +-----------------------------------------------------------------------+ |
---|
| 122 | $conf_lecteur = explode("," , $conf['mp_lecteur']); |
---|
| 123 | |
---|
| 124 | if ($conf_lecteur[10]=='true') |
---|
| 125 | { |
---|
| 126 | $file = 'lecteur.css'; |
---|
| 127 | $dir = 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 | $template->assign(array( 'STYLE_FILE' => $theme_file ) ); |
---|
| 134 | } |
---|
| 135 | elseif (file_exists($template_file)) |
---|
| 136 | { |
---|
| 137 | $template->assign(array( 'STYLE_FILE' => $template_file ) ); |
---|
| 138 | } |
---|
| 139 | else |
---|
| 140 | { |
---|
| 141 | $template->assign(array( 'STYLE_FILE' => $dir.$conf_lecteur[9] ) ); |
---|
| 142 | } |
---|
| 143 | } |
---|
| 144 | else |
---|
| 145 | { |
---|
| 146 | $template->assign(array( 'STYLE_FILE' => $dir.$conf_lecteur[9] ) ); |
---|
| 147 | } |
---|
| 148 | if ($conf_lecteur[10]=='true') |
---|
| 149 | { |
---|
| 150 | |
---|
| 151 | $file = 'lecteur.conf.php'; |
---|
| 152 | $dir = LOCALEDIT_PATH.'template/style/'; |
---|
| 153 | $theme_file = $dir.$user['template'].'/'.$user['theme'].'/'.$file; |
---|
| 154 | $template_file = $dir.$user['template'].'/'.$file; |
---|
| 155 | |
---|
| 156 | if (file_exists($theme_file)) |
---|
| 157 | { |
---|
| 158 | include($theme_file); |
---|
| 159 | } |
---|
| 160 | elseif (file_exists($template_file)) |
---|
| 161 | { |
---|
| 162 | include($template_file) ; |
---|
| 163 | } |
---|
| 164 | else |
---|
| 165 | { |
---|
| 166 | $name = explode('.', $conf_lecteur[9]); |
---|
| 167 | include_once($dir.$name[0].'.conf.php'); |
---|
| 168 | } |
---|
| 169 | } |
---|
| 170 | else |
---|
| 171 | { |
---|
| 172 | $name = explode('.', $conf_lecteur[9]); |
---|
| 173 | include_once($dir.$name[0].'.conf.php'); |
---|
| 174 | } |
---|
| 175 | |
---|
| 176 | |
---|
| 177 | |
---|
| 178 | // +-----------------------------------------------------------------------+ |
---|
[3329] | 179 | // | Configuration du lecteur | |
---|
| 180 | // +-----------------------------------------------------------------------+ |
---|
| 181 | |
---|
| 182 | |
---|
| 183 | if ($conf_lecteur[5]=='true') $shuffle=$conf_lecteur[5]; else $shuffle="false"; |
---|
| 184 | if ($conf_lecteur[6]=='true') $repeat=$conf_lecteur[6]; else $repeat="list"; |
---|
| 185 | if ($conf_lecteur[8]=='true') $autoscroll=$conf_lecteur[8]; else $autoscroll="false"; |
---|
| 186 | |
---|
| 187 | if ($conf_lecteur[7]!='0') |
---|
| 188 | { |
---|
| 189 | $rep = pwg_query('SELECT url FROM '.MP_PLAYLIST.' WHERE id IN (\''.$conf_lecteur[7].'\') ;'); |
---|
| 190 | $pl = mysql_fetch_array($rep); |
---|
| 191 | $url=$pl['url']; |
---|
| 192 | $url='music/'.$url.'/'.$url.'.xml'; |
---|
| 193 | $autostart='true'; |
---|
| 194 | } |
---|
| 195 | else { |
---|
| 196 | $url='player/playlist.xml'; |
---|
| 197 | $autostart='false'; |
---|
| 198 | } |
---|
| 199 | |
---|
| 200 | ////assignement des valeurs |
---|
| 201 | $template->assign( |
---|
| 202 | array( |
---|
| 203 | 'H_TT' => $conf_lecteur[0], |
---|
| 204 | 'L_TT' => $conf_lecteur[1], |
---|
| 205 | 'H' => $conf_lecteur[2], |
---|
| 206 | 'L' => $conf_lecteur[4], |
---|
| 207 | 'SHUFFLE' => $shuffle, |
---|
| 208 | 'REPEAT' => $repeat, |
---|
| 209 | 'AUTOSTART' => $autostart, |
---|
| 210 | 'URL' => $url, |
---|
| 211 | 'AUTOSCROLL' => $autoscroll, |
---|
[3507] | 212 | 'BACK_COLOR' => $BACK_COLOR, |
---|
| 213 | 'FRONT_COLOR' => $FRONT_COLOR, |
---|
| 214 | 'LIGHT_COLOR' => $LIGHT_COLOR, |
---|
[3329] | 215 | ) |
---|
| 216 | ); |
---|
| 217 | |
---|
| 218 | $template->set_filename('lecteur', $m_p->plugin_path.'template/lecteur.tpl'); |
---|
| 219 | |
---|
| 220 | // +-----------------------------------------------------------------------+ |
---|
| 221 | // | html code display | |
---|
| 222 | // +-----------------------------------------------------------------------+ |
---|
| 223 | $template->parse('lecteur'); |
---|
| 224 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
[3501] | 225 | }//else groupe |
---|
[3329] | 226 | //$template->p(); |
---|
| 227 | ?> |
---|