ACC SHELL

Path : /srv/www/vhosts/sc-brno/sefar/modules/sitemap/
File Upload :
Current File : /srv/www/vhosts/sc-brno/sefar/modules/sitemap/modul.php

<?
class CModul_Sitemap{
	function CModul_Sitemap($pripojeni){
		$this->pripojeni = $pripojeni;
		$this->conf_id='modul_sitemap';
	}
	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."'");

	}


	function show_element_preview($id_elementu){
/*
		$dbdata = $this->pripojeni->dotaz("SELECT * FROM  ".$GLOBALS['config_db_prefix']."modul_prezidium 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" | ";						
			if($_SESSION['auth_uzivatel_authorisation']==9)
				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?\")' class='button red'>odstranit modul</a>";
			echo"</div>\n\n";
	}

	function show_element_view($id_elementu){
	
		$this->generuj_site_tree(0,0,'');
	}

	function generuj_site_tree($id_top=0, $zanoreni=0, $above_seo=''){
	    $dbdata = $this->pripojeni->dotaz("select M.*, count(M2.id) as pocet_vnorenych from ".$GLOBALS['config_db_prefix']."menu M LEFT JOIN ".$GLOBALS['config_db_prefix']."menu M2 ON M2.id_top=M.id AND M2.deleted='0' AND M2.hidden='0' WHERE M.id_webu='".$GLOBALS['main']->web_id."' AND M.lang='".$GLOBALS['main']->lang."' AND M.id_top='".$id_top."' AND M.deleted='0' AND M.hidden='0' AND M.seo<>'intro'   GROUP BY M.id ORDER BY M.poradi");
    	echo"<ul ".(!$zanoreni ?"id='sitemap'":"").">\n";
    	$pocet_polozek = $this->pripojeni->pocet_radku($dbdata);
    	$i=1;
		while ($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
			
			echo"<li class='".($i==1?"first ":"")."'>";
			echo"<a href='".($data->url?$data->url:"./".$GLOBALS['main']->lang."/".$above_seo.$data->seo)."' ".($data->url?"target='_blank'":"")." ".($i==$pocet_polozek&&!$zanoreni?"class='end'":"").">".($data->menu_nazev?$data->menu_nazev:$data->nazev)."</a>";
			if ($data->pocet_vnorenych && $zanoreni<5){
				//echo"<li>";
					$this->generuj_site_tree($data->id, $zanoreni+1, $above_seo.$data->seo."/");
				//echo"</li>";
			}
			echo"</li>\n";
		$i++;
		}
		echo"</ul>";
	}




	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