
</div>
	<div class="main-content">

<?php
if(!defined('panel'))
	die('Nope.');
if(!isset($_SESSION['user']) && !isset(Config::$_url[1])) echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL.'login\'/>';
if(isset(Config::$_url[1])) $user = (int)Config::$_url[1];
else $user = $_SESSION['user'];
$q = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
$q->execute(array($user));
if(!$q->rowCount()) {
	echo '
<title>Error! Invalid ID</title>
	<div class="breadcrumbs" id="breadcrumbs">
		<ul class="breadcrumb">
			<li>
				<i class="icon-home home-icon"></i>
				<a href="../">Home</a>
			</li>
			<li>
				<a href="../factionslist">Factions</a>
			</li>
			<li class="active">Invalid ID.</li>
		</ul>

		<div class="nav-search" id="nav-search">
			<form method="POST" action="../search">
				<span class="input-icon">
					<input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on"> 
					<i class="ace-icon fa fa-search nav-search-icon"></i>
				</span>
			</form>
		</div> <!-- /.nav-search -->
	</div>	
<div class="page-content">
	<div class="alert alert-danger">Error! Invalid ID.</div>';
	echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL.'complaints\'/>';
	return;
}
?>	
		<div class="main-content-inner">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="ace-icon fa fa-home home-icon"></i>
								<a href="<?php echo Config::$_PAGE_URL; ?>">Home</a>
							</li>
							<li>
								<a href="<?php echo Config::$_PAGE_URL; ?>complaints">Complaints</a>
							</li>							
							<li class="active">View Complaint</li>
						</ul><!-- /.breadcrumb -->

						<div class="nav-search" id="nav-search">
							<form method="POST" action="search">
								<span class="input-icon">
									<input type="text" placeholder="Search ..." name="sname" id="username" type="submit" class="nav-search-input" autocomplete="on"> 
									<i class="ace-icon fa fa-search nav-search-icon"></i>
								</span>
							</form>
						</div> <!-- /.nav-search -->
					</div>	


					
<div class="page-content">
	<div class="row-fluid">
	
<?php

if(isset($_POST['send'])) {
	if(!$_POST['text']) { echo '<div class="alert alert-danger">Nu po&#355;i trimite un mesaj gol.</div>'; }
	if(Config::getData('users','ConnectedTime',$_SESSION['user']) < 5) {
		echo'<div class="alert alert-danger">Trebuie sa ai minim 5 ore jucate pe server pentru a putea raspunde la reclamatie.</div>';
	}
	else if (strpos($_POST['text'], 'window.location') !== false) {
}
	else { 
		echo '<div class="alert alert-success">Ai r&#259;spuns cu succes reclama&#355;iei.</div>';
		
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($_POST['text'],Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
	
		echo '<meta http-equiv="refresh" content="2">';
	}
}

if(isset($_POST['postclose'])) {
	if(!$_POST['text']) echo '<div class="alert alert-danger">Nu po&#355;i trimite un mesaj gol.</div>';
	else { 
		echo '<div class="alert alert-success">Ai raspuns cu succes reclamatiei si ai inchis-o.</div>';
		
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
				$q->execute(array(" ". $_POST['text'] ." <br /><b>Admin action:</b> Topic Closed!",Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) {
	 	$qp = Config::$g_con->prepare("INSERT INTO emails (Message, LinkPanel, playerid)
			VALUES ('Reclamatia impotriva ta a fost inchisa de ".Config::getData('users','name',$_SESSION['user']).".','complaint/".Config::$_url[1]."', '".Config::getID('users','id',$row->playername)."')");		$qp->execute();
        $qp = Config::$g_con->prepare("INSERT INTO emails (Message, LinkPanel, playerid)
			VALUES ('Reclamatia creata de tine a fost inchisa de ".Config::getData('users','name',$_SESSION['user']).".','complaint/".Config::$_url[1]."', '".Config::getID('users','id',$row->createdby)."')");		$qp->execute();
		}


		echo '<meta http-equiv="refresh" content="2">';
	}
}
if(isset($_POST['postclosel'])) {
	if(!$_POST['text']) echo '<div class="alert alert-danger">Nu po&#355;i trimite un mesaj gol.</div>';
	else { 
		echo '<div class="alert alert-success">Ai raspuns cu succes reclamatiei si ai inchis-o.</div>';
		
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
				$q->execute(array(" ". $_POST['text'] ." <br /><b>Leader action:</b> Topic Closed!",Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));
  		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) {
	 	$qp = Config::$g_con->prepare("INSERT INTO emails (Message, LinkPanel, playerid)
			VALUES ('Reclamatia impotriva ta a fost inchisa de ".Config::getData('users','name',$_SESSION['user']).".','complaint/".Config::$_url[1]."', '".Config::getID('users','id',$row->playername)."')");		$qp->execute();
        $qp = Config::$g_con->prepare("INSERT INTO emails (Message, LinkPanel, playerid)
			VALUES ('Reclamatia creata de tine a fost inchisa de ".Config::getData('users','name',$_SESSION['user']).".','complaint/".Config::$_url[1]."', '".Config::getID('users','id',$row->createdby)."')");		$qp->execute();
		}
		
		echo '<meta http-equiv="refresh" content="2">';
	}
}

/*if(isset($_SESSION['user']) && Config::getData('users','Leader',$_SESSION['user']) == $row->factionid) {
if(isset($_POST['doveziinsuficiente'])) {
		echo '<div class="alert alert-success">Ai inchis reclamatia cu succes.</div>';
		
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
				$q->execute(array("Dovezi insuficiente.<br /><b>Leader action:</b> Topic Closed!",Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));		
		
		echo '<meta http-equiv="refresh" content="2">';
}
} else { */
if(isset($_POST['doveziinsuficiente'])) {
		echo '<div class="alert alert-success">Ai inchis reclamatia cu succes.</div>';
		
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
				$q->execute(array("Dovezi insuficiente.<br /><b>Admin action:</b> Topic Closed!",Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) {
	 	$qp = Config::$g_con->prepare("INSERT INTO emails (Message, LinkPanel, playerid)
			VALUES ('Reclamatia impotriva ta a fost inchisa de ".Config::getData('users','name',$_SESSION['user']).".','complaint/".Config::$_url[1]."', '".Config::getID('users','id',$row->playername)."')");		$qp->execute();
        $qp = Config::$g_con->prepare("INSERT INTO emails (Message, LinkPanel, playerid)
			VALUES ('Reclamatia creata de tine a fost inchisa de ".Config::getData('users','name',$_SESSION['user']).".','complaint/".Config::$_url[1]."', '".Config::getID('users','id',$row->createdby)."')");		$qp->execute();
		}


  echo '<meta http-equiv="refresh" content="2">';
		}	
/*	}
}	*/

if(isset($_POST['delete'])&& (Config::getData('users','Admin',$_SESSION['user'])) >= 5) {
	$q = Config::$g_con->prepare('DELETE FROM `complaints` WHERE `id` = ?');
	$q->execute(array(Config::$_url[1]));
	
	echo '<meta http-equiv="refresh" content="0;URL=\''.Config::$_PAGE_URL.'complaints\'/>';
}

if(isset($_POST['retrage'])) {
	echo '<div class="alert alert-danger">Ai retras reclamatia cu succes.</div>';

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));

		$text = "<b>User action:</b> Complaint removed!";
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($text,Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
		
		echo '<meta http-equiv="refresh" content="2">';		
}

if(isset($_POST['avertizeazal'])) {
	if(!$_POST['reason'] && !$_POST['duration']) echo '<div class="alert alert-danger">Ai lasat campuri necompletate.</div>';
	else {
		echo '<div class="alert alert-success">Jucatorul a primit warn cu succes.</div>';
		if($_POST['duration']) {
			$duration = 0;
		} else { $duration = 0; }
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) { 

		$q = Config::$g_con->prepare('INSERT INTO `panelactions` (`complaintid`, `actiontime`, `actionid`, `playerid`, `playername`, `giverid`, `givername`, `reason`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
		$q->execute(array(Config::$_url[1],$duration,4,Config::getID('users','id',$row->playername),Config::getID('users','name',$row->playername),Config::getData('users','id',$_SESSION['user']),Config::getData('users','name',$_SESSION['user']),$_POST['reason']));
		
		$q = Config::$g_con->prepare('UPDATE `users` SET `Warnings` = ? WHERE `id` = ?');
		$q->execute(array(Config::getID('users','Warnings',$row->playername)+1,Config::getID('users','id',$row->playername)));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));

		$text = "<b>Panel action:</b> Admin ". Config::getData('users','name',$_SESSION['user']) ." <b>warned</b> player ". Config::getID('users','name',$row->playername) .", reason: <b>".$_POST['reason']."</b>";
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($text,Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
		
		echo '<meta http-equiv="refresh" content="2">';		
		
			}
		}
}

if(isset($_POST['baneazal']) && Config::getData('users','Admin',$_SESSION['user']) >= 1) {
	if(!$_POST['reason'] && !$_POST['duration']) echo '<div class="alert alert-danger">Ai lasat campuri necompletate.</div>';
	else {
		echo '<div class="alert alert-success">Jucatorul a primit ban cu succes.</div>';
		if($_POST['duration'] == 0) {
			$permanentban = 1;	
			$duration = 0; 
		} else {
			$permanentban = 0;	
			$duration = $_POST['duration'];		
		}

		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) { 

		$q = Config::$g_con->prepare('INSERT INTO `panelactions` (`complaintid`, `actiontime`, `actionid`, `playerid`, `playername`, `giverid`, `givername`, `reason`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
		$q->execute(array(Config::$_url[1],$duration,1,Config::getID('users','id',$row->playername),Config::getID('users','name',$row->playername),Config::getData('users','id',$_SESSION['user']),Config::getData('users','name',$_SESSION['user']),$_POST['reason']));
		
		$q = Config::$g_con->prepare('INSERT INTO `bans` (
		`IP`, 
		`Active`, 
		`Permanent`, 
		`IPBan`, 
		`Time`, 
		`PlayerName`, 
		`Days`, 
		`AdminName`, 
		`Reason`
		) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)');
		$q->execute(array(
		Config::getID('users','IP',$row->playername),
		1,
		$permanentban,
		$_POST['banip'],
		(time()+$duration*43200),
		Config::getID('users','name',$row->playername),
		$duration,
		Config::getData('users','name',$_SESSION['user']),
		$_POST['reason']
		));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));

		if($_POST['duration'] == 0) { 
			$durata = "permanent"; 
		} else { 
			$durata = "". $_POST['duration'] ." days"; 
		}
		$text = "<b>Panel action:</b> Admin ". Config::getData('users','name',$_SESSION['user']) ." <b>banned</b> player ". Config::getID('users','name',$row->playername) .", reason: <b>".$_POST['reason']."</b>, time: <b>". $durata ."</b>";
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($text,Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
		
		echo '<meta http-equiv="refresh" content="2">';					
		}
	}
}

if(isset($_POST['puscariazal']) && Config::getData('users','Admin',$_SESSION['user']) >= 1) {
	if(!$_POST['reason'] && !$_POST['duration']) echo '<div class="alert alert-danger">Ai lasat campuri necompletate.</div>';
	else {
		echo '<div class="alert alert-success">Jucatorul a primit jail cu succes.</div>';
		if($_POST['duration']) {
			$duration = $_POST['duration'];
		}
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) { 

		$q = Config::$g_con->prepare('INSERT INTO `panelactions` (`complaintid`, `actiontime`, `actionid`, `playerid`, `playername`, `giverid`, `givername`, `reason`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
		$q->execute(array(Config::$_url[1],$duration,3,Config::getID('users','id',$row->playername),Config::getID('users','name',$row->playername),Config::getData('users','id',$_SESSION['user']),Config::getData('users','name',$_SESSION['user']),$_POST['reason']));
		
		$q = Config::$g_con->prepare('UPDATE `users` SET `Jailed` = ? AND `JailTime` = ? WHERE `id` = ?');
		$q->execute(array(2,Config::getID('users','JailTime',$row->playername)+$duration,Config::getID('users','id',$row->playername)));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));

		$text = "<b>Panel action:</b> Admin ". Config::getData('users','name',$_SESSION['user']) ." <b>jailed</b> player ". Config::getID('users','name',$row->playername) .", reason: <b>".$_POST['reason']."</b>, time: <b>$duration minutes</b>";
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($text,Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
		
		echo '<meta http-equiv="refresh" content="2">';		
			}
		}
}

if(isset($_POST['dmfarap']) && Config::getData('users','Admin',$_SESSION['user']) >= 1) {
		echo '<div class="alert alert-success">Jucatorul a primit jail pentru DM cu succes.</div>';

		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($rowq = $s->fetch(PDO::FETCH_OBJ)) {  
			
		if(Config::getID('users','dm',$rowq->playername) > 6) {
			$duration = 60;
			$gls = 6;
		} else {
		$duration = Config::getID('users','dm',$rowq->playername)*10+10;
		$gls = Config::getID('users','dm',$rowq->playername)+1;
		}
		
		}
			
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) { 

		$q = Config::$g_con->prepare('INSERT INTO `panelactions` (`complaintid`, `actiontime`, `actionid`, `playerid`, `playername`, `giverid`, `givername`, `reason`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
		$q->execute(array(Config::$_url[1],$duration,3,Config::getID('users','id',$row->playername),Config::getID('users','name',$row->playername),Config::getData('users','id',$_SESSION['user']),Config::getData('users','name',$_SESSION['user']),"DM"));
		
		$q = Config::$g_con->prepare('UPDATE `users` SET `Jailed` = ?, `JailTime` = ?, `GunLic` = ?, `GunLicT` = ?, `GunLicSuspend` = ?, `dm` = ? WHERE `id` = ?');
		$q->execute(array(2,$duration,0,0,$gls,Config::getID('users','dm',$row->playername)+1,Config::getID('users','id',$row->playername)));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));

		$text = "<b>Panel action:</b> Admin ". Config::getData('users','name',$_SESSION['user']) ." <b>jailed</b> player ". Config::getID('users','name',$row->playername) .", reason: <b>DM</b>.";
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($text,Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
		
		echo '<meta http-equiv="refresh" content="2">';	
		}
}

if(isset($_POST['dmcup']) && Config::getData('users','Admin',$_SESSION['user']) >= 1) {
		echo '<div class="alert alert-success">Jucatorul a primit jail pentru DM cu pumnii cu succes.</div>';

		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($rowq = $s->fetch(PDO::FETCH_OBJ)) {  
			
		if(Config::getID('users','dmp',$rowq->playername) > 6) {
			$duration = 60;
		} else {
		$duration = Config::getID('users','dmp',$rowq->playername)*10+10;
		}
		
		}
			
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) { 

		$q = Config::$g_con->prepare('INSERT INTO `panelactions` (`complaintid`, `actiontime`, `actionid`, `playerid`, `playername`, `giverid`, `givername`, `reason`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
		$q->execute(array(Config::$_url[1],$duration,3,Config::getID('users','id',$row->playername),Config::getID('users','name',$row->playername),Config::getData('users','id',$_SESSION['user']),Config::getData('users','name',$_SESSION['user']),"DM"));
		
		$q = Config::$g_con->prepare('UPDATE `users` SET `Jailed` = ?, `JailTime` = ?, `dmp` = ? WHERE `id` = ?');
		$q->execute(array(2,$duration,Config::getID('users','dmp',$row->playername)+1,Config::getID('users','id',$row->playername)));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));

		$text = "<b>Panel action:</b> Admin ". Config::getData('users','name',$_SESSION['user']) ." <b>jailed</b> player ". Config::getID('users','name',$row->playername) .", reason: <b>DM</b>.";
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($text,Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
		
		echo '<meta http-equiv="refresh" content="2">';	
		}
}

if(isset($_POST['mutestel']) && Config::getData('users','Admin',$_SESSION['user']) >= 1) {
	if(!$_POST['reason'] && !$_POST['duration']) echo '<div class="alert alert-danger">Ai lasat campuri necompletate.</div>';
	else {
		echo '<div class="alert alert-success">Jucatorul a primit mute cu succes.</div>';
		if($_POST['duration']) {
			$duration = $_POST['duration'];
		}
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) { 

		$q = Config::$g_con->prepare('INSERT INTO `panelactions` (`complaintid`, `actiontime`, `actionid`, `playerid`, `playername`, `giverid`, `givername`, `reason`) VALUES (?, ?, ?, ?, ?, ?, ?, ?)');
		$q->execute(array(Config::$_url[1],$duration,5,Config::getID('users','id',$row->playername),Config::getID('users','name',$row->playername),Config::getData('users','id',$_SESSION['user']),Config::getData('users','name',$_SESSION['user']),$_POST['reason']));
		
		$q = Config::$g_con->prepare('UPDATE `users` SET `Muted` = ? AND `JailTime` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::getID('users','MuteTime',$row->playername)+$duration,Config::getID('users','id',$row->playername)));

		$q = Config::$g_con->prepare('UPDATE `complaints` SET `status` = ? WHERE `id` = ?');
		$q->execute(array(1,Config::$_url[1]));

		$text = "<b>Panel action:</b> Admin ". Config::getData('users','name',$_SESSION['user']) ." <b>muted</b> player ". Config::getID('users','name',$row->playername) .", reason: <b>".$_POST['reason']."</b>, time: <b>$duration minutes</b>";
		$q = Config::$g_con->prepare('INSERT INTO `reply_complaints` (`text`, `user`, `idd`) VALUES (?, ?, ?)');
		$q->execute(array($text,Config::getData('users','name',$_SESSION['user']),Config::$_url[1]));
		
		echo '<meta http-equiv="refresh" content="2">';		
			}
		}
}

		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
			while($row = $s->fetch(PDO::FETCH_OBJ)) { 
if($row->status == 1) {
echo"<div class='alert alert-warning'>
This topic is closed. Only admins can reply to it!
</div>";
} }
?>
<div class="row-fluid">
<div class="span4">
<h4>Complaint against</h4>
<hr>
	<?php
		$s = Config::$g_con->prepare('SELECT * FROM `complaints` WHERE `id` = ?');
		$s->execute(array(Config::$_url[1]));
		while($row = $s->fetch(PDO::FETCH_OBJ)) { 
			if($row->reasoncomplaint == 1) {
				$reason = "Faction";
			} else if($row->reasoncomplaint == 2) {
				$reason = "DM";
			} else if($row->reasoncomplaint == 3) {
				$reason = "Offensive language";
			} else if($row->reasoncomplaint == 4) {
				$reason = "Scam";
			} else if($row->reasoncomplaint == 5) {
				$reason = "Other";
			} else if($row->reasoncomplaint == 6) {
				$reason = "Admin/helper abuse";
			} else if($row->reasoncomplaint == 7) {
				$reason = "Leader mistake";
			}
	?>
<title>Complaint against <?php echo Config::getID('users','name',$row->playername); ?> - <?php echo $reason ?>  - <?php echo Config::$_SITE_NAME; ?></title>	
<img class="nav-user-photo img-circle pull-left" src="<?php echo Config::$_PAGE_URL; ?>assets/images/100/<?php echo Config::getID('users','Model',$row->playername); ?>.png" alt="<?php echo Config::getID('users','name',$row->playername); ?>'s Avatar"/>
<p class="pull-left">
<a href="<?php echo Config::$_PAGE_URL; ?>profile/<?php echo Config::getID('users','id',$row->playername); ?>"><?php echo Config::getID('users','name',$row->playername); ?></a><br/>
Level: <?php echo Config::getID('users','Level',$row->playername); ?><br/>
Faction: <?php echo Config::getID('users','Member',$row->playername); ?><br/>
Hours played: <?php echo Config::getID('users','ConnectedTime',$row->playername); ?><br/>
Warns: <?php echo Config::getID('users','Warnings',$row->playername); ?>/3<br>
</p>
<span class="clearfix"></span>
<hr>
<h4>Complaint status</h4>
Status: <b><?php echo ($row->status ? "Closed" : "Open") ?></b><br>
<!--Admin replies: <b><abbr title="Optiunea aceasta va fi implementata in viitor.">N/A</abbr></b><br/>
Views: <b><abbr title="Optiunea aceasta va fi implementata in viitor.">N/A</abbr></b><br/>-->
Creat pe: <b><?php echo $row->time ?></b><br/>
<?php if(isset($_SESSION['user']) && Config::getData('users','Admin',$_SESSION['user']) >= 5) { ?>
Posted from IP: <b><?php echo $row->ip; ?></b><br />
<?php } ?>
<br/>
<hr />
<?php if(isset($_SESSION['user']) && Config::getData('users','Admin',$_SESSION['user']) >= 1) {
if($row->reasoncomplaint == 2) { ?>
<form method="POST" action="" disabled>
<input type="submit" name="dmfarap" class="btn btn-small btn-purple" value="Jail pentru DM"/>
<input type="submit" name="dmcup" class="btn btn-small btn-success" value="Jail pentru DM cu pumnii"/>
</form>
<hr>
<?php } ?>
<form method="POST" action="" disabled>
<div class="col-sm-10"> Reason: <br/>
	<input name="reason" type="text" class="col-xs-10 col-sm-10" />
</div>
<div class="col-sm-10"> Time: <br/>
	<input name="duration" type="text" class="col-xs-10 col-sm-10" />
</div>
<div class="col-sm-10"><br />
<select name="action" class="col-xs-10 col-sm-10">
	<option value="1">After action: reload page, close post</option>
</select>
</div>
<div class="col-sm-10"><br />
Time 0 pentru permanent<br />
Tip:<br>
<select name="banip" class="col-xs-10 col-sm-10">
	<option value="0">Cont</option>
	<option value="1">IP</option>
</select>
</div>
<div class="col-sm-10"><br />
<input type="submit" name="avertizeazal" class="btn btn-small btn-purple" value="warn"/>
<input type="submit" name="baneazal" class="btn btn-small btn-danger" value="ban"/>
<input type="submit" name="mutestel" class="btn btn-small btn-grey" value="mute"/>
<input type="submit" name="puscariazal" class="btn btn-small btn-pink" value="jail"/>
</div>
</form>

<?php } ?>

</div>
<div class="span8">
<h4>Complaints details</h4>
<hr>
<b>Nickname</b>: <a href="<?php echo Config::$_PAGE_URL; ?>profile/<?php echo Config::getID('users','id',$row->createdby); ?>"><?php echo Config::getID('users','name',$row->createdby); ?></a><br/>
<b>Level</b>: <?php echo Config::getID('users','Level',$row->createdby); ?><br/>
<b>Detalii</b>: <?php echo $row->details ?><br/>
<b>Motiv reclamatie</b>: <?php echo $reason; ?>
<br/>
<b>Dovezi (screenshot-uri, video-uri)</b>: <?php echo $row->evidence ?>
<br/><br/>

<div class="widget-box ">
<div class="widget-header widget-header-flat widget-header-small">
<h4 class="lighter smaller">
<i class="icon-rss red"></i>
Comments
</h4>
</div>
<div class="widget-body">
<div class="widget-main no-padding">
<div class="dialogs">
	<?php
		$s = Config::$g_con->prepare('SELECT * FROM `reply_complaints` WHERE `idd` = ? ORDER BY `id` ASC');
		$s->execute(array(Config::$_url[1]));
		while($row2 = $s->fetch(PDO::FETCH_OBJ)) { ?>
<div class="itemdiv dialogdiv">
<div class="user">
<img alt="<?php echo Config::getID('users','name',$row2->user); ?>'s Avatar" src="<?php echo Config::$_PAGE_URL; ?>assets/images/avatars/<?php echo Config::getID('users','Model',$row2->user); ?>.png"/>
</div>
<div class="body ">
<div class="time">
<i class="icon-time"></i>
<span class="green">
<?php echo $row2->time ?>
</span>
</div>
<div class="text">

<a href="<?php echo Config::$_PAGE_URL; ?>profile/<?php echo Config::getID('users','id',$row2->user); ?>" title=""><?php echo Config::getID('users','name',$row2->user); ?></a>
<?php if($row->createdby == Config::getID('users','name',$row2->user)) { echo'<span class="badge badge-info">complaint creator</span>'; } ?>
<?php if($row->playername == Config::getID('users','name',$row2->user)) { echo'<span class="badge badge-danger">reported player</span>'; } ?>
<?php if(Config::getID('users','Admin',$row2->user) > 0 && Config::getID('users','Admin',$row2->user) < 5) { echo'<span class="label label-purple arrowed arrowed-in-right">admin</span>'; } ?>
<?php if(Config::getID('users','Admin',$row2->user) >= 6) { echo'<span class="label label-purple arrowed arrowed-in-right">owner</span>'; } ?>
<?php if(Config::getID('users','Helper',$row2->user) > 0) { echo'<span class="label label-purple arrowed-in-right">helper</span>'; } ?>
<?php if(Config::getID('users','Leader',$row2->user) > 0) { echo'<span class="label label-danger arrowed-in-right">faction leader</span>'; } ?>

<br/>
<span class="comment">
<?php echo $row2->text ?>
</span>
<span class="pull-right">
</span>

</div>
</div>
</div>
<?php } ?>
</div>
<?php if(isset($_SESSION['user']) && (Config::getData('users','Admin',$_SESSION['user'])) >= 1) { ?>
<div  style="margin: 0 15px 20px 60px;">
<form method="POST" action="" disabled>
<h5>Leave a reply</h5>
<textarea class="input-block-level" placeholder="ADMIN REPLY: reply text..." name="text"></textarea>
<br/><br/>
<input type="submit" name="send" class="btn btn-small btn-danger" value="Post">
<input type="submit" name="postclose" class="btn btn-small btn-danger" value="Post and close">
</form>
<form method="POST" action=""><br />
<?php if(Config::getData('users','Admin',$_SESSION['user']) >= 6) {	?>
<input type="submit" name="delete" class="btn btn-small btn-danger" value="Delete"/> <?php }?>
</form>
<form method="POST" action="" disabled>
<br />
<input type="submit" name="doveziinsuficiente" class="btn btn-small btn-success" value="Dovezi insuficiente"/>
<?php if($row->createdby == Config::getData('users','name',$_SESSION['user'])) { ?>
<input type="submit" name="retrage" class="btn btn-small btn-blue" value="Retrage reclamatie"/>
<?php } ?>
</form>
</div>
<?php } else if(isset($_SESSION['user']) && ($row->status) == 0 && ($row->factionid) > 0 && Config::getData('users','Leader',$_SESSION['user']) == $row->factionid) { ?>
<form class="form-horizontal" method="POST" style="margin: 0 15px 20px 60px;" action="" disabled>
<h5>Leave a reply</h5>
<textarea class="input-block-level" placeholder="reply text..." name="text"></textarea>
<br/><br/>
<input type="submit" name="send" class="btn btn-small btn-danger" value="Post"/>
<input type="submit" name="postclosel" class="btn btn-small btn-danger" value="Post and close">
<br /><br />
<?php if($row->createdby == Config::getData('users','name',$_SESSION['user'])) { ?>
<input type="submit" name="retrage" class="btn btn-small btn-blue" value="Retrage reclamatie"/>
<?php } ?>
</form>
<?php } else if(isset($_SESSION['user']) && ($row->status) == 0) { ?>
<form class="form-horizontal" method="POST" style="margin: 0 15px 20px 60px;" action="" disabled>
<h5>Leave a reply</h5>
<textarea class="input-block-level" placeholder="reply text..." name="text"></textarea>
<br/><br/>
<input type="submit" name="send" class="btn btn-small btn-danger" value="Post"/>
<br /><br />
<?php if($row->createdby == Config::getData('users','name',$_SESSION['user'])) { ?>
<input type="submit" name="retrage" class="btn btn-small btn-blue" value="Retrage reclamatie"/>
<?php } ?>
</form>
<?php } else if(isset($_SESSION['user']) && ($row->status) == 1) { ?>
<form class="form-horizontal" method="POST" style="margin: 0 15px 20px 60px;" action="" disabled>
<h5>Leave a reply</h5>
<textarea class="input-block-level" placeholder="You can&#039;t reply to this topic, reason: This topic is closed." name="text" disabled></textarea>
<br/><br/>
<input type="submit" name="submit" class="btn btn-small btn-danger" value="Post" disabled />
<form>
<?php } else { ?>
<form class="form-horizontal" method="POST" style="margin: 0 15px 20px 60px;" action="" disabled>
<h5>Leave a reply</h5>
<textarea class="input-block-level" placeholder="You can&#039;t reply to this topic, reason: You are not logged in." name="text" disabled></textarea>
<br/><br/>
<input type="submit" name="submit" class="btn btn-small btn-danger" value="Post" disabled />
<form>
<?php } ?>
</div> 
</div> 
</div>
<?php } ?>
</div>
