Размер файла: 4.23Kb
<?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_news = load_lng('news');
head(''.$lng_news['1_1'].'');
echo'<div class="hdr"><b><a href="index.php">'.$lng_news['1_1'].'</a></b></div>';
if(isset($user) && $user['level']>=6 && isset($_POST['msg']) && isset($_POST['title']))
{
$title = stripslashes(htmlspecialchars(trim($_POST['title'])));
$msg = stripslashes(htmlspecialchars(trim($_POST['msg'])));
$link = stripslashes(htmlspecialchars(trim($_POST['link'])));
$ch=intval($_POST['ch']);
$mn=intval($_POST['mn']);
$main_time=$time+$ch*$mn*60*60*24;
if ($main_time<=$time)
$main_time=0;
if(mb_strlen($title)<4)
{
$err[] = '<div class="errmenu">'.$lng_news['1_11'].'(min 4)</div>';
}
if(mb_strlen($title)>32)
{
$err[] = '<div class="errmenu">'.$lng_news['1_12'].'(max 32)</div>';
}
if(mb_strlen($msg)<8)
{
$err[] = '<div class="errmenu">'.$lng_news['1_13'].'(min 8)</div>';
}
if(mb_strlen($msg)>1024)
{
$err[] = '<div class="errmenu">'.$lng_news['1_14'].'(max 1024)</div>';
}
if(!isset($err))
{
$msg1="[b]".$user['login']."[/b] ".$lng_news['1_17']." [url=/modules/news]»[/url]";
mysql_query("INSERT INTO `news` (`msg`, `time`, `title`, `link`, `maintime`) values('$msg', '$time', '$title', '$link', '$main_time')");
msg('<div class="menu">'.$lng_news['1_10'].'</div>');}
err();
}
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `news`"),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_news['1_9'].'';
echo'</div>';}
$n = 1;
$q=mysql_query("SELECT * FROM `news` ORDER BY id DESC LIMIT $start, $set[p_count] ");
while ($post = mysql_fetch_array($q))
{
$k_p=mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `id_news` = '$post[id]'"), 0);
$k_n= mysql_result(mysql_query("SELECT COUNT(*) FROM `news_komm` WHERE `time` > '".($time-86400)."' AND `id_news` = '$post[id]'"), 0);
if ($k_n==0)$k_n=NULL;
else $k_n='/<span style="color:red;">+'.$k_n.'</span>';
$counter = "[$k_p$k_n]";
echo'<div class="menu"><img src="/images/icons/news.gif" alt="'.$lng_news['1_1'].'" /> '.$post['title'].' ('.timef($post['time']).')';
if (isset($user) && $user['level']>=6){
echo'<a href="delete.php?id='.$post['id'].'">[X]</a>';}
echo'<br/>'.post($post['msg']).'';
if ($post['link']!=NULL)
echo'<br/><a href="http://'.htmlentities($post['link'], ENT_QUOTES, 'UTF-8').'">'.$lng_news['1_8'].'</a>';
echo'<br/><a href="komm.php?id='.$post['id'].'">'.$lng['1_52'].'</a>'.$counter;
echo'</div>';}
if ($k_page>1)str('?',$k_page,$page); // გვერდების გამოტანა
if (isset($user) && $user['level']>=6)
{
echo'<div class="egmenu">';
echo'<a href="index.php?write">'.$lng_news['1_2'].'</a>';
if (isset($_GET['write']))
{
echo'<form method="POST" action="index.php">
'.$lng_news['1_3'].':<br/><input type="text" name="title" value="" maxlength="32" /><br/>
'.$lng_news['1_4'].':<br/><textarea name="msg" maxlength="1024"></textarea><br/>
'.$lng_news['1_5'].'(http://'.$lng['1_9'].')*:<br/><input type="text" name="link" value="" maxlength="64" /><br/>
'.$lng_news['1_6'].':<br/>
<input type="text" name="ch" size="3" value="1" />
<select name="mn">
<option value="0" selected="selected"></option>
<option value="1">'.$lng['1_5'].'</option>
<option value="7">'.$lng['1_6'].'</option>
<option value="31">'.$lng['1_7'].'</option>
</select><br/>
<input type="submit" name="save" value="'.$lng['1_8'].'" /></form>';
echo'* '.$lng_news['1_7'].'';}
echo'</div>';}
require $root_path.'includes/end.php'; // დასასრული
?>