Exemplo n.º 1
0
    chdir('../');
    require_once 'vendor/autoload.php';
    Router::init();
}
$ans = array();
$lim = Ans::GET('lim', 'string', '0,100');
$p = explode(',', $lim);
if (sizeof($p) != 2) {
    return Ans::err($ans, 'Некорректный параметр lim');
}
list($start, $count) = $p;
$dir = Ans::GET('src', 'string');
if (!$dir) {
    return Ans::err($ans, 'Укажите обязательный параметр src');
}
if (!Path::isNest('~', $dir)) {
    return Ans::err($ans, 'Указан небезопасный путь src');
}
$order = Ans::GET('order', ['descending', 'ascending']);
$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);
Exemplo n.º 2
0
use infrajs\path\Path;
use infrajs\config\Config;
use infrajs\ans\Ans;
use infrajs\view\View;
use infrajs\router\Router;
use infrajs\rubrics\Rubrics;
if (!is_file('vendor/autoload.php')) {
    chdir('../../../');
    require_once 'vendor/autoload.php';
    Router::init();
}
$ans = array();
$src = Ans::GET('src');
if ($src) {
    if (!Path::isNest('~', $src)) {
        return Ans::err($ans, 'Передан некорректный или небезопасный путь');
    }
    $id = Ans::GET('id');
    $src = Rubrics::find($src, $id);
    $text = Rubrics::article($src);
    return Ans::html($text);
}
$conf = Config::get('rubrics');
$type = Path::toutf($_GET['type']);
/*
	type два смысла.. type blog - имя рубрики и type list то как отображается всё
*/
if (empty($conf['list'][$type])) {
    return Ans::err($ans, 'Undefined type ' . $type);
}