<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  dir="ltr" lang="tr-TR">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Select A Page</title>


<?php

// Call WP Load
$wp_include = "../wp-load.php";$i = 0;
while (!file_exists($wp_include) && $i++ < 10) {$wp_include = "../$wp_include";} require($wp_include);
if ( !is_user_logged_in() || !current_user_can('edit_posts') ) 
	wp_die(__("You are not allowed to be here","cloudfw"));
	
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
$this_url = $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

global $_opt;

wp_enqueue_script('utils');

$cid = $_GET["id"];
$preview = $_GET["pid"];
$cases = $_GET["case"];
$hideparent = $_GET["hideparent"];
$whichin = $_GET["whichin"];
$s = $_GET["s"];
?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>

<script type="text/javascript">


jQuery(document).ready(function() {
								
			jQuery('.senderer').click(function(){
												   
			jQuery('#<?php echo $cid;?>',top.document).val(<?php if ($cases=="" || $cases=="url"){ echo 'jQuery(this).attr("rel")+"||"+jQuery(this).attr("href")';}else if ( $cases=="id"){ echo 'jQuery(this).attr("rel")+"||"+jQuery(this).attr("href")+"||"+jQuery(this).attr("id")';}else if ( $cases=="salturl"){ echo 'jQuery(this).attr("href")';} ?>);
			<?php if ($preview){?>
			
			jQuery('#<?php echo $preview;?>',top.document).html('<a href="#" onclick="javascript: jQuery(\'#<?php echo $cid;?>\').val(\'\').show();jQuery(\'#<?php echo $preview;?>\').html(\'\');return false;"><img src="<?php echo TMP_ADMIN_SRC;?>/cancel.gif" /></a> <a href="'+jQuery(this).attr("href")+'" target="_blank" class="page-preview-link"><span class="page-preview-title">'+jQuery(this).attr("rel")+'</span></a><span class="page-preview-url">'+jQuery(this).attr("href")+'</span>');
			
			<?php }
			if ($hideparent){?>
			jQuery('#<?php echo $cid;?>',top.document).hide();
			<?php }?>
			
			jQuery("#TB_imageOff",top.document).unbind("click");
			jQuery("#TB_closeWindowButton",top.document).unbind("click");
			jQuery("#TB_window",top.document).fadeOut("fast",function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect',top.document).trigger("unload").unbind().remove();});
			jQuery("#TB_load",top.document).remove();
			return false;});
			
			
			if(!(jQuery.browser.msie && jQuery.browser.version < 7)){
			jQuery('.senderer').hover(function(){jQuery('#msg').html('Select "'+jQuery(this).attr("rel")+'"<span>'+jQuery(this).attr("href")+'</span>').show();},function(){jQuery('#msg').html('').hide();});
			jQuery('.ex').hover(function(){jQuery('#msg').html('Open This On New Page<span>'+jQuery(this).attr("href")+'</span>').show();},function(){jQuery('#msg').html('').hide();});
			};
			
			
			  });

</script>

<link type="text/css" rel="stylesheet" href="<?php bloginfo("template_url")?>/reset.css" />

<style>

body {
	background:#f9f9f9;
	font-family: "Lucida Sans Unicode", "Lucida Grande", sans-serif;
	font-size: 12px;
	}
	
ul, li {
	list-style:none;
	margin:0;
	padding:0;
	}
	
#left {
	float:left;
	width:49%;
	margin:30px 0;
	}
	
#right {
	float:left;
	width:49%;
	margin:30px 0;
	border-left: dotted 1px #ccc;
	padding-left:1%;
	}
	
.inside {
	padding:20px 10px;;
	}
	
h3 {
	font: bold  16px/16px Arial, Helvetica, sans-serif;
	text-shadow:0 1px 0 #FFFFFF;
	color:#333;
	margin:0 0 0 20px;
	}
	
ul.items li{
/*	border-bottom:dotted 1px #ccc;
	padding:5px 0;
	list-style: square inside;
	color:#CCC;*/
	
	}
	
ul.items li a.senderer{
	display:block;
	color:#333;
	border-radius: 6px 0 0 6px;
	-moz-border-radius:6px 0 0 6px;
	-webkit-border-radius: 6px 0 0 6px;
	border:solid 1px #dedede;
	border-right:none;
	background: #f1f1f1;
	padding:5px 10px;
	margin:3px 0;
	text-decoration:none;
	float:left;
	width:80%;
	height:20px;
	}
	
ul.items li a.senderer:hover{
	color:#fff;
	background: #333;
	border:solid 1px #333;
	border-right:none;
	}
	
ul.items li a.senderer:active{
	color:#fff;
	background: #C03;
	border:solid 1px #C03;
	border-right:none;
	}
	
ul.items li a.ex{
	display:block;
	color:#333;
	border-radius: 0 6px 6px 0;
	-moz-border-radius: 0 6px 6px 0;
	-webkit-border-radius: 0 6px 6px 0;
	border:solid 1px #dedede;
	border-left:none;
	background: #f1f1f1 url(../cloudfw/icons/external.gif) no-repeat top center;
	padding:0;
	margin:3px 0;
	text-decoration:none;
	float:left;
	width:10%;
	height:30px;
	clear:right;
	}
	
ul.items li a.ex:hover{
	background: #333 url(../cloudfw/icons/external.gif) no-repeat bottom center;
	border:solid 1px #333;
	border-left:none;
	}
	
ul.items li a.ex:active{
	background: #C03 url(../cloudfw/icons/external.gif) no-repeat bottom center;
	border:solid 1px #C03;
	border-left:none;
	}
	
#msg {
	width:100%; bottom:0; left:0;
	position:fixed;
	background: #000;
	color:#FFF;
	padding:20px 0;
	text-align:center;
	-moz-opacity:.75; filter:alpha(opacity=75); opacity:.75;
	display:none;
	
	font: bold 16px/16px Arial, Helvetica, sans-serif;
	color:#fff;
	}
	
#msg span {
	display:block;
	margin:10px;
	font: normal 11px/11px Arial, Helvetica, sans-serif;
	color:#ccc;
	}

</style>

</head>
<body>
<div id="msg"></div>

<div style="float:right; margin: 10px 30px 0 0;">
<form action="<?php echo $this_url; ?>">
<input type="text" name="s" id="s" value="<?php echo $s;?>" style="width:150px;" />
<input type="hidden" name="id" value="<?php echo $cid;?>" />
<input type="hidden" name="pid" value="<?php echo $preview;?>" />
<input type="hidden" name="case" value="<?php echo $cases;?>" />
<input type="hidden" name="hideparent" value="<?php echo $hideparent;?>" />
<input type="hidden" name="whichin" value="<?php echo $whichin;?>" />
<input type="submit" value="<?php _e('Search','cloudfw'); ?>" />
</form>
</div>
<div style="clear:both;"></div>

<?php if ($whichin=="" || $whichin=="page"){?><div id="left">
<h3><?php if (!empty($s)) printf("'%s' In Pages", $s); else echo __('All Pages','cloudfw');?></h3>

<div class="inside">

	<ul class="items">
    	<?php 	
		
		
		$myPosts = new WP_Query();
		$myPosts->query(array( 'post_type' => array('page'), 'post__not_in' => $_opt['wptb_exclude_post'] , 'showposts' => '-1', 's' => $s));
		$count = $myPosts->post_count;
		$post_column_row = ceil($count/2)-1;
		
		if ($myPosts->have_posts()):
		
		while ($myPosts->have_posts()) : $myPosts->the_post();
		 ?>
       	 <li><a href="<?php the_permalink(); ?>" class="senderer" rel="<?php the_title(); ?>" id="<?php the_ID(); ?>"><?php echo (strlen(__translate( get_the_title()))>30) ? mb_substr(__translate( get_the_title() ),0,30).'..': __translate( get_the_title() ); ?></a><a href="<?php the_permalink(); ?>" target="_blank" class="ex"></a></li>
		<?php  
		
		if ($whichin=="page" && $post_column_row == $i) {
			
			echo '
</ul>
</div>

</div>

			
<div id="right">

<h3>&nbsp;</h3>

<div class="inside">

<ul class="items">';
			
			}
			
		$i++;
		
		endwhile;
		
		else:
		
		echo '<div style="margin-left:30px; color:#ccc;">Pages Not Found</div>';
		
		endif;
		
		
		?>
	</ul>
</div>

</div>

<?php };

if ($whichin=="" || $whichin=="post"){?>

<div id="right">
<h3><?php if (!empty($s)) printf("'%s' In Posts", $s); else echo __('All Posts','cloudfw');?></h3>

<div class="inside">

	<ul class="items">
    	<?php 	
		
		
		$myPosts = new WP_Query();
		$myPosts->query(array( 'post_type' => array('post'), 'post__not_in' => $_opt['wptb_exclude_post'] , 'showposts' => '-1', 's' => $s));
		$count = $myPosts->post_count;
		$post_column_row = ceil($count/2)-1;
		
		if ($myPosts->have_posts()):
		
		while ($myPosts->have_posts()) : $myPosts->the_post();
		 ?>
       	 <li><a href="<?php the_permalink(); ?>" class="senderer" rel="<?php the_title(); ?>" id="<?php the_ID(); ?>"><?php echo (strlen(__translate( get_the_title() ))>30) ? mb_substr(__translate( get_the_title() ),0,30).'..': __translate( get_the_title() ); ?></a><a href="<?php the_permalink(); ?>" target="_blank" class="ex"></a></li>
		<?php  
		
		if ($whichin=="post" && $post_column_row == $i) {
			
			echo '
</ul>
</div>

</div>

			
<div id="left">

<h3>&nbsp;</h3>

<div class="inside">

<ul class="items">';
			
			}
			
		$i++;
		
		endwhile;
		
		else:
		
		echo '<div style="margin-left:30px; color:#ccc;">Posts Not Found</div>';
		
		endif;
		
		
		?>
	</ul>
</div>

</div>
<?php };?>




</body>
</html>
