Location: PHPKode > projects > HuMo-gen > menu.php
<?php
// *** Automatisch menu bepalen zonder variabele in de link ***
$auto_menu=$_SERVER['REQUEST_URI'];

// *** Automatische menukeuze hoofdindex ***
$auto_menu2 = str_replace("index", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='hoofdindex';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze personen ***
$auto_menu2 = str_replace("lijst", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='personen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze namen ***
$auto_menu2 = str_replace("lijst_namen", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='namen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze plaatsen ***
$auto_menu2 = str_replace("places", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='plaatsen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}
if (isset($_POST['index_list']) AND $_POST['index_list']=="birthplaces"){
	$save_menukeuze='plaatsen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}
if (isset($_POST['index_list']) AND $_POST['index_list']=="places"){
	$save_menukeuze='plaatsen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}
if (isset($_POST['index_list']) AND $_POST['index_list']=="deathplaces"){
	$save_menukeuze='plaatsen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze fotoboek ***
$auto_menu2 = str_replace("photoalbum", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='afbeeldingen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze bronnen ***
$auto_menu2 = str_replace("source", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='bronnen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze bronnen ***
$auto_menu2 = str_replace("address", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='adressen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze bronnen ***
$auto_menu2 = str_replace("help", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='help';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze bronnen ***
$auto_menu2 = str_replace("login", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='login';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

// *** Automatische menukeuze personen ***
$auto_menu2 = str_replace("gezin", "!", $auto_menu);
if (strpos($auto_menu2,'!')>0){
	$save_menukeuze='personen';
	$_SESSION['save_menukeuze']=$save_menukeuze;
}

$menukeuze="hoofdindex";
if (isset($_SESSION["save_menukeuze"])){ $menukeuze=$_SESSION["save_menukeuze"]; }

print '<div id="top_menu">';

$rtlmark='ltr'; if($language["dir"]=="rtl") { $rtlmark='rtl'; }
echo '<div id="top" style="direction:'.$rtlmark.';">';

	echo '<span id="top_website_name">';
		echo '<a href="'.$humo_option["homepage"].'">'.$dirmark1.'&nbsp;'.$humo_option["database_naam"].'</a>';
	echo '</span>';

	// *** Show name of family tree (if one family tree is selected) ***
	echo '<span id="top_familytree_name">';
		if (isset($zoekdatabase) AND $zoekdatabase=='allemaal'){
			echo $dirmark1.' | '.$language["main_all_family_trees"];
		}
		else{
			$treetext_name=database_name($_SESSION['tree_prefix'], $Taalkeuze);
			echo $dirmark1.' | '.$treetext_name;		
		}
	echo '</span>'; 

	// *** Show quicksearch field ***
	//echo '<span id="top_quicksearch">';
		if ($cms['cms_name']=='Joomla'){
			$path_tmp='index.php?option=com_humo-gen&amp;task=lijst';
		}
		else{
			$path_tmp='lijst.php';
		}
		print '<form method="post" action="'.$path_tmp.'" id="top_quicksearch">';
		print '<input type="hidden" name="index_list" value="quicksearch">';
		$quicksearch='';
		if (isset($_POST['quicksearch'])){
			$quicksearch=htmlentities($_POST['quicksearch'],ENT_QUOTES,'UTF-8');
			$_SESSION["save_quicksearch"]=$quicksearch;
		}
		if (isset($_SESSION["save_quicksearch"])){ $quicksearch=$_SESSION["save_quicksearch"]; }		
		print '<input type="text" name="quicksearch" value="'.$quicksearch.'" size="15">';
		print ' <input type="submit" value="'.$language["main_search"].'">';
		print "</form>";
	//echo '</span>'; 

	// *** Theme select ***
	//echo '<span id="switchform">';

	// *** Hide theme select if there is only one theme, AND it is the default theme ***
	$show_theme_select=true;
	if (count($theme_map)==1){
		if (isset($humo_option['default_skin']) AND $humo_option['default_skin'].'.css'==$theme_map[0]) {
			$show_theme_select=false;
		}
	}

	if ($show_theme_select==true){
		echo '<form title="'.$language["index_theme"].'" action="" id="switchform">';
		echo '<select name="switchcontrol" size="1" onchange="chooseStyle(this.options[this.selectedIndex].value, 365)">';

		if (isset($humo_option['default_skin'])){
			print '<option value="'.$humo_option['default_skin'].'" selected="selected">'.$language["index_theme_select"].':</option>';
			echo '<option value="'.$humo_option['default_skin'].'">'.$language["index_theme_standard"].'</option>';
		}
		else{
			print '<option value="none" selected="selected">'.$language["index_theme_select"].':</option>';
			echo '<option value="none">'.$language["index_theme_standard"].'</option>';
		}

		sort($theme_map);
		for ($i=0; $i<count($theme_map); $i++){
			$theme=$theme_map[$i];
			$theme=str_replace(".css","", $theme);
			print '<option value="'.$theme.'">'.$theme.'</option>';
		}
		echo '</select></form>';
	}

	// *** Show "A+ A- Reset" ***
	echo '<span id="top_font_size">';
		echo '&nbsp;&nbsp;&nbsp;<a href="javascript:decreaseFontSize(0);" title="decrease font size">'.$dirmark1.'A-&nbsp;</a>';
		echo ' <a href="javascript:increaseFontSize(0);" title="increase font size">A+</a>';

		$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';
		if ((stristr($navigator_user_agent, "chrome")) OR (stristr($navigator_user_agent, "safari"))) {
			// voor Chrome of Safari zet geen "reset" link, want zij doen gekke dingen met location.reload()
			//en bij "reset" krijgt men een "geen geldig gezins nummer" aankondiging
			// dus mensen met die browser kunnen gewoon de "-" gebruiken om weer te verkleinen
		}
		else {  // alle andere browsers
			 echo ' <a href="javascript:delCookie();" title="reset font size">Reset</a>'; 
		}
	echo '</span>'; // END OF SWITCHFORM

echo '</div>'; // End of Top

// *** Menu ***
$ie7_rtlhack='';  // in some skins in rtl display in IE7 menu runs off the screen and needs float:right
if (strpos($_SERVER['HTTP_USER_AGENT'],"MSIE 7.0") !== false AND $language['dir']=="rtl") { $ie7_rtlhack=' class="headerrtl"'; }
//echo '<div id="header" '.$ie7_rtlhack.' >';
echo '<div id="humo_menu"'.$ie7_rtlhack.'>';

// *** Override Joomla style lines ***
if ($cms['cms_name']=='Joomla'){
	echo '<style type="text/css">
	ul.humo_menu_item li { background:none; padding:0; }
	</style>';
}

echo '<ul class="humo_menu_item">';
	// *** You can use this link, for an extra link to another main homepage ***
	//echo '<li><a href="'.$humo_option["homepage"].'">'.$language["main_homepage"]."</a></li>";

	$selecteer=''; if ($menukeuze=='hoofdindex'){ $selecteer=' id="current"'; }
	if ($cms['cms_name']=='Joomla'){
		$path_tmp='index.php?option=com_humo-gen';
	}
	elseif ($humo_option["url_rewrite"]=="j"){
		$path_tmp='index/'.$_SESSION['tree_prefix']."/";
	}
	else{
		$path_tmp='index.php?database='.$_SESSION['tree_prefix'];
	}
	echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_mainindex_az"]."</a></li>\n";

	$selecteer=''; if ($menukeuze=='personen'){ $selecteer=' id="current"'; }
	if ($cms['cms_name']=='Joomla'){
		$path_tmp='index.php?option=com_humo-gen&amp;task=lijst&amp;database='.$_SESSION['tree_prefix'].'&amp;reset=1';
	}
	else{
		$path_tmp='lijst.php?database='.$_SESSION['tree_prefix'].'&amp;reset=1';
	}
	echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_persons"]."</a></li>\n";

	$selecteer=''; if ($menukeuze=='namen'){ $selecteer=' id="current"'; }
	if ($cms['cms_name']=='Joomla'){
		$path_tmp='index.php?option=com_humo-gen&amp;task=lijst_namen&amp;database='.$_SESSION['tree_prefix'];
	}
	elseif ($humo_option["url_rewrite"]=="j"){
		$path_tmp= 'lijst_namen/'.$_SESSION['tree_prefix'];
	}
	else{
		$path_tmp='lijst_namen.php?database='.$_SESSION['tree_prefix'];
	}
	echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_names"]."</a></li>\n";

	if ($user["plaatsen"]=="j"){
		$selecteer=''; if ($menukeuze=='plaatsen'){ $selecteer=' id="current"'; }
		//echo '<li'.$selecteer.'><a href="lijst.php?database='.$_SESSION['tree_prefix'].'&amp;index_list=places&amp;reset=1">'.$language["main_index_places"]."</a></li>\n";
		if ($cms['cms_name']=='Joomla'){
			$path_tmp='index.php?option=com_humo-gen&amp;database='.$_SESSION['tree_prefix'].'&amp;task=lijst&amp;index_list=places&amp;reset=1';
		}
		else{
			$path_tmp='lijst.php?database='.$_SESSION['tree_prefix'].'&amp;index_list=places&amp;reset=1';
		}
		echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_index_places"]."</a></li>\n";
	}

	if ($user["photobook"]=='j'){
		$selecteer=''; if ($menukeuze=='afbeeldingen'){ $selecteer=' id="current"'; }
		//echo '<li'.$selecteer.'><a href="photoalbum.php?database='.$_SESSION['tree_prefix'].'">'.$language["main_photobook"]."</a></li>\n";
		if ($cms['cms_name']=='Joomla'){
			$path_tmp='index.php?option=com_humo-gen&amp;task=photoalbum&amp;database='.$_SESSION['tree_prefix'];
		}
		else{
			$path_tmp='photoalbum.php?database='.$_SESSION['tree_prefix'];	
		}
		echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_photobook"]."</a></li>\n";
	}

	// *** Javascript pull-down menu ***
	$selecteer='';
	//if ($menukeuze=='bronnen'){ $selecteer=' id="current"'; }
	//if ($menukeuze=='adressen'){ $selecteer=' id="current"'; }

	echo '<li'.$selecteer.'>';
	//echo '<span class="'.$rtlmarker.'sddm">';
	echo '<div class="'.$rtlmarker.'sddm">';

		if ($cms['cms_name']=='Joomla'){
			$path_tmp='index.php?option=com_humo-gen';
		}
		else{
			$path_tmp='index.php';
		}
		echo '<a href="'.$path_tmp.'"';
		echo ' onmouseover="mopen(event,\'m1x\',\'?\',\'?\')"';
		echo ' onmouseout="mclosetime()">'.$language["main_extra"].'</a>';

		echo '<div id="m1x" class="sddm_abs" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">';
			echo '<ul class="humo_menu_item2">';

			if ($user["bronnen"]=='j'){
				// *** Controle of er bronnen zijn, anders wordt menu item niet weergegeven ***
				$bron=mysql_query("SELECT * FROM ".veilig($_SESSION['tree_prefix'])."sources",$db);
				@$bronnen=mysql_num_rows($bron);
				if ($bronnen>0){
					$selecteer=''; if ($menukeuze=='bronnen'){ $selecteer=' id="current"'; }
					//echo '<li'.$selecteer.'><a href="sources.php?database='.$_SESSION['tree_prefix'].'">'.$language["source_sources"]."</a></li>\n";
					if ($cms['cms_name']=='Joomla'){
						$path_tmp='index.php?option=com_humo-gen&amp;task=sources&amp;database='.$_SESSION['tree_prefix'];
					}
					else{
						$path_tmp='sources.php?database='.$_SESSION['tree_prefix'];
					}
					echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["source_sources"]."</a></li>\n";
				}
			}

			if ($user["adressen"]=='j'){
				// *** Controle of er adressen zijn, anders wordt menu item niet weergegeven ***
				$adres=mysql_query("SELECT * FROM ".veilig($_SESSION['tree_prefix'])."addresses WHERE address_gedcomnr LIKE '_%'",$db);
				@$adressen=mysql_num_rows($adres);
				if ($adressen>0){
					$selecteer=''; if ($menukeuze=='adressen'){ $selecteer=' id="current"'; }
					//echo '<li'.$selecteer.'><a href="addresses.php?database='.$_SESSION['tree_prefix'].'">'.$language["address_addresses"]."</a></li>\n";
					if ($cms['cms_name']=='Joomla'){
						$path_tmp='index.php?option=com_humo-gen&amp;task=adresses&amp;database='.$_SESSION['tree_prefix'];
					}
					else{
						$path_tmp='addresses.php?database='.$_SESSION['tree_prefix'];
					}
					echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["address_addresses"]."</a></li>\n";
				}
			}

			if ($user["group_birthday_list"]=='j' AND file_exists($cms['cms_path'].'birthday_list.php')){
				if ($cms['cms_name']=='Joomla'){
					$path_tmp='index.php?option=com_humo-gen&amp;task=birthday_list';
				}
				else{
					$path_tmp='birthday_list.php';
				}
				echo '<li><a href="'.$path_tmp.'">'.$language["birthday_list"].'</a></li>';
			}

			if ($cms['cms_name']=='Joomla'){
				$path_tmp='index.php?option=com_humo-gen&amp;task=statistics';
			}
			else{
				$path_tmp='statistics.php';
			}
			echo '<li><a href="'.$path_tmp.'">'.$language["main_statistics"].'</a></li>';

			$selecteer=''; //if ($menukeuze=='adressen'){ $selecteer=' id="current"'; }
			if ($cms['cms_name']=='Joomla'){
				$path_tmp='index.php?option=com_humo-gen&amp;task=relations';
			}
			else{
				$path_tmp='relations.php';
			}
			echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_relation"]."</a></li>\n";

			if ($dataDb->tree_owner){
				$eigenaar=$language["main_owner"].' ';
				// *** Show owner e-mail address ***
				if ($dataDb->tree_email){
					$selecteer=''; //if ($menukeuze=='adressen'){ $selecteer=' id="current"'; }
					if ($cms['cms_name']=='Joomla'){
						$path_tmp='index.php?option=com_humo-gen&amp;task=mailform';
					}
					else{
						$path_tmp='mailform.php';
					}
					echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_contact"]."</a></li>\n";
				}
				//else{
				//	$eigenaar.=$dataDb->tree_owner."<br>\n";
				//}
			}
			
			// *** Latest changes ***
			$path_tmp='latest_changes.php';
			echo '<li><a href="'.$path_tmp.'">'.$language["main_latest_changes"].'</a></li>';			

			echo '</ul>';
		echo '</div>';

	//	echo '</span>';	
	echo '</div>';

	echo '</li>';

	$selecteer=''; if ($menukeuze=='help'){ $selecteer=' id="current"'; }
	if ($cms['cms_name']=='Joomla'){
		$path_tmp='index.php?option=com_humo-gen&amp;task=help';
	}
	else{
		$path_tmp='help.php';
	}
	echo '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_help"].'</a></li>';

	if (!$user["gebruikersnaam"]){
		$selecteer=''; if ($menukeuze=='login'){ $selecteer=' id="current"'; }
		//print '<li'.$selecteer.'><a href="login.php">'.$language["main_login"]."</a></li>\n";
		if ($cms['cms']){
			$path_tmp='index.php?option=com_humo-gen&amp;task=login';
		}
		else{
			$path_tmp='login.php';
		}
		print '<li'.$selecteer.'><a href="'.$path_tmp.'">'.$language["main_login"]."</a></li>\n";
	}
	else{
		print '<li><a href="index.php?uitloggen=1">'.$language["main_logoff"]." [".$_SESSION["gebruikersnaam"]."]</a></li>\n";
	}

	echo '</ul>';

	echo '<div id="country_flags">';
	for ($i=0; $i<count($languagebestand); $i++){
		// *** Get language name ***
		include('languages/'.$languagebestand[$i].'/language_data.php');
		echo '<a href="index.php?language='.$languagebestand[$i].'" style="border-right:none; background:none;">';
		echo '<img src="'.$cms['cms_path'].'languages/'.$languagebestand[$i].'/flag.gif" title="'.$language["name"].'" alt="'.$language["name"].'" style="border:none;"></a> ';
	}
	echo '</div>';

echo '</div>'; // End of humo_menu

echo '</div>';   // End of top_menu

if($language["dir"]=="rtl") {
	print '<div id="rtlcontent">';
}
else {
	print '<div id="content">';
}

?>
Return current item: HuMo-gen