<?php
							 | 
						|
								/** 
							 | 
						|
								* @package	Galeria Suczawa 2009 
							 | 
						|
								* @file		functions.php
							 | 
						|
								* @version	$Id$
							 | 
						|
								* @author	PioDer <[email protected]>
							 | 
						|
								* @link 	http://suczawa.ath.cx/
							 | 
						|
								**/
							 | 
						|
								
							 | 
						|
								$xhtml=true;
							 | 
						|
								
							 | 
						|
								#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()
							 | 
						|
								{
							 | 
						|
									global $xhtml;
							 | 
						|
									$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;
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								function Przekieruj($url='index.php', $tresc='')
							 | 
						|
								{
							 | 
						|
									if ($tresc!='')
							 | 
						|
									{
							 | 
						|
										die('
							 | 
						|
										<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
							 | 
						|
										<meta http-equiv="refresh" content="2; url='.$url.'" />
							 | 
						|
										'.$tresc);
							 | 
						|
									}
							 | 
						|
									else
							 | 
						|
									{
							 | 
						|
										die('<meta http-equiv="refresh" content="0; url='.$url.'" />');
							 | 
						|
									}
							 | 
						|
								}
							 | 
						|
								
							 | 
						|
								function NaglowekPA($nazwapodstrony)
							 | 
						|
								{
							 | 
						|
									global $xhtml;
							 | 
						|
									echo '
							 | 
						|
									<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
							 | 
						|
									<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
							 | 
						|
									<head>
							 | 
						|
										<title>ACP • '.$nazwapodstrony.'</title>
							 | 
						|
										<meta http-equiv="Content-Type" content="'.($xhtml?'application/xhtml+x':'text/ht').'ml; charset=utf-8" />
							 | 
						|
										<style type="text/css">
							 | 
						|
										body { font-family: Verdana; font-size: 10pt}
							 | 
						|
										a { color: red; text-decoration: none }
							 | 
						|
										a:hover { color: orange; text-decoration: underline }
							 | 
						|
										.b { background-color: #666666; color: white; border: 1px; }
							 | 
						|
										</style>
							 | 
						|
									</head>
							 | 
						|
									<body>
							 | 
						|
									<center>
							 | 
						|
									<div align="center" style="width: 900px">
							 | 
						|
									<h1>Panel Administracyjny Galerii Zdjęć</h1>
							 | 
						|
									';
							 | 
						|
									
							 | 
						|
									if ($_SESSION['logged'])
							 | 
						|
									{
							 | 
						|
										echo '
							 | 
						|
										<a href="index.php?mode=admin_gallery">Administruj galerią</a> •
							 | 
						|
										<a href="index.php?mode=admin_users">Administruj użytkownikami</a> •
							 | 
						|
										<a href="index.php?mode=logout">Wyloguj</a> ';
							 | 
						|
									}
							 | 
						|
								}
							 | 
						|
								function StopkaPA()
							 | 
						|
								{
							 | 
						|
									echo '
							 | 
						|
									<span style="font-size: 8pt">ACP by <a href="http://pioder.gim2przemysl.int.pl" target="_blank">PioDer</a> © 2009</span>
							 | 
						|
									</div>
							 | 
						|
									</center>
							 | 
						|
									</body>
							 | 
						|
									</html>
							 | 
						|
									';
							 | 
						|
								}
							 | 
						|
								?>
							 |