Размер файла: 6.8Kb
<?php
#********************************** AgS MOD DOWNLOAD CENTR SEA *************************************#
#***************************************************************************************************#
# /||||||||||||||| ********************* /||||||||||||||| ********************* /||||||||||||||| #
# | ||||||||||||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | |||||/////||||| ********************* | |||||///////// ********************* | |||||///////// #
# | ||||| | ||||| ****** E-MAIL ******* | ||||| ****** WAP/WEB ****** | ||||| #
# | ||||| | ||||| *** [email protected] *** | ||||| * http://ags.h2m.ru * | ||||||||||||||| #
# | ||||| | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# | ||||| | ||||| ********************* | |||||/////||||| ********************* |///////////||||| #
# | ||||||||||||||| ****** SKYPE ******** | ||||| | ||||| ***** MOD AUTHOR **** | ||||| #
# | |||||////|||||| ***** agrizz15 ****** | ||||| | ||||| ***** Agris Cišs **** /||||||||||||||| #
# | ||||| | ||||| ********************* | ||||||||||||||| ********************* | ||||||||||||||| #
# |///// |///// ********************* |/////////////// ********************* |/////////////// #
#***************************************************************************************************#
#********************************* MOD by AgS in 2010 @ LATVIA *************************************#
require_once"system/start.php";
require_once"system/config.php";
require_once"system/db.php";
require_once"system/head.php";
require_once"lng/$setup[lng]/lng.php";
require_once"system/functions.php";
require_once"system/cookies.php";
require_once"system/counter.php";
include_once"thm/$setup[thm]/index.php";
include_once"system/msg.php";
/* Pārbaudam komentēšanas iespēju */
if($setup['modulis_komentari']){
/* Datu pārbaude */
$id = intval($_GET['id']);
$page = intval($_GET['page']);
$onpage = iegut_sesiju('onpage');
ir_numurs($onpage,'onpage');
/* Faila info */
$file_info_real = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'faili` WHERE id = '.$id));
/* Pārbaudam faila esamību */
if(!is_file ($file_info_real['path'])) die(com_001.'</body></html>');
/* Iegūstam komentārus */
$query = mysql_query('SELECT * FROM `'.$MY_pre.'komentari` WHERE `file_id` = '.$id.' ORDER BY `time` DESC');
while($list_sw = mysql_fetch_array($query)){
$array_id[] = $list_sw['id'];}
/* Apstrādājam info */
$all = sizeof($array_id); ## visi komentāri
$filepath = pathinfo($file_info_real['path']); ## faila mape
$namefile = $filepath[basename]; ## faila vārds
/* Iegūstam vārdu un mapi atpakaļadresei */
$dir = $filepath[dirname].'/';
$back = mysql_fetch_array(mysql_query("SELECT * FROM `".$MY_pre."faili` WHERE `path` = '".$dir."'"));
/* Ieraksts komentāros */
if($_GET['act']=='add'){
/* Kļūdu pārbaude */
$error = null;
if(!$_POST['msg']) $error .= com_002.'<br>';
if(mb_strlen($_POST['msg'])<4) $error .= com_003.'<br>';
if(empty($file_info_real['loads'])) $error .= com_004.'<br>';
/* Apstrādājam rakstītos datus */
$_POST['msg'] = bb_kods(smaidinji(tirit(dzest(mb_substr($_POST['msg'],0,255)))));
//$_POST['name'] = $log;
$currtime = time();
$tr = mysql_query("SELECT * FROM `".$MY_pre."komentari` WHERE `text` = '".$_POST['msg']."'");
/* Anti-spam */
if(mysql_fetch_row($tr)) $error .= com_005.'<br>';
/* Ja nav kļūdu, tad rakstam DB */
if($error) die('<div class="b">'.$error.'</div></body></html>');
mysql_query("INSERT INTO `".$MY_pre."komentari` (`file_id`, `name`, `text`, `time`, `ip`, `brow`) VALUES ('".$id."', '".$_POST['log']."', '".$_POST['msg']."' , '".$currtime."' , '".$ip."' , '".$brow."');");
echo '<div class="b">'.com_006.'</div>';
echo '<img src="pic/main/dot.gif" alt=""> <a href="komm.php?onpage='.$onpage.'&id='.$id.'&'.SID.'">'.sys_coms.'</a><br>';
/* Pašu komentāru izavade */
}else{
/* Nosaukums */
echo'<img src="pic/main/comments.gif" alt=""><b> '.com_008.' '.$namefile.'</b><br><br>';
/* Lapu izvade */
$n = 0;
$pages = ceil($all/$onpage);
if($page>$pages or $page<=0) $page=1;
if(!$pages) $pages = 1;
if($page) $n = ($onpage*$page)-$onpage;
/* Ja fails vēl nav komentēts */
if(!$all){ echo '<div class="b">'.com_009.'</div>';
}
/* Komentāru izvade */
for($i=1; $i<=$onpage; $i++){
if(!isset($array_id[$n])){
$n++;
continue;
}
/* Datu iegūšana un apstrāde */
$row = '<div class="b">'; ## Stils
$komments = mysql_fetch_array(mysql_query('SELECT * FROM `'.$MY_pre.'komentari` WHERE `id` = '.$array_id[$n]));
$komments['time'] = date('d.m.Y/H:i', $komments['time']); ## Laiks
$komments['text'] = str_replace("\n", '<br>',$komments['text']); ## Teksts
/* Izvade */
echo $row ; ## Stils
echo '<b>'.$komments['name'].'</b> <small>('.$komments['time'].')</small><br>'.$komments['text'].'<br>';
echo '<font color="#CC00CC"><small>('.$komments['ip'].', '.$komments['brow'].')</small></font></div><br>';
$n++;
}
/* Forma komentāru rakstīšanai */
echo '<br><br><form action="komm.php?act=add&id='.$id.'" method="post">'.sys_nick.':<br>
<input name="log" maxlength="25" /><br>';
echo com_011.':<br>';
echo '<textarea cols="25" rows="3" name="msg" maxlength="256"></textarea><br><br>';
echo '<input type="submit" value="'.com_012.'"></form>';
/* Lapu izvade */
if($all > 1) {
echo '<br>'.sys_pages.': ';
$asd = $page - 2;
$asd2 = $page + 3;
if($asd<$all && $asd>0 && $page>3) echo ' <a href="komm.php?page=1&id='.$id.'">1</a> ... ';
for($i=$asd; $i<$asd2;$i++){
if($i<$all && $i>0){
if ($i > $pages ) break;
if ($page==$i){
echo '<b>['.$i.']</b> ';}else{
echo '<a href="komm.php?page='.$i.'&id='.$id.'">'.$i.'</a> ';}
}}
if ($i <= $pages){
if($asd2<$all) {
echo ' ... <a href="komm.php?page='.$pages.'&id='.$id.'">'.$pages.'</a>';}}
echo '<br><br>';}
}
/* Lejas izvēlne */
echo '<img src="pic/main/dot.gif" alt=""> <a href="about.php?id='.$id.'&'.SID.'">'.sys_abouts.'</a><br>';
echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?id='.$back['id'].'&'.SID.'">'.sys_category.'</a><br>';
echo '<img src="pic/main/dot.gif" alt=""> <a href="index.php?'.SID.'">'.sys_dl.'</a><br>';
echo '<img src="pic/main/home.gif" alt=""> <a href="'.$setup['home'].'/?'.SID.'">'.sys_home.'</a><br>';
/* Komentāru automātiskā attīrīšana */
if($all > $setup['klimit']){
$max = mysql_fetch_row(mysql_query('SELECT MIN(`id`) FROM `'.$MY_pre.'komentari`;'));
mysql_query('DELETE FROM `'.$MY_pre.'komentari` WHERE `id` = '.$max[0]);
$page=1;
}
} else { header ("Location: index.php?sayer=404&".SID); exit;}
include_once"thm/$setup[thm]/foot.php";
?>