News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1266769803:v:use_geshi-1:v:type-php

Started by SleePy, Feb 21, 2010, 04:30 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

SleePy

   function getLegacyAttachmentFilenameNew($filename, $attachment_id)
   {
      // Remove special accented characters - ie. sÃŒ (because they won't write to the filesystem well.)
      $clean_name = strtr($filename, array(chr(138) => 'S', chr(142) => 'Z', chr(154) => 's', chr(158) => 'z', chr(159) => 'Y', chr(192) => 'A', chr(193) => 'A', chr(194) => 'A', chr(195) => 'A', chr(196) => 'A', chr(197) => 'A', chr(199) => 'C', chr(200) => 'E', chr(201) => 'E', chr(202) => 'E', chr(203) => 'E', chr(204) => 'I', chr(205) => 'I', chr(206) => 'I', chr(207) => 'I', chr(209) => 'N', chr(210) => 'O', chr(211) => 'O', chr(212) => 'O', chr(213) => 'O', chr(214) => 'O', chr(216) => 'O', chr(217) => 'U', chr(218) => 'U', chr(219) => 'U', chr(220) => 'U', chr(221) => 'Y', chr(224) => 'a', chr(225) => 'a', chr(226) => 'a', chr(227) => 'a', chr(228) => 'a', chr(229) => 'a', chr(231) => 'c', chr(232) => 'e', chr(233) => 'e', chr(234) => 'e', chr(235) => 'e', chr(236) => 'i', chr(237) => 'i', chr(238) => 'i', chr(239) => 'i', chr(241) => 'n', chr(242) => 'o', chr(243) => 'o', chr(244) => 'o', chr(245) => 'o', chr(246) => 'o', chr(248) => 'o', chr(249) => 'u', chr(250) => 'u', chr(251) => 'u', chr(252) => 'u', chr(253) => 'y', chr(255) => 'y'));
      $clean_name = strtr($clean_name, array(chr(222) => 'TH', chr(254) => 'th', chr(208) => 'DH', chr(240) => 'dh', chr(223) => 'ss', chr(140) => 'OE', chr(156) => 'oe', chr(198) => 'AE', chr(230) => 'ae', chr(181) => 'u'));

      // Get rid of dots, spaces, and other weird characters.
      $clean_name = preg_replace(array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $clean_name);

      return $attachment_id . '_' . strtr($clean_name, '.', '_') . md5($clean_name);
   }
No siggy! :D

SleePy

   function getLegacyAttachmentFilename($filename, $attachment_id)
   {
      // Remove special accented characters - ie. sÃŒ (because they won't write to the filesystem well.)
      $clean_name = strtr($filename, 'äéöûü¿¡¬√Æ'≈«»… ÀÃÕÅ'Å"â€"“”‘’÷ÿŸâ,,â,¬â€¹â€ºâ€¡Â·â€šâ€žâ€°Ã,ÁËÈÍÎÏÌÃ"Ã"Ã'ÚÛÙıˆ¯˘˙˚¸˝ˇ', 'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy');
      $clean_name = strtr($clean_name, array('fi' => 'TH', 'Ë›' => 'th', 'â€"' => 'DH', '' => 'dh', 'ï¬,' => 'ss', 'Ã¥' => 'OE', 'ú' => 'oe', '∆' => 'AE', 'Ê' => 'ae', 'µ' => 'u'));

      // Get rid of dots, spaces, and other weird characters.
      $clean_name = preg_replace(array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $clean_name);

      return $attachment_id . '_' . strtr($clean_name, '.', '_') . md5($clean_name);
   }

   function getLegacyAttachmentFilenameNew($filename, $attachment_id)
   {
      // Remove special accented characters - ie. sÃŒ (because they won't write to the filesystem well.)
      $clean_name = strtr($filename, array(chr(138) => 'S', chr(142) => 'Z', chr(154) => 's', chr(158) => 'z', chr(159) => 'Y', chr(192) => 'A', chr(193) => 'A', chr(194) => 'A', chr(195) => 'A', chr(196) => 'A', chr(197) => 'A', chr(199) => 'C', chr(200) => 'E', chr(201) => 'E', chr(202) => 'E', chr(203) => 'E', chr(204) => 'I', chr(205) => 'I', chr(206) => 'I', chr(207) => 'I', chr(209) => 'N', chr(210) => 'O', chr(211) => 'O', chr(212) => 'O', chr(213) => 'O', chr(214) => 'O', chr(216) => 'O', chr(217) => 'U', chr(218) => 'U', chr(219) => 'U', chr(220) => 'U', chr(221) => 'Y', chr(224) => 'a', chr(225) => 'a', chr(226) => 'a', chr(227) => 'a', chr(228) => 'a', chr(229) => 'a', chr(231) => 'c', chr(232) => 'e', chr(233) => 'e', chr(234) => 'e', chr(235) => 'e', chr(236) => 'i', chr(237) => 'i', chr(238) => 'i', chr(239) => 'i', chr(241) => 'n', chr(242) => 'o', chr(243) => 'o', chr(244) => 'o', chr(245) => 'o', chr(246) => 'o', chr(248) => 'o', chr(249) => 'u', chr(250) => 'u', chr(251) => 'u', chr(252) => 'u', chr(253) => 'y', chr(255) => 'y'));
      $clean_name = strtr($clean_name, array(chr(222) => 'TH', chr(254) => 'th', chr(208) => 'DH', chr(240) => 'dh', chr(223) => 'ss', chr(140) => 'OE', chr(156) => 'oe', chr(198) => 'AE', chr(230) => 'ae', chr(181) => 'u'));

      // Get rid of dots, spaces, and other weird characters.
      $clean_name = preg_replace(array('/\s/', '/[^\w_\.\-]/'), array('_', ''), $clean_name);

      return $attachment_id . '_' . strtr($clean_name, '.', '_') . md5($clean_name);
   }
No siggy! :D