Просмотр файла modules/smiles/index.php

Размер файла: 3.8Kb
<?php
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
// Sitchi CMS - Mobile Content Management System //
// The author:  Nikoloz Sitchinava [sitchi]      //
// Link:        http://sitchicms.num.ge          //
// Skype:       SitchiCMS                        //
// License:     LICENSE.txt (see attached file)  //
// Version:     VERSION.txt (see attached file)  //
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
define('_SITCHICMS', 1);
$root_path='../../'; 
require $root_path.'includes/db_connect.php';
require $root_path.'includes/start.php';
require $root_path.'includes/header.php';
require $root_path.'includes/functions.php';
require $root_path.'includes/head.php'; // თავი
$lng_smiles = load_lng('smiles');
if (!isset($_GET['act']))$_GET['act']='';
$act=htmlspecialchars(trim($_GET['act']));
switch ($act) 
{
/**განყოფილებების ჩვენება**/
default:
head(''.$lng['1_48'].' | '.$set['title']);
echo'<div class="hdr"><b>'.$lng['1_48'].'</b></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `smiles_dir`"),0);
$k_page = k_page($k_post,$set['p_count']);
$page = page($k_page);
$start = $set['p_count']*$page-$set['p_count'];
if($k_post==0)
{
echo'<div class="errmenu">';
echo''.$lng_smiles['1_1'].'.';
echo'</div>';
}
$q=mysql_query("SELECT * FROM `smiles_dir` ORDER BY `id` ASC LIMIT $start, $set[p_count]");
while($post = mysql_fetch_array($q))
{
$smile = mysql_result(mysql_query("SELECT COUNT(*) FROM `smiles_list` WHERE `id_dir` = '$post[id]'"),0);
echo'<div class="menu">';
echo'<a href="?act=view_dir&amp;id_dir='.$post['id'].'">'.mres(stripcslashes(htmlspecialchars($post['name']))).'</a> ['.$smile.']<br/>';
echo'</div>';
}
if($k_page>1){str('?',$k_page,$page);}
if (isset($user) && $user['level']>=8){
echo'<a href="create.php?act=create_dir">'.$lng_smiles['1_2'].'</a><br/>';}
break;
/**სმაილები**/
case 'view_dir':
if (isset($_GET['id_dir']) && is_numeric($_GET['id_dir']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `smiles_dir` WHERE `id` = '".intval($_GET['id_dir'])."' LIMIT 1",$dblink), 0)==1)
{
$id_dir=intval(abs($_GET['id_dir']));
$dir = mysql_fetch_assoc(mysql_query("SELECT * FROM `smiles_dir` WHERE `id` = '".$id_dir."' LIMIT 1"));
}else{
header("Location: index.php?".SID);
}
head(''.$lng['1_48'].' | '.$dir['name']);
echo'<div class="hdr"><b><a href="index.php">'.$lng['1_48'].'</a> | '.$dir['name'].'</b></div>';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `smiles_list` WHERE `id_dir` = '$dir[id]'"),0);
$k_page = k_page($k_post,$set['p_count']);
$page = page($k_page);
$start = $set['p_count']*$page-$set['p_count'];
if($k_post==0)
{
echo'<div class="errmenu">';
echo''.$lng_smiles['1_3'].'';
echo'</div>';
}
$q=mysql_query("SELECT * FROM `smiles_list` WHERE `id_dir` = '$dir[id]' ORDER BY `id` ASC LIMIT $start, $set[p_count]");
while($post = mysql_fetch_array($q))
{
echo'<div class="menu"><img src="/files/smiles/'.$post['name'].'.gif" alt="'.$post['name'].'"/>&nbsp;&#187;&nbsp;'.$post['sim'];if (isset($user) && $user['level']>=6){echo'<a href="delete.php?act=delete_smile&amp;id_smile='.$post['id'].'">[X]</a>';}
echo'</div>';
}
if($k_page>1){str('?act=view_dir&amp;id_dir='.$dir['id'].'&amp;',$k_page,$page);}
if (isset($user) && $user['level']>=6){
echo'<a href="create.php?act=create_smile&amp;id_dir='.$dir['id'].'">'.$lng_smiles['1_4'].'</a><br/>';}
if (isset($user) && $user['level']>=8){
echo'<a href="delete.php?act=delete_dir&amp;id_dir='.$dir['id'].'">'.$lng_smiles['1_5'].'</a><br/>';}
echo'<a href="/modules/smiles/"> '.$lng['1_48'].'</a>';
break;
}
if (isset($_SERVER['HTTP_REFERER']))
echo'<a href="'.htmlspecialchars($_SERVER['HTTP_REFERER']).'"> '.$lng['1_50'].' </a>';
require $root_path.'includes/end.php'; // დასასრული
?>