Location: PHPKode > projects > MySonar > mysonar-gui-1.0/view-1.0.php
<?php
/**
 * mySonar GUI - Version 1.0
 * mySonar (reachable under mySonar.de) is a platform for Location Based Mobile Networking. 
 * Users can find friends, flirts, partys and places arround by uses their mobile devices.
 * The application has several components. One of the components is the graphical user interface 
 * to access a XML Web Service layer, the services, kernel and database behind. This source file
 * belongs to that component.
 * 
 * Copyright (C) 2008 mySonar GbR, Markus Heussen
 * 
 * This program is free software; you can redistribute it and/or modify it under the terms of the 
 * GNU General Public License as published by the Free Software Foundation; only GPLv2.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with this program; 
 * if not, see <http://www.gnu.org/licenses/>.
 */

defined("ACCESS") or die("Direct access to this resource is not allowed.");

class View {
	var $MySonar;
	
	public function __construct($MySonar) {
		$this->MySonar = $MySonar;
	}
	
	public function displayPageHeader() {
		if ($this->MySonar->getProperty("standalone")) {
			echo '<?xml version="1.0" encoding="iso-8859-1"?>';
			echo '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">';
			echo '<html>';
			echo '<head>';
			echo '<title>'.$this->MySonar->getProperty("title").'</title>';
			include("style-1.0.php");
			echo '<meta http-equiv="expires" content="0"/>';
			echo '<meta http-equiv="cache-control" content="max-age=0"/>';
			echo '<meta http-equiv="pragma" content="no-cache"/>';
			echo '<meta http-equiv="content-type" content="application/xhtml+xml" />';
			echo '<meta name="description" content="'.$this->MySonar->getProperty("description").'" />';
			echo '<meta name="keywords" content="'.$this->MySonar->getProperty("keywords").'" />';
			echo '</head>';
			echo '<body>';
		}
		echo '<div class="sonar">';
		echo '<div class="header"><img src="images/logo_mysonar.gif" width="161" height="43" alt="mySonar"/>'; 
		echo '</div>';
	}
		
	public function displayPageFooter() {
		$days = $this->MySonar->getProperty("days");
		echo '<br/><p class="highlight">'.$days[date("w")].' &middot; '.date("d.m.y").' &middot; '.date("H:i").' Uhr</p>';
		echo '<div class="footer">';
		echo '<p>&copy; '.date("Y").' &middot; <a href="index.php?m=getHelp&amp;key=menu">Hilfe</a> &middot; <a href="index.php?m=getHelp&amp;key=about">&Uuml;ber</a> &middot; <a href="index.php?m=getHelp&amp;key=imprint">Impressum</a></p>';
		echo '</div>';
		echo '</div>';
		if ($this->MySonar->getProperty("standalone")) {
			echo '</body>';
			echo '</html>';
		}
	}
		
	private function displayTitle($title, $style = "title") {
		echo '<div class="'.$style.'">';
		echo $title;
		echo '</div>';
	}
	
	private function displaySubTitle($subtitle) {
		echo '<p><strong>'.$subtitle.'</strong></p>';
	}
	
	private function displayCategory($name) {
		echo '<p><div class="border"><strong class="highlight">'.$name.'</strong></div></p>';
	}
	
	public function displayHomepage($fullPage = true, $Query = "", $firstLogin = false, $Modules = null, $Profile = "DEFAULT", $tab = null, $Statistics = null, $Msg = NULL) {
		$_SESSION["menuHTML"] = NULL; // delete cache for back function
		$_SESSION["menuHTML2"] = NULL; // delete cache 2 for back function
		if ($fullPage) $this->displayPageHeader();
		if ($Msg!=NULL) $this->displayMsg(false, $Msg);
		if ($_SESSION["Security"]!=null) {
			// check if something has happend
			if ($Statistics!=null) {
				$Mails = $Statistics->NewMessages;
				$Balance = $Statistics->Balance;
				$WhazzuppAlert = false;
				if ($Statistics->NewFriendships>0) $WhazzuppAlert = true;
				if ($Statistics->LastVisitors>0) $WhazzuppAlert = true;
			}
			// user is logged in
			$this->displayTitle('<span class="friend">Freunde</span> &middot; <span class="flirt">Flirts</span> &middot; <span class="party">Partys</span> &middot; <span class="location">Pl&auml;tze</span>');
			// start top navigation
			echo '<p>';
			echo '<a '.($Mails>0 ? 'class="spot" ':'').'href="index.php?m=getInbox">'.($Mails>0 ? ''.$Mails.'':'').' Mail'.($Mails==1 ? '':'s').'</a> &middot; <a '.($WhazzuppAlert ? '':'').'href="index.php?m=getStatistics">'.($WhazzuppAlert ? '<span class="spot">*</span> ':'').'Whazzupp?</a> &middot; <a href="'.$_PHPSELF.'">Reload</a> &middot; <a href="index.php?m=logout">Raus</a><br/>';
			echo '<a href="index.php?m=getFriends">Kontakte</a> &middot; <a href="index.php?m=getStatement&amp;StartDate='.date("Y-m-d\TH:i:s", strtotime($_SESSION["User"]->LastLogin)).'">Konto</a>: <span class="'.($Balance>0 ? 'highlight':'spot').'">'.number_format(round($Balance,0), 0, ',', '.').' $'.($Balance==1 ? '':'').'</span>';
			echo '</p>';
			// start search box
			echo '<form action="index.php" method="get">';
			switch ($Profile) {
				case "USERS_BY_KEY": 
					echo '<div class="module"><strong>Leute suchen</strong></div><p class="li altline">';
					echo '<span style="">Vorname oder Stichwort</span>'; $HelpKey = "QueryUSER"; 
				break;
				case "UID": 
					echo '<div class="module"><strong>Leute suchen</strong></div><p class="li altline">';
					echo '<span style="">Mitgliedsnr. eingeben</span>'; $HelpKey = "QueryUID";
				break;
				case "PID": 
					echo '<div class="module"><strong>Pl&auml;tze suchen</strong></div><p class="li altline">';
					echo '<span style="">POI-Nummer eingeben</span>'; $HelpKey = "QueryPID"; 
				break;
				case "KEY": 
					echo '<div class="module"><strong>Stichwort suchen</strong></div><p class="li altline">';
					echo '<span style="">Stichwort eingeben</span>'; $HelpKey = "QueryKEY"; 
				break;
				default: 
					echo '<div class="module"><strong>Umgebung durchsuchen</strong></div><p class="li altline">';
					echo '<span'.($Query=="" ? ' class="spot"':'').'>Ort &middot; ggf. Stra&szlig;e eingeben</span>'; $HelpKey = "QueryDEFAULT"; 
				break;
			}
			echo ' &middot; <a class="" href="index.php?m=getHelp&amp;key='.$HelpKey.'">?</a>';
			echo '<br/>';
			echo '<input type="hidden" name="m" value="sendPing" />';
			echo '<input type="hidden" name="Profile" value="'.$Profile.'" />';
			echo '<input type="hidden" name="StartIndex" value="1" />';
			echo '<input type="hidden" name="Limit" value="9" />';
			echo '<input class="text_home" type="text" name="Query" value="'.$Query.'" id="sonar_location" size="10"/>&nbsp;';
			echo '<input class="button_home" id="sonar_submit" type="submit" name="submit" value="Suche"/>';
			echo '<br/>';
			$links = array();
			if ($Profile!="DEFAULT") array_push($links, '<a class="" href="index.php?Profile=DEFAULT&amp;Query='.$_SESSION["Location"]->Address.'">Standortsuche</a>');
			if ($Profile!="USERS_BY_KEY") array_push($links, '<a class="" href="index.php?Profile=USERS_BY_KEY&amp;Query=">Leute suchen</a>');
			if ($Profile!="KEY") array_push($links, '<a class="" href="index.php?Profile=KEY&amp;Query=">Stichwortsuche</a>');
			$i = 0; $j = count($links);
			for ($i=0;$i<$j;$i++) {
				echo $links[$i]; 
				if ($i<$j-1) echo ' &middot; ';
			}
			echo '</p>';
			echo '</form>';			
			// start tab menu
			echo '<div class="tab">';
			echo ($tab!="" ? '<a class="tab" href="index.php">Home</a>':'<span class="tab_selected">Home</span>').'&nbsp;&nbsp;';
			echo ($tab!="SEARCH" ? '<a class="tab" href="index.php?Tab=SEARCH">Suche</a>':'<span class="tab_selected">Suche</span>').'&nbsp;&nbsp;';
			echo ($tab!="GROUPS" ? '<a class="tab" href="index.php?Tab=GROUPS">Gruppen</a>':'<span class="tab_selected">Gruppen</span>').'&nbsp;&nbsp;';
			echo ($tab!="OPTIONS" ? '<a class="tab" href="index.php?Tab=OPTIONS">Extras</a>':'<span class="tab_selected">Extras</span>');
			echo '</div>';
			// start tab
			echo '<div class="tabcontent">';
			echo '<p>';
			$options = array();
			switch ($tab) {
				case "SEARCH":
					array_push($options, array("title"=>"Die reichsten Mitglieder", "href"=>"index.php?m=sendPing&Profile=TOP_ACCOUNTS&amp;Start=1&amp;Limit=9", "hint"=>""));
					array_push($options, array("title"=>"Beliebteste Pl&auml;tze in der N&auml;he", "href"=>"index.php?m=sendPing&amp;Profile=TOP_POI_NEARBY&amp;Start=1&amp;Limit=9", "hint"=>""));
					array_push($options, array("title"=>"Beste Partys in der N&auml;he", "href"=>"index.php?m=sendPing&amp;Profile=TOP_PARTYS_NEARBY&amp;Start=1&amp;Limit=9", "hint"=>""));
					array_push($options, array("title"=>"Meine Partys &amp; Pl&auml;tze anzeigen", "href"=>"index.php?m=sendPing&amp;Profile=MY_POI&amp;Start=1&amp;Limit=9", "hint"=>""));
					$this->displayOptions($options);
				break;
				case "GROUPS":
					array_push($options, array("title"=>"Meine eigene Gruppe gr&uuml;nden", "href"=>"index.php?m=createGroup", "hint"=>""));
					array_push($options, array("title"=>"Alle Gruppen anzeigen", "href"=>"index.php?m=sendPing&amp;Profile=ALL_GROUPS&amp;StartIndex=1&amp;Limit=9", "hint"=>""));
					$this->displayOptions($options);
				break;
				case "OPTIONS":
					array_push($options, array("title"=>"(Profil-) Einstellungen &auml;ndern", "href"=>"index.php?m=getSonarPreferences", "hint"=>""));
					array_push($options, array("title"=>"Meine Statusmeldung bearbeiten", "href"=>"index.php?m=updateUser&amp;Option=StatusMessage", "hint"=>""));
					array_push($options, array("title"=>"Mein Profil ansehen", "href"=>"index.php?m=getProfile", "hint"=>""));
					array_push($options, array("title"=>"Mein Passwort &auml;ndern", "href"=>"index.php?m=changePassword", "hint"=>""));
					$this->displayOptions($options);
				break;
				default:
					array_push($options, array("title"=>"Meine letzten Standorte anzeigen", "href"=>"index.php?m=getLastLocations", "hint"=>""));
					array_push($options, array("title"=>"Neue Partys und Pl&auml;tze melden", "href"=>"index.php?m=setPointOfInterest", "hint"=>""));
					array_push($options, array("title"=>"Meine Freunde per SMS einladen", "href"=>"index.php?m=setInvitation", "hint"=>""));
					array_push($options, array("title"=>"Alle Mitglieder anzeigen", "href"=>"index.php?m=sendPing&amp;StartIndex=1&amp;Limit=9&amp;Profile=ALL_USERS", "hint"=>""));
					array_push($options, array("title"=>"Meine Flirts anzeigen", "href"=>"index.php?m=getFlirts", "hint"=>""));
					$this->displayOptions($options);
				break;
			}
			echo '</p>';
			echo '</div>';
			// start modules
			if ($Modules!=NULL) {
				if (is_object($Modules)) $Modules = array($Modules);
				foreach ($Modules as $Module) {
					$Infos = $Module->Info;
					if ($Infos!=NULL && !is_array($Infos)) $Infos = array($Infos);
					if ($Infos) {
						echo '<a name="mod'.$Module->ID.'"/>';
						echo '<div class="module"><strong>'.$Module->Name.'</strong></div>';
						$i=0;
						foreach ($Infos as $Info) {
							echo '<p class="li '.(fmod($i, 2)==1 ? 'altline':'line').'">'.$this->translate($Info).'</p>';
							$i++;
						}
						echo '<div class="module_info">&nbsp;'.count($Infos).' '.(count($Infos)==1 ? 'Eintrag':'Eintr&auml;ge').'';
						if (count($Infos)>3) echo ' &middot; <a href="index.php">weniger</a>';
						elseif (count($Infos)==3) echo ' &middot; <a href="index.php?ModuleID='.$Module->ID.'&amp;Limit=25#mod'.$Module->ID.'">mehr</a>';
						echo ' &middot; <a href="index.php?m=getHelp&amp;key=mod'.$Module->ID.'">?</a>';
						echo '</div>';
					} //else echo '<p class="li altline">Keine Ergebnisse gefunden.</p>';
				}
			}
		} else {
			// user is not logged in
			echo '<strong><span class="friend">Freunde</span>, <span class="flirt">Flirts</span>, <span class="party">Partys</span> &amp; <span class="location">Pl&auml;tze</span> in deiner Umgebung orten!</strong>';
			$menuHTML = '<p><a href="index.php?m=login">Login</a> &middot; <a href="index.php?m=createUser">Kostenlos registrieren</a> &middot; <a href="index.php?m=getHelp&amp;key=menu">Hilfe</a></p>'; 
			echo $menuHTML;
			echo '<p class="highlight"><a href="index.php?m=checkInvitationCode">Eingeladen worden?</a><br/><a href="index.php?m=createUser&amp;Code=">$onar-Geldschein bekommen?</a></p>';
			echo '<p><img title="Lokalisieren..." src="images/map.gif" hspace="5" vspace="5" width="117" height="117" alt="Karte"/></p>';
			echo '<p><strong class="highlight">Location Based Networking</strong></p>';
			echo '<span class="nav">';
			echo '<p class="li"><strong class="highlight">&middot;</strong>&nbsp;Handy + Community + Navi</p>';
			echo '<p class="li"><strong class="highlight">&middot;</strong>&nbsp;Menschen &amp; Pl&auml;tze in deiner N&auml;he</p>';
			echo '<p class="li"><strong class="highlight">&middot;</strong>&nbsp;Kostenlose SMS an Freunde</p>';
			echo '<p class="li"><strong class="highlight">&middot;</strong>&nbsp;Immer informiert per Free-SMS</p>';
			echo '<p class="li"><strong class="highlight">&middot;</strong>&nbsp;Dollars verdienen &amp; ausgeben</p>';
			echo '</span>';
			echo '<p><strong class="title">Alles dauerhaft kostenlos!</strong></p>';
			echo $menuHTML;
		}
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayLoginForm($fullPage = true, $username = "", $password = "") {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Login");
		$menuHTML = '<p><a href="index.php">Abbrechen</a> &middot; <a href="index.php?m=getNewPassword">Passwort vergessen?</a></p>';
		echo $menuHTML;
		echo '<form action="index.php" method="get">';
		echo '<input type="hidden" name="m" value="login" />';
		echo '<p>Nickname (Benutzername)<br />';
		echo '<input class="text" type="text" name="Username" id="sonar_username" size="20" value="'.htmlspecialchars($username).'" /></p>';
		echo '<p>Passwort<br />';
		echo '<input class="text" type="password" name="Password" id="sonar_password" size="20" value="'.$password.'"/></p>';
		echo '<p><input type="submit" name="submit" class="button" value="Login" /></p>';
		echo '</form>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayPasswordForm($fullPage = true, $password = "") {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Passwort &auml;ndern");
		$menuHTML = '<p><a href="index.php?Tab=OPTIONS">Zur&uuml;ck</a></p>';
		echo $menuHTML;
		if ($_SESSION["User"]->MobilePhoneNumber=="" || !$_SESSION["User"]->MobilePhoneNumberConfirmed) {
			echo '<div class="border"><p>Aus Sicherheitsgr&uuml;nden kannst du dein Passwort erst &auml;ndern, wenn du deine Handynummer angegeben und best&auml;tigt hast. Wir senden die dein neues Passwort per Free-SMS an dein Handy. So hast du sicher gehen, dass du es nicht vergisst.<br/>';
			echo '<a href="index.php?m=updateUser&amp;Option=MobilePhoneNumber&amp;value='.$_SESSION["User"]->MobilePhoneNumber.'">Handynummer angeben</a></p></div>';
		} else {
			echo '<div class="border">Wir senden dir dein neues Passwort per Free-SMS an dein Handy. So kannst du sicher gehen, dass du es nicht vergisst.</div>';
			echo '<form action="index.php" method="get">';
			echo '<div>';
			echo '<input type="hidden" name="m" value="changePassword" />';
			echo '<p>Neues Passwort<br />';
			echo '<input class="text" type="password" name="Password" id="sonar_password" size="20" value="'.$password.'"/><br/><span class="spot">min. 3 Zeichen</span></p>';
			echo '<p><input type="submit" name="submit" class="button" value="&Auml;ndern" /></p>';
			echo '</div>';
			echo '</form>';
		}
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayNewPasswordForm($fullPage = true, $Username = "", $MobilePhoneNumber = "", $Birth = "") {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Passwort vergessen");
		$menuHTML = '<p><a href="index.php?m=login">Zum Login</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<form action="index.php" method="get">';
		echo '<input type="hidden" name="m" value="getNewPassword" />';
		echo '<p>Da wir Passw&ouml;rter nicht auslesen k&ouml;nnen, senden wir dir ein neues Kennwort per Free-SMS.</p>';
		echo '<div class="border">';
		echo '<p>Nickname (Benutzername)<br />';
		echo '<input class="text" type="text" name="Username" id="sonar_username" size="20" value="'.htmlspecialchars($Username).'"/></p>';
		echo '<p>Handynummer &middot; z. B. 01737401483<br />';
		echo '<input class="text" type="text" name="MobilePhoneNumber" id="sonar_mobilphonenumber" size="20" value="'.$MobilePhoneNumber.'"/></p>';
		echo '</div>';
		echo '<p><input type="submit" name="submit" class="button" value="Passwort anfordern" /></p>';
		echo '</form>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
			
	public function displayLogoutPage($fullPage = true) {
		if ($fullPage) $this->displayPageHeader();
		$menuHTML = '<p>'.$this->MySonar->getProperty("homelink").' &middot; <a href="index.php?m=login">Login</a></p>';
		echo $this->displayTitle("Du hast dich abgemeldet!");
		echo $menuHTML;
		echo '<p>Willst du noch mehr Spa&szlig; haben?</p><p>Dann lade deine Freunde und Bekannte zu <span class="my">my</span><span class="sonar">Sonar</span> ein. Als Dankesch&ouml;n erh&auml;ltst du 150 $onars pro erfolgreicher Einladung.</p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayRegistration($fullPage = true, $User, $Page, $Code=null) {
		if ($Page==NULL) $Page = 1;
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Kostenlos registrieren &middot; ".$Page." von 2");
		$buffer = "";
		
		switch ($Page) {
			case 1:
				$menuHTML = '<p><a href="index.php">Abbrechen</a></p>';
				$buffer .= '<div class="border">';
				$buffer .= '<p>Nickname (Benutzername)<br />';
				$buffer .= '<input class="text" type="text" name="Username" id="sonar_username" maxlength="15" size="20" value="'.htmlspecialchars($User->Username).'" /></p>';
				$buffer .= '<p>Passwort<br />';
				$buffer .= '<input class="text" type="password" name="Password" id="sonar_password" size="20" value="'.$User->Password.'" /></p>';
				$buffer .= '<p>Handynummer &middot; z. B. 01737401483<br />';
				$buffer .= '<input class="text" type="text" name="MobilePhoneNumber" id="sonar_mobilephonenumber" maxlength="15" size="20" value="'.$User->MobilePhoneNumber.'" /><br><span class="highlight">freiwillige Angabe</span></p>';
				$buffer .= '<p>Geburtsdatum &middot; Format: TTMMJJJJ<br />';
				$buffer .= '<input class="text" type="text" name="Birth" maxlength="8" size="20" value="'.$User->Birth.'" /><br><span class="highlight">freiwillige Angabe</span></p>';
				$buffer .= '<p>Geschlecht<br />';
				$buffer .= '<input type="radio" name="Sex" value="FEMALE" '.($User->Sex=="" || $User->Sex=="FEMALE" ? 'checked="checked"':'').'/> <span class="female">weiblich</span> <input type="radio" name="Sex" value="MALE" '.($User->Sex=="MALE" ? 'checked="checked"':'').'/> <span class="male">m&auml;nnlich</span></p>';
				$buffer .= '</div>';
				if (isset($Code)) {
					$buffer .= '<p class="highlight">Deinen $onar-Geldschein kannst du gleich mit registrieren. Einfach den aufgedruckten Code eingeben. <a href="index.php?m=getHelp&amp;key=q903">Hilfe</a></p>';
					$buffer .= '<p>Geldschein-Code (5-stellig)<br/>';
					$buffer .= '<input class="text" type="text" name="Code" id="sonar_code" size="20" value="'.$code.'"/></p>';
				}
				$buffer .= '<p><input type="submit" name="submit" class="button" value="Weiter zur &Uuml;bersicht" /></p>';
			break;
			case 2:
				$menuHTML = '<p><a href="index.php?m=createUser&amp;Username='.htmlspecialchars($User->Username).'&amp;Password='.$User->Password.'&amp;MobilePhoneNumber='.$User->MobilePhoneNumber.'&amp;Birth='.$User->Birth.'&amp;Sex='.$User->Sex.(isset($code) ? '&amp;Code='.$Code:'').'">Daten &auml;ndern</a> &middot; <a href="index.php">Abbrechen</a></p>';
				$buffer .= '<p>Hiermit best&auml;tige ich, dass meine Daten korrekt sind und ich die <a href="index.php?m=getTermsAndConditions">Nutzungsbedingungen</a> gelesen und akzeptiert habe.</p>';
				$buffer .= '<div class="border"><p>';
				$buffer .= '<p>Nickname (Benutzername)<br/><span class="highlight">'.htmlspecialchars($User->Username).'</span>&nbsp;</p>';
				$buffer .= '<p>Passwort<br/><span class="highlight">'.$User->Password.'</span>&nbsp;</p>';
				$buffer .= '<p>Handynummer<br/><span class="highlight">'.htmlspecialchars($User->MobilePhoneNumber).'</span>&nbsp;</p>';
				$buffer .= '<p>Geburtsdatum (TTMMJJJJ)<br/><span class="highlight">'.$User->Birth.'</span>&nbsp;</p>';
				$buffer .= '<p>Geschlecht<br/><span class="highlight">'.($User->Sex=="MALE" ? 'm&auml;nnlich':'weiblich').'</span>&nbsp;</p>';
				if ($Code!="") $buffer .= '<p>Code:<br/><span class="highlight">'.$Code.'</span>&nbsp;</p>';
				$buffer .= '</p></div>';
				$buffer .= '<p><form action="index.php" method="get">';
				$buffer .= '<input type="hidden" name="m" value="createUser" />';
				$buffer .= '<input type="hidden" name="Username" value="'.htmlspecialchars($User->Username).'"/>';
				$buffer .= '<input type="hidden" name="Password" value="'.$User->Password.'"/>';
				$buffer .= '<input type="hidden" name="MobilePhoneNumber" value="'.$User->MobilePhoneNumber.'"/>';
				$buffer .= '<input type="hidden" name="Sex" value="'.$User->Sex.'"/>';
				$buffer .= '<input type="hidden" name="Birth" value="'.$User->Birth.'"/>';
				if ($Code!=null) $buffer .= '<input type="hidden" name="Code" value="'.$Code.'"/>';
				$buffer .= '<p><input type="submit" name="ok" class="button" value="Jetzt registrieren"/></p></form></p>';
			break;
			default:
				$buffer .= '<p>Keine Seite gefunden.</p>';
			break;
		}
		
		echo $menuHTML;
		echo '<form action="index.php" method="get">';
		echo '<input type="hidden" name="m" value="createUser" />';
		echo '<input type="hidden" name="Page" value="'.($Page+1).'" />';
		if (isset($Code)) echo '<input type="hidden" name="Code" value="'.$Code.'" />';
		echo $buffer;
		echo '</form>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayCheckInvitationCode($fullPage = true, $param1, $param2) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Einladung annehmen");
		$menuHTML = '<p><a href="index.php">Abbrechen</a></p>';
		echo $menuHTML;
		echo '<form action="index.php" method="get">';
		echo '<input type="hidden" name="m" value="checkInvitationCode" />';
		echo '<p>Wenn du von Freunden eingeladen wurdest, hast du einen 4-stelligen Code per SMS bekommen. Bitte gib diesen Code und deine Handynummer in die folgenden Felder ein:</p>';
		echo '<p>Handynummer<br/>';
		echo '<input class="text" type="text" name="MobilePhoneNumber" id="sonar_mobilephonenumber" size="20" value="'.$param1.'"/><br/><span class="message">Nur Ziffern eingeben!</span></p>';
		echo '<p>Einladungscode<br/>';
		echo '<input class="text" type="text" name="InvitationCode" id="sonar_invitationcode" size="20" value="'.$param2.'"/></p>';
		echo '<p><input type="submit" name="submit" class="button" value="Weiter" /></p>';
		echo '</form>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayConfirmInvitation($fullPage = true, $User) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Einladung annehmen");
		$menuHTML = '<p><a href="index.php?m=createUser&amp;Username='.htmlspecialchars($User->Name).'&MobilePhoneNumber='.$User->MobilePhoneNumber.'">Weiter zur Registrierung</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p>Sch&ouml;n, dass du der Einladung gefolgt bist! Du kannst dich jetzt ganz einfach, schnell und <a href="index.php?m=createUser&amp;Username='.htmlspecialchars($User->Name).'&amp;MobilePhoneNumber='.$User->MobilePhoneNumber.'">kostenlos registrieren</a>.</p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	
	
	public function displayStatistics($fullPage = true, $Statistics, $firstLogin=false) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Whazzupp?");
		$menuHTML = '<p>'.$this->MySonar->getProperty("homelink").' &middot; <a href="index.php?m=logout">Raus</a></p>'; 
		echo $menuHTML;
		echo '<p>';
		echo '<strong>Aktuelles</strong>';
		echo '<br/><span class="highlight">Stand: '.date("d.m. - H:i").' Uhr</span>';
		if ($Statistics->LastLogin!="") echo '<br/><span class="highlight">Letzter Login: '.date("d.m. - H:i", strtotime($Statistics->LastLogin)).' Uhr</span>';		
		echo '</p><div class="border"><p>';
		echo '&middot; <a href="index.php?m=getInbox">Ungelesene Mails</a> : '.$Statistics->NewMessages.'<br/>';
		echo '&middot; <a href="index.php?m=getFriendshipRequests">Offene Kontaktanfragen</a> : '.($Statistics->NewFriendships!="" ? $Statistics->NewFriendships:'0').'<br/>';
		echo '&middot; <a href="index.php?m=sendPing&amp;Profile=NEW_USERS_LAST_LOGIN">Neue Mitglieder</a> : '.($Statistics->LatestUsers!="" ? $Statistics->LatestUsers:'0').'<br/>';
		echo '&middot; <a href="index.php?m=sendPing&amp;Profile=LATEST_VISITORS_LAST_LOGIN">Neue Profil-Besucher</a> : '.($Statistics->LatestVisitors!="" ? $Statistics->LatestVisitors:'0').'<br/>';
		echo '&middot; <a href="index.php?m=getStatement&amp;StartDate='.$Statistics->LastLogin.'">Neue Kontobewegungen</a> : '.($Statistics->NewTransactions!="" ? $Statistics->NewTransactions:'0').'<br/>';
		echo '&middot; <a href="index.php?m=sendPing&amp;Profile=NEW_GROUPS_LAST_LOGIN">Neue Gruppen</a> : '.($Statistics->LatestGroups!="" ? $Statistics->LatestGroups:'0').'<br/>';
		echo '&middot; <a href="index.php?m=getPendingPOIs">Meine POIs in Pr&uuml;fung</a>: '.$Statistics->NewPendingPointOfInterests.'';
		echo '</div></p>';
		$sysMsg = "";
		if ($_SESSION["User"]->MobilePhoneNumber==NULL || $_SESSION["User"]->MobilePhoneNumberConfirmed==false) {
			$sysMsg .= '&middot; '.($_SESSION["User"]->MobilePhoneNumber=="" ? '<a class="spot" href="index.php?m=updateUser&amp;Option=MobilePhoneNumber&amp;value='.$_SESSION["User"]->MobilePhoneNumber.'">Handynummer angeben</a>':'<a class="spot" href="index.php?m=confirmUser">Handynummer aktivieren</a>').'</a><br/>';
		}
		if ($_SESSION["Picture"]==NULL) {
			$sysMsg .= '&middot; <a class="spot" href="index.php?m=setPicture">Profilfoto hochladen</a><br/>';
		}
		if ($sysMsg!="") {
			echo '<p><strong>Systemmeldungen</strong><br/>'.$sysMsg.'</p>';
		}
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
		
	public function displayErrors($fullPage = true, $SonarErrors) {
		if ($fullPage) {	
			$this->displayPageHeader();
			echo '<p>'.$this->MySonar->getProperty("homelink").'</p>';
		}
		echo '<p>';
		$errors = $SonarErrors->getErrors();
		foreach ($errors as $error) echo '<span class="spot">Fehler '.$error[0].': '.$error[1].'</span>';
		echo '</p>';
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayMsg($fullPage= true, $msg) {
		if ($fullPage) $this->displayPageHeader();
		echo '<div class="box">';
		echo $msg;
		echo '</div>';
		if ($fullPage) $this->displayPageFooter();
	}
		
	public function displayPing($fullPage = true, $resultset, $Query=null) {
		$_SESSION["menuHTML"] = NULL; // delete cache for back function
		if ($fullPage) $this->displayPageHeader();
		if (!$resultset instanceof SonarErrors) {
			$list = $resultset["Objects"];
			$Options = $resultset["Options"];
			$resultlistFrom = $Options->StartIndex;
			$resultlistTo = ($Options->NumberResults<$Options->Limit ? $resultlistFrom+$Options->NumberResults-1:($Options->StartIndex==1 ? $resultlistFrom+$Options->Limit-1:$resultlistFrom+$Options->Limit));
			$i=0; $key=1;
			$maxDistance = 0;
			if (count($list)>0) {
				$locations = $_SESSION["Location"]->ID.','; // First Location.ID is the one of the user himself
				$buffer = ''; 
				while ($i < count($list)) {
					$Object = $list[$i]; 
					$Location = $Object->Location;
					$locations .= $Location->ID.',';
					switch ($Object->Type) {
						case "USER": 
							$User = $Object->User;
							$buffer .= '<p class="li '.(fmod($key, 2)==1 ? 'line':'altline').'"><span class="accesskey '.strtolower($Object->Type).' '.($User->Flirt==true ? "user_flirt":"").' '.($User->Friendship=="CONFIRMED" ? "user_friend":"").'">'.$key.'</span>&nbsp;&nbsp;';
							$buffer .= ($User->Sex=="MALE" ? '<img src="images/man'.($User->Flirt==true ? '_flirt':'').(fmod($key, 2)==1 ? '_line':'_altline').'.gif" width="13" height="18" alt=""/>&nbsp;&nbsp;&nbsp;':($User->Sex=="FEMALE" ? '<img src="images/woman'.($User->Flirt==true ? '_flirt':'').(fmod($key, 2)==1 ? '_line':'_altline').'.gif" alt=""/>&nbsp;&nbsp;&nbsp;':'')).'<a accesskey="'.$key.'" href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'">'.htmlspecialchars($User->Username).'</a>'.($User->BestFriend==true ? ' &middot; <span class="friend">BEF</span>':'').($User->Status=="ONLINE" ? ' &middot; <span class="online">ON</span>':' &middot; <span class="offline">OFF</span>'); 
							// picture
							if ($User->Picture) $buffer .= ' &middot; <strong>BILD</strong>';
						break;
						case "POI": 
							if ($Object->Party!=NULL) {
								$POIType = $Object->Party->Type;
								$type = 'poi_'.strtolower($POIType);
								$PointOfInterest = $Object->Party;
								$Vote = $Object->Party->Vote;
							} else {
								$POIType = $Object->PointOfInterest->Type;
								$type = 'poi_'.strtolower($POIType);
								$PointOfInterest = $Object->PointOfInterest;
								$Vote = $Object->PointOfInterest->Vote;
							}
							$buffer .= '<p class="li '.(fmod($key, 2)==1 ? 'line':'altline').'"><span class="accesskey '.strtolower($Object->Type).' '.$type.'">'.$key.'</span>&nbsp;&nbsp;';
							$buffer .= '<a class="'.$Object->Type.$Location->Category.'" accesskey="'.$key.'" href="index.php?m=getPointOfInterest&amp;ID='.$PointOfInterest->ID.'">'.$PointOfInterest->Name.'</a>'.(date("Y-m-d\TH:i:s", strtotime($_SESSION["User"]->LastLogin)) <= date("Y-m-d\TH:i:s", strtotime($PointOfInterest->PublishedFrom))? ' &middot; <span class="new">NEU</span>':''); 
							// vote
							$grades = $this->MySonar->getProperty("grades");
							if ($Vote->TotalAmount>0) $buffer .= '<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Note: <span class="highlight">'.$grades[round($Vote->Value)].' ('.round($Vote->Value,1).')</span> &middot; '.$Vote->TotalAmount.' Stimme'.($Vote->TotalAmount==1 ? '':'n');
						break;
						case "GROUP":
							$Group = $Object->Group;
							$buffer .= '<p class="li '.(fmod($key, 2)==1 ? 'line':'altline').'"><span class="accesskey '.strtolower($Object->Type).'">'.$key.'</span>&nbsp;&nbsp;';
							$buffer .= '<a title="'.$Group->Name.'" class="'.$Object->Type.$Location->Category.'" accesskey="'.$key.'" href="index.php?m=getGroup&amp;ID='.$Group->ID.'">'.(strlen($Group->Name)>25 ? substr($Group->Name,0,25).'...':$Group->Name).'</a>'.(date("Y-m-d\TH:i:s", strtotime($_SESSION["User"]->LastLogin)) <= date("Y-m-d\TH:i:s", strtotime($Group->Created))? ' &middot; <span class="new">NEU</span>':''); 
							$buffer .= '<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.substr($Group->Description,0,28).(strlen($Group->Description)>28 ? '...':'').'';
						break;
						default: break;
					}
					if (isset($Object->Distance)) {
						// evaluate distance
						if ($Object->Distance > 1) $distance = round($Object->Distance, 1).' Kilometer';
						elseif ($Object->Distance==0) $distance = '< 50 Meter';
						else {
							$meter = round($Object->Distance*1000, 1);
							if ($meter < 100) $distance = ''.$meter.' Meter';
							elseif ($meter < 500) $distance = ''.$meter.' Meter';
							else $distance = ''.$meter.' Meter';
						}
						// write distance
						$buffer .= '<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.($Object->Type=="POI" ? '<span>'.$distance.'</span>':$distance).'';
					}
					$days = $this->MySonar->getProperty("days");
					switch ($Object->Type) {
						case "GROUP": 
							$buffer .= '<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$Group->Members.' Mitglied'.($Group->Members==1 ? '':'er').'';
							$buffer .= '<br/><span class="'.$Object->Type.$Location->Category.'">';
							$buffer .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="category">Gruppen</span>'; 
							$buffer .= '</span>';
						break;
						case "POI": 
							$buffer .= '<br/><span class="'.$Object->Type.$Location->Category.'">';
							if ($Object->Party!=NULL) {
								$buffer .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.($Object->Party->Type=="EVENT" ? 'Event' : ($Object->Party->Private==true ? 'Privat-Party':'Party')).' am '.$days[date("w", strtotime($Object->Party->Begin))].',';
								$buffer .= '<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.date("d.m.", strtotime($Object->Party->Begin)).' um '.date("H:i", strtotime($Object->Party->Begin)).' Uhr<br/>'; 
							}
							$POITypes = $this->MySonar->getProperty("poitypes");
							$buffer .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="category">'.$POITypes[$POIType].'</span>'; 
							$buffer .= '</span>';
						break;
						case "USER":
							$tmp = array();
							// age
							if ($User->Age!="") array_push($tmp, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.($User->Sex=="MALE" ? '<span class="male">m&auml;nnlich</span> &middot; ':($User->Sex=="FEMALE" ? '<span class="female">weiblich</span> &middot; ':'')).$User->Age.' Jahre ');
							// sex
							// on last location update time the user was here
							if ($User->Status!="ONLINE" && $User->LastLogin!=NULL) array_push($tmp, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="highlight">War '.(date("d.m.Y", strtotime($User->LastLogin))==date("d.m.Y") ? 'heute um '.date("H:i", strtotime($User->LastLogin)).' Uhr ':'am '.$days[date("w", strtotime($User->LastLogin))].',<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.date("d.m.", strtotime($User->LastLogin)).' um '.date("H:i", strtotime($User->LastLogin)).' Uhr').' hier.</span>');
							if ($Options->Profile=="NEW_USERS_LAST_LOGIN" || $Options->Profile=="NEW_USERS") array_push($tmp, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="highlight">Dabei seit '.date("d.m.Y", strtotime($User->RegisterDate)).'.</span>');
							array_push($tmp, '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="category">Mitglieder</span>'); 
							if (count($tmp)>0) { 
								$buffer .= '<br/>';
								$j=0;
								while ($j<count($tmp)) {
									$buffer .= $tmp[$j].'<br/>';
									$j++;
								}
								$buffer .= '';
							}
						break;
					}
					$buffer .= '</p>';
					$i++; $key++;
				}
				$buffer .= '';
				switch ($Options->Profile) {
					case "NEW_USERS_LAST_LOGIN": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Neue Mitglieder seit letztem Login.</p>'; 
						$menuHTML = '<p><a href="index.php?m=getStatistics">Whazzupp?</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "NEW_GROUPS_LAST_LOGIN": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Neue Gruppen seit letztem Login.</p>'; 
						$menuHTML = '<p><a href="index.php?m=getStatistics">Whazzupp?</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "NEW_USERS": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Die letzten '.$Options->NumberResults.' neuen Mitglieder.</p>'; 
						$menuHTML = '<p><a href="index.php?m=getStatistics">Whazzupp?</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "LATEST_VISITORS_LAST_LOGIN": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Profil-Besucher seit letztem Login.</p>'; 
						$menuHTML = '<p><a href="index.php?m=getStatistics">Whazzupp?</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "LATEST_VISITORS": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Die letzten '.$Options->NumberResults.' Profil-Besucher.</p>'; 
						$menuHTML = '<p><a href="index.php?m=getStatistics">Whazzupp?</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "UID": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Suche nach UID</p>'; 
						$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "PID": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Suche nach PID</p>'; 
						$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "KEY": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Suche mit Stichwort</p>'; 
						$menuHTML = '<p><a href="index.php?Profile=KEY&amp;Query='.$_GET["Query"].'">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "ALL_USERS": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Alle Mitglieder sortiert nach letztem Login.</p>'; 
						$menuHTML = '<p>'.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "TOP_POI_NEARBY": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Beliebteste Pl&auml;tze im Umkreis!</p>'; 
						$menuHTML = '<p><a href="index.php?Tab=SEARCH">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "TOP_PARTYS_NEARBY": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Beste Partys im Umkreis!</p>'; 
						$menuHTML = '<p><a href="index.php?Tab=SEARCH">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "TOP_ACCOUNTS": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Die reichsten Mitglieder!</p>'; 
						$menuHTML = '<p><a href="index.php?Tab=SEARCH">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "USERS_BY_KEY": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Suche nach Leuten!</p>'; 
						$menuHTML = '<p><a href="index.php?Profile=USERS_BY_KEY&amp;Query='.$Query.'">Home</a></p>';
					break;
					case "ALL_GROUPS": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Alle Gruppen sortiert nach Aktivit&auml;t!</p>'; 
						$menuHTML = '<p><a href="index.php?Tab=GROUPS">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					case "MY_POI": 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						echo '<p>Durch mich gemeldete Partys &amp; Pl&auml;tze, absteigend sortiert nach letzter Aktualisierung!</p>'; 
						$menuHTML = '<p><a href="index.php?Tab=SEARCH">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
					default: 
						$this->displayTitle("Ergebnisse ".$resultlistFrom.'-'.$resultlistTo.' von '.$Options->NumberResults);
						if ($_SESSION["Location"]->Address!="") echo '<p>'.round($_SESSION["SonarPreferences"]->Range / 1000, 2).' km rund um <a href="index.php?m=getMap&amp;Locations='.$locations.'&amp;Zoom=15&amp;StartIndex='.$Options->StartIndex.'&amp;Limit='.$Options->Limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$_SESSION["Location"]->ID.'">'.$_SESSION["Location"]->Address.'</a></p>'; 
						$menuHTML = '<p><a href="index.php?m=getMap&amp;Locations='.$locations.'&amp;StartIndex='.$Options->StartIndex.'&amp;Limit='.$Options->Limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;back='.urlencode($_SERVER["REQUEST_URI"]).'">Karte</a> &middot; <a href="index.php?m=getSonarPreferences">Einstellungen</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
					break;
				}
				// paging
				$paging = '<p>';
				if ($list[0]->ID > 1) { 
					$back = true;
					if ($Options->StartIndex==10) $paging .= '<a href="index.php?m=sendPing&amp;Query='.($Query!=null ? $Query:urlencode($_SESSION["Location"]->Address)).'&amp;StartIndex=1&amp;Limit='.$Options->Limit.'&amp;Profile='.$Options->Profile.'">Zur&uuml;ck</a> ';
					else $paging .= '<a href="index.php?m=sendPing&amp;Query='.($Query!=null ? $Query:urlencode($_SESSION["Location"]->Address)).'&amp;StartIndex='.($Options->StartIndex-1-$Options->Limit).'&amp;Limit='.$Options->Limit.'&amp;Profile='.$Options->Profile.'">Zur&uuml;ck</a> ';
				} 
				if ($list[count($list)-1]->ID < $Options->NumberResults-1) {
					if ($back) $paging .= " &middot; ";
					if ($Options->StartIndex==1) $paging .= ' <a href="index.php?m=sendPing&amp;Query='.($Query!=null ? $Query:urlencode($_SESSION["Location"]->Address)).'&amp;StartIndex=10&amp;Limit='.$Options->Limit.'&amp;Profile='.$Options->Profile.'">Weiter</a>'; 
					else $paging .= ' <a href="index.php?m=sendPing&amp;Query='.($Query!=null ? $Query:urlencode($_SESSION["Location"]->Address)).'&amp;StartIndex='.($Options->StartIndex+$Options->Limit+1).'&amp;Limit='.$Options->Limit.'&amp;Profile='.$Options->Profile.'">Weiter</a>'; 
				}
				$paging .= '</p>';
				// show page navigation only when more than 30 list items
				if ($Options->NumberResults>30) { 
					$paging .= '<p>';
					$pages = floor($Options->NumberResults / $Options->Limit);
					if ($Options->StartIndex!=1) $paging .= '<a href="index.php?m=sendPing&amp;Query='.urlencode($_SESSION["Location"]->Address).'&amp;StartIndex=1&amp;Limit='.($Options->Limit).'&amp;Profile='.$Options->Profile.'">1</a> ';
					else $paging .= ' <span class="selectedpage">1</span>';
					$j=10; 
					for ($i=2;$i<=$pages;$i++) {
						if ($i<=15) {
							if ($Options->StartIndex!=$j) $paging .= ' <a href="index.php?m=sendPing&amp;Query='.urlencode($_SESSION["Location"]->Address).'&amp;StartIndex='.($j).'&amp;Limit='.($Options->Limit).'&amp;Profile='.$Options->Profile.'">'.$i.'</a>';
							else $paging .= ' <span class="selectedpage">'.$i.'</span>';
							$j=$j+($Options->Limit+1);
						}
					}
					$paging .= '</p>';
				}
				echo $menuHTML;
				echo '<div class="border">';
				echo $paging;
				echo $buffer;
				echo $paging;
				echo '</div>';
				echo $menuHTML;
			}
		} else {
			$this->displayTitle("Keine Suchergebnisse");
			$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
			echo $menuHTML;
			$options = array();
			switch ($_GET["Profile"]) {
				case "NEW_USERS_LAST_LOGIN": 
					echo '<p>Seit deinem letzten Login am '.date("d.m.", strtotime($_SESSION["User"]->LastLogin)).' um '.date("H:i", strtotime($_SESSION["User"]->LastLogin)).' Uhr gibt es keine neuen Mitglieder. Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Letzten Login ignorieren", "href"=>"index.php?m=sendPing&amp;Profile=NEW_USERS"));
					array_push($options, array("title"=>"Freunde einladen", "href"=>"index.php?m=setInvitation"));
				break;
				case "NEW_GROUPS_LAST_LOGIN": 
					echo '<p>Seit deinem letzten Login am '.date("d.m.", strtotime($_SESSION["User"]->LastLogin)).' um '.date("H:i", strtotime($_SESSION["User"]->LastLogin)).' Uhr gibt es keine neuen Gruppen. Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Letzten Login ignorieren", "href"=>"index.php?m=sendPing&amp;Profile=ALL_GROUPS"));
					array_push($options, array("title"=>"Eine Gruppe gr&uuml;nden", "href"=>"index.php?m=createGroup"));
				break;
				case "LATEST_VISITORS_LAST_LOGIN": 
					echo '<p>Seit deinem letzten Login am '.date("d.m.", strtotime($_SESSION["User"]->LastLogin)).' um '.date("H:i", strtotime($_SESSION["User"]->LastLogin)).' Uhr wurde dein Profil nicht besucht. Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Letzten Login ignorieren", "href"=>"index.php?m=sendPing&amp;Profile=LATEST_VISITORS"));
					array_push($options, array("title"=>"Freunde anschreiben", "href"=>"index.php?m=getFriends"));
					array_push($options, array("title"=>"Freunde einladen", "href"=>"index.php?m=setInvitation"));
				break;
				case "LATEST_VISITORS": 
					echo '<p>Bisher hat sich niemand f&uuml;r dich interessiert. Vielleicht hast du keine Freunde oder warst noch nicht aktiv genug! Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Freunde einladen", "href"=>"index.php?m=setInvitation"));
					array_push($options, array("title"=>"Freunde anschreiben", "href"=>"index.php?m=getFriends"));
					array_push($options, array("title"=>"Partys oder Locations melden", "href"=>"index.php?m=setPointOfInterest"));
				break;
				case "UID": 
					echo '<p>Vertippt? Die UID ist uns nicht bekannt! Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Nochmal eingeben", "href"=>"index.php?Profile=UID&amp;Query=".$_GET["Query"]));
					array_push($options, array("title"=>"Mit UID als Stichwort suchen", "href"=>"index.php?Profile=KEY&amp;Query=".$_GET["Query"]));
					array_push($options, array("title"=>"Deine Umgebung durchsuchen", "href"=>"index.php?m=sendPing&amp;Profile=DEFAULT&amp;Start=1&amp;Limit=9"));
				break;
				case "PID": 
					echo '<p>Vertippt? Die PID ist uns nicht bekannt! Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Nochmal eingeben", "href"=>"index.php?Profile=PID&amp;Query=".$_GET["Query"]));
					array_push($options, array("title"=>"Mit PID als Stichwort suchen", "href"=>"index.php?Profile=KEY&amp;Query=".$_GET["Query"]));
					array_push($options, array("title"=>"Deine Umgebung durchsuchen", "href"=>"index.php?m=sendPing&amp;Profile=DEFAULT&amp;Start=1&amp;Limit=9"));
				break;
				case "KEY": 
					echo '<p>Nee, da haben wir nix gefunden! Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Stichwort ver&auml;ndern", "href"=>"index.php?Profile=KEY&amp;Query=".$_GET["Query"]));
					array_push($options, array("title"=>"POI unter Stichwort melden", "href"=>"index.php?m=setPointOfInterest"));
					array_push($options, array("title"=>"Deine Umgebung durchsuchen", "href"=>"index.php?m=sendPing&amp;Profile=DEFAULT&amp;Start=1&amp;Limit=9"));
				break;
				case "TOP_POI_NEARBY": 
					echo '<p>An deinem Standort und in dem von dir definierten Umkreis wurden noch keine Pl&auml;tze bewertet. Was willst du jetzt tun? ';	
					echo 'Hinweis: <span class="my">my</span><span class="sonar">Sonar</span> kennt deinen Standort, sobald du ihn eingegeben und eine <a href="index.php">Suche</a> gestartet hast.</p>';
					array_push($options, array("title"=>"Umkreis vergr&ouml;&szlig;ern", "href"=>"index.php?m=getSonarPreferences&amp;Option=Range"));
					array_push($options, array("title"=>"Pl&auml;tze suchen &amp; bewerten", "href"=>"index.php?m=sendPing&amp;Profile=DEFAULT&amp;Start=1&amp;Limit=9"));
				break;
				case "TOP_PARTYS_NEARBY": 
					echo '<p>An deinem Standort und in dem von dir definierten Umkreis wurden noch keine Partys oder Events bewertet. Was willst du jetzt tun? ';	
					echo 'Hinweis: <span class="my">my</span><span class="sonar">Sonar</span> kennt deinen Standort, sobald du ihn eingegeben und eine <a href="index.php">Suche</a> gestartet hast.</p>';
					array_push($options, array("title"=>"Umkreis vergr&ouml;&szlig;ern", "href"=>"index.php?m=getSonarPreferences&amp;Option=Range"));
					array_push($options, array("title"=>"Partys suchen &amp; bewerten", "href"=>"index.php?m=sendPing&amp;Profile=DEFAULT&amp;Start=1&amp;Limit=9"));
				break;
				case "ALL_GROUPS": 
					echo '<p>Es gibt noch keine Gruppen. Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Neue Gruppe gr&uuml;nden", "href"=>"index.php?m=createGroup"));
				break;
				case "MY_POI": 
					echo '<p>Nee, du hast weder Partys noch Pl&auml;tze gemeldet! Deshalb haben wir nix gefunden. Was willst du jetzt tun?</p>';	
					array_push($options, array("title"=>"Partys oder Pl&auml;tze melden", "href"=>"index.php?m=setPointOfInterest"));
					array_push($options, array("title"=>"Was anderes suchen", "href"=>"index.php?Tab=SEARCH"));
				break;
				default: 
					echo '<p>Hier in der Gegend ist irgendwie (noch) nix los! Was willst du jetzt tun?</p>';
					array_push($options, array("title"=>"Suchradius erh&ouml;hen", "href"=>"index.php?m=getSonarPreferences&amp;Option=Range"));
					array_push($options, array("title"=>"Partys oder Locations melden", "href"=>"index.php?m=setPointOfInterest"));
					array_push($options, array("title"=>"Freunde einladen", "href"=>"index.php?m=setInvitation"));
				break;
			}
			$this->displayOptions($options);
			if (!isset($_GET["Profile"]) || $_GET["Profile"]=="DEFAULT") echo '<p class="highlight">Kommst du aus der Gegend und willst uns aktiv vor Ort unterst&uuml;tzen? Dann werde doch <a href="index.php?m=getHelp&amp;key=q901">City Manager</a> bei <span class="my">my</span><span class="sonar">Sonar</span>!</p>';
			echo $menuHTML;
		}
		if ($fullPage) $this->displayPageFooter();
	}
		
	public function displayMap($fullPage = true, $locations, $lid, $start, $limit, $result) {
		if ($fullPage) $this->displayPageHeader();
		$Map = $result[0];
		$MapType = ($Map->Type!="" ? $Map->Type:"DEFAULT");
		$Objects = $result[1];
		$this->displayTitle("Karte".($Map->Zoom>0 ? " &middot; Zoomfaktor ".$Map->Zoom:""));
		if (is_object($Objects)) $Objects = array($Objects);
		switch ($Map->MimeType) {
			case "image/jpeg": $suffix = ".jpg"; break;
			case "image/gif": $suffix = ".gif"; break;
			case "image/png": $suffix = ".png"; break;
			case "image/x-png": $suffix = ".png"; break;
		}
		$filename = $_SESSION["Security"]->Token.'_'.$Map->Zoom.'_'.time().$suffix;
		$i=0; $buffer = "";
		if ($lid=="") $lid = $_SESSION["Location"]->ID;
		if ($Map!=null) {
			$MapTypeHTML = '<p>';
			if ($MapType=="DEFAULT") $MapTypeHTML .= '<a href="index.php?m=getMap&amp;Type=HYBRID&amp;Locations='.$locations.'&amp;Zoom='.$Map->Zoom.'&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">Satelitenansicht</a>';
			else $MapTypeHTML .= '<a href="index.php?m=getMap&amp;Type=DEFAULT&amp;Locations='.$locations.'&amp;Zoom='.$Map->Zoom.'&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">Kartenansicht</a>';
			$MapTypeHTML .= '<br/>';
				if ($Map->Zoom!="") {
				if (($Map->Zoom+1)<=17) $MapTypeHTML .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom='.($Map->Zoom+1).'&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">Reinzoomen</a>';
				if ($Map->Zoom<17 && $Map->Zoom>1) $MapTypeHTML .= ' &middot; ';
				if (($Map->Zoom-1)>=1) $MapTypeHTML .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom='.($Map->Zoom-1).'&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">Rauszoomen</a>';
			}
			$MapTypeHTML .= '</p>';
			$zoomerTop = '<p>Zoom: ';
			$zoomerTop .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=17&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">17</a> | '; 
			$zoomerTop .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=16&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">16</a> | '; 
			$zoomerTop .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=15&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">15</a> | '; 
			$zoomerTop .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=14&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">14</a> | '; 
			$zoomerTop .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=13&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">13</a> | '; 
			$zoomerTop .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=12&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">12</a>'; 
			$zoomerTop .= '</p>';
			$zoomerBottom = '<p>';
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=11&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">11</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=10&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">10</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=9&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">9</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=8&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">8</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=7&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">7</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=6&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">6</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=5&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">5</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=4&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">4</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=3&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">3</a> | '; 
			$zoomerBottom .= '<a href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=2&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;LID='.$lid.'&amp;back='.urlencode($_GET["back"]).'">2</a>'; 
			$zoomerBottom .= '</p>';
			$map = '<p><img class="map" src="index.php?m=displayImage&amp;Filename='.$Map->Filename.'" alt="Karte" /></p>';		
			$buffer .= '<p><span>';
			while ($i < count($Objects)) {
				$User = $Objects[$i]->User;
				$POI = $Objects[$i]->PointOfInterest;
				$Object = $Objects[$i];
				$Location = $Objects[$i]->Location;
				$iconsID = $this->MySonar->getProperty("icons");
				switch ($Object->Type) {
					case "USER":
						$buffer .= '<p class="li"><span class="accesskey '.strtolower($Object->Type).' '.($User->Friendship=="CONFIRMED" ? "user_friend":($User->Flirt==true ? " user_flirt":"")).'">'.$User->ReferenceID.'</span> ';
						if ($User->Username == $_SESSION["User"]->Username) {
							$currentLocationMapLink = 'index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=15&amp;Address='.urlencode($_SESSION["Location"]->Address).'&amp;StartIndex='.$Map->StartIndex.'&amp;Limit='.$Map->Limit.'&amp;LID='.$Location->ID.'&amp;back='.urlencode($_GET["back"]).'';
							$buffer .= '<span><a accesskey="'.$iconsID[$i+1].'" href="'.$currentLocationMapLink.'">Mein Standort</a>'.($User->Visibility=="HIDDEN" ? ' &middot; unsichtbar':'').'</span>';
						} else {
							$buffer .= '<a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'">'.htmlspecialchars($User->Username).'</a>';
							if (count($Objects)>1) {
								if ($User->Visibility=="VISIBLE") $buffer .= ' &middot; <a accesskey="'.$iconsID[$i+1].'" href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=15&amp;Address='.urlencode($Location->Address).'&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;LID='.$Location->ID.'&amp;back='.urlencode($_GET["back"]).'">Fokus</a>';
							}
							$buffer .= ($User->Visibility=="HIDDEN" ? ' &middot; unsichtbar':'');
						}
					break;
					case "POI":
						$buffer .= '<p class="li"><span class="accesskey '.strtolower($Object->Type).' poi_'.strtolower($POI->Type).'">'.$POI->ReferenceID.'</span> ';
						$buffer .= '<a href="index.php?m=getPointOfInterest&amp;ID='.$POI->ID.'">'.$POI->Name.'</a>';
						if (count($Objects)>1) $buffer .= ' &middot; <a accesskey="'.$iconsID[$i+1].'" href="index.php?m=getMap&amp;Type='.$MapType.'&amp;Locations='.$locations.'&amp;Zoom=15&amp;Address='.urlencode($Location->Address).'&amp;StartIndex='.$start.'&amp;Limit='.$limit.'&amp;LID='.$Location->ID.'&amp;back='.urlencode($_GET["back"]).'">Fokus</a>';
					break;
				}
				// evaluate distance
				if ($i!=0) {
					if ($Object->Distance > 1) $distance = round($Object->Distance, 1).'km';
					elseif ($Object->Distance==0) $distance = '< 20m';
					else {
						$meter = round($Object->Distance*1000, 1);
						if ($meter < 100) $distance = ''.$meter.'m';
						elseif ($meter < 500) $distance = ''.$meter.'m';
						else $distance = ''.$meter.'m';
					}			
					$buffer .= ' &middot; '.$distance;
				}
				$buffer .= '</p>';
				$i++;
			}
			$buffer .= '</span></p>';
		} else $buffer .= '<p>Du hast keinen Standort.</p>';
		// back to search results otherwise back to map
		$menuHTML = '<p><a href="'.urldecode($_GET["back"]).'">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border"><p>';
		echo $MapTypeHTML;
		echo $zoomerTop;
		echo $map;
		echo $zoomerBottom;
		echo '</p></div>';
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayProfile($fullPage = true, $result, $thumbnail = false) {
		if ($fullPage) $this->displayPageHeader();
		$User = $result[0];
		$Pictures = $result[1];
		$Location = $result[2];
		$owner = (strtolower($User->Username)==strtolower($_SESSION["User"]->Username) ? true:false);
		if ($Pictures!=null) {
			foreach ($Pictures as $Picture) {
				if ($Picture->Thumbnail==$thumbnail) $pic = $Picture;
			}
		}
		$style = "user";
		if ($User->Flirt==true) $style = "user_flirt";
		if ($User->Friendship=="CONFIRMED") $style = "user_friend";
		$this->displayTitle("Profil &middot; ".htmlspecialchars($User->Username), $style);
		// cache first request for back function
		if ($_SESSION["menuHTML"]=="") $_SESSION["menuHTML"] = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $_SESSION["menuHTML"];
		// show profile
		echo '<div class="border">'; // start border
		if ($User->StatusMessage!="") echo '<p>Status: <span class="highlight">'.htmlspecialchars($User->Username).' '.$User->StatusMessage.'</span></p>';
		if ($User->EyesOn==true) echo '<p><span class="flirt">Du hast ein Auge auf '.htmlspecialchars($User->Username).' geworfen!</span></p>';
		if ($thumbnail) echo '<div class="left">'; // start left
		echo '<img alt="Profilfoto" class="picture" src="'.($pic!=null ? "index.php?m=displayImage&amp;Filename=".$pic->Filename:$this->MySonar->getProperty("imagesdir").$this->MySonar->getProperty("nopicfilename")).'" width="'.($pic->Width!="" ? $pic->Width:"60").'"/>';
		if ($thumbnail) {
			echo '</div>'; // stop left
			echo '<div class="right">'; // start right
		} else echo '<br/>';
		// friendship
		if (!$owner && $User->Friendship!="NONE") {
			echo 'Dein ';
			if ($User->BestFriend==true) echo '<span class="friend">BestFriend</span>';
			else {
				switch ($User->Friendship) {
					case "CONFIRMED": echo '<span class="friend">Kontakt</span>'; break;
					case "PENDING": echo '<span class="friend">Kontakt</span> (?)'; break;
				}			
			}
			echo '<br/>';
		}
		// first name
		echo ($User->Name!="" ? htmlspecialchars($User->Name):htmlspecialchars($User->Username)).' ist<br/>';
		// sex
		if (isset($User->Sex)) {
			$sex = $this->MySonar->getProperty("sexlong");
			echo ''.$sex[$User->Sex].',<br/>';
		}
		// age
		if ($User->Age!="") echo '<strong>'.$User->Age.'</strong> Jahre alt,<br/>';
		// status
		$status = $this->MySonar->getProperty("status");
		echo 'gerade '.($User->Status=="ONLINE" ? '<span class="online">online</span>':'<span class="offline">offline</span>').'';
		// flirt
		echo ''.($User->Flirt==true ? '<br/>und will <span class="flirt">flirten</span>!':'.');
		if ($thumbnail) echo '</div>'; // stop right
		// info
		echo '<div class="clear">'; // start clear
		echo '<strong>Kurzinfo:</strong> '.($User->Info!="" ? $User->Info:"keine Angabe");
		echo '</div>'; // stop clear
		echo '<p>';
		// options
		$options = array();
		if ($Location->ID!="") array_push($options, array("title"=>"Karte anzeigen", "href"=>'index.php?m=getMap&amp;Locations='.(!$owner && $_SESSION["Location"]->ID!="" ? $_SESSION["Location"]->ID.",":"").$Location->ID.','.'&amp;Zoom=15&amp;LID='.$Location->ID.'&amp;back='.urlencode($_SERVER["REQUEST_URI"])));
		if ($thumbnail && $pic!=null) array_push($options, array("title"=>"Bild vergr&ouml;&szlig;ern", "href"=>'index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'&amp;thumbnail=false'));
		if ($thumbnail==false && $pic!=null) array_push($options, array("title"=>"Bild verkleinern", "href"=>'index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username)));
		if ($owner) {
			// options for profile owner only
		} else {
			// options for non profile owner only
			array_push($options, array("title"=>"Nachricht senden", "href"=>"index.php?m=sendMessage&amp;Type=MAIL&amp;Recipient=".htmlspecialchars($User->Username)));
			array_push($options, array("title"=>"Kontakte anzeigen", "href"=>"index.php?m=getFriends&amp;Username=".htmlspecialchars($User->Username)));
			if ($User->Friendship==NULL || $User->Friendship=="NONE") array_push($options, array("title"=>"Als Kontakt hinzuf&uuml;gen", "href"=>"index.php?m=setFriendship&amp;Username=".htmlspecialchars($User->Username)."&amp;MobilePhoneNumber=".($User->MobilePhoneNumber!="" ? "true":"false")));
			if ($User->Flirt==true && $User->EyesOn==false) array_push($options, array("title"=>"Ein Auge drauf werfen", "href"=>"index.php?m=putEyesOn&amp;Username=".htmlspecialchars($User->Username)));
			if ($User->Friendship=="CONFIRMED") array_push($options, array("title"=>"Free-SMS senden", "href"=>"index.php?m=sendMessage&amp;Type=SMS&amp;Recipient=".htmlspecialchars($User->Username).(!$User->MobilePhoneNumberConfirmed ? "&amp;MobilePhoneNumberConfirmed=false":"")));
			if ($User->MobilePhoneNumber!="") array_push($options, array("title"=>htmlspecialchars($User->Username)." anrufen (beta)", "href"=>"index.php?m=doPhoneCall&amp;MobilePhoneNumber=".$User->MobilePhoneNumber));
			array_push($options, array("title"=>'$onars &uuml;berweisen', "href"=>"index.php?m=pay&amp;Recipient=".htmlspecialchars($User->Username)));
		}
		$this->displayOptions($options);
		echo '</p>';
		echo '</div>'; // stop border
		echo '<p class="highlight">';
		echo 'Dabei seit '.date("d.m.y", strtotime($User->RegisterDate)).' &middot; UID '.$User->ID.'<br/>';
		echo 'Letzter Login: '.($User->LastLogin!="" ? date("d.m.y - H:i", strtotime($User->LastLogin)).' Uhr':'noch nie').'<br/>';
		echo 'Das Profil wurde '.($User->Visitors).' Mal besucht.<br/>';
		echo '</p>';
		echo $_SESSION["menuHTML"];
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayGroup($fullPage = true, $Group, $Options = null) {
		if ($fullPage) $this->displayPageHeader();
		$Articles = $Group->Article;
		$Members = $Group->User;
		$this->displayTitle("Gruppe von ".$Group->Owner, "group");
		$_SESSION["menuHTML"] = '<p><a href="index.php?m=getGroup&amp;ID='.$Group->ID.'">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		$menuHTML = '<p><a href="index.php?Tab=GROUPS">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p>';
		echo '<strong class="highlight title">'.$Group->Name.'</strong>';
		echo '<br/>'.$Group->Description;
		echo '</p>';
		// module topics
		if ($Articles!=NULL) {
			echo '<div class="module"><strong>Themen</strong></div>';
			$i=0;
			if (!is_array($Articles)) $Articles = array($Articles);
			if ($this->MySonar->getProperty("admin_username")==$_SESSION["User"]->Username || $Group->Membership) {
				if (count($Articles)>0) {
					foreach ($Articles as $Article) {
						echo '<p class="li '.(fmod($i, 2)==1 ? 'altline':'line').'"><a href="index.php?m=getTopic&amp;ID='.$Article->ID.'">'.$Article->Title.'</a>';
						echo '<br/>Autor: <a href="index.php?m=getProfile&amp;Username='.$Article->Author.'">'.$Article->Author.'</a>';
						echo ' &middot; '.$Article->Articles.' '.($Article->Articles==1 ? 'Beitrag':'Beitr&auml;ge');
						echo '</p>';
						$i++;
					}
				} else echo '<p class="li altline">Es gibt noch keine Themen.</p>';
			} else {
				echo '<p class="li altline">Du bist kein Mitglied dieser Gruppe. Themen &amp; Beitr&auml;ge kannst du nur als Mitglied lesen.</p>';	
			}
		} 
		// menu
		echo '<div class="module"><strong>Optionen</strong></div>';
		$options = array();
		if ($owner) {
			// options for profile owner only
		} else {
			if (!$Group->Membership) {
				// options for non group members only
				array_push($options, array("title"=>"Der Gruppe beitreten", "href"=>"index.php?m=joinGroup&amp;ID=".$Group->ID));
			} else {
				// options for group members
				array_push($options, array("title"=>"Neues Thema starten", "href"=>"index.php?m=setTopic&amp;GroupID=".$Group->ID));
				if (!$Group->Administrator) array_push($options, array("title"=>"Gruppe verlassen", "href"=>"index.php?m=leaveGroup&amp;ID=".$Group->ID));
			}
			if ($Group->Owner==$_SESSION["User"]->Username) {
				// for group owners only	
				array_push($options, array("title"=>"Gruppe l&ouml;schen", "href"=>"index.php?m=deleteGroup&amp;ID=".$Group->ID));
			}
		}
		$this->displayOptions($options);
		// members
		echo '<div class="module"><strong>Mitglieder dieser Gruppe</strong></div>';
		if (!is_array($Members)) $Members = array($Members);
		if (count($Members)>0) {
			foreach ($Members as $Member) {
				echo '<p class="li '.(fmod($i, 2)==1 ? 'altline':'line').'"><a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Member->Username).'">'.htmlspecialchars($Member->Username).'</a>';
				if ($Member->Sex!="") echo ' &middot; '.($Member->Sex=="MALE" ? '<span class="male">M</span>':'<span class="female">W</span>');
				if ($Member->Age!="") echo ' &middot; '.$Member->Age;
				$status = $this->MySonar->getProperty("status");
				echo ' &middot; '.$status[$Member->Status];
				if ($Member->Role=="GROUP_ADMINISTRATOR" || $Member->Role=="GROUP_MODERATOR") echo '<br/>'.($Member->Role=="GROUP_ADMINISTRATOR" ? 'Gr&uuml;nder':($Member->Role=="GROUP_MODERATOR" ? 'Moderator':'')).'';
				echo '</p>';
				$i++;
			}
		} else echo '<p>Diese Gruppe hat keine Mitglieder.</p>';
		echo '<div class="module"><strong>Infos zur Gruppe</strong></div>';
		echo '<p class="li altline">Gegr&uuml;ndet am '.date("d.m.y", strtotime($Group->Created)).' &middot; GID '.$Group->ID.'<br/>';
		echo 'Gr&uuml;nder: <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Group->Owner).'">'.htmlspecialchars($Group->Owner).'</a><br/>';
		echo $Group->Members.' Mitglied'.($Group->Members==1 ? '':'er').' &middot; '.$Group->Articles.' '.($Group->Articles==1 ? 'Thema':'Themen').'<br/>';
		echo '</p>';
		echo '<br/>';
		echo $_SESSION["menuHTML"];
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayArticle($fullPage = true, $ObjectSet) { // [0] = Article, [1] = Group
		if ($fullPage) $this->displayPageHeader();
		$Article = $ObjectSet[0];
		$Group = $ObjectSet[1];
		$this->displayTitle("Gruppe von ".$Group->Owner, "group");
		$menuHTML = '<p>'.($Article->Topic ? '<a href="index.php?m=getGroup&amp;ID='.$Group->ID.'">Zur&uuml;ck</a>':'<a href="index.php?m=getArticle&amp;ID='.$Group->ReferenceID.'">Zur&uuml;ck</a>').' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<p><strong class="title">'.$Group->Name.'</strong></p>';
		echo '<p><strong>'.$Article->Title.'</strong><br/>'.$Article->Content.'</p>';
		echo '</div>';
		echo '<p>'.$Article->Content.'</p>';
		echo '<p>';
		$options = array();
		if ($Article->Topic) array_push($options, array("title"=>"Beitrag schreiben", "href"=>"index.php?m=setArticle&amp;GID=".$Article->GroupID."&amp;ReferenceID=".$Article->ID."&amp;Topic=false"));
		if ($Article->Author==$_SESSION["User"]->Username) {
			// for owner only
			array_push($options, array("title"=>"Thema l&ouml;schen", "href"=>"index.php?m=deleteArticle&amp;ID=".$Article->ID));
		}
		$this->displayOptions($options);
		echo '</p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayTopic($fullPage = true, $ObjectSet, $Mode = NULL) { // [0] = Article, [1] = Group
		if ($fullPage) $this->displayPageHeader();
		$Topic = $ObjectSet[0];
		$Group = $ObjectSet[1];
		$this->displayTitle("Gruppe von ".$Group->Owner, "group");
		$menuHTML = '<p><a href="index.php?m=getGroup&amp;ID='.$Group->ID.'">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p><strong class="title">'.$Group->Name.'</strong></p>';
		echo '<div class="module"><strong>Thema</strong></div>';
		echo '<p class="li altline">'.$Topic->Title.'<br/>'.$Topic->Content.'</p>';
		echo '<p class="li altline"><span class="highlight">Er&ouml;ffnet von <a href="index.php?m=getProfile&amp;Username='.$Topic->Author.'">'.$Topic->Author.'</a> am<br/>';
		echo date("d.m.Y", strtotime($Topic->Created)).' um '.date("H:i", strtotime($Topic->Created)).' Uhr</span></p>';
		$Articles = $Topic->Article;
		if (is_object($Articles)) $Articles = array($Articles);
		echo '<div class="module"><strong>'.count($Articles).' '.(count($Articles)==1 ? 'Beitrag':'Beitr&auml;ge').'</strong></div>';
		if (count($Articles)>0) {
			$i=0;
			foreach($Articles as $Article) {
				echo '<p class="li '.(fmod($i, 2)==1 ? 'altline':'line').'">';
				echo $Article->Content;
				echo '<br/>'.date("d.m.y", strtotime($Article->Created)).' &middot; '.date("H:i", strtotime($Article->Created)).' Uhr<br/>';
				echo '<span class="highlight">Autor: <a href="index.php?m=getProfile&amp;Username='.$Article->Author.'">'.$Article->Author.'</a>';
				if ($Article->Author==$_SESSION["User"]->Username || $Group->Owner==$_SESSION["User"]->Username) {
					echo '<br/><a href="index.php?m=updateArticle&amp;ID='.$Article->ID.'&amp;ReferenceID='.$Topic->ID.'">Beitrag &auml;ndern</a> &middot; <a href="index.php?m=deleteArticle&amp;ID='.$Article->ID.'&amp;ReferenceID='.$Topic->ID.'">l&ouml;schen</a>';
				}
				echo '</span>';
				echo '</p>';
				$i++;
			}
		} else echo '<p class="li altline">Keine Beitr&auml;ge gefunden.</p>';
		echo '<div class="module"><strong>Optionen</strong></div>';
		$options = array();
		array_push($options, array("title"=>"Neuen Beitrag schreiben", "href"=>"index.php?m=setArticle&amp;ReferenceID=".$Topic->ID));
		if ($Topic->Author==$_SESSION["User"]->Username) {
			// for owner only
			array_push($options, array("title"=>"Thema &auml;ndern", "href"=>"index.php?m=updateTopic&amp;ID=".$Topic->ID."&amp;GroupID=".$Group->ID));
			array_push($options, array("title"=>"Thema l&ouml;schen", "href"=>"index.php?m=deleteTopic&amp;ID=".$Topic->ID."&amp;GroupID=".$Group->ID));
		}
		$this->displayOptions($options);
		echo '<br/>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	
	
	public function displayEyesOn($fullPage = true, $User) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Ein Auge drauf werfen");
		$menuHTML = '<p><a accesskey="Z" href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'" title="Zur&uuml;ck">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border"><p>M&ouml;chtest du ein Auge auf <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'">'.htmlspecialchars($User->Username).'</a> werfen? <span class="my">my</span><span class="sonar">Sonar</span> informiert dich automatisch per Free-SMS, wenn dein Flirt in deiner N&auml;he ist. Dann k&ouml;nnt ihr euch direkt vor Ort verabreden und flirten!</p></div>';
		echo '<p>';
		$options = array();
		array_push($options, array("title"=>"ok, Auge drauf", "href"=>"index.php?m=putEyesOn&amp;submit=true&amp;Username=".htmlspecialchars($User->Username)));
		array_push($options, array("title"=>"n&ouml;, doch nicht", "href"=>"index.php?m=getProfile&amp;Username=".htmlspecialchars($User->Username)));
		$this->displayOptions($options);
		echo '</p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayPointOfInterest($fullPage = true, $Object) {
		if ($fullPage) $this->displayPageHeader();
		$buffer = "";
		$address = $Object->Location->Address;
		$countries = $this->MySonar->getProperty("countries");
		$country = $countries[$Object->Location->CountryCode];
		$LID = $Object->Location->ID;
		$POITypes = $this->MySonar->getProperty("poitypes");
		$Type = $POITypes[$Object->PointOfInterest->Type];
		if ($Object->Party!=NULL) {
			$POI = $Object->Party;
			$ID = $POI->ID;
			$style = "poi_party";
			$title = "POI &middot; ".($POI->Private==true ? "Privatparty":"Party");
			$name = $POI->Name;
			$description = $POI->Description;
			$invitations = $POI->Invitations;
			$PublishedFrom = $POI->PublishedFrom;
			$LastUpdate = $POI->LastUpdate;
			$Visitors = $POI->Visitors;
			$Vote = $POI->Vote;
			$buffer .= '<p>';
			if ($POI->LocationName!="") $buffer .= 'Ort: '.$POI->LocationName.'<br/>';
			$buffer .= 'Beginn: '.date("d.m.y - H:i", strtotime($POI->Begin)).' Uhr<br/>';
			$buffer .= '</p>';
		} else { 
			$POI = $Object->PointOfInterest;
			$ID = $POI->ID;
			$style = "poi";
			$title = "POI &middot; ".$POI->Type;
			$name = $POI->Name;
			$description = $POI->Description;
			$PublishedFrom = $POI->PublishedFrom;
			$LastUpdate = $POI->LastUpdate;
			$Visitors = $POI->Visitors;
			$Vote = $POI->Vote;
			$buffer .= '';
		}
		// show profile
		if (!$POI->Active) echo '<p class="spot">Achtung: POI nicht freigeschaltet!</p>';
		if ($_SESSION["User"]->Username==$this->MySonar->getProperty("admin_username")) {
			// if user is admin then add administrative links
			echo '<p>';
			echo '<a href="index.php?m=updatePointOfInterest&amp;ID='.$ID.'">&Auml;ndern</a> &middot; ';
			echo '<a href="index.php?m=getStatistics">Whazzupp?</a> &middot; ';
			echo '<a href="index.php?m=deletePointOfInterest&amp;ID='.$ID.'">L&ouml;schen</a>';
			echo '</p>';
		}
		$this->displayTitle($title, $style);
		// cache first request for back function
		if ($_SESSION["menuHTML"]=="") $_SESSION["menuHTML"] = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $_SESSION["menuHTML"];
		echo '<div class="border"><p>';
		echo '<span class="highlight"><strong>'.$name.'</strong> &middot; PID '.$ID.'</span><br/>';
		echo ''.$description.'</p>';
		echo $buffer;
		$grades = $this->MySonar->getProperty("grades");
		if ($Vote->TotalAmount>0) echo '<p>Dieser POI wurde <span class="highlight">'.$Vote->TotalAmount.' mal</span> bewertet und erhielt im Schnitt die Note <span class="highlight">'.$grades[round($Vote->Value)].'</span>.</p>';
		else echo '<p>Dieser POI wurde noch nicht bewertet. Schon mal dort gewesen? <a href="index.php?m=doVote&amp;Category=POI&amp;Key='.$ID.'">Dann jetzt bewerten!</a></p>';
		if ($address!="") echo '<p>Standort: '.$address.'<br/>'.$country.'</p>';
		// options
		$options = array();
		array_push($options, array("title"=>"Karte anzeigen", "href"=>"index.php?m=getMap&amp;Locations=".$LID."&amp;Zoom=15&amp;LID=".$LID."&amp;back=".urlencode($_SERVER["REQUEST_URI"])));
		if ($POI->Active) array_push($options, array("title"=>"Bewerten", "href"=>"index.php?m=doVote&amp;Category=POI&amp;Key=".$ID));
		// for owner only
		if ($Object->User->Username==$_SESSION["User"]->Username) {
			array_push($options, array("title"=>"&Auml;ndern", "href"=>"index.php?m=updatePointOfInterest&amp;ID=".$ID));
			array_push($options, array("title"=>"L&ouml;schen", "href"=>"index.php?m=deletePointOfInterest&amp;ID=".$ID));
		}
		if ($invitations>0) array_push($options, array("title"=>"Einladungen versenden", "href"=>"index.php?m="));
		$this->displayOptions($options);
		echo '</p></div>';
		echo '<p class="highlight">Ver&ouml;ffentlicht seit '.date("d.m.Y", strtotime($PublishedFrom)).'<br/>';
		echo 'Gemeldet von <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Object->User->Username).'">'.htmlspecialchars($Object->User->Username).'</a><br/>';
		echo 'Update '.date("d.m.y - H:i", strtotime($LastUpdate)).' Uhr<br/>';
		echo ''.($Visitors).' Mal abgerufen';
		echo '</p>';
		echo '<p><a href="index.php?m=sendMessage&amp;Type=MAIL&amp;Recipient='.$this->MySonar->getProperty("admin_username").'&amp;Text=Der POI mit der UID '.$ID.' existiert nicht. Nachricht: ">POI existiert nicht (mehr)</a><br/>';
		echo '<a href="index.php?m=sendMessage&amp;Type=MAIL&amp;Recipient='.$this->MySonar->getProperty("admin_username").'&amp;Text=Der POI mit der UID '.$ID.' hat sich wie folgt geaendert: ">POI hat sich ge&auml;ndert</a>';
		echo '</p>';
		echo $_SESSION["menuHTML"];
		if ($fullPage) $this->displayPageFooter();
	}
	
	
	public function displaySonarPreferences($fullPage = true, $preferences, $option = null) {
		$SonarPreferences = $preferences;
		if ($fullPage) $this->displayPageHeader();
		$buffer = '';
		if ($option!=null) {
			$menuHTML = '<p><a accesskey="*" href="index.php?m=getSonarPreferences" title="Zur&uuml;ck">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
			switch ($option) {
				case "Range": $ranges = $this->MySonar->getProperty("ranges"); $buffer .= 'Umkreis aktuell: '.$ranges[$SonarPreferences->Range]; break;
				case "ObjectType": $objecttypes = $this->MySonar->getProperty("objecttypes"); $buffer .= 'Suche aktuell: '.$objecttypes[$SonarPreferences->ObjectType]; break;
				case "POITypes": $POITypes = explode("|", $SonarPreferences->POITypes); $buffer .= "Kategorien: ".count($POITypes)." St&uuml;ck ausgew&auml;hlt"; break;
				case "UserSex": $usersexes = $this->MySonar->getProperty("usersexes"); $buffer .= 'Aktuell: '.$usersexes[$SonarPreferences->UserSex]; break;
				case "MinAge": $ages = $this->MySonar->getProperty("ages"); $buffer .= 'Derzeit: '.$ages[$SonarPreferences->MinAge]; break;
				case "UserFlirt": $buffer .= 'Suche aktuell: '.($SonarPreferences->UserFlirt==true ? "nur Flirts":"nicht nur Flirts"); break;
				case "MapWidth": $buffer .= 'Aktuelle Breite: '.$SonarPreferences->MapWidth.' Pixel'; break;
				case "MapHeight": $buffer .= 'Aktuelle H&ouml;he: '.$SonarPreferences->MapHeight.' Pixel'; break;
			}
		} else {
			if ($_SESSION["menuHTML"]=="") $_SESSION["menuHTML"] = '<p>'.$this->MySonar->getProperty("backlink").' &middot; <a href="index.php?m=getMap&amp;Locations='.$_SESSION["Location"]->ID.',&amp;Zoom=10&amp;StartIndex=1&amp;Limit=9&amp;Address=&amp;LID='.$_SESSION["Location"]->ID.'">Karte</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
			$buffer .= $_SESSION["menuHTML"];
		}
		switch ($option) {
			// Range
			case "Range":
				$title = "Umkreis";
				$buffer .= '<div class="border">In welchem Umkreis suchst du?</div>';
				$buffer .= '<p>';
				$i = 1; 
				$options = array();
				foreach ($this->MySonar->getProperty("ranges") as $key=>$value) {
					array_push($options, array("title"=>"bis ".$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=Range&amp;value=".$key));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
			break;
			// ObjectType
			case "ObjectType":
				$title = "Suche";
				$buffer .= '<div class="border">Was willst du finden?</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("objecttypes") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=ObjectType&amp;value=".$key));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true, false);
				$buffer .= '</p>';
			break;
			// POITypes
			case "POITypes":
				$title = "Kategorie";
				$buffer .= '<div class="border">Wenn du nach Points of Interest (POI) suchst: Welche Kategorien sollen durchsucht werden?</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("poitypes") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=POITypes&amp;value=".$key."&amp;Task=".(in_array($key, $POITypes) ? 'REMOVE':'ADD')."&amp;POITypes=".$SonarPreferences->POITypes, "hint"=>" &middot; ".(in_array($key, $POITypes) ? '<span class="highlight">ja</span>':'<span class="spot">nein</span>')));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true, false);
				$buffer .= '</p>';
				$buffer .= '<p class="highlight">Bei Klick auf den entsprechenden Kategorie-Link schalten wir zwischen ja und nein um.</p>';
			break;
			// UserSex
			case "UserSex":
				$title = "Geschlecht";
				$buffer .= '<div class="border">Wen suchst du?</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("usersexes") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=UserSex&amp;value=".$key));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
			break;
			// MinAge
			case "MinAge":
				$title = "Alter";
				$buffer .= '<div class="border">In welcher Altersklasse suchst du?</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("ages") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=MinAge&amp;value=".$key));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
			break;
			// UserFlirt
			case "UserFlirt":
				$title = "Flirts";
				$buffer .= '<div class="border">Suchst du nur Leute die flirten wollen?</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("flirts") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=UserFlirt&amp;value=".$key));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
			break;	
			// MapWidth
			case "MapWidth":
				$title = "Kartenbreite";
				$buffer .= '<div class="border">Handydisplays sind unterschiedlich gro&szlig;. Der Standard liegt heute bei 176 Pixel. Je breiter das Display, desto mehr Platz hast du f&uuml;r die Karte. Wie breit soll die Karte sein?</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("mapwidths") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=MapWidth&amp;value=".$key));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
			break;	
			// MapHeight
			case "MapHeight":
				$title = "Kartenh&ouml;he";
				$buffer .= '<div class="border">Wie hoch soll die Karte sein?</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("mapheights") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=MapHeight&amp;value=".$key));
					$i++;
				}
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
			break;	
			// Visibility
			case "Visibility":
				$title = "Standort";
				$buffer .= '<div class="border">Hier kannst du einstellen, f&uuml;r wen dein aktueller Aufenthaltsort sichtbar ist.</div>';
				$buffer .= '<p>';
				$i = 1;
				$options = array();
				foreach ($this->MySonar->getProperty("visibility") as $key=>$value) {
					array_push($options, array("title"=>$value, "href"=>"index.php?m=updateSonarPreferences&amp;Option=Visibility&amp;value=".$key));
					$i++;
				}
				array_push($options, array("title"=>"Standort l&ouml;schen", "href"=>"index.php?m=deleteCurrentLocation"));
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
				$buffer .= '<p class="highlight">Wenn du unsichtbar bist, kannst du nicht mehr &uuml;ber die Umkreissuche gefunden werden. Au&szlig;erdem bist du auf Karten nicht sichtbar.</p>';
			break;											
			// display menu
			case null:
				$title = "&Uuml;bersicht";
				$buffer .= '<div class="module"><strong>Such-Einstellungen</strong></div>';
				$buffer .= '<p>';
				$objecttypes = $this->MySonar->getProperty("objecttypes"); 
				$usersexes = $this->MySonar->getProperty("usersexes"); 
				$ages = $this->MySonar->getProperty("ages"); 
				$flirts = $this->MySonar->getProperty("flirts"); 
				$visibility = $this->MySonar->getProperty("visibility"); 
				$options = array();
				array_push($options, array("title"=>"Umkreis", "href"=>"index.php?m=getSonarPreferences&amp;Option=Range", "hint"=>"&middot; ".($SonarPreferences->Range>=1000 ? (round($SonarPreferences->Range/1000,1))." Kilometer":$SonarPreferences->Range." Meter")));
				array_push($options, array("title"=>"Suche", "href"=>"index.php?m=getSonarPreferences&amp;Option=ObjectType", "hint"=>"&middot; ".$objecttypes[$SonarPreferences->ObjectType]));
				array_push($options, array("title"=>"Kategorien", "href"=>"index.php?m=getSonarPreferences&amp;Option=POITypes", "hint"=>"&middot; ".count(explode("|", $SonarPreferences->POITypes))." St&uuml;ck"));
				array_push($options, array("title"=>"Geschlecht", "href"=>"index.php?m=getSonarPreferences&amp;Option=UserSex", "hint"=>"&middot; ".$usersexes[$SonarPreferences->UserSex]));
				array_push($options, array("title"=>"Alter", "href"=>"index.php?m=getSonarPreferences&amp;Option=MinAge", "hint"=>"&middot; ".$ages[$SonarPreferences->MinAge]));
				array_push($options, array("title"=>"Nur Flirtwillige", "href"=>"index.php?m=getSonarPreferences&amp;Option=UserFlirt", "hint"=>"&middot; ".($SonarPreferences->UserFlirt==true ? "ja":"nein")));
				$buffer .= $this->displayOptions($options, true, false);
				$buffer .= '</p>';
				$buffer .= '<div class="module"><strong>Profil-Einstellungen</strong></div>';
				$buffer .= '<p>';
				$options = array();
				array_push($options, array("title"=>"Profilfoto", "href"=>"index.php?m=setPicture", "hint"=>"&middot; ".($_SESSION["Picture"]!=NULL ? 'eins gespeichert':'keins gespeichert')));
				array_push($options, array("title"=>"Vorname", "href"=>"index.php?m=updateUser&amp;Option=Name".($_SESSION["User"]->Name!="" ? '&amp;value='.$_SESSION["User"]->Name:''), "hint"=>"&middot; ".($_SESSION["User"]->Name!="" ? $_SESSION["User"]->Name:'unbekannt')));
				$sex = $this->MySonar->getProperty("sex");
				array_push($options, array("title"=>"Geschlecht", "href"=>"index.php?m=updateUser&amp;Option=Sex", "hint"=>"&middot; ".$sex[$_SESSION["User"]->Sex]));
				array_push($options, array("title"=>"Alter", "href"=>"index.php?m=updateUser&amp;Option=Birth", "hint"=>"&middot; ".($_SESSION["User"]->Age!="" ? $_SESSION["User"]->Age.' Jahre':'???')));
				array_push($options, array("title"=>"Flirten", "href"=>"index.php?m=updateUser&amp;Option=Flirt", "hint"=>"&middot; ".($_SESSION["User"]->Flirt ? 'ja':'nein')));
				array_push($options, array("title"=>"Kurzinfo", "href"=>"index.php?m=updateUser&amp;Option=Info", "hint"=>"&middot; ".($_SESSION["User"]->Info!="" ? substr($_SESSION["User"]->Info,0,20).'...':'???')));
				$buffer .= $this->displayOptions($options, true, false);
				$buffer .= '</p>';
				$buffer .= '<div class="module"><strong>Allgemeine Einstellungen</strong></div>';
				$buffer .= '<p>';
				$options = array();
				array_push($options, array("title"=>"Standort", "href"=>"index.php?m=getSonarPreferences&amp;Option=Visibility", "hint"=>"&middot; ".$visibility[$SonarPreferences->Visibility]));
				array_push($options, array("title"=>"Handynr.", "href"=>"index.php?m=updateUser&amp;Option=MobilePhoneNumber&amp;value=".$_SESSION["User"]->MobilePhoneNumber, "hint"=>"&middot; ".($_SESSION["User"]->MobilePhoneNumber!="" ? ($_SESSION["User"]->MobilePhoneNumberConfirmed==true ? '<span class="highlight">'.$_SESSION["User"]->MobilePhoneNumber.'</span>':'<span class="spot">'.$_SESSION["User"]->MobilePhoneNumber.'</span>'):'keine')));
				array_push($options, array("title"=>"Kartenbreite", "href"=>"index.php?m=getSonarPreferences&amp;Option=MapWidth", "hint"=>"&middot; ".$SonarPreferences->MapWidth." px"));
				array_push($options, array("title"=>"Kartenh&ouml;he", "href"=>"index.php?m=getSonarPreferences&amp;Option=MapHeight", "hint"=>"&middot; ".$SonarPreferences->MapHeight." px"));
				$buffer .= $this->displayOptions($options, true, false);
				$buffer .= '<br/></p>';
				break;
		}
		$this->displayTitle("Einstellungen &middot; ".$title);
		echo $menuHTML;
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayHallOfFame($fullPage = true) {
		if ($fullPage) $this->displayPageHeader();
		$menuHTML = '<p>'.$this->MySonar->getProperty("homelink").'</p>';
		$this->displayTitle("Hall Of Fame");
		echo $menuHTML;
		echo '<div class="border">';
		echo 'Hier findest du die <strong class="highlight">TOP 9</strong> in verschiedenen Kategorien.';
		echo '</div>';
		echo '<p>';
		$options = array();
		array_push($options, array("title"=>"Die reichsten Mitglieder", "href"=>"index.php?m=sendPing&amp;Profile=TOP_ACCOUNTS&amp;Start=1&amp;Limit=9"));
		array_push($options, array("title"=>"TOP-Locations in der N&auml;he", "href"=>"index.php?m=sendPing&amp;Profile=TOP_POI_NEARBY&amp;Start=1&amp;Limit=9"));
		array_push($options, array("title"=>"TOP-Partys in der N&auml;he", "href"=>"index.php?m=sendPing&amp;Profile=TOP_PARTYS_NEARBY&amp;Start=1&amp;Limit=9"));
		$this->displayOptions($options);
		echo '</p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayConfirmUser($fullPage = true) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Handynummer best&auml;tigen");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<p>Hier kannst du deine Handynummer <span class="highlight">'.$_SESSION["User"]->MobilePhoneNumber.'</span> aktivieren. Dazu brauchst du den Code, den wir an dein Handy geschickt haben!</p>';
		echo '</div>';
		echo '<form action="index.php" method="get">';
		echo '<div>';
		echo '<input type="hidden" name="m" value="confirmUser"/>';
		echo '<p>Aktivierungscode<br/>';
		echo '<input type="text" class="text" name="ActivationCode" value=""/><br/>';
		echo '<span class="message">4 Ziffern</span></p>';
		echo '<p><input type="submit" name="submit" value="Aktivieren"/></p>';
		echo '</div>';
		echo '</form>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
		
	public function displayDeletePicture($fullPage = true) {
		$Pictures = $_SESSION["Picture"];
		if ($Pictures!=null) {
			foreach ($Pictures as $Picture) {
				if ($Picture->Thumbnail==true) $pic = $Picture;
			}
		}
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Profilfoto l&ouml;schen");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; <a href="index.php?m=getSonarPreferences" title="Einstellungen">Einstellungen</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<div class="left"><img alt="Profilfoto" class="picture" src="index.php?m=getPicture&amp;Thumbnail=true" width="'.$pic->Width.'"/></div>';
		echo '<div class="right highlight">Noch mal &uuml;berlegen?<br/>L&ouml;schen geht schnell ;-) Du bist f&uuml;r andere attraktiver mit Foto!</div>';
		echo '<div class="clear">';
		$options = array();
		array_push($options, array("title"=>"nee, jetzt doch nicht mehr", "href"=>"index.php?m=setPicture"));
		array_push($options, array("title"=>"na klar man - l&ouml;sch endlich!", "href"=>"index.php?m=deletePicture&amp;delete=true"));
		$this->displayOptions($options);
		echo '</div>';
		echo '<br/></div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayPictureForm($fullPage = true) {
		set_time_limit(180); // 3 minuts
		$Pictures = $_SESSION["Picture"];
		if ($Pictures!=null) {
			foreach ($Pictures as $Picture) {
				if ($Picture->Thumbnail==true) $pic = $Picture;
			}
		}
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Profilfoto laden");
		$menuHTML = '<p><a href="index.php?m=getSonarPreferences" title="Zur&uuml;ck">Zur&uuml;ck</a> &middot; '.($_SESSION["Picture"]!=NULL ? '<a href="index.php?m=deletePicture">Foto l&ouml;schen</a> &middot; ':'').$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<div class="left"><img alt="Profilfoto" class="picture" src="index.php?m=getPicture&amp;Thumbnail=true" width="'.$pic->Width.'"/></div>';
		echo '<div class="right"><p>Auf dem Foto mu&szlig;t du deutlich erkennbar sein. Es wird eine redaktionelle Pr&uuml;fung durchgef&uuml;hrt. Erlaubte Formate: GIF, JPG, PNG.</p></div>';
		echo '<form action="index.php?m=setPicture" method="post" enctype="multipart/form-data">';
		echo '<div class="clear">';
		echo '<p><input class="upload" size="5" name="Data" type="file"/></p>';
		echo '<p><input class="button" type="submit" name="submit" value="Speichern"/></p>';
		echo '</div>';
		echo '</form>';
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayUpdateUser($fullPage = true, $option = null, $value = null) {
		if ($fullPage) $this->displayPageHeader();
		$menuHTML = '<p><a accesskey="Z" href="index.php?m=getSonarPreferences" title="Zur&uuml;ck">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		$buffer = '';
		switch($option) {
			// mobile phone number
			case "MobilePhoneNumber":
				$title = "Handynummer";
				if ($_SESSION["User"]->MobilePhoneNumber!="" && $_SESSION["User"]->MobilePhoneNumberConfirmed==false) $buffer .= '<p><span class="spot">Achtung: Du musst deine Handynummer noch aktivieren:</span> <a href="index.php?m=confirmUser">Aktivierungscode eingeben</a></p>';
				$buffer .= '<div class="border"><span class="my">my</span><span class="sonar">Sonar</span> h&auml;lt dich per Free-SMS auf dem Laufenden, wenn du offline bist. Wir informieren dich, wenn Freunde und Flirts in deiner N&auml;he sind und du neue Mails hast. Deine Handynr. bleibt geheim! Kein Spam, versprochen!<br/>Wichtig: Nur wenn wir deine Handynr. kennen, k&ouml;nnen wir dir ein neues Passwort per Free-SMS zusenden, falls du es einmal vergessen solltest.</div>';
				$buffer .= '<form action="index.php" method="get">';
				$buffer .= '<div>';
				$buffer .= '<input type="hidden" name="m" value="updateUser"/>';
				$buffer .= '<input type="hidden" name="Option" value="MobilePhoneNumber"/>';
				$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				$buffer .= '<p>Handynummer<br/>';
				$buffer .= '<input class="text" type="text" maxlength="15" name="value" size="26" value="'.$value.'"/><br/>';
				$buffer .= '<span class="spot">Nur Ziffern und mit 0 beginnen! Zum L&ouml;schen Nummer entfernen.</span></p>';
				$buffer .= '<p class="highlight">Du musst die Nummer aktivieren. Den Aktivierungscode erh&auml;ltst du per Free-SMS.</p>';
				$buffer .= '<p><input type="submit" name="submit" value="Speichern" class="button"/></p>';
				$buffer .= '</div>';
				$buffer .= '</form>';
			break;
			// name
			case "Name":
				$title = "Vorname";
				$buffer .= '<div class="border">Sag uns deinen Namen! Andere Mitglieder k&ouml;nnen dich dann &uuml;ber die Mitgliedersuche besser finden.</div>';
				$buffer .= '<form action="index.php" method="get">';
				$buffer .= '<div>';
				$buffer .= '<input type="hidden" name="m" value="updateUser"/>';
				$buffer .= '<input type="hidden" name="Option" value="Name"/>';
				$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				$buffer .= '<p>Vorname<br/>';
				$buffer .= '<input class="text" type="text" maxlength="20" name="value" size="26" value="'.$value.'"/></p>';
				$buffer .= '<p><input type="submit" name="submit" value="Speichern" class="button"/></p>';
				$buffer .= '</div>';
				$buffer .= '</form>';
			break;
			// sex
			case "Sex":
				$title = "Geschlecht";
				$buffer .= '<div class="border">Sag uns, ob du M&auml;nnlein oder Weiblein bist, dann wirst du besser gefunden!</div>';
				$buffer .= '<p>';
				$options = array();
				array_push($options, array("title"=>"Ich bin eine Frau", "href"=>"index.php?m=updateUser&amp;Option=Sex&amp;value=FEMALE&amp;submit=true&amp;UID=".$_SESSION["UID"]));
				array_push($options, array("title"=>"Ich bin ein Mann", "href"=>"index.php?m=updateUser&amp;Option=Sex&amp;value=MALE&amp;submit=true&amp;UID=".$_SESSION["UID"]));
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p><p><span class="spot">Achtung: Nicht mehr &auml;nderbar!</span></p>';
			break;
			// birth
			case "Birth":
				$title = "Alter";
				$buffer .= '<div class="border">Sag uns dein Geburtsdatum und wir zeigen anderen dein Alter an. Au&szlig;erdem wirst du besser gefunden!</div>';
				$buffer .= '<p>Format beachten: <span class="highlight">TTMMJJJJ</span><br/>Beispiel: 16021987</p>';
				$buffer .= '<form action="index.php" method="get">';
				$buffer .= '<div>';
				$buffer .= '<input type="hidden" name="m" value="updateUser"/>';
				$buffer .= '<input type="hidden" name="Option" value="Birth"/>';
				$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				$buffer .= '<p><input class="text" type="text" maxlength="8" name="value" size="26" value="'.$value.'"/><br/>';
				$buffer .= '<span class="spot">Achtung: Nicht mehr &auml;nderbar!</span></p>';
				$buffer .= '<p><input type="submit" name="submit" value="Speichern" class="button"/></p>';
				$buffer .= '</div>';
				$buffer .= '</form>';
			break;
			// info
			case "Info":
				$title = "Kurzinfo";
				$buffer .= '<div class="border">Die Kurzinformation erscheint auf deinem Profil (max. '.$this->MySonar->getProperty("messagemaxchars").' Zeichen) und ist f&uuml;r andere Mitglieder sichtbar.</div>';
				$buffer .= '<form action="index.php" method="get">';
				$buffer .= '<div>';
				$buffer .= '<input type="hidden" name="m" value="updateUser"/>';
				$buffer .= '<input type="hidden" name="Option" value="Info"/>';
				$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				$buffer .= '<p>Kurzinfo<br/>';
				$buffer .= '<textarea class="text" name="value" rows="5" cols="18">'.$_SESSION["User"]->Info.'</textarea><br/>';
				$buffer .= '<span class="spot">Zum L&ouml;schen Text entfernen.</span></p>';
				$buffer .= '<p><input type="submit" name="submit" value="Speichern" class="button"/></p>';
				$buffer .= '</div>';
				$buffer .= '</form>';
			break;			
			// flirt
			case "Flirt":
				$title = "Flirten";
				$buffer .= '<div class="border">Stehst auf hei&szlig;e Flirts? Wir helfen bei der Suche!</div>';
				$buffer .= '<p>';
				$options = array();
				array_push($options, array("title"=>"Ja, ich will flirten", "href"=>"index.php?m=updateUser&amp;Option=Flirt&amp;value=true&amp;submit=true&amp;UID=".$_SESSION["UID"]));
				array_push($options, array("title"=>"Hau blo&szlig; ab!", "href"=>"index.php?m=updateUser&amp;Option=Flirt&amp;value=false&amp;submit=true&amp;UID=".$_SESSION["UID"]));
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
				$buffer .= '<p class="highlight">Wenn du nicht flirten willst, kann auch niemand ein Auge auf dich werfen.</p>';
			break;
			// statusmessage
			case "StatusMessage":
				$menuHTML = '<p><a accesskey="Z" href="index.php?Tab=OPTIONS" title="Zur&uuml;ck">Zur&uuml;ck</a> &middot; <a href="index.php?m=updateUser&amp;Option=StatusMessage&amp;value=&amp;submit=true">Status l&ouml;schen</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
				$title = "Statusmeldung";
				$buffer .= '<div class="border">&Uuml;ber die Statusmeldung kannst du anderen Mitgliedern eine kurze Botschaft oder ein Anliegen a la <span class="highlight">'.htmlspecialchars($_SESSION["User"]->Username).' sucht Leute f&uuml;r...</span> oder <span class="highlight">'.htmlspecialchars($_SESSION["User"]->Username).' hat Lust auf...</span> mitteilen.</div>';
				$buffer .= '<form action="index.php" method="get">';
				$buffer .= '<div>';
				$buffer .= '<input type="hidden" name="m" value="updateUser"/>';
				$buffer .= '<input type="hidden" name="Option" value="StatusMessage"/>';
				$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				$buffer .= '<p>'.htmlspecialchars($_SESSION["User"]->Username).'...<br/>';
				$buffer .= '<textarea class="text" name="value" cols="18" rows="3">'.($value!="" ? $value:$_SESSION["User"]->StatusMessage).'</textarea><br/>';
				$buffer .= '<span class="spot">max. 130 Zeichen</span></p>';
				$buffer .= '<p><input type="submit" name="submit" value="Speichern" class="button"/></p>';
				$buffer .= '<p class="highlight">Dein Nickname wird der Statusmeldung automatisch vorangestellt. Die Meldung erscheint auf deinem Profil und in den Netzwerk-News deiner Kontakte.</p>';
				$buffer .= '</div>';
				$buffer .= '</form>';
			break;			
			// error
			default: $buffer .= "Kein Task definiert."; break;
		} 
		$this->displayTitle("Einstellungen &middot; ".$title);
		echo $menuHTML;
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayVote($fullPage = true, $Category, $Key) {
		if ($fullPage) $this->displayPageHeader();
		$menuHTML = '<p><a href="index.php?m=getPointOfInterest&amp;ID='.$Key.'">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		$buffer = '';
		switch ($Category) {
			case "POI":
				$buffer .= '<div class="border"><p>Wie bewertest du diesen Point Of Interest?</p></div>';
				$buffer .= '<p>';
				$options = array();
				array_push($options, array("title"=>"Sehr gut", "href"=>"index.php?m=doVote&amp;Category=POI&amp;Key=".$Key."&amp;Value=1&amp;submit=true"));
				array_push($options, array("title"=>"Gut", "href"=>"index.php?m=doVote&amp;Category=POI&amp;Key=".$Key."&amp;Value=2&amp;submit=true"));
				array_push($options, array("title"=>"Befriedigend", "href"=>"index.php?m=doVote&amp;Category=POI&amp;Key=".$Key."&amp;Value=3&amp;submit=true"));
				array_push($options, array("title"=>"Ausreichend", "href"=>"index.php?m=doVote&amp;Category=POI&amp;Key=".$Key."&amp;Value=4&amp;submit=true"));
				array_push($options, array("title"=>"Mangelhaft", "href"=>"index.php?m=doVote&amp;Category=POI&amp;Key=".$Key."&amp;Value=5&amp;submit=true"));
				$buffer .= $this->displayOptions($options, true);
				$buffer .= '</p>';
				$buffer .= '<p class="highlight">Die Bewertung erfolgt nach Schulnoten. Du hast nur eine einzige Stimme.</p>';
				$this->displayTitle("Bewertung");
			break;
			default: $buffer .= '<p>Kategorie unbekannt.</p>';
		}
		echo $menuHTML;
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	
	
	public function displayLastLocations($fullPage = true, $locations) {
		if (is_Object($locations)) $locations = array($locations);
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Meine letzten Standorte");
		$menuHTML = '<p>'.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p>Hier siehst du, wann du wo warst und kannst einen deiner letzten Standorte zur aktuellen Location machen.</p>';
		echo '<div class="border">'; 
		if ($locations!=null) {
			$i=1;
			foreach ($locations as $Location) {
				echo '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				echo '<a accesskey="'.$i,'" href="index.php?m=sendPing&amp;Profile=DEFAULT&amp;StartIndex=1&amp;Limit=9&amp;submit=Suche&amp;Query='.urlencode($Location->Address).'">'.$Location->Address.'</a><br/>';
				echo date("d.m.y, H:i", strtotime($Location->LastUpdate)).' Uhr';
				echo '</p>';
				$i++;
			}
		} else echo '<p class="spot">Es gibt zurzeit keine Standorte.</p>';
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayHelp($fullPage = true, $Help) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle($Help->Title);
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo $Help->Text;
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayMessageForm($fullPage = true, $Message, $TextAttachment = NULL) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle(($Message->Type=="SMS" ? "SMS":"Nachricht")." schreiben");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		if ($Message->Type=="SMS" && ($_SESSION["User"]->MobilePhoneNumber=="" && !$_SESSION["User"]->MobilePhoneNumberConfirmed)) echo '<div class="border"><span class="spot">Achtung: Diese Funktion steht dir zurzeit nicht zur Verf&uuml;gung. Hierf&uuml;r musst du zuerst deine Handynummer angeben.<br/><a href="index.php?m=updateUser&Option=MobilePhoneNumber">Handynummer angeben</a></span></div>';
		elseif ($Message->Type=="SMS" && $_GET["MobilePhoneNumberConfirmed"]=="false") echo '<div class="border"><span class="spot">'.$Message->Recipient.' hat leider keine Handynummer hinterlegt.</span></div>';
		else {
			if ($Message->Type=="SMS") echo '<p>Du kannst deinen Kontakten SMS-Nachrichten an ihr Handy senden. Eine individuelle SMS mit bis zu 150 Zeichen L&auml;nge kostet nur 30 $onars.</p>';
			echo '<p>Von <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($_SESSION["User"]->Username).'">'.htmlspecialchars($_SESSION["User"]->Username).'</a> &middot; An <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Message->Recipient).'">'.htmlspecialchars($Message->Recipient).'</a></p>';
			echo '<div class="border">';
			if ($Message->Time!="") {
				// confirmation
				echo '<p>';
				echo '<strong>Absender:</strong> '.$Message->Sender.'<br/>';
				echo '<strong>Empf&auml;nger:</strong> '.$Message->Recipient.'<br/>';
				echo '<strong>Zustellung:</strong> '.date("H:i", strtotime($Message->Time)).' Uhr';
				echo '</p>';
				echo '<p><strong>Text:</strong> '.utf8_decode($Message->Text).'</p>';
			} else {
				if ($TextAttachment!=NULL) echo '<p>Originalnachricht von '.$Message->Recipient.':<br/><span class="highlight">'.utf8_decode(urldecode($TextAttachment)).'</span></p>';
				// collecting data
				echo '<form action="index.php" method="get">';
				echo '<div>';
				echo '<input type="hidden" name="m" value="sendMessage"/>';
				echo '<input type="hidden" name="Type" value="'.$Message->Type.'"/>';
				echo '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				echo '<input type="hidden" name="Recipient" value="'.$Message->Recipient.'"/>';
				echo '<p>';
				echo 'Deine '.($Message->Type=="SMS" ? 'SMS':($TextAttachment!="" ? 'Antwort':'Mail')).'<br/><textarea class="text" name="Text" cols="18" rows="5">'.$Message->Text.'</textarea>';
				if ($Message->Type=="SMS") echo '<br/><span class="message">max. '.$this->MySonar->getProperty("smsmaxchars").' Zeichen</span>';
				echo '</p>';
				if ($Message->Type=="SMS") echo '<p class="highlight">Als Absender der SMS verwenden wir deinen Nickname. Nach dem Versand buchen wir 30 $onars von deinem Konto ab! Die SMS legen wir zus&auml;tzlich als Nachricht vom Typ SMS in deiner Mailbox ab.</p>';
				else echo '<p class="highlight">Wenn '.$Message->Recipient.' offline ist, informiert <span class="my">my</span><span class="sonar">Sonar</span> sofort per Free-SMS &uuml;ber den Eingang deiner Mail.</p>';
				echo '<p><input class="button" type="submit" name="submit" value="Senden"/></p>';
				echo '</div>';
				echo '</form>';
			}
			echo '</div>';	
		}
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	
		
	public function displayInbox($fullPage = true, $messages) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Mails &middot; Posteingang");
		$menuHTML = '<p><a href="index.php?m=getOutbox">Postausgang</a> &middot; <a href="'.$_PHPSELF.'">Reload</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		if ($messages!=null) {
			if (is_object($messages)) $messages = array($messages);
			$i=1;
			foreach ($messages as $Message) {
				echo '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				echo '<a href="index.php?m=getMessage&amp;ID='.$Message->ID.'">'.$Message->Sender.'</a>';
				echo ($Message->Type=="MAIL" ? '':' &middot; <span class="highlight">SMS</span>').'';
				if ($Message->Type=="MAIL") echo ' &middot; '.($Message->Status=="UNREAD" ? '<span class="spot">ungelesen</span>':'<span class="highlight">gelesen</span>');
				echo '<br/>Vorschau: '.utf8_decode(substr($Message->Subject, 0, 25)).(strlen($Message->Subject)>25 ? '...':'');
				echo '<br/>'.date("d.m.y", strtotime($Message->Time)).' &middot; '.date("H:i", strtotime($Message->Time)).' Uhr<br/>';
				echo '<a href="index.php?m=getMessage&amp;ID='.$Message->ID.'">&ouml;ffnen</a> &middot; <a href="index.php?m=sendMessage&amp;Type=MAIL&amp;Recipient='.$Message->Sender.'&amp;Text='.$Message->Text.'">antworten</a> &middot; <a href="index.php?m=deleteMessage&amp;ID='.$Message->ID.'&amp;goto=Inbox">l&ouml;schen</a>';
				echo '</p>';
				$i++;	
			}
		} else echo '<p class="message">Du hast keine Nachrichten.</p>';
		echo '</div>';	
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayOutbox($fullPage = true, $messages) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Mails &middot; Postausgang");
		$menuHTML = '<p><a href="index.php?m=getInbox">Posteingang</a> &middot; <a href="'.$_PHPSELF.'">Reload</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		if ($messages==null) {
			echo '<p class="message">Du hast keine Nachrichten.</p>';
		} else {
			if (is_object($messages)) $messages = array($messages);
			$i=1;
			foreach ($messages as $Message) {
				echo '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				echo '<a href="index.php?m=getMessage&amp;ID='.$Message->ID.'">'.$Message->Recipient.'</a>';
				echo ($Message->Type=="MAIL" ? '':' &middot; <span class="highlight">SMS</span>').'';
				if ($Message->Type=="MAIL") echo ' &middot; '.($Message->Status=="UNREAD" ? '<span class="spot">ungelesen</span>':'<span class="highlight">gelesen</span>');
				echo '<br/>Vorschau: '.utf8_decode(substr($Message->Subject, 0, 25)).(strlen($Message->Subject)>25 ? '...':'');
				echo '<br/>'.date("d.m.y", strtotime($Message->Time)).' &middot; '.date("H:i", strtotime($Message->Time)).' Uhr<br/>';
				echo '<a href="index.php?m=getMessage&amp;ID='.$Message->ID.'">&ouml;ffnen</a> &middot; <a href="index.php?m=deleteMessage&amp;ID='.$Message->ID.'&amp;goto=Outbox">l&ouml;schen</a>';
				echo '</p>';
				$i++;	
			}
		}
		echo '</div>';	
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayMessage($fullPage = true, $Message) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle(($Message->Type=="SMS" ? "SMS-Nachricht":"Nachricht"));
		$menuHTML = '<p><a accesskey="p" href="index.php?m=getInbox">Posteingang</a> &middot; <a href="index.php?m=getOutbox">Postausgang</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p>Von <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Message->Sender).'">'.htmlspecialchars($Message->Sender).'</a> an <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Message->Recipient).'">'.htmlspecialchars($Message->Recipient).'</a>,';
		echo '<br/>verschickt am '.date("d.m. H:i", strtotime($Message->Time)).' Uhr</p>';
		echo '<p>Empf&auml;nger-Status: '.($Message->Status=="READ" ? '<span class="highlight">gelesen</span>':'<span class="message">ungelesen</span>').'</p>';
		echo '<div class="border"><div class="highlight">'.utf8_decode($Message->Text).'</div></div>';	
		echo '<p><a href="index.php?m=sendMessage&amp;Type=MAIL&amp;Recipient='.$Message->Sender.'&amp;TextAttachment='.urlencode($Message->Text).'">antworten</a> &middot; <a href="index.php?m=deleteMessage&amp;ID='.$Message->ID.'&amp;goto='.($Message->Recipient==$_SESSION["User"]->Username ? 'Inbox':'Outbox').'">l&ouml;schen</a></p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayPointOfInterestForm($fullPage = true, $Object, $update=false) {
		if ($fullPage) $this->displayPageHeader();
		$buffer = "";
		if ($Object!=null) {
			$POITypes = $this->MySonar->getProperty("poitypes");
			if ($Object->Party->Type=="PARTY" || $Object->Party->Type=="EVENT") {
				// Party
				$type = $POITypes[$Object->Party->Type];
				$title = $type;
				$back = '<a href="index.php?m=setPointOfInterest">Zur &Uuml;bersicht</a>';
				if ($Object->Party->Type=="PARTY") {
					if ($Object->Party->Private==false) $buffer .= '<div class="border">&Ouml;ffentliche Partys k&ouml;nnen von allen Mitgliedern gefunden werden, Privat-Partys nur von deinen besten Freunden (BEFs).</div>';
					else $buffer .= '<div class="border">Privat-Partys k&ouml;nnen nur von deinen besten Freunden (BEFs) gefunden werden, &ouml;ffentliche Partys von allen Mitgliedern.</div>';
				}
				$buffer .= '<form action="index.php" method="get">';
				$buffer .= '<div>';
				$buffer .= '<input type="hidden" name="m" value="'.($update ? 'updatePointOfInterest':'setPointOfInterest').'"/>';
				// if admin user then POI is almost actived
				if ($_SESSION["User"]->Username==$this->MySonar->getProperty("admin_username")) $buffer .= '<input type="hidden" name="Active" value="1"/>';
				$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				$buffer .= '<input type="hidden" name="ID" value="'.$Object->Party->ID.'"/>';
				$buffer .= '<input type="hidden" name="Type" value="'.$Object->Party->Type.'"/>';
				if ($Object->Party->Type=="PARTY") {
					$buffer .= '<input type="hidden" name="Private" value="'.($Object->Party->Private ? "true":"false").'"/>';
					$buffer .= '<p class="highlight">Art der Party: '.($Object->Party->Private==false ? '&ouml;ffentlich':'privat');
					if (!$update) $buffer .= ' &middot; <a href="index.php?m=setPointOfInterest&amp;ID='.$Object->Party->ID.'&amp;Type=PARTY&amp;Private='.($Object->Party->Private==false ? 'true':'false').'">&auml;ndern</a></p>';
				}
				$buffer .= '<p>Wie hei&szlig;t '.($Object->Party->Type=="PARTY" ? 'die Party':'das Event bzw. die Band').'?<br/><input class="text" type="text" name="Name" value="'.$Object->Party->Name.'" size="20"/></p>';
				$buffer .= '<p>Was geht da?<br/><textarea class="text" name="Description" rows="5" cols="18">'.$Object->Party->Description.'</textarea></p>';
				$buffer .= '<p>Wo genau? (Stadt &middot; Str. &middot; Nr.)<br/><input class="text" type="text" name="Address" value="'.$Object->Location->Address.'" size="20"/></p>';
				if ($Object->Party->Private==false) $buffer .= '<p>Wie hei&szlig;t der Laden? (optional)<br/><input class="text" type="text" name="LocationName" value="'.$Object->Party->LocationName.'" size="20"/></p>';
				$buffer .= '<p>Wann? (Datum &middot; Uhrzeit)<br/>';
				$buffer .= '<input class="text" type="text" name="Begin" value="'.date("dmY Hi", strtotime($Object->Party->Begin)).'" size="20"/><br/><span class="message">Format: TTMMJJJJ SSMM</span></p>';
			} else {
				// POI
				$type = $POITypes[$Object->PointOfInterest->Type];
				$title = $type;
				$back = '<a href="index.php?m=setPointOfInterest">Zur &Uuml;bersicht</a>';
				$buffer .= '<form action="index.php" method="get">';
				$buffer .= '<div>';
				$buffer .= '<input type="hidden" name="m" value="'.($update ? 'updatePointOfInterest':'setPointOfInterest').'"/>';
				// if admin user then POI is almost actived
				if ($_SESSION["User"]->Username==$this->MySonar->getProperty("admin_username")) $buffer .= '<input type="hidden" name="Active" value="1"/>';
				$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				$buffer .= '<input type="hidden" name="ID" value="'.$Object->PointOfInterest->ID.'"/>';
				$buffer .= '<input type="hidden" name="Type" value="'.$Object->PointOfInterest->Type.'"/>';
				$buffer .= '<p>'.($Object->PointOfInterest->Type=="CASHPOINT" ? 'Bank?':'Name?').'<br/><input class="text" type="text" name="Name" value="'.($Object->PointOfInterest->Type=="CASHPOINT" ? 'Geldautomat ':'').$Object->PointOfInterest->Name.'" size="20"/></p>';
				$buffer .= '<p>Beschreibung &middot; ggf. Bewertung<br/><textarea class="text" name="Description" rows="5" cols="18">'.$Object->PointOfInterest->Description.'</textarea></p>';
				$buffer .= '<p>Wo? (Stadt &middot; Str. &middot; Nr.)<br/><input class="text" type="text" name="Address" value="'.$Object->Location->Address.'" size="20"/></p>';
			}
			if (!$update) $buffer .= '<p class="highlight">Point Of Interests werden vor ihrer Ver&ouml;ffentlichung redaktionell gepr&uuml;ft.'.($Object->Party->Private==true ? '':' Nach Freischaltung erh&auml;ltst du einmalig 30 $onars pro Meldung. Falschmeldungen f&uuml;hren zur K&uuml;ndigung der Mitgliedschaft.').'</p>';
			$buffer .= '<p><input class="button" type="submit" name="submit" value="'.($update ? '&Auml;ndern':'Einreichen').'"/></p>';
			$buffer .= '</div>';
			$buffer .= '</form>';
		} else {
			// Menu
			$title = "Partys &amp; Locations";
			$back = $this->MySonar->getProperty("backlink");
			$buffer .= '<div class="border"><p>Melde uns Partys und Pl&auml;tze (Points Of Interest=POI)! So erfahren deine Freunde, wo was los ist! Als Dankesch&ouml;n erh&auml;ltst du pro Meldung 30 <a href="index.php?m=getHelp&amp;key=q902">$onars</a> (au&szlig;er f&uuml;r Privat-Partys).</p></div>';
			$buffer .= '<p class="highlight">Was m&ouml;chtest du melden?</p>';
			$options = array();
			array_push($options, array("title"=>"Party oder Privatparty", "href"=>"index.php?m=setPointOfInterest&amp;Type=PARTY"));
			array_push($options, array("title"=>"Event, Konzert oder Gig", "href"=>"index.php?m=setPointOfInterest&amp;Type=EVENT"));
			array_push($options, array("title"=>"Restaurant oder Bistro", "href"=>"index.php?m=setPointOfInterest&amp;Type=RESTAURANT"));
			array_push($options, array("title"=>"Disco oder Club", "href"=>"index.php?m=setPointOfInterest&amp;Type=CLUB"));
			array_push($options, array("title"=>"Cafe oder Eiscafe", "href"=>"index.php?m=setPointOfInterest&amp;Type=CAFE"));
			array_push($options, array("title"=>"Bar oder Kneipe", "href"=>"index.php?m=setPointOfInterest&amp;Type=BAR"));
			array_push($options, array("title"=>"Kino oder Autokino", "href"=>"index.php?m=setPointOfInterest&amp;Type=CINEMA"));
			array_push($options, array("title"=>"Geldautomat", "href"=>"index.php?m=setPointOfInterest&amp;Type=CASHPOINT"));
			array_push($options, array("title"=>"Tankstelle", "href"=>"index.php?m=setPointOfInterest&amp;Type=GASSTATION"));
			array_push($options, array("title"=>"Supermarkt oder Discounter", "href"=>"index.php?m=setPointOfInterest&amp;Type=SUPERMARKET"));
			array_push($options, array("title"=>"Shop", "href"=>"index.php?m=setPointOfInterest&amp;Type=SHOP"));
			array_push($options, array("title"=>"Bowling- oder Kegelbahn", "href"=>"index.php?m=setPointOfInterest&amp;Type=BOWLING"));
			array_push($options, array("title"=>"Schwimmbad", "href"=>"index.php?m=setPointOfInterest&amp;Type=BATHS"));
			array_push($options, array("title"=>"Fastfood-Restaurant", "href"=>"index.php?m=setPointOfInterest&amp;Type=FASTFOOD"));
			array_push($options, array("title"=>"Imbiss", "href"=>"index.php?m=setPointOfInterest&amp;Type=SNACK"));
			array_push($options, array("title"=>"Apotheke oder Drogerie", "href"=>"index.php?m=setPointOfInterest&amp;Type=DRUGSTORE"));
			array_push($options, array("title"=>"WLAN-Hotspot", "href"=>"index.php?m=setPointOfInterest&amp;Type=HOTSPOT"));
			array_push($options, array("title"=>"Post", "href"=>"index.php?m=setPointOfInterest&amp;Type=POST"));
			array_push($options, array("title"=>"Parkplatz oder -haus", "href"=>"index.php?m=setPointOfInterest&amp;Type=PARKINGLOT"));
			array_push($options, array("title"=>"Taxihaltestelle", "href"=>"index.php?m=setPointOfInterest&amp;Type=TAXISTOP"));
			array_push($options, array("title"=>"Campingplatz", "href"=>"index.php?m=setPointOfInterest&amp;Type=CAMPINGGROUND"));
			array_push($options, array("title"=>"Jugendherberge", "href"=>"index.php?m=setPointOfInterest&amp;Type=YOUTHHOSTEL"));
			array_push($options, array("title"=>"Fitness-Studio", "href"=>"index.php?m=setPointOfInterest&amp;Type=GYM"));
			array_push($options, array("title"=>"Reiterhof", "href"=>"index.php?m=setPointOfInterest&amp;Type=HORSEFARM"));
			$menu = true;
		}
		$this->displayTitle($title.($update ? ' &auml;ndern':' melden'));
		$menuHTML = '<p>'.($update ? $this->MySonar->getProperty("backlink"):$back).' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo $buffer;
		$this->displayOptions($options, false, false);
		if ($menu) echo '<p class="highlight">Fehlen Kategorien?<br/>Schreib uns eine <a href="index.php?m=sendMessage&amp;Recipient='.$this->MySonar->getProperty("admin_username").'&amp;Text=Liebes mySonar-Team! Ich wuensche mir folgende Kategorie:">Mail</a>.</p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	

	public function displayGroupForm($fullPage = true, $Group, $update=false) {
		if ($fullPage) $this->displayPageHeader();
		$buffer = '';
		if ($Group) {
			$buffer .= '<div class="border">';
			$buffer .= 'Hier kannst du eine neue Gruppe erstellen, um Leute mit gemeinsamen Interessen zu vernetzen und dich mit ihnen auszutauschen.';
			$buffer .= '</div>';
			$buffer .= '<form action="index.php" method="get">';
			$buffer .= '<div>';
			$buffer .= '<input type="hidden" name="m" value="'.($update ? 'updateGroup':'createGroup').'"/>';
			$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
			$buffer .= '<input type="hidden" name="ID" value="'.$Group->ID.'"/>';
			$buffer .= '<p>Wie soll die Gruppe hei&szlig;en?<br/><input class="text" type="text" name="Name" value="'.$Group->Name.'" size="20" maxlength="50"/><br/><span class="spot">max. 50 Zeichen</span></p>';
			$buffer .= '<p>Worum gehts in der Gruppe?<br/><textarea class="text" name="Description" rows="5" cols="18">'.$Group->Description.'</textarea><br/><span class="spot">max. 255 Zeichen</span></p>';
			$buffer .= '<p><input type="submit" name="submit" value="Gruppen gr&uuml;nden"/></p>';
			$buffer .= '</div>';
			$buffer .= '</form>';
			$buffer .= '<p class="highlight">Deine Gruppe wird sofort freigeschaltet. Achtung: Gruppen, die Personen oder andere Gruppen angreifen sind nicht zul&auml;ssig. Das Gr&uuml;nden einer solchen Gruppe f&uuml;hrt zur L&ouml;schung deines Accounts.</p>';
			$this->displayTitle(($update ? 'Gruppe &auml;ndern':' Neue Gruppe gr&uuml;nden'));
			$menuHTML = '<p><a href="index.php?Tab=GROUPS">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		} else {
			$buffer .= '<p>Diese Gruppe existiert nicht mehr.</p>';	
		}
		echo $menuHTML;
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	

	public function displayTopicForm($fullPage = true, $Article, $Group, $update=false) {
		if ($fullPage) $this->displayPageHeader();
		$buffer .= '<form action="index.php" method="get">';
		$buffer .= '<div>';
		$buffer .= '<input type="hidden" name="m" value="'.($update ? 'updateTopic':'setTopic').'"/>';
		$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
		$buffer .= '<input type="hidden" name="ID" value="'.$Article->ID.'"/>';
		$buffer .= '<input type="hidden" name="GroupID" value="'.$Group->ID.'"/>'; // the id of the group to belong to
		$buffer .= '<input type="hidden" name="GroupName" value="'.$Group->Name.'"/>';
		$buffer .= '<input type="hidden" name="GroupDescription" value="'.$Group->Description.'"/>';
		$title = 'Gruppe von '.$Group->Owner;
		$buffer .= '<p>'.($update ? 'Thema &auml;ndern':'Neues Thema').'<br/>';
		$buffer .= '<input type="text" class="text" maxlength="50" size="20" name="Title" value="'.$Article->Title.'"/></p>';
		$buffer .= '<p>Text'.($update ? ' &auml;ndern':'').'<br/>';
		$buffer .= '<textarea class="text" name="Content" cols="18" rows="5">'.$Article->Content.'</textarea></p>';
		$buffer .= '<p><input class="button" type="submit" name="submit" value="'.($update ? '&Auml;ndern':'Abschicken').'"/></p>';
		$buffer .= '</div>';
		$buffer .= '</form>';
		$this->displayTitle($title, "group");
		$menuHTML = '<p><a href="index.php?m=getGroup&amp;ID='.$Group->ID.'">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<strong class="highlight title">'.$Group->Name.'</strong><br/>';
		echo $Group->Description;
		echo '</div>';
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	

	public function displayArticleForm($fullPage = true, $Topic, $Article, $update=false) {
		if ($fullPage) $this->displayPageHeader();
		$Group = $Topic[1];
		$Topic = $Topic[0];
		$buffer .= '<form action="index.php" method="get">';
		$buffer .= '<div>';
		$buffer .= '<input type="hidden" name="m" value="'.($update ? 'updateArticle':'setArticle').'"/>';
		$buffer .= '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
		$buffer .= '<input type="hidden" name="ID" value="'.$Article->ID.'"/>'; 
		$buffer .= '<input type="hidden" name="ReferenceID" value="'.$Topic->ID.'"/>'; 
		$title = 'Gruppe von '.$Group->Owner;
		$buffer .= '<p>'.($update ? 'Beitrag &auml;ndern':'Neuer Beitrag').'<br/>';
		$buffer .= '<textarea class="text" name="Content" cols="18" rows="5">'.$Article->Content.'</textarea></p>';
		$buffer .= '<p><input class="button" type="submit" name="submit" value="'.($update ? '&Auml;ndern':'Abschicken').'"/></p>';
		$buffer .= '</div>';
		$buffer .= '</form>';
		$this->displayTitle($title, "group");
		$menuHTML = '<p><a href="index.php?m=getTopic&amp;ID='.$Topic->ID.'">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<strong class="highlight title">'.$Group->Name.'</strong><br/>';
		echo '<strong>Thema:</strong> '.$Topic->Title;
		echo '</div>';
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	
	
	public function displayTermsAndConditions($fullPage = true, $Terms) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Nutzungsbedingungen");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p>Version '.$Terms->Release.' vom '.date("d.m.Y", strtotime($Terms->Date)).'</p>';
		echo '<p><div class="border">';
		echo '<div class="terms">'.$Terms->HTML.'</div>';
		echo '</p></div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayFriends($fullPage = true, $objects, $Username="") {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle(($Username!="" ? 'Kontakte von '.htmlspecialchars($Username):'Meine Kontakte'));
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		$buffer = '';
		if (count($objects)>0) {
			if (is_object($objects)) $objects = array($objects);
			$ownFriends = true;
			if ($Username!="") $ownFriends = false;
			$friends = 0; $pendingFriends = 0; $bef = 0;
			$i = 1;
			foreach ($objects as $Object) {
				$Friend = $Object->User;
				if ($Friend->Friendship=="CONFIRMED") $friends++; else $pendingFriends++;
				$buffer .= '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				if ($Friend->Friendship=="PENDING") $buffer .= '<span class="highlight">&middot;&middot;&middot; Anfrage nicht best&auml;tigt &middot;&middot;&middot;</span><br/>';
				$buffer .= '<a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Friend->Username).'">'.htmlspecialchars($Friend->Username).'</a> ';
				if ($Friend->BestFriend==true) { $buffer .= ' &middot; <span class="friend">BEF</span>'; $bef++; }
				if ($Friend->Sex!="") $buffer .= ' &middot; '.($Friend->Sex=="MALE" ? '<span class="male">M</span>':'<span class="female">W</span>');
				if ($Friend->Age!="") $buffer .= ' &middot; '.$Friend->Age;
				$status = $this->MySonar->getProperty("status");
				$buffer .= ' &middot; '.$status[$Friend->Status];
				if ($Username=="") {
					$buffer .= '<br/><a href="index.php?m=sendMessage&amp;Type=MAIL&amp;Recipient='.htmlspecialchars($Friend->Username).'">Mail</a> &middot; ';
					if ($Friend->MobilePhoneNumber!="" && $Friend->MobilePhoneNumberConfirmed) $buffer .= '<a href="index.php?m=sendMessage&amp;Type=SMS&amp;Recipient='.htmlspecialchars($Friend->Username).'">SMS</a> &middot; <a href="index.php?m=doPhoneCall&amp;MobilePhoneNumber='.$Friend->MobilePhoneNumber.'">Anruf (beta)</a><br/>';
					if ($Friend->BestFriend==false) $buffer .= '<a href="index.php?m=setBestFriend&amp;Username='.htmlspecialchars($Friend->Username).'">BEFen</a>';
					else $buffer .= '<a href="index.php?m=deleteBestFriend&amp;Username='.htmlspecialchars($Friend->Username).'">unBEFen</a>';
					$buffer .= ' &middot; <a href="index.php?m=deleteFriendship&amp;Username='.htmlspecialchars($Friend->Username).'">L&ouml;schen</a>';
				}
				$buffer .= '</p>';
				$i++;
			}
			$buffer2 = '<p>';
			$buffer2 .= $friends.' '.($friends>1 ? 'Kontakte':'Kontakt').' &middot; '.$bef.' <span class="friend">BEF'.($bef==1 ? '':'s').'</span><br/>';
			if (count($objects)>0 && $Username=="") {
				$buffer3 = '<p>BestFriends (<span class="friend">BEFs</span>) werden per Free-SMS informiert, wenn du in ihrer N&auml;he bist. Vom BEFen und unBEFen merken sie nichts ;-)</p>';
			}
			$buffer2 .= '</p>';
			$buffer = $buffer2.'<div class="border">'.$buffer.'</div>'.$buffer3;
			
		} else {
			$buffer .= '<p class="spot">'.($Username!="" ? htmlspecialchars($Username).' hat keinen Kontakt.':'Du hast noch keine Kontakte. M&ouml;chtest du Freunde per SMS kostenlos einladen? <a href="index.php?m=setInvitation">Hier lang</a>').'</p>'; 
		}
		echo $menuHTML;
		if ($Username=="") {
			echo '<form method="get" action="index.php">';
			echo '<div class="border">';
			echo '<input type="hidden" name="m" value="sendPing" />';
			echo '<input type="hidden" name="Profile" value="USERS_BY_KEY" />';
			echo '<input type="hidden" name="StartIndex" value="1" />';
			echo '<input type="hidden" name="Limit" value="9" />';
			echo '<p>Leute suchen<br/>';
			echo '<input class="text_home" type="text" name="Query" value="" id="sonar_location" size="10"/>&nbsp;';
			echo '<input class="button_home" id="sonar_submit" type="submit" name="submit" value="Suche"/><br/>';
			echo '<span class="spot">Name, Vorname oder Stichwort</span></p>';
			echo '</div>';
			echo '</form>';
		}
		echo $buffer;
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayFlirts($fullPage = true, $objects) {
		if (is_object($objects)) $objects = array($objects);
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Meine Flirts");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		if (count($objects)>0) {
			$flirts = 0;
			$buffer = '';
			$i = 1;
			foreach ($objects as $Object) {
				$Flirt = $Object->User;
				$buffer .= '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				$buffer .= '<a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Flirt->Username).'">'.htmlspecialchars($Flirt->Username).'</a> ';
				if ($Flirt->Sex!="") $buffer .= ' &middot; '.($Flirt->Sex=="MALE" ? '<span class="male">M</span>':'<span class="female">W</span>');
				if ($Flirt->Age!="") $buffer .= ' &middot; '.$Flirt->Age;
				$status = $this->MySonar->getProperty("status");
				$buffer .= ' &middot; '.$status[$Flirt->Status];
				if ($Flirt->EyesOn) $buffer .= '<br/>Du hast eine Auge drauf.';
				else $buffer .= '<br/>Hat ein Auge auf dich.';
				$buffer .= '<br/><a href="index.php?m=sendMessage&amp;Recipient='.htmlspecialchars($Flirt->Username).'">Nachricht</a> &middot; '.($Flirt->EyesOn ? '<a href="index.php?m=removeEyesOn&amp;Username='.htmlspecialchars($Flirt->Username).'">Augen zur&uuml;cknehmen</a>':'<a href="index.php?m=blockEyesOn&amp;Username='.htmlspecialchars($Flirt->Username).'">Flirt blocken</a>').'';
				$buffer .= '</p>';
				$i++; $flirts++;
			}
		} else {
			// no flirts
			$buffer .= '<p class="spot">Du hast noch keine Flirts.</p>';
		}
		echo $menuHTML;
		echo '<div class="border">';
		echo $buffer;
		echo '</div>';
		if (count($objects)>0) echo '<p class="highlight"><span class="my">my</span><span class="sonar">Sonar</span> informiert dich automatisch per Free-SMS, wenn Flirts in deiner N&auml;he sind, auf die du ein Auge geworfen hast.</p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayPay($fullPage = true, $Account, $Transaction) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle('$onars &uuml;berweisen');
		$menuHTML = '<p><a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Transaction->Recipient).'">Zum Profil</a> &middot; <a href="index.php?m=getStatement">Zum Konto</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p class="highlight">Kontostand: '.round($Account->Balance,0).' $onar'.($Account->Balance==1 ? '':'s').'</p>';
		echo '<p><div class="border">';
		if ($_SESSION["User"]->Username!=$this->MySonar->getProperty("admin_username") && ($_SESSION["User"]->MobilePhoneNumber=="" || !$_SESSION["User"]->MobilePhoneNumberConfirmed)) {
			echo '<p class="spot">Achtung: Diese Funktion steht dir zurzeit nicht zur Verf&uuml;gung.</p>';
			echo '<p>Um Betrug vorzubeugen, musst du zuerst deine '.($_SESSION["User"]->MobilePhoneNumber!="" ? '<a href="index.php?m=confirmUser">Handynummer aktivieren</a>':'<a href="index.php?m=updateUser&amp;Option=MobilePhoneNumber">Handynummer angeben</a>').'. Danach kannst du $onars an andere Mitglieder &uuml;berweisen.</p>';
		} else {
			if ($Account->Balance>0) {
				echo '<p>Wie viel $onars m&ouml;chtest du an <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Transaction->Recipient).'">'.$Transaction->Recipient.'</a> &uuml;berweisen?</p>';
				echo '<form action="index.php" method="get">';
				echo '<input type="hidden" name="m" value="pay"/>';
				echo '<input type="hidden" name="Recipient" value="'.$Transaction->Recipient.'"/>';
				echo '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
				echo '<p>Betrag<br/>';
				echo '<input type="text" class="text" name="Amount" value="'.$Transaction->Amount.'"/><br/>';
				echo '<span class="spot">min. 1 $onar &middot; keine Kommazahlen</span></p>';
				echo '<p>Buchungsvermerk<br/>';
				echo '<input type="text" class="text" maxlength="50" name="Description" value="'.$Transaction->Description.'"/><br/>';
				echo '<span class="spot">1 bis 50 Zeichen</span></p>';
				echo '<p><input type="submit" name="submit" value="Bezahlen"/></p>';
				echo '</form>';
			} else {
				// no money
				echo '<p class="spot">Leider hast du kein Geld auf deinem Konto.</p>'; 
				echo '<p>Willst du deinen Kontostand aufbessern? Dann melde uns Point Of Interests oder lade neue Freunde ein. <span class="my">my</span><span class="sonar">Sonar</span> zahlt daf&uuml;r $onars.</p>';
			}
		}
		echo '</div></p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayPayConfirmation($fullPage = true, $Account, $Transaction) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle('$onars &uuml;berwiesen');
		$menuHTML = '<p><a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Transaction->Recipient).'">Zum Profil</a> &middot; <a href="index.php?m=getStatement&amp;StartDate='.$_SESSION["User"]->LastLogin.'">Zum Konto</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p class="highlight">Kontostand: '.round($Account->Balance,0).' $onar'.($Account->Balance==1 ? '':'s').'</p>';
		echo '<p><div class="border">';
		echo '<p>ID: '.$Transaction->ID.'<br/>';
		echo 'Zahlungsempf&auml;nger: <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Transaction->Recipient).'">'.htmlspecialchars($Transaction->Recipient).'</a><br/>';
		echo 'Betrag: '.$Transaction->Amount.' $onar'.($Transaction->Amount==1 ? '':'s').'<br/>';
		echo 'Zeitpunkt: '.date("d.m.Y - H:i", strtotime($Transaction->Time)).' Uhr</p>';
		echo '<p>Vermerk: '.$Transaction->Description.'</p>';
		echo '</div></p>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayCouponForm($fullPage = true, $Coupon) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle('$onars einzahlen');
		$menuHTML = '<p><a href="index.php?m=getStatement">Zum Konto</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		switch ($Coupon->Type) {
			case "SONAR":
				echo '<p>Jemand hat dir einen <a href="index.php?m=getHelp&amp;key=q902">$onar-Geldschein</a> gegeben? Hier kannst du ihn einl&ouml;sen! Einfach den aufgedruckten Code eingeben und schon hast du das Geld auf deinem <span class="my">my</span><span class="sonar">Sonar</span>-Konto!</p>';
				echo '<form action="index.php" method="get">';
				echo '<div>';
				echo '<input type="hidden" name="m" value="activateCoupon"/>';
				echo '<input type="hidden" name="Type" value="'.$Coupon->Type.'"/>';
				echo '<p>Code (5-stellig)<br/>';
				echo '<input type="text" class="text" name="Code" value="'.$Coupon->Code.'"/><br/>';
				echo '<span class="spot">Gro&szlig;-/Kleinschreibung beachten</span></p>';
				echo '<p><input type="submit" name="submit" value="Einl&ouml;sen"/></p>';
				echo '</div>';
				echo '</form>';
				echo '<p class="highlight">F&uuml;r $onars kannst dir kostenlose SMS an Freunde kaufen, bei unseren <a href="index.php?m=getHelp&amp;key=q904">Partnern</a> einkaufen oder $onars an andere Mitglieder &uuml;berweisen.</p>';
			break;
			default:
				// put in menu here in case of more coupon options
			break;
		}
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayCouponConfirmation($fullPage = true, $Coupon) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle('$onars eingezahlt');
		$menuHTML = '<p><a href="index.php?m=getStatement&amp;Period=1">Zum Konto</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		switch ($Coupon->Type) {
			case "SONAR":
				echo '<p>Das hat geklappt! Wir haben dir gerade <span class="highlight"><strong>'.$Coupon->Transaction->Amount.' $onars</strong></span> auf dein <a href="index.php?m=getStatement&amp;Period=1">Konto</a> &uuml;berwiesen.</p>';
				echo '<p>Noch ein Geldschein? <a href="index.php?m=activateCoupon&amp;Type=SONAR">Hier lang</a></p>';
			break;
			default: echo '<p>Nicht unterst&uuml;tzt!</p>'; break;
		}
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	

	public function displayRequestCouponForm($fullPage = true, $Coupon) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle('$onars abheben');
		$menuHTML = '<p><a href="index.php?m=getStatement">Zum Konto</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		if ($_SESSION["User"]->MobilePhoneNumber!="" && $_SESSION["User"]->MobilePhoneNumberConfirmed) {
			switch ($Coupon->Type) {
				case "SONAR":
					echo '<p>Einige unserer <a href="index.php?m=getHelp&amp;key=q904">Partner</a> akzeptieren $onars als Zahlungsmittel. Du kannst also mit $onar-Banknoten bei ihnen bezahlen.</p>';
					echo '<form action="index.php" method="get">';
					echo '<div>';
					echo '<input type="hidden" name="m" value="getCoupon"/>';
					echo '<input type="hidden" name="Type" value="'.$Coupon->Type.'"/>';
					echo '<p>Wieviel $onars willst du abheben?<br/>';
					echo '<input type="text" class="text" name="Amount" value="'.$Coupon->Transaction->Amount.'"/><br/>'; 
					echo '<span class="spot">min. 300 $onars, z. B. 300, 500, etc.</span></p>';
					echo '<p><span class="highlight">An welche Addresse sollen wir die Banknoten senden?</span></p>';
					echo '<p>Vor- / Nachname<br/>';
					echo '<input type="text" class="text" name="Recipient" value="'.$Coupon->Address->Recipient.'"/></p>';
					echo '<p>Stra&szlig;e / Hausnr.<br/>';
					echo '<input type="text" class="text" name="Street" value="'.$Coupon->Address->Street.'"/></p>';
					echo '<p>PLZ / Ort<br/>';
					echo '<input type="text" class="text" name="Location" value="'.$Coupon->Address->Location.'"/></p>';
					echo '<p class="highlight">Wir senden dir in K&uuml;rze den gew&uuml;nschten Betrag kostenlos per Post zu. Die Banknoten sind i.d.R. innerhalb von 3 Werktagen bei dir.</p>';
					echo '<p><input type="submit" name="submit" value="$onars abheben"/></p>';
					echo '</div>';
					echo '</form>';
				break;
				default:
					// put in menu here in case of more coupon options
				break;
			}
		} else {
			echo '<p>Bevor du $onars von deinem Konto abheben und damit bei unseren <a href="index.php?m=getHelp&amp;key=q904">Partnern</a> vor Ort bezahlen kannst, musst du zuerst deine '.($_SESSION["User"]->MobilePhoneNumber!="" ? '<a href="index.php?m=confirmUser">Handynummer aktivieren</a>':'<a href="index.php?m=updateUser&amp;Option=MobilePhoneNumber&amp;value='.$_SESSION["User"]->MobilePhoneNumber.'">Handynummer angeben</a>').'.</p>';
		}
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayRequestCouponConfirmation($fullPage = true, $Coupon, $action="SONAR") {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle('$onars eingezahlt');
		$menuHTML = '<p><a href="index.php?m=getStatement&amp;StartDate='.$_SESSION["User"]->LastLogin.'">Zum Konto</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		switch ($action) {
			case "SONAR":
				echo '<p>Das hat geklappt! Wir haben dir gerade <span class="highlight"><strong>'.$Coupon->Transaction->Amount.' $onars</strong></span> auf dein <a href="index.php?m=getStatement&amp;StartDate='.$_SESSION["User"]->LastLogin.'">Konto</a> &uuml;berwiesen.</p>';
				echo '<p>Noch ein Geldschein? <a href="index.php?m=activateCoupon&amp;Type=SONAR">Hier lang</a></p>';
			break;
			case "SONAR_DISBURSEMENT":
				echo '<p>Das hat geklappt! Wir senden dir in K&uuml;rze <span class="highlight"><strong>'.$Coupon->Transaction->Amount.' $onars</strong></span> in Form von Banknoten per Post zu.</p>';
			break;
			default: echo '<p>Nicht unterst&uuml;tzt!</p>'; break;
		}
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayPhoneCall($fullPage = true, $MobilePhoneNumber) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle('Anruf: '.$MobilePhoneNumber);
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo 'Achtung: Nicht jedes Handy unterst&uuml;tzt diese Funktion. Wenn du <span class="my">my</span><span class="sonar">Sonar</span> &uuml;ber PC nutzt, brauchst du eine Telefon-Software.';
		echo '<p><a href="tel:'.$MobilePhoneNumber.'">Teilnehmer jetzt anrufen</a></p>';
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayStatement($fullPage = true, $Statement) {
		$Transactions = $Statement->Transaction;
		if (is_object($Transactions)) $Transactions = array($Transactions);
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Mein Konto");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		$buffer = '';
		if (count($Transactions)>0) {
			$i = 1;
			foreach ($Transactions as $Transaction) {
				if ($Transaction->Amount<0) {
					// debit
					$text = 'Emp&auml;nger <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Transaction->Recipient).'">'.htmlspecialchars($Transaction->Recipient).'</a>';
				} else {
					// credit
					$text = 'Absender <a href="index.php?m=getProfile&amp;Username">'.htmlspecialchars($Transaction->Sender).'</a>';
				}
				$buffer .= '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				$buffer .= date("d.m.y H:i", strtotime($Transaction->Time)).' &middot; '.($Transaction->Type=="DEBIT" ? '<span class="spot">SOLL</span>':'<span class="highlight">HABEN</span>').' &middot; '.number_format(round($Transaction->Amount,0),0,',','.').' $<br/>';
				$buffer .= ($Transaction->Type=="CREDIT" ? 'Absender':'Empf&auml;nger').': <a href="index.php?m=getProfile&amp;Username='.($Transaction->Type=="CREDIT" ? htmlspecialchars($Transaction->Sender):htmlspecialchars($Transaction->Recipient)).'">'.($Transaction->Type=="CREDIT" ? $Transaction->Sender:$Transaction->Recipient).'</a><br/>';
				$buffer .= ''.substr($Transaction->Description,0,35).(strlen($Transaction->Description)>35 ? '...':'');
				$buffer .= '</p>';
				$i++; $transactions++;
			}
		} else {
			// no transaction found
			$buffer .= '<p class="spot">Keine Transaktionen im Zeitraum.</p>';
		}
		echo $menuHTML;
		echo '<p>';
		echo 'Kontostand: <strong><span class="'.($Statement->Account->Balance>0 ? 'highlight':'spot').'">'.number_format(round($Statement->Account->Balance,0),0,',','.').'</span></strong> $onar'.($Statement->Account->Balance==1 ? '':'s').'<br/>';
		echo '</p>';
		echo '<p><a href="index.php?m=activateCoupon&amp;Type=SONAR">$onars einzahlen</a> &middot; <a href="index.php?m=getCoupon&amp;Type=SONAR">$onars abheben</a></p>';
		echo '<p class="highlight">'.count($Transactions).' Transaktion'.(count($Transactions)==1 ? '':'en').' im Zeitraum<br/> '.date("d.m. H:i", strtotime($Statement->StartDate)).' Uhr bis heute '.date("H:i", strtotime($Statement->StopDate)).' Uhr</p>';
		echo '<p>Zeige: <a href="index.php?m=getStatement&amp;Period=1">1</a> &middot; <a href="index.php?m=getStatement&amp;Period=3">3</a> &middot; <a href="index.php?m=getStatement&amp;Period=10">10</a> &middot; <a href="index.php?m=getStatement&amp;Period=20">20</a> &middot; <a href="index.php?m=getStatement&amp;Period=30">30</a> Tage</p>';
		echo '<div class="border">';
		echo $buffer;
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
				
	public function displayFriendshipRequests($fullPage = true, $users) {
		if (is_object($users)) $users = array($users);
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Kontaktanfragen");
		$menuHTML = '<p><a href="index.php?m=getStatistics" title="Zur&uuml;ck">Zur&uuml;ck</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		$countUsers = count($users);
		if ($countUsers>0) {
			echo '<p>'.$countUsers.' '.($countUsers>1 ? 'Kontakte warten':'Kontakt wartet').' auf Best&auml;tigung.</p>';
			$i=1; $buffer = '<span class="nav">';
			foreach ($users as $Friend) {
				$buffer .= '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				$buffer .= '<a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($Friend->Username).'">'.htmlspecialchars($Friend->Username).'</a> ';
				if ($Friend->BestFriend==true) $buffer .= ' &middot; BestFriend';
				if ($Friend->Sex!="") $buffer .= ' &middot; '.($Friend->Sex=="MALE" ? '<span class="male">M</span>':'<span class="female">W</span>');
				if ($Friend->Age!="") $buffer .= ' &middot; '.$Friend->Age;
				$status = $this->MySonar->getProperty("status");
				$buffer .= ' &middot; '.$status[$Friend->Status];
				$buffer .= '<br/><a href="index.php?m=confirmFriendship&amp;Username='.htmlspecialchars($Friend->Username).'&amp;submit=true">annehmen</a> &middot; <a href="index.php?m=deleteFriendship&amp;Username='.htmlspecialchars($Friend->Username).'&amp;submit=true">ablehnen</a>';
				$buffer .= '</p>';
				$i++;
			}
			$buffer .= '</span>';
		} else {
			// no requests
			$buffer .= '<p class="spot">Zurzeit gibt es keine Anfragen.</p>';
		}
		echo '<div class="border">';
		echo $buffer;
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}
	
	public function displayPendingPOIs($fullPage = true, $Objects) {
		if (is_object($Objects)) $Objects = array($Objects);
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Meine POIs in Pr&uuml;fung");
		$menuHTML = '<p><a href="index.php?m=getStatistics">Whazzupp?</a> &middot; <a href="index.php?m=setPointOfInterest">POIs melden</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<p>Wenn du Partys &amp; Locations gemeldet hast, werden sie erst redaktionell gepr&uuml;ft. So lange sie auf Freigabe warten, findest du sie hier.</p>';
		$countObjects = count($Objects);
		if ($countObjects>0) {
			echo '<p>'.$countObjects.' '.($countObjects>1 ? 'POIs warten':'POI wartet').' auf Freigabe.</p>';
			$i=1; $buffer = '<span class="nav">';
			foreach ($Objects as $Object) {
				if ($Object->Party!=null) $POI = $Object->Party;
				else $POI = $Object->PointOfInterest;
				$User = $Object->User;
				$buffer .= '<p class="li '.(fmod($i, 2)==1 ? 'line':'altline').'">';
				$buffer .= '<a href="index.php?m=updatePointOfInterest&amp;ID='.$POI->ID.'">'.$POI->Name.'</a>';
				$buffer .= '<br/><span>'.substr($POI->Description,0,70).(strlen($POI->Description)>70 ? '...':'').'</span>';
				$buffer .= '<span class="highlight"><br/>gemeldet durch <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'">'.htmlspecialchars($User->Username).'</a>';
				$buffer .= '<br/>am '.date("d.m.y", strtotime($Object->Timestamp)).' um '.date("H:i", strtotime($Object->Timestamp)).' Uhr</span>';
				$buffer .= '<br/><a href="index.php?m=updatePointOfInterest&amp;ID='.$POI->ID.'">&auml;ndern</a> &middot; <a href="index.php?m=deletePointOfInterest&amp;ID='.$POI->ID.'">l&ouml;schen</a>';
				$buffer .= '</p>';
				$i++;
			}
			$buffer .= '</span>';
		} else {
			// no requests
			$buffer .= '<p class="spot">Zurzeit gibt es keine schwebenden POIs.</p>';
		}
		echo '<div class="border">';
		echo $buffer;
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	
	
	public function displayInvitationForm($fullPage = true, $mobilephonenumber, $sender, $recipient, $text) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Freunde einladen");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border"><p>Lade deine Freunde kostenlos per SMS ein. So w&auml;chst dein lokales Netzwerk und du lernst &uuml;ber sie neue Leute kennen. &Uuml;brigens: &Uuml;ber <span class="my">my</span><span class="sonar">Sonar</span> kannst du ihnen kostenlose SMS senden. Und f&uuml;r jede erfolgreiche Einladung erh&auml;ltst du von uns au&szlig;erdem 150 <a href="index.php?m=getHelp&amp;key=q902">$onars</a>.</p></div>';
		if ($_SESSION["User"]->MobilePhoneNumber!="" && $_SESSION["User"]->MobilePhoneNumberConfirmed==true) {
			// to avoid spamming the users mobile phone number has to be set first
			echo '<form action="index.php" method="get">';
			echo '<div>';
			echo '<input type="hidden" name="m" value="setInvitation"/>';
			if ($_SESSION["User"]->Name!="") {
				echo '<input type="hidden" name="Sender" value="'.$_SESSION["User"]->Name.'"/>';
			} else {
				echo '<p>Dein Vorname<span class="message"></span><br/>';
				echo '<input class="text" type="text" name="Sender" value="'.$sender.'" maxlength="20" size="20"/><br/><span class="message">Bitte keine Sonderzeichen!</span></p>';
			}
			echo '<p>Wen einladen? (Vorname)<span class="message"></span><br/>';
			echo '<input class="text" type="text" name="Recipient" value="'.$recipient.'" maxlength="20" size="20"/><br/><span class="message">Bitte keine Sonderzeichen!</span></p>';
			echo '<p>Handynr. des Empf&auml;ngers<br/>';
			echo '<input class="text" type="text" name="MobilePhoneNumber" value="'.$mobilephonenumber.'" maxlength="20" size="20"/><br/><span class="message">Nur Ziffern eingeben!</span></p>';
			echo '<p>Deine Nachricht an den Empf&auml;nger<br/>';
			echo '<textarea class="text" name="Text" rows="3" cols="18">'.$text.'</textarea><br/><span class="message">Max. 150 Zeichen!</span></p>';
			echo '<p class="highlight">Wir zeigen dir erst die Einladung, die wir dann kostenlos per SMS versenden!</p>';
			echo '<p><input type="submit" name="submit" value="Weiter"/></p>';
			echo '</div>';
			echo '</form>';
		} else {
			echo '<p>';
			if ($_SESSION["User"]->MobilePhoneNumber=="") echo '<p class="highlight">Um SMS-Spamming zu vermeiden, musst du zuerst deine <a href="index.php?m=updateUser&amp;Option=MobilePhoneNumber&amp;value=">Handynr. angeben</a>!</p>';
			elseif ($_SESSION["User"]->MobilePhoneNumberConfirmed==false) echo '<p class="highlight">Um SMS-Spamming zu vermeiden, musst du zuerst deine <a href="index.php?m=confirmUser&amp;MobilePhoneNumber='.$_SESSION["User"]->MobilePhoneNumber.'">Handynr. aktivieren</a>!</p>';
			echo '</p>';
		}
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayInvitationConfirmation($fullPage = true, $mobilephonenumber, $sender, $recipient, $text) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Freunde einladen");
		$menuHTML = '<p><a href="index.php?m=setInvitation&amp;Sender='.$sender.'&amp;Recipient='.$recipient.'&amp;MobilePhoneNumber='.$mobilephonenumber.'&amp;Text='.$text.'">Angaben &auml;ndern</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<form action="index.php" method="get">';
		echo '<div>';
		echo '<input type="hidden" name="m" value="setInvitation"/>';
		echo '<input type="hidden" name="Sender" value="'.$sender.'"/>';
		echo '<input type="hidden" name="Recipient" value="'.$recipient.'"/>';
		echo '<input type="hidden" name="MobilePhoneNumber" value="'.$mobilephonenumber.'"/>';
		echo '<input type="hidden" name="Text" value="'.$text.'"/>';
		echo '<div class="border">Die folgende SMS senden wir jetzt an die Handnnr.: <span class="highlight">'.$mobilephonenumber.'</span></div>';
		echo '<p>';
		echo substr('Hi '.$recipient.'! '.$sender.' hat dich eingeladen'.($text!="" ? ': '.substr($text,0,150):'').' - www.mysonar.de eingeben und mit Code XXXX kostenlos registrieren! mySonar - Die Handy-Community!',0,320);
		echo '</p>';
		echo '<p class="highlight">Wir informieren dich automatisch, wenn deine Einladung angenommen wird!</p>';
		echo '<p><input type="submit" name="OK" value="Einladung versenden"/></p>';
		echo '</div>';
		echo '</form>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayFriendshipForm($fullPage = true, $User, $Message, $MobilePhoneNumber=false) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Als Kontakt hinzuf&uuml;gen");
		$menuHTML = '<p><a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'">Zum Profil</a> &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<p>Hier kannst du <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'">'.htmlspecialchars($User->Username).'</a> eine Kontaktanfrage senden. Nach Best&auml;tigung der Anfrage geh&ouml;rt '.htmlspecialchars($User->Username).' zu deinen Kontakten.</p>';
		echo '<p>';
		echo '<form action="index.php" method="get">';
		echo '<input type="hidden" name="m" value="setFriendship"/>';
		echo '<input type="hidden" name="Username" value="'.htmlspecialchars($User->Username).'"/>';
		echo '<input type="hidden" name="UID" value="'.$_SESSION["UID"].'"/>';
		echo '<p>Deine Nachricht (optional)<br/>';
		echo '<textarea class="text" maxlength="'.$this->MySonar->getProperty("messagemaxchars").'" name="Text" cols="18" rows="5">'.$Message->Text.'</textarea><br/><span class="message">Max. '.$this->MySonar->getProperty("messagemaxchars").' Zeichen</span></p>';
		echo '<p class="highlight">'.htmlspecialchars($User->Username).' wird sofort informiert.</p>';
		echo '<p><input type="submit" name="submit" value="Anfrage senden"/></p>';
		echo '</form>';
		echo '</p>';
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}

	public function displayDeleteFriendship($fullPage = true, $User) {
		if ($fullPage) $this->displayPageHeader();
		$this->displayTitle("Kontakt l&ouml;schen");
		$menuHTML = '<p>'.$this->MySonar->getProperty("backlink").' &middot; '.$this->MySonar->getProperty("homelink").'</p>';
		echo $menuHTML;
		echo '<div class="border">';
		echo '<p>Alles in Ordnung? Willst du deinen Kontakt mit <a href="index.php?m=getProfile&amp;Username='.htmlspecialchars($User->Username).'">'.htmlspecialchars($User->Username).'</a> wirklich beenden?</p>';
		echo '<p>';
		$options = array();
		array_push($options, array("title"=>"oh ne, blo&szlig; nicht", "href"=>$_SERVER["HTTP_REFERER"]));
		array_push($options, array("title"=>"ja, ich wei&szlig;, was ich tue", "href"=>"index.php?m=deleteFriendship&amp;Username=".htmlspecialchars($User->Username)."&amp;submit=true"));
		$this->displayOptions($options);		
		echo '</p>';
		echo '</div>';
		echo $menuHTML;
		if ($fullPage) $this->displayPageFooter();
	}	
	
	function displayPicture($Picture) { 
		$filename = $this->MySonar->getProperty("tempdir").$Picture->Filename;
		if (is_file($filename)) {
			switch(substr($filename,strlen($filename)-3)) {
				case "jpg": 
					$image = imagecreatefromjpeg($filename);
					header("Content-type: image/jpeg");
					imagejpeg($image);
				break;
				case "gif": 
					$image = imagecreatefromgif($filename);
					header("Content-type: image/gif");
					imagegif($image);
				break;
				case "png": 
					$image = imagecreatefrompng($filename);
					header("Content-type: image/png");
					imagepng($image);
				break;
				default: 
					// nothing
				break;
			} 
			unlink($filename);
		} else {
			$image = imagecreate(60, 60);
			$bgcolor = imagecolorallocate ( $image, 0, 0, 0);
			$red = imagecolorallocate ( $image, 255, 0, 0);
			imagettftext($image, 50, 0, 13, 60, $red, "fonts/silenthell.ttf", "X");
			header("Content-type: image/gif");
			imagegif($image);
		}
	}	
		
	function displayImage($filename) { // picture before
		$filename = $this->MySonar->getProperty("tempdir").$filename;
		if (is_file($filename)) {
			switch(substr($filename,strlen($filename)-3)) {
				case "jpg": 
					$image = imagecreatefromjpeg($filename);
					header("Content-type: image/jpeg");
					imagejpeg($image);
				break;
				case "gif": 
					$image = imagecreatefromgif($filename);
					header("Content-type: image/gif");
					imagegif($image);
				break;
				case "png": 
					$image = imagecreatefrompng($filename);
					header("Content-type: image/png");
					imagepng($image);
				break;
				default: 
					// nothing
				break;
			} 
			unlink($filename);
		} else {
			$image = imagecreate(60, 60);
			$bgcolor = imagecolorallocate ( $image, 0, 0, 0);
			$red = imagecolorallocate ( $image, 255, 0, 0);
			imagettftext($image, 50, 0, 13, 60, $red, "fonts/silenthell.ttf", "X");
			header("Content-type: image/gif");
			imagegif($image);
		}
	}	
	
	private function displayOptions($options, $buffer = false, $index=false) {
		if ($options!=null) {
			$accesskey = 1;
			$output = '';
			foreach ($options as $link) { 
				$output .= ($index ? '<span class="accesskey menu">'.$accesskey.'</span>&nbsp;&nbsp;':'&middot;&nbsp;').'<a title="'.$link["title"].'" accesskey="'.$accesskey.'" href="'.$link["href"].'">'.$link["title"].'</a>&nbsp;'.$link["hint"].'<br/>';
				$accesskey++;
			}
			if ($buffer) return $output; else echo $output;
		}
	}	
	
	private function translate($content) {
		return $content;
	}

}
?>
Return current item: MySonar