<?PHP
/************************************************************************/
/* Upload / meta fonction and automation for NPDS .                     */
/* This version name NPDS Copyright (c) 2001-2005 by Philippe Brunier   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Configuration de l upload pour les forums                            */
/* D apres les sources du forum w-agora de Marc Druilhe                 */
/************************************************************************/

// display mode if displayed inline
define   ('ATT_DSP_LINK', '1');        // displays as link (icon)
define   ('ATT_DSP_IMG', '2');         // display inline as a picture, using <img> tag.
define   ('ATT_DSP_HTML', '3');        // display inline as HTML, e.g. banned tags are stripped.
define   ('ATT_DSP_PLAINTEXT', '4');   // display inline as text, using <pre> tag.
define   ('ATT_DSP_SWF', '5');         // Embedded Macromedia Shockwave Flash

$mimetypes = array (
  'avi' => 'video/x-msvideo',
  'bat' => 'text/plain',
  'bak' => 'text/plain',
  'bmp' => 'image/bmp',
  'doc' => 'application/msword',
  'gif' => 'image/gif',
  'gz' => 'application/x-gzip',
  'htm' => 'text/html',
  'html' => 'text/html',
  'jpe' => 'image/jpeg',
  'jpg' => 'image/jpeg',
  'jpeg' => 'image/jpeg',
  'mov' => 'video/quicktime',
  'mpe' => 'video/mpeg',
  'mpeg' => 'video/mpeg',
  'mpg' => 'video/mpeg',
  'mpga' => 'audio/mpeg',
  'mp2' => 'audio/mpeg',
  'mp3' => 'audio/mpeg',
  'pdf' => 'application/pdf',
  'png' => 'image/png',
  'ppt' => 'application/vnd.ms-powerpoint',
  'qt' => 'video/quicktime',
  'rtf' => 'text/rtf',
  'swf' => 'application/x-shockwave-flash',
  'tar' => 'application/x-tar',
  'tgz' => 'application/x-gzip',
  'tif' => 'image/tiff',
  'tiff' => 'image/tiff',
  'txt' => 'text/plain',
  'xls' => 'application/vnd.ms-excel',
  'xml' => 'text/xml',
  'zip' => 'application/zip'
);

// mime type to be used if no other type known
// Do not modify without need!
$mimetype_default = 'application/octet-stream';
$mime_dspinl[$mimetype_default] = 'O';
$mime_dspfmt[$mimetype_default] = ATT_DSP_LINK;


// display mode if displayed inline
$mime_dspfmt['image/gif'] = ATT_DSP_IMG;
$mime_dspfmt['image/bmp'] = ATT_DSP_LINK;
$mime_dspfmt['image/png'] = ATT_DSP_IMG;
$mime_dspfmt['image/x-png'] = ATT_DSP_IMG;
$mime_dspfmt['image/jpeg'] = ATT_DSP_IMG;
$mime_dspfmt['image/pjpeg'] = ATT_DSP_IMG;
$mime_dspfmt['text/html'] = ATT_DSP_HTML;
$mime_dspfmt['text/plain'] = ATT_DSP_PLAINTEXT;
$mime_dspfmt['application/x-shockwave-flash'] = ATT_DSP_SWF;

// attachement
$mime_renderers[ATT_DSP_PLAINTEXT] = "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td bgcolor=\"#000000\"><table border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\"><tr><td align=\"center\" bgcolor=\"#cccccc\">\$att_name\$visible_wrn</td></tr><tr><td bgcolor=\"#ffffff\"><pre>\$att_contents</pre></td></tr></table></td></tr></table>";
$mime_renderers[ATT_DSP_HTML]      = "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td bgcolor=\"#000000\"><table border=\"0\" cellpadding=\"5\" cellspacing=\"1\" width=\"100%\"><tr><td align=\"center\" bgcolor=\"#cccccc\">\$att_name\$visible_wrn</td></tr><tr><td bgcolor=\"#ffffff\">\$att_contents</td></tr></table></td></tr></table>";
$mime_renderers[ATT_DSP_LINK]      = "<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td align=\"center\"><a href=\"\$att_url\" target=\"_blank\"><acronym title=\"".upload_translate("Télécharg.")." \$att_name (\$att_type - \$att_size)\"><span style=\"font-size: 10px;\">\$att_icon<br /><b>\$att_name</b></span></acronym></a><br /><span style=\"font-size: 10px;\">\$att_size</span></td></tr><tr><td align=\"center\" nowrap=\"nowrap\"><span style=\"font-size: 10px;\">\$compteur ".upload_translate("Télécharg.")."</span></td></tr><tr><td align=\"center\">\$visible_wrn</td></tr></table>";
$mime_renderers[ATT_DSP_IMG] = "<p align=\"center\"><img src=\"\$att_url\" alt=\"\$att_name\" border=\"0\" \$img_size />\$visible_wrn</p>";
$mime_renderers[ATT_DSP_SWF] = "<p align=\"center\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4\,0\,2\,0\" \$img_size><param name=\"quality\" value=\"high\"><param name=\"SRC\" value=\"\$att_url\"><embed src=\"\$att_url\" quality=\"high\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" \$img_size></embed></object></p>\$visible_wrn";

// Images
if ($ibid=theme_image("upload/file_types/zip.gif")) {$imgGZ=$ibid;} else {$imgGZ="images/upload/file_types/zip.gif";}
if ($ibid=theme_image("upload/file_types/word.gif")) {$imgWO=$ibid;} else {$imgWO="images/upload/file_types/word.gif";}
if ($ibid=theme_image("upload/file_types/htm.gif")) {$imgHT=$ibid;} else {$imgHT="images/upload/file_types/htm.gif";}
if ($ibid=theme_image("upload/file_types/pdf.gif")) {$imgPD=$ibid;} else {$imgPD="images/upload/file_types/pdf.gif";}
if ($ibid=theme_image("upload/file_types/txt.gif")) {$imgTX=$ibid;} else {$imgTX="images/upload/file_types/txt.gif";}
if ($ibid=theme_image("upload/file_types/excel.gif")) {$imgEX=$ibid;} else {$imgEX="images/upload/file_types/excel.gif";}
if ($ibid=theme_image("upload/file_types/flash.gif")) {$imgFL=$ibid;} else {$imgFL="images/upload/file_types/flash.gif";}
if ($ibid=theme_image("upload/file_types/image.gif")) {$imgIM=$ibid;} else {$imgIM="images/upload/file_types/image.gif";}
if ($ibid=theme_image("upload/file_types/exe.gif")) {$imgEE=$ibid;} else {$imgEE="images/upload/file_types/exe.gif";}
if ($ibid=theme_image("upload/file_types/ppt.gif")) {$imgPP=$ibid;} else {$imgPP="images/upload/file_types/ppt.gif";}
$att_icons = array (
   'gz' => '<img src="'.$imgGZ.'" border="0" align="middle" alt="">',
   'zip' => '<img src="'.$imgGZ.'" border="0" align="middle" alt="">',
   'doc' => '<img src="'.$imgWO.'" border="0" align="middle" alt="">',
   'html' => '<img src="'.$imgHT.'" border="0" align="middle" alt="">',
   'htm' => '<img src="'.$imgHT.'" border="0" align="middle" alt="">',
   'pdf' => '<img src="'.$imgPD.'" border="0" align="middle" alt="">',
   'txt' => '<img src="'.$imgTX.'" border="0" align="middle" alt="">',
   'xls' => '<img src="'.$imgEX.'" border="0" align="middle" alt="">',
   'swf' => '<img src="'.$imgFL.'" border="0" align="middle" alt="">',
   'jpg' => '<img src="'.$imgIM.'" border="0" align="middle" alt="">',
   'jpeg' => '<img src="'.$imgIM.'" border="0" align="middle" alt="">',
   'gif' => '<img src="'.$imgIM.'" border="0" align="middle" alt="">',
   'png' => '<img src="'.$imgIM.'" border="0" align="middle" alt="">',
   'exe' => '<img src="'.$imgEE.'" border="0" align="middle" alt="">',
   'ppt' => '<img src="'.$imgPP.'" border="0" align="middle" alt="">'
);
if ($ibid=theme_image("upload/file_types/unknown.gif")) {$att_icon_default=$ibid;} else {$att_icon_default="images/upload/file_types/unknown.gif";}
$att_icon_default="<img src=\"".$att_icon_default."\" border=\"0\" align=\"middle\" alt=\"\" />";
if ($ibid=theme_image("upload/file_types/multiple.gif")) {$att_icon_multiple=$ibid;} else {$att_icon_multiple="images/upload/file_types/multiple.gif";}
$att_icon_multiple="<img src=\"".$att_icon_multiple."\" border=\"0\" align=\"middle\" alt=\"\" />";
?>