<?php

	if(query_load_posts_search() == "0"){
		echo '
			<section class="tsr tsr-p-10px tsr-mt-20 tsr-mb-20 fs-120 l-0" style="background-color: #eeeeee;">
				Nie znaleziono postów dla wyniku wyszukiwania: '.query_post_search().'.
			</section>
		';
	}

	if(query_load_posts_search() >= "1"){
		echo '
			<section class="tsr tsr-p-10px tsr-mt-20 tsr-mb-20 fs-90 l-0" style="background-color: #eeeeee;">
				Wynik wyszukiwania dla: '.query_post_search().'. Znalezionych Postów: '.query_load_posts_search().'
			</section>
		';
	}

	for($i=0; $i < query_load_posts_search(); $i++){

			/*echo query_load_posts();
			
			echo id_posts()[$i];
			
			echo author_posts()[$i];

			echo title_posts()[$i];
			
			echo url_posts()[$i];
			
			echo format_posts()[$i];
			
			echo category_posts()[$i];
			
			echo status_posts()[$i];
			
			echo tag_posts()[$i];
			
			echo datetime_posts()[$i];
			
			echo datetime_change_posts()[$i];
			
			echo user_edit_posts()[$i];
			
			echo comments_posts()[$i];
			
			echo thumbnail_posts()[$i];
			
			echo contents_posts()[$i];
			
			echo address_posts()[$i];
			echo '<a href="'.address_posts()[$i].'">ttt</a>';*/
			//var_dump(address_posts());
			//echo url_site_bm();
			
			//$nnd1 = status_posts();
			//var_dump(status_posts());
			
			//foreach ($nnd1 as $t) {
			//	echo $t;
			//}
						
			/*if(status_posts() == "public"){
				echo "tak";
			}else{
				echo "nie";
			}
			
			if(status_posts() == "protect_password"){
				echo '
				
				
				
			';
		}*/
			

		if((status_posts_search()[$i] == "public") OR (status_posts_search()[$i] == "protect_password")){
			if(title_posts_search()[$i] != "protect_password"){
?>

				<section class="tsr fs-100 l-0 tsr-mt-10 tsr-post-auto tsr-border-solid-bottom braund-post-<?php echo id_posts_search()[$i]; ?>">
					<?php if(thumbnail_posts_search()[$i] != NULL){?>
					<section class="tsr col-ms20">
						<?php echo thumbnail_posts_search()[$i]; ?>
					</section>
					<section class="tsr col-ms80 tsr-p-10px">
						<?php echo title_posts_search()[$i]; ?>
					</section>
					<section class="tsr col-ms80 fs-100 tsr-p-10px">
						opublikowano dnia <?php echo data_format(datetime_posts_search()[$i], "m.d.Y"); ?> o godzinie <?php echo data_format(datetime_posts_search()[$i], "H:i"); ?> przez <?php echo author_posts_search()[$i]; ?>
					</section>
					<?php }else{?>
					<section class="tsr tsr-p-10px">
						<?php echo title_posts_search()[$i]; ?>
					</section>
					<section class="tsr fs-100 tsr-p-10px">
						opublikowano dnia <?php echo data_format(datetime_posts_search()[$i], "m.d.Y"); ?> o godzinie <?php echo data_format(datetime_posts_search()[$i], "H:i"); ?> przez <?php echo author_posts_search()[$i]; ?>
					</section>
					<?php }?>
					<section class="tsr fs-100 tsr-mt-10 tsr-post-auto tsr-za-wi">
						<?php 
						if(contents_posts_search()[$i] == "protect_password"){
							echo "Post Zabespieczony Hasłem!";
						}else{
							echo contents_posts_search()[$i];
						}						
						?>
					</section>
					<section class="tsr fs-80 r-0 tsr-mb-10">
						<a href="<?php echo address_posts_search()[$i]; ?>">
							Pokaż więcej!
						</a>
					</section>
				</section>
	
<?php 
			}	
			
		} 
	
	}
?>	
