<?php

/*
////////////////////////////////////////////////////////////////////////////////
// JohnCMS                Mobile Content Management System                    //
// Project site:          http://johncms.com                                  //
// Support site:          http://gazenwagen.com                               //
////////////////////////////////////////////////////////////////////////////////
// Lead Developer:        Oleg Kasyanov   (AlkatraZ)  alkatraz@gazenwagen.com //
// Development Team:      Eugene Ryabinin (john77)    john77@gazenwagen.com   //
//                        Dmitry Liseenko (FlySelf)   flyself@johncms.com     //
////////////////////////////////////////////////////////////////////////////////
*/

// Проверяем права доступа
if (core::$user_rights < 1) {
    header('Location: /');
    exit;
}
defined('_IN_JOHNCMS') or die('Error: restricted access');

if (!$user_id) {
    require('../incfiles/head.php');
    echo functions::display_error($lng['access_guest_forbidden']);
    require('../incfiles/end.php');
    exit;
}

require('../incfiles/head.php');

echo '<div class="phdr">Shikoyatlar</div>';
$t = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_arz`"), 0);
if ($t > 0) {
$z=mysql_query("SELECT * FROM `forum_arz` ORDER BY `id` DESC LIMIT $start, $kmess");
     while (($a = mysql_fetch_array($z)) !== false) {
$arz = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id` = '".$a['post_id']."'"));
$res1 = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '".$a['arzchi_id']."'"));
$f = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum` WHERE `id` = '".$arz['refid']."'"));
			echo '<div class="menu">';
			// Метка пола
                    if ($res1['sex']) {
                        echo functions::image(($res1['sex'] == 'm' ? 'm' : 'w') . ($res1['datereg'] > time() - 86400 ? '_new' : '') . '.png', array('class' => 'icon-inline'));
                    } else {
                        echo functions::image('del.png');
                    }

                    // Ник юзера и ссылка на его анкету
                    if ($user_id && $user_id != $res1['user_id']) {
echo '<a href="../users/profile.php?user=' . $res1['id'] . '"><b>'.$res1['name'].'</b></a> ';
$u_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `user_id`='".$res1['id']."'" . ($rights >= 7 ? '' : " AND `close`!='1'")), 0);
echo '<span style="color: #525252; font-weight: bold;"> ['.$u_p.']</span>';
                    } else {
                        echo '<b>' . $res1['from'] . '</b> ';
$u_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum` WHERE `type`='m' AND `user_id`='".$res1['id']."'" . ($rights >= 7 ? '' : " AND `close`!='1'")), 0);
echo '<span style="color: #525252; font-weight: bold;"> ['.$u_p.']</span>';
						}
                    // Метка онлайн/офлайн
echo(time() > $res1['lastdate'] + 300 ? '<span class="red"> [Off]</span> ' : '<span class="green"> [ON]</span> ');
 echo ''.functions::display_date($a['time']).'';	 
	 
	 $text = $a['arz'];
$text = functions::checkout($text, 1, 1);
if ($set_user['smileys']) {
$text = functions::smileys($text, $arz['rights'] ? 1 : 0);
}

	 echo '<div style="border-bottom: 1px dashed #D7EBB9; border-top: 1px dashed #D7EBB9;">
Mavzu: <a href="index.php?id='.$f['id'].'">'.$f['text'].'</a><div class="br"></div><div style="padding: 4px 0px;">
'.$text.'<font style="float:right;">
<a href="/forum/index.php?act=arz_del&id='.$arz['id'].'">O\'chirish</a></font></div></div></div>';
}
} else {
        echo '<div class="menu">Shikoyatlar mavjud emas!</div>';
    }
?>