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); return Ans::ret($ans);
public static function article($src) { return Cache::exec(array($src), __FILE__, function ($src) { $html = Load::loadTEXT('-doc/get.php?src=' . $src); $info = Load::srcInfo($src); if (!in_array($info['ext'], array('html', 'tpl', 'php'))) { $soft = true; } else { $soft = false; } return Rubrics::parse($html, $soft); }, array($src), isset($_GET['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);
function rub_article($src) { return Rubrics::article($src); }
//@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; } else {
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);