<?php 
/*
##################################################################
#                       PHP 4&5 MySQL 4&5                        #
##################################################################
#           Copyright (c) 2004-2008 Armia Systems Inc            #
##################################################################
#               This file is part of Cybermatch site             #
##################################################################
#    Developed By: simi (simi@armia.com)                         #

##################################################################
#               Developed On:   03-04-2008                       #
##################################################################
#               Modified By:                                     #
##################################################################
#               Modified On:                                     #
##################################################################
# This script may not be distributed, sold, given away for free  #
# to third party, or used as a part of any internet ervices such #
# as webdesign etc.                                              #
##################################################################
*/
require_once ("../config.inc.php");
require_once ("../includes/userlogincheck.mobile.inc.php");
require_once ("../includes/mysql_mobile.inc.php");
require_once ("../classes/misc.class.php");
require_once ("../classes/userside.class.php");
require_once ("../includes/Pager/Pager.php");
require_once ("../includes/arrays.inc.php");

$message	= "";
$data		= array();
$array		= array();
$script		= "";
$pages		= "";
$page		= isset($_REQUEST['page'])	?	trim($_REQUEST['page'])	:	"1";
$type		= isset($_REQUEST['type'])	?	trim($_REQUEST['type'])	:	"__";

$stamsg		= "";
if ($type == "RN")	$stamsg	= "read";
else if ($type == "DN")	$stamsg	= "declined";
else if ($type == "NN")	$stamsg	= "unread";

if (!$objDB) {
	$message	= "Unable to Locate Database Server.";
} else {
	$objU	= new userside($objDB);
	$objM	= new misc($objDB);
	if (isset($_POST['DM'])) {
		$message	= $objU->delete_messages($_POST);
	}
	$array		= $objM->get_messages($type, $_SESSION['user_id'], true);
	$params 	= array(
		'mode'      => 'Sliding',
		'perPage'   => 2,
		'urlVar'    => 'page',
		'extraVars' => array('type'=>$type),
		'itemData'  => $array
	);
	$objP 		= & Pager::factory($params);
	$data  		= $objP->getPageData();
	$pages		= $objP->links;
	if (empty($data))
		$message	.= "No $stamsg message(s) in your inbox folder.<br>";
	$script		= $objU->get_script($message);
	$message	= $objU->remove_script($message);
}
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Cybermatch</title>
<link href="images/mobile.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div xmlns="http://www.w3.org/1999/xhtml">
<?php include_once('title.inc.php');?>
<div>&nbsp;</div>
    <div>
        <div><i>+</i> <a href="index.php">Home</a></div>
        <div><i>+</i> <a href="search.php">Search</a></div>
        <div><i>+</i> <a href="dashbox.php" accesskey="2">Account</a> </div>
        <div><i>+</i> <a href="logout.php">Logout</a></div>
    </div>
<div>&nbsp;</div>
<div><a name="search"></a><strong>Recieved Mails (Inbox)</strong></div>
<div class="message"><?php echo $message?></div>
<div>&nbsp;</div>
<form name="frmTell" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<?php if (!empty($data)) { 
  foreach ($data as $key => $value) { ?>
<div class="list"><div >
<span><div><input name="ids[]" type="checkbox" class="inputel" value="<?php echo $value['nMessage_Id']?>">
<b>From: <a href="profile.php?id=<?php echo $value['nUser_Id']?>&page=<?php echo $page?>"><?php echo $value['vLogin']?></a></b>&nbsp;&nbsp;<a href="send_message.php?id=<?php echo $value['nUser_Id']?>&msgid=<?php echo $value['nMessage_Id']?>&page=<?php echo $page?>">Reply</a></div>
<div><span class="j"><?php echo $value['vLogin']?> - <?php echo $value['vAge']?> -year-old <?php echo $value['vGender']?></span></div>
<div><span class="j"><strong>Mail Title</strong>: <?php echo $value['vTitle']?></span></div>
<div><span class="j"><div><strong>Mail</strong>:</div> <?php echo htmlspecialchars($value['tContent'])?></span></div>
</span></div></div>
<?php } ?>
<input name="DM" type="submit" class="inputb" id="DM" value=" Delete Message(s) ">
                                        <input type="hidden" name="page" value="<?php echo $page?>">
                                        <input type="hidden" name="type" value="<?php echo $type?>">
<?php }?>	
</form>	
<div>&nbsp;</div>
<?php if ($pages <> "") { ?>
<div class="listi"><?php echo $pages?></div><div class="l">&nbsp;</div>
<?php } ?>  
<?php include_once('footer.inc.php');?>