<?php

	# author Drk in

	require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );

	$id =  isset( $_GET['id'] ) ? abs(intval($_GET['id'])): 0;

	$act = DB :: $dbh -> queryFetch("SELECT CK FROM `user` WHERE `id`=? LIMIT 1;", array($id));  
	
	$act = cache_user::check($act['CK']);

	if (cache_user::ch($act['CK']) == false)system::header('/admin/users','Ошибка ID не найден');

	# meta

	$title = 'Пользователи - Сайты - '.system::check($act['login']);
	$description = system::check($config['description']);
	$keywords = system::check($config['keywords']);
	$tl = 'Пользователи - Сайты - '.system::check($act['login']);

	# admin

	system::adm();

	# head

	require_once ( head );

	$cn = DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE user = ?", array($id));	

	if($cn == 0)echo '<div class="err">Cписок пуст!</div>';

	$page = new page($cn);

	$limit = $cn > $page -> elements ? $page -> limit : null;

	$query = DB :: $dbh -> query("SELECT id FROM platforms WHERE user = ? ORDER BY time DESC {$limit}", array($id));	

	while ($act = $query -> fetch()):

	$act = cache_pf::check($act['id']);

	echo '
	<div class="touch"><img src="'.save_img::fav($act['url']).'"> 
	<strong>'.system::check($act['url']).'</strong>
	[ID: '.$act['id'].' | ID USER: '.$act['user'].' | '.($act['ban'] == 1 ? '<font color="red">БАН</font>':''.($act['mode'] == 0 ? '<font color="green">Активен</font>':'<font color="red">Модерация</font>').'').'
	| '.($act['ch'] == 1 ? '<font color="red">Счетчик не найден</font>':'<font color="green">Счетчик найден</font>').']
	<br> 
	<a href ="'.site.'admin/platforms/edit/id'.$act['id'].'">Изменить</a> |
	'.($act['ban'] == 1 ? '<a href ="'.site.'admin/platforms/ban/id'.$act['id'].'">Разблокировать</a>':'<a href ="'.site.'admin/platforms/ban/id'.$act['id'].'">Заблокировать</a>').' |
	'.($act['mode'] == 1 ? '<a href ="'.site.'admin/platforms/mod/id'.$act['id'].'">Активен</a>':'<a href ="'.site.'admin/platforms/mod/id'.$act['id'].'">Модерация</a>').' |
	<a href ="'.site.'admin/platforms/check/id'.$act['id'].'">Проверить счетчик</a> 
	</div>
	';	

	endwhile;	
	
	$page -> get('?');

	echo '
	
	<a href="'.site.'admin/users" class="touch">« Назад</a>';

	# foot

	require_once ( foot ) ;
?>