<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=index.tags
[END_COT_EXT]
==================== */

defined('COT_CODE') or die('Wrong URL');

require_once cot_incfile('page', 'module');

$sqllistpages = $db->query("SELECT p.*, u.* FROM $db_pages as p
		LEFT JOIN $db_users AS u ON u.user_id=p.page_ownerid
    WHERE page_state=0 AND page_cat='system'
		ORDER BY page_date DESC LIMIT 1")->fetchAll();

$jj=0;
foreach ($sqllistpages as $pag)
{
	$jj++;
	$t->assign(cot_generate_pagetags($pag, 'LIST_ROW_', 150, $usr['isadmin']));
  $t->assign(cot_generate_usertags($pag, 'LIST_ROW_OWNER_'));

  $t->parse('MAIN.PAGE_LIST_SYSTEM');
}

$t->assign('PAGE_LIST_SYSTEM_CNT', $jj);

$sqllistpages = $db->query("SELECT p.*, u.* FROM $db_pages as p
		LEFT JOIN $db_users AS u ON u.user_id=p.page_ownerid
    WHERE page_state=0 AND page_cat='news'
		ORDER BY page_date DESC LIMIT 5")->fetchAll();

$jj=0;
foreach ($sqllistpages as $pag)
{
	$jj++;
	$t->assign(cot_generate_pagetags($pag, 'LIST_ROW_', 150, $usr['isadmin']));
  $t->assign(cot_generate_usertags($pag, 'LIST_ROW_OWNER_'));

	$t->parse('MAIN.PAGE_LIST_ROW');
  $t->parse('MAIN.PAGE_LIST_ROW_PC');
}

$t->assign('PAGE_LIST_NEWS_CNT', $jj);