<?php
//=================================================================
// KOOBI R7 - CMS - PORTALSOFTWARE(c) DREAM4(r) 
// HTTP://WWW.DREAM4.DE
//=================================================================
// ACHTUNG!
// DIESER PROGRAMMCODE IST URHERRECHTLICH GESCHUETZT
// DIE URHEBERRECHTE LIEGEN BEI DEN JEWEILIGEN AUTOREN.
// AENDERUNGEN IN DIESER DATEI ERFOLGEN AUF EIGENE GEFAHR!
// ES IST NICHT GESTATTET, DEN COPYRIGHTHINWEIS ZU AENDERN ODER ZU
// ENTFERNEN. NUR WENN SIE EINE COPYRIGHTHINWEIS-ENTFERNUNG BESTELLT
// HABEN, DUERFEN SIE DIESEN ENTFERNEN.
//================================================================
// BEI FRAGEN WENDEN SIE SICH BITTE AN: KONTAKT@DREAM4.DE
//=================================================================
function BuildMod($sql_data)
{
	// BESCHREIBBAR
	if(!is_writeable(BASE_DIR."/.htaccess")) 
	{
		echo '<pre><strong>Fehler:</strong> <i>.htaccess</i> ist nicht beschreibbar, bitte setzen Sie die entsprechenden Rechte !</pre>';		
	}
	else
	{
	
		$sql = $GLOBALS['db']->Query("SELECT Sprachcode FROM " . PREFIX . "_sprachen WHERE Aktiv = '1'");
		while($row = $sql->fetchrow())
		{
			$langs[] = $row->Sprachcode;
		}
		
		// SPRACHEN AUSWÄHLEN
		foreach($langs as $lang)
		{ 
			// SPRACHVARIABLEN LADEN...
			if(is_file(BASE_DIR . '/lang/' . $lang . '/rewrite.txt'))
			{
				$GLOBALS['tmpl']->config_load(BASE_DIR . '/lang/' . $lang . '/rewrite.txt');
				$config_vars = $GLOBALS['tmpl']->get_config_vars();
				
				// HTACCESS REGELN
				$rewrite[] = "#--------------------- SPRACHE: ".strtoupper($lang)." ---------------------# \n \n";
				
				$rewrite[] = 'RewriteRule ^'.$config_vars['forumshelp'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=forum&action=help&hid=$1&sub=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forumshelp'].'/([^/]*)$ index.php?p=forum&action=help';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forumpage'].'/([0-9]+)/(.*)/(.*)/([_a-zA-Z]+)/([_a-zA-Z]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=showforum&fid=$1&unit=$2&period=$3&sortby=$4&sort=$5&pp=$6&page=$7';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forumpage'].'/([0-9]*)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=showforum&fid=$1&sortby=$2&sort=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['topicprint'].'/([0-9]+)/([0-9]+)/'.$config_vars['page'].'-([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=showtopic&print=1&toid=$1&fid=$2&page=$3&t=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['postprint'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=showtopic&print=1&print_post=$1&toid=$2&t=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['topic'].'/([0-9]+)/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=showtopic&toid=$1&fid=$2&page=$3&t=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['topic'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=showtopic&toid=$1&fid=$2&t=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forums'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=showforums&cid=$1&t=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forum'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=showforum&fid=$1&t=$2';
				
				$rewrite[] = 'RewriteRule ^'.$config_vars['last24'].'/([^/]*)$ index.php?p=forum&action=show&unit=h&period=24';
				$rewrite[] = 'RewriteRule ^'.$config_vars['search_mask'].'/([0-9]+)/([^/]*)$ index.php?p=forum&action=search_mask&fid=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['search_mask'].'/([^/]*)$ index.php?p=forum&action=search_mask';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forumsemptytopics'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=forum&action=print&what=topicsempty&page=$1&pp=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forumsemptytopics'].'/([^/]*)$ index.php?p=forum&action=print&what=topicsempty';
				$rewrite[] = 'RewriteRule ^'.$config_vars['userposting'].'/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=forum&action=print&what=posting&id=$1&page=$2&pp=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['userposting'].'/([0-9]+)/([^/]*)$ index.php?p=forum&action=print&what=posting&id=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['subscription'].'/([0-9]+)/([^/]*)$ index.php?p=forum&action=print&what=subscription&id=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['subscriptions'].'/([^/]*)$ index.php?p=forum&action=print&what=subscription';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forumslastposts'].'/([^/]*)$ index.php?p=forum&action=print&what=lastposts';
				$rewrite[] = 'RewriteRule ^'.$config_vars['markread'].'/([^/]*)$ index.php?p=forum&action=markread&what=forum&ReadAll=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['markread'].'/([0-9]+)/([^/]*)$ index.php?p=forum&action=markread&what=forum&id=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['addsubscription'].'/([0-9]+)/([^/]*)$ index.php?p=forum&action=addsubscription&t_id=$1';
			
				$rewrite[] = 'RewriteRule ^'.$config_vars['newtopic'].'/([0-9]+)/([^/]*)$ index.php?p=newtopic&fid=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['editpost'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=newpost&action=edit&pid=$1&toid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newpost'].'/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=newpost&toid=$1&pp=$2&num_pages=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newquote'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=newpost&action=quote&pid=$1&toid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newpost'].'/([0-9]+)/([^/]*)$ index.php?p=newpost&toid=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['delpost'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=delpost&pid=$1&toid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['getfile'].'/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=forum&action=getfile&id=$1&f_id=$2&t_id=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forums'].'/([0-9]+)/([^/]*)$ index.php?p=showforums&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['forums'].'/([^/]*)$ index.php?p=showforums';
		
				$rewrite[] = '#--------------------- BENUTZER ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['users'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=members&ud=$1&selby=$2&pp=$3&page=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['users'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=members&ud=$1&pp=$2&page=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['users'].'/([0-9]+)/([^/]*)$ index.php?p=members&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['users'].'/([^/]*)$ index.php?p=members';
				$rewrite[] = 'RewriteRule ^'.$config_vars['userprofile'].'/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=user&id=$1&area=$2&page=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['userprofile'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=user&id=$1&area=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['userprofile'].'/([0-9]+)/([^/]*)$ index.php?p=user&id=$1';
				
				$rewrite[] = 'RewriteRule ^'.$config_vars['editprofile'].'/([0-9]+)/([^/]*)$ index.php?p=useraction&action=profile&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['editprofile'].'/([^/]*)$ index.php?p=useraction&action=profile';
				$rewrite[] = 'RewriteRule ^'.$config_vars['changepass'].'/([0-9]+)/([^/]*)$ index.php?p=useraction&action=changepass&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['changepass'].'/([^/]*)$ index.php?p=useraction&action=changepass';
				$rewrite[] = 'RewriteRule ^'.$config_vars['ignore'].'/([0-9]+)/([^/]*)$ index.php?p=forum&action=ignorelist&sub=add&id=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['ignorelist'].'/([^/]*)$ index.php?p=forum&action=ignorelist';
			
				$rewrite[] = '#--------------------- PRIVATE NACHRICHTEN ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pn']."/". $config_vars['inbox'].'/([0-9]+)/([^/]*)$ index.php?p=pn&action=message&id=$1&goto=inbox';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pn']."/". $config_vars['outbox'].'/([0-9]+)/([^/]*)$ index.php?p=pn&action=message&id=$1&goto=outbox';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pn']."/". $config_vars['inbox'].'/([^/]*)$ index.php?p=pn&goto=inbox';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pn']."/". $config_vars['outbox'].'/([^/]*)$ index.php?p=pn&goto=outbox';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pn']."/". $config_vars['new'].'/(.*)/([^/]*)$ index.php?p=pn&action=new&to=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pn']."/".$config_vars['new'].'/([^/]*)$ index.php?p=pn&action=new';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pn'].'/([^/]*)$ index.php?p=pn';
				
				$rewrite[] = '#--------------------- KALENDER ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/'.$config_vars['calendar_events'].'/([public|private]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=calendar&action=events&show=$1&koobi_monat=$2&koobi_jahr=$3&koobi_tag=$4&area=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/'.$config_vars['calendar_week'].'/([public|private]+)/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=calendar&show=$1&action=week&weekstart=$2&weekend=$3&area=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/'.$config_vars['calendar_year'].'/([0-9]+)/([public|private]+)/([0-9]+)/([^/]*)$ index.php?p=calendar&area=$1&action=displayyear&show=$2&koobi_jahr=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/([0-9]+)/([0-9]+)/([0-9]+)/([public|private]+)/([^/]*)$ index.php?p=calendar&koobi_monat=$1&koobi_jahr=$2&area=$3&show=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=calendar&koobi_monat=$1&koobi_jahr=$2&area=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/'.$config_vars['calendar_newevent'].'/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=calendar&area=$1&action=newevent&koobi_monat=$2&koobi_jahr=$3&area=$4&show=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/'.$config_vars['calendar_myevents'].'/([0-9]+)/([^/]*)$ index.php?p=calendar&area=$1&action=myevents';
				$rewrite[] = 'RewriteRule ^'.$config_vars['calendar'].'/([0-9]+)/([^/]*)$ index.php?p=calendar&area=$1';
				
				
				$rewrite[] = '#--------------------- SHOP ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['shop_topseller_products'].'/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7&topseller=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['shop_lowamount_products'].'/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7&lowamount=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['shop_offer_products'].'/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7&offers=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['shop_topseller_products'].'/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7&list=$8&topseller=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['shop_lowamount_products'].'/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7&list=$8&lowamount=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['shop_offer_products'].'/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7&list=$8&offers=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7&list=$8';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/'.$config_vars['search'].'/([^/]+)/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_.A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?shop_q=$1&man=$2&p=shop&action=showproducts&cid=$3&page=$4&limit=$5&pf=$6&pt=$7';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_lowamount_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&lowamount=1&cid=$2&list=$3&limit=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_offer_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&offers=1&cid=$2&list=$3&limit=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1&cid=$2&list=$3&limit=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&cid=$1&page=$2&limit=$3&t=$4&list=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&cid=$1&page=$2&limit=$3&t=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_product'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproduct&id=$1&cid=$2&pname=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/start/([^/]*)$ index.php?p=shop&start=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['shippingcost'].'/([^/]*)$ index.php?p=shop&action=shippingcost';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['showbasket'].'/([^/]*)$ index.php?p=shop&action=showbasket';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['mylist'].'/del/([0-9]+)/([^/]*)$ index.php?p=shop&action=mylist&subaction=del_list&id=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['mylist'].'/([0-9]+)/([^/]*)$ index.php?p=shop&action=mylist&subaction=load_list&id=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['mylist'].'/([^/]*)$ index.php?p=shop&action=mylist';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['mydownloads'].'/([^/]*)$ index.php?p=shop&action=mydownloads';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['myorders'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=shop&action=myorders&show=$1&page=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['myorders'].'/-/([0-9]+)/([^/]*)$ index.php?p=shop&action=myorders&page=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['myorders'].'/([^/]*)$ index.php?p=shop&action=myorders';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['shoporder'].'/([^/]*)$ index.php?p=shop&action=shoporder&step=2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['shoporder'].'/'. $config_vars['step'].'/([0-9]+)/([^/]*)$ index.php?p=shop&action=shoporder&subaction=step$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['search'].'/([0-9]+)/([^/]*)$ index.php?p=shop&s=1&action=showproducts&limit=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['search'].'/([^/]*)$ index.php?p=shop&s=1&action=showproducts';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['myorders'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=myorders&show=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['shoporder'].'/([^/]*)$ index.php?p=shop&action=shoporder&step=2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['shop_download'].'/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=shop&action=mydownloads&sub=showfile&Id=$1&FileId=$2&getId=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_new_products'].'/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&cid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_offer_products'].'/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&offers=1&cid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1&cid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_lowamount_products'].'/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&lowamount=1&cid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_new_products'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&cid=$2&limit=$3&list=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_new_products'].'/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&cid=$2&limit=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_offer_products'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&offers=1&cid=$2&limit=$3&list=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_offer_products'].'/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&offers=1&cid=$2&limit=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1&cid=$2&limit=$3&list=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1&cid=$2&limit=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_lowamount_products'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&lowamount=1&cid=$2&limit=$3&list=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_lowamount_products'].'/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&lowamount=1&cid=$2&limit=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1&limit=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_new_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&cid=$2&list=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_offer_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&offers=1&cid=$2&list=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1&cid=$2&list=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/([0-9]+)/'.$config_vars['shop_lowamount_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&lowamount=1&cid=$2&list=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'.$config_vars['shop_products'].'/([0-9]+)/'.$config_vars['shop_topseller_products'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=shop&action=showproducts&page=$1&topseller=1&list=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop_manufacturer_first'].'/'. $config_vars['shop_manufacturer'] . '/([0-9]+)/([^/]*)$ index.php?p=shop&action=showproducts&man=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['showseenproducts'] . '/([0-9]+)/([^/]*)$ index.php?p=shop&area=$1&action=showseenproducts';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['shop_dataprotection'] . '/([^/]*)$ index.php?p=shop&action=dataprotect';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/'. $config_vars['shop_agb'] . '/([^/]*)$ index.php?p=shop&action=agb';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/([0-9]+)/([^/]*)$ index.php?p=shop&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['shop'].'/([^/]*)$ index.php?p=shop';
				
				$rewrite[] = '#--------------------- Galerie ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/' .$config_vars['gallerydiashow'].'/([0-9]+)/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showimage&id=$1&galid=$2&blanc=1&first_id=$3&ascdesc=$4&categ=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/' . $config_vars['galleryimage']. '/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showimage&id=$1&galid=$2&ascdesc=$3&categ=$4&area=$5&page=$6';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/' . $config_vars['galleryimage']. '/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showimage&id=$1&galid=$2&ascdesc=$3&categ=$4&area=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&q=$1&searchtype=$2&ascdesc=$3&page=$4&area=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/' . $config_vars['galleryimages']. '/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/' . $config_vars['galleryfavs'] . '/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showgallery&id=$1&categ=$2&name=$3&ascdesc=$4&pp=$5&page=$6&favorites=1&area=$7';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/' . $config_vars['galleryimages']. '/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showgallery&id=$1&categ=$2&name=$3&ascdesc=$4&pp=$5&page=$6&area=$7';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/' . $config_vars['galleryimages']. '/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/' . $config_vars['galleryfavs'] . '/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showgallery&id=$1&categ=$2&name=$3&favorites=1&area=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/' . $config_vars['galleryimages']. '/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showgallery&id=$1&categ=$2&name=$3&area=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showincluded&categ=$1&name=$2&q=$3&searchtype=$4&page=$5&sort=$6&area=$7';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=gallery&action=showincluded&categ=$1&name=$2&area=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['gallery'].'/([0-9]+)/([^/]*)$ index.php?p=gallery&area=$1';
				
				$rewrite[] = '#--------------------- Umfrage  ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['poll'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=poll&id=$1&name=$2&page=$3&area=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['poll'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=poll&id=$1&name=$2&area=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pollarchive'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=poll&action=archive&page=$1&area=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['pollarchive'].'/([0-9]+)/([^/]*)$ index.php?p=poll&action=archive&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['poll'].'/([0-9]+)/([^/]*)$ index.php?p=poll&area=$1';
				
				$rewrite[] = '#--------------------- NEWS ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['news'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=news&area=$1&newsid=$2&name=$3&artpage=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['news'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=news&newsid=$1&name=$2&page=$3&area=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['news'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=news&area=$1&newsid=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newsarchive'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=newsarchive&area=$1&catid=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newsarchive'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=newsarchive&area=$1&catid=$2';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newsrss'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?area=$1&p=newsarchive&catid=$2&t=1&mode=rss';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newsrss'].'/([0-9]+)/([^/]*)$ index.php?p=newsarchive&area=$1&mode=rss';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newsarchive'].'/([0-9]+)/([^/]*)$ index.php?p=newsarchive&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newsletter'].'/([0-9]+)/([^/]*)$ index.php?p=newsletter&area=$1';
			
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles_archive'].'/([0-9]+)/([0-9]+)/([0-9]+)/([^/]+)/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1&catid=$2&page=$3&q_news=$4&limit=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles_archive'].'/([0-9]+)/([0-9]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1&catid=$2&page=$3&limit=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles_archive'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=articles&area=$1&catid=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1&action=displayarticle&id=$2&name=$3&artpage=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=articles&area=$1&action=displayarticle&id=$2&name=$3';
				
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles'].'/'.$config_vars['articles_previews'].'/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1&type=previews';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles'].'/'.$config_vars['articles_reviews'].'/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1&type=reviews';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles'].'/'.$config_vars['articles_specials'].'/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1&type=specials';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles_rss'].'/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1&mode=rss';
				$rewrite[] = 'RewriteRule ^'.$config_vars['articles'].'/([0-9]+)/([^/]*)$ index.php?p=articles&area=$1';
				
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=links&action=showdetails&categ=$1&id=$2&name=$3&page=$4&area=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/([0-9]+)/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=links&action=showdetails&area=$1&categ=$2&id=$3&name&name=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=links&area=$1&categ=$2&name=$3&page=$4&sort=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=links&area=$1&categ=$2&name=$3&page=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=links&area=$1&categ=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/'.$config_vars['links_search'].'/([^/]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?ql=$1&action=search&p=links&area=$2&page=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/'.$config_vars['links_search'].'/([0-9]+)/([^/]*)$ index.php?p=links&action=search&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['links'].'/([0-9]+)/([^/]*)$ index.php?p=links&area=$1';
				
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=downloads&action=showdetails&categ=$1&id=$2&name=$3&page=$4&area=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/([0-9]+)/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=downloads&action=showdetails&area=$1&categ=$2&id=$3&name&name=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=downloads&area=$1&categ=$2&name=$3&page=$4&sort=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=downloads&area=$1&categ=$2&name=$3&page=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=downloads&area=$1&categ=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/'.$config_vars['downloads_search'].'/([^/]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?ql=$1&action=search&p=downloads&area=$2&page=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/'.$config_vars['downloads_search'].'/([0-9]+)/([^/]*)$ index.php?p=downloads&action=search&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads'].'/([0-9]+)/([^/]*)$ index.php?p=downloads&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['downloads_getfile'].'/([0-9]+)/([^/]*)$ index.php?p=downloads&action=getfile&id=$1';
				
				$rewrite[] = '#--------------------- CHEATS ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats'].'/([0-9]+)/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=cheats&action=showcheat&area=$1&plattform=$2&id=$3&name=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['page'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=cheats&area=$1&plattform=$2&name=$3&page=$4&sort=$5';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats'].'/'.$config_vars['cheats_search'].'/([^/]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?ql=$1&action=search&p=cheats&area=$2&page=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=cheats&area=$1&plattform=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats'].'/'.$config_vars['cheats_search'].'/([0-9]+)/([^/]*)$ index.php?p=cheats&action=search&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats'].'/([0-9]+)/([^/]*)$ index.php?p=cheats&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats_getfile'].'/([0-9]+)/([^/]*)$ index.php?p=cheats&action=getfile&id=$1';
				
				$rewrite[] = '#--------------------- PRODUKTE ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['products'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/'.$config_vars['page'].'/([0-9]+)/([^/]*)$ index.php?p=products&area=$1&action=showproduct&id=$2&name=$3&artpage=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['products'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=products&area=$1&action=showproduct&id=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['products'].'/'.$config_vars['page'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=products&area=$1&page=$2&sort=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['products'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]+)/([^/]*)$ index.php?p=products&area=$1&page=$2&sort=$3&q=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['products'].'/([0-9]+)/([^/]*)$ index.php?p=products&area=$1';
				
				$rewrite[] = '#--------------------- HERSTELLER ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['manufacturer'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=manufacturer&area=$1&action=showdetails&id=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['manufacturer'].'/'.$config_vars['page'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=manufacturer&area=$1&page=$2&sort=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['manufacturer'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]+)/([^/]*)$ index.php?p=manufacturer&area=$1&page=$2&sort=$3&q=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['manufacturer'].'/([0-9]+)/([^/]*)$ index.php?p=manufacturer&area=$1';
				
				$rewrite[] = '#--------------------- GAESTEBUCH ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['guestbook'].'/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=guestbook&page=$2&area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['guestbook'].'/([0-9]+)/([^/]*)$ index.php?p=guestbook&area=$1';
				
				$rewrite[] = 'RewriteRule ^'.$config_vars['sitemap'].'/([0-9]+)/([^/]*)$ index.php?p=sitemap&area=$1';
				
				$rewrite[] = '#--------------------- FAQ ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['faq'].'/([0-9]+)/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([^/]*)$ index.php?p=faq&faq_id=$1&area=$2&name=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['faq'].'/([0-9]+)/([^/]*)$ index.php?p=faq&area=$1';
				
				$rewrite[] = '#--------------------- CONTENT ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['content'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/' . $config_vars['page'] . '/([0-9]+)/([^/]*)$ index.php?p=content&id=$1&name=$2&page=$4&area=$3';
				$rewrite[] = 'RewriteRule ^'.$config_vars['content'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([0-9]+)/([^/]*)$ index.php?p=content&id=$1&name=$2&area=$3&artpage=$4';
				$rewrite[] = 'RewriteRule ^'.$config_vars['content'].'/([0-9]+)/([-_A-Za-zÀ-ÖØ-öø-ÿ0-9-]+)/([0-9]+)/([^/]*)$ index.php?p=content&id=$1&name=$2&area=$3';
				
				$rewrite[] = '#--------------------- SONSTIGES (AUSEINANDERFUDDELN!) ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['products'].'/([^/]*)$ index.php?p=products';
				$rewrite[] = 'RewriteRule ^'.$config_vars['cheats'].'/([^/]*)$ index.php?p=cheats';
				$rewrite[] = 'RewriteRule ^'.$config_vars['guestbook'].'/([^/]*)$ index.php?p=guestbook';
				$rewrite[] = 'RewriteRule ^'.$config_vars['userlist'].'/([^/]*)$ index.php?p=userlist';
				$rewrite[] = 'RewriteRule ^'.$config_vars['newsarchive'].'/([^/]*)$ index.php?p=newsarchive';
				$rewrite[] = 'RewriteRule ^'.$config_vars['manufacturer'].'/([^/]*)$ index.php?p=manufacturer';
				$rewrite[] = 'RewriteRule ^'.$config_vars['currency'].'/([0-9]+)/(.*)([^/]*)$ index.php?p=shop&currency=$1&redirect=$2';
				
				$rewrite[] = '#--------------------- STARTSEITE ---------------------#';
				$rewrite[] = 'RewriteRule ^'.$config_vars['startindex'].'/([0-9]+)/rss.xml([^/]*)$ index.php?area=$1&mode=rss';
				$rewrite[] = 'RewriteRule ^'.$config_vars['startindex'].'/([0-9]+)/([^/]*)$ index.php?area=$1';
				$rewrite[] = 'RewriteRule ^'.$config_vars['imprint'].'/([^/]*)$ index.php?p=imprint';
				$rewrite[] = 'RewriteRule ^.+/'.$config_vars['printversion'].'/$ %{HTTP_REFERER}&print=1 [R=302]';
				
				
				$rewrite[] = '# Spambots nach User_agent aussperren';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^.*Whacker.*$ [OR] ';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^EmailCollector [OR]';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR] ';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR] ';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^.*FileHound.*$ [OR]';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^.*TurnitinBot.*$ [OR]';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^.*JoBo.*$ [OR]';
				$rewrite[] = 'RewriteCond %{HTTP_USER_AGENT} ^.*adressendeutschland.*$';
				$rewrite[] = 'RewriteRule ^.* - [F]';
				unset($config_vars);
			}
			
		}
		
		// AUSGABE STARTEN...
		$rs = str_replace('index.php','',$_SERVER['PHP_SELF']);
		$Ausgabe = "<IfModule mod_rewrite.c>\n";
		$Ausgabe .= "RewriteEngine on  \n\n";		
		$Ausgabe .= "RewriteBase ".$rs." \n";
		$Ausgabe .= "AddType application/x-httpd-php html \n\n";
		$Ausgabe .= "ErrorDocument 404 {$rs}index.php?p=notfound\n\n";
		foreach($rewrite as $r )
		{		
			$Ausgabe .= $r."\n";
		} 
		$Ausgabe .= "\n</IfModule>";
		$fp = @fopen(BASE_DIR. "/.htaccess", "wb+");
		@fwrite($fp, $Ausgabe);
		@fclose($fp);
		
		$GLOBALS['db']->Query("UPDATE " . PREFIX . "_einstellungen SET Seo_Sprachen = '" . implode(";", $sql_data) . "' WHERE Id = '1'");
		
		return true;
		
	}

}

?>