Current Path : /data/web/virtuals/51568/virtual/www/www/ |
Current File : /data/web/virtuals/51568/virtual/www/www/casopis.php |
<?php $pathCasopis = '../www/ftp/casopis/'; $dirsCasopis = zjistiSlozky($pathCasopis); echo zobrazSlozky($dirsCasopis); function zjistiSlozky($path) { $files = scandir($path); $dirs = []; foreach ($files as $file) { if (is_dir($path . $file) && ($file !== '.') && ($file !== '..')) { $dirs[] = $file; } } rsort($dirs); return $dirs; } function zobrazSlozky($dirs) { if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on') {$url = 'https://'; } else {$url = 'http://';} $url.= $_SERVER['HTTP_HOST']."/index.php?m=www/casopiscislo.php&c="; $html = <<<HTML Zveřejněná čísla: <div class="d-flex border-top mt-1" style="font-size: 1rem;"> HTML; foreach($dirs as $dir) { $cesta = $url . $dir; $html .= <<<HTML <!-- <div class="mr-3"><a href="{$cesta}">{$dir}</a></div> --> <div class="mr-3 article-nadpis font-weight-bold"><span style="cursor: pointer;" onclick="zobrazCasopis('{$dir}')">{$dir}</span></div> HTML; } $html .= <<<HTML </div> HTML; return $html; }