checkProfil(PROFIL_ADMIN); # Initialisation $tpl = isset($_POST['tpl'])?$_POST['tpl']:'home.php'; if(!empty($_POST['load'])) $tpl = $_POST['template']; $style = $plxAdmin->aConf['style']; $filename = realpath(PLX_ROOT.$plxAdmin->aConf['racine_themes'].$style.'/'.$tpl); if(!preg_match('#^'.str_replace('\\', '/', realpath(PLX_ROOT.$plxAdmin->aConf['racine_themes'].$style.'/').'#'), str_replace('\\', '/', $filename))) { $tpl='home.php'; } $filename = realpath(PLX_ROOT.$plxAdmin->aConf['racine_themes'].$style.'/'.$tpl); # On teste l'existence du thème if(empty($style) OR !is_dir(PLX_ROOT.$plxAdmin->aConf['racine_themes'].$style)) { plxMsg::Error(L_CONFIG_EDITTPL_ERROR_NOTHEME); header('Location: parametres_affichage.php'); exit; } # Traitement du formulaire: sauvegarde du template if(isset($_POST['submit']) AND trim($_POST['content']) != '') { if(plxUtils::write($_POST['content'], $filename)) plxMsg::Info(L_SAVE_FILE_SUCCESSFULLY); else plxMsg::Error(L_SAVE_FILE_ERROR); } # On récupère les fichiers templates du thèmes $aTemplates=array(); function listFolderFiles($dir, $include, $root=''){ $content = array(); $ffs = scandir($dir); foreach($ffs as $ff){ if($ff!='.' && $ff!='..') { $ext = strtolower(strrchr($ff,'.')); if(!is_dir($dir.'/'.$ff) AND is_array($include) AND in_array($ext,$include)) { $f = str_replace($root, "", PLX_ROOT.ltrim($dir.'/'.$ff,'./')); $content[$f] = $f; } if(is_dir($dir.'/'.$ff)) $content = array_merge($content, listFolderFiles($dir.'/'.$ff,$include,$root)); } } return $content; } $root = PLX_ROOT.$plxAdmin->aConf['racine_themes'].$style; $aTemplates=listFolderFiles($root, array('.php','.css','.htm','.html','.txt','.js'), $root); # On récupère le contenu du fichier template $content = ''; if(file_exists($filename) AND filesize($filename) > 0) { if($f = fopen($filename, 'r')) { $content = fread($f, filesize($filename)); fclose($f); } } # On inclut le header include(dirname(__FILE__).'/top.php'); ?>
plxPlugins->callHook('AdminSettingsEdittplTop')) # Hook Plugins ?> plxPlugins->callHook('AdminSettingsEdittplFoot')); # On inclut le footer include(dirname(__FILE__).'/foot.php'); ?>