Ignore:
Timestamp:
Jul 9, 2009, 6:54:57 PM (15 years ago)
Author:
flop25
Message:

-color config for style
-my_phone global style
-add text needed in admin page
-all var are now in *.conf.php files
-config by default changed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/music_player/admin/admin.php

    r3557 r3559  
    361361if ($_POST['envoi_config']=='lecteur')
    362362{
    363  
     363  if ($_POST['style']=='NULL')
     364  {
     365          $style=$conf_lecteur['9'];
     366  }
     367  else
     368  {
     369          $style=$_POST['style'];
     370  }
    364371 
    365372  if ($_POST['mp_miniature']=="true")
     
    375382      $_POST['mp_autostart'],
    376383      $_POST['mp_autoscroll'],
    377       $_POST['style'],
     384      $style,
    378385      $_POST['various_style'],
    379386    );
     
    392399      $_POST['mp_autostart'],
    393400      $_POST['mp_autoscroll'],
    394       $_POST['style'],
     401      $style,
    395402      $_POST['various_style'],
    396403    );
     
    430437
    431438$check='checked="checked"';
    432 if ($conf_lecteur[3]=='true') $miniature=$check;
    433 if ($conf_lecteur[5]=='true') $shuffle=$check;
    434 if ($conf_lecteur[6]=='true') $repeat=$check;
    435 if ($conf_lecteur[8]=='true') $autoscroll=$check;
    436 if ($conf_lecteur[10]=='true') $various_style=$check;
     439if ($conf_lecteur[3]=='true') { $miniature=$check; } else { $miniature=NULL; }
     440if ($conf_lecteur[5]=='true') { $shuffle=$check; } else { $shuffle=NULL; }
     441if ($conf_lecteur[6]=='true') { $repeat=$check; } else { $repeat=NULL; }
     442if ($conf_lecteur[8]=='true') { $autoscroll=$check; } else { $autoscroll=NULL; }
     443if ($conf_lecteur[10]=='true') { $various_style=$check; } else { $various_style=NULL; }
    437444
    438445if ($conf_lecteur[7]!='0')
     
    444451else {$txt="Defaut"; }
    445452
    446 if ($conf_plugin[0]=='true') $evidence=$check;
    447 if ($conf_plugin[1]=='true') $head=$check;
    448 if ($conf_plugin[2]=='true') $foot=$check;
     453if ($conf_plugin[0]=='true') { $evidence=$check; } else { $evidence=NULL; }
     454if ($conf_plugin[1]=='true') { $head=$check; } else { $head=NULL; }
     455if ($conf_plugin[2]=='true') { $foot=$check; } else { $foot=NULL; }
    449456
    450457////////////////////////////////////////////////
    451458////////[ liste des styles globaux //////////
    452459////////////////////////////////////////////////
    453         $fichier = array();
     460        /*$fichier = array();
    454461        $dir = opendir('./plugins/music_player/template/style'); //ouvre le repertoire courant désigné par la variable
    455462     while(false!==($file = readdir($dir))){ //on lit tout et on récupere tout les dossiers dans $folder
     
    478485    natcasesort($fichier); //la fonction natcasesort( ) est la fonction de tri standard sauf qu'elle ignore la casse
    479486   
    480        
    481         foreach($fichier as $file) {
    482                 if ($conf_lecteur[9]==$file)
    483                 {
     487        */
     488
     489function recursive_readdir ($dir) {
     490        global $conf, $template;
     491        $conf_lecteur = explode("," , $conf['mp_lecteur']);
     492        $dh = opendir ($dir); // on l'ouvre
     493        while (($file = readdir ($dh)) !== false ) { //boucle pour parcourir le repertoire
     494                if ($file !== '.' && $file !== '..') { // no comment
     495                        $path =$dir.'/'.$file; // construction d'un joli chemin...
     496                        if (is_dir ($path)) { //si on tombe sur un sous-repertoire
     497                                //echo '<p style="font-weight: bold; border : 1pt solid #000000;">', $path, ' -> dir</p>'; // ptit style...
     498                                recursive_readdir ($path); // appel recursif pour lire a l'interieur de ce sous-repertoire
     499                        }
     500                        else
     501                        {
     502                                //echo $path, '<br />'; // si il s'agit d'un fichier, on affiche, tout simplement.
     503                          $page = explode('.', $file);
     504                          $nb = count($page);
     505                          $nom_fichier = $page[0];
     506                          for ($i = 1; $i < $nb-1; $i++){
     507                           $nom_fichier .= '.'.$page[$i];
     508                          }
     509                          if(isset($page[1])){
     510                           $ext_fichier = $page[$nb-2].'.'.$page[$nb-1];
     511                          }
     512                          else {
     513                           $ext_fichier = '';
     514                          }
    484515                       
    485                         $template->append('list_style',
    486                                 array('FILE' => $file,
    487                                           'TEXTE' => '->'.$file,
    488                                           ));
    489                 }
    490                 else
    491                 {
    492                         $template->append('list_style',
    493                         array('FILE' => $file,
    494                                   'TEXTE' => $file,
    495                                   ));
     516                          if($ext_fichier == 'conf.php') { //On ne prend que les css
     517                                  $path = str_replace("/plugins/music_player", "", $path);
     518                                  if ($conf_lecteur[9]==$path)
     519                                  {
     520                                          $template->append('list_style',
     521                                                  array('FILE' => $path,
     522                                                                'TEXTE' => ' --> '.$path,
     523                                                                ));
     524                                  }
     525                                  else
     526                                  {
     527                                          $template->append('list_style',
     528                                          array('FILE' => $path,
     529                                                        'TEXTE' => $path,
     530                                                        ));
     531                                  }
     532                          }
     533                        }
    496534                }
    497535        }
     536        closedir ($dh); // on ferme le repertoire courant
     537}       
     538recursive_readdir ('./plugins/music_player/template/style');
     539       
    498540
    499541
    500542////assignement des valeurs
    501 if (isset($foot) and isset($head) and isset($shuffle) and isset($repeat)){
    502543        $template->assign(
    503544                array(
     
    521562                )
    522563          );
    523 }
     564
    524565// +-----------------------------------------------------------------------+
    525566// |               affichage des msg                                       |
Note: See TracChangeset for help on using the changeset viewer.