<?php
/*================================================================+\
|| # PHPRetro - An extendable virtual hotel site and management
|+==================================================================
|| # Ink's Support System (Hayden-rocks@live.co.uk)
|+==================================================================
|| # Copyright (C) 2009 Yifan Lu. All rights reserved.
|| # http://www.yifanlu.com
|| # Parts Copyright (C) 2009 Meth0d. All rights reserved.
|| # http://www.meth0d.org
|| # All images, scripts, and layouts
|| # Copyright (C) 2009 Sulake Ltd. All rights reserved.
|+==================================================================
|| # PHPRetro is provided "as is" and comes without
|| # warrenty of any kind. PHPRetro is free software!
|| # License: GNU Public License 3.0
|| # http://opensource.org/licenses/gpl-license.php
\+================================================================*/

$page['dir'] = '\housekeeping';
$page['housekeeping'] = true;
if($_GET['do'] == "savedetails" || $_GET['do'] == "savebadges"){
$page['rank'] = 7;
}else{
$page['rank'] = 6;
}
require_once('../includes/core.php');
require_once('./includes/hksession.php');
$data = new housekeeping_sql;
$lang->addLocale("housekeeping.users");

if(isset($_POST['search'])){
	$sql = $serverdb->query("SELECT id,name FROM ".PREFIX."users WHERE name LIKE '%".$input->FilterText($_POST['query'])."%' LIMIT 50");
	$search_results = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n"; $i = 0;
	while($row = $db->fetch_row($sql)){
		if($input->IsEven($i)){ $even = "even"; }else{ $even = "odd"; }
		$search_results .= "<tr id=\"".$even."\"><td><a href=\"".PATH."/housekeeping/users?id=".$row[0]."\">".$row[1]."</a></td><td class=\"selectid\">".$row[0]."</td></tr>\n";
		$i++;
	}
	$search_results .= "</tr></table>";
}else{
	$search_results = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr><td><b>".$lang->loc['search.desc']."</b></td></tr></table>";
}
if(!empty($_GET['id'])){
	$id = $input->FilterText($_GET['id']);
}elseif(!isset($id)){
	$id = $serverdb->result($serverdb->query("SELECT MAX(id) FROM ".PREFIX."users LIMIT 1"));
}

$page['name'] = $lang->loc['pagename.users'];
$page['category'] = "users";
require_once('./templates/housekeeping_header.php');

$row = $db->fetch_row($core->select3($id));
$cms_row = $db->fetch_assoc($db->query("SELECT * FROM ".PREFIX."users WHERE id = '".$id."' LIMIT 1"));
?>
<div class="page_title">
 <img src="<?php echo PATH; ?>/housekeeping/images/icons/users.png" class="pticon">
 <span class="page_name_shadow">Non Urgent support</span>

 <span class="page_name">Non Urgent support</span>
</div>
<div class="page_main">

<table border="0" cellpadding="0" cellspacing="0" height="100%">
<tbody>
<tr height="100%" />
<td class="page_main_left">
<div class="left_date"><?php echo date('l F j, Y | g:iA'); ?></div>
<div class="hr"></div>
 <div class="text">
 <p>You can use the search facility below so you can find a user if you need to alert them after they have sent you an Non Urgent Support Message.</p>
 </div>
<form name="users_search" action="<?php echo PATH; ?>/housekeeping/users" method="POST">
 <div class="text">
   <div class="user_listview_bg">
    <div id="listview">
     <div class="Scroller-Container">
<?php echo $search_results; ?>
     </div>
    </div>

    <div id="Scrollbar-Container">
     <img src="<?php echo PATH; ?>/housekeeping/images/up_arrow.gif" class="Scrollbar-Up" />
     <div class="Scrollbar-Track">
       <img src="<?php echo PATH; ?>/housekeeping/images/scrollbar_handle.gif" class="Scrollbar-Handle" />
     </div>
     <img src="<?php echo PATH; ?>/housekeeping/images/down_arrow.gif" class="Scrollbar-Down" />
    </div>
   </div>
<div class="searcuser">

<input type="text" name="query" id="searchname" value="">
<button type="submit" name="search" id="button_search"><?php echo $lang->loc['search']; ?></button>
</div>
</div>
</form>
</td>
 <td class="page_main_right">
<div class="center">
<?php
if(isset($message) && !empty($message)){ echo '<div class="clean-ok">'.$message.'</div>'; }
if(isset($error) && !empty($error)){ echo '<div class="clean-error">'.$error.'</div>'; }
?>
</div>
<table>
<tr>
 <td class="center" valign="top">
 <div class="cform_head">Support</div>

 <div class="cform">
<div class="text">
<h1><font size=25>Non Urgent support Entries:</font></h1>
<div class="hr"></div>
		
		<?php include "includes/supportsql.php";

$showit = mysql_query("SELECT * FROM `support`");
while($row = mysql_fetch_array($showit)){
	echo "Username: ".$row["name"]."";
	echo "<br>Message type: ".$row["type"]."      (1 is Support, 2 is Question, 3 is Complaint)";
	echo "<br>Message: ".$row["message"]."";
	echo "<br><a href=\"supportdelete.php?id=".$row["id"]."\">Delete Entry</a></br></br>";
}

?>


 </div>
 </td>
</tr>
</table>
</div>
 </td>
</tr>
</tbody>
</table>

</div>
<?php require_once('./templates/housekeeping_footer.php'); ?>
