summaryrefslogtreecommitdiff
path: root/www/WebMagick/files/patch-aa
blob: 66fd4927adb1357c0fd141761ecdbccdd69cda98 (plain) (blame)
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
642
643
644
645
646
647
648
649
650
651
652
653
654
Index: webmagick.in
===================================================================
RCS file: /cvsroot/webmagick/WebMagick/webmagick.in,v
retrieving revision 1.117
retrieving revision 1.129
diff -u -r1.117 -r1.129
--- webmagick.in	23 Oct 2002 16:14:47 -0000	1.117
+++ webmagick.in	21 Feb 2004 02:27:24 -0000	1.129
@@ -1,6 +1,6 @@
 #! @PERL@ 
 #
-# $Id: webmagick.in,v 1.117 2002/10/23 16:14:47 clindell Exp $
+# $Id: webmagick.in,v 1.129 2004/02/21 02:27:24 ache Exp $
 #
 # You are looking at the main PERL script for WebMagick, a package to
 # intelligently create HTML and JavaScript index files and imagemaps
@@ -167,6 +167,7 @@
     %opt_icons,
     $opt_ignore,
     $opt_ignorefp,
+    $opt_indexinfo,
     $opt_imgindexname,
     $opt_indexname,
     $opt_javascript,
@@ -212,6 +213,9 @@
     $opt_srcdir,
     $opt_stylesheet, 	# URL to a CSS to use
     $opt_tables,
+    $opt_tables_bottom,
+    $opt_tables_params,
+    $opt_tables_top,
     $opt_thumbbackground,
     $opt_thumbbordercolor,
     $opt_thumbborderwidth,
@@ -237,8 +241,11 @@
     $opt_webmagickrc,	# Per-directory WebMagick rc file name
     $opt_zoomfilter,
     $opt_pichtml,
+    $opt_pichtmlaltend,
+    $opt_pichtmlaltstart,
     $opt_pichtmlbottom,
     $opt_pichtmlext,
+    $opt_pichtmllink,
     $opt_pichtmlnav,
     $opt_pichtmlputtitle,
     $opt_pichtmltarget,
@@ -368,6 +375,7 @@
 $opt_ignore		= 0;	# Do not webmagick this directory
 				#    but still recurse into sub-directories
 $opt_ignorefp		= 1;	# ignore _* special FrontPage directories (on)
+$opt_indexinfo          = 1;    # Put "Index of files"
 $opt_srcdir		= '.';	# Source directory path (current directory)
 $opt_verbose		= 0;	# Verbose flag (default off)
 $opt_forcecache		= 0;	# Force update of cached thumbnails
@@ -386,13 +394,19 @@
 $opt_readmevisible	= 0;	# Make README.html be first page.
 $opt_title		= '';	# Page title (blank provides default title)
 $opt_tables		= 0;	# disable tables
+$opt_tables_bottom      = '';   # HTML after table contents
+$opt_tables_params      = 'WIDTH="90%"';   # table HTML parameters
+$opt_tables_top         = '';   # HTML before table contents
 $opt_address		= '';	# Additonal address info for bottom of
                                 #    imagemap page
 $opt_date               = 1;    # Output updates date
 
 $opt_pichtml            = 0;    # Write separate HTML for each picture
+$opt_pichtmlaltend      = '';   # Some words to append to ALT
+$opt_pichtmlaltstart    = '';   # Some words to prepend to ALT
 $opt_pichtmlbottom      = '</CENTER>';
 $opt_pichtmlext         = '.html'; # Use .shtml for SSI
+$opt_pichtmllink        = '';   # Where to link pic
 $opt_pichtmlnav         = 0;    # Write navigation into pic's HTML
 $opt_pichtmlputtitle    = 1;    # Write picture title above it
 $opt_pichtmltarget      = '';
@@ -492,7 +506,7 @@
 $opt_framemarginwidth	= 1;		# Pixels allocated to frame margin in horizontal direction
 $opt_framemarginheight	= 1;		# Pixels allocated to frame margin in vertical direction
 $opt_framebordersize	= 3 ;		# Pixels allocated to frame border
-$opt_frameborder	= 'YES';	# Enable (YES) or disable (NO) decorative frame borders
+$opt_frameborder        = 1;            # Enable (1) or disable (0) decorative frame borders
 $opt_framestyle		= 1;		# Frame style to use (out of those available)
 
 #
@@ -596,12 +610,11 @@
 # |  |          |
 #  -------------
 $opt_framefmt{1}=
-'<FRAMESET COLS=\"132,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize}>
+'<FRAMESET COLS=\"132,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize} FRAMESPACING=${opt_framebordersize}>
  <FRAME SRC=\"${dirframelink}\" NAME=\"${opt_frame_name_dirview}\"
    MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
  <FRAME SRC=\"${pageframelink}\" NAME=\"${opt_frame_name_imageview}\"
-   MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
-</FRAMESET>';
+   MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>';
 $opt_framefmt_frames{1}=2;	# Number of frames expressed by this frame format
 
 # Three frame screen with directories listed in top-left frame,
@@ -616,16 +629,15 @@
 # |  |          |
 #  -------------
 $opt_framefmt{2}=
-'<FRAMESET COLS=\"145,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize}>
- <FRAMESET ROWS=\"20%,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize}>
+'<FRAMESET COLS=\"145,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize} FRAMESPACING=${opt_framebordersize}>
+ <FRAMESET ROWS=\"20%,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize} FRAMESPACING=${opt_framebordersize}>
   <FRAME SRC=\"${dirframelink}\" NAME=\"${opt_frame_name_dirview}\"
     MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
   <FRAME SRC=\"${pageframelink}\" NAME=\"${opt_frame_name_thumbview}\"
     MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
  </FRAMESET>
  <FRAME SRC=\"${imageFrameLink}\" NAME=\"${opt_frame_name_imageview}\"
-   MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
-</FRAMESET>';
+   MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>';
 $opt_framefmt_frames{2}=3;	# Number of frames expressed by this frame format
 
 # Three frame screen with directories listed in left frame,
@@ -640,16 +652,15 @@
 # |  |          |
 #  -------------
 $opt_framefmt{3}=
-'<FRAMESET COLS=\"132,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize}>
+'<FRAMESET COLS=\"132,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize} FRAMESPACING=${opt_framebordersize}>
  <FRAME SRC=\"${dirframelink}\" NAME=\"${opt_frame_name_dirview}\"
    MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
- <FRAMESET ROWS=\"150,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize}>
+ <FRAMESET ROWS=\"150,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize} FRAMESPACING=${opt_framebordersize}>
    <FRAME SRC=\"${pageframelink}\" NAME=\"${opt_frame_name_thumbview}\"
      MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
    <FRAME SRC=\"${imageFrameLink}\" NAME=\"${opt_frame_name_imageview}\"
      MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
- </FRAMESET>
-</FRAMESET>';
+ </FRAMESET>';
 $opt_framefmt_frames{3}=3;	# Number of frames expressed by this frame format
 
 # Three frame screen with directories listed in lower-left frame,
@@ -664,16 +675,15 @@
 # |  |          |
 #  -------------
 $opt_framefmt{4}=
-'<FRAMESET ROWS=\"172,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize}>
+'<FRAMESET ROWS=\"172,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize} FRAMESPACING=${opt_framebordersize}>
  <FRAME SRC=\"${pageframelink}\" NAME=\"${opt_frame_name_thumbview}\"
    MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
- <FRAMESET COLS=\"132,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize}>
+ <FRAMESET COLS=\"132,*\" FRAMEBORDER=${opt_frameborder} BORDER=${opt_framebordersize} FRAMESPACING=${opt_framebordersize}>
    <FRAME SRC=\"${dirframelink}\" NAME=\"${opt_frame_name_dirview}\"
      MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
    <FRAME SRC=\"${imageFrameLink}\" NAME=\"${opt_frame_name_imageview}\"
      MARGINWIDTH=${opt_framemarginwidth} MARGINHEIGHT=${opt_framemarginheight}>
- </FRAMESET>
-</FRAMESET>';
+ </FRAMESET>';
 $opt_framefmt_frames{4}=3;	# Number of frames expressed by this frame format
 
 #
@@ -793,7 +803,7 @@
 		'framemarginwidth=i'	=> \$opt_framemarginwidth,
 		'framemarginheight=i'	=> \$opt_framemarginheight,
 		'framebordersize=i'	=> \$opt_framebordersize,
-		'frameborder=s'		=> \$opt_frameborder,
+		'frameborder=i'         => \$opt_frameborder,
 		'frames!'               => \$opt_frames,
 		'framestyle=i'		=> \$opt_framestyle,
 		'header=s'		=> \$opt_header,
@@ -803,6 +813,7 @@
 		'iconbase=s'            => \$opt_iconbase,
 		'iconpath=s'		=> \$opt_iconpath,
 		'ignorefp!'             => \$opt_ignorefp,
+		'indexinfo!'            => \$opt_indexinfo,
 		'imgindexname=s'	=> \$opt_imgindexname,
 		'indexname=s'		=> \$opt_indexname,
 		'javascript!'		=> \$opt_javascript,
@@ -828,8 +839,11 @@
 		'msg_up=s'              => \$opt_msg_up,
 		'pageindexname=s'	=> \$opt_pageindexname,
 		'pichtml!'              => \$opt_pichtml,
+		'pichtmlaltend=s'       => \$opt_pichtmlaltend,
+		'pichtmlaltstart=s'     => \$opt_pichtmlaltstart,
 		'pichtmlbottom=s'       => \$opt_pichtmlbottom,
 		'pichtmlext=s'          => \$opt_pichtmlext,
+		'pichtmllink=s'         => \$opt_pichtmllink,
 		'pichtmlnav!'           => \$opt_pichtmlnav,
 		'pichtmlputtitle!'      => \$opt_pichtmlputtitle,
 		'pichtmltarget=s'       => \$opt_pichtmltarget,
@@ -846,6 +860,9 @@
 		'srcdir=s'		=> \$opt_srcdir,
 		'stylesheet=s'		=> \$opt_stylesheet,
 		'tables!'		=> \$opt_tables,
+		'tables_bottom=s'       => \$opt_tables_bottom,
+		'tables_params=s'       => \$opt_tables_params,
+		'tables_top=s'          => \$opt_tables_top,
 		'thumbtexture=s'	=> \$opt_thumbtexture,
 		'thumbbackground=s'	=> \$opt_thumbbackground,
 		'thumbborderwidth=i'	=> \$opt_thumbborderwidth,
@@ -1353,9 +1370,11 @@
 
 	if( !defined(%dirTitles) || (  compareHash(\%dirTitles,\%tmp_dirTitles) ) ) {
 	    %dirTitles = %tmp_dirTitles;
-	    print( STDERR "Directory titles have changed, must re-do HTML indexes\n" )
-		if $opt_debug;
-	    ++$doIndexHtml;
+	    if ($opt_frames) {
+		print( STDERR "Directory titles have changed, must re-do HTML indexes\n" )
+		    if $opt_debug;
+		++$doIndexHtml;
+	    }
 	}	
     }
 
@@ -1576,7 +1595,7 @@
 	$tmp_montageParameters .= "mattecolor=>\'$opt_thumbframecolor\',\n "
 	    if $opt_thumbframecolor ne 'false';
 	$tmp_montageParameters .= "label=>\'$opt_thumblabel\',\n "
-	    if $opt_thumblabel ne 'false';
+	    if ($opt_thumblabel && $opt_thumblabel ne 'false');
 	$tmp_montageParameters .= "labelwidth=>\'$opt_thumblabelwidth\',\n ";
 	$tmp_montageParameters .= "\Lzoomfilter=>\'$opt_zoomfilter\'";
 	if( !defined($montageParameters) || ($tmp_montageParameters ne $montageParameters)) {
@@ -1619,7 +1638,7 @@
 	 'framemarginwidth'     => !$opt_frames ? 0 : $opt_framemarginwidth,
 	 'framemarginheight'    => !$opt_frames ? 0 : $opt_framemarginheight,
 	 'framebordersize'      => !$opt_frames ? 0 : $opt_framebordersize,
-	 'frameborder'          => !$opt_frames ? "" : $opt_frameborder,
+	 'frameborder'          => !$opt_frames ? 0 : $opt_frameborder,
 	 'frames'               => $opt_frames,
 	 'framestyle'           => !$opt_frames ? 1 : $opt_framestyle,
 	 'header'		=> $opt_header,
@@ -1627,6 +1646,7 @@
 	 'htmlext'              => !$opt_frames ? "" : $opt_htmlext,
 	 'iconbase'             => $opt_iconbase,
 	 'imgindexname'		=> $opt_imgindexname,
+	 'indexinfo'            => $opt_indexinfo,
 	 'indexname'            => $opt_indexname,
 	 'javascript'           => $opt_javascript,
 	 'jsdirindex'           => !$opt_javascript ? "" : $fileNames{'jsDirIndex'},
@@ -1647,8 +1667,8 @@
 	 'msg_directory_navigator' => !$opt_frames ? "" : $opt_msg_directory_navigator,
 	 'msg_images'           => !$opt_frames ? "" : $opt_msg_images,
 	 'msg_index_of_directory' => $opt_msg_index_of_directory,
-	 'msg_index_of_files'   => $opt_msg_index_of_files,
-	 'msg_index_through'    => $opt_msg_index_through,
+	 'msg_index_of_files'   => !$opt_indexinfo ? "" : $opt_msg_index_of_files,
+	 'msg_index_through'    => !$opt_indexinfo ? "" : $opt_msg_index_through,
 	 'msg_next'             => $opt_msg_next,
 	 'msg_pause'             => $opt_msg_pause,
 	 'msg_page_navigator'   => !$opt_frames ? "" : $opt_msg_page_navigator,
@@ -1659,8 +1679,11 @@
 	 'numpages'		=> $numPages,
 	 'pageindexname'        => $opt_pageindexname,
 	 'pichtml'              => $opt_pichtml,
+	 'pichtmlaltend'        => !$opt_pichtml ? "" : $opt_pichtmlaltend,
+	 'pichtmlaltstart'      => !$opt_pichtml ? "" : $opt_pichtmlaltstart,
 	 'pichtmlbottom'        => !$opt_pichtml ? "" : $opt_pichtmlbottom,
 	 'pichtmlext'           => !$opt_pichtml ? "" : $opt_pichtmlext,
+	 'pichtmllink'          => !$opt_pichtml ? '' : $opt_pichtmllink,
 	 'pichtmlnav'           => !$opt_pichtml ? 0 : $opt_pichtmlnav,
 	 'pichtmlputtitle'      => !$opt_pichtml ? 0 : $opt_pichtmlputtitle,
 	 'pichtmltarget'        => (!$opt_pichtml || !$opt_frames) ? "" : $opt_pichtmltarget,
@@ -1676,6 +1699,9 @@
 	 'stylesheet'		=> $opt_stylesheet,
 	 'subdirectories'       => !$opt_frames ? "" : join(' ',@dirNames),
 	 'tables'		=> $opt_tables,
+	 'tables_bottom'        => !$opt_tables ? "" : $opt_tables_bottom,
+	 'tables_params'        => !$opt_tables ? "" : $opt_tables_params,
+	 'tables_top'           => !$opt_tables ? "" : $opt_tables_top,
 	 'title'		=> $pageTitle,
 	 'version'              => $opt_anonymous ? "" : $webmagickInfo{'version'},
 	 );
@@ -2135,7 +2161,8 @@
     print( INDEX "  <TITLE>${pageTitle}</TITLE>\n" );
 
     # Meta tags
-    print( INDEX "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" );
+    print( INDEX "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" )
+	if (!$opt_anonymous);
     print( INDEX "  <META NAME=\"Author\" CONTENT=\"${opt_metaauthor}\">\n" )
 	if( "$opt_metaauthor" ne '' );
     print( INDEX "  <META NAME=\"Description\" CONTENT=\"${opt_metadescription}\">\n" )
@@ -2173,20 +2200,17 @@
     print( INDEX $framespechtml );
     print( INDEX "<NOFRAMES>\n" );
     print( INDEX "<BODY\n" );
-    unless ("$opt_stylesheet" ne '')
-    {
-	    print( INDEX "  TEXT=\"${opt_colorfore}\"\n" );
-	    print( INDEX "  BGCOLOR=\"${opt_colorback}\"\n" )
-		if $opt_colorback ne 'false';
-	    print( INDEX "  BACKGROUND=\"$iconImageUrls{background}\"\n" )
-		if defined $iconImageUrls{background};
-	    print( INDEX "  LINK=\"${opt_colorlink}\"\n" );
-	    print( INDEX "  VLINK=\"${opt_colorvlink}\"\n" );
-	    print( INDEX "  ALINK=\"${opt_coloralink}\"");
-    }
+    print( INDEX "  TEXT=\"${opt_colorfore}\"\n" );
+    print( INDEX "  BGCOLOR=\"${opt_colorback}\"\n" )
+	if $opt_colorback ne 'false';
+    print( INDEX "  BACKGROUND=\"$iconImageUrls{background}\"\n" )
+	if defined $iconImageUrls{background};
+    print( INDEX "  LINK=\"${opt_colorlink}\"\n" );
+    print( INDEX "  VLINK=\"${opt_colorvlink}\"\n" );
+    print( INDEX "  ALINK=\"${opt_coloralink}\"");
     print( INDEX ">\n" );
     print( INDEX $indexhtml );
-    print( INDEX "</BODY>\n</NOFRAMES>\n</HTML>" );
+    print( INDEX "</BODY>\n</NOFRAMES>\n</FRAMESET>\n</HTML>" );
     close( INDEX );
 
 
@@ -2224,7 +2248,8 @@
     print( INDEX "  <BASE TARGET=\"$opt_frame_name_top\">\n" );
 
     # Meta tags
-    print( INDEX "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" );
+    print( INDEX "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" )
+	if (!$opt_anonymous);
     print( INDEX "  <META NAME=\"Author\" CONTENT=\"${opt_metaauthor}\">\n" )
 	if( "$opt_metaauthor" ne '' );
     print( INDEX "  <META NAME=\"Description\" CONTENT=\"${opt_metadescription}\">\n" )
@@ -2242,17 +2267,14 @@
     
     print( INDEX "</HEAD>\n" );
     print( INDEX "<BODY\n" );
-    unless ("$opt_stylesheet" ne '')
-    {
-	    print( INDEX "  TEXT=\"${opt_dircolorfore}\"\n" );
-	    print( INDEX "  BGCOLOR=\"${opt_dircolorback}\"\n" )
-		if $opt_dircolorback ne 'false';
-	    print( INDEX "  BACKGROUND=\"$iconImageUrls{dirbackground}\"\n" )
-		if defined $iconImageUrls{dirbackground};
-	    print( INDEX "  LINK=\"${opt_dircolorlink}\"\n" );
-	    print( INDEX "  VLINK=\"${opt_dircolorvlink}\"\n" );
-	    print( INDEX "  ALINK=\"${opt_dircoloralink}\"" );
-	}
+    print( INDEX "  TEXT=\"${opt_dircolorfore}\"\n" );
+    print( INDEX "  BGCOLOR=\"${opt_dircolorback}\"\n" )
+	if $opt_dircolorback ne 'false';
+    print( INDEX "  BACKGROUND=\"$iconImageUrls{dirbackground}\"\n" )
+	if defined $iconImageUrls{dirbackground};
+    print( INDEX "  LINK=\"${opt_dircolorlink}\"\n" );
+    print( INDEX "  VLINK=\"${opt_dircolorvlink}\"\n" );
+    print( INDEX "  ALINK=\"${opt_dircoloralink}\"" );
     print( INDEX ">\n");
     print( INDEX $pagedirhtml );
     print( INDEX "</BODY></HTML>\n" );
@@ -2361,7 +2383,8 @@
 	if ($opt_frames);
 
     # Meta tags
-    print( INDEX "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" );
+    print( INDEX "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" )
+	if (!$opt_anonymous);
     print( INDEX "  <META NAME=\"Author\" CONTENT=\"${opt_metaauthor}\">\n" )
 	if( "$opt_metaauthor" ne '' );
     print( INDEX "  <META NAME=\"Description\" CONTENT=\"${opt_metadescription}\">\n" )
@@ -2379,16 +2402,13 @@
 
     print( INDEX "</HEAD>\n" );
     print( INDEX "<BODY\n" );
-    unless ("$opt_stylesheet" ne '')
-    {
-	    print( INDEX "  TEXT=\"${opt_colorfore}\"\n" );
-	    print( INDEX "  BGCOLOR=\"${opt_colorback}\"\n" );
-	    print( INDEX "  BACKGROUND=\"$iconImageUrls{background}\"\n" )
-		if defined $iconImageUrls{background};
-	    print( INDEX "  LINK=\"${opt_colorlink}\"\n" );
-	    print( INDEX "  VLINK=\"${opt_colorvlink}\"\n" );
-	    print( INDEX "  ALINK=\"${opt_coloralink}\"" );
-    }
+    print( INDEX "  TEXT=\"${opt_colorfore}\"\n" );
+    print( INDEX "  BGCOLOR=\"${opt_colorback}\"\n" );
+    print( INDEX "  BACKGROUND=\"$iconImageUrls{background}\"\n" )
+	if defined $iconImageUrls{background};
+    print( INDEX "  LINK=\"${opt_colorlink}\"\n" );
+    print( INDEX "  VLINK=\"${opt_colorvlink}\"\n" );
+    print( INDEX "  ALINK=\"${opt_coloralink}\"" );
     print( INDEX ">\n");
 
     print( INDEX "${opt_header}\n" ) if ("$opt_header" ne '');
@@ -2397,14 +2417,21 @@
     if( $numimages > 0 ) {
 	# Total HACK!!!
 	if( !$opt_frames || $opt_framestyle == 1 ) {
-	    print( INDEX "<p><FONT SIZE=\"-1\">${opt_msg_index_of_files}\"$imageNames[$pageNumber - 1][0]\" ${opt_msg_index_through}",
-		  " \"$imageNames[$pageNumber - 1][$numimages-1]\"</FONT></p>\n" );
+	    print( INDEX "<p><FONT SIZE=\"-1\">${opt_msg_index_of_files}\"",
+		  escapehtml($imageNames[$pageNumber - 1][0]),
+		  "\" ${opt_msg_index_through}",
+		  " \"",
+		  escapehtml($imageNames[$pageNumber - 1][$numimages-1]),
+		  "\"</FONT></p>\n" )
+			if ($opt_indexinfo);
 	}
 	print( INDEX "$indexbar<BR>\n" );
 
 	if ($opt_tables)
 	{
-		print INDEX "<TABLE WIDTH=\"90%\">";
+		print INDEX "<TABLE ${opt_tables_params}>";
+		print INDEX "${opt_tables_top}"
+			if ($opt_tables_top ne '');
 	}
 	else
 	{
@@ -2433,25 +2460,34 @@
 	
 	    my $pic = $imageNames[$pageNumber - 1][$imageNum];
 	    my $pichtml;
+	    my $altlabel;
 	    my $target = '';
+
 	    if ($opt_pichtml && $opt_frames && "$opt_pichtmltarget" ne '') {
 		$target = " TARGET=\"${opt_pichtmltarget}\"";
 	    }
+	    if (defined($imageLabels{$pic})) {
+		$altlabel = $imageLabels{$pic};
+	    } else {
+		($altlabel = $pic) =~ s/(.*)\.\w+$/$1/i;
+		$altlabel =~ y/_/ /; # Usual space replacement in file name
+	    }
+	    $altlabel = escapehtml($opt_pichtmlaltstart . $altlabel . $opt_pichtmlaltend);
 
 	    if ( $opt_pichtml ) {
 			
 			$pichtml = $pic . $opt_pichtmlext;
-
 			open( PICHTML, ">$pichtml")
 			    || die("$0: Failed to open file $pichtml for output\n$@\n");
 			print( PICHTML "<HTML>\n<HEAD>\n" );
 			# Charset is better before title
 			print( PICHTML "  <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=${opt_metacharset}\">\n" )
 			    if( "$opt_metacharset" ne '' );
-			print( PICHTML "  <TITLE>$pic</TITLE>\n" );
+			print( PICHTML "  <TITLE>${altlabel}</TITLE>\n" );
 
 			# Meta tags
-			print( PICHTML "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" );
+			print( PICHTML "  <META NAME=\"GENERATOR\" CONTENT=\"WebMagick/$webmagickInfo{version} [WebMagick]\">\n" )
+			    if (!$opt_anonymous);
 			print( PICHTML "  <META NAME=\"Author\" CONTENT=\"${opt_metaauthor}\">\n" )
 			    if( "$opt_metaauthor" ne '' );
 			print( PICHTML "  <META NAME=\"Description\" CONTENT=\"${opt_metadescription}\">\n" )
@@ -2469,28 +2505,19 @@
 
 			print( PICHTML "</HEAD>\n" );
 			print( PICHTML "<BODY\n" );
-			unless ("$opt_stylesheet" ne '')
-	    		{
-				print( PICHTML "  TEXT=\"${opt_colorfore}\"\n" );
-				print( PICHTML "  BGCOLOR=\"${opt_colorback}\"\n" );
-				print( PICHTML "  BACKGROUND=\"$iconImageUrls{background}\"\n" )
-				    if defined $iconImageUrls{background};
-				print( PICHTML "  LINK=\"${opt_colorlink}\"\n" );
-				print( PICHTML "  VLINK=\"${opt_colorvlink}\"\n" );
-				print( PICHTML "  ALINK=\"${opt_coloralink}\"");
-			}
+			print( PICHTML "  TEXT=\"${opt_colorfore}\"\n" );
+			print( PICHTML "  BGCOLOR=\"${opt_colorback}\"\n" );
+			print( PICHTML "  BACKGROUND=\"$iconImageUrls{background}\"\n" )
+			    if defined $iconImageUrls{background};
+			print( PICHTML "  LINK=\"${opt_colorlink}\"\n" );
+			print( PICHTML "  VLINK=\"${opt_colorvlink}\"\n" );
+			print( PICHTML "  ALINK=\"${opt_coloralink}\"");
 			print( PICHTML ">\n" );
 
 			print( PICHTML "$opt_pichtmltop") if ("$opt_pichtmltop" ne '');
 
 			if ($opt_pichtmlputtitle) {
-			    print ( PICHTML "${opt_pichtmltitlestart}");
-			    if (defined( $imageLabels{$pic})) {
-				print( PICHTML "$imageLabels{$pic}");
-			    } else {
-				print( PICHTML "$pic");
-			    }
-			    print ( PICHTML "${opt_pichtmltitleend}");
+			    print ( PICHTML "${opt_pichtmltitlestart}${altlabel}${opt_pichtmltitleend}");
 			}
 
 			if ($opt_pichtmlnav) {
@@ -2526,9 +2553,9 @@
 				} else {
 					print ( PICHTML "<A${target} HREF=\"");
 					if ($imageNum == 0 && $pageNumber != 1) {
-						print ( PICHTML $imageNames[$pageNumber - 2][$#{$imageNames[$pageNumber - 2]}]);
+						print ( PICHTML escapeurl($imageNames[$pageNumber - 2][$#{$imageNames[$pageNumber - 2]}]) );
 					} else {
-						print ( PICHTML $imageNames[$pageNumber - 1][${imageNum} - 1]);
+						print ( PICHTML escapeurl($imageNames[$pageNumber - 1][${imageNum} - 1]) );
 					}
 					print ( PICHTML $opt_pichtmlext);
 					print ( PICHTML "\"><IMG SRC=\"$iconImageUrls{'prev'}\"",
@@ -2543,9 +2570,9 @@
 				} else {
 					print ( PICHTML "<A${target} HREF=\"");
 					if (($imageNum == $#{$imageNames[$pageNumber - 1]}) && $pageNumber != $numPages) {
-						print ( PICHTML $imageNames[$pageNumber][0]);
+						print ( PICHTML escapeurl($imageNames[$pageNumber][0]) );
 					} else {
-						print ( PICHTML $imageNames[$pageNumber - 1][${imageNum} + 1]);
+						print ( PICHTML escapeurl($imageNames[$pageNumber - 1][${imageNum} + 1]) );
 					}
 					print ( PICHTML $opt_pichtmlext);
 					print ( PICHTML "\"><IMG SRC=\"$iconImageUrls{'next'}\"",
@@ -2556,10 +2583,14 @@
 				print ( PICHTML "</NOBR><BR>");
 			}
 
-			if ( $pic =~ /\.(jpg|jpeg?|gif|xbm|png)$/i ) {
-			    print( PICHTML "<IMG SRC=\"$pic\" ALT=\"\">" );
+			if ($pic =~ /\.(jpg|jpeg?|gif|xbm|png)$/i) {
+			    print( PICHTML "<A HREF=\"$opt_pichtmllink\">")
+				if ($opt_pichtmllink ne '');
+			    print( PICHTML "<IMG SRC=\"", escapeurl($pic), "\" BORDER=0 ALT=\"${altlabel}\">" );
+			    print( PICHTML "</A>")
+				if ($opt_pichtmllink ne '');
 			} else {
-			    print( PICHTML "<A HREF=\"", escapeurl($pic), "\"><BIG><B>$pic</B></A> ", fsize($pic), "</BIG>" );
+			    print( PICHTML "<A HREF=\"", escapeurl($pic), "\"><BIG><B>", escapehtml($pic), "</B></A> ", fsize($pic), "</BIG>" );
 			}
 
 			print( PICHTML "$opt_pichtmlbottom\n") if ("$opt_pichtmlbottom" ne '');
@@ -2601,12 +2632,19 @@
 			# TODO: make sure the thumbnails are created, and get some image sizes
 			# TODO: save the labels in a new array, maybe same with sizes
 			if ( $thumbImageSizes{$pic}) {
-				print (INDEX "<IMG SRC=\"", $opt_cachedir, "/", escapeurl($pic), ".\L${opt_cacheformat}", "\" $thumbImageSizes{$pic} BORDER=0>");
+				print (INDEX "<IMG SRC=\"", $opt_cachedir, "/", escapeurl($pic), ".\L${opt_cacheformat}",
+				       "\" $thumbImageSizes{$pic} ALT=\"${altlabel}\" BORDER=0>");
 			} else {
-				print (INDEX "<IMG SRC=\"", escapeurl($pic), "\" BORDER=0>");
+				print (INDEX "<IMG SRC=\"", escapeurl($pic),
+				       "\" ALT=\"${altlabel}\" BORDER=0>");
 			}
 			
-			print (INDEX "</A><BR><FONT SIZE=\"-1\">" . $tableImageLabels{$imageNames[$pageNumber - 1][$imageNum]} . "</FONT></TD>\n");
+			print (INDEX "</A>");
+			print (INDEX "<BR><FONT SIZE=\"-1\">",
+				$tableImageLabels{$imageNames[$pageNumber - 1][$imageNum]},
+				"</FONT>")
+				if ($opt_thumblabel && $opt_thumblabel ne 'false');
+			print (INDEX "</TD>\n");
 						
 			if ($imageNum%$opt_columns == ($opt_columns - 1))
 			{
@@ -2622,6 +2660,8 @@
 		{
 			print INDEX "</TR>";
 		}
+		print INDEX "${opt_tables_bottom}"
+			if ($opt_tables_bottom ne '');
 		print (INDEX "</TABLE>\n")
 	} else {print( INDEX "</MAP>\n" );}
     }
@@ -3868,7 +3908,7 @@
 	# Set image label
 	#
 	my $label = '';
-	if( $opt_thumblabel ne 'false' ) {
+	if( $opt_thumblabel && $opt_thumblabel ne 'false' ) {
 	    if( defined( $imageLabels{$imagename} ) ) {
 		# Set image specific label
 		$label = $imageLabels{$imagename};
@@ -3922,7 +3962,7 @@
 
 	    # put our label into the table image hash
 
-	    $tableImageLabels{$imagename} = $label;
+	    $tableImageLabels{$imagename} = escapehtml($label);
 	    $tableImageLabels{$imagename} =~ s/\n/<BR>/g;
 
 	    print( STDERR "Applying image label: \"${label}\"\n" )
@@ -4073,6 +4113,7 @@
   --[no]forcehtml    Force HTML files to be generated (default off)
   --[no]forcemontage Force montage (default off)
   --[no]ignorefp     Ignore directories with names like _vti (FrontPage directories) (default on)
+  --[no]indexinfo    Put "Index of files" (default on)
   --[no]help         Display usage message (default off)
   --[no]recurse      Recurse directory tree (default off)
   --srcdir	     Image directory to process
@@ -4156,25 +4197,33 @@
   --footer           Page footer (imagemap frame) (default to </CENTER>)
   --header           Page header (imagemap frame) (default to <CENTER>)
   --[no]javascript   Enable JavaScript output (default off)
+  --[no]readmevisible Show README.html on first page rather than just linking (default off)
+  --[no]tables       Use HTML tables instead of imagemaps for thumbnails (default off)
+  --tables_params    Table HTML parameters
+  --tables_top       HTML before table contents
+  --tables_bottom    HTML after table contents
+  --title            Page title
+
+Per-image HTML options:
   --[no]pichtml      Per-image HTML file generation (default off)
-  --pichtmlext       Per-image HTML file extension (default .html)
+  --pichtmlaltend    Some words to append to ALT= (default "")
+  --pichtmlaltstart  Some words to prepend to ALT= (default "")
   --pichtmlbottom    Per-image HTML, extra HTML to display below image (default to </CENTER>)
+  --pichtmlext       Per-image HTML file extension (default .html)
   --[no]pichtmlnav   Per-image HTML, show navigation buttons (default off)
+  --pichtmllink      Per-image HTML link (default "")
   --[no]pichtmlputtitle Put per-image HTML picture title (default on)
   --pichtmltarget    Per-image HTML default frame target
   --pichtmltitleend  End tags for per-image HTML picture title (default </P>)
   --pichtmltitlestart Start tags for per-image HTML picture title (default <P>)
   --pichtmltop       Per-image HTML, extra HTML to display above image (default to <CENTER>)
-  --[no]readmevisible Show README.html on first page rather than just linking (default off)
-  --[no]tables       Use HTML tables instead of imagemaps for thumbnails (default off)
-  --title            Page title
 
 Frame Options:
   --[no]frames       Use frames, if no - single directory collection assumed (default on)
   --framemarginwidth Pixels allocated to frame margin in horizontal direction
   --framemarginheight Pixels allocated to frame margin in vertical direction
   --framebordersize  Pixels allocated to frame border
-  --frameborder      Enable (YES) or disable (NO) decorative frame borders
+  --frameborder      Enable (1) or disable (0) decorative frame borders
   --framestyle       Frame style to use (out of those available)
   --[no]allowconfig  Allow user to configure framestyle, columns and rows (requires javascript and tables) (default off)
 
@@ -4296,6 +4345,7 @@
     s/&/&amp;/g;
     s/>/&gt;/g;
     s/</&lt;/g;
+    s/\"/&quot;/g;  # because we use "xxx" form sometimes
     return( $_ );
 }
 
@@ -4324,22 +4374,10 @@
 # Escape unsafe characters in URLs
 #		
 sub escapeurl {
+    no locale;
     local($_) = @_;
-    s/\%/%25/g;		# % (must substitute first!)
-    s/\"/%22/g;		# "
-    s/\#/%23/g;		# #
-    s/\</%3C/g;		# <
-    s/\>/%3E/g;		# >
-    s/\[/%5B/g;		# [
-    #s/\\/%5C/g;		# \
-    s/\]/%5D/g;		# ]
-    s/\^/%5E/g;		# ^
-    s/\`/%60/g;		# `
-    s/\{/%7B/g;		# {
-    s/\|/%7C/g;		# |
-    s/\}/%7D/g;		# }
-    s/\~/%7E/g;		# ~
-    s/ /%20/g;          # " "
+    # ' is here because some bots (Google) goes crazy on "xxx'xxx"
+    s/([][\x00-\x20"#%'<>^`{|}~\x7F-\xFF])/sprintf("%%%02x", ord($1))/eg;
     s:\\:/:g; # replace \ with / for better URLs
     return( $_ );
 }