<?php
//$_SESSION['urlbase'] = 'http://localhost:8090/Uploadmanager';
//$_SESSION['prefix'] = 'nos';

/*
$s_prefix = 'nos';
$s_title='Radio Nostalgia';
$_SESSION['urlbase'] = 'upload';
*/

$s_prefix = 'wa';
$s_title='LOLLI RADIO';
$_SESSION['urlbase'] = '../Public'; //'upload';

if (!isset($s_lan)) {
	if (isset($_SESSION['language'])) {
		if(file_exists ("include/language/".$_SESSION['language'].".txt")) {
			$s_lan	= parse_ini_file("include/language/".$_SESSION['language'].".txt",TRUE);
		} else if(file_exists ("../include/language/".$_SESSION['language'].".txt")) {
			$s_lan	= parse_ini_file("../include/language/".$_SESSION['language'].".txt",TRUE);
		}
	} else {
		if(file_exists ("include/language/english.txt")) {
			$s_lan	= parse_ini_file("include/language/english.txt",TRUE);
		} else if(file_exists ("../include/language/english.txt")) {
			$s_lan	= parse_ini_file("../include/language/english.txt",TRUE);
		}
	}
}

if (!isset($s_folder)) {
	if (isset($_SESSION['folder'])) { $s_folder = $_SESSION['folder']; $pathpublic='../../public/'.$s_folder.'/';}
	else { $s_folder = ''; $pathpublic='../../public/';}
}

if (!isset($s_prefix)) {
	if (isset($_SESSION['prefix'])) $s_prefix = $_SESSION['prefix'];
	else $s_prefix = '';
}

if (!isset($s_multiuser)) {
	if (isset($_SESSION['multiuser'])) $s_multiuser = $_SESSION['multiuser'];
	else $s_multiuser = 0;
}

if (!isset($s_logo)) {
	if (isset($_SESSION['logo'])) $s_logo = $_SESSION['logo'];
	else $s_logo = '';
}

if (!isset($s_idaccount)) {
	if (isset($_SESSION['idaccount'])) $s_idaccount = $_SESSION['idaccount'];
	else $s_idaccount = 0;
}

if (!isset($s_iduser)) {
	if (isset($_SESSION['iduser'])) $s_iduser = $_SESSION['iduser'];
	else $s_iduser = 0;
}

if (!isset($s_nome)) {
	if (isset($_SESSION['name'])) $s_nome = $_SESSION['name'];
	else $s_nome = '';
}

if (!isset($s_livelliuser)) {
	if (isset($_SESSION['userlevel'])) $s_livelliuser = $_SESSION['userlevel'];
	else $s_livelliuser = 0;
}

if (!isset($s_idradio)) {
	if (isset($_SESSION['idradio'])) $s_idradio = $_SESSION['idradio'];
	else $s_idradio = '';
}

if (!isset($s_width)) {
	if (isset($_SESSION['tb_width']) && $_SESSION['tb_width']!=0) $s_width = $_SESSION['tb_width'];
	else $s_width = '"100%"';
}

if (!isset($s_height)) {
	if (isset($_SESSION['tb_height']) && $_SESSION['tb_height']!=0) $s_height = $_SESSION['tb_height'];
	else $s_height = '"100%"';
}

if (!isset($s_genmsg)) {
	if (isset($_SESSION['genmsg']) && $_SESSION['genmsg']!=0) $s_genmsg = $_SESSION['genmsg'];
	else $s_genmsg = 0;
}

if (!isset($s_webapp)) {
	if (isset($_SESSION['webapp']) && $_SESSION['webapp']!=0) $s_webapp = $_SESSION['webapp'];
	else $s_webapp = '';
}

$s_field=array();
for($i=1;$i<9;$i++) {
	if (isset($_SESSION['field'.$i]) && $_SESSION['field'.$i]!='') $s_field[$i] = $_SESSION['field'.$i];
	else $s_field[$i]='';
}

if (!isset($s_group)) {
	if (isset($_SESSION['group'])) $s_group = explode(",", $_SESSION['group']);
	else $s_group 	= array();
}

if (!isset($s_customer)) {
	if (isset($_SESSION['customer'])) $s_customer = explode(",", $_SESSION['customer']);
	else $s_customer 	= array();
}

if (!isset($s_area)) {
	if (isset($_SESSION['area'])) $s_area = explode(",", $_SESSION['area']);
	else $s_area 	= array();
}

if (!isset($s_machine)) {
	if (isset($_SESSION['machine'])) $s_machine = explode(",", $_SESSION['machine']);
	else $s_machine 	= array();
}

if (!isset($s_channel)) {
	if (isset($_SESSION['channel'])) $s_channel = explode(",", $_SESSION['channel']);
	else $s_channel 	= array();
}

if (!isset($s_defch)) {
	if (isset($_SESSION['defch'])) $s_defch = $_SESSION['defch'];
	else $s_defch 	= 1;
}

if (!isset($s_logogroup)) {
	/*
	if(count($s_group)==1) {	
		$values = mysqli_query("SELECT imglogo FROM anag_group WHERE id=".$s_group[0]);
		if($row = mysqli_fetch_array($values, MYSQLI_ASSOC)) {
			$s_logogroup=$row['imglogo'];
		}
	} else $s_logogroup='';
	*/
	$s_logogroup='';
}

if (!isset($s_logochannel)) {
	/*
	if(count($s_channel)==1) {
		$values = mysqli_query("SELECT imglogo FROM anag_channel WHERE id=".$s_channel[0]);
		//$values = mysqli_query("SELECT imglogo FROM anag_channel WHERE id=1") or die('Query failed: ' . mysqli_error($link));
		if($row = mysqli_fetch_array($values, MYSQLI_ASSOC)) {
			$s_logochannel=$row['imglogo'];
		}
	} else $s_logochannel='';
	*/
	$s_logochannel='';
}

if (!isset($sel_group)) {
	if (isset($_SESSION['sel_group'])) $sel_group = $_SESSION['sel_group'];
	else $sel_group 	= 0;
}

if (!isset($sel_customer)) {
	if (isset($_SESSION['sel_customer'])) $sel_customer = $_SESSION['sel_customer'];
	else $sel_customer 	= 0;
}

if (!isset($sel_area)) {
	if (isset($_SESSION['sel_area'])) $sel_area = $_SESSION['sel_area'];
	else $sel_area 	= 0;
}

if (!isset($sel_machine)) {
	if (isset($_SESSION['sel_machine'])) $sel_machine = $_SESSION['sel_machine'];
	else $sel_machine 	= 0;
}

if (!isset($sel_channel)) {
	if (isset($_SESSION['sel_channel'])) $sel_channel = $_SESSION['sel_channel'];
	else $sel_channel 	= 1;
}
?>