#server
//$keputvonal="http://www.i-com.hu/katkepek/";
$keputvonal="http://www.i-com.hu/kszfkatkepek/";
$fontutvonal="/DATA/i-com.hu/kszf-katalogus/arial.ttf";
#localhost
//$keputvonal="http://localhost.icom/kszfkatkepek/";
//$fontutvonal="arial.ttf";
?>
function advancedRmdir($path) { //mappát töröl akkor is, ha nem üres
$origipath = $path;
$handler = opendir($path);
while (true) {
$item = readdir($handler);
if ($item == "." or $item == "..") {
continue;
} elseif (gettype($item) == "boolean") {
closedir($handler);
if (!@rmdir($path)) {
return false;
}
if ($path == $origipath) {
break;
}
$path = substr($path, 0, strrpos($path, "/"));
$handler = opendir($path);
} elseif (is_dir($path."/".$item)) {
closedir($handler);
$path = $path."/".$item;
$handler = opendir($path);
} else {
unlink($path."/".$item);
}
}
return true;
}
function parse_tpl($tpl_file, $vars=array()){
$tpl = implode("", file($tpl_file.".tpl"));
foreach($vars as $variable => $value){
$tpl = str_replace("{".$variable."}",$value,$tpl);
}
//ie miatt
$tpl = preg_replace("/(\
]*\>)\<\/td\>/i","\\1 | ",$tpl);
return preg_replace("/{[0-9a-z_]*}/i","",$tpl);
}
function RandomString ($max) {
$string = "";
$CharacterMap = array("A", "a", "B", "b", "C", "c", "D", "d", "E", "e", "F", "f",
"G", "g", "H", "h", "I", "i", "J", "j", "K", "k", "L", "l",
"M", "m", "N", "n", "O", "o", "P", "p", "Q", "q", "R", "r",
"S", "s", "T", "t", "U", "u", "V", "v", "W", "w", "X", "x",
"Y", "y", "Z", "z", "0", "1", "2", "3", "4", "5", "6", "7",
"8", "9");
for ($i = 0; $i < $max; $i++) {
$string .= $CharacterMap[array_rand($CharacterMap, 1)];
}
return $string;
}
function checkupload($kep)
{
$max = 2097152;
if($kep['size'] > $max)
{
return "Túl nagy a fájl. A maximális méret: ".$max/1024 ."KB";
break;
}
else
{
return "rendben";
}
}
function checkimage($kep)
{
$max = 4194304;
$formats = array("image/jpg","image/jpeg","image/pjpeg","image/gif","image/png");
foreach ($formats as $format)
{
if ($format == $kep['type'])
{
$helyes = true;
break;
}
}
//echo ($kep['type']);
if($kep['size'] > $max)//250KB)
{
return "Túl nagy a kép. A maximális méret: ".$max/1024 ."KB";
break;
}
elseif($helyes != true)
{
return "Hibás képformátum";
break;
}
else
{
return "rendben";
}
} //checkimage function end
function makeimage($filename, $newfilename, $path, $newwidth, $newheight,$w,$h) {
global $szel,$mag;
//SEARCHES IMAGE NAME STRING TO SELECT EXTENSION (EVERYTHING AFTER . )
$image_type = strstr($filename, '.');
//echo $image_type;
$image_type=strtolower($image_type);
//SWITCHES THE IMAGE CREATE FUNCTION BASED ON FILE EXTENSION
switch($image_type) {
case '.jpg':
$sourcepath=$path.$filename;
$source = imagecreatefromjpeg($sourcepath);
$file = $newfilename;
$fullpath = $path . $file;
$thumb = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $w, $h);
imagejpeg($thumb, $fullpath,90);
$filepath = $fullpath;
break;
case '.png':
$source = imagecreatefrompng($filename);
$file = $newfilename;
$fullpath = $path . $file;
list($width, $height) = getimagesize($filename);
$thumb = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $w,$h);
imagepng($thumb, $fullpath, 100);
$filepath = $fullpath;
break;
case '.gif':
$source = imagecreatefromgif($filename);
$file = $newfilename;
$fullpath = $path . $file;
list($width, $height) = getimagesize($filename);
$thumb = imagecreatetruecolor($newwidth, $newheight);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagegif($thumb, $fullpath, 100);
$filepath = $fullpath;
break;
default:
echo("Error Invalid Image Type");
die;
break;
}
return $filepath;
} //makeimage function end
function ekezetcsere($szoveg)
{
/*
$ekezetek = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Á","É","Í","Ó","Ö","Ő","Ú","Ü","Ű", "á", "é", "í", "ó", "ö", "ő", "ú", "ü", "ű");
$mask = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","a","e","i","o","o","o","u","u","u", "a", "e", "i", "o", "o", "o", "u", "u", "u" );
$csereszoveg = str_replace( $ekezetek, $mask, $szoveg);
$csereszoveg = eregi_replace ("([^a-zA-Z0-9.]|[[:space:]])+","-", $csereszoveg);
*/
$ekezetek = array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Á","É","Í","Ó","Ö","Ő","Ú","Ü","Ű", "á", "é", "í", "ó", "ö", "ő", "ú", "ü", "ű","!",".","?","+");
$mask = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","a","e","i","o","o","o","u","u","u", "a", "e", "i", "o", "o", "o", "u", "u", "u","!","","","+");
$csereszoveg = str_replace( $ekezetek, $mask, $szoveg);
$csereszoveg = eregi_replace ("([^a-zA-Z0-9\.\?+!.]|[[:space:]])+","-", $csereszoveg);
return $csereszoveg;
}
function displayParent($id)
{/*displayParent lekérdezi egy gyerek szüleit a gyökérelemig*/
global $parentid;
$query="SELECT tcsid,szuloid FROM termekcsoport1 WHERE tcsid=".$id;
//echo $query."