<?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 services 	 #
# such as webdesign etc.                                         #
##################################################################
*/

require_once ("config.inc.php");
require_once ("includes/userlogincheck.inc.php");
require_once ("includes/mysql.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");
require_once ("classes/timespamp.php");
$ds = new FuzzyTime();
$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);
	$array		= $objM->get_messages($type, $_SESSION['user_id'], false);
	$params 	= array(
		'mode'      => 'Sliding',
		'perPage'   => PAGESIZE,
		'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 sent folder.<br>";
	$script		= $objU->get_script($message);
	$message	= $objU->remove_script($message);
}

include_once ("title.inc.php");
include_once ("tophtml.inc.php");
?>

<div class="row">
	<div class="eight columns">
		<div class="search-rslts">
			<div class="row"><div class="inenr-hd"><h2>Message Sent</h2></div></div>
			<div class="row">
				<div class="newdesignforinput maintext1">
					<?php if(isset($message) && trim($message)!='')
					  {
					?>
					<div class="full_row">
						<div class="maintext1 warning"><?php echo $message;?></div>
					</div>
					<?php }//end if?>
					
					<form name="frmTell" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
						<?php if (!empty($data)) 
					   { 
					  		foreach ($data as $key => $value) 
							{ 
						?>
						<div class="full_row bordernew profile_list_outer">
							<div class="two columns">
								<a href="profile.php?id=<?php echo $value['nUser_Id']?>">
									<img src="<?php echo $objU->get_pimage_url(PROFILE_IMAGE_URL, $value['nPhoto_Id'], $value['vGender']);?>" width="100" height="100" title="<?php echo $value['vLogin']?>" alt="<?php echo $value['vLogin']?>" border="0">
								</a>
							</div>
							<!--<tr>
							<td align="right" class="profilenumber"><table width="100%"  border="0" cellspacing="0" cellpadding="3">
							<tr>
							<td align="right"><?php echo $value['nUser_Id']?></td>
							</tr>
							</table></td>
							</tr>-->
							<div class="ten columns">
								<div class="full_row">
									<div class="profile_listing_hdnew">
										<div class="nine columns">To:<?php echo $value['vLogin']?></div>
										<div class="three columns right">
											<div class="twelve">
												<div class="seven columns"><?php echo $objU->get_bgcheck_image($value['nUser_Id'])?></div>
												<div class="five columns right featured_icon"><?php echo $objU->get_featured_image($value['nUser_Id'])?></div>
											</div>
										</div>
									<div class="clear"></div>
									</div>
								</div>
								
								<div class="clear"></div>
								<div class="twelve">
									<div class="ten columns textstyle_new1">Sent on:&nbsp;<?php echo $ds->getFuzzyTime($value['dDay'])?></div>
									<div class="one right columns"><input type="checkbox" name="ids[]" value="<?php echo $value['nMessage_Id']?>"></div>
								</div>
								<!--<div class="full_row maintext1"><strong><?php// echo $value['dDay']?></strong></div>-->
								<div class="full_row maintext1">
									<?php echo $value['vAge']?>-year-old <?php echo $value['vGender']?> &nbsp;&nbsp;
									Height : <?php echo $value['nHeight'] <> "" ? $objU->get_height($value['nHeight']) : "--"?><br>
									<?php echo ($value['vCounty']!='')?$value['vCounty'].",":"";?>
									<?php echo ($value['vState']!='')?$value['vState'].",":"";?>
									<?php echo $value['vCountry']?>
								</div>
								
								<div class="clear"></div>
								<div class="full_row maintext1"><b>Message Details</b></div>
								<div class="full_row maintext1">
									Title: <?php echo $value['vTitle']?><br>
                                    <?php echo nl2br(htmlspecialchars(stripslashes($value['tContent'])))?>
								</div>									
								<div class="full_row profile_list_bottom_butn">
									<?php if(isset($_SESSION['user_id']) && $_SESSION['user_id']!='')
										  {
									?>
									
									<div class="columns"><a href="profile.php?id=<?php echo $value['nUser_Id']?>&EI=yes" class="express-interest-btn marginr" title="Express Interest"></a></div>
                                      <div class="columns"><a href="profile.php?id=<?php echo $value['nUser_Id']?>&SM=yes" class="send-mail-btn marginr" title="Send An Email"></a></div>
                                  <!--<div class="columns"><a title="Add as favourite" href="profile.php?id=<?php echo $value['nUser_Id']?>&AF=yes"><img src="images/addasfav.gif" alt="Add to favourite list" width="23" height="22" border="0" title="Add to favourite list"></a></td>-->
                                      <div class="columns"><a href="profile.php?id=<?php echo $value['nUser_Id']?>&AH=yes" class="hotlist-btn marginr" title="Add To Hot List"></a></div>
                                      <div class="columns"><a href="profile.php?id=<?php echo $value['nUser_Id']?>&ATF=yes" class="im-btn" title="Add To IM List"></a></div>
									 <?php }//end if?>
                                      <div class="columns"><div class="view-pro-row right"><a href="profile.php?id=<?php echo $value['nUser_Id']?>" class="view-pro-btn r_float" title="View Full Profile"></a></div></div>
									  
								</div>
							</div>
							
							<div class="clear"></div>
						</div>
						<?php }//end foreach
							}//end if
						   if ($pages <> "") 
						   {
					   	?>
						
						<div class="full_row pagenation"><?php echo $pages?></div>

											
						<?php } ?>
					</form>
				</div>
			</div>
		</div>
	</div>
	<div class="four columns right search_result_R"><?php include_once ("left.inc.php");?></div>
</div>

<?php include_once('bottomhtml.inc.php');?>
