From: <ara...@us...> - 2006-11-26 15:38:33
|
Revision: 50 http://svn.sourceforge.net/easybox-mod/?rev=50&view=rev Author: aragornis Date: 2006-11-26 07:38:30 -0800 (Sun, 26 Nov 2006) Log Message: ----------- Possibilit?\195?\169 de modifier sa skin depuis la configuration Modif sur le module "modules" Modified Paths: -------------- trunk/_framework/fonctions_partagees.inc.php trunk/_framework/framework.php trunk/_utilisateur/modules.db trunk/configuration/skin.php trunk/module/modules/modules.tpl trunk/module/mp3/playdb.php trunk/module/reseaufree/province.png Modified: trunk/_framework/fonctions_partagees.inc.php =================================================================== --- trunk/_framework/fonctions_partagees.inc.php 2006-11-19 08:37:18 UTC (rev 49) +++ trunk/_framework/fonctions_partagees.inc.php 2006-11-26 15:38:30 UTC (rev 50) @@ -537,4 +537,59 @@ sqlite_close($db); } + +function list_skin(){ +global $RACINE_REP; + $db = sqlite_open($RACINE_REP.'_utilisateur/modules.db', 0666); + + $res = sqlite_query($db,'SELECT * FROM modules WHERE type="Skin"'); + + $SKINS = array(); + while($element = sqlite_fetch_object($res)){ + $SKINS[] = array('nom'=>$element->nom,'repertoire'=>$element->repertoire,'description'=>$element->description,'version'=>$element->version); + } + sqlite_close($db); + return $SKINS; +} + + +function change_template($tpl){ +global $RACINE_REP; + +function ClearDirectory($path){ + if($dir_handle = opendir($path)){ + while($file = readdir($dir_handle)){ + if($file == "." || $file == ".."){ + if(!@unlink($path."/".$file)){ + continue; + } + }else{ + @unlink($path."/".$file); + } + } + closedir($dir_handle); + return true; +// all files deleted + }else{ + return false; +// directory doesn?t exist + } +} + +ClearDirectory(realpath($RACINE_REP.'_framework/lib/cache/')); + + $ini1 = parse_ini_file($RACINE_REP.'_utilisateur/configuration.ini', TRUE); + foreach($ini1 as $key2=>$inisec2){ + $reini .="\n[".$key2."]\n"; + foreach($inisec2 as $subkey2=>$entry2){ + if($subkey2=="skin" && $key2=="skin") + $reini .=$subkey2.' = "'.$tpl."\"\n"; + else + $reini .=$subkey2.' = "'.$ini1[$key2][$subkey2]."\"\n"; + } + } +$handle = fopen($RACINE_REP.'_utilisateur/configuration.ini', "w"); +fwrite($handle, $reini); +fclose($handle); +} ?> Modified: trunk/_framework/framework.php =================================================================== --- trunk/_framework/framework.php 2006-11-19 08:37:18 UTC (rev 49) +++ trunk/_framework/framework.php 2006-11-26 15:38:30 UTC (rev 50) @@ -70,7 +70,7 @@ $xml_aide = simplexml_load_file($AIDE_REP."help.xml"); //-- R\xE9pertoire de la skin - $SKIN_REP = $RACINE_REP.'skin/'.$ini[skin][skin]."/"; + $SKIN_REP = $RACINE_REP.'skin/'.$ini['skin']['skin']."/"; $smarty->assign('SKIN_REP',$SKIN_REP); $THEME_REP = $RACINE_REP.'themes/'; $smarty->assign('THEME_REP',$THEME_REP); Modified: trunk/_utilisateur/modules.db =================================================================== (Binary files differ) Modified: trunk/configuration/skin.php =================================================================== --- trunk/configuration/skin.php 2006-11-19 08:37:18 UTC (rev 49) +++ trunk/configuration/skin.php 2006-11-26 15:38:30 UTC (rev 50) @@ -2,55 +2,24 @@ <table width="700" style="border: thin outset;font-size: 9px;"> <tr><td> <?php -function ClearDirectory($path){ - if($dir_handle = opendir($path)){ - while($file = readdir($dir_handle)){ - if($file == "." || $file == ".."){ - if(!@unlink($path."/".$file)){ - continue; - } - }else{ - @unlink($path."/".$file); - } - } - closedir($dir_handle); - return true; -// all files deleted - }else{ - return false; -// directory doesn?t exist - } -} -ClearDirectory(realpath('./../_framework/lib/cache/')); - +$RACINE_REP = "../"; if (isset($_GET['choiskin'])){ - $ini1 = parse_ini_file("../_utilisateur/configuration.ini", TRUE); - foreach($ini1 as $key2=>$inisec2){ - $reini .="\n[".$key2."]\n"; - foreach($inisec2 as $subkey2=>$entry2){ - if($subkey2=="skin" && $key2=="skin") - $reini .=$subkey2.' = "'.$_GET['choiskin']."\"\n"; - else - $reini .=$subkey2.' = "'.$ini1[$key2][$subkey2]."\"\n"; - } - } -$handle = fopen("../_utilisateur/configuration.ini", "w"); -fwrite($handle, $reini); -fclose($handle); + change_template($_GET['choiskin']); } +$skins = list_skin(); + // Chargement du fichier INI de configuration $ini = parse_ini_file("../_utilisateur/configuration.ini", TRUE); -$skincfg = $ini[skin][skin]; -$dir= scandir('../skin'); +$skincfg = $ini['skin']['skin']; ?> <form action="index1.php" method="get"> <?php - foreach($dir as $skin){ - if(is_dir('../skin/'.$skin) && substr($skin,0,1)!="." && $skin!="_commun"){ + foreach($skins as $skin){ + if(is_dir('../skin/'.$skin['repertoire'])){ ?> <table width="100%" border="0" cellspacing="0" cellpadding="3"> @@ -61,36 +30,29 @@ <td colspan="2" align="right"><table width="100%" border="0" cellspacing="3" cellpadding="1"> <tr> <td width="85%"><font><b> - <input type="radio" name="choiskin" value="<?= $skin; ?>" <?php if($skincfg==$skin) {echo' checked="checked" '; } ?>> - Skin : <?= $skin ?> + <input type="radio" name="choiskin" value="<?= $skin['nom']; ?>" <?php if(strtolower($skincfg)==strtolower($skin['nom'])) {echo' checked="checked" '; } ?>> + Skin : <?= $skin['nom'] ?> </b></font></td> </tr> </table></td> </tr> <tr> <td align="right" width=200> - <img style="height: 128px; border:0px;" src="../skin/<?= $skin; ?>/vuedensemble.gif" alt="<?= $skin; ?>"> + <img style="height: 128px; border:0px;" src="../skin/<?= $skin['repertoire']; ?>/vuedensemble.gif" alt="<?= $skin['nom']; ?>"> </td> <td width="783" valign="top"> <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td> - <?php - if (file_exists("../skin/".$skin."/info.php")) { - include ("../skin/".$skin."/info.php"); - } ?> - - <b>Auteur : </b> <?= $auteur; ?> <br> - <br> <b>Description :</b><br> - <?= $description; ?><br> + <?= $skin['nom']; ?><br> <br> - <b>Version : </b> <?= $version; ?></td> + <b>Version : </b> <?= $skin['version']; ?></td> </tr> <tr> <td align="right"> - <?php if (file_exists("../skin/".$skin."/config_skin.php")) { ?> - <a href="?<?= $_SERVER['QUERY_STRING']; ?>&act=config&skin=<?= $skin; ?>">Configurer la skin : <?= $skin; ?></a> + <?php if (file_exists("../skin/".$skin['nom']."/config_skin.php")) { ?> + <a href="?<?= $_SERVER['QUERY_STRING']; ?>&act=config&skin=<?= $skin['nom']; ?>">Configurer la skin : <?= $skin['nom']; ?></a> <?php }else{ echo "Pas d'options de configuration"; } ?> Modified: trunk/module/modules/modules.tpl =================================================================== --- trunk/module/modules/modules.tpl 2006-11-19 08:37:18 UTC (rev 49) +++ trunk/module/modules/modules.tpl 2006-11-26 15:38:30 UTC (rev 50) @@ -14,13 +14,17 @@ <td>{$MOD[mod].nom}</td> <td>{$MOD[mod].version}</td> <td>{$MOD[mod].description}</td> - <td width="20" bgcolor="{$COLOR}"><a href="index1.php?delid={$MOD[mod].id}"><table width="20" height="20" border="0" cellpadding="0" cellspacing="0" bgcolor="{$COLOR}" abgcolor="{#COULEUR_ALINK#}"><tr height="20"><td align=center width="20" height="20" align="center" valign="middle"><img src="{$INTERFACE_REP}delete.gif" border="0" width="20" height="20"></td></tr></table></a></td> + <td width="20" bgcolor="{$COLOR}"><a href="index1.php?delid={$MOD[mod].id}&action={$action}"><table width="20" height="20" border="0" cellpadding="0" cellspacing="0" bgcolor="{$COLOR}" abgcolor="{#COULEUR_ALINK#}"><tr height="20"><td align=center width="20" height="20" align="center" valign="middle"><img src="{$INTERFACE_REP}delete.gif" border="0" width="20" height="20"></td></tr></table></a></td> </tr> {if $smarty.section.mod.last}</table>{/if} {sectionelse} - Aucun module suppl\xE9mentaire n'est install\xE9. Pour installer, rendez-vous dans la partie "Nouveaux modules". + {if $action=="skin"} + Aucune skin suppl\xE9mentaire n'est install\xE9e. Pour en installer, rendez-vous dans la partie "Nouvelles skins". + {else} + Aucun module suppl\xE9mentaire n'est install\xE9. Pour en installer, rendez-vous dans la partie "Nouveaux modules". + {/if} {/section} {elseif $action=="newmod" OR $action=="newskin"} {section name=mod loop=$MOD} @@ -44,9 +48,12 @@ </tr> {if $smarty.section.mod.last}</table>{/if} - {sectionelse} - Aucun autre module n'est disponible. + {if $action=="newskin"} + Aucun skin n'est disponible. + {else} + Aucun autre module n'est disponible. + {/if} {/section} {/if} Modified: trunk/module/mp3/playdb.php =================================================================== --- trunk/module/mp3/playdb.php 2006-11-19 08:37:18 UTC (rev 49) +++ trunk/module/mp3/playdb.php 2006-11-26 15:38:30 UTC (rev 50) @@ -1,177 +1,177 @@ -<?php -$RACINE_REP = "../../"; - -require($RACINE_REP.'_framework/framework.php'); - -function sqlite_table_exists(&$db, $table){ - $result = sqlite_query($db, "SELECT name FROM sqlite_master WHERE type='table' AND name='$table'"); - return (sqlite_num_rows($result)!=0); -} - -$db = sqlite_open($USER.'audio.db', 0666); - -// On teste si la base des fichiers mp3/ogg existe bien -if (sqlite_table_exists($db, 'music')) { - -$ext_audio = $ini[explorateur][ext_audio]; -$audio_defaut = $ini[explorateur][audio_defaut]; -$afficher_fichier_cache = $ini[explorateur][afficher_fichier_cache]; -$default = $audio_defaut; -$extv = explode(",",$ext_audio); - -/* -//Construction de la playlist actuelle -$pagedinfo=file_get_contents('http://localhost:8081/module/mp3/lecteuraudio.html'); -eval($pagedinfo); - - if (is_array($pl)){ - foreach($pl as $key => $value) { - $variable .= '#EXTINF:0,'.utf8_encode($value[0]).' - '.utf8_encode($value[2]).' - '; - } - } -*/ - -//D\xE9finition du mode de lecture -$pisteaudio = $ini[multimedia][sortiefreebox]; -$decallage = $ini[multimedia][compensation]; -$file2 = @readfile('http://127.0.0.1:8081/lecteur/modif-config.html?type=0&var=audio-desync&value='.$decallage); - -if($pisteaudio=='TV'){ -// $META['aud'] = '69(en,mp2)'; - $add = 'type=2'; - $play = 'type=1'; - if($_GET['type']=="radio") { - $play = 'type=41'; - } - if ($_GET['type']=="m3u") { - $play = 'type=1'; - } - -}elseif($pisteaudio=='PC'){ - $add = 'type=4'; - $play = 'type=3'; - $decallage = $ini[multimedia][compensation]; - $file2 = @readfile('http://127.0.0.1:8081/lecteur/modif-config.html?type=0&var=audio-desync&value='.$decallage); - if($_GET['type']=="radio") { - $play = 'type=42'; - } - if ($_GET['type']=="m3u") { - $play = 'type=3'; - } - -}elseif($pisteaudio=='AC3'){ -// $META['aud'] = '69(en,ac3)'; - $add = 'type=6'; - $play = 'type=5'; - if($_GET['type']=="radio") { - $play = 'type=43'; - } - if ($_GET['type']=="m3u") { - $play = 'type=5'; - } - -} - -if (isset($_GET['option'])){ - $page = $add; -}else{ - $page = $play; -} - - -//Lecture en mode biblioth\xE8que - (isset($_GET['wf'])?$wherefield=$_GET['wf']:$wherefield=''); - (isset($_GET['wl'])?$wherelike=$_GET['wl']:$wherelike=''); - if ($wherefield!=''){ - $sqllike=$wherefield." LIKE \"".urldecode($wherelike)."%\""; - - $query = "SELECT * FROM music WHERE ".stripslashes($sqllike); - - $result=sqlite_query($db, $query); - while ($row = sqlite_fetch_array($result)) { - $basename = $row[filename]; - $variable .= " - ".utf8_encode(realpath($basename)); - } - } - - -//Lecture en mode explorateur seul -if(isset($_GET['toplay_rep']) && isset($_GET['toplay_file'])){ - $basename=$_GET['toplay_rep'].'/'.$_GET['toplay_file']; - /*$variable .= " - ".utf8_encode(realpath(stripslashes($basename))); */ - $variable .= '#EXTINF:0,'.utf8_encode($_GET['toplay_file']).' - '.utf8_encode(realpath(stripslashes($basename))).' - '; - -} - -//Lecture en mode explorateur dossier entier - if($_GET['type']=="playrep"){ - - function add_recursive($handle){ - global $extv, $variable; - $handle2=@opendir($handle); - while (false !== ($file = readdir($handle2))){ - if(in_array(strtolower(substr($file,strrpos($file,'.'))),$extv) && $file!='.'){ - $basename = $handle.'/'.$file; - $variable .= " - ".utf8_encode(realpath($basename)); - }elseif(is_dir($handle.'/'.$file) && $file!='.' && $file!='..'){ - add_recursive($handle.'/'.$file); - } - } - } - add_recursive(realpath(stripslashes($_REQUEST['toplay']))); -} - -//Lecture d'une webradio -if($_GET['type']=="webradio"){ - $basename = $_REQUEST['play']; - $nom = $_REQUEST['nom']; - save_variable('lastwebradio', urldecode($nom)); - play_fichier('type=40',$basename,0,'webradio'); -}elseif($_GET['type']=="m3u"){ - $basename = $_REQUEST['play']; - play_fichier($play,$basename,0,'mp3'); -}elseif($_GET['type']=="podcast"){ - save_variable('current_pod', urldecode($_GET['setlect'])); - $basename = $_REQUEST['play']; - play_fichier($play,$basename,0,'podcast'); -}elseif($_GET['type']=="cdda"){ - $basename = 'cdda://'.strtoupper($_REQUEST['disque']).':'; - play_fichier($play,$basename,0,'cd'); -}else{ - if(isset($_GET['toplay']) && $_GET['type']!="playrep"){ - $basename=$_GET['toplay']; - $variable .= " - ".utf8_encode(realpath(stripslashes($basename))); - } - //Cr\xE9ation de la playlist temporaire - $fp = fopen($USER.'audiotemp'.get_variable('num_playlist').'.m3u',"w+"); - fputs($fp,"#EXTM3U"); - fputs($fp,$variable); - fclose($fp); - play_fichier($page,$USER.'audiotemp'.get_variable('num_playlist').'.m3u',1,'mp3'); - save_variable('num_playlist', get_variable('num_playlist')+1); -} - -} -?> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<html> -<head> -<?php -echo '<meta name="refresh" content="2;url=lecteuraudio.php">'; -?> -<flags volume_key=true> -</head> -<body background="ts://127.0.0.1" text="#f0f0f03f" link="#f0f0f03f" alink="#FCBE033f" vlink="#cc00003f"> -<script language="javascript" src="/fb2ie.js"> -</script> -</body> -</html> - +<?php +$RACINE_REP = "../../"; + +require($RACINE_REP.'_framework/framework.php'); + +function sqlite_table_exists(&$db, $table){ + $result = sqlite_query($db, "SELECT name FROM sqlite_master WHERE type='table' AND name='$table'"); + return (sqlite_num_rows($result)!=0); +} + +$db = sqlite_open($USER.'audio.db', 0666); + +// On teste si la base des fichiers mp3/ogg existe bien +if (sqlite_table_exists($db, 'music')) { + +$ext_audio = $ini[explorateur][ext_audio]; +$audio_defaut = $ini[explorateur][audio_defaut]; +$afficher_fichier_cache = $ini[explorateur][afficher_fichier_cache]; +$default = $audio_defaut; +$extv = explode(",",$ext_audio); + +/* +//Construction de la playlist actuelle +$pagedinfo=file_get_contents('http://localhost:8081/module/mp3/lecteuraudio.html'); +eval($pagedinfo); + + if (is_array($pl)){ + foreach($pl as $key => $value) { + $variable .= '#EXTINF:0,'.utf8_encode($value[0]).' + '.utf8_encode($value[2]).' + '; + } + } +*/ + +//D\xE9finition du mode de lecture +$pisteaudio = $ini[multimedia][sortiefreebox]; +$decallage = $ini[multimedia][compensation]; +$file2 = @readfile('http://127.0.0.1:8081/lecteur/modif-config.html?type=0&var=audio-desync&value='.$decallage); + +if($pisteaudio=='TV'){ +// $META['aud'] = '69(en,mp2)'; + $add = 'type=2'; + $play = 'type=1'; + if($_GET['type']=="radio") { + $play = 'type=40'; + } + if ($_GET['type']=="m3u" OR $_GET['type']=="webradio") { + $play = 'type=1'; + } + +}elseif($pisteaudio=='PC'){ + $add = 'type=4'; + $play = 'type=3'; + $decallage = $ini[multimedia][compensation]; + $file2 = @readfile('http://127.0.0.1:8081/lecteur/modif-config.html?type=0&var=audio-desync&value='.$decallage); + if($_GET['type']=="radio") { + $play = 'type=41'; + } + if ($_GET['type']=="m3u" OR $_GET['type']=="webradio") { + $play = 'type=3'; + } + +}elseif($pisteaudio=='AC3'){ +// $META['aud'] = '69(en,ac3)'; + $add = 'type=6'; + $play = 'type=5'; + if($_GET['type']=="radio" OR $_GET['type']=="webradio") { + $play = 'type=42'; + } + if ($_GET['type']=="m3u") { + $play = 'type=5'; + } + +} + +if (isset($_GET['option'])){ + $page = $add; +}else{ + $page = $play; +} + + +//Lecture en mode biblioth\xE8que + (isset($_GET['wf'])?$wherefield=$_GET['wf']:$wherefield=''); + (isset($_GET['wl'])?$wherelike=$_GET['wl']:$wherelike=''); + if ($wherefield!=''){ + $sqllike=$wherefield." LIKE \"".urldecode($wherelike)."%\""; + + $query = "SELECT * FROM music WHERE ".stripslashes($sqllike); + + $result=sqlite_query($db, $query); + while ($row = sqlite_fetch_array($result)) { + $basename = $row[filename]; + $variable .= " + ".utf8_encode(realpath($basename)); + } + } + + +//Lecture en mode explorateur seul +if(isset($_GET['toplay_rep']) && isset($_GET['toplay_file'])){ + $basename=$_GET['toplay_rep'].'/'.$_GET['toplay_file']; + /*$variable .= " + ".utf8_encode(realpath(stripslashes($basename))); */ + $variable .= '#EXTINF:0,'.utf8_encode($_GET['toplay_file']).' + '.utf8_encode(realpath(stripslashes($basename))).' + '; + +} + +//Lecture en mode explorateur dossier entier + if($_GET['type']=="playrep"){ + + function add_recursive($handle){ + global $extv, $variable; + $handle2=@opendir($handle); + while (false !== ($file = readdir($handle2))){ + if(in_array(strtolower(substr($file,strrpos($file,'.'))),$extv) && $file!='.'){ + $basename = $handle.'/'.$file; + $variable .= " + ".utf8_encode(realpath($basename)); + }elseif(is_dir($handle.'/'.$file) && $file!='.' && $file!='..'){ + add_recursive($handle.'/'.$file); + } + } + } + add_recursive(realpath(stripslashes($_REQUEST['toplay']))); +} + +//Lecture d'une webradio +if($_GET['type']=="webradio"){ + $basename = $_REQUEST['play']; + $nom = $_REQUEST['nom']; + save_variable('lastwebradio', urldecode($nom)); + play_fichier($play,$basename,0,'webradio'); +}elseif($_GET['type']=="m3u"){ + $basename = $_REQUEST['play']; + play_fichier($play,$basename,0,'mp3'); +}elseif($_GET['type']=="podcast"){ + save_variable('current_pod', urldecode($_GET['setlect'])); + $basename = $_REQUEST['play']; + play_fichier($play,$basename,0,'podcast'); +}elseif($_GET['type']=="cdda"){ + $basename = 'cdda://'.strtoupper($_REQUEST['disque']).':'; + play_fichier($play,$basename,0,'cd'); +}else{ + if(isset($_GET['toplay']) && $_GET['type']!="playrep"){ + $basename=$_GET['toplay']; + $variable .= " + ".utf8_encode(realpath(stripslashes($basename))); + } + //Cr\xE9ation de la playlist temporaire + $fp = fopen($USER.'audiotemp'.get_variable('num_playlist').'.m3u',"w+"); + fputs($fp,"#EXTM3U"); + fputs($fp,$variable); + fclose($fp); + play_fichier($page,$USER.'audiotemp'.get_variable('num_playlist').'.m3u',1,'mp3'); + save_variable('num_playlist', get_variable('num_playlist')+1); +} + +} +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +<?php +echo '<meta name="refresh" content="2;url=lecteuraudio.php">'; +?> +<flags volume_key=true> +</head> +<body background="ts://127.0.0.1" text="#f0f0f03f" link="#f0f0f03f" alink="#FCBE033f" vlink="#cc00003f"> +<script language="javascript" src="/fb2ie.js"> +</script> +</body> +</html> + Modified: trunk/module/reseaufree/province.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |