<?php
#################################################################################
####### # ##     # #     #       ##       #######         #########  ##  ###  ###
####### # #  #   # #     #      #  #      #      #            ##     ## ##    ###
####### # #   #  # #     #     #    #     #      #            ##     ####     ###
####### # #    # # #     #    ########    #######             ##     ###      ###
####### # #      # #  #  #   #        #   #                   ##     ## #     ###
####### # #      # # # # #  #          #  #         ###       ##     ##  #    ###
####### # #      # ##   ## ##          ## #         ###       ##     ##   ##  ###
#################################################################################


#### FREE FORUM N DIWNLOADS HTTP://INDWAP.TK  ###################################

include_once 'sys/inc/start.php';
include_once 'sys/inc/compress.php';
include_once 'sys/inc/sess.php';
include_once 'sys/inc/home.php';
include_once 'sys/inc/settings.php';
include_once 'sys/inc/db_connect.php';
include_once 'sys/inc/ipua.php';
include_once 'sys/inc/fnc.php';
include_once 'sys/inc/user.php';

/////////////////////////////
// Bila ditentukan TRUE maka komentar akan ditampilkan pada halaman yang sama di mana blog itu sendiri.
// Jika Anda menetapkan FALSE, maka komentar akan ditampilkan pada halaman terpisah
$komm_list=TRUE;
///////////////////////////

if(!isset($_GET['id']))
{
$set['title']='Status';
include_once 'sys/inc/thead.php';
//title();
aut();
echo "Belum ada status terupdate!";
echo"<div class='foot'>\n";
echo"<a href='index.php'>&raquo;Kembali</a><br />\n";
echo"</div>\n";
include_once 'sys/inc/tfoot.php';
exit();
}
$id = intval($_GET['id']);


#### FREE FORUM N DIWNLOADS HTTP://INDWAP.TK  ###################################
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_list` WHERE  `id` = '".intval($_GET['id'])."'"),0) ==0)
{
$set['title']='Status';
include_once 'sys/inc/thead.php';
//title();
aut();
echo "Belum ada status terupdate";
echo"<div class='foot'>\n";
echo"<a href='index.php'>&raquo;Kembali</a><br />\n";
echo"</div>\n";
include_once 'sys/inc/tfoot.php';
exit();
}
$statuse=mysql_fetch_array(mysql_query("select * from `statuse_list` where `id`='".intval($_GET['id'])."';"));


if($statuse['privat'] == 1)
{
if (($user['level'] < 4) && ($user['id'] !=$statuse['id_user']))
{
$set['title']=' Status';
include_once 'sys/inc/thead.php';
//title();
aut();
echo "Artikel Pribadi<br \>Bukan untuk umum!";
echo"<div class='foot'>\n";
echo"<a href='index.php'>&raquo;Kembali</a><br />\n";
echo"</div>\n";
include_once 'sys/inc/tfoot.php';
exit();
}
}
mysql_query("UPDATE `statuse_list` SET `count` = '".($statuse['count']+1)."' WHERE `id` = '$statuse[id]' LIMIT 1");
$ank=get_user($statuse['id_user']);
$set['title']=' Status - '.$ank['nick'].'';
include_once 'sys/inc/thead.php';
//title();
aut();
err();
$user_id = $ank['id'];
#### FREE FORUM N DIWNLOADS HTTP://INDWAP.TK  ###################################
echo "<br />".online($ank['id'])." <a href='/profil.php?id=$ank[id]'> <strong> $ank[nick]</strong></a> \n";

echo "".output_text($statuse['msg'])." <br /><font class='time'>".waktu($statuse['time'])."</font>\n";

echo " <img src='/status/suka.gif' height='10' widht='10'><a href='/like.php?id=".$statuse['id']."'> ".mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_like` WHERE `id_statuse` = '$statuse[id]'"),0)." suka</a> . <a href='/list.php?id=".$statuse['id']."'>".mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id_statuse` = '$statuse[id]'"),0)." Komentar</a>\n";

if (($user['level'] >= 4) || ($user['id'] ==$statuse['id_user']))
{
echo "<a href='edit.php?id=$statuse[id]'>Edit </a>";
echo "<a href='edit.php?id=$statuse[id]&amp;del'>Hapus</a>";
}

if (!isset($_GET['id']) && !is_numeric($_GET['id'])){header("Location: index.php?".SID);exit;}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_list` WHERE `id` = '".intval($_GET['id'])."' LIMIT 1",$db), 0)==0){header("Location: index.php?".SID);exit;}
$statuse=mysql_fetch_array(mysql_query("select * from `statuse_list` where `id`='".intval($_GET['id'])."';"));

if (isset($_POST['msg']) && isset($user))
{
$msg=$_POST['msg'];
if (isset($_POST['translit']) && $_POST['translit']==1)$msg=translit($msg);
if (strlen2($msg)>1024){$err='Pesan terlalu panjang';}
elseif (strlen2($msg)<2){$err='Pesan terlalu pendek';}
elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id_statuse` = '".intval($_GET['id'])."' AND `id_user` = '$user[id]' AND `msg` = '".mysql_real_escape_string($msg)."' LIMIT 1"),0)!=0){$err='Pesan sudah tersimpan sebelumnya';}
else{
mysql_query("INSERT INTO `statuse_komm` (`id_user`, `time`, `msg`, `id_statuse`) values('$user[id]', '$time', '".mysql_real_escape_string($msg)."', '".intval($_GET['id'])."')");
mysql_query("UPDATE `user` SET `balls` = '".($user['balls']+1)."' WHERE `id` = '$user[id]' LIMIT 1");
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_anu` WHERE `id_statuse` = '".intval($_GET['id'])."' AND `id_user` = '$user[id]' LIMIT 1"),0)==0){
mysql_query("INSERT INTO `statuse_anu` (`id_user`, `id_statuse`) values('$user[id]', '".intval($_GET['id'])."')");
}
msg('Komentar ditambahkan');
//Pemberitahu//
#### FREE FORUM N DIWNLOADS HTTP://INDWAP.TK  ###################################
if (isset($user) && $user['id']!=$ank['id'])
{
$msgn="[url=/info.php?id=$user[id]]$user[nick][/url] mengomentari [url=/list.php?id=$statuse[id]]status[/url] anda"; mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$ank[id]', '$msgn', '$time')");}
$anu = mysql_query("SELECT * FROM `statuse_anu` WHERE `id_statuse`='$statuse[id]' ORDER BY `id`");
while ($postanu = mysql_fetch_assoc($anu))
{
$useranu = get_user($postanu['id_user']);
if ($user[id]!=$useranu[id]) {
if ($user[id]==$ank[id]){
$pemberitahuan = ''.$user['nick'].' juga mengomentari [url=/list.php?id='.$statuse['id'].']status[/url]nya.';
}
elseif ($user[id]!=$ank[id] && $useranu[id]!=$ank[id]){
$pemberitahuan = ''.$user['nick'].' juga mengomentari [url=/list.php?id='.$statuse['id'].']status[/url] '.$ank['nick'].'.';
}
if ($useranu[id]!=$user[id] && $useranu[id]!=$ank[id]) {
mysql_query("INSERT INTO `jurnal` (`id_user`, `id_kont`, `msg`, `time`) VALUES ('0', '$useranu[id]', '$pemberitahuan', '$time')");
}
}
}


//WAPSPORT.ORG//
}
}
elseif (isset($_GET['del']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id` = '".intval($_GET['del'])."' && `id_statuse` = '".intval($_GET['id'])."'"),0))
{
if (isset($user) && ($user['level']>=4) || isset($user) && ($user['id']=$statuse['id_user']))
{
mysql_query("DELETE FROM `statuse_komm` WHERE `id` = '".intval($_GET['del'])."' LIMIT 1");
}
}
#### FREE FORUM N DIWNLOADS HTTP://INDWAP.TK  ###################################
if($komm_list)
{
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id_statuse` = '".intval($_GET['id'])."'"),0);
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
$q=mysql_query("SELECT * FROM `statuse_komm` WHERE `id_statuse` = '".intval($_GET['id'])."' ORDER BY `time` ASC LIMIT $start, $set[p_str]");
/*
$like=mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_like` WHERE `id_statuse` = '$statuse[id]'"),0);
if ($like==0)$like=NULL;
else $like='<div class="footer"><a href="/like.php?id='.$statuse['id'].'"> '.$like.' orang</a> menyukai ini</div>';
echo "$like";*/
if(mysql_result(mysql_query("SELECT `id_user` FROM `statuse_like` WHERE `id_statuse` = '$statuse[id]' LIMIT 1"),0)==1){
echo "anda menyukai ini";
}
else
{
$like=mysql_result(mysql_query("SELECT `id_user` FROM `statuse_like` WHERE `id_statuse` = '$statuse[id]' LIMIT 1"),0);
$si_anu=mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id` = '$like' LIMIT 1"),0);
while ($ank = mysql_fetch_array($si_anu)){
echo "<br/><a href='/info.php?id=$ank[id]'>$si_anu</a> menyukai ini.";
echo implode(' | ',$si_anu).'.';
}


}
while ($post = mysql_fetch_assoc($q))
{
//$ank=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_user] LIMIT 1"));
$ank=get_user($post['id_user']);

echo "<div class='footer'>\n";
echo "<a href='/info.php?id=$ank[id]'>$ank[nick]</a>\n";

echo output_text($post['msg'])."<br /><font class='time'>".waktu($post['time'])."</font></span>\n";
if (isset($user) && ($user['level']>=4) || isset($user) && ($user['id'] == $statuse['id_user']))
echo "<a href='?id=".intval($_GET['id'])."&amp;del=$post[id]'> hapus</a><br />\n";
echo "</div>";
}


if ($k_page>1)str("?id=".intval($_GET['id']).'&amp;',$k_page,$page);
//Form komentar

echo"<div class='footer'>\n";
if (isset($user))
{echo "<form method=\"post\" name='message' action=\"?id=".intval($_GET['id'])."&amp;page=$page\">\n";
if ($set['web'] && is_file(H.'style/themes/'.$set['set_them'].'/altername_post_form.php'))
include_once H.'style/themes/'.$set['set_them'].'/altername_post_form.php';
else
echo "Kirim Komentar:<br />\n<textarea name=\"msg\"></textarea><br />\n";

echo "<input value=\"Kirim\" type=\"submit\" class=\"button\" />\n";
echo "</form>\n";

}
}
else
{
echo"<a href='komm.php?id=$statuse[id]'>&raquo;komentar</a> (".mysql_result(mysql_query("SELECT COUNT(*) FROM `statuse_komm` WHERE `id_statuse` = '$statuse[id]'"),0).")<br/>";
}

echo "</div>\n";
include_once 'sys/inc/tfoot.php';

?>
