[ Index ] |
|
Code source de FCKeditor 2.4 |
1 ##### 2 # FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 # Copyright (C) 2003-2007 Frederico Caldeira Knabben 4 # 5 # == BEGIN LICENSE == 6 # 7 # Licensed under the terms of any of the following licenses at your 8 # choice: 9 # 10 # - GNU General Public License Version 2 or later (the "GPL") 11 # http://www.gnu.org/licenses/gpl.html 12 # 13 # - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 # http://www.gnu.org/licenses/lgpl.html 15 # 16 # - Mozilla Public License Version 1.1 or later (the "MPL") 17 # http://www.mozilla.org/MPL/MPL-1.1.html 18 # 19 # == END LICENSE == 20 # 21 # File Name: upload_fck.pl 22 # This is the File Manager Connector for Perl. 23 # 24 # File Authors: 25 # Takashi Yamaguchi (jack@omakase.net) 26 ##### 27 28 # image data save dir 29 $img_dir = './temp/'; 30 31 32 # File size max(unit KB) 33 $MAX_CONTENT_SIZE = 30000; 34 35 # Filelock (1=use,0=not use) 36 $PM{'flock'} = '1'; 37 38 39 # upload Content-Type list 40 my %UPLOAD_CONTENT_TYPE_LIST = ( 41 'image/(x-)?png' => 'png', # PNG image 42 'image/p?jpe?g' => 'jpg', # JPEG image 43 'image/gif' => 'gif', # GIF image 44 'image/x-xbitmap' => 'xbm', # XBM image 45 46 'image/(x-(MS-)?)?bmp' => 'bmp', # Windows BMP image 47 'image/pict' => 'pict', # Macintosh PICT image 48 'image/tiff' => 'tif', # TIFF image 49 'application/pdf' => 'pdf', # PDF image 50 'application/x-shockwave-flash' => 'swf', # Shockwave Flash 51 52 'video/(x-)?msvideo' => 'avi', # Microsoft Video 53 'video/quicktime' => 'mov', # QuickTime Video 54 'video/mpeg' => 'mpeg', # MPEG Video 55 'video/x-mpeg2' => 'mpv2', # MPEG2 Video 56 57 'audio/(x-)?midi?' => 'mid', # MIDI Audio 58 'audio/(x-)?wav' => 'wav', # WAV Audio 59 'audio/basic' => 'au', # ULAW Audio 60 'audio/mpeg' => 'mpga', # MPEG Audio 61 62 'application/(x-)?zip(-compressed)?' => 'zip', # ZIP Compress 63 64 'text/html' => 'html', # HTML 65 'text/plain' => 'txt', # TEXT 66 '(?:application|text)/(?:rtf|richtext)' => 'rtf', # RichText 67 68 'application/msword' => 'doc', # Microsoft Word 69 'application/vnd.ms-excel' => 'xls', # Microsoft Excel 70 71 '' 72 ); 73 74 # Upload is permitted. 75 # A regular expression is possible. 76 my %UPLOAD_EXT_LIST = ( 77 'png' => 'PNG image', 78 'p?jpe?g|jpe|jfif|pjp' => 'JPEG image', 79 'gif' => 'GIF image', 80 'xbm' => 'XBM image', 81 82 'bmp|dib|rle' => 'Windows BMP image', 83 'pi?ct' => 'Macintosh PICT image', 84 'tiff?' => 'TIFF image', 85 'pdf' => 'PDF image', 86 'swf' => 'Shockwave Flash', 87 88 'avi' => 'Microsoft Video', 89 'moo?v|qt' => 'QuickTime Video', 90 'm(p(e?gv?|e|v)|1v)' => 'MPEG Video', 91 'mp(v2|2v)' => 'MPEG2 Video', 92 93 'midi?|kar|smf|rmi|mff' => 'MIDI Audio', 94 'wav' => 'WAVE Audio', 95 'au|snd' => 'ULAW Audio', 96 'mp(e?ga|2|a|3)|abs' => 'MPEG Audio', 97 98 'zip' => 'ZIP Compress', 99 'lzh' => 'LZH Compress', 100 'cab' => 'CAB Compress', 101 102 'd?html?' => 'HTML', 103 'rtf|rtx' => 'RichText', 104 'txt|text' => 'Text', 105 106 '' 107 ); 108 109 110 # sjis or euc 111 my $CHARCODE = 'sjis'; 112 113 $TRANS_2BYTE_CODE = 0; 114 115 ############################################################################## 116 # Summary 117 # 118 # Form Read input 119 # 120 # Parameters 121 # Returns 122 # Memo 123 ############################################################################## 124 sub read_input 125 { 126 eval("use File::Copy;"); 127 eval("use File::Path;"); 128 129 my ($FORM) = @_; 130 131 132 mkdir($img_dir,0777); 133 chmod(0777,$img_dir); 134 135 undef $img_data_exists; 136 undef @NEWFNAMES; 137 undef @NEWFNAME_DATA; 138 139 if($ENV{'CONTENT_LENGTH'} > 10000000 || $ENV{'CONTENT_LENGTH'} > $MAX_CONTENT_SIZE * 1024) { 140 &upload_error( 141 'Size Error', 142 sprintf( 143 "Transmitting size is too large.MAX <strong>%d KB</strong> Now Size <strong>%d KB</strong>(<strong>%d bytes</strong> Over)", 144 $MAX_CONTENT_SIZE, 145 int($ENV{'CONTENT_LENGTH'} / 1024), 146 $ENV{'CONTENT_LENGTH'} - $MAX_CONTENT_SIZE * 1024 147 ) 148 ); 149 } 150 151 my $Buffer; 152 if($ENV{'CONTENT_TYPE'} =~ /multipart\/form-data/) { 153 # METHOD POST only 154 return unless($ENV{'CONTENT_LENGTH'}); 155 156 binmode(STDIN); 157 # STDIN A pause character is detected.'(MacIE3.0 boundary of $ENV{'CONTENT_TYPE'} cannot be trusted.) 158 my $Boundary = <STDIN>; 159 $Boundary =~ s/\x0D\x0A//; 160 $Boundary = quotemeta($Boundary); 161 while(<STDIN>) { 162 if(/^\s*Content-Disposition:/i) { 163 my($name,$ContentType,$FileName); 164 # form data get 165 if(/\bname="([^"]+)"/i || /\bname=([^\s:;]+)/i) { 166 $name = $1; 167 $name =~ tr/+/ /; 168 $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 169 &Encode(\$name); 170 } 171 if(/\bfilename="([^"]*)"/i || /\bfilename=([^\s:;]*)/i) { 172 $FileName = $1 || 'unknown'; 173 } 174 # head read 175 while(<STDIN>) { 176 last if(! /\w/); 177 if(/^\s*Content-Type:\s*"([^"]+)"/i || /^\s*Content-Type:\s*([^\s:;]+)/i) { 178 $ContentType = $1; 179 } 180 } 181 # body read 182 $value = ""; 183 while(<STDIN>) { 184 last if(/^$Boundary/o); 185 $value .= $_; 186 }; 187 $lastline = $_; 188 $value =~s /\x0D\x0A$//; 189 if($value ne '') { 190 if($FileName || $ContentType) { 191 $img_data_exists = 1; 192 ( 193 $FileName, # 194 $Ext, # 195 $Length, # 196 $ImageWidth, # 197 $ImageHeight, # 198 $ContentName # 199 ) = &CheckContentType(\$value,$FileName,$ContentType); 200 201 $FORM{$name} = $FileName; 202 $new_fname = $FileName; 203 push(@NEWFNAME_DATA,"$FileName\t$Ext\t$Length\t$ImageWidth\t$ImageHeight\t$ContentName"); 204 205 # Multi-upload correspondence 206 push(@NEWFNAMES,$new_fname); 207 open(OUT,">$img_dir/$new_fname"); 208 binmode(OUT); 209 eval "flock(OUT,2);" if($PM{'flock'} == 1); 210 print OUT $value; 211 eval "flock(OUT,8);" if($PM{'flock'} == 1); 212 close(OUT); 213 214 } elsif($name) { 215 $value =~ tr/+/ /; 216 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 217 &Encode(\$value,'trans'); 218 $FORM{$name} .= "\0" if(defined($FORM{$name})); 219 $FORM{$name} .= $value; 220 } 221 } 222 }; 223 last if($lastline =~ /^$Boundary\-\-/o); 224 } 225 } elsif($ENV{'CONTENT_LENGTH'}) { 226 read(STDIN,$Buffer,$ENV{'CONTENT_LENGTH'}); 227 } 228 foreach(split(/&/,$Buffer),split(/&/,$ENV{'QUERY_STRING'})) { 229 my($name, $value) = split(/=/); 230 $name =~ tr/+/ /; 231 $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 232 $value =~ tr/+/ /; 233 $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; 234 235 &Encode(\$name); 236 &Encode(\$value,'trans'); 237 $FORM{$name} .= "\0" if(defined($FORM{$name})); 238 $FORM{$name} .= $value; 239 240 } 241 242 } 243 244 ############################################################################## 245 # Summary 246 # 247 # CheckContentType 248 # 249 # Parameters 250 # Returns 251 # Memo 252 ############################################################################## 253 sub CheckContentType 254 { 255 256 my($DATA,$FileName,$ContentType) = @_; 257 my($Ext,$ImageWidth,$ImageHeight,$ContentName,$Infomation); 258 my $DataLength = length($$DATA); 259 260 # An unknown file type 261 262 $_ = $ContentType; 263 my $UnknownType = ( 264 !$_ 265 || /^application\/(x-)?macbinary$/i 266 || /^application\/applefile$/i 267 || /^application\/octet-stream$/i 268 || /^text\/plane$/i 269 || /^x-unknown-content-type/i 270 ); 271 272 # MacBinary(Mac Unnecessary data are deleted.) 273 if($UnknownType || $ENV{'HTTP_USER_AGENT'} =~ /Macintosh|Mac_/) { 274 if($DataLength > 128 && !unpack("C",substr($$DATA,0,1)) && !unpack("C",substr($$DATA,74,1)) && !unpack("C",substr($$DATA,82,1)) ) { 275 my $MacBinary_ForkLength = unpack("N", substr($$DATA, 83, 4)); # ForkLength Get 276 my $MacBinary_FileName = quotemeta(substr($$DATA, 2, unpack("C",substr($$DATA, 1, 1)))); 277 if($MacBinary_FileName && $MacBinary_ForkLength && $DataLength >= $MacBinary_ForkLength + 128 278 && ($FileName =~ /$MacBinary_FileName/i || substr($$DATA,102,4) eq 'mBIN')) { # DATA TOP 128byte MacBinary!! 279 $$DATA = substr($$DATA,128,$MacBinary_ForkLength); 280 my $ResourceLength = $DataLength - $MacBinary_ForkLength - 128; 281 $DataLength = $MacBinary_ForkLength; 282 } 283 } 284 } 285 286 # A file name is changed into EUC. 287 # &jcode::convert(\$FileName,'euc',$FormCodeDefault); 288 # &jcode::h2z_euc(\$FileName); 289 $FileName =~ s/^.*\\//; # Windows, Mac 290 $FileName =~ s/^.*\///; # UNIX 291 $FileName =~ s/&/&/g; 292 $FileName =~ s/"/"/g; 293 $FileName =~ s/</</g; 294 $FileName =~ s/>/>/g; 295 # 296 # if($CHARCODE ne 'euc') { 297 # &jcode::convert(\$FileName,$CHARCODE,'euc'); 298 # } 299 300 # An extension is extracted and it changes into a small letter. 301 my $FileExt; 302 if($FileName =~ /\.(\w+)$/) { 303 $FileExt = $1; 304 $FileExt =~ tr/A-Z/a-z/; 305 } 306 307 # Executable file detection (ban on upload) 308 if($$DATA =~ /^MZ/) { 309 $Ext = 'exe'; 310 } 311 # text 312 if(!$Ext && ($UnknownType || $ContentType =~ /^text\//i || $ContentType =~ /^application\/(?:rtf|richtext)$/i || $ContentType =~ /^image\/x-xbitmap$/i) 313 && ! $$DATA =~ /[\000-\006\177\377]/) { 314 # $$DATA =~ s/\x0D\x0A/\n/g; 315 # $$DATA =~ tr/\x0D\x0A/\n\n/; 316 # 317 # if( 318 # $$DATA =~ /<\s*SCRIPT(?:.|\n)*?>/i 319 # || $$DATA =~ /<\s*(?:.|\n)*?\bONLOAD\s*=(?:.|\n)*?>/i 320 # || $$DATA =~ /<\s*(?:.|\n)*?\bONCLICK\s*=(?:.|\n)*?>/i 321 # ) { 322 # $Infomation = '(JavaScript contains)'; 323 # } 324 # if($$DATA =~ /<\s*TABLE(?:.|\n)*?>/i 325 # || $$DATA =~ /<\s*BLINK(?:.|\n)*?>/i 326 # || $$DATA =~ /<\s*MARQUEE(?:.|\n)*?>/i 327 # || $$DATA =~ /<\s*OBJECT(?:.|\n)*?>/i 328 # || $$DATA =~ /<\s*EMBED(?:.|\n)*?>/i 329 # || $$DATA =~ /<\s*FRAME(?:.|\n)*?>/i 330 # || $$DATA =~ /<\s*APPLET(?:.|\n)*?>/i 331 # || $$DATA =~ /<\s*FORM(?:.|\n)*?>/i 332 # || $$DATA =~ /<\s*(?:.|\n)*?\bSRC\s*=(?:.|\n)*?>/i 333 # || $$DATA =~ /<\s*(?:.|\n)*?\bDYNSRC\s*=(?:.|\n)*?>/i 334 # ) { 335 # $Infomation = '(the HTML tag which is not safe is included)'; 336 # } 337 338 if($FileExt =~ /^txt$/i || $FileExt =~ /^cgi$/i || $FileExt =~ /^pl$/i) { # Text File 339 $Ext = 'txt'; 340 } elsif($ContentType =~ /^text\/html$/i || $FileExt =~ /html?/i || $$DATA =~ /<\s*HTML(?:.|\n)*?>/i) { # HTML File 341 $Ext = 'html'; 342 } elsif($ContentType =~ /^image\/x-xbitmap$/i || $FileExt =~ /^xbm$/i) { # XBM(x-BitMap) Image 343 my $XbmName = $1; 344 my ($XbmWidth, $XbmHeight); 345 if($$DATA =~ /\#define\s*$XbmName\_width\s*(\d+)/i) { 346 $XbmWidth = $1; 347 } 348 if($$DATA =~ /\#define\s*$XbmName\_height\s*(\d+)/i) { 349 $XbmHeight = $1; 350 } 351 if($XbmWidth && $XbmHeight) { 352 $Ext = 'xbm'; 353 $ImageWidth = $XbmWidth; 354 $ImageHeight = $XbmHeight; 355 } 356 } else { # 357 $Ext = 'txt'; 358 } 359 } 360 361 # image 362 if(!$Ext && ($UnknownType || $ContentType =~ /^image\//i)) { 363 # PNG 364 if($$DATA =~ /^\x89PNG\x0D\x0A\x1A\x0A/) { 365 if(substr($$DATA, 12, 4) eq 'IHDR') { 366 $Ext = 'png'; 367 ($ImageWidth, $ImageHeight) = unpack("N2", substr($$DATA, 16, 8)); 368 } 369 } elsif($$DATA =~ /^GIF8(?:9|7)a/) { # GIF89a(modified), GIF89a, GIF87a 370 $Ext = 'gif'; 371 ($ImageWidth, $ImageHeight) = unpack("v2", substr($$DATA, 6, 4)); 372 } elsif($$DATA =~ /^II\x2a\x00\x08\x00\x00\x00/ || $$DATA =~ /^MM\x00\x2a\x00\x00\x00\x08/) { # TIFF 373 $Ext = 'tif'; 374 } elsif($$DATA =~ /^BM/) { # BMP 375 $Ext = 'bmp'; 376 } elsif($$DATA =~ /^\xFF\xD8\xFF/ || $$DATA =~ /JFIF/) { # JPEG 377 my $HeaderPoint = index($$DATA, "\xFF\xD8\xFF", 0); 378 my $Point = $HeaderPoint + 2; 379 while($Point < $DataLength) { 380 my($Maker, $MakerType, $MakerLength) = unpack("C2n",substr($$DATA,$Point,4)); 381 if($Maker != 0xFF || $MakerType == 0xd9 || $MakerType == 0xda) { 382 last; 383 } elsif($MakerType >= 0xC0 && $MakerType <= 0xC3) { 384 $Ext = 'jpg'; 385 ($ImageHeight, $ImageWidth) = unpack("n2", substr($$DATA, $Point + 5, 4)); 386 if($HeaderPoint > 0) { 387 $$DATA = substr($$DATA, $HeaderPoint); 388 $DataLength = length($$DATA); 389 } 390 last; 391 } else { 392 $Point += $MakerLength + 2; 393 } 394 } 395 } 396 } 397 398 # audio 399 if(!$Ext && ($UnknownType || $ContentType =~ /^audio\//i)) { 400 # MIDI Audio 401 if($$DATA =~ /^MThd/) { 402 $Ext = 'mid'; 403 } elsif($$DATA =~ /^\x2esnd/) { # ULAW Audio 404 $Ext = 'au'; 405 } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { 406 my $HeaderPoint = index($$DATA, "RIFF", 0); 407 $_ = substr($$DATA, $HeaderPoint + 8, 8); 408 if(/^WAVEfmt $/) { 409 # WAVE 410 if(unpack("V",substr($$DATA, $HeaderPoint + 16, 4)) == 16) { 411 $Ext = 'wav'; 412 } else { # RIFF WAVE MP3 413 $Ext = 'mp3'; 414 } 415 } elsif(/^RMIDdata$/) { # RIFF MIDI 416 $Ext = 'rmi'; 417 } elsif(/^RMP3data$/) { # RIFF MP3 418 $Ext = 'rmp'; 419 } 420 if($ContentType =~ /^audio\//i) { 421 $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; 422 } 423 } 424 } 425 426 # a binary file 427 unless ($Ext) { 428 # PDF image 429 if($$DATA =~ /^\%PDF/) { 430 # Picture size is not measured. 431 $Ext = 'pdf'; 432 } elsif($$DATA =~ /^FWS/) { # Shockwave Flash 433 $Ext = 'swf'; 434 } elsif($$DATA =~ /^RIFF/ || $$DATA =~ /^ID3/ && $$DATA =~ /RIFF/) { 435 my $HeaderPoint = index($$DATA, "RIFF", 0); 436 $_ = substr($$DATA,$HeaderPoint + 8, 8); 437 # AVI 438 if(/^AVI LIST$/) { 439 $Ext = 'avi'; 440 } 441 if($ContentType =~ /^video\//i) { 442 $Infomation .= '(RIFF '. substr($$DATA, $HeaderPoint + 8, 4). ')'; 443 } 444 } elsif($$DATA =~ /^PK/) { # ZIP Compress File 445 $Ext = 'zip'; 446 } elsif($$DATA =~ /^MSCF/) { # CAB Compress File 447 $Ext = 'cab'; 448 } elsif($$DATA =~ /^Rar\!/) { # RAR Compress File 449 $Ext = 'rar'; 450 } elsif(substr($$DATA, 2, 5) =~ /^\-lh(\d+|d)\-$/) { # LHA Compress File 451 $Infomation .= "(lh$1)"; 452 $Ext = 'lzh'; 453 } elsif(substr($$DATA, 325, 25) eq "Apple Video Media Handler" || substr($$DATA, 325, 30) eq "Apple \x83\x72\x83\x66\x83\x49\x81\x45\x83\x81\x83\x66\x83\x42\x83\x41\x83\x6E\x83\x93\x83\x68\x83\x89") { 454 # QuickTime 455 $Ext = 'mov'; 456 } 457 } 458 459 # Header analysis failure 460 unless ($Ext) { 461 # It will be followed if it applies for the MIME type from the browser. 462 foreach (keys %UPLOAD_CONTENT_TYPE_LIST) { 463 next unless ($_); 464 if($ContentType =~ /^$_$/i) { 465 $Ext = $UPLOAD_CONTENT_TYPE_LIST{$_}; 466 $ContentName = &CheckContentExt($Ext); 467 if( 468 grep {$_ eq $Ext;} ( 469 'png', 470 'gif', 471 'jpg', 472 'xbm', 473 'tif', 474 'bmp', 475 'pdf', 476 'swf', 477 'mov', 478 'zip', 479 'cab', 480 'lzh', 481 'rar', 482 'mid', 483 'rmi', 484 'au', 485 'wav', 486 'avi', 487 'exe' 488 ) 489 ) { 490 $Infomation .= ' / Header analysis failure'; 491 } 492 if($Ext ne $FileExt && &CheckContentExt($FileExt) eq $ContentName) { 493 $Ext = $FileExt; 494 } 495 last; 496 } 497 } 498 # a MIME type is unknown--It judges from an extension. 499 unless ($Ext) { 500 $ContentName = &CheckContentExt($FileExt); 501 if($ContentName) { 502 $Ext = $FileExt; 503 $Infomation .= ' / MIME type is unknown('. $ContentType. ')'; 504 last; 505 } 506 } 507 } 508 509 # $ContentName = &CheckContentExt($Ext) unless($ContentName); 510 # if($Ext && $ContentName) { 511 # $ContentName .= $Infomation; 512 # } else { 513 # &upload_error( 514 # 'Extension Error', 515 # "$FileName A not corresponding extension ($Ext)<BR>The extension which can be responded ". join(',', sort values(%UPLOAD_EXT_LIST)) 516 # ); 517 # } 518 519 # # SSI Tag Deletion 520 # if($Ext =~ /.?html?/ && $$DATA =~ /<\!/) { 521 # foreach ( 522 # 'config', 523 # 'echo', 524 # 'exec', 525 # 'flastmod', 526 # 'fsize', 527 # 'include' 528 # ) { 529 # $$DATA =~ s/\#\s*$_/\&\#35\;$_/ig 530 # } 531 # } 532 533 return ( 534 $FileName, 535 $Ext, 536 int($DataLength / 1024 + 1), 537 $ImageWidth, 538 $ImageHeight, 539 $ContentName 540 ); 541 } 542 543 ############################################################################## 544 # Summary 545 # 546 # Extension discernment 547 # 548 # Parameters 549 # Returns 550 # Memo 551 ############################################################################## 552 553 sub CheckContentExt 554 { 555 556 my($Ext) = @_; 557 my $ContentName; 558 foreach (keys %UPLOAD_EXT_LIST) { 559 next unless ($_); 560 if($_ && $Ext =~ /^$_$/) { 561 $ContentName = $UPLOAD_EXT_LIST{$_}; 562 last; 563 } 564 } 565 return $ContentName; 566 567 } 568 569 ############################################################################## 570 # Summary 571 # 572 # Form decode 573 # 574 # Parameters 575 # Returns 576 # Memo 577 ############################################################################## 578 sub Encode 579 { 580 581 my($value,$Trans) = @_; 582 583 # my $FormCode = &jcode::getcode($value) || $FormCodeDefault; 584 # $FormCodeDefault ||= $FormCode; 585 # 586 # if($Trans && $TRANS_2BYTE_CODE) { 587 # if($FormCode ne 'euc') { 588 # &jcode::convert($value, 'euc', $FormCode); 589 # } 590 # &jcode::tr( 591 # $value, 592 # "\xA3\xB0-\xA3\xB9\xA3\xC1-\xA3\xDA\xA3\xE1-\xA3\xFA", 593 # '0-9A-Za-z' 594 # ); 595 # if($CHARCODE ne 'euc') { 596 # &jcode::convert($value,$CHARCODE,'euc'); 597 # } 598 # } else { 599 # if($CHARCODE ne $FormCode) { 600 # &jcode::convert($value,$CHARCODE,$FormCode); 601 # } 602 # } 603 # if($CHARCODE eq 'euc') { 604 # &jcode::h2z_euc($value); 605 # } elsif($CHARCODE eq 'sjis') { 606 # &jcode::h2z_sjis($value); 607 # } 608 609 } 610 611 ############################################################################## 612 # Summary 613 # 614 # Error Msg 615 # 616 # Parameters 617 # Returns 618 # Memo 619 ############################################################################## 620 621 sub upload_error 622 { 623 624 local($error_message) = $_[0]; 625 local($error_message2) = $_[1]; 626 627 print "Content-type: text/html\n\n"; 628 print<<EOF; 629 <HTML> 630 <HEAD> 631 <TITLE>Error Message</TITLE></HEAD> 632 <BODY> 633 <table border="1" cellspacing="10" cellpadding="10"> 634 <TR bgcolor="#0000B0"> 635 <TD bgcolor="#0000B0" NOWRAP><font size="-1" color="white"><B>Error Message</B></font></TD> 636 </TR> 637 </table> 638 <UL> 639 <H4> $error_message </H4> 640 $error_message2 <BR> 641 </UL> 642 </BODY> 643 </HTML> 644 EOF 645 &rm_tmp_uploaded_files; # Image Temporary deletion 646 exit; 647 } 648 649 ############################################################################## 650 # Summary 651 # 652 # Image Temporary deletion 653 # 654 # Parameters 655 # Returns 656 # Memo 657 ############################################################################## 658 659 sub rm_tmp_uploaded_files 660 { 661 if($img_data_exists == 1){ 662 sleep 1; 663 foreach $fname_list(@NEWFNAMES) { 664 if(-e "$img_dir/$fname_list") { 665 unlink("$img_dir/$fname_list"); 666 } 667 } 668 } 669 670 } 671 1;
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 15:28:05 2007 | par Balluche grâce à PHPXref 0.7 |