<?php
							 | 
						|
								/** 
							 | 
						|
								* @package	Galeria Suczawa 2009 
							 | 
						|
								* @file		functions.php
							 | 
						|
								* @version	$Id$
							 | 
						|
								* @author	PioDer <[email protected]>
							 | 
						|
								* @link 	http://suczawa.ath.cx/
							 | 
						|
								**/
							 | 
						|
								
							 | 
						|
								#wyświetl błąd
							 | 
						|
								function blad($msg)
							 | 
						|
								{
							 | 
						|
									die('
							 | 
						|
									<h1>Blad Galerii Zdjec Suczawa 2009!</h1>
							 | 
						|
									<span style="color: red; font-weight: bold; font-size: 12pt">'.$msg.'</span>');
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								function NaglowekXHTML()
							 | 
						|
								{
							 | 
						|
									$xhtml = preg_match('/application\/xhtml\+xml(?![+a-z])(;q=(0\.\d{1,3}|[01]))?/i', 
							 | 
						|
									$_SERVER['HTTP_ACCEPT'], $xhtml) && (isset($xhtml[2])?$xhtml[2]:1) > 0 || 
							 | 
						|
									strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator")!==false || 
							 | 
						|
									strpos($_SERVER["HTTP_USER_AGENT"], "WebKit")!==false;
							 | 
						|
									
							 | 
						|
									header('Content-Type: '.($xhtml?'application/xhtml+x':'text/ht').'ml; charset="utf-8"'); #IE doesn't support application/xhtml+xml - workaround
							 | 
						|
									
							 | 
						|
									echo '<?xml version="1.0" encoding="utf-8"?>'; 
							 | 
						|
								}
							 | 
						|
								 
							 | 
						|
								function GenerujListeStron()
							 | 
						|
								{
							 | 
						|
								   	global $cnt;
							 | 
						|
								   	global $page;
							 | 
						|
								   	$content = '';
							 | 
						|
								   	
							 | 
						|
									if ($page>1)
							 | 
						|
									{
							 | 
						|
										$content .= '<a href="?page=1" title="Pierwsza strona">«</a>';
							 | 
						|
										$content .= '  <a href="?page='.($page-1).'" title="Poprzednia strona"><</a> ';
							 | 
						|
									}
							 | 
						|
									
							 | 
						|
									#wygeneruj strony
							 | 
						|
									for ($i=1;$i<=$cnt;$i++)
							 | 
						|
								   	{
							 | 
						|
								     		if ($i==$page)
							 | 
						|
								     		{
							 | 
						|
											if ($i == $cnt)
							 | 
						|
											{
							 | 
						|
												$content .= '<span style="text-decoration: underline">'.$i.'</span>';
							 | 
						|
											}
							 | 
						|
											else
							 | 
						|
											{
							 | 
						|
									    			$content .= '<span style="text-decoration: underline">'.$i.'</span>'.' | ';
							 | 
						|
											}
							 | 
						|
										}
							 | 
						|
										else
							 | 
						|
										{
							 | 
						|
											if ($i == $cnt)
							 | 
						|
											{
							 | 
						|
												$content .= '<a href="?page='.$i.'">'.$i.'</a> ';
							 | 
						|
											}
							 | 
						|
											else
							 | 
						|
											{
							 | 
						|
									    			$content .= '<a href="?page='.$i.'">'.$i.'</a> | ';
							 | 
						|
											}
							 | 
						|
										}
							 | 
						|
								     	}
							 | 
						|
								     	#dodaj linka "+1 strona" oraz do ostatniej
							 | 
						|
									if ($page<$cnt)
							 | 
						|
								     	{
							 | 
						|
								    		$content .= '<a href="?page='.($page+1).'" title="Następna strona">></a>';
							 | 
						|
								    		$content .= '  <a href="?page='.$cnt.'" title="Ostatnia strona">»</a>';
							 | 
						|
									}
							 | 
						|
									
							 | 
						|
									#dodaj linka do ostatniej strony
							 | 
						|
								     	echo $content;
							 | 
						|
								}
							 | 
						|
								?>
							 |