ACC SHELL

Path : /srv/www/vhosts/lps/modules/rada/
File Upload :
Current File : /srv/www/vhosts/lps/modules/rada/modul.php.bak

<?
class CModul_Rada{
	function CModul_Rada($pripojeni){
		$this->pripojeni = $pripojeni;
		$this->conf_id='modul_rada';
	}
	function create_modul($id_bloku){

		$this->pripojeni->dotaz("INSERT INTO ".$GLOBALS['config_db_prefix']."elementy (id_bloku, poradi, modul) SELECT '".$id_bloku."', max(poradi)+1, '".$this->conf_id."' FROM ".$GLOBALS['config_db_prefix']."elementy WHERE id_bloku='".$id_bloku."'");

//		$vlozene_id = mysql_insert_id($this->pripojeni->conn);
		
//		$this->pripojeni->dotaz("INSERT INTO ".$GLOBALS['config_db_prefix']."modul_texty (id_elementu, text) VALUES ('".$vlozene_id."', '')");
	
	
	}


	function show_element_preview($id_elementu){
		$dbdata = $this->pripojeni->dotaz("SELECT * FROM  ".$GLOBALS['config_db_prefix']."modul_komise WHERE id_elementu='".$id_elementu."' LIMIT 3");
		while($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
			echo"<div class='osoba'>";
				echo"<h3>".$data->titul." ".$data->jmeno." ".$data->prijmeni." ".$data->titul_za."</h3>";
				echo"<div class='anotace'>".$data->funkce." ".($data->zarizeni?" (".$data->zarizeni.")":"")."</div>";
			echo"</div>";
		
		}
			echo"<div class='modul-opearace'>";
			echo"<a href='./admin.php?lang=".$this->lang."&amp;sekce=obsah&amp;id=".$_REQUEST['id']."&amp;operace=edit-element&amp;id_bloku=".$polozka_menu->id."&amp;id_elementu=".$id_elementu."'>upravit</a>";
			echo" | ";						
			echo"<a href='./admin.php?lang=".$this->lang."&amp;sekce=obsah&amp;id=".$_REQUEST['id']."&amp;operace=delete-element&amp;id_bloku=".$polozka_menu->id."&amp;id_elementu=".$id_elementu."' onclick='return confirm(Opravdu odstranit modul?)'>odstranit modul</a>";
			echo"</div>\n\n";						
	
	}

	function show_element_view($id_elementu){
		$dbdata = $this->pripojeni->dotaz("SELECT * FROM  ".$GLOBALS['config_db_prefix']."modul_komise WHERE id_elementu='".$id_elementu."' ");
		while($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
			echo"<div class='osoba'>";
				echo"<h3>".$data->titul." ".$data->jmeno." ".$data->prijmeni." ".$data->titul_za."</h3>";
				echo"<div class='funkce'>".$data->funkce."</div>";
				echo $data->zarizeni ? "<div class='zarizeni'>".$data->zarizeni."</div>" :"";
				echo $data->adresa ? "<div class='adresa'>".$data->adresa."</div>" :"";
				echo $data->telefon ? "<div class='telefon'>".$data->telefon."</div>" :"";
				echo $data->email ? "<div class='email'><a href='mailto:".$data->email."'>".$data->email."</a>"."</div>" :"";
			echo"</div>";
		
		}
	
	}





	function admin_edituj()
	{
		if($_REQUEST['editace']=='pripojene-obrazky'){
			$this->attached_images_edit();		 
		}
		else{
		 	$this->articles_edit();
		 
		}
	}
	                                
	function show_admin_form($id_elementu)
	{
		 $admin_url.="admin.php";
		 $admin_url.="?web_id=".$_REQUEST['web_id'];
		 $admin_url.="&amp;lang=".$_REQUEST['lang'];
		 $admin_url.="&amp;sekce=".$_REQUEST['sekce'];
		 $admin_url.="&amp;operace=".$_REQUEST['operace'];
		 $admin_url.="&amp;id=".$_REQUEST['id'];
		 $admin_url.="&amp;id_bloku=".$_REQUEST['id_bloku'];
		 $admin_url.="&amp;id_elementu=".$_REQUEST['id_elementu'];
		
		if($_REQUEST['editace']=='pripojene-obrazky'){
			$this->attached_images_form();		
		}
		else{
			$this->articles_form();		
		}
	}	
	function articles_edit()
	{
		if ($_FILES['ikona']['tmp_name']){
			$nazev_obrazku = time()."_".$this->seo_gen($_FILES['ikona']['name'], "files");
			$this->do_thumbnail('ikona', "../../images/obr/", "../../images/tn/", $nazev_obrazku, 100);
		}
		
		
		if ($_REQUEST['id']){
			$this->pripojeni->dotaz("UPDATE ".$GLOBALS['config_db_prefix']."modul_rada SET hidden='".($_REQUEST['hidden']+0)."', jmeno='".$_REQUEST['jmeno']."', prijmeni='".$_REQUEST['prijmeni']."', titul='".$_REQUEST['titul']."', titul_za='".$_REQUEST['titul_za']."', funkce='".$_REQUEST['funkce']."', zarizeni='".$_REQUEST['zarizeni']."', adresa='".$_REQUEST['adresa']."', email='".$_REQUEST['email']."', telefon='".$_REQUEST['telefon']."' , poradi='".($_REQUEST['poradi']+0)."' ".($nazev_obrazku?", ikona='".$nazev_obrazku."'":"")." WHERE id='".$_REQUEST['id']."'");
		}
		else{
			$this->pripojeni->dotaz("INSERT INTO ".$GLOBALS['config_db_prefix']."modul_rada (id_elementu, hidden, jmeno, prijmeni, titul, titul_za, funkce, zarizeni, adresa, email, telefon, poradi, ikona) VALUES ('".(0+$_REQUEST['id_elementu'])."', '".($_REQUEST['hidden']+0)."', '".$_REQUEST['jmeno']."', '".$_REQUEST['prijmeni']."',  '".$_REQUEST['titul']."', '".$_REQUEST['titul_za']."', '".$_REQUEST['funkce']."', '".$_REQUEST['zarizeni']."', '".$_REQUEST['adresa']."', '".$_REQUEST['email']."', '".$_REQUEST['telefon']."', '".($_REQUEST['poradi']+0)."', '".$nazev_obrazku."')");
		}
		
	}
	function articles_delete($id)
	{
		if ($id){
//			$this->pripojeni->dotaz("DELETE FROM ".$GLOBALS['config_db_prefix']."modul_clanky WHERE id='".(0+$id)."'");
			$this->pripojeni->dotaz("UPDATE ".$GLOBALS['config_db_prefix']."modul_rada SET deleted='1' WHERE id='".(0+$id)."'");
		}		
	}
	function articles_form()
	{

		 $admin_url.="admin.php";
		 $admin_url.="?web_id=".$_REQUEST['web_id'];
		 $admin_url.="&amp;lang=".$_REQUEST['lang'];
		 $admin_url.="&amp;sekce=".$_REQUEST['sekce'];
		 $admin_url.="&amp;operace=".$_REQUEST['operace'];
		 $admin_url.="&amp;id=".$_REQUEST['id'];
		 $admin_url.="&amp;id_bloku=".$_REQUEST['id_bloku'];
		 $admin_url.="&amp;id_elementu=".$_REQUEST['id_elementu'];


		if ($_REQUEST['delete']){
			$this->articles_delete($_REQUEST['delete']);
		}
		if ($_REQUEST['oprava']){
			$db_opravna_polozka  = $this->pripojeni->dotaz("SELECT * FROM  ".$GLOBALS['config_db_prefix']."modul_rada WHERE id='".$_REQUEST['oprava']."' LIMIT 1");
			if ($db_opravna_polozka && $opravna_polozka = $this->pripojeni->objekt_dotazu($db_opravna_polozka)){
			}
		}

		echo"<form action='./functions/function.php' method='post' enctype='multipart/form-data'>\n";
			echo"<input type='hidden' name='web_id' value='".$this->web_id."'/>\n";
			echo"<input type='hidden' name='lang' value='".$this->lang."'/>\n";
			echo"<input type='hidden' name='sekce' value='".$this->sekce."'/>\n";
			echo"<input type='hidden' name='id_menu' value='".$_REQUEST['id_menu']."'/>\n";


			echo"<input type='hidden' name='web_id' value='".$_REQUEST['web_id']."'/>\n";
			echo"<input type='hidden' name='lang' value='".$_REQUEST['lang']."'/>\n";
			echo"<input type='hidden' name='sekce' value='".$_REQUEST['sekce']."'/>\n";
			echo"<input type='hidden' name='id_bloku' value='".$_REQUEST['id_bloku']."'/>\n";
			echo"<input type='hidden' name='id_elementu' value='".$_REQUEST['id_elementu']."'/>\n";
			echo"<input type='hidden' name='id' value='".$_REQUEST['id']."'/>\n";



			echo"<input type='hidden' name='id' value='".$opravna_polozka->id."'/>\n";

			echo"<table class='formularovka'>";
				echo"<tr><td>Jméno</td><td><input type='text' name='jmeno' value='".$opravna_polozka->jmeno."'/></td></tr>\n";
				echo"<tr><td>Příjmení</td><td><input type='text' name='prijmeni' value='".$opravna_polozka->prijmeni."'/></td></tr>\n";
				echo"<tr><td>Titul</td><td><input type='text' name='titul' value='".$opravna_polozka->titul."'/></td></tr>\n";
				echo"<tr><td>Titul za jm.</td><td><input type='text' name='titul_za' value='".$opravna_polozka->titul_za."'/></td></tr>\n";
				echo"<tr><td>Pozice</td><td><input type='text' name='funkce' value='".$opravna_polozka->funkce."'/></td></tr>\n";
				echo"<tr><td>Zařízeni</td><td><input type='text' name='zarizeni' value='".$opravna_polozka->zarizeni."'/></td></tr>\n";
				
				echo"<tr><td>Adresa</td><td><textarea name='adresa' >".$opravna_polozka->adresa."</textarea></td></tr>\n";
				echo"<tr><td>Telefon</td><td><input type='text' name='telefon' value='".$opravna_polozka->telefon."'/></td></tr>\n";
				echo"<tr><td>Email</td><td><input type='text' name='email' value='".$opravna_polozka->email."'/></td></tr>\n";
				
				echo"<tr><td>Pořadí</td><td><input type='text' name='poradi' value='".$opravna_polozka->poradi."'/></td></tr>\n";
				
				//echo"<tr><td>Ikona</td><td><input type='file' name='ikona' /><br/>".($opravna_polozka->ikona?"<img src='../images/tn/".$opravna_polozka->ikona."' alt=''/>":"")."</td></tr>\n";
				
				echo"<tr><td></td><td><input type='submit' name='edit_obsah_elementu' value='Odeslat' class='submitter'/></td></tr>\n";


			echo"</table>";



		echo"</form>\n\n";


		$dbdata = $this->pripojeni->dotaz("SELECT * FROM  ".$GLOBALS['config_db_prefix']."modul_rada WHERE id_elementu='".$_REQUEST['id_elementu']."' ORDER BY poradi");
		echo"<table class='vypisy'>\n";
		while ($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
			echo"<tr class='".(($i++)%2?"s":"l")."'>\n";
				echo"<td>".$data->titul." ".$data->jmeno." ".$data->prijmeni." ".$data->titul_za."</td>\n";
				echo"<td>".$data->funkce."</td>";
				echo"<td>".$data->zarizeni."</td>";
				echo"<td>".$data->poradi."</td>";
					echo"\t\t<td class='op'><a href='".$admin_url."&amp;oprava=".$data->id."' class='edit'>opravit</a></td>\n";			
					echo"\t\t<td class='op'><a href='".$admin_url."&amp;delete=".$data->id."' class='del' onclick=\"return confirm('Opravdu odstranit tuto položku?')\">odstranit</a></td>\n";			
			echo"</tr>";
		}
		echo"</table>";

	}
	
	







	function do_thumbnail_cropped($soubor, $path, $tn_dir, $new_name, $square="", $max_width="", $max_height="")
	{
		if ($soubor){
			if (!@fopen($path.$new_name, "r")){
				@copy($_FILES[$soubor]['tmp_name'], $path.$new_name);
			}
		}
		if(@$velikost_obrazku = GetImageSize($path.$new_name)){
			
			if ($square ){
				if (($velikost_obrazku[0]>$square || $velikost_obrazku[1]>$square)){

					if($velikost_obrazku[0]>$velikost_obrazku[1]){
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
						$height=ImageSY($im)*($square/ImageSX($im)); 
						$im2 = ImageCreateTrueColor($square,$square); 
//						ImageCopyResampled ($im2, $im, 0, 0, round((ImageSX($im)-ImageSY($im))/2), 0, $square, $square, ImageSY($im)+round((ImageSX($im)-ImageSY($im))/2), ImageSY($im));
						ImageCopyResampled ($im2, $im, 0, 0, round((ImageSX($im)-ImageSY($im))/2), 0, $square, $square, ImageSY($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
						
					}
					else{
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
						$width=ImageSX($im)*($square/ImageSY($im)); 
						$im2 = ImageCreateTrueColor($square, $square); 
						//ImageCopyResampled ($im2, $im, 0, 0, 0, round((ImageSY($im)-ImageSX($im))/2), $square, $square, ImageSX($im), ImageSX($im)+round((ImageSY($im)-ImageSX($im))/2));
						ImageCopyResampled ($im2, $im, 0, 0, 0, round((ImageSY($im)-ImageSX($im))/2), $square, $square, ImageSX($im), ImageSX($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
					}

				}
				else{
					@copy($path.$new_name, $tn_dir.$new_name);
				}

			}
			elseif($max_width && $max_height){
        //pokud sx/sy > Sx/Sy
          // rx=sx&ry=sy . sSx=Sx & sSy = sy*SX/sx

						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
				$im2 = ImageCreateTrueColor($max_width,$max_height); 

				if( ($velikost_obrazku[0]/$velikost_obrazku[1])<($max_width/$max_height) ){


//					ImageCopyResampled ($im2, $im, 0, 0, 0, round((ImageSY-($max_height*ImageSX($im)/$max_width))/2), $max_width, $max_height, ImageSX($im), round($max_height*ImageSX($im)/$max_width));
          ImageCopyResampled ($im2, $im, 0, 0, 0, round((ImageSY($im)-($max_height*ImageSX($im)/$max_width))/2), $max_width, $max_height, ImageSX($im), round($max_height*ImageSX($im)/$max_width));
				}
				else{
         ImageCopyResampled ($im2, $im, 0, 0, round((ImageSX($im)-($max_width*ImageSY($im)/$max_height))/2), 0, $max_width, $max_height, round($max_width*ImageSY($im)/$max_height), ImageSY($im));
				}
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
			}

			elseif($max_width){
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
				$height=ImageSY($im)*($max_width/ImageSX($im)); 
				$im2 = ImageCreateTrueColor($max_width,$height); 
				ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $max_width, $height, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
			}
			elseif($max_height){
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
				$width=ImageSX($im)*($max_height/ImageSY($im)); 
				$im2 = ImageCreateTrueColor($width, $max_height); 
				ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $width, $max_height, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
			}
		}
	}



	function do_thumbnail($soubor, $path, $tn_dir, $new_name, $square="", $max_width="", $max_height="")
	{
		if ($soubor){
			if (!@fopen($path.$new_name, "r")){
				@copy($_FILES[$soubor]['tmp_name'], $path.$new_name);
			}
		}
		@$velikost_obrazku = GetImageSize($path.$new_name);
		
		if ($square){
			if($velikost_obrazku[0]>$velikost_obrazku[1]){
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
				$height=ImageSY($im)*($square/ImageSX($im)); 
				$im2 = ImageCreateTrueColor($square,$height); 
				ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $square, $height, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
			}
			else{
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
				$width=ImageSX($im)*($square/ImageSY($im)); 
				$im2 = ImageCreateTrueColor($width, $square); 
				ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $width, $square, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
			}
		}
		elseif($max_width && $max_height){
			if( ($velikost_obrazku[0]/$velikost_obrazku[1])>($max_width/$max_height) ){
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
				$height=ImageSY($im)*($max_width/ImageSX($im)); 
				$im2 = ImageCreateTrueColor($max_width,$height); 
				ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $max_width, $height, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
			}
			else{
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
				$width=ImageSX($im)*($max_height/ImageSY($im)); 
				$im2 = ImageCreateTrueColor($width, $max_height); 
				ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $width, $max_height, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
			}
		}

		elseif($max_width){
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
			$height=ImageSY($im)*($max_width/ImageSX($im)); 
			$im2 = ImageCreateTrueColor($max_width,$height); 
			ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $max_width, $height, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
		}
		elseif($max_height){
						if($velikost_obrazku['mime']=="image/gif")$im = ImageCreateFromGIF ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/png")$im = ImageCreateFromPNG ($path.$new_name); 
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageCreateFromJPEG ($path.$new_name); 
			$width=ImageSX($im)*($max_height/ImageSY($im)); 
			$im2 = ImageCreateTrueColor($width, $max_height); 
			ImageCopyResampled ($im2, $im, 0, 0, 0, 0, $width, $max_height, ImageSX($im), ImageSY($im));
						if($velikost_obrazku['mime']=="image/gif")$im = ImageGIF($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/png")$im = ImagePNG($im2, $tn_dir.$new_name);
						if($velikost_obrazku['mime']=="image/jpeg")$im = ImageJPEG($im2, $tn_dir.$new_name);
		}
	}

	function code_gen()
	{
		$totalChar = 8; // number of chars in the code
		$salt = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ123456789";  // salt to select chars from
		srand((double)microtime()*1000000); // start the random generator
		$code=""; // set the inital variable
		for ($i=0;$i<$totalChar;$i++)  // loop and create password
			$code = $code. substr ($salt, rand() % strlen($salt), 1);
		return $code;
	}

	function seo_gen($title, $typ='')
	{
		static $convertTable = array (
			'á' => 'a', 'Á' => 'A', 'ä' => 'a', 'Ä' => 'A', 'č' => 'c',
			'Č' => 'C', 'ď' => 'd', 'Ď' => 'D', 'é' => 'e', 'É' => 'E',
			'ě' => 'e', 'Ě' => 'E', 'ë' => 'e', 'Ë' => 'E', 'í' => 'i',
			'Í' => 'I', 'i' => 'i', 'I' => 'I', 'l' => 'l', 'L' => 'L',
			'l' => 'l', 'L' => 'L', 'ň' => 'n', 'Ň' => 'N', 'n' => 'n',
			'N' => 'N', 'ó' => 'o', 'Ó' => 'O', 'ö' => 'o', 'Ö' => 'O',
			'ř' => 'r', 'Ř' => 'R', 'r' => 'r', 'R' => 'R', 'š' => 's',
			'Š' => 'S', 's' => 's', 'S' => 'S', 'ť' => 't', 'Ť' => 'T',
			'ú' => 'u', 'Ú' => 'U', 'ů' => 'u', 'Ů' => 'U', 'ü' => 'u',
			'Ü' => 'U', 'ý' => 'y', 'Ý' => 'Y', 'y' => 'y', 'Y' => 'Y',
			'ž' => 'z', 'Ž' => 'Z', 'z' => 'z', 'Z' => 'Z', 
			':' => '-', '/' => '-',
		);
		$title = strtolower(strtr($title, $convertTable));
		$title = Str_Replace(Array(" ", "_"), "-", $title); //nahradí mezery a podtržítka pomlckami
		if ($typ=='files')
			$title = Str_Replace(Array("(",")","!",",","\"","'"), "", $title); //odstraní ().!,"'
		else
			$title = Str_Replace(Array("(",")",".","!",",","\"","'"), "", $title); //odstraní ().!,"'
		
		$title = ereg_replace('/[^a-zA-Z0-9]+/u', '-', $title);
		$title = str_replace('--', '-', $title);
		$title = trim($title, '-');
		return urlencode($title);
	}
}
?>

ACC SHELL 2018