$ans['breadcrumbs'][sizeof($ans['breadcrumbs']) - 1]['active'] = true; if (!$group['path']) { $ans['breadcrumbs'][] = array('href' => 'producers', 'title' => 'Производители'); } } } Catalog::sort($ans['list'], $md); //Numbers $pages = ceil(sizeof($ans['list']) / $md['count']); if ($pages < $page) { $page = $pages; } $ans['numbers'] = Catalog::numbers($page, $pages, 11); $ans['list'] = array_slice($ans['list'], ($page - 1) * $md['count'], $md['count']); //Text $src = Rubrics::find($conf['dir'] . 'articles/', $ans['title']); if ($src) { $ans['textinfo'] = Rubrics::info($src); $ans['text'] = Load::loadTEXT('-doc/get.php?src=' . $src); //Изменение текста не отражается как изменение каталога, должно быть вне кэша } foreach ($ans['list'] as $k => $pos) { $pos = Catalog::getPos($pos); $group = Catalog::getGroup($pos['group']); $pos['descr'] = $group['descr']; unset($pos['texts']); unset($pos['files']); $ans['list'][$k] = $pos; } return $ans; }, $args, $re);
$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);
public static function findImages($dir, $id) { return Rubrics::find($dir, $id, 'images'); }
} 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 { //echo View::getPath().$dir.$res['file']; //exit; @header('location: ' . View::getPath() . $dir . $res['file']); } exit;