<?php

/***************** DO NOT EDIT THIS FILE *************************
******************************************************************

INFORMATION:
------------

This is a core theme file, you should not need to edit 
this file directly. Code changes maybe lost during updates.

LAST UPDATED: 27th March 2011
EDITED BY: MARK FAIL
------------------------------------------------------------------

******************************************************************/

if(isset($_GET['cid']) && is_numeric($_GET['cid']) ){

	$te = explode("themes",$_SERVER['SCRIPT_FILENAME']);
	$tf = explode("PPT",trim($te[1])); 
	$themeName = str_replace("\\","",str_replace("\\\\","",str_replace("/","",str_replace("////","",$tf[0]))));	
	$path=dirname(realpath($_SERVER['SCRIPT_FILENAME']));
	$path_parts = pathinfo($path);
	$p = str_replace("wp-content","",$path_parts['dirname']);	
	$p = str_replace("themes","",$p);
	$p = str_replace("PPT","",$p);
	$p = str_replace($themeName,"",$p);
	$p = str_replace("template_","",$p);
	$p = str_replace("\\\\","",$p);
	$p = str_replace("////","",$p);
 			
	require( $p.'/wp-config.php' );
	
	$GLOBALS['premiumpress']['language'] = get_option("language");
	$PPT->Language();

	$the_post = get_post($_GET['cid']);
	if(!isset($the_post->ID)){ die(); }
	
	$expires = get_post_meta($the_post->ID, "expires", true);
	$code = get_post_meta($the_post->ID, "code", true);
	
	if(strtolower(PREMIUMPRESS_SYSTEM) == "couponpress"){
	
		$iframe = get_option("couponpress_iframe");
		
		$expires = get_post_meta($the_post->ID, "pexpires", true);
		
		if($expires == ""){
			$expires = premiumpress_time_difference(get_post_meta($the_post->ID, "expires", true));
		}
		
		// LOAD THE LINK CLOAKING FILE 
		if(get_option("cp_skimlinks") =="yes"){
			$skim = "http://go.redirectingat.com?id=".get_option("cp_skimlinks_id")."&xs=1&url=";
			$l = explode("http://",premiumpress_link($the_post->ID));
 			if(isset($l[2])){ $ll = "http://".$l[2]; }else{ if($l[0] !=""){ $ll = $l[0]; }else{ $ll = "http://".$l[1]; } }
			$url = $skim . $ll ."&sref=".$GLOBALS['bloginfo_url'];
		}else{
		$url 	= premiumpress_link($the_post->ID);
		}		
		
		if($iframe == "off"){
		header("location: ".$url);
		exit();
		}
		
	}else{
	
	$url  = premiumpress_link($the_post->ID);
	
	}
	
 	
	if($url == ""){  }else{ $imgT = "url"; } $imgT = "full";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><?php echo $the_post->post_title; ?></title>
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> 
<META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">
<META NAME="ROBOTS" CONTENT="INDEX, NOFOLLOW">
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">

<style type="text/css">

<?php if(isset($_GET['frame'])){ 

	$GlobalsArray = array("language","logo_url","feature_expiry","feature_expiry_do","imagestorage_link","thumbresize","submit_url","manage_url","dashboard_url",
	"contact_url","post_prun","prun_period","prun_status","analytics_tracking","faviconLink","nofollow"); 
	foreach($GlobalsArray as $value){
	$GLOBALS['premiumpress'][$value] 	= get_option($value);
	}  

$nv = get_post_meta($_GET['cid'], 'no_votes', true);
$yv = get_post_meta($_GET['cid'], 'yes_votes', true);

?>

body, * html { padding:0px; margin:0px; }
.w_960 {margin: auto auto;display: block; width:960px  }
.left { display: inline; float: left !important; }
.f_half {width: 50%;}
.wrapper {  overflow:hidden;  background: transparent url(<?php echo PPT_THEME_URI; ?>/template_couponpress/images/vote/bg1.png) top right repeat;   }
.wrapper1 { height:82px; padding:5px;    }
#logo { width:300px; }
#logo img { max-height:50px; margin-top:10px;  }
#logo img a { border:0px; }
#voteboxdiv { margin-top:2px; min-width:600px; }
#closediv { margin-top:2px; width:50px; height:50px; float:right; background: transparent url(<?php echo PPT_THEME_URI; ?>/template_couponpress/images/vote/close.png) top right no-repeat; text-indent:-9999px; }

 
/* ========== Global Styles ========== */
/* Form wrapper */
.thumbsup { position:relative; margin:0 auto; padding:0; border:0; cursor:default; }
.thumbsup.left { margin-left:0; }
.thumbsup.right { margin-right:0; }

/* Use pointer cursor for all input */
.thumbsup input, .thumbsup button, .thumbsup label { cursor:pointer; }
.thumbsup.disabled input, .thumbsup.disabled button, .thumbsup.disabled label { cursor:default; }

/* Remove dotted outlines on buttons in FF: http://bit.ly/cTp1kC */
.thumbsup input::-moz-focus-inner { border:0; }

/* Align spinner images */
.thumbsup .spinner { vertical-align:middle; }

/* ========== Buttons Template ========== */
.thumbsup.buttons.disabled button, .thumbsup.buttons.disabled .question { display:none; }
 
/* ========== Thumbs Up Down Template ========== */
.thumbsup.thumbs_up_down { width:300px; height:40px; background:url(<?php echo PPT_THEME_URI; ?>/template_couponpress/images/vote/thumbs_up_down.png) no-repeat 0 0; text-align:center; color:#000; margin-top:1px; margin-right:200px; }
.thumbsup.thumbs_up_down b { position:absolute; top:0; padding-top:4px; width:100px; font:bold 32px/36px 'Myriad Pro',sans-serif; letter-spacing:-0.05em; }
.thumbsup.thumbs_up_down b.squeeze { font-size:28px; }
.thumbsup.thumbs_up_down .result1 { left:0; }
.thumbsup.thumbs_up_down .result2 { right:0; }
.thumbsup.thumbs_up_down input { position:absolute; top:0; width:50px; height:40px; background:url(<?php echo PPT_THEME_URI; ?>/template_couponpress/images/vote/thumbs_up_down.png) no-repeat 50px 0; border:0; text-indent:-9999px; }
.thumbsup.thumbs_up_down input.up { left:100px; }
.thumbsup.thumbs_up_down input.down { right:100px; }
.thumbsup.thumbs_up_down input.up:hover, .thumbsup.thumbs_up_down input.up:focus { background-position:-300px 0; }
.thumbsup.thumbs_up_down input.down:hover, .thumbsup.thumbs_up_down input.down:focus { background-position:-350px 0; }
.thumbsup.thumbs_up_down input.up:active { background-position:-400px 0; }
.thumbsup.thumbs_up_down input.down:active { background-position:-450px 0; }
.thumbsup.thumbs_up_down.user_voted input.up, .thumbsup.thumbs_up_down.busy input.up { background-position:-500px 0; }
.thumbsup.thumbs_up_down.user_voted input.down, .thumbsup.thumbs_up_down.busy input.down { background-position:-550px 0; }
.thumbsup.thumbs_up_down.closed input.up { background-position:-600px 0; }
.thumbsup.thumbs_up_down.closed input.down { background-position:-650px 0; }

 
/* ========== Fixes for IE ========== */
/* For IE6 and 7: text-indent does not work to hide text on submit buttons */
.thumbsup.mini_thumbs input, .thumbsup.thumbs_up input, .thumbsup.thumbs_up_down input, .thumbsup.up_down input { font-size:0; line-height:999px; }
<?php }else{ ?>

body { font-size:15px; valign:top;}
h1 { padding:0px; margin-top:0px;}
._print { padding:10px;  border:2px dashed #000; }
.printbutton { padding:10px; font-size:16px; background: #efefef; border:1px solid #ddd; }
.printbutton:hover { background:#666; }
.printbutton a { font-size:18px; text-decoration:none; color:#333333; }
.printbutton a:hover { color:#FFFFFF;  font-weight:bold; }
<?php } ?>

</style>
<script type='text/javascript' src='<?php echo $GLOBALS['bloginfo_url']; ?>/wp-includes/js/jquery/jquery.js?ver=1.7.2'></script>
<script type='text/javascript' src='<?php echo PPT_THEME_URI; ?>/PPT/ajax/actions.js?ver=3.4.2'></script>
</head>

<body>

 
<?php if(isset($_GET['frame'])){ ?>


<div class="wrapper">

		<div class="w_960">
        
        <div class="wrapper1">

			<div class="f_half left" id="logo"> 
            
            <?php echo ' <a href="'.$GLOBALS['bloginfo_url'].'/" title="'.get_bloginfo('name').'">
             
			 	<img src="'.$PPT->Logo(true).'" alt="'.get_bloginfo('name').'" />
                
			 </a>'; ?>
             
            
            
            </div>        
        
            <div class="left" id="voteboxdiv">  
     
     		 <a href="<?php echo $url; ?>" id="closediv">close tab</a>
             
            
               
			<?php if(get_option("couponpress_didwork") == "on"){ ?>
                        
            <form method="post" id="thumbsup_vote" class="thumbsup thumbs_up_down" name="thumbs_up_down">
            
          
             
             
             
                <div id="votediv<?php echo $_GET['cid']; ?>">
                    <b class="result1 error " title="Votes up">+<?php echo $yv; ?></b>
                <b class="result2 error " title="Votes down">-<?php echo $nv; ?></b>
                
            
                <input class="up" name="thumbsup_vote" type="submit" value="+1" title="Vote up" onClick="jQuery('#thumbsup_vote').addClass('user_voted disabled');PPTVote(<?php echo $_GET['cid']; ?>,'yes','votediv<?php echo $_GET['cid']; ?>','<?php echo str_replace("http://","",PPT_THEME_URI); ?>/PPT/ajax/'); return false;">
                <input class="down" name="thumbsup_vote" type="submit" value="-1" title="Vote down" onClick="jQuery('#thumbsup_vote').addClass('user_voted disabled');PPTVote(<?php echo $_GET['cid']; ?>,'no','votediv<?php echo $_GET['cid']; ?>','<?php echo str_replace("http://","",PPT_THEME_URI); ?>/PPT/ajax/');return false;">
                
                </div>
                
            </form>
            
              <?php $code = get_post_meta($_GET['cid'], "code", true); if(strlen($code) > 1){  ?>
             <div class="codebox" style="color:#fff;font-size:16px; font-family:Arial, Helvetica, sans-serif; text-align:center;padding:2px;margin-right:100px;"><?php echo $code ; ?></div>  <?php } ?>
            
            <?php }else{ premiumpress_banner("top",true); }  ?>
            
           
    
            </div>           
        </div> 
	</div>
</div>


<iframe src="<?php echo $url; ?>" name="nWindow" scrolling="no" frameborder="0" width="100%" height="100%" style="min-height:2000px;" marginwidth="1" marginheight="0" align="middle" title="nWindow"></iframe>


<?php }else{ ?>

<div style="border:1px solid #000; margin:0px; padding:0px; width:540px;">
<div class="_print"> 

    <h1><?php echo $the_post->post_title; ?></h1>
    <?php if($the_post->post_content =="" || $the_post->post_content != $the_post->post_excerpt){ ?> <p><?php echo $the_post->post_excerpt; ?></p><?php } ?>
    <p><?php echo $the_post->post_content; ?></p>
    <?php if($expires !=""){ ?><p><strong>Expires: <?php echo date(get_option('date_format'),strtotime($expires)); ?> </strong></p><?php } ?>  
    <?php if($code !=""){ ?><p><strong>Coupon Code: <?php echo $code; ?> </strong></p><?php } ?> 
    
    <center><?php echo premiumpress_image($the_post->ID,"",array('alt' => $the_post->IDpost_title, 'width' => '160', 'height' => '110', 'style' => 'max-width:500px;' )); ?></center>
    

<div style="clear:both;"></div> 
</div></div>

<center><div  class="printbutton"><a href="javascript:void(0);" onclick="window.print()"><?php echo $PPT->_e(array('button','23')) ?></a></div></center>
<?php } ?>


</body>
</html>
<?php } ?>
