[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'); |
---|
[6887] | 6 | $title="Music Player"; |
---|
[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']); |
---|
[6887] | 123 | global $template; |
---|
| 124 | $r_theme_file=array(); |
---|
| 125 | if ($conf_lecteur[10]=='true' and isset($template->smarty->template_dir) ) |
---|
| 126 | { |
---|
[3507] | 127 | |
---|
| 128 | $file = 'lecteur.conf.php'; |
---|
[3560] | 129 | $dir = MP_LOCALEDIT_PATH.'template/style/'; |
---|
[3507] | 130 | |
---|
[6887] | 131 | foreach( $template->smarty->template_dir as $style) |
---|
[3507] | 132 | { |
---|
[6887] | 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 | } |
---|
[3507] | 140 | } |
---|
[6887] | 141 | |
---|
| 142 | |
---|
| 143 | } |
---|
| 144 | if (!empty($r_theme_file)) |
---|
| 145 | { |
---|
| 146 | foreach( $r_theme_file as $style) |
---|
[3507] | 147 | { |
---|
[6887] | 148 | include($style); |
---|
[3507] | 149 | } |
---|
| 150 | } |
---|
| 151 | else |
---|
| 152 | { |
---|
[3559] | 153 | include_once($conf_lecteur[9]); |
---|
[3507] | 154 | } |
---|
| 155 | |
---|
[3559] | 156 | $template->assign(array( 'STYLE_FILE' => $STYLE_FILE ) ); |
---|
[3507] | 157 | |
---|
| 158 | // +-----------------------------------------------------------------------+ |
---|
[3329] | 159 | // | Configuration du lecteur | |
---|
| 160 | // +-----------------------------------------------------------------------+ |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | if ($conf_lecteur[5]=='true') $shuffle=$conf_lecteur[5]; else $shuffle="false"; |
---|
| 164 | if ($conf_lecteur[6]=='true') $repeat=$conf_lecteur[6]; else $repeat="list"; |
---|
| 165 | if ($conf_lecteur[8]=='true') $autoscroll=$conf_lecteur[8]; else $autoscroll="false"; |
---|
| 166 | |
---|
| 167 | if ($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 | } |
---|
| 175 | else { |
---|
| 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], |
---|
[3561] | 185 | // 'L_TABLE' => $conf_lecteur[1]+125, |
---|
[3329] | 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, |
---|
[3507] | 193 | 'BACK_COLOR' => $BACK_COLOR, |
---|
| 194 | 'FRONT_COLOR' => $FRONT_COLOR, |
---|
| 195 | 'LIGHT_COLOR' => $LIGHT_COLOR, |
---|
[3329] | 196 | ) |
---|
| 197 | ); |
---|
[3559] | 198 | $template->set_filename('lecteur', $TPL_FILE); |
---|
[3329] | 199 | |
---|
| 200 | // +-----------------------------------------------------------------------+ |
---|
| 201 | // | html code display | |
---|
| 202 | // +-----------------------------------------------------------------------+ |
---|
| 203 | $template->parse('lecteur'); |
---|
| 204 | include(PHPWG_ROOT_PATH.'include/page_tail.php'); |
---|
[3501] | 205 | }//else groupe |
---|
[3329] | 206 | //$template->p(); |
---|
| 207 | ?> |
---|