ACC SHELL
<?php
/**
* @author Filip Štencl
* @since 19.02.2014
*
*/
use Nette\Image;
class files extends base {
const TABLE_NAME = 'files';
public $auto_max_resize = true;
public $max_sirka = 1200;
public $max_vyska = 1000;
public $popis_limit = 250;
public $soubor_limit = 250;
public $pripony_dokument = array("txt","csv","htm","html","xml","css","doc","docx","xls","xlsx","rtf","ppt","pptx","pdf","swf","flv","avi","wmv","mov","jpg","jpeg","gif","png","zip");
public $pripony_foto = array("jpg","jpeg","gif","png");
private $id = null;
private $cesta = null;
private $pomid = null;
private $popis = null;
private $soubor = null;
private $tempFile = null;
private $velikost = null;
private $pripona = null;
private $hlavni = null;
private $typ = null;
private $poradi = null;
private $chyba = null;
private $adminID = 0;
public function __construct($id = null) {
if(!is_null($id) && intval($id) != 0) {
$result = dibi::query('SELECT * FROM ['.self::TABLE_NAME.'] WHERE id=%i',intval($id));
if($result->count() > 0) {
$row = $result->fetch();
$this->id = $row->id;
$this->cesta = $row->cesta;
$this->pomid = $row->pomid;
$this->popis = $row->popis;
$this->soubor = $row->soubor;
$this->velikost = $row->velikost;
$this->pripona = $row->pripona;
$this->hlavni = $row->hlavni;
$this->typ = $row->typ;
$this->poradi = $row->poradi;
$this->adminID = 0;
} else {
notification::infoBox_error("Požadovaná položka nebyla nalezena");
redirect("./home.php");
}
}
}
public function getId() { return $this->id; }
public function getCesta() { return $this->cesta; }
public function getPomid() { return $this->pomid; }
public function getSoubor() { return $this->soubor; }
public function getNazev() { return $this->soubor; }
public function getPopis() { return $this->popis; }
public function getVelikost() { return $this->velikost; }
public function getPripona() { return $this->pripona; }
public function getHlavni() { return $this->hlavni; }
public function getTyp() { return $this->typ; }
public function getPoradi() { return $this->poradi; }
public function setId($id) { $this->id = intval($id); }
public function setCesta($cesta) { $this->cesta = $cesta; }
public function setPomid($pomid) { $this->pomid = intval($pomid); }
public function setSoubor($soubor) { $this->soubor = $soubor; }
public function setTempFile($tempFile) {$this->tempFile = $tempFile; }
public function setPopis($popis) { $this->popis = $popis; }
public function setVelikost($velikost) { $this->velikost = intval($velikost); }
public function setPripona($pripona) { $this->pripona = $pripona; }
public function setHlavni($hlavni) {$this->hlavni = $hlavni; }
public function setTyp($typ) {$this->typ = $typ; }
public function setPoradi($poradi) {$this->poradi = $poradi; }
public function setadminID($adminID) {$this->adminID = $adminID; }
public function create($variables,$redirectOnEnd = true) {
$arr = pripravPost($variables);
if($this->checkData($arr)) {
$arr["soubor"] = $this->soubor;
$arr["velikost"] = $this->velikost;
$arr["pripona"] = mb_strtolower(mb_substr($this->soubor,mb_strrpos($this->soubor,'.') + 1));
$pripona = end(explode(".", trim($this->soubor)));
$arr["soubor"] = mr_url(mb_substr(trim($this->soubor),0, - mb_strlen($pripona) - 1)).".".$arr["pripona"];
if ($this->velikost > 0) {
if ($this->typ == "1" && !in_array(mb_strtolower(mb_substr($this->soubor,mb_strrpos($this->soubor,'.') + 1)),$this->pripony_foto)) { $this->chyba.= "<strong>".$this->soubor."</strong> - tento typ obrázku není podporován.<br />Podporované formáty jsou <strong>".implode($this->pripony_foto,", ")."</strong>"; }
elseif ($this->typ == "2" && !in_array(mb_strtolower(mb_substr($this->soubor,mb_strrpos($this->soubor,'.') + 1)),$this->pripony_dokument)) { $this->chyba.= "<strong>".$this->soubor."</strong> - tento typ dokumentu není podporován<br />Podporované formáty jsou <strong>".implode($this->pripony_dokument,", ")."</strong>"; }
else {
$cesta = DATA_DIR.$this->cesta."/".$this->pomid."/".($this->typ == "1" ? "foto/":"dokumenty/")."";
if (!is_dir($cesta)) {
if (!is_dir(DATA_DIR)) { mkdir(DATA_DIR); }
if (!is_dir(DATA_DIR.$this->cesta)) { mkdir(DATA_DIR.$this->cesta); }
if (!is_dir(DATA_DIR.$this->cesta."/".$this->pomid)) { mkdir(DATA_DIR.$this->cesta."/".$this->pomid); }
if (!is_dir(DATA_DIR.$this->cesta."/".$this->pomid."/foto")) { mkdir(DATA_DIR.$this->cesta."/".$this->pomid."/foto"); }
if (!is_dir(DATA_DIR.$this->cesta."/".$this->pomid."/dokumenty")) { mkdir(DATA_DIR.$this->cesta."/".$this->pomid."/dokumenty"); }
}
move_uploaded_file($this->tempFile,$cesta . $arr["soubor"]);
chmod($cesta . $arr["soubor"], 0646 );
if ($this->auto_max_resize == true && $this->typ == "1") {
$image = Image::fromFile(DATA_DIR . $this->cesta . "/" . $this->pomid . "/foto/" . $arr["soubor"]);
$image->resize($this->max_sirka,$this->max_sirka,Image::SHRINK_ONLY);
$image->save(DATA_DIR . $this->cesta . "/" . $this->pomid . "/foto/" . $arr["soubor"]); // JPEG, kvalita 90%
}
}
} else { $this->chyba.= "<strong>".$this->soubor."</strong> - soubor nebyl nahrán. Má nulovou velikost."; }
if ($this->chyba == "") {
if ($this->hlavni == 1) { dibi::query("UPDATE [".self::TABLE_NAME."] SET hlavni = 0 WHERE pomid = '".$this->pomid."' AND typ = '".$this->typ."' AND cesta = '".$this->cesta."'"); }
$arr['poradi'] = dibi::query("SELECT MAX(poradi) FROM [".self::TABLE_NAME."] WHERE pomid = '".$this->pomid."' AND typ = '".$this->typ."' AND cesta = '".$this->cesta."'")->fetchSingle() + 1;
if(!dibi::query('INSERT INTO ['.self::TABLE_NAME.']', $arr)) { notification::infoBox_error("Při ukládání položky se vyskytla chyba"); }
else {
if ($this->typ == 1) { notification::infoBox_success("<img src=\"/images-crop/50x50/".$this->cesta."/".$this->pomid."/".$arr["soubor"]."\"> Přidání položky: <strong>".$arr["soubor"]."</strong><br />"); }
if ($this->typ == 2) { notification::infoBox_success("Přidání položky: <strong>".$arr["soubor"]."</strong><br />"); }
$last_id = dibi::insertId();
notification::zaloguj("Přidání položky: <strong>".$arr["soubor"]."</strong>",$last_id,$this->adminID);
}
} else {notification::infoBox_error($this->chyba);}
} else {notification::infoBox_error($this->chyba);}
if ($redirectOnEnd == true) { redirect(admin::returnBack()); }
}
public function edit($variables, $redirectOnEnd = true) {
// pokud je fotka nastavena jako hlavní, ostatní hlavni vypni
$arr = pripravPost($variables);
if (intval($arr['hlavni']) == 1) {
dibi::query("UPDATE [".self::TABLE_NAME."] SET hlavni = 0 WHERE pomid = '".$this->pomid."' AND typ = '".$this->typ."' AND cesta = '".$this->cesta."'");
}
// rotace
if ($this->typ == 1 && $arr["rotace"] != "0") {
$url = DATA_DIR . $this->cesta . "/" . $this->pomid . "/foto/" . $this->soubor;
$image = Image::fromFile($url);
switch ($arr['rotace']) {
case "90": $image->rotate(-90,NULL); break;
case "180": $image->rotate(180,NULL); break;
case "270": $image->rotate(90,NULL); break;
case "vertikal": $image->resize(NULL,'-100%'); break;
case "horizont": $image->resize('-100%',NULL); break;
}
$image->save($url,"100");
notification::infoBox_success("Obrázek otočen");
notification::caszmeny_update($this->id,"files");
}
unset($arr['rotace']);
parent::edit($arr, $redirectOnEnd);
}
public function uploadImage($promenna,$cesta,$pomid,$popis,$smazat_stare = true) { self::upload("1",$_FILES[$promenna]['name'],$_FILES[$promenna]['tmp_name'],$_FILES[$promenna]['size'],$cesta,$pomid,$popis,$smazat_stare); }
public function uploadDoc($promenna,$cesta,$pomid,$popis,$smazat_stare = true) { self::upload("2",$_FILES[$promenna]['name'],$_FILES[$promenna]['tmp_name'],$_FILES[$promenna]['size'],$cesta,$pomid,$popis,$smazat_stare); }
public function saveImageFromUrl($url,$cesta,$pomid,$popis='') {
$image = Image::fromFile($url);
if ($this->auto_max_resize == true) {
$image->resize($this->max_sirka,$this->max_sirka,Image::SHRINK_ONLY);
}
if (!is_dir(DATA_DIR)) { mkdir(DATA_DIR); }
if (!is_dir(DATA_DIR.$cesta)) { mkdir(DATA_DIR.$cesta); }
if (!is_dir(DATA_DIR . $cesta . "/" . $pomid)) { mkdir(DATA_DIR . $cesta . "/" . $pomid); }
if (!is_dir(DATA_DIR . $cesta . "/" . $pomid . "/foto")) { mkdir(DATA_DIR . $cesta . "/" . $pomid . "/foto/"); }
$fotka_nazev = hash('ripemd128',$url . $pomid).".jpg";
$image->save(DATA_DIR . $cesta . "/" . $pomid . "/foto/" . $fotka_nazev, 100, Image::JPEG); // JPEG, kvalita 90%
$velikost = filesize(DATA_DIR . $cesta . "/" . $pomid . "/foto/" . $fotka_nazev);
dibi::query("DELETE FROM [".self::TABLE_NAME."] WHERE pomid = '".$pomid."' AND typ = 1 AND cesta = '".$cesta."'");
$nova_fotografie = array(
'cesta' =>$cesta,
'pomid' => $pomid,
'soubor' => $fotka_nazev,
'popis' => $popis,
'pripona' => 'jpg',
'velikost' => $velikost,
'poradi' => 1,
'typ' => 1
);
dibi::query('INSERT INTO ['.self::TABLE_NAME.']', $nova_fotografie);
$last_id = dibi::insertId();
dibi::query("UPDATE [files] SET barva = %s WHERE id = %i",$nahodna_barva,$last_id);
}
private function upload($typ,$soubor,$temp_soubor,$velikost,$cesta,$pomid,$popis,$smazat_stare) {
if($this->checkData(array("typ"=>$typ,"pomid"=>$pomid,"soubor"=>$soubor,"cesta"=>$cesta,"popis"=>$popis,"checkUnikatni"=>false))) {
$this->tempFile = $temp_soubor;
$this->typ = $typ;
$this->soubor = $soubor;
$arr["velikost"] = $velikost;
$arr["typ"] = $typ;
$arr["pomid"] = $pomid;
$arr["cesta"] = $cesta;
$arr["popis"] = $popis;
$arr['poradi'] = 1;
$arr["pripona"] = mb_strtolower(mb_substr($this->soubor,mb_strrpos($this->soubor,'.') + 1));
$pripona = end(explode(".", trim($this->soubor)));
$arr["soubor"] = mr_url(mb_substr(trim($this->soubor),0, - mb_strlen($pripona) - 1)).".".$arr["pripona"];
if ($this->typ == "1" && !in_array(mb_strtolower(mb_substr($this->soubor,mb_strrpos($this->soubor,'.') + 1)),$this->pripony_foto)) { $this->chyba.= "<strong>".$this->soubor."</strong> - tento typ obrázku není podporován.<br />Podporované formáty jsou <strong>".implode($this->pripony_foto,", ")."</strong>"; }
elseif ($this->typ == "2" && !in_array(mb_strtolower(mb_substr($this->soubor,mb_strrpos($this->soubor,'.') + 1)),$this->pripony_dokument)) { $this->chyba.= "<strong>".$this->soubor."</strong> - tento typ dokumentu není podporován<br />Podporované formáty jsou <strong>".implode($this->pripony_dokument,", ")."</strong>"; }
else {
$cesta = DATA_DIR.$this->cesta."/".$this->pomid."/".($this->typ == "1" ? "foto/":"dokumenty/")."";
if (!is_dir($cesta)) {
if (!is_dir(DATA_DIR)) { mkdir(DATA_DIR); }
if (!is_dir(DATA_DIR.$this->cesta)) { mkdir(DATA_DIR.$this->cesta); }
if (!is_dir(DATA_DIR.$this->cesta."/".$this->pomid)) { mkdir(DATA_DIR.$this->cesta."/".$this->pomid); }
if (!is_dir(DATA_DIR.$this->cesta."/".$this->pomid."/foto")) { mkdir(DATA_DIR.$this->cesta."/".$this->pomid."/foto"); }
if (!is_dir(DATA_DIR.$this->cesta."/".$this->pomid."/dokumenty")) { mkdir(DATA_DIR.$this->cesta."/".$this->pomid."/dokumenty"); }
}
move_uploaded_file($this->tempFile,$cesta . $arr["soubor"]);
chmod($cesta . $this->soubor, 0646 );
if ($this->auto_max_resize == true && $this->typ == "1") {
$image = Image::fromFile(DATA_DIR . $this->cesta . "/" . $this->pomid . "/foto/" . $arr["soubor"]);
$image->resize($this->max_sirka,$this->max_sirka,Image::SHRINK_ONLY);
$image->save(DATA_DIR . $this->cesta . "/" . $this->pomid . "/foto/" . $arr["soubor"]); // JPEG, kvalita 90%
}
}
if ($this->chyba == "") {
if ($smazat_stare == true) {dibi::query("DELETE FROM [".self::TABLE_NAME."] WHERE pomid = '".$this->pomid."' AND typ = '".$this->typ."' AND cesta = '".$this->cesta."'"); }
if(!dibi::query('INSERT INTO ['.self::TABLE_NAME.']', $arr)) { notification::infoBox_error("Při ukládání položky se vyskytla chyba"); }
else {
if ($this->typ == 1) { notification::infoBox_success("<br /><img src=\"/images-crop/30x30/".$this->cesta."/".$this->pomid."/".$arr["soubor"]."\"> Přidání položky: <strong>".$arr["soubor"]."</strong><br />"); }
if ($this->typ == 2) { notification::infoBox_success("Přidání položky: <strong>".$arr["soubor"]."</strong><br />"); }
$last_id = dibi::insertId();
notification::zaloguj("Přidání položky: <strong>".$arr["soubor"]."</strong>",$last_id,$this->adminID);
}
} else {notification::infoBox_error($this->chyba);}
} else {notification::infoBox_error($this->chyba);}
}
public function delete($redirectOnEnd = true) {
if(dibi::query("DELETE FROM [".self::TABLE_NAME."] WHERE id=".$this->id)) {
if (dibi::query("SELECT * FROM [".self::TABLE_NAME."] WHERE pomid = ".$this->pomid." AND cesta = '".$this->cesta."' AND typ = '".$this->typ."'")->count() > 0) {
dibi::query("UPDATE [".self::TABLE_NAME."] SET poradi = poradi - 1 WHERE pomid = ".$this->pomid." AND cesta = '".$this->cesta."' AND typ = '".$this->typ."' AND poradi > ".$this->poradi);
if ($this->hlavni == 1) { // pokud je smazana jako hlavni, nastavim hlavni na ten co je první v pořadí daného seznamu
dibi::query("UPDATE [".self::TABLE_NAME."] SET hlavni = 1 WHERE pomid = '".$this->pomid."' AND typ = '".$this->typ."' AND cesta = '".$this->cesta."' AND poradi = 1");
notification::infoBox("Smazaná fotografie byla označena jako hlavní.<br />Jako hlavní fotografie je nyní použita první fotografie ze seznamu");
}
}
if (file_exists(DATA_DIR.$this->cesta."/".$this->pomid."/".($this->typ == 1 ? "":"dokumenty/").$this->soubor)) { unlink($cesta); }
notification::infoBox_success("Položka <strong>".$this->soubor."</strong> byla smazána");
notification::zaloguj("Položka <strong>".$this->soubor."</strong> byla smazána",$this->id,$this->adminID);
} else { notification::infoBox_error("Při mazání položky z databáze se vyskytla chyba");}
if ($redirectOnEnd == true) { redirect(admin::returnBack()); }
}
protected function getChyba() { return $this->chyba; }
protected function checkData($data) {
if(array_key_exists("pomid",$data)) { if(intval($data['pomid']) > 0) { $this->pomid = intval($data['pomid']); }else { $this->chyba .= "pomid je v nesprávném formátu<br />"; return false; }}
if(array_key_exists("cesta",$data)) { if(trim(strip_tags($data['cesta'])) != "") { $this->cesta = trim(strip_tags($data['cesta'])); }else { $this->chyba .= "Cesta je v nesprávném formátu<br />"; return false;}}
if(array_key_exists("popis",$data)) {if(mb_strlen($data['popis']) <= $this->popis_limit) { $this->popis = trim(strip_tags($data['popis'])); }else { $this->chyba .= "Popis obsahuje více jak ".$this->popis_limit." znaků<br />"; return false; }}
if(array_key_exists("hlavni",$data)) {if($data['hlavni'] == 1) { $this->hlavni = 1; }else { $this->hlavni = null; }}
if(array_key_exists("typ",$data)) {if($data['typ'] == 1) { $this->typ = 1; }else { $this->typ = 2; }}
if(array_key_exists("soubor",$data)) {
if(mb_strlen($data['soubor']) <= $this->soubor_limit) {
if(trim($data['soubor']) != "") {
$pripona = end(explode(".", trim($data['soubor'])));
$soubor_jmeno = mb_substr(trim($data['soubor']),0, - mb_strlen($pripona) - 1);
$this->pripona = ".". mb_strtolower($pripona);
$this->soubor = mr_url($soubor_jmeno) . $this->pripona;
}
else {
if ($this->typ == 2) { $povoleneFormaty = implode(", ",$this->pripony_dokument); }
else { $povoleneFormaty = implode(", ",$this->pripony_foto); }
$this->chyba .= "Soubor je v nesprávném formátu<br /> Povolené formáty jsou: <strong>$povoleneFormaty</strong>";
return false;
}
$result = dibi::query("SELECT * FROM [".self::TABLE_NAME."] WHERE [soubor] = '".$this->soubor."' AND [cesta] = '".$this->cesta."' AND [typ] = '".$this->typ."' AND [pomid] = '".$this->pomid."'");
if($result->count() > 0 && $data['checkUnikatni'] != false) { $this->chyba .= "Zadaný název souboru (<strong>".$data['soubor']."</strong>) již existuje<br />"; return false; }
} else { $this->chyba .= "Soubor obsahuje více jak ".$this->soubor_limit." znaků<br />"; return false; }
}
return true;
}
static function getIco($pripona = "doc") { return "<img src=\"/images/fileicons/". str_replace(".","",strtolower($pripona)).".png\" alt=\"Soubor typu ".strtolower($pripona)."\" class='filetype' />"; }
static function vypisFotky($width,$height,$cesta,$pomid,$class = NULL,$notID = null) {
if ($class == null) { $class = "fotogalerie"; }
if ($notID != null) { $notID_sql = "AND id NOT IN ($notID)"; }
else {$notID_sql = "";}
$result = dibi::query("SELECT * FROM [files] WHERE cesta = %s AND pomid = %i AND typ = 1 ".$notID_sql." ORDER BY poradi ",$cesta,$pomid)->fetchAll();
if (count($result) > 0) {
@$output .= "\n<br /><div class=\"$class\">";
foreach($result as $n => $row) {
if ($row->popis != "") { $popis = $row->popis; } else {$popis = $row->soubor; }
$pomtrida = "";
if ($n % 3 == 0) { $pomtrida = " prvni"; }
$output .= "\n<a href=\"/data/$cesta/$pomid/foto/".$row->soubor."\" title=\"".$popis."\" class=\"fancybox thumbnail grouped_elements".$pomtrida."\" rel=\"group1\" id=\"single_image\">";
$output .= "<img src=\"/images-fit/".$width."x".$height."/$cesta/$pomid/".$row->soubor."\" alt=\"".$popis."\">";
$output .= "</a>";
}
$output .= "\n<div class=\"clear\"></div></div>";
return $output;
}
}
static function lastchange($cesta,$pomid) {
$caszmeny = dibi::query("SELECT MAX(caszmeny) FROM [files] WHERE cesta = %s AND pomid = %i",$cesta,$pomid)->fetchSingle();
$caszalozeni = dibi::query("SELECT MAX(caszalozeni) FROM [files] WHERE cesta = %s AND pomid = %i",$cesta,$pomid)->fetchSingle();
if ($caszalozeni > $caszmeny) { return $caszalozeni; }
else { return $caszmeny; }
}
static function vypisDokumenty($cesta,$pomid,$class = "tab-docs") {
$result = dibi::query("SELECT * FROM [files] WHERE cesta = %s AND pomid = %i AND typ = 2 ORDER BY poradi",$cesta,$pomid)->fetchAll();
if (count($result) > 0) {
@$output .= "\n<br /><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"$class\">";
foreach($result as $row) {
if ($row->popis != "") { $popis = $row->popis; } else {$popis = $row->soubor; }
$output .= "\n<tr>";
$output .= "<td class='file-tr'><a href=\"/download.html?id=".$row->id."\" title=\"otevřít: ".$popis."\" target=\"_blank\">".self::getIco($row->pripona)."</a></td>";
$output .= "<td>".$popis."</td><td width=\"80\">(".toVelikost($row->velikost).")</td>";
$output .= "<td width=\"80\" class=\"taright\"><a href=\"/download.html?id=".$row->id."\" title=\"otevřít: ".$popis."\" target=\"_blank\">stáhnout</a></td>";
$output .= "\n</tr>";
}
$output .= "\n</table>";
//$output .= "<a href=\"/download/$cesta/$pomid\">Stáhnout všechny soubory (.zip) »</a>";
return $output;
}
}
static function smazVse($cesta,$pomid) {
$result = dibi::query("SELECT soubor FROM [".self::TABLE_NAME."] WHERE cesta = %s AND pomid = %i",$cesta,$pomid);
foreach($result as $row) {
if ($row->typ == 1 && file_exists(DATA_DIR.$cesta."/".$pomid."/foto/".$row->soubor)) { unlink(DATA_DIR.$cesta."/".$pomid."/foto/".$row->soubor); }
elseif ($row->typ == 2 && file_exists(DATA_DIR.$cesta."/".$pomid."/dokumenty/".$row->soubor)) { unlink(DATA_DIR.$cesta."/".$pomid."/dokumenty/".$row->soubor); }
dibi::query("DELETE FROM [".self::TABLE_NAME."] WHERE cesta = %s AND pomid = %i",$cesta,$pomid);
}
}
static function vytvorZip($cesta,$pomid = 0) {
if ($pomid == 0) {die();}
$sql = "SELECT soubor FROM [files] WHERE cesta = %s AND pomid = %i AND typ = 2 ORDER BY poradi";
$files = dibi::query($sql,$cesta,$pomid)->fetchPairs();
$valid_files = array();
if(is_array($files)) {
foreach($files as $file) {
if(file_exists("./data/".$cesta."/".$pomid."/dokumenty/".$file)) {
$valid_files[] = $file;
}
}
}
if(count($valid_files)) {
$zip = new ZipArchive();
$res = $zip->open($cesta.".zip", ZipArchive::CREATE);
if ($res == TRUE) {
foreach($valid_files as $file) {
$zip->addFile($file,$file);
}
} else {
echo "nejebe to";
}
echo 'The zip archive contains ',$zip->numFiles,' files with a status of ',$zip->status;
$zip->close();
// header("Content-Type: application/zip");
// header("Content-Length: " . filesize($file));
// header("Content-Disposition: attachment; filename=\"a_zip_file.zip\"");
// readfile($file);
//
// unlink($file);
return file_exists("./data/download/".$cesta);
}
else
{
return false;
}
}
public static function vypis_search($co,$limit = null) {
$sql[]= "SELECT A.*
FROM [files] A
WHERE
(
A.soubor LIKE %~like~
OR A.popis LIKE %~like~
)
AND A.typ = 2
";
array_push($sql,$co,$co);
$pocetCelkem = count(\dibi::query($sql));
if ($limit != null) { array_push($sql," LIMIT 0, %i",$limit); }
$result = \dibi::query($sql);
$pom = "";
if (count($result) > 0) {
$pom = "\n<br /><table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"tab-docs\">";
foreach($result as $row) {
if ($row->popis != "") { $popis = $row->popis; } else {$popis = $row->soubor; }
$pom .= "\n<tr>";
$pom .= "<td class='file-tr'><a href=\"/download.html?id=".$row->id."\" title=\"otevřít: ".$popis."\" target=\"_blank\">".self::getIco($row->pripona)."</a></td>";
$pom .= "<td>".$popis."</td><td width=\"80\">(".toVelikost($row->velikost).")</td>";
$pom .= "<td width=\"80\" class=\"taright\"><a href=\"/download.html?id=".$row->id."\" title=\"otevřít: ".$popis."\" target=\"_blank\">stáhnout</a></td>";
$pom .= "\n</tr>";
}
$pom .= "\n</table>";
}
$output = array("html" => $pom, "count" => $pocetCelkem);
return $output;
}
}
ACC SHELL 2018