View file plugins/smiles/dir.php

File size: 1.7Kb
<?php
require( '../../sys/inc/core.php' );
if ( isset( $_GET['id'] ) ) {
    $id = intval( $_GET['id'] );
} else {
    header( "Location: /index.php" );
}
$dir = db::fetch("SELECT * FROM `smile_dir` WHERE `id` = '" . $id . "'", ARRAY_N);
if ( !$dir['id'] )
    header( "Location: /index.php" );
$set['title'] = text( $dir['name'] ) . ' | Список смайлов';
include_once H . 'sys/inc/thead.php';
title();
aut();
?>
<div class="foot">
<img src="/style/icons/str2.gif" alt="*"> <a href="index.php">Категории</a> | <b><?= text( $dir['name'] ) ?></b>
</div>
<?php
$k_post = db::count("SELECT COUNT(*) FROM `smile` WHERE `dir` = '$id'");
$k_page = k_page( $k_post, $set['p_str'] );
$page   = page( $k_page );
$start  = $set['p_str'] * $page - $set['p_str'];
?><table class="post"><?php
if ( $k_post == 0 ) {
?><div class="mess">Список смайлов пуст</div><?php
}
$q = db::query("SELECT * FROM `smile` WHERE `dir` = '$id' ORDER BY `id` ASC LIMIT $start, $set[p_str]");
while ( $post =  $q->fetch_array() ) {
    echo '<div class="' . ( $num % 2 ? "nav1" : "nav2" ) . '">';
    $num++;
?>
	<img src="/style/smiles/<?= $post['id'] ?>.gif" alt="<?= $post['name'] ?>"/> <?= text( $post['smile'] ) ?>
	</div>
	<?php
}
if ( $k_page > 1 )
    str( 'dir.php?id=' . $id . '&amp;', $k_page, $page );
if ( isset( $user ) && $user['level'] > 3 ) {
?>
	<div class="foot">
	<img src="/style/icons/str.gif" alt="*"> <a href="/adm_panel/smiles.php">Админка</a>
	</div>
	<?php
}
?>
<div class="foot">
<img src="/style/icons/str2.gif" alt="*"> <a href="index.php">Категории</a> | <b><?= text( $dir['name'] ) ?></b>
</div>
<?php
include_once H . 'sys/inc/tfoot.php';
?>