$ans['order'] = $order; $list = Access::cache(__FILE__, function ($dir, $order) { $list = array(); array_map(function ($file) use(&$list, $dir) { if ($file[0] == '.') { return; } $file = Path::toutf($file); if (!Path::theme($dir . $file)) { return; } $fd = Load::nameInfo($file); if (!in_array($fd['ext'], array('jpg', 'png'))) { return; } $slide = $fd; $slide['title'] = $fd['name']; $src = Rubrics::find($dir, $fd['name'], 'articles'); if ($src) { $slide['title'] = Rubrics::article($src); } $list[] = $slide; }, scandir(Path::theme($dir))); Load::sort($list, $order); //$list = array_reverse($list); return $list; }, array($dir, $order)); $list = array_slice($list, $start, $count); $ans['dir'] = $dir; $ans['list'] = $list; return Ans::ret($ans);
$res = rub_search($dir, $id, $exts); if (isset($_GET['image'])) { if ($res['images']) { $data = file_get_contents(Path::tofs($res['images'][0]['src'])); echo $data; } else { //@header('HTTP/1.1 404 Not Found'); } return; } elseif (isset($_GET['show'])) { if (!$res) { header("HTTP/1.0 404 Not Found"); return; } else { $src = $dir . $res['file']; $text = Rubrics::article($src); echo $text; return; } } elseif (isset($_GET['gallery'])) { $src = Rubrics::find($dir, $id); $info = Rubrics::info($src); $ans['info'] = $info; return Ans::ret($ans); } elseif (isset($_GET['load'])) { if (!$res) { //@header("Status: 404 Not Found"); //@header("HTTP/1.0 404 Not Found"); @header('location: ' . View::getPath() . '?' . $type . '/' . $id); //Просто редирект на страницу со списокм всех файлов } else {
function rub_article($src) { return Rubrics::article($src); }
return; } //Скрытый файл Word if (!is_file(Path::theme($dir) . $file)) { return; } $fd = Load::nameinfo($file); if (!in_array($fd['ext'], array('docx', 'html', 'tpl'))) { return; } $list[] = Rubrics::info(Path::toutf($dir . $file)); }, scandir(Path::theme($dir))); Load::sort($list); return $list; }, array($dir)); $list = array_slice($list, $start, $count); $ans['list'] = $list; } else { if ($type == 'page') { if ($type == 'page') { $id = Ans::GET('id'); } if (!$id) { return Ans::err($ans, 'Для type=page необходимо указать id страницы'); } $src = Rubrics::find($dir, $id); $ans['info'] = Rubrics::info($src); $ans['text'] = Rubrics::article($src); } } return Ans::ret($ans);