<?php
/*---------------------------------------------------+
| HoloCMS - Website and Content Management System
+----------------------------------------------------+
| Copyright © 2008 Meth0d
+----------------------------------------------------+
| HoloCMS is provided "as is" and comes without
| warrenty of any kind. 
+---------------------------------------------------*/

include('../config.php');
include('../core.php');
include('../includes/session.php');

if(!isset($_POST['gosend']) && !isset($_GET['post'])){
	// Let's give the URL that pointless help tool feeling
	if(!isset($_GET['lang'])){
	header("location:go.php?lang=en&country=uk");
	} else if(!isset($_GET['lang'])){
	header("location:go.php?lang=en&country=uk");
	} else if($_GET['lang'] !== "en"){
	header("location:go.php?lang=en&country=uk");
	} else if($_GET['country'] !== "uk"){
	header("location:go.php?lang=en&country=uk");
	}
}

include('header.php');

if(isset($_POST['gosend'])){
$subject = FilterText($_POST['subject']);
$message = FilterText($_POST['message']);
	if(empty($subject) || empty($message)){
	$result = "- Compila tutti i campi per procedere!";
	} else {
	$sql2 = mysql_query("SELECT * FROM cms_help WHERE ip = '".$remote_ip."' and picked_up = '0' LIMIT 1");
	$num2 = mysql_num_rows($sql2);
		if($num2 == "0"){
		$result = "Ticket presentate. Vi risponderemo al piu breve possibile, ti preghiamo di essere pazienti in quanto cio potrebbe richiedere un po '. Si noti che non e' possibile inviare ulteriori richieste di sostegno fino a quando questa richiesta di assistenza viene prelevato.";
		$disableform = "1";
		$go_sql = mysql_query("INSERT INTO cms_help (username,message,subject,ip,date,picked_up) VALUES ('".$rawname."','".$message."','".$subject."','".$remote_ip."','".$date_full."','0')") or die(mysql_error());
		} else {
		$result = "In grado di presentare richiesta di assistenza: e ancora in attesa di una richiesta di sostegno. Si prega di riprovare piu tardi.";
		$disableform = "1";
		}
	}
}

if(isset($_GET['post'])){
$post_id = $_GET['post'];
	$sql2 = mysql_query("SELECT * FROM cms_help WHERE ip = '".$remote_ip."' and picked_up = '0' LIMIT 1");
	$num2 = mysql_num_rows($sql2);
	$sql3 = mysql_query("SELECT * FROM cms_forum_posts WHERE id = '".$post_id."' LIMIT 1");
	$exists = mysql_num_rows($sql3);
	if($exists > 0){ $row3 = mysql_fetch_assoc($sql3); }
		if($num2 == "0"){
			if($_GET['sure'] == "yes" && $exists > 0){
				$result = "Thank you for reporting this post.";
				$disableform = "1";
				$page = $_GET['page'];
				if(empty($page) || !is_numeric($page)){ $page = 1; }
				$go_sql = mysql_query("INSERT INTO cms_help (username,message,subject,ip,date,picked_up) VALUES ('".$rawname."','This user has reported an post on the Discussion Board. The Post ID is ".$post_id.", in thread ".$row3['threadid'].".\n\nOriginal Message\n-----------------------------------\n".FilterText($row3['message'])."\n\nURL:\n-----------------------------------\n".$path."viewthread.php?thread=".$row3['threadid']."&page=".$page."#post-".$row3['id']."','DISCUSSION BOARD - REPORTED POST','".$remote_ip."','".$date_full."','0')") or die(mysql_error());
			} elseif($exists < 1){
				$result = "Invalid post specified";
				$disableform = "1";
			} else {
				$result = "Is the post you have selected offensive or breaking the rules? Are you sure you want to report this post?<br /><br /><a href='go.php?do=report&post=".$post_id."&page=".$_GET['page']."&sure=yes'>Proceed</a>";
				$disableform = "1";
			}
		} else {
		$result = "Unable to report post: you still have a pending support request. Please try again later. Note that post reports also count as support requests.";
		$disableform = "1";
		}
}

?>

  <div style="height: 4px;"></div>
  <div style="height: 18px; padding: 0 0 0 12px;">&nbsp;</div>	
  <div class="portlet">
   <div class="portlet-top-process"><div class="portlet-process-header">&nbsp;</div></div>
   <div class="portlet-body-process">
   <div class="imaindiv">
<form method="post" action="go.php"><input type="hidden" name="sid" value="55"><table border="0" cellspacing="0" cellpadding="0" class="ihead">
 <tr>
  <td class="icon"><img src="header_images/Western2/1.gif" alt=" " width="47" height="37" /></td>
  <td class="text"><h2>ESPONI IL TUO PROBLEMA!</h2></td></tr>
</table>
<br>

<table border="0" cellspacing="0" cellpadding="0" class="content-table">
 <tr>
  <td>
   <div class="iinfodiv">
    Stai scrivendo al <b>Player Support</b> servizio di supporto al giocatore, se ti &egrave stato consigliato in chiamata Moderatore di rivolgerti a questo servizio, allora compila il modulo sottostante. Se ritieni invece il tuo problema urgente effettua una <b>Chiamata d'Aiuto</b> in Hotel!
<br>
<br>
<u>Se vuoi una risposta al tuo problema/ domanda inserisci un indirizzo e-mail <b>valido<b></b></u>.
<br><br>
<?php if(!empty($result)){
echo "<b>".$result."</b>";
echo "<br><br>"; } ?>

<?php if($disableform !== "1"){ ?>
    La tua e-mail:<br>
    <input type="text" name="subject"  size="50" maxlength="50" value="" /><br> 
    Il tuo problema:<br>
    <textarea name="message"  class="imessageform"></textarea>
   </div>
<?php } ?>
  <br>
  </td>
 </tr>
</table>
   <div style="float:right;">
   <table height="21" border="0" cellpadding="0" cellspacing="0" class="button">
<?php if($disableform !== "1"){ ?>
    <tr><td class="button-left-side"></td><td class="middle">
		<input type="submit" class="proceedbutton" name="gosend" value=" Procedi " /></td><td class="button-right-side-arrow"></td></tr>
<?php } else { ?>
    <tr><td class="button-left-side"></td><td class="middle">
		<a href="../me" >Ritorna alla Home</a>
<?php } ?>
   </table>
   </div>
</form>
   </div>
   </div>
   <div class="portlet-bottom-process"></div>
  </div>
 </div>

<?php

include('footer.php');

?>