$null) {
// Dégueulasse les ternaires à la suite ! mais j'aime ça
echo '
':''):'');
$i++;
}
}
### EXECUTION ###
if (isset($_GET['Process']) AND !isset($Errors)) {
### Supprimer les caractères spéciaux - dossiers & fichiers ###
// Les caractères '%' et '$' sont systématiquement échappés, ca génère des bugs dans les noms de fichiers
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 ###
$copyright = utf8_decode($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 '
'.l10n('Source files').'
';
foreach ($FilesSource as $value) {
echo '- '.$value.'
';
}
echo '
'.l10n('%d files', count($FilesSource)).'
';
}
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 '';
} else if (!isset($Errors)) {
echo '';
}
echo '