Bonsoir,

suite à la mise en place d'un album photo sur mon serveur, j'ai constaté que les fichiers et les repertoires sont bien crées.

Néanmoins il y a un souci lorsque je tente de supprimer les repertoires ou les fichiers créés : les droits utilisateurs ne sont plus ceux de mon user standard mais "nobody" (pareil en ce qui concerne le groupe). N'étant pas sur un serveur dédié cela me pose quelques soucis...

Voici le code utilisé :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
<?php 
require("conf.php");
 
//error_reporting(E_ALL); // afficher les erreurs
error_reporting(0); // ne pas afficher les erreurs
 
//fonction qui renomme les dossiers comprenant des caractères interdits
function scan_invalid_char($dir2scan) {
	if ($handle = opendir($dir2scan)) {
	   while (false !== ($file = readdir($handle))) {
		if ($file != "." && $file != ".." && eregi("[]\[áâãäåÀÁÂÃÄÅÈÉÊËèéêëÌÍÎÏìíîïÒÓÔÕÖòóôõöÙÚÛÜùúûü.!@#$%^&*+{}()'=$]", $file) && is_dir($dir2scan.'/'.$file)) {
				$newfilename = $file;
				$newfilename = eregi_replace("[]\[\.!@#$%^&*+{}()'=$]", "_", $newfilename);
				$newfilename = eregi_replace("[àáâãäåÀÁÂÃÄÅ]", "a", $newfilename);
				$newfilename = eregi_replace("[ÈÉÊËèéêë]", "e", $newfilename);
				$newfilename = eregi_replace("[Çç]", "c", $newfilename);
				$newfilename = eregi_replace("[ÌÍÎÏìíîï]", "i", $newfilename);
				$newfilename = eregi_replace("[ÒÓÔÕÖòóôõö]", "o", $newfilename);
				$newfilename = eregi_replace("[ÙÚÛÜùúûü]", "u", $newfilename);
			   rename($dir2scan.'/'.$file, $dir2scan.'/'.$newfilename);
		   }
	   }
	   closedir($handle);
	}
}
 
//fonction pour créer une miniature de la 1ère image du sous dossier photo
function create_icon($dir2iconize) {
	$dir = PHOTOS_DIR."/".$dir2iconize; //chemin vers le répertoire à dont on doit créer l'icone
	if ($handle = opendir($dir)) {
		$cFile = 0;
		while (false !== ($file = readdir($handle))) {
			if($file != "." && $file != ".."){
				if(is_file($dir . "/" . $file)){
					$listFile[$cFile] = $file;
					$cFile++;
				}
			}
		}
	closedir($handle);
	}
	//$extract = scandir($dir);//scan des "array" du répertoire
	$first_dir_item = $listFile[0]; // on extrait la valeur du premier fichier du répertoire (après"." et "..")
	list($width, $height, $type, $attr) = getimagesize($dir."/".$first_dir_item);//on liste les valeur de l'image
    $miniature = imagecreatetruecolor(ICO_WIDTH, ICO_HEIGHT);
	if ($type == 1) {
		$image = imagecreatefromgif($dir."/".$first_dir_item);
	}
	if ($type == 2) {
		$image = imagecreatefromjpeg($dir."/".$first_dir_item);
	}
	if ($type == 3) {
		$image = imagecreatefrompng($dir."/".$first_dir_item);
	}
	//imagecopyresampled(image de destination, image source, int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h);
	imagecopyresampled($miniature, $image, 0, 0,((($width - ICO_WIDTH)/2) <= ICO_WIDTH ? ICO_WIDTH-(($width - ICO_WIDTH)/2) : ($width - ICO_WIDTH)/2), ((($height - ICO_HEIGHT)/2) <= 0 ? ICO_HEIGHT-(($height - ICO_HEIGHT)/2) : ($height - ICO_HEIGHT)/2), ICO_WIDTH, ICO_HEIGHT, ICO_WIDTH*2, ICO_HEIGHT*2);
	imagejpeg($miniature, $dir."/".ICO_FILENAME, GLOBAL_JPG_QUALITY);
}
 
//fonction pour créer le répertoire miniatures
function create_folder($dirwhere2folderize, $dir_name) {
	mkdir(PHOTOS_DIR."/".$dirwhere2folderize."/".$dir_name);
}
 
//fonction pour créer toutes les miniatures du répertoire en question
function create_newimage($dirname, $file2miniaturize, $dimensionmax, $dir_where2save, $file_prefixe) {
	$dir = PHOTOS_DIR."/".$dirname; //chemin vers le répertoire à dont on doit créer l'icone
	$dir_where2save = ($dir_where2save ? "/".$dir_where2save : "");
	$file_prefixe = ($file_prefixe ? $file_prefixe : "");
	list($width, $height, $type, $attr) = getimagesize($dir."/".$file2miniaturize);//on liste les valeur de l'image
	if ($width >= $height) {
	$newwidth = $dimensionmax;
	$newheight = ($dimensionmax*$height)/$width;
	} else {
	$newwidth = ($dimensionmax*$width)/$height;
	$newheight = $dimensionmax;
	}
    $miniature = imagecreatetruecolor($newwidth, $newheight);
	if ($type == 1) {
		$image = imagecreatefromgif($dir."/".$file2miniaturize);
	}
	if ($type == 2) {
		$image = imagecreatefromjpeg($dir."/".$file2miniaturize);
	}
	if ($type == 3) {
		$image = imagecreatefrompng($dir."/".$file2miniaturize);
	}
	imagecopyresampled($miniature, $image, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
	imagejpeg($miniature, $dir.$dir_where2save."/".$file_prefixe.$file2miniaturize, GLOBAL_JPG_QUALITY); 
}
 
//fonction pour tronquer un nom trop long
function wordTruncate($str) {
  $str_to_count = html_entity_decode($str);
  echo strlen($str_to_count);
  if (strlen($str_to_count) <= PHOTONAME_MAXCHAR) {
   return $str;
  } else { 
  $str2 = substr($str_to_count, 0, PHOTONAME_MAXCHAR - 3)."...";
  return htmlentities($str2);
  }
}
?>
<html>
<head>
  <title>a</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="global_style.css" rel="stylesheet" type="text/css">
<SCRIPT LANGUAGE=Javascript>
<!--
function inCell(cell, newcolor) {
	if (!cell.contains(event.fromElement)) {
		cell.bgColor = newcolor;
	}
}
 
function outCell(cell, newcolor) {
	if (!cell.contains(event.toElement)) {
		cell.bgColor = newcolor;
	}
}
//-->
</SCRIPT>
</head>
<body>
<?php 
$show_heading = (isset($_GET['show_heading']) ? $_GET['show_heading'] : "");
ini_set('max_execution_time', 120); //2 mn max
switch ($show_heading) {
//listing des répertoires photos sur la page d'index par défaut
default:
scan_invalid_char(PHOTOS_DIR); //scan des répertoires qui contiennent des caractères interdits
// listage des répertoires et fichiers
if ($handle = opendir(PHOTOS_DIR)) {
   $cDir = 0;
   $cFile = 0;
   while (false !== ($file = readdir($handle))) {
		if($file != "." && $file != ".." &&  $file != THUMBS_DIR && $file != IMAGE_STDDIM && $file != IMAGE_400 &&  $file != IMAGE_800){
			if(is_dir(PHOTOS_DIR . "/" . $file)){
				$listDir[$cDir] = $file;
				$cDir++;
			}
			else{
				$listFile[$cFile] = $file;
				$cFile++;
			} 
		}
   }
   if (ALPHABETIC_ORDER == true) {
		usort($listDir,"strnatcmp");
	}
   closedir($handle);
}
//
$total_icons = count($listDir);
$totalPages = ceil($total_icons/ICO_PER_PAGE);
$page_num = (isset($_GET['page_num']) && $_GET['page_num'] !== "" && $_GET['page_num'] <= $totalPages ? $_GET['page_num'] : "1");
?>
<div class="fdgris"><span class="Style1">// <?php echo HOME_NAME ?></span></div>
<div class="fdcolor1" align="center">
<span class="Style2"><?php if ($page_num > 1) { ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo ($page_num-1); ?>" class="Style2">&laquo;</a> &nbsp;|&nbsp; <?php } 
 
for ($l =1; $l < $totalPages; $l++) {
	if ($page_num != $l) {
		?> <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a> &nbsp;|&nbsp; <?php 
	} else {
	?> <b><?php echo $l; ?></b> &nbsp;|&nbsp; <?php 
	}
}
if ($page_num != $l) {
	?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a><?php
} else {
	?><b><?php echo $l; ?></b><?php
}
if ($page_num < $totalPages) { ?> &nbsp;|&nbsp; <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo ($page_num+1) ?>" class="Style2">&raquo;</a><?php } ?>
</span></div>
<br>
<table border="0" align="center" cellpadding="8" cellspacing="0">
	<tr>
<?php 
$separateurs = array('_', '-', '.');
$k=0; 
   for ($i = (ICO_PER_PAGE*$page_num) - ICO_PER_PAGE; $i < ($total_icons > (ICO_PER_PAGE*($page_num)) ? ICO_PER_PAGE*$page_num : $total_icons); $i++) {
	if ($listDir[$i] != "." && $listDir[$i] != ".." && $listDir[$i] != THUMBS_DIR && $listDir[$i] != IMAGE_STDDIM && $listDir[$i] != IMAGE_400 && $listDir[$i] != IMAGE_800 && is_dir(PHOTOS_DIR . "/" . $listDir[$i]) == true) {
	//création du répertoire miniatures et images
	if (!file_exists(PHOTOS_DIR . "/" . $listDir[$i] . "/" . THUMBS_DIR)) { 
		create_folder($listDir[$i], THUMBS_DIR);
	}
	if (!file_exists(PHOTOS_DIR . "/" . $listDir[$i] . "/" . IMAGE_STDDIM)) { 
		create_folder($listDir[$i], IMAGE_STDDIM);
	}
	if (!file_exists(PHOTOS_DIR . "/" . $listDir[$i] . "/" . IMAGE_800)) { 
		create_folder($listDir[$i], IMAGE_800);
	}
	if (!file_exists(PHOTOS_DIR . "/" . $listDir[$i] . "/" . IMAGE_1024)) { 
		create_folder($listDir[$i], IMAGE_1024);
	}
	if (!file_exists(PHOTOS_DIR . "/" . $listDir[$i]  . "/" . IMAGE_400)) { 
		create_folder($listDir[$i], IMAGE_400);
	}
		//création de la miniature
		if (!file_exists(PHOTOS_DIR . "/" . $listDir[$i] . "/" . ICO_FILENAME)) { //si la miniature existe
			create_icon($listDir[$i]);
		}
		list($width, $height, $type, $attr) = getimagesize(PHOTOS_DIR . "/" . $listDir[$i]  . "/" . ICO_FILENAME);//on liste les valeurs de la miniature
		if ($width != ICO_WIDTH || $height != ICO_HEIGHT) { //on affiche
			create_icon($listDir[$i]);
		}
		?>
        <?php (is_int($k/ICO_PER_LINE) ? print "<tr>": print "");  ?>  
	<td>
		<table border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
		  <tr class="tddeco">
		    <td width="<?php echo ICO_WIDTH + 18; ?>" height="<?php echo ICO_HEIGHT + 18; ?>" align="center" valign="middle" class="tdover" onMouseOver="this.style.borderColor='#666666'" onMouseOut="this.style.borderColor='#FFFFFF'">
				<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $listDir[$i]; ?>"><img src="<?php echo PHOTOS_DIR . "/" . rawurlencode($listDir[$i]) . "/" . ICO_FILENAME ?>" alt="<?php echo str_replace($separateurs, ' ', $listDir[$i]); ?>" width="<?php echo ICO_WIDTH ?>" height="<?php echo ICO_HEIGHT ?>" border="0" class="imageborder"></a></td>
		  </tr>
		  <tr>
		    <td align="center"><span class="Style2"><?php 
			$titre_album = str_replace($separateurs, ' ', $listDir[$i]);
			$nbmots = explode(" ", $titre_album);
			$maxword2show = ((count($nbmots) < 6) ? count($nbmots) : 6);
			$wordnb = 0;
			while ($wordnb <$maxword2show) {
			echo  $nbmots[$wordnb] . " "; 
			$wordnb++;
			}
			echo ((count($nbmots) > 6) ? " ..." : "");
 			?></span></td>
		  </tr>
	  </table>
	  </td>
<?php
		//
	}
	$k++;
   }
?>
</table><br>
<div class="fdcolor1" align="center">
  <span class="Style2"><?php if ($page_num > 1) { ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo ($page_num-1); ?>" class="Style2">&laquo;</a> &nbsp;|&nbsp; <?php } 
 
  for ($l =1; $l < ceil($total_icons/ICO_PER_PAGE); $l++) {
	  if ($page_num != $l) {
	   ?> <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a> &nbsp;|&nbsp; <?php 
	  } else {
	   ?> <b><?php echo $l; ?></b> &nbsp;|&nbsp; <?php 
	  }
  }
  if ($page_num != $l) {
  ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a><?php
  } else {
  ?><b><?php echo $l; ?></b><?php
  }
   if ($page_num < ( ceil(($total_icons)/ICO_PER_PAGE)) ) { ?> &nbsp;|&nbsp; <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo ($page_num+1) ?>" class="Style2">&raquo;</a><?php } ?>
  </span></div>
<?php 
break;
 
//listing des miniatures dans un répertoire photo spécifié
case ('list'):
$photodir = (isset($_GET['dir']) ? $_GET['dir'] : "");
	if (!isset($_GET['dir']) || $_GET['dir'] == "") {//on vérifie que le répertoire photo existe bien ?>
		<table border="0" align="center" cellpadding="28" cellspacing="0">
		  <tr>
		    <td align="center"><span class="txtrouge">Vous devez spécifier un répertoire photo !</span>
		      <p>
			<form method="post"><INPUT TYPE="button" VALUE="Retour" onClick="history.go(-1)"></form>
			</td>
		</tr>
	</table>
	<?php	
	break;
	}
//on supprime les slash, antislash et points possibles pour éviter les failles de sécurité
$photodir = preg_replace("/\\\\/", "", $photodir);
$str2clean = array("." => "", "/" => "");
$photodir = strtr($photodir, $str2clean);
$page_num = (isset($_GET['page_num']) ? $_GET['page_num'] : "1");//vérification que le numéro de page existe bien
$dir = PHOTOS_DIR . "/" . $photodir; //chemin vers le répertoire qui contient les miniatures
	if (!file_exists($dir)) {//on vérifie que le répertoire photo existe bien ?>
		<table border="0" align="center" cellpadding="28" cellspacing="0">
		  <tr>
		    <td align="center"><span class="txtrouge">Ce r&eacute;pertoire photo n'existe pas !</span>
		      <p>
			<form method="post"><INPUT TYPE="button" VALUE="Retour" onClick="history.go(-1)"></form>
			</td>
		</tr>
	</table>
	<?php	
	break;
	}
	//création du répertoire miniatures et images
	if (!file_exists($dir . "/" . THUMBS_DIR)) { 
		create_folder($photodir, THUMBS_DIR);
	}
	if (!file_exists($dir . "/" . IMAGE_STDDIM)) { 
		create_folder($photodir, IMAGE_STDDIM);
	}
	if (!file_exists($dir . "/" . IMAGE_800)) { 
		create_folder($photodir, IMAGE_800);
	}
	if (!file_exists($dir . "/" . IMAGE_1024)) { 
		create_folder($photodir, IMAGE_1024);
	}
	if (!file_exists($dir . "/" . IMAGE_400)) { 
		create_folder($photodir, IMAGE_400);
	}
// listage des répertoires et fichiers
if ($handle = opendir($dir)) {
   $cDir = 0;
   $cFile = 0;
   while (false !== ($file = readdir($handle))) {
	if($file != "." && $file != ".."){
		if(is_dir($dir . "/" . $file)){
			$listDir[$cDir] = $file;
			$cDir++;
		}
		else{
			$listFile[$cFile] = $file;
			$cFile++;
		}
	}
   }
   closedir($handle);
}
if (ALPHABETIC_ORDER == true) {
	usort($listFile,"strnatcmp");
}
 
//selon l'ordonnancement, on détermine la bonne pagination de retour à l'index principal.
if (ALPHABETIC_ORDER == true) {
	if ($handle = opendir(PHOTOS_DIR)) {
		$cDir = 0;
		while (false !== ($subdir = readdir($handle))) {
			if($subdir != "." && $subdir != ".." && $subdir != THUMBS_DIR && $subdir != IMAGE_STDDIM && $subdir != IMAGE_400 && $subdir != IMAGE_800){
				if(is_dir(PHOTOS_DIR . "/" . $subdir)){
					$listDir[$cDir] = $subdir;
					$cDir++;
				}
			}
   		}
   closedir($handle);
	} 
usort($listDir,"strnatcmp");
$photoDirNba = 1;
	for ($b=0; $b <	count($listDir); $b++) {
		$ordertest[$photoDirNba] = $listDir[$b];
				if($ordertest[$photoDirNba] == $photodir){
				$dir_index = $photoDirNba;
				} else {
				$photoDirNba++;
				}
	}
} else {
// récupération du numéro du dossier photo
	if ($handle = opendir(PHOTOS_DIR)) {
	   $photoDirNbb = 1;
	   while (false !== ($photoDirectory = readdir($handle))) {
		if($photoDirectory != "." && $photoDirectory != ".." && $photoDirectory != THUMBS_DIR && $photoDirectory != IMAGE_STDDIM && $photoDirectory != IMAGE_400 && $photoDirectory != IMAGE_800 && $photoDirectory != IMAGE_1024){
			if(is_dir(PHOTOS_DIR . "/" . $photoDirectory)){
				if($photoDirectory == $photodir){
				$dir_index = $photoDirNbb;
				} else {
				$photoDirNbb++;
				}
			}
		}
   }
   closedir($handle);
}
}
$page_index = ceil($dir_index/ICO_PER_PAGE);
 
//on liste les miniatures
if ($handle = opendir($dir."/".THUMBS_DIR)) {
   $thumb = 0;
   while (false !== ($file = readdir($handle))) {
	if($file != "." && $file != ".."){
		if(is_file($dir."/".THUMBS_DIR . "/" . $file)){
			$extractthumbs[$thumb] = $file;
			$thumb++;
		}
	}
   }
   closedir($handle);
}
$valid = 0;
for ($i=0; $i <	count($listFile); $i++) {
	if ($listFile[$i] !== ICO_FILENAME) {
		$listvalidimg[$valid] = $listFile[$i];
		$valid++;
	}
}
 
$total_files = count($listvalidimg);// on compte le nombre d'éléments dans le dossier sans compter "." et ".."
$separateurs = array('_', '-', '.');
?>
<div class="fdgris"><span class="Style1">// <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default&page_num=<?php echo $page_index; ?>" class="Style1"><?php echo HOME_NAME; ?></a> &raquo; <?php echo str_replace($separateurs, ' ', $photodir); ?>  / photos <?php echo (($page_num-1)*MINIATURES_PER_PAGE)+1; ?> à <?php if ($page_num < ( ceil(($total_files)/MINIATURES_PER_PAGE)) ) { echo (($page_num)*MINIATURES_PER_PAGE); } else { echo $total_files; } ?>  sur <?php echo $total_files; ?> </span></div>
<div class="fdcolor1" align="center">
  <span class="Style2"><?php if ($page_num > 1) { ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo ($page_num-1) ?>" class="Style2">&laquo;</a> &nbsp;|&nbsp; <?php } 
  $l =1;
  while ($l < (ceil(($total_files)/MINIATURES_PER_PAGE)) ) {
  if ($page_num != $l) {
   ?> <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a> &nbsp;|&nbsp; <?php 
  } else {
   ?> <b><?php echo $l; ?></b> &nbsp;|&nbsp; <?php 
  }
   $l++;
  }
  if ($page_num != $l) {
  ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a><?php
  } else {
  ?><b><?php echo $l; ?></b><?php
  }
   if ($page_num < ( ceil(($total_files)/MINIATURES_PER_PAGE)) ) { ?> &nbsp;|&nbsp; <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo ($page_num+1) ?>" class="Style2">&raquo;</a><?php } ?>
  </span></div>
<br>
<table border="0" align="center" cellpadding="8" cellspacing="0">
	<tr>
<?php 
//si les références correspondent :
$total_thumbFloor = MINIATURES_PER_PAGE*$page_num;
$k=0; 
for ($i = $total_thumbFloor - MINIATURES_PER_PAGE; $i < ( ($total_files > $total_thumbFloor) ? $total_thumbFloor : $total_files); $i++) {//oncompte le nb d'éléments à afficher selon le numéro de page
		$fileexist = "";
		$j = 0;
			while ($j < ($total_files)) {
				if ("__".$listvalidimg[$i] == (isset($extractthumbs[$j]) ? $extractthumbs[$j] : "")) {
					$fileexist = $extractthumbs[$j];
				}
			$j++;
		   }
		$pos = strrpos($listvalidimg[$i], '.'); //calcule la position du point dans la chaine $document, ex. : 8
		$ext = strtolower(substr($listvalidimg[$i], $pos + 1));
			if (($ext == "jpeg" || $ext == "jpg" || $ext == "gif" || $ext == "png") && $listvalidimg[$i] !== ICO_FILENAME && ("__".$listvalidimg[$i] !== $fileexist)) { //si $document contient les extensions d'image et qu'il n'est pas icone/image du répertoire
			   create_newimage($photodir, $listvalidimg[$i], MINIATURE_MAXDIM, THUMBS_DIR, "__");
		   }
		?>
        <?php (is_int($k/MINIATURES_PER_LINE) ? print "<tr>": print "");  ?>  
	<td>
		<table border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
		  <tr class="tddeco">
		    <td width="<?php echo MINIATURE_MAXDIM + 18; ?>" height="<?php echo MINIATURE_MAXDIM + 18; ?>" align="center" valign="middle" class="tdover" onMouseOver="this.style.borderColor='#666666'" onMouseOut="this.style.borderColor='#FFFFFF'"><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo rawurlencode($photodir); ?>&photo=<?php echo $i+1; ?>"><img src="<?php echo PHOTOS_DIR."/" . rawurlencode($photodir) . "/" . THUMBS_DIR . "/__".$listvalidimg[$i] ?>" border="0" alt="<?php echo $listvalidimg[$i]; ?>" class="imageborder"></a></td>
		  </tr>
		  <tr>
		    <td align="center"><span class="Style2"><?php echo $i+1 ."| " . wordTruncate($listvalidimg[$i]); ?></span></td>
		  </tr>
	  </table>
	  </td>
		<?php
		$k++;
}
?>
</table><br>
<div class="fdcolor1" align="center">
  <span class="Style2"><?php if ($page_num > 1) { ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo ($page_num-1) ?>" class="Style2">&laquo;</a> &nbsp;|&nbsp; <?php } 
  $l =1;
  while ($l < (ceil(($total_files)/MINIATURES_PER_PAGE)) ) {
  if ($page_num != $l) {
   ?> <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a> &nbsp;|&nbsp; <?php 
  } else {
   ?> <b><?php echo $l; ?></b> &nbsp;|&nbsp; <?php 
  }
   $l++;
  }
  if ($page_num != $l) {
  ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo $l; ?>" class="Style2"><?php echo $l; ?></a><?php
  } else {
  ?><b><?php echo $l; ?></b><?php
  }
   if ($page_num < ( ceil(($total_files)/MINIATURES_PER_PAGE)) ) { ?> &nbsp;|&nbsp; <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir; ?>&page_num=<?php echo ($page_num+1) ?>" class="Style2">&raquo;</a><?php } ?>
  </span></div>
<?php 
 break;
 
 
//détail de la photo
case ('detail'):
$photodir = (isset($_GET['dir']) ? $_GET['dir'] : "");
	if (!isset($_GET['dir']) || $_GET['dir'] == "") {//on vérifie que le répertoire photo existe bien ?>
		<table border="0" align="center" cellpadding="28" cellspacing="0">
		  <tr>
		    <td align="center"><span class="txtrouge">Vous devez spécifier un répertoire photo !</span>
		      <p>
			<form method="post"><INPUT TYPE="button" VALUE="Retour" onClick="history.go(-1)"></form>
			</td>
		</tr>
	</table>
	<?php	
	break;
	}
//on supprime les slash, antislash et points possibles pour éviter les failles de sécurité
$photodir = preg_replace("/\\\\/", "", $photodir);
$str2clean = array("." => "", "/" => "");
$photodir = strtr($photodir, $str2clean);
$dir = PHOTOS_DIR . "/" . $photodir; //chemin vers le répertoire qui contient les miniatures
	if (!file_exists($dir)) {//on vérifie que le répertoire photo existe bien ?>
		<table border="0" align="center" cellpadding="28" cellspacing="0">
		  <tr>
		    <td align="center"><span class="txtrouge">Ce r&eacute;pertoire photo n'existe pas !</span>
		      <p>
			<form method="post"><INPUT TYPE="button" VALUE="Retour" onClick="history.go(-1)"></form>
			</td>
		</tr>
	</table>
	<?php	
	break;
	}
$photo = (isset($_GET['photo']) ? $_GET['photo'] : "");
$dim = (isset($_GET['dim']) ? $_GET['dim'] : IMAGE_STDDIM);
$dir = PHOTOS_DIR . "/" . $photodir;
if ($handle = opendir($dir)) {
   $cFile = 1;
   while (false !== ($file = readdir($handle))) {
	if($file != "." && $file != ".."){
		if(is_file($dir . "/" . $file) && $file != ICO_FILENAME){
			$listFile[$cFile] = $file;
			$cFile++;
		}
	}
   }
   closedir($handle);
}
 
if (ALPHABETIC_ORDER == true)
{
	$listFile2 = $listFile;
	usort($listFile2,"strnatcmp");
	for ($i=0;$i < count($listFile2); $i++) {
		$listFile[$i+1] = $listFile2[$i];
	}
}
//
	if (!isset($_GET['photo']) || $_GET['photo'] == "" || !isset($listFile[$photo])) {//on vérifie que la photo existe bien ?>
		<table border="0" align="center" cellpadding="28" cellspacing="0">
		  <tr>
		    <td align="center"><span class="txtrouge">Il n'y a aucune photo à afficher !</span>
		      <p>
			<form method="post"><INPUT TYPE="button" VALUE="Retour" onClick="history.go(-1)"></form>
			</td>
		</tr>
	</table>
	<?php	
	break;
	}
	//
if (!file_exists($dir . "/" . $dim . "/" . $listFile[$photo])) {
	create_newimage($photodir, $listFile[$photo], $dim, $dim, "");
} 
$total_images = count($listFile);// on compte le nombre d'éléments dans le dossier sans compter "." et ".."
list($width, $height, $type, $attr) = getimagesize($dir . "/" . $dim . "/" . $listFile[$photo]);
//on créé les miniatures si elles sont absentes
if ($photo > 1 && !file_exists(PHOTOS_DIR . "/" . $photodir . "/" . THUMBS_DIR . "/__" . $listFile[$photo-1])) {
	create_newimage($photodir, $listFile[$photo-1], MINIATURE_MAXDIM, THUMBS_DIR, "__");
}
if ($photo < $total_images && !file_exists(PHOTOS_DIR . "/" . $photodir . "/" . THUMBS_DIR . "/__" . $listFile[$photo+1])) {
	create_newimage($photodir, $listFile[$photo+1], MINIATURE_MAXDIM, THUMBS_DIR, "__");
}
$separateurs = array('_', '-', '.');
?>
<div class="fdgris"><span class="Style1">////// <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=default" class="Style1"><?php echo HOME_NAME ?></a> &raquo; <a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=list&dir=<?php echo $photodir ?>&page_num=<?php echo ceil($photo/MINIATURES_PER_PAGE); ?>" class="Style1"><?php echo str_replace($separateurs, ' ', $photodir); ?></a> &raquo; photo : <?php echo $listFile[$photo]; ?> / n&deg;<?php echo $photo; ?> sur <?php echo $total_images; ?></span></div>
<br>
<table border="0" align="center" cellpadding="8" cellspacing="0">
  <tr>
    <td width="<?php echo MINIATURE_MAXDIM + 26; ?>" height="<?php echo MINIATURE_MAXDIM + 26; ?>">
	<?php if ($photo > 1) {?>
		<table border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
			<tr class="tddeco">
		  		<td width="<?php echo MINIATURE_MAXDIM + 18; ?>" height="<?php echo MINIATURE_MAXDIM + 18; ?>" align="center" valign="middle" class="tdover" onMouseOver="this.style.borderColor='#666666'" onMouseOut="this.style.borderColor='#FFFFFF'">
				<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo $photodir; ?>&photo=<?php echo $photo-1; echo ($dim == IMAGE_STDDIM ? "" : "&dim=". $dim);?>"><img src="<?php echo PHOTOS_DIR . "/" . rawurlencode($photodir) . "/" . THUMBS_DIR . "/__" . $listFile[$photo-1]; ?>" alt="<?php echo $listFile[$photo-1]; ?>" border="0" class="imageborder"></a>
				</td>
			</tr>
	  	</table>
	<?php }?>
	</td><td>
		<table border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
		  <tr class="tddeco">
		    <td width="<?php echo $dim + 18; ?>" height="<?php echo $dim + 18; ?>" align="center" valign="middle" class="tdover" onMouseOver="this.style.borderColor='#666666'" onMouseOut="this.style.borderColor='#FFFFFF'">
			<?php if ($photo != "") { 
			if ($photo < $total_images) { ?><a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo $photodir; ?>&photo=<?php echo $photo+1; echo ($dim == IMAGE_STDDIM ? "" : "&dim=". $dim);?>"><?php } ?>
				<img src="<?php echo PHOTOS_DIR . "/" . rawurlencode($photodir) . "/" . $dim . "/" . $listFile[$photo]; ?>" alt="<?php echo $listFile[$photo]; ?>" <?php echo $attr; ?> border="0" class="imageborder">
			<?php if ($photo < $total_images) { ?></a><?php } 
			} else { echo "<span class=\"txtrouge\">Il n'y a aucune photo à afficher</span>"; } ?>
			</td>
		  </tr>
		  <tr>
		    <td align="center"><span class="Style2"> 
			<?php if ($dim !== IMAGE_400) { ?>
			<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo $photodir; ?>&photo=<?php echo $photo; ?>&dim=<?php echo IMAGE_400; ?>" class="Style2">400x300</a>
			<?php } else {  echo "<b>400x300</b>"; } ?>
			|| 
			<?php if ($dim !== IMAGE_STDDIM) { ?>
			<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo $photodir; ?>&photo=<?php echo $photo; ?>&dim=<?php echo IMAGE_STDDIM; ?>" class="Style2">640x480</a>
			<?php } else {  echo "<b>640x480</b>"; } ?>
			|| 
			<?php if ($dim !== IMAGE_800) { ?>
			<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo $photodir; ?>&photo=<?php echo $photo; ?>&dim=<?php echo IMAGE_800; ?>" class="Style2">800x600</a>
			<?php } else {  echo "<b>800x600</b>"; } ?>
			|| 
			<?php if ($dim !== IMAGE_1024) { ?>
			<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo $photodir; ?>&photo=<?php echo $photo; ?>&dim=<?php echo IMAGE_1024; ?>" class="Style2">1024x768</a>
			<?php } else {  echo "<b>1024x768</b>"; } ?>
			<?php
		if (exif_imagetype($dir.'/'.$listFile[$photo]) != IMAGETYPE_PNG && exif_imagetype($dir.'/'.$listFile[$photo]) != IMAGETYPE_GIF) {
				 ?><hr size="1" noshade><?php
	 			$exif = read_exif_data($dir.'/'.$listFile[$photo], 0, true);
				echo $exif["FILE"]["FileName"] . " || " . round(($exif["FILE"]["FileSize"]/1024), 0) . " Ko || Résolution originale : ".$exif["COMPUTED"]["Width"]." x ".$exif["COMPUTED"]["Height"]."<br>\n";
		   if (isset($exif["EXIF"]["DateTimeOriginal"]))  echo "Date et Heure : ".$exif["EXIF"]["DateTimeOriginal"]."<br>";
		   if (isset($exif["EXIF"]["ExposureTime"])) echo "Temps d'exposition : ".$exif["EXIF"]["ExposureTime"]." || ";
		   if (isset($exif["EXIF"]["ISOSpeedRatings"])) echo "ISO : ".$exif["EXIF"]["ISOSpeedRatings"]."<br>";
		   if (isset($exif["COMPUTED"]["ApertureFNumber"])) echo "Ouverture de la focale : ".$exif["COMPUTED"]["ApertureFNumber"]." || ";
		   if (isset($exif["EXIF"]["FocalLength"])) echo "Longueur de la focale : ".$exif["EXIF"]["FocalLength"]."\n";
		}
			 ?>
			</span>
			</td>
		  </tr>
	  </table>
	</td>
    <td width="<?php echo MINIATURE_MAXDIM + 26; ?>" height="<?php echo MINIATURE_MAXDIM + 26; ?>">
	<?php if ($photo < $total_images) {?>
		<table border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
			<tr class="tddeco">
		  		<td width="<?php echo MINIATURE_MAXDIM + 18; ?>" height="<?php echo MINIATURE_MAXDIM + 18; ?>" align="center" valign="middle" class="tdover" onMouseOver="this.style.borderColor='#666666'" onMouseOut="this.style.borderColor='#FFFFFF'">
 
				<a href="<?php echo $_SERVER["PHP_SELF"]; ?>?show_heading=detail&dir=<?php echo $photodir; ?>&photo=<?php echo $photo+1; echo ($dim == IMAGE_STDDIM ? "" : "&dim=". $dim);?>"><img src="<?php echo PHOTOS_DIR . "/" . rawurlencode($photodir) . "/" . THUMBS_DIR . "/__" . $listFile[$photo+1]; ?>" alt="<?php echo $listFile[$photo+1]; ?>" border="0" class="imageborder"></a>
				</td>
			</tr>
	  	</table>
	<?php }?>
	</td>
  </tr>
</table>
 
<?php
break;
//fin du switch
}
?>
</body>
</html>
Sachant que le fichier conf.php contient que des variables simples !

Or n'étant pas expert du tout dans le php, je ne vois pas d'où vient l'erreur qui me pose tout de même beaucoup de soucis :s

D'avance merci pour toutes aides de votre part