Erreur fatale : Fichier de configuration introuvable. Retour'); } // Configuration $config = simplexml_load_file('config.xml'); $config = XMLParse($config); $config = array_settype($config); extract($config); // Afficher la configuration if (!$silentORNOT) { include('files/display_config.php'); } // Dossiers if (!file_exists($DIRsource)) { mkdir($DIRsource); } if (!file_exists($DIRsortie)) { mkdir($DIRsortie); } if (is_dir_empty($DIRsource)) { die('
Erreur fatale : Dossier source vide. Retour Configurer
'); } if ($silentORNOT) { rrmdir($DIRsortie); // Si mode silencieux mkdir($DIRsortie); // vidage automatique du dossier de sortie } else if (!is_dir_empty($DIRsortie)) { die('
Erreur fatale : Dossier de sortie non vide. Retour Configurer
'); } ### EXECUTION ### if (isset($_GET['Process'])) { ### Supprimer les caractères spéciaux - dossiers & fichiers ### if ($renameORNOT) { function recursive_delete_special_car($dir) { $dir = rtrim($dir, '/'); $dh = opendir($dir); while (($file = readdir($dh)) !== false ) { if ($file !== '.' && $file !== '..') { $path = $dir.'/'.$file; $new_path = $dir.'/'.delete_special_car($file); rename($path, $new_path); if (is_dir($new_path)) { recursive_delete_special_car($new_path); } } } closedir($dh); } recursive_delete_special_car($DIRsource); } ### Copyright ### if ($copyONhd) { $copyHD = '-text_font "'.$copyFONT.'" '.$DIMnormal*$copySIZE.' -text_color '.$copyCOLOR.' -text_flag '.$copyPOS.' -text_pos 0 0 -text "'.$copyright.'"'; } else { $copyHD = null; } if ($copyONnormal) { $copyNormal = '-text_font "'.$copyFONT.'" '.$DIMnormal*$copySIZE.' -text_color '.$copyCOLOR.' -text_flag '.$copyPOS.' -text_pos 0 0 -text "'.$copyright.'"'; } else { $copyNormal = null; } ### Plugins avant execution ### foreach ($PluginsBefore as $name => $config) { if ($config['active']) { include('plugins/'.$name.'.php'); } } ### Processus principal ### // Tableau avec les fichiers source $FilesSource = array(); recursive_readdir($DIRsource, 'FilesSource'); // Tableau avec les fichiers de sortie $FilesSortie = str_replace($DIRsource, $DIRsortie, $FilesSource); for ($i=0; $i $config) { if ($config['active']) { include('plugins/'.$name.'.php'); } } // Compresse les fichiers dans le dossier de sortie if (!isset($BlockNormal)) { exec('nconvert.exe -q '.$Qnormal.' -out jpeg -o "'.$matches[1].'/'.$matches[2].'" -dpi 72 -ratio -rtype lanczos -resize '.$DIMnormal.' '.$DIMnormal.' '.$copyNormal.' "'.$FilesSource[$i].'"'); } if (!isset($BlockThumbnail)) { exec('nconvert.exe -q '.$Qthumbnail.' -out jpeg -o "'.$matches[1].'/thumbnail/'.$prefixe_mini.$matches[2].'" -dpi 72 -ratio -rtype lanczos -rflag decr -resize '.$DIMthumbnail.' '.$DIMthumbnail.' -rmeta -rexifthumb "'.$FilesSource[$i].'"'); } if ($DIRhighORNOT AND !isset($BlockHigh)) { if ($DIMhdORNOT) { exec('nconvert.exe -q '.$Qhd.' -out jpeg -o "'.$matches[1].'/pwg_high/'.$matches[2].'" -dpi '.$DPI.' -ratio -rtype lanczos -rflag decr -resize '.$DIMhd.' '.$DIMhd.' '.$copyHD.' "'.$FilesSource[$i].'"'); } else { copy($FilesSource[$i], $matches[1].'/pwg_high/'.$matches[2]); } } // Réinitialise les bloqueurs unset($BlockNormal); unset($BlockThumbnail); unset($BlockHigh); } if (!$silentORNOT) { echo '

Fichiers source

'.count($FilesSource).' fichiers
'; } unset($FilesSource); unset($FilesSortie); ### Supprime les dossiers vides et copie les fichiers index.php ### // Tableau avec les dossiers de sortie $DirsSortie = array(); recursive_readdir($DIRsortie, 'DirsSortie', true); foreach($DirsSortie as $dir) { if (is_dir_empty($dir)) { rmdir($dir); } else if ($indexORNOT) { copy('files/index.php', $dir.'/index.php'); } } unset($DirsSortie); ### Plugins après execution ### foreach ($PluginsAfter as $name => $config) { if ($config['active']) { include('plugins/'.$name.'.php'); } } echo '
Opération terminée : '.intval((microtime(true)-$TIME_START)) .' secondes. Retour Configurer
'; } else { echo '
Prêt à commencer. Exécuter Configurer
'; } echo ' '; ?>