foreach ($md['producer'] as $val => $one) { break; } $link = $link . '&m=:producer.' . $val . ':1'; } else { if ($md['search']) { $val = $md['search']; $link = $link . '&m=:search:' . $val; } } } unset($ans['md']); unset($ans['m']); $ans['external'] = '*catalog/seo.json'; $ans['canonical'] = infra_view_getPath() . '?' . $link; return infra_ans($ans); } infra_cache_no(); if (isset($_GET['p'])) { $ans['page'] = (int) $_GET['p']; if ($ans['page'] < 1) { $ans['page'] = 1; } } else { $ans['page'] = 1; } $args = array($md, $ans['page']); $re = isset($_GET['re']); if (!$re) { if ($ans['page'] != 1) { $re = true;
$data['description'] = 'Новостная лента сайта ' . $_SERVER['HTTP_HOST']; } $data['time'] = infra_admin_time(); $data['link'] = 'http://' . infra_view_getHost() . '/' . infra_view_getRoot(); $conf = infra_config(); $exts = array('docx', 'tpl', 'mht', 'html'); $files = $conf['files']; $folders = array(array('dir' => $files['folder_blog'], 'link' => '?Блог/'), array('dir' => $files['folder_events'], 'link' => '?События/'), array('dir' => $files['folder_pages'], 'link' => '?')); $items = array(); infra_forr($folders, function ($fold) use($exts, &$items) { if (!$fold['dir']) { return; } $ar = files_list($fold['dir'], 0, 100, $exts); if (!$ar) { return; } $ar = array_values($ar); infra_forr($ar, function (&$itm) use($fold) { $itm = array("title" => strip_tags($itm['title']), "link" => $itm['link'], "description" => strip_tags($itm['preview']), "pubDate" => $itm['date'], "link" => $fold['link'] . $itm['name']); }); $items = array_merge($items, $ar); }); usort($items, function ($i, $j) { if ($i['pubDate'] < $j['pubDate']) { return 1; } }); $data['items'] = $items; return infra_ans($data);