4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Ersen on December 18, 2012, 12:41:15 PM

Title: check new images error on line 390
Post by: Ersen on December 18, 2012, 12:41:15 PM
when i checked new images i will see this error

Fatal error: Call to undefined function filterFileName() in /home/ddd/public_html/admin/checkimages.php on line 390

how can i fix this?
Title: Re: check new images error on line 390
Post by: Rembrandt on December 18, 2012, 06:56:34 PM
Hi!

your includes/functions.php is to old.
search in includes/functions.php "?>" and insert above:

function filterFileName($text, $tolower = 1, $transl = null)
{
global $translit;
$transl = ($transl !== null) ? $transl : @$translit;
if ($transl)
$text = strtr(
$text,
array(
// russian Windows-1251
"\xc0" => "a",
"\xc1" => "b",
"\xc2" => "v",
"\xc3" => "g",
"\xc4" => "d",
"\xc5" => "e",
"\xa8" => "e",
"\xc6" => "zh",
"\xc7" => "z",
"\xc8" => "i",
"\xc9" => "j",
"\xca" => "k",
"\xcb" => "l",
"\xcc" => "m",
"\xcd" => "n",
"\xce" => "o",
"\xcf" => "p",
"\xd0" => "r",
"\xd1" => "s",
"\xd2" => "t",
"\xd3" => "u",
"\xd4" => "f",
"\xd5" => "h",
"\xd6" => "c",
"\xd7" => "ch",
"\xd8" => "sh",
"\xd9" => "sch",
"\xda" => "",
"\xdb" => "i",
"\xdc" => "",
"\xdd" => "e",
"\xde" => "yu",
"\xdf" => "ya",
"\xe0" => "a",
"\xe1" => "b",
"\xe2" => "v",
"\xe3" => "g",
"\xe4" => "d",
"\xe5" => "e",
"\xb8" => "e",
"\xe6" => "zh",
"\xe7" => "z",
"\xe8" => "i",
"\xe9" => "j",
"\xea" => "k",
"\xeb" => "l",
"\xec" => "m",
"\xed" => "n",
"\xee" => "o",
"\xef" => "p",
"\xf0" => "r",
"\xf1" => "s",
"\xf2" => "t",
"\xf3" => "u",
"\xf4" => "f",
"\xf5" => "h",
"\xf6" => "c",
"\xf7" => "ch",
"\xf8" => "sh",
"\xf9" => "sch",
"\xfa" => "",
"\xfb" => "i",
"\xfc" => "",
"\xfd" => "e",
"\xfe" => "yu",
"\xff" => "ya",
// russian KOI8
/*
"\xe1" => "a",
"\xe2" => "b",
"\xf7" => "v",
"\xe7" => "g",
"\xe4" => "d",
"\xe5" => "e",
"\xb3" => "e",
"\xf6" => "zh",
"\xfa" => "z",
"\xe9" => "i",
"\xea" => "j",
"\xeb" => "k",
"\xec" => "l",
"\xed" => "m",
"\xee" => "n",
"\xef" => "o",
"\xf0" => "p",
"\xf2" => "r",
"\xf3" => "s",
"\xf4" => "t",
"\xf5" => "u",
"\xe6" => "f",
"\xe8" => "h",
"\xe3" => "c",
"\xfe" => "ch",
"\xfb" => "sh",
"\xfd" => "sch",
"\xff" => "",
"\xf9" => "i",
"\xf8" => "",
"\xfc" => "e",
"\xe0" => "yu",
"\xf1" => "ya",
"\xc1" => "a",
"\xc2" => "b",
"\xd7" => "v",
"\xc7" => "g",
"\xc4" => "d",
"\xc5" => "e",
"\xa3" => "e",
"\xd6" => "zh",
"\xda" => "z",
"\xc9" => "i",
"\xca" => "j",
"\xcb" => "k",
"\xcc" => "l",
"\xcd" => "m",
"\xce" => "n",
"\xcf" => "o",
"\xd0" => "p",
"\xd2" => "r",
"\xd3" => "s",
"\xd4" => "t",
"\xd5" => "u",
"\xc6" => "f",
"\xc8" => "h",
"\xc3" => "c",
"\xde" => "ch",
"\xdb" => "sh",
"\xdd" => "sch",
"\xdf" => "",
"\xd9" => "i",
"\xd8" => "",
"\xdc" => "e",
"\xc0" => "yu",
"\xd1" => "ya",
*/
));

if ($tolower)
  $text = strtolower($text);

$text = str_replace(" ", "_", $text);
$text = str_replace("%20", "_", $text);
$text = preg_replace("/[^\-\._a-z0-9]/i", "_", $text);
return $text;
}

function create_unique_filename($base, $file)
{
  $ext = get_file_extension($file);
  $name = get_file_name($file);
  $n = 2;
  $copy = "";
  while (file_exists($base."/".$name.$copy.".".$ext)) {
    $copy = "_".$n;
    $n++;
  }
  return $name.$copy.".".$ext;
}


mfg Andi