ACC SHELL
<?
class CModul_Texty{
function CModul_Texty($pripojeni){
$this->pripojeni = $pripojeni;
$this->conf_id='modul_texty';
$this->lang = $_REQUEST['lang'];
}
function create_modul($id_bloku){
$this->pripojeni->dotaz("INSERT INTO ".$GLOBALS['config_db_prefix']."elementy (id_bloku, poradi, modul, nazev) SELECT '".$id_bloku."', max(poradi)+1, '".$this->conf_id."', '".$_REQUEST['nazev']."' 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 vyhledat($fraze){
$dbdata = $this->pripojeni->dotaz("SELECT * FROM ".$GLOBALS['config_db_prefix']."modul_texty WHERE text LIKE '%".$fraze."%'");
while($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
$idecka .= ($idecka?", ":"").$data->id_elementu;
}
return $idecka;
}
function admin_edituj()
{
if ($_FILES['soubor']['name']){
$nazev_obrazku = time()."_".$this->seo_gen($_FILES['soubor']['name'], "files");
$this->do_thumbnail('soubor', "../../images/obr/", "../../images/tn/", $nazev_obrazku, 100);
//copy($_FILES['ikona']['tmp_name'], "../../images/".$nazev_obrazku);
}
if ($_REQUEST['id_this']){
$this->pripojeni->dotaz("UPDATE ".$GLOBALS['config_db_prefix']."modul_texty SET text='".$_REQUEST['text']."' ".($nazev_obrazku?",soubor='".$nazev_obrazku."'":"")." WHERE id='".$_REQUEST['id_this']."'");
}
else{
$this->pripojeni->dotaz("INSERT INTO ".$GLOBALS['config_db_prefix']."modul_texty (id_elementu, text) VALUES ('".$_REQUEST['id_elementu']."', '".$_REQUEST['text']."')");
}
}
function texty_delete($id)
{
if ($id){
$this->pripojeni->dotaz("DELETE FROM ".$GLOBALS['config_db_prefix']."modul_texty WHERE id='".(0+$id)."'");
}
}
function show_admin_form($id_elementu)
{
$admin_url.="admin.php";
$admin_url.="?web_id=".$_REQUEST['web_id'];
$admin_url.="&lang=".$_REQUEST['lang'];
$admin_url.="&sekce=".$_REQUEST['sekce'];
$admin_url.="&operace=".$_REQUEST['operace'];
$admin_url.="&id=".$_REQUEST['id'];
$admin_url.="&id_bloku=".$_REQUEST['id_bloku'];
$admin_url.="&id_elementu=".$_REQUEST['id_elementu'];
if ($_REQUEST['clear_icon']){
$this->pripojeni->dotaz("UPdate ".$GLOBALS['config_db_prefix']."modul_texty set soubor='' WHERE id='".$_REQUEST['clear_icon']."' ORDER BY id desc LIMIT 1");
}
if ($_REQUEST['delete']){
$this->texty_delete($_REQUEST['delete']);
}
if (true || $_REQUEST['oprava']){
$db_opravna_polozka = $this->pripojeni->dotaz("SELECT * FROM ".$GLOBALS['config_db_prefix']."modul_texty WHERE id_elementu='".$id_elementu."' ORDER BY id desc LIMIT 1");
// $db_opravna_polozka = $this->pripojeni->dotaz("SELECT * FROM ".$GLOBALS['config_db_prefix']."modul_texty 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='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='return' value='lang=".$_REQUEST['lang']."&sekce=".$_REQUEST['sekce']."&id=".$_REQUEST['id']."&operace=".$_REQUEST['operace']."&id_bloku=".$_REQUEST['id_bloku']."&id_elementu=".$_REQUEST['id_elementu']."'/>\n";
echo"<input type='hidden' name='id_this' value='".$opravna_polozka->id."'/>\n";
echo"<table class='formularovka'>";
echo"<tr><td>Ikona</td><td><input type='file' name='soubor' /><br/>".($opravna_polozka->soubor?"<img src='../images/tn/".$opravna_polozka->soubor."' alt=''/> <a href='./admin.php?lang=".$this->lang."&sekce=obsah&id=".$_REQUEST['id']."&operace=edit-element&id_bloku=".$_REQUEST['id_bloku']."&id_elementu=".$id_elementu."&clear_icon=".$opravna_polozka->id."'>zrušit</a>":"")."</td></tr>\n";
echo"<tr><td>Text</td><td>";
echo"<textarea name='text' id='text'>".$opravna_polozka->text."</textarea>";
?>
<script type="text/javascript">
//<![CDATA[
CKEDITOR.replace( 'text',
{
toolbar:
[
['Source','-','Preview','-','Templates'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print'],
['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
['NumberedList','BulletedList','-','CreateDiv'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
['Link','Unlink','Anchor'],
['Image','Flash','Table','HorizontalRule','SpecialChar','PageBreak'],
'/',
['Format','FontSize'],['TextColor','BGColor'],
['Maximize', 'ShowBlocks','-','About']
],
filebrowserBrowseUrl : './ckfinder/ckfinder.html',
filebrowserImageBrowseUrl : './ckfinder/ckfinder.html?type=Images',
filebrowserFlashBrowseUrl : './ckfinder/ckfinder.html?type=Flash',
filebrowserUploadUrl : './ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
filebrowserImageUploadUrl : './ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
filebrowserFlashUploadUrl : './ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
});
//]]>
</script>
<?
echo"</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_texty WHERE id_elementu='".$id_elementu."' ORDER BY id desc");
echo"<table class='vypisy'>\n";
while ($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
echo"<tr class='".(($i++)%2?"s":"l")."'>\n";
echo"<td>".$data->typ."</td>\n";
echo"<td>".substr(strip_tags($data->text), 0, 100)."...</td>\n";
// echo"\t\t<td class='op'><a href='./admin.php?lang=".$this->lang."&web_id=".$this->web_id."&sekce=texty-prilozene-soubory&id_clanku=".$data->id."' class='edit'>přiložené soubory</a></td>\n";
echo"\t\t<td class='op'><a href='./".$admin_url."&oprava=".$data->id."' class='edit'>opravit</a></td>\n";
echo"\t\t<td class='op'><a href='./".$admin_url."&delete=".$data->id."' class='del' onclick=\"return confirm('Opravdu odstranit tuto položku?')\">odstranit</a></td>\n";
echo"</tr>";
}
echo"</table>";
*/
}
function show_element_preview($id_elementu){
$dbdata = $this->pripojeni->dotaz("SELECT * FROM ".$GLOBALS['config_db_prefix']."modul_texty WHERE id_elementu='".$id_elementu."' LIMIT 1");
if($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
echo"<div class='preview'>";
echo substr(strip_tags($data->text), 0, 127);
echo"</div>";
echo"<div class='modul-opearace'>";
echo"<a href='./admin.php?lang=".$this->lang."&sekce=obsah&id=".$_REQUEST['id']."&operace=edit-element&id_bloku=".$polozka_menu->id."&id_elementu=".$id_elementu."' class='button green'>upravit</a>";
echo" ";
if($_SESSION['auth_uzivatel_id']!=8)
echo"<a href='./admin.php?lang=".$this->lang."&sekce=obsah&id=".$_REQUEST['id']."&operace=delete-element&id_bloku=".$polozka_menu->id."&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){
$dbdata = $this->pripojeni->dotaz("SELECT * FROM ".$GLOBALS['config_db_prefix']."modul_texty WHERE id_elementu='".$id_elementu."' LIMIT 1");
if($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
echo"<div class='preview'>";
if($data->soubor){
if($data->soubor && !file_exists("./images/sized/".$data->soubor)){
$this->do_thumbnail("", "./images/obr/", "./images/sized/", $data->soubor, "", 300);
}
echo"<div class='text-ikona'><img src='./images/sized/".$data->soubor."' alt='' /></div>";
}
echo $data->text;
echo"</div>";
}
}
function texty_prilozene_soubory_edit()
{
if ($_REQUEST['id']){
if($_FILES['nazev']['name']){
$novy_nazev = time()."_".$_FILES['nazev']['name'];
copy($_FILES['nazev']['tmp_name'], "../../images/clanky/fotky/".$novy_nazev);
$velikost = getimagesize("../../images/clanky/fotky/".$novy_nazev);
if ($velikost[2]){
$this->do_thumbnail("", "../../images/clanky/fotky/", "../../images/clanky/fotky/tn/", $novy_nazev, 100);
}
}
$vysledek = $this->pripojeni->dotaz( "UPDATE ".$GLOBALS['config_db_prefix']."texty_pix SET ".($novy_nazev?"nazev='$novy_nazev', ":"")."popis='".$_REQUEST['popis']."' WHERE id='".$_REQUEST['id']."'" );
}
else{
if($_FILES['nazev']['name'][1]){
for($i=1; $i<=$_REQUEST['ObrNb2']; $i++){
$novy_nazev = time()."_".$_FILES['nazev']['name'][$i];
copy($_FILES['nazev']['tmp_name'][$i], "../../images/clanky/fotky/$novy_nazev");
$velikost = getimagesize("../../images/clanky/fotky/$novy_nazev");
if ($velikost[2]){
$this->do_thumbnail("", "../../images/clanky/fotky/", "../../images/clanky/fotky/tn/", $novy_nazev, 100);
$je_obrazek = true;
}
$vysledek = $this->pripojeni->dotaz( "INSERT INTO ".$GLOBALS['config_db_prefix']."texty_pix (nazev, id_kat, popis, soubor ) VALUES ('$novy_nazev', '".$_REQUEST['id_clanku']."', '".$_REQUEST['popis'][$i]."', '".($je_obrazek?"":$_FILES['nazev']['type'][$i])."' )" );
}
}
}
}
function texty_prilozene_soubory_delete($id)
{
if ($id){
$this->pripojeni->dotaz("DELETE FROM ".$GLOBALS['config_db_prefix']."texty_pix WHERE id='".(0+$id)."'");
}
}
function texty_prilozene_soubory_form()
{
if ($_REQUEST['delete']){
$this->texty_prilozene_soubory_delete($_REQUEST['delete']);
}
if ($_REQUEST['oprava']){
$db_opravna_polozka = $this->pripojeni->dotaz("SELECT * FROM ".$GLOBALS['config_db_prefix']."texty_pix WHERE id='".$_REQUEST['oprava']."' LIMIT 1");
if ($db_opravna_polozka && $opravna_polozka = $this->pripojeni->objekt_dotazu($db_opravna_polozka)){
}
}
echo"<SCRIPT LANGUAGE=JavaScript>\n";
echo"function ObrGen2() {\n";
echo" nb = document.getElementById('ObrNb2').value;\n";
echo" document.getElementById('obrazky2').innerHTML = \"\";\n";
echo" for(i=1; i<=nb; i++)\n";
echo" document.getElementById('obrazky2').innerHTML += \"<input type=text name=popis[\"+ i +\"] class=winput> <input type=file name=nazev[\"+ i +\"] class=winput><br>\";\n";
echo"}\n";
echo"</SCRIPT>\n";
echo"<form action='./functions/function.php' method='post' enctype='multipart/form-data' id='form1' name='form1'>\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='id_clanku' value='".$_REQUEST['id_clanku']."'/>\n";
echo"<input type='hidden' name='id' value='".$opravna_polozka->id."'/>\n";
echo"<table>";
if ($_REQUEST['oprava']){
echo"<tr><td>Popis</td><td><input type=text name=popis value='".$opravna_polozka->popis."' class='winput'></td></tr>";
echo"<tr><td>soubor:</td><td>";
echo"<input type='file' name='nazev' value=\"$nazev\" class=winput><br/>";
if($opravna_polozka->nazev){
if ($opravna_polozka->soubor)
echo"<a href='../images/clanky/fotky/".$opravna_polozka->nazev."'>soubor: ".$opravna_polozka->nazev."</a><br/>";
else
echo"<img src=\"../images/clanky/fotky/tn/".$opravna_polozka->nazev."\"><br/>";
}
echo"</td></tr>";
}
else{
echo"<tr><td>Počet obrázků</td><td>";
echo"<input type='text' size='3' name='ObrNb2' id='ObrNb2' onChange='ObrGen2()' class='winput2' />";
echo"<div id='obrazky2'></div>";
echo"</td></tr>";
}
echo"<tr><td></td><td><input type='submit' name='edit_texty_prilozene_soubory' value='Odeslat' class='submitter'/></td></tr>\n";
echo"</table>";
echo"</form>\n\n";
$dbdata = $this->pripojeni->dotaz("SELECT * FROM ".$GLOBALS['config_db_prefix']."texty_pix WHERE id_kat='".$_REQUEST['id_clanku']."' ORDER BY id desc");
echo"<table class='vypisy'>\n";
while ($dbdata && $data = $this->pripojeni->objekt_dotazu($dbdata)){
echo"<tr class='".(($i++)%2?"s":"l")."'>\n";
$velikost = getimagesize("../images/clanky/fotky/".$data->nazev);
echo"<td><a href='../images/clanky/fotky/".$data->nazev."'><img src='".($velikost[2]?"../images/clanky/fotky/tn/".$data->nazev."":"../img/pdf_icon.gif")."' alt=''/></a></td>\n";
echo"<td>".$data->nazev."</td>\n";
echo"\t\t<td class='op'><a href='./admin.php?lang=".$this->lang."&web_id=".$this->web_id."&sekce=".$this->sekce."&id_clanku=".$_REQUEST['id_clanku']."&oprava=".$data->id."' class='edit'>opravit</a></td>\n";
echo"\t\t<td class='op'><a href='./admin.php?lang=".$this->lang."&web_id=".$this->web_id."&sekce=".$this->sekce."&id_clanku=".$_REQUEST['id_clanku']."&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 ( $velikost_obrazku['mime']){
echo tu;
} else echo problem; */
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 generuj_form_element($typ, $nazev, $hodnota, $class="")
{
switch ($typ){
case "textarea":
echo"<textarea name=\"$nazev\" id=\"$nazev\"".($class?" class=\"$class\"":"")." cols=\"20\" rows=\"4\">$hodnota</textarea>";
break;
case "text":
echo"<input type=\"text\"name=\"$nazev\" id=\"$nazev\" value=\"$hodnota\" ".($class?" class=\"$class\"":"")." >";
break;
}
}
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