} $aPosts = array(); while ($row = mysql_fetch_assoc($sql)) { $aPosts[] = $row; } if (empty($aPosts)) { $_t->assign('ContentBlock', 'Больше записей нет'); } $tplBlog = new KTemplate(FLGR_TEMPLATES . '/blog.htm'); $tplPost = $tplBlog->fetchBlock('post'); foreach ($aPosts as $k => $v) { $tplPost->assign('link', $v['id']); $tplPost->assign('title', $v['title']); // dbg($sape_context); $tplPost->assign('text', crbr($sape_context->replace_in_text_segment($v['text']))); $tplPost->assign('t', str_replace(' ', ' ', date_humanize($v['t']))); $tplPost->assign('comments', nGetCountComments_FromPostId($v['id'])); $_t->assign('ContentBlock', $tplPost); $tplPost->reset(); } $sql = 'SELECT count(*) FROM `' . DB_PREFIX . DB_TBL_POSTS . '`'; $sql = mysql_query($sql); if (false == $sql) { my_die(); } $nCountPost = current(mysql_fetch_assoc($sql)); $tplPrevNext = $tplBlog->fetchBlock('prev_next'); if ($nCountPost > $nStart + POST_PER_PAGE) { $tplPrev = $tplPrevNext->fetchBlock('block_prev'); $tplPrev->assign('prev', $nStart + POST_PER_PAGE); $tplPrevNext->assign('block_prev', $tplPrev);
$tpl->assign('content', $tplBlog->fetchBlock('post_comment_top')); } else { $tpl->assign('content', '<center><small>Зарегистрируйтесь или войдите чтобы оставить комментарий</small><center><br />'); } global $aTree; $aTree = $aComments; global $aOutTree; $aOutTree = array(); foreach ($aComments as $k => $v) { if ($v['parent'] == 0) { DendroId($v['id'], array()); } } foreach ($aOutTree as $v) { $v['text'] = str_replace('<br /><br />', '<br />', normalize($v['text'])); $v['t'] = str_replace(' ', ' ', date_humanize($v['t'])); $v['level'] = count($v['level']) * 20 - 20; $v['user'] = $Permissions->getUserNameFromId($v['user']); $tplComment = $tplBlog->fetchBlock('comment'); $tplComment->assign($v); if ($Permissions->bIsAdmin()) { $tplComment->assign('if_admin', '<a href="/commentedit/' . $v['id'] . '">' . '<img src="/img/edit.gif">' . '</a> '); $tplComment->assign('if_admin', '<a href="/commentdel/' . $v['id'] . '">' . '<img src="/img/del.gif">' . '</a> '); } else { $tplComment->assign('if_admin', ''); } if (isset($_SESSION['user'])) { $tplIsLogged = $tplComment->fetchBlock('is_logged'); $tplIsLogged->assign('id', $v['id']); $tplComment->assign('is_logged', $tplIsLogged); $tplIsLogged->reset();
$aStat[$k]['query'] = convert_cyr_string($aStat[$k]['query'], 'k', 'w'); } } elseif ('vkontakte.ru' == trim($aStat[$k]['host'])) { $aStat[$k]['icon'] = '<img src="/img/search/vkontakte.ru.gif" border="0" />'; $aStat[$k]['from'] = urldecode($aStat[$k]['from']); } if (isset($aStat[$k]['query']) && !isCorrectText($aStat[$k]['query'])) { $aStat[$k]['query'] = utf_to_cp1251($aStat[$k]['query']); } } else { // нет GET-параметров // ... } } $tplStatSearch = new KTemplate(FLGR_CMS_TEMPLATES . '/stat.search.htm'); foreach ($aStat as $k => $v) { /* dbg($v); */ $tplStatElt = $tplStatSearch->fetchBlock('stat_elt'); $v['t'] = date_humanize($v['t']); if (!isset($v['icon'])) { $v['icon'] = $v['host']; } if (!isset($v['query'])) { $v['query'] = $v['from']; } $tplStatElt->assign($v); $tplStatSearch->assign('stat_elt', $tplStatElt); $tplStatElt->reset(); } $_t->assign('content', $tplStatSearch); $_t->assign('BreadCrumbs', $BreadCrumbs->getBreadCrumbs());