<?php
/***************************************************************************\
| index.php
|
| (c) Walter Scheelen - www.muzikum.eu
\***************************************************************************/

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

$pc = request_var('pc', PG_HOME);
$ids = request_var('ids', '');
$id3 = utf8_normalize_nfc(request_var('id3', ''));

//ids = "99-99". Only first 2 numbers are allowed (if more are given, they are ignored)
$id1 = $id2 = '';
$ids = explode('-', $ids);
$c = count($ids);
if ($c == 2){
	$id1 = (int) $ids[1];
}
elseif ($c > 2){
	$id1 = (int) $ids[1];
	$id2 = (int) $ids[2];
}

//in case the NoIndex parameter is added robots may not index this page.
$show_robots = (isset($_GET['ni'])) ? true : false;

//set other parameters
$page_title = 'Muzikum';
$display_online_list = true;
$item_id = 0;
$item = 'forum';
$muz_page_header_args = array(
		'is_phpbb_page'				=> false,
		'show_robots'				=> $show_robots,
		'show_login_form'			=> false,
		'show_ads'					=> true,
		);

switch ($pc){
	case PG_ABOUT_US: case PG_DISCLAIMER: case PG_PRIVACY: 
		$page = 'generic.php';
		break;
		
	case PG_ARTISTS:
		$search_view = 'abclist';
		$search_text = $id3;
		$search_table = ARTISTS;
		$l_list_field = 'ARTISTS';
		$page = 'muz_search.php';
		break;
	
	case PG_ARTIST_ADD:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'add';
		$page = 'artist_actions.php';
		break;	
		
	case PG_ARTIST_EDIT:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$mode = 'edit';
		$page = 'artist_actions.php';
		break;	
		
	case PG_ARTIST_DEL:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$mode = 'delete';
		$page = 'artist_actions.php';
		break;	
		
	case PG_ARTIST_BIO:
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$page = 'artist_general.php';
		break;	
	
	case PG_ARTIST_CD:
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$cd_id = (!empty($id2)) ? $id2 : 0;
		$page = 'artist_cd.php';
		break;	
	
	case PG_ARTIST_DISCO:
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$page = 'artist_disco.php';
		break;	
	
	case PG_ARTIST_EVENTS:
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$page = 'artist_events.php';
		break;	
	
	case PG_ARTIST_LYRICS: 
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$page = 'artist_lyrics.php';
		break;	
	
	case PG_ARTIST_LYRIC: case PG_ARTIST_LYRIC_TRANSLATION:
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$lyric_id = (!empty($id1)) ? $id2 : 0;
		$page = 'artist_lyric.php';
		break;	
	
	case PG_ARTIST_LYRIC_PRINT:
		$artist_id = (!empty($id1)) ? $id1 : 0;
		$lyric_id = (!empty($id1)) ? $id2 : 0;
		$page = 'artist_lyric_print.php';
		$display_online_list = false;
		break;	

	case PG_CDS:
		$search_view = 'abclist';
		$search_text = $id3;
		$search_table = CDS;
		$l_list_field = 'CDS';
		$page = 'muz_search.php';
		break; 
		
	case PG_CD_ADD:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'add';
		$page = 'cd_actions.php';
		break;	
		
	case PG_CD_EDIT:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$cd_id = (!empty($id2)) ? $id2 : 0;
		$mode = 'edit';
		$page = 'cd_actions.php';
		break;	
		
	case PG_CD_DEL:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$cd_id = (!empty($id2)) ? $id2 : 0;
		$mode = 'delete';
		$page = 'cd_actions.php';
		break;	
		
	case PG_CONTACT:
		$page= 'contact.php';
		break;
	
	case PG_EVENTS:
		$page = 'events.php';
		break;
	
	case PG_EVENT_ADD:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'add';
		$page = 'event_actions.php';
		break;
		
	case PG_EVENT_IMPORT:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'import';
		$page = 'event_actions.php';
		break;
	
	case PG_FAQ:
		$page = 'faq.php';
		break;
		
	case PG_FORUM:
		$page = 'forum_index.php';
		break;
		
	case PG_FORUM_POSTING:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$page = 'forum_posting.php';
		break;
		
	case PG_ITUNES:
		$page = 'itunes.php';
		break;
		
	case PG_LIST_ARTISTS:
		$page = 'list_landing.php';
		break;
		
	case PG_LIST_CDS:
		$page = 'list_landing.php';
		break;
		
	case PG_LIST_LYRICS:
		$page = 'list_landing.php';
		break;
		
	case PG_LOCATIONS:
		$search_view = 'abclist';
		$search_text = $id3;
		$search_table = LOCATIONS;
		$l_list_field = 'LOCATIONS';
		$page = 'muz_search.php';
		break;
	
	case PG_LOCATION_VIEW:
		$location_id = (!empty($id1)) ? $id1 : 0;
		$page = 'location_view.php';
		break;
		
	case PG_LOCATION_ADD:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'add';
		$page = 'location_actions.php';
		break;
		
	case PG_LOCATION_EDIT:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$location_id = (!empty($id1)) ? $id1 : 0;
		$mode = 'edit';
		$page = 'location_actions.php';
		break;
	
	case PG_LOCATION_DEL:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$location_id = (!empty($id1)) ? $id1 : 0;
		$mode = 'delete';
		$page = 'location_actions.php';
		break;	
	
	case PG_LYRICS:
		$search_view = 'abclist';
		$search_text = $id3;
		$search_table = LYRICS;
		$l_list_field = 'LYRICS';
		$page = 'muz_search.php';
		break;
		
	case PG_LYRIC_ADD:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'add';
		$page = 'lyric_actions.php';
		break;	
		
	case PG_LYRIC_EDIT:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$lyric_id = (!empty($id2)) ? $id2 : 0;
		$mode = 'edit';
		$page = 'lyric_actions.php';
		break;	
		
	case PG_LYRIC_DEL:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$lyric_id = (!empty($id2)) ? $id2 : 0;
		$mode = 'delete';
		$page = 'lyric_actions.php';
		break;	
		
	case PG_LYRIC_TRANSLATE:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$translated_lyric_id = (!empty($id2)) ? $id2 : 0;
		$mode = 'add';
		$page = 'lyric_translate_actions.php';
		break;	
		
	case PG_LYRIC_TRANSLATION_EDIT:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$lyric_id = (!empty($id2)) ? $id2 : 0;
		$mode = 'edit';
		$page = 'lyric_translate_actions.php';
		break;	
		
	case PG_LYRIC_TRANSLATION_DEL:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$lyric_id = (!empty($id2)) ? $id2 : 0;
		$mode = 'delete';
		$page = 'lyric_translate_actions.php';
		break;	
		
	case PG_LYRIC_NO_LANGDETECT:
		$page = 'lyric_list_not_langdetected.php';
		break;	
		
	case PG_MAILS:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = '';
		$page = 'mail_actions.php';
		break;
		
	case PG_MAIL_DEL:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'delete';
		$page = 'mail_actions.php';
		break;
		
	case PG_MAIL_PROCESS:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'process';
		$page = 'mail_actions.php';
		break;
		
	case PG_MAIL_VIEW:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'view';
		$mail_id = (!empty($id1)) ? $id1 : 0;
		$page = 'mail_actions.php';
		break;
		
	case PG_MAIL_WRITE:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$mode = 'write';
		$page = 'mail_actions.php';
		break;
		
	case PG_RINGTONES:
		$search_view = 'abclist';
		$search_text = $id3;
		$search_table = RINGTONES;
		$l_list_field = 'RINGTONES';
		$page = 'muz_search.php';
		break;
	
	case PG_SEARCH: case PG_RINGTONES_SEARCH: 
		//get post/get vars
		$search_view = 'search';
		$search_text = request_var('q', '', true);
		$search_table = request_var('st', ARTISTS);
		$l_list_field = '';
		$page = 'muz_search.php';
		break;
	
	case PG_STATS:
		$page = 'statistics.php';
		break;
		
	case PG_TRANSLATE:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$page = 'translate.php';
		break;
		
	case PG_NEWSLETTER_WRITE:
		$muz_page_header_args['show_robots'] = true;
		$muz_page_header_args['show_ads'] = false;
		$page = 'newsletter.php';
		break;
		
	default:
		$muz_page_header_args['show_login_form'] = true;
		$muz_page_header_args['show_ads'] = false;
		$page = 'home.php';
}

include($page);
?>