<?php

	# mark core  v1.0
    # author Drk in
	# date 24.10.19 	

	# core

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

	$s =  isset( $_GET['s'] ) ? system::abs($_GET['s']): 0;

	# meta

	$title = 'Сайты » Мобильные WAP сайты';
	$description = system::check($config['description']);
	$keywords = system::check($config['keywords']);
	$tl = 'Сайты';
	
	# adm

	system::adm();

	# head

	require_once ( head );

	echo '<div class ="touch"> <a href ="?"> Все</a> | <a href ="?&s=5"> Новые</a> | <a href ="?&s=1"> Активные</a> |  <a href ="?&s=2"> На модерации</a>  |  <a href ="?&s=3"> Заблокированные</a> |  <a href ="?&s=4"> Нет счетчика</a></div>';

	if ($s == 1)$sr = 'WHERE mode = 0 AND  ban = 0'; 
	if ($s == 2)$sr = 'WHERE mode = 1'; 
	if ($s == 3)$sr = 'WHERE ban = 1';
	if ($s == 4)$sr = 'WHERE ch = 1';
	if ($s == 5)$sr = 'WHERE time > '.time().' - 86400';
	if ($s == 0)$sr =  null;

	$cn = DB :: $dbh -> querySingle("SELECT count(id) FROM platforms {$sr} ");	

	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 {$sr} ORDER BY id  {$limit}");

	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($s == 0 ? '?':'?&s='.$s.'&');

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

	# foot

	require_once ( foot ) ;
?>