<?php
	include('views/_header.tpl.php');
	
	// LET'S MASK THE SUBSCRIBER'S EMAIL
	
	$subcode = $subscriber_info['ver_code'];
	
	$stars = 4; // Min Stars to use
	$em = $subscriber_info['email'];
	$at = strpos($em,'@');
	if ($at - 2 > $stars)
		$stars = $at - 2;
	$subscriber_email = substr($em,0,1) . str_repeat('*',$stars) . substr($em,$at - 1);
	
	// LET'S MASK THE SUBSCRIBER'S PHONE
	$phone = $subscriber_info['phone'];
	
	$phone_1 = substr( $phone, 0, 2 ); // Get the first two digits
	$phone_2 = str_repeat( '*', ( strlen( $phone ) - 4 ) ); // Apply enough asterisks to cover the middle numbers
	$phone_3 = substr( $phone, -3 ); // Get the last two digits
	
	$subscriber_phone  = $phone_1 . $phone_2 . $phone_3;
	
	if (isset($msg)) {
		$msg = "You unsubscribed successfully";
		echo "<center><b>$msg</b></center><br /><br />";
	}

	if (isset($_GET['msg'])) {
		$message = "You unsubscribed successfully";
		$msg = htmlentities(strip_tags($message));
		// ORIG $msg = htmlentities(strip_tags($_GET['msg']));
	}
?>

<script type="text/javascript">
$(document).ready(function() {

});	
</script>

<!-- MAY WANT TO REMOVE THE OVERFLOW HIDDEN STYLES, SO THE PAGE IS SCROLLABLE -->
<style type="text/css">
	html {
		overflow:auto !important;
		font-family: Montserrat,'Open Sans', Helvetica, Verdana,sans-serif;
	}
	body { height:100%; overflow:auto; font-family: Montserrat,'Open Sans', Helvetica, Verdana,sans-serif; }
	.spacer { padding-top: 60px; }
	
	h1 {
		font-family: Montserrat,'Open Sans', Helvetica, Verdana,sans-serif;
	}
	.prefstable a { 
		background:#333;
		color:#fff;
		padding:5px 5px;
		font-size:13px;
		border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px;
	}
	.prefstable a:hover { 
		background:#555;
	}
	
	#errordiv a,
	#errordiv a:active,
	#errordiv a:visited {
		background: #fff;
		color: #28d52d;
		border-radius: 50px; -moz-border-radius: 50px; -webkit-border-radius: 50px;
		padding: 3px 10px;
		font-weight: 800;
	}

	#errordiv a:hover {
		color: #fff;
		background: #28d52d;
	}	
	
	.bottomtray {
		display: none !important;
	}
	
/* ###################################################################### */
/* ###############              MOBILE STYLES             ############### */
/* ###################################################################### */

/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) {

}

/* Landscape phone to portrait tablet */
@media (max-width: 767px) {
	
}

/* Landscape phones and down */
@media (max-width: 586px) {
	
}

/* Landscape phones and down */
@media (max-width: 480px) {

}	

/* Older phones with super small screens */
@media (max-width: 320px) {

}	
</style>


<div class="home-feature-category" style="background:none; border:none;">
    <div class="container_12 clearfix">
        <div class="grid_12 marked-category">
        	<br />
			<div class="form form-profile aif" style="max-width:400px; margin:0 auto; background:#fff; padding:15px 25px; 
				border:1px solid #eee; font-size:15px; line-height:23px; font-family:Montserrat,'Open Sans', Helvetica, Verdana,sans-serif;">	
        
				<h1 style="text-shadow:0px 0px 0px rgba(255,255,255,0); margin:5px 0 15px; font-weight:600; color:#aaa;">Unsubscribe</h1>
				
				<?php
				if (isset($msg)) {
					echo "<div id='errordiv' style='line-height:25px; background:#cd1000; color:#fff; padding:11px 15px;
					margin:5px 0px 15px 0px; border:1px solid #fff; font-weight:300; text-align:center;
					 font-size:15px;'>$msg &nbsp;<a href='/unsubscribe/$subcode'>Ok!</a></div>";
				}
				?>	
				
				Your Email:<br />
				<?= $subscriber_email ?>
				<br /><br />
				Your Phone Number:<br />
				<?= $subscriber_phone ?>				
				<br /><br />

				<table class="prefstable" style="width:100%; overflow:hidden;">
					<tr>
						<th width="150" style="text-align:left;">TYPE</th>
						<th width="50">SUBSCRIBED</th>
						<th width="100">ACTION</th>
					</tr>
					<tr>
						<td style="padding:10px 0; text-align:left;">Email</td>
						<td style="padding:10px 0; text-align:center;">
							<?php if($subscriber_info['is_subscribe'] == 1) { ?>
							<i class="fa fa-check" aria-hidden="true"></i>
							<?php } else { ?>
							-
							<?php } ?>	
							</td>
						<td style="padding:10px 0; text-align:center;">
							<?php if($subscriber_info['is_text'] == 1) { ?>
								<a href="?unsubscribe">Unsubscribe</a>
							<?php } else { ?>
								<span style="font-size:12px;">Not subscribed</span>
							<?php } ?>
						
						</td>
					</tr>
					<tr>
						<td style="padding:10px 0; text-align:left;">SMS Text Message</td>
						<td style="padding:10px 0; text-align:center;">
							<?php if($subscriber_info['is_text'] == 1) { ?>
								<i class="fa fa-check" aria-hidden="true"></i>
							<?php } else { ?>
								-
							<?php } ?></td>
						<td style="padding:10px 0; text-align:center;">
							<?php if($subscriber_info['is_text'] == 1) { ?>
								<a href="?unsubtotext">Unsubscribe</a>
							<?php } else { ?>
								<span style="font-size:12px;">Not subscribed</span>
							<?php } ?>
						</td>
					</tr>
					<tr>
						<td style="padding:10px 0; text-align:left;">Push Notification</td>
						<td style="padding:10px 0; text-align:center;">
							<?php if($subscriber_info['is_push'] == 1) { ?>
								<i class="fa fa-check" aria-hidden="true"></i>
							<?php } else { ?>
								-
							<?php } ?>	
							</td>
						<td style="padding:10px 0; text-align:center;">
							<?php if($subscriber_info['is_push'] == 1) { ?>
								See Below
							<?php } else { ?>
								<span style="font-size:12px;">Not subscribed</span>
							<?php } ?>	
						</td>
					</tr>
				</table>
				
				<br />
				<div style="color:#999; font-size:14px; line-height:19px;">
					You can turn these settings back on at any time by 
					logging into your DevShares Account
					and going to the Notifications section on your Edit Account page.
				</div>
				<br />
				
				<div style="border-top:1px solid #ccc;">&nbsp;</div>
				
				<div style="font-family:Montserrat,'Open Sans', Helvetica, Verdana,sans-serif;">
					To "unsubscribe" from Push Notifications, follow the directions below.* 
					
					<br /><br />
					<span style="font-weight:700">iPhones/iPads (iOS)</span>
					<br />
					1. Open your iPhone&rsquo;s Settings app.<br />
					2. Scroll down to the bottom section where all the Apps are - and look for
					the DevShares App.<br />
					3. Click on &ldquo;Notifications&rdquo;<br />
					4. Toggle &ldquo;Allow Notifications&rdquo; to OFF
					<br /><br />
					
					<span style="font-weight:700">Android Phones/Tablets</span>
					<br />
					1. Open your phone&rsquo;s Settings app.<br />
					2. Tap Notifications. App settings.<br />
					3. Under "Most recent," find apps that recently sent you notifications. 
					To find more apps, in the dropdown menu, tap All apps.<br />
					4. Tap the app.<br />
					5. Turn the app&rsquo;s notifications on or off.<br />
					<br />
					<div style="color:#999; font-size:12px; line-height:17px">
						<i>*Note: These instructions may change or be different from when this 
						page was last updated due to continual updates by both Apple and Google.</i>
					</div>
				</div>
				
			</div>
		
		</div><!-- GRID 12 DIV ENDS HERE -->
	</div><!-- CONTAINER 12 DIV END HERE -->
</div><!-- HOME FEATURE CATEGORY DIV ENDS HERE -->

<?php
	include('views/_footer.tpl.php');
?>