<?php 
require('../flowap/system.php');
switch($act) {
    default: 
    	$ids = functions::htmlred($_GET['url']); 
    	$blog = DB::$dbs->queryFetch('SELECT * FROM `blog` WHERE `urlt` = ? LIMIT 1', [$ids]);
	    if(empty($blog['id'])):
	        $_SESSION['err'] = 'Такого блога не существует.';
	        header('location: /'); exit;
	    endif;
    	$title->SetTitle($blog['name']);
    	$title->SetDescription(mb_substr(bbcode::notags($blog['message']), 0, 250, 'UTF-8'));
    	$title->GetHeader();
    	// запись просмотров
    	DB::$dbs->query('UPDATE `blog` SET `pros` = `pros` + 1 WHERE `id` = ? LIMIT 1',[$blog['id']]);
    	//
    	?>
		<div class="flowap3">
				<div class="fontniz">
					<div class="fontniz2" style="font-weight: 700;" title="кто написал"><?php echo functions::usvv($blog['idus']);?></div>
					<?php if(isset($user['id']) and $user['lvl'] == 100):?>
						<time onclick="klikz(<?php echo $blog['id'];?>);" class="fontniz2" style="float: right;" title="время блога">
							<i class="far fa-clock"></i> <?php echo functions::vremja($blog['time']);?>
							<div id="post_<?php echo $blog['id'];?>" class="post" style="display: none;">
								<a href="/my/read/<?php echo $blog['urlt'];?>/" class="linkpan"><i class="far fa-file-alt"></i>Изменить</a>
							</div>
						</time>						
					<?php else: ?>
						<time class="fontniz2" style="float: right;" title="время блога">
							<i class="far fa-clock"></i> <?php echo functions::vremja($blog['time']);?>
						</time>	
					<?php endif; ?>
				</div>
				<div class="bogess">
					<h1><?php echo $blog['name'];?></h1>
					<?php echo $bbcode->tags($blog['message']);?>
				</div>
				<?php
				if($blog['status'] == 1):
					$files = DB::$dbs->queryFetch('SELECT `size`,`gen`,`loads` FROM `files_blog` WHERE `idblog` = ? LIMIT 1', [$blog['id']]);
					?>
					<div class="fileviv">
						<a href="/lobf/<?php echo $files['gen'];?>/" class="buttonload">
							<div style="text-transform: uppercase;font-weight: 700;">Скачать <span style="">[<?php echo $files['loads'];?>]</span></div>
							<div style="font-size: 13px;color: #e6e0e0;"><?php echo functions::sizeraz($files['size']);?></div>
						</a>
					</div>
					<?php
				endif;
				?>
		</div>
		<?php $title->GetFooter();
	break;
}
?>