Location: PHPKode > projects > kPlaylist > kplaylist.1.8.508/kplaylist.1.8.508.php
<?php
//kPlaylist 1.8 Build 508 (19-02-11_16.26)

/*****************************************************************************
kPlaylist 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; either version 2 of the License, or
(at your option) any later version.

kPlaylist 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 kPlaylist; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
##############################################################################

kPlaylist makes your music archive available via the WEB. Play music, 
	search, create and edit playlists from everywhere by just having a webbrowser 
	and a audio player. Features include logon, accounts, account classes, user editor, 
	automatic installation (MySQL) and automatic search engine update. 

Are you a PHP programmer? 
	Would you like to join us in the creation of this product? Before you start 
	changing the code please send a mail to us and tell us that you want to help us. 
	We'll send you some information on how you can  send us upgrade information and 
	how to get the latest up2date source. We got a development source available.

Translate or errors in the grammar?
	Please submit new languages, or grammar fixes directly to us for immediate
	new builds. Se http://www.kplaylist.net/addlang/ for more information.

	Our website helps you to create new languages. Please look there if your
	language is missing.

Note!
	You can get updates and installation instructions here: http://www.kplaylist.net
  
	Need answers? Goto the kPlaylist forum: http://www.kplaylist.net/forum/
	
	We develop other products than PHP applications, for commercial and non
	commercial use. Contact our company Keyteq AS here: http://www.keyteq.no.

Script information:
	Also note, this is a script under construction and strange things may happen,
	though it hasn't on the machines we tested it on. The system writes by
	default only to a MySQL database, but can also be set up to write
	id3v1 tags (mp3 files.).

	Due to the legal responsibility however, we have to note: There
	are NO GUARANTEES WHATSOEVER other than this application will
	occupy certain amount of space on the device you put it.

*****************************************************************************/

// try to set the execution time to 86400 sec = 1 day. 
@ini_set('max_execution_time', 86400);
@ini_set('register_globals', 'Off');
@ini_set('display_errors', 'Off');

// if you for any reason want to reset the configuration, set this variable to true, reload the page and set it back to false.
$resetconfiguration = false;

$db = array(
	'host' => 'localhost', # MySql server
	'name' => 'kplaylist', # Database name
	'user' => 'kplaylist', # MySql user
	'pass' => 'kplaylist', # MySql password
	'prepend' => 'tbl_'    # To prepend before the table names
);


// what to prepend before the table names, don't change this after installing! Do it before.
$cfg['dbprepend'] = $db['prepend'];

// If you use the Bad Blue webserver, set the following value to 1
$cfg['badblue'] = 0;

// If you want to disable logins and let everybody with http access to your
// site get in, change the two following options. (WARNING! ALL SECURITY NOW VANISH.)
$cfg['disablelogin'] = 0;

// If you disable logins, a default user has to be chosen. Setting this to 1 means
// the first user which is usually the admin.
$cfg['assumeuserid'] = 1;

// enable the getid3 package. getid package must reside under getid3/ under the directory
// this file exists. If it does not, please change the 'include' statement below.
$cfg['enablegetid3'] = 0;

// where the getid3.php file exists
$cfg['getid3include'] = 'getid3/getid3.php';

//how many titles of one album do we need to treat as a album? Turn to zero to show all.
$cfg['titlesperalbum'] = 0;

// for multiple downloads.
$cfg['archivemode'] = false;

$cfg['archivefilelist_cr'] = "\n";

// turn this on to show commands when creating INSTEAD of executing 
$cfg['archivemodedebug'] = false;

// where archivemode stores data. For UNIX it should be /tmp/, For win32 it should be: c:\\tmp\\
$cfg['archivetemp'] = '/tmp/'; 

// Read here before enabling: http://www.kplaylist.net/forum/viewtopic.php?t=196
$cfg['id3editor'] = 0;

// cookie name
$cfg['cookie'] = 'kplaylist';

// list of directories to ignore.
$cfg['dirignorelist'] = array('..' => 1, '.' => 1, 'lost+found' => 1);

// For use of automatic search engine update via lynx / cron. Turn to 1 to enable. Check
// www.kplaylist.net for information how to run this update automatically.
$cfg['autoupdate'] = 0;
$cfg['autoupdatehost'] = '127.0.0.1';
$cfg['autoupdateuser'] = 'autooperate';

// what date format to use. if you want to change, look here: http://php.net/date/ for the format
$cfg['dateformat'] = 'd.m.y H:i';

$cfg['timeformat'] = 'H:i';

// format when listing periods in what's hot
$cfg['dateformatwhatshot'] = 'M Y';

// small format
$cfg['smalldateformat'] = 'd.m.y';

// if the dir count exceeds this count, it will not be considered a 'album' directory and albums will not be shown
$cfg['isalbumdircount'] = 1;

// sort the root? does not affect sorting in subdirs.
$cfg['sortroot'] = true;

// to reopen an uri after logon
$cfg['accepturi'] = true;

// where to cut the front bulletin message
$cfg['frontbulletinchars'] = 120;

// where to break 'last stream' titles
$cfg['laststreambreak'] = 33;

// miniumum hits to show in whats'hot
$cfg['whatshotminimumhits'] = 5;

// lame command (transcode)
$cfg['lamecmd'] = '/usr/local/bin/lame --silent --nores --nohist --mp3input -h -m s -b %bitrate% "%file%" -';

// ogg command  (transcode)
$cfg['oggcmd'] = '/usr/bin/oggdec -Q "%file%" -o - | /usr/bin/oggenc - --quiet --managed -b %bitrate% -o -';

// enable ogg transcoding, look the line above for the command, check this before enabling
$cfg['oggtranscode'] = false;

$lamebitrates = array(0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320);

//	enabled	(0/1)	extension	cmd	(%D = destination file,	%F source OR %LIST if using filelist.)  mime	name
// YOU MUST SUIT THESE ARCHIVERS TO YOUR OWN NEED. DO NOT USE THE DEFAULT BLINDLY.
$archivers = array();

$archivers[] = array(1,	'zip', '/usr/bin/zip -j -0 %D "%F"', 'application/zip', 'zip');
$archivers[] = array(1, 'tar','/bin/tar cf %D --files-from "%LIST"', 'application/x-tar', 'tar');
$archivers[] = array(0,	'rar', 'C:\Programfiler\WinRAR\rar.exe -m0 a %D "%F"', 'application/x-rar', 'rar');

// stream 'engine' finetune settings. 
$streamsettings = 
array(
	'preload'			=> 215,
	'buffer'			=> 105,
	'sleep'				=> 0.999,
	'bitrates'			=> array(32, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 512),
	'defaultrate'		=> 288,
	'precision'			=> 1000,
	'forcedefaultrate'	=> 0
);

// syntax: .filename, mime header, file in M3U, get id function, viewable, log access
$streamtypes_default = array(
	0 => array	('mp3',		'audio/mpeg',				1, 1, 1, 1),
	1 => array	('mp2',		'audio/mpeg',				1, 1, 1, 1),
	2 => array	('ogg',		'application/x-ogg',		1, 2, 1, 1),
	3 => array	('wav',		'audio/wave',				1, 0, 1, 1),
	4 => array	('wma',		'audio/x-ms-wma',			1, 0, 1, 1),
	5 => array	('mpg',		'video/mpeg',				1, 0, 1, 1),
	6 => array	('mpeg',	'video/mpeg',				1, 0, 1, 1),
	7 => array	('avi',		'video/avi',				0, 0, 1, 1),
	8 => array	('wmv',		'video/x-ms-wmv',			1, 0, 1, 1),
	9 => array	('asf',		'application/vnd.ms-asf',	0, 0, 1, 1),
	10 => array	('m3u',		'audio/x-mpegurl',			0, 0, 0, 0),
	11 => array	('flac',	'audio/x-flac',				1, 0, 1, 1),
	12 => array	('jpg' ,	'image/jpeg',				0, 0, 1, 0),
	13 => array	('gif' ,	'image/gif',				0, 0, 1, 0),
	14 => array	('png' ,	'image/png',				0, 0, 1, 0)
);

// filetypes to include or ignore when showing statistics 
// use * for everything, "-" and "+" for ignore and include.  NB! If change, do an (normal) update.
$cfg['stat_count_ftype'] = array('*'); // example for everything except jpg, gif, png: array('*', '-12', '-13', '-14');

// files to look for to detect basedirs
$cfg['detecttypes'] = array('.mp3' => 1, '.mp2' => 1, '.ogg' => 1, '.wma' => 1);

// dirs to ignore when detecting base dirs (find tool)
$cfg['detectignoredirs'] = array('temp', 'tmp', 'temporary internet files', 'documents and settings', 'winnt', 'windows', 'win32', 'win nt');

// when using getid3 and id3 tags - highest most importnant, 0 to disable
$cfg['id3tagspri'] = array('id3v1' => 1, 'id3v2' => 2);

// maximum size in bytes for album images (if and when auto id3v2 tag.)
$cfg['maxtagimagesize'] = 1048576; // set to zero for no limit - default 1 mb.

// if you enabled urlsecurity in settings, you can specify how long a url will be valid (in seconds) (0 for no limit)
$cfg['urlsecurityvalidtime'] = 0;

// order by tracks
$cfg['ordertrack'] = true;

// when resizing jpeg album
$cfg['jpeg-quality'] = 90;

// resize album images the same way via web as with stream?
$cfg['id3v2albumresize'] = true;

// map design to files instead of inbuilt ('' means inbuilt). set one or each to a relevant filename to customize,
// download the template from here: http://www.kplaylist.net/getdesign.php
$cfg['designmap'] = 
array(
		'login' => '', 
		'infobox' => '', 
		'endmp3table' => '', 
		'top' => '', 
		'bottom' => '', 
		'blackbox' => '', 
		'detailedview' => '', 
		'dirheader' => ''
);

// all 

// how many last stream titles to show
$cfg['laststreamscount'] = 6;

// if using pear (mailmp3), where should we include pear mail files? (relevant to php general include path, pear lib should be in this)
$cfg['pearmailpath'] = 'Mail/';

$cfg['striphtmlbulletin'] = true; // strip away tags from bulletin (when storing.)

// many file select boxes in upload
$cfg['uploadselections'] = 3;

// many streams in rss?
$cfg['rsslaststreamcount'] = 25;

// how to group artist/albums from whatsnew. Default: album, artist (before build 420)
$cfg['albumartistgroup'] = array('album', 'artist'); 

// can be switched to false after installing for improved security
$cfg['installerenabled'] = true;

// merge root directories? (to avoid duplicate directory names)
$cfg['mergerootdir'] = false;

// convert filesystem (directories) during display? Needs iconv support.
$cfg['convertcharset'] = false;

// which charset to convert from. for other charsets, please look here: http://no.php.net/manual/en/ref.iconv.php
$cfg['filesystemcharset'] = 'UTF-8'; 

// count of logins (many times one can login concurrently with the same credentials), 0 means indefinite.
 $cfg['numberlogins'] = 0;

// dirlist: sort each row (1) or each column (2)?
$cfg['columnsorttype'] = 2;

// enable httpQ support
$cfg['httpq_support'] = false;

$cfg['httpq_parm'] = array(
		'server'	=> 'localhost',
		'port'		=> 4800,
		'pass'		=> 'test'
);

// ajax update live streams -- requires that Settings->Customize->AJax url is filled out (and correct.)
$cfg['livestreamajax'] = false;

// number of milliseconds to update (interval) (default 5 seconds.)
$cfg['livestreamajaxupdatetime'] = 5000;

// number of milliseconds to update (interval) (default 5 seconds.)
$cfg['shoutboxupdatetime'] = 5000;

// how many messages to show
$cfg['shoutboxmessages'] = 5;


// enable radio functionality? (NEED icecast/ices2++) Read forum.
$cfg['radio'] = false;

// use _ in hotselect for a new line. If UTF-8 characters, make sure your editor supports it!
$cfg['hotselectchars'] = '*0abcdefghijklmnopqrstuvwxyz';

// customized/personal genres, if adding/changing needs an re-update with id3rebuild for changes to take effect.
// example: = array('My genre', 'Another genre', 'My genre 3');
$cfg['custom_genres'] = array();

// enable auto creating genres by name, set to false to disable, getid3 is required.
$cfg['genre_auto_create'] = true;

// allow users their own homedir (set homedir in usereditor)
$cfg['userhomedir'] = false;

// operate in UTF-8 mode? Recommended if you have any users speaking other
// languages than english and if you have music with other titles than english. 
// NB!! Do not switch this to true unless you know what you're doing.
$cfg['utf8mode'] = false;

// if you wish to use URL's such as http://kplaylist/music/04343/File.mp3 instead of the ones
// with streamsid, cookieid, etc. This currently only works with stream urls and it REQUIRES
// that your web server redirects calls.
$cfg['filepathurl'] = false;

// start, but do not end with slash 
$cfg['filepathurlprepend'] = '/music';

// authtype, cookie default, session is the alternative
$cfg['authtype'] = 1; // 1=cookie, 2=session

$cfg['musicmatch'] = true; // inbuilt music match support? Default true (randomizer feature.)

// size of window for "external" player
$cfg['window_x'] = 420;
$cfg['window_y'] = 220;

// edit this to suit your setup
$cfg['xspf_url'] = 'http://mysite/blah/xspf_player.swf';

// enable xspf? Make sure the URL above works.
$cfg['xspf_enable'] = false;

// JW: edit this to suit your setup
$cfg['jw_urls'] = 
array(
	'swf'	=> 'jw/mediaplayer.swf',
	'js'	=> 'jw/swfobject.js'
);

// size of window for "external" player
$cfg['jw_window_x'] = 500;
$cfg['jw_window_y'] = 550;

// enable jw player? Make sure the URLs above works.
$cfg['jw_enable'] = false;

// end of configuration
if (file_exists('kpconfig.php')) include('kpconfig.php');


function geturi()
{
	global $phpenv;
	if (frm_isset('uri')) $uri = frm_get('uri'); else $uri = urlencode($phpenv['uri']);
	return stripslashes(strip_tags($uri));
}

function make_seed() {
    list($usec, $sec) = explode(' ', microtime());
    return (float) $sec + ((float) $usec * 100000);
}

function mkor($arr, $name)
{
	$sql = '';
	if (is_array($arr))
	{
		$sql = $name;
		foreach($arr as $g) $sql .= ' = '.$g.' OR '.$name;
		return substr($sql, 0, strlen($sql) - (strlen($name) + 4));
	}
	return $sql;
}

function access_denied()
{
	echo 'Access denied.';
	die();
}

function refreshurl($url)
{
	?>
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html>
		<head>
			<title></title>
			<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
			<meta http-equiv="Refresh" content="0; url=<?php echo $url; ?>"/>
		</head>
		<body></body>
	</html>
	<?php
}

function syslog_write($msg)
{
	global $phpenv, $win32;
	$msg = 'Client '.$phpenv['remote'].' '.$phpenv['useragent'].' '.$msg;
	if (!$win32)
	{
		define_syslog_variables();
		openlog('kplaylist', LOG_PID | LOG_PERROR, LOG_LOCAL0);
		syslog(LOG_INFO,$msg);
		closelog();
	} else user_error($msg);
}

function selected($val, $ret = 'selected="selected"', $uret = '')
{
	if ($val) return $ret;
	return $uret;
}

function checked($val, $ret = 'checked="checked"', $uret = '')
{
	if ($val) return $ret;
	return $uret;
}

function genselect($name, $options, $default=0, $disabled = false, $class='fatbuttom', $width=0, $id='')
{
	$out = '<select name="'.$name.'" class="'.$class.'"';
	if (strlen($id) > 0) $out .= ' id="'.$id.'"';
	if ($width > 0) $out .= ' style="width:'.$width.'px"';
	if ($disabled) $out .= ' disabled="disabled"';
	$out .= '>';
	for ($i=0,$c=count($options);$i<$c;$i++)
	{
		$out .= '<option value="'.$options[$i][0].'"';
		if ($options[$i][0] == $default) $out .= ' selected="selected"';
		$out .= '>'.$options[$i][1].'</option>';
	}
	$out .= '</select>';
	return $out;
}

function selectoptions($arr, $default)
{
	// input is single dimensioal array
	$out = '';
	foreach($arr as $id => $val)
	{
		$out .= '<option value="'.$id.'"';
		if ($id == $default) $out .= ' selected="selected"';
		$out .= '>'.$val.'</option>';
	}
	return $out;
}

function getrand($from = 1, $to = 0)
{
	$randmax = getrandmax();
	srand((double)microtime()*1000000);
	if ($to > 0 && $to < $randmax) return rand($from,$to);
	return rand($from,$randmax);
}

function lzero($in, $len=2)
{
	if (strlen($in) >= $len) return $in; 
		else
	return (substr('00000000',0,$len - strlen($in)).$in);
}

function slashtranslate($in,$key='\\', $rep='/')
{
	$out = $in;
	if (strlen($in) > 0)
	{
		$out = str_replace($key, $rep, $in);
		if ($out[strlen($out)-1] != '/') $out .= '/';	
	}
	return stripslashes($out);
}

function noslash($in)
{
	if (strlen($in) > 1)
		if ($in[strlen($in)-1] == '/') return substr($in, 0, strlen($in) - 1);
	return $in;
}

function relativedir($dir)
{
	$relative = '';

	if (isset($_SERVER['DOCUMENT_ROOT']))
	{
		$docroot = $_SERVER['DOCUMENT_ROOT'];
		
		if (strlen($dir) >= strlen($docroot))
		{
			if (substr($dir, 0, strlen($docroot)) == $docroot) 
			{
				$relative = substr($dir, strlen($docroot));				
			}
		}
	}

	return $relative;

}

function slashend($in)
{
	$out = $in;
	$lastchar = '';
	if (strlen($out) > 0) $lastchar = $out[strlen($out)-1]; 	
	if ($lastchar != '/') $out .= '/';	
	return $out;
}

function slashstart($in)
{
	$first = '';
	if (strlen($in) > 0) $first = $in[0];
	if ($first != '/') return '/'.$in;
	return $in;
}

function checkcharadd(&$string, $chars, $add)
{
	if (kp_strlen($string) > 0)
	{
		$test = kp_substr($string, kp_strlen($string) - kp_strlen($chars));
		if ($test == $chars) $string .= $add; else $string .= $chars.$add;
	} else $string = $add;
}

function getimagelink($image)
{
	global $setctl, $kpt;
	
	if ($link = $kpt->getfile($image))
	{
		if (strlen($link) > 0) return $link;
	}
	
	if (!empty($setctl->keys['externimagespath'])) return $setctl->get('externimagespath').$image; else return PHPSELF.'?image='.$image;
}

function gethtml($page)
{
	global $kdesign, $cfg, $kpt;

	if (isset($cfg['designmap'][$page])) $f = $cfg['designmap'][$page]; else $f = '';

	if ($link = $kpt->getlocalfile($page.'.kpp'))
	{
		if (strlen($link) > 0 && file_exists($link)) $f = $link; 
	}

	if (strlen($f) > 0)
	{
		$fp = fopen($f, 'rb');
		if ($fp)
		{
			$data = fread($fp, filesize($f));
			fclose($fp);
			return $data;
		}
	}
	if (isset($kdesign[$page])) return $kdesign[$page];
}

function addsq()
{
	return "'";
}

function trspace($height)
{
	echo '<tr><td height="'.$height.'"></td></tr>';
}

function isphp5()
{
	$ver = phpversion();
	if (substr($ver, 0, 1) >= '5') return true;
	return false;
}

function kp_strlen($str)
{
	if (UTF8MODE) return mb_strlen($str);
	return strlen($str);
}

function kp_tolower($str)
{
	if (UTF8MODE) return mb_strtolower($str);
	return strtolower($str);
}

function kp_substr($str, $off, $to=0)
{
	if (UTF8MODE) 
	{
		if ($to > 0) 
			return mb_substr($str, $off, $to);
		else 
			return mb_substr($str, $off);
	}
	if ($to > 0) 
		return substr($str, $off, $to); 
	else
		 return substr($str, $off);
}

function kp_basename($in)
{
	global $win32;
	if (!$win32)
	{
		$t = substr(strrchr($in, '/'), 1);
		return $t ? $t : $in; 
	} else return basename($in);
}

function webpdir($pdir, $url=true)
{
	if ($url) return urlencode(base64_encode($pdir));
		else return base64_encode($pdir);
	
}


// string handling

function vernum($in)
{
	if (is_numeric($in)) return $in; else return 0;
}

function vernumset($in, $value)
{
	if (is_numeric($in)) return $in; else return $value;
}

function verchar($in)
{
	if ($in == '1' || $in == '0') return $in; else return 0;
}

// new handling

function frm_isset($name)
{
	if (isset($_POST[$name]) || isset($_GET[$name])) return true;
	return false;
}

function frm_get($name, $type=0, $default='')
{
	$retval = $default;
	
	if (frm_isset($name))
	{
		if (isset($_POST[$name])) $val = $_POST[$name]; 
			else
		if (isset($_GET[$name])) $val = $_GET[$name];
	
		switch($type)
		{
			case 0: $retval = stripslashes(strip_tags($val));
			case 1: if (is_numeric($val)) $retval = $val;
			case 2: if ($val == '1' || $val == '0') $retval = $val;
			case 3: if (is_array($val)) $retval = $val;
		}
	}

	return $retval;
}

function frm_ok($name, $type)
{
	if (frm_isset($name))
	{
		if (isset($_POST[$name])) $val = $_POST[$name]; 
			else
		if (isset($_GET[$name])) $val = $_GET[$name];
	
		switch($type)
		{
			case 0: return true;
			case 1: if (is_numeric($val)) return true;
			case 2: if ($val == '1' || $val == '0') return true;
			case 3: if (is_array($val)) return true;
		}
	}

	return false;
}

function frm_getwww($name)
{
	$val = frm_get($name);
	return htmlentities($val, ENT_QUOTES, get_lang(1));
}

function frm_empty($name)
{
	$val = frm_get($name);
	if (strlen($val) > 0) return false;
	return true;
}


$kdesign = array();

$kdesign['dirheader'] =
	'?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td colspan="2" align="left">
			<font class="importnant"><b><?php echo $dirlink; ?>&nbsp;</b></font><?php echo $ximg; ?>
		</td>
	</tr>
	<tr><td height="7"></td></tr>
	<tr>
		<td width="80%" height="1" bgcolor="#CCCCCC"></td>
		<td width="20%"></td>
	</tr>
	<tr>
		<td height="8"></td>
	</tr>
	</table>';

$kdesign['detailedview'] = 
	'?><tr>
			<td>
				<table width="90%" cellspacing="2" cellpadding="0" border="0">
				<tr>
					<td height="10"></td>
				</tr>
				<tr>
					<td height="100" width="120"><?php echo $imgurl; ?></td>
					<td width="10"></td>
					<td class="ainfo" valign="top">
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tr>
							<td width="28">							
							<a href="<?php echo $href; ?>" <?php echo $onclick; ?> title="<?php echo get_lang(337); ?>" class="dir"><img alt="<?php echo get_lang(337); ?>\'" src="<?php echo getimagelink(\'play.gif\'); ?>" border="0"/></a></td>						
							<td><a href="<?php echo $dirurl; ?>" class="dir"><?php echo $cname; ?></a></td>
						</tr>
						</table>
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
						<tr>
							<td width="3"></td>
							<td>
								<table width="100%" cellspacing="0" cellpadding="0" border="0">
								<tr>
									<td height="6"></td>
								</tr>
								<tr>
									<td width="80"><?php echo get_lang(142); ?></td><td><?php echo $ainf[\'artist\']; ?></td>
								</tr>						
								<tr>
									<td width="80"><?php echo get_lang(145); ?></td><td><?php if (is_numeric($ainf[\'year\']) && $ainf[\'year\'] != 0) echo $ainf[\'year\']; ?></td>
								</tr>
								<tr>
									<td width="80"><?php echo get_lang(147); ?></td><td><?php echo checkchs($ainf[\'genre\']); ?></td>
								</tr>
								<tr>
									<td width="80"><?php echo get_lang(336); ?></td><td><?php echo get_lang(151, $ainf[\'length\'], $ainf[\'titles\']); ?></td>
								</tr>
								</table>
							</td>
						</tr>
						</table>
					</td>
				</tr>
				</table>
			</td>
		</tr>';

$kdesign['login'] = '
?>
<form style="margin:0;padding:0" method="post" action="<?php if (HTTPS_REQ_MET) echo PHPSELF;?>">
<input type="hidden" name="l_uri" value="<?php echo geturi(); ?>"/>
<p>&nbsp;</p>
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
	<td align="left"><a href="http://www.kplaylist.net/"><font class="loginkplaylist">www.kplaylist.net</font></a></td>
	</tr>
	<tr>
		<td height="5"></td>
	</tr>
	<tr>
		<td colspan="3"><img src="<?php echo getimagelink(\'login.jpg\'); ?>" height="327" width="600" alt="kPlaylist v<?php echo $app_ver; ?> build <?php echo $app_build; ?>"/></td>
	</tr>
	<tr>
		<td height="3" bgcolor="#AAAAAA"></td>
	</tr>
	<tr>
		<td height="12" width="600" valign="top">
			<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tdlogin">
				<tr>
					<td height="10"></td>
				</tr>
				<tr>
					<td width="2%"></td>
					<td width="20%"><font class="text"><?php echo get_lang(37); ?></font></td>
					<td width="30%"><input type="text" id="l_username" name="l_username" tabindex="1" maxlength="30" size="15" class="logonbuttom"/></td>
					<td width="48%"></td>
				</tr>
				<tr>
					<td height="3"></td>
				</tr>
				<tr>
					<td></td>
					<td><font class="text"><?php echo get_lang(38); ?></font></td>
					<td>
						<input type="password" name="l_password" tabindex="2" maxlength="30" size="15" class="logonbuttom"/>
					</td>
				</tr>
				<tr>
					<td height="3"></td>
				</tr>
				<tr>
					<td></td>
					<td><font class="text"><?php echo get_lang(287); ?></font></td>
					<td><input type="checkbox" name="l_rememberme" tabindex="4" value="1" class="logonbuttom"/></td>
				</tr>
				<tr>
					<td height="8"></td>
				</tr>
				<tr>
					<td></td>					
					<td colspan="3">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr>
						<td width="30%">
						<?php 
						if (HTTPS_REQ_MET)
						{
							?><input type="submit" name="l_submit" tabindex="3" value="<?php echo get_lang(40); ?>" class="logonbuttom" />
							<?php
							if (USERSIGNUP) 
							{ 
								?><input type="button" name="l_signup" tabindex="5" onclick="newwin(\'Users\', \'<?php echo PHPSELF; ?>?l_signup=1\', 195, 350);" value="<?php echo get_lang(158); ?>" class="logonbuttom" /><?php 
							}
						} else { ?><a href="https://<?php echo $phpenv[\'streamlocation\']; ?>"><font class="logintext"><?php echo get_lang(41); ?></font></a><?php }
						?>
						</td>
						<td valign="bottom" align="right"><font class="logintext"><?php echo get_lang(39); ?>&nbsp;&nbsp;</font></td>
					</tr>
					</table>
					</td>
				</tr>
				<?php if (!empty($msg))
				{
					?>
					<tr>
						<td height="10"></td>
					</tr>
					<tr>
						<td></td><td colspan="2"><font class="logintext"><?php echo $msg; ?></font></td>
					</tr>
					<?php
				}
				?>
				<tr>
					<td height="10"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</form>
<script type="text/javascript">
	<!--
	d = document.getElementById(\'l_username\');	
	d.focus();	
	-->
</script>
<table width="610" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td height="7"></td></tr>
<tr>
	<td align="right">
		<a href="http://validator.w3.org/check/referer">
		<img src="<?php echo getimagelink(\'w3c_xhtml_valid.gif\'); ?>" border="0" alt="Valid XHTML 1.0!" height="31" width="88"/></a>
	</td>
</tr>
</table>';

$kdesign['infobox'] = '	
	
	$trheight = 14;
	$boxwidth = 245;
	?>	
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td valign="top" align="left">
		<?php
		if ($setctl->get(\'showupgrade\')) 
		{
			?><a title="<?php echo get_lang(120); ?>" href="http://www.kplaylist.net/?ver=<?php echo $app_ver; ?>&amp;build=<?php echo $app_build; ?>" target="_blank">
			<font color="#CCCCCC"><?php echo get_lang(78); ?></font></a><br/><?php
		} 
		?>
		<a title="<?php echo get_lang(79); ?>" href="<?php echo $homepage; ?>" target="_blank"><img alt="<?php echo get_lang(79); ?>" src="<?php echo getimagelink(\'kplaylist.gif\'); ?>" border="0"/><span class="notice">v<?php echo $app_ver.\' \'.$app_build; ?></span></a>
		</td>
	</tr>
	<tr>
		<td height="6"></td>
	</tr>
	<tr>
		<td>
		<table width="100%" cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td width="15"></td>
			<td>
			<table width="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td>
						<form style="margin:0;padding:0" name="search" action="<?php echo PHPSELF; ?>" method="post">
						<input type="hidden" name="action" value="search"/>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<?php
						if ($setctl->get(\'showstatistics\'))
						{
							?>
							<tr><td height="4"></td></tr>
							<tr><td align="left"><font class="smalltext">&nbsp;<?php echo compute_statistics(); ?></font></td></tr>
							<tr><td height="8"></td></tr>
							<?php
						}
						?>		
						<tr>
							<td align="left"><input type="text" name="searchtext" id="searchtext" value=\'<?php echo frm_getwww(\'searchtext\'); ?>\' maxlength="150" size="46" class="fatbuttom"/></td>	
						</tr>
						<tr>
							<td height="5"></td>
						</tr>
						<tr>
							<td align="left">
								<input type="radio" name="searchwh" value="0" <?php if ($valuser->get(\'defaultsearch\')==\'0\') echo \'checked="checked"\';?>/><font class="notice"><?php echo get_lang(81); ?>&nbsp;</font>
								<input type="radio" name="searchwh" value="1" <?php if ($valuser->get(\'defaultsearch\')==\'1\') echo \'checked="checked"\';?>/><font class="notice"><?php echo get_lang(82); ?>&nbsp;</font>
								<input type="radio" name="searchwh" value="2" <?php if ($valuser->get(\'defaultsearch\')==\'2\') echo \'checked="checked"\';?>/><font class="notice"><?php echo get_lang(83); ?>&nbsp;</font>
								<input type="radio" name="searchwh" value="3" <?php if ($valuser->get(\'defaultsearch\')==\'3\') echo \'checked="checked"\';?>/><font class="notice"><?php echo get_lang(67); ?></font>
							</td>		
						</tr>
						<tr>
							<td height="5"></td>
						</tr>
						<tr>
							<td align="left">
								<input type="checkbox" name="onlyid3" value="1" <?php if ($valuser->get(\'defaultid3\')) echo \' checked="checked"\'; ?>/>
								<font class="notice"><?php echo get_lang(80); ?></font>
								<input type="checkbox" name="orsearch" value="1" <?php if ($valuser->get(\'orsearch\')) echo \' checked="checked"\'; ?>/>
								<font class="notice"><?php echo get_lang(306); ?></font>&nbsp;
								<select name="hitsas" class="fatbuttom">
								<option value="0"<?php if ($valuser->get(\'hitsas\') == 0) echo \' selected="selected"\'; ?>><?php echo get_lang(185); ?></option>
								<option value="1"<?php if ($valuser->get(\'hitsas\') == 1) echo \' selected="selected"\'; ?>><?php echo get_lang(186); ?></option>
								</select>								
							</td>		
						</tr>
						<tr>
							<td height="5"></td>
						</tr>
						<tr>
							<td align="left"><input type="submit" name="startsearch" value="<?php echo get_lang(5); ?>" class="fatbuttom"/></td>
						</tr>		
						<?php trspace($trheight); ?>
						<tr>
							<td align="left">
							<script type="text/javascript">
								<!--
								d = document.getElementById(\'searchtext\');
								d.focus();
								-->
							</script>
							<?php 
								$ha = new hotalbum();
								blackbox(get_lang(84), $ha->html(), 0, true, \'boxhotlist\', \'left\', $boxwidth); 
							?>
							</td>
						</tr>
						</table>
						</form>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<?php if (class_exists(\'kbulletin\') && BULLETIN)
						{
						trspace($trheight);
						?>						
						<tr>
							<td><?php 
									$kb = new kbulletin();
									blackbox(get_lang(268), $kb->getlatest(), 0, false, \'box\', \'left\', $boxwidth); ?>
								</td>
						</tr>
						<?php
						}		
						if (SHOUTBOX)
						{
							trspace($trheight);
							?>
							<tr>
								<td><?php 
										blackbox(get_lang(364), $kpshout->show(), 0, false, \'box\', \'left\', $boxwidth); ?>
									</td>
							</tr>

							<tr>
								<td height="5"></td>
							</tr>						
							<tr>
								<td>								
								&nbsp;<input type="text" id="shoutmessage" name="shoutmessage" value="" maxlength="128" size="30" class="fatbuttom"/>&nbsp;
								<input type="button" name="submitmessage" onclick="KPlaylist.Shout.submitMessage(document.getElementById(\'shoutmessage\'));" class="fatbuttom" value="<?php echo get_lang(365); ?>"/>													
								</td>
							</tr>
							
							<?php
							}	
											
						trspace($trheight);
						?>
						<tr>
							<td><?php 
									blackbox(get_lang(286), $ca->show(), 0, false, \'box\', \'left\', $boxwidth); ?>
								</td>
						</tr>
						</table>
					</td>
				</tr>
				<?php
	
				$plshared = pl_shared(75);
				if (!empty($plshared))
				{
					trspace($trheight);
					?>
					<tr>
					<td>
					<form style="margin:0;padding:0" name="sharedplaylist" action="<?php echo PHPSELF; ?>" method="post">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
					<tr><td><?php echo blackbox(get_lang(86), $plshared, 0, false, \'box\', \'left\', $boxwidth); ?></td></tr>
					</table>
					</form>
					</td>
					</tr>
					<?php 
				}
				?>

				<tr>
				<td>
				<form style="margin:0;padding:0" name="misc" action="<?php echo PHPSELF?>" method="post">
				<input type="hidden" name="action" value="misc"/>
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<?php					
					if ($valuser->isadmin())
					{
						trspace($trheight);
						?>
						<tr>
							<td align="left">
						<?php
						$admincode = \'&nbsp;<input type="button" name="action" value="\'.get_lang(87).\'" class="fatbuttom" onclick="\'.jswinscroll(\'Users\', \'?action=showusers\',425,695).\'"/> \';			
						$admincode .= \'<input type="button" name="updatesearch" value="\'.get_lang(15).\'" class="fatbuttom" onclick="\'.jswinscroll(\'Update\', \'?action=updateoptions\').\'"/> \';
						$admincode .= \'<input type="button" name="settings" value="\'.get_lang(126).\'" class="fatbuttom" onclick="\'.jswin(\'Settings\',\'?action=settingsview\',460,685).\'"/>\';
						
						$dropadmin = \'<a class="bbox" onclick="javascript: if (!confirm(\'.addsq().get_lang(313).addsq().\')) return false;" href="\'.PHPSELF.\'?action=dropadmin&amp;p=\'.$runinit[\'pdir64\'].\'&amp;d=\'.$runinit[\'drive\'].\'">x</a>&nbsp;\';		
	
						echo blackbox(get_lang(88),$admincode, 0, false, \'box\', \'left\', $boxwidth, $dropadmin); ?>
						</td></tr>
					<?php 
					} 
					
					if ($valuser->isadmin() && $cfg[\'radio\'])
					{
						trspace($trheight);
						
						$kpr = new kpradio();
						
						$radiocode = $kpr->selectstations();
						if (strlen($radiocode) > 0)
									$radiocode .= \'&nbsp;<input type="button" name="editradio" onclick="\'.jswin(\'radioedite\', \'?action=radio_editjs\', 165, 475).\'" value="\'.get_lang(71).\'" class="fatbuttom"/>\';
	

							$radiocode .= \'&nbsp;<input type="button" name="newradio" onclick="\'.jswin(\'radioeditn\', \'?action=radio_new&amp;stationid=0\', 165, 475).\'" value="\'.get_lang(72).\'" class="fatbuttom"/>\';

						
						?>
							<tr><td><?php echo blackbox(get_lang(343), \'&nbsp;\'.$radiocode, 0, false, \'box\', \'left\', $boxwidth); ?></td></tr>
						<?php 
					}	


					$othercode = \'&nbsp;<input type="submit" name="whatsnew" value="\'.get_lang(89).\'" class="fatbuttom"/>&nbsp;\';
					$othercode .= \'<input type="submit" name="whatshot" value="\'.get_lang(90).\'" class="fatbuttom"/>&nbsp;\';

					$usermisc = \'&nbsp;<input type="submit" name="logmeout" value="\'.get_lang(91).\'" onclick="javascript: if (!confirm(\'.addsq().get_lang(210).addsq().\')) return false;" class="fatbuttom"/> \';
					if ($valuser->get(\'u_access\') != 2) $usermisc .= \'<input type="button" name="editoptions" value="\'.get_lang(92).\'" class="fatbuttom" \'. \'onclick="\'.jswin(\'Options\', \'?action=editoptions\',380,590).\'"/> \';
					$usermisc .= \'<input type="button" name="randomizer" value="\'.get_lang(212).\'" class="fatbuttom" \'. \'onclick="\'.jswin(\'Randomizer\', \'?action=showrandomizer\',380,550).\'"/>\';

					trspace($trheight);

					?>
					<tr><td><?php echo blackbox(get_lang(93), $othercode, 0, false, \'box\', \'left\', $boxwidth); ?></td></tr>

					<?php 
					
					trspace($trheight);

					$genres = \'&nbsp;\'.genre_select(true,$valuser->get(\'defgenre\'));
					$genres .= \'&nbsp;<input type="submit" class="fatbuttom" name="genrelist" value="\'.get_lang(154).\'"/>\';
					?>
					<tr><td><?php echo blackbox(get_lang(147), $genres,1, false, \'box\', \'left\', $boxwidth); ?></td></tr>

					<?php trspace($trheight); ?>
					<tr><td><?php echo blackbox(get_lang(94), $usermisc,1, false, \'box\', \'left\', $boxwidth); ?></td></tr>
				</table>
				</form>
				</td>
				</tr>
			</table>
		</td>
	</tr>
	</table>
	</td>
	</tr>
</table>';

$kdesign['endmp3table'] = '		
	
	$upload = \'<input type="button" name="upload" onclick="\'.jswin(\'upload\', \'?action=fupload\', 220, 520).\'" value="\'.get_lang(69).\'" class="fatbuttom"/>\';
	$httpq  = \'<input type="submit" onclick="javascript: if (!anyselected()) { alert(\'.addsq().get_lang(159).addsq().\'); return false; }" name="httpqselected" value="\'.get_lang(68).\'" class="fatbuttom"/>\';
	
	$selectallcode=\'<input type="button" value="+" class="fatbuttom" onclick="javascript: selectall();"/>&nbsp;&nbsp;<input type="button" value="-" class="fatbuttom" onclick="javascript: disselectall();"/>&nbsp;&nbsp;<input type="button" value="-+" class="fatbuttom" onclick="javascript: kptoggle();"/>\';
	
	?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr><td height="8"></td></tr>
	<tr>
	<td>
		<table border="0" cellspacing="0" cellpadding="0">	
		<tr>
		<?php
		
		if ($files > 0 || $dirs > 0) echo \'<td align="left">\'.blackbox(get_lang(73), $selectallcode).\'</td><td width="5"></td>\';
		if (strlen($playbts) > 0) echo \'<td align="left"> \'.blackbox(get_lang(74), $playbts).\'</td><td width="5"></td>\';
		if ($archivedl && ($files > 0 || $dirs > 0)) echo \'<td align="left"> \'.blackbox(get_lang(117), $dlbts).\'</td><td width="5"></td>\';

		echo \'<td align="left">\'.blackbox(get_lang(75), $playlistbts).\'</td><td width="5"></td>\';
		if (ENABLEUPLOAD) echo \'<td align="left">\'.blackbox(get_lang(234), $upload).\'</td>\';
	
		if ($cfg[\'httpq_support\'] && ($files > 0 || $dirs > 0)) echo \'<td width="5"></td><td align="left">\'.blackbox(get_lang(332), $httpq).\'</td>\';

		?>
		</tr>
	</table>
	</td></tr></table>';

$kdesign['top'] = '
				?>
				<table width="100%" border="0" align="left" cellspacing="0" cellpadding="0">
				<tr>
					<td width="320" valign="top">
					<?php infobox(); ?></td>
					<td align="left" valign="top">
						<?php if ($this->form) $this->form(); ?>
						<table width="100%" border="0" cellpadding="0" cellspacing="0">
						<tr><td height="5"></td></tr>
						<tr>
						<td>						
				';

$kdesign['bottom'] = '
				echo \'</td></tr></table>\';
				if ($this->form) echo \'</form>\';
				echo \'</td></tr></table>\';
				';


$kdesign['blackbox'] = '
	$mix = \'<table class="\'.$class.\'" border="0" cellspacing="0" cellpadding="0"\';
	if ($width != 0) $mix .= \' width="\'.$width.\'"\';
	$mix .= 
	\'><tr><td height="13" valign="top" class="bbox"><b>&nbsp;\'.$title.\'&nbsp;</b></td><td class="bbox" align="right">\'.$extra.\'</td></tr><tr><td colspan="2" class="notice">\'.
	\'<table class="bboxtable" border="0" cellspacing="0" cellpadding="0" width="100%">\';
	$mix .= \'<tr><td height="6"></td></tr>\'.
	\'<tr><td width="3"></td><td \';
	if ($nowrap) $mix .= \'nowrap="nowrap" \';
	$mix .= \'>\'.$code.\'</td><td width="3"></td></tr><tr><td height="4"></td></tr></table>\'.
	\'</td></tr></table>\';
	if (!$returncode) echo $mix; else return($mix);
	';


$kdesign['welcome'] = 
	'?>	
		<table width="90%" bgcolor="#BBCCCC" cellpadding="8" cellspacing="8" border="1">
			<tr>
				<td class="importnant"><h3>Welcome to kPlaylist!</h3>
				To get your site quickly up:
				
				<br/><br/>Click Settings on the admin menu, choose \'File handling\' and enter the path to your music directory or directories in the \'base directory\' field. You can also click the <a class="importnantlink" href="#" onclick="javascript: newwinscroll(\'find\', \'<?php echo PHPSELF; ?>?action=findmusic\', 450, 600);">find</a> button to automatically detect music directories. Press F5 when finished.<br/><br/>
				
				If you have problems configuring kPlaylist, click <a class="importnantlink" href="http://kplaylist.net/index.php?install=true" target="_blank">here</a> for the kPlaylist installation manual.
				<br/><br/>
				</td>
			</tr>
			</table>
			';

$kdesign['basedirchange'] = 
	'?><table width="90%" bgcolor="#BBCCCC" cellpadding="8" cellspacing="8" border="1">
			<tr>
				<td class="importnant"><h3>Base directory changed</h3>
				The base dir setting was changed. Please click the \'Update\' button on the admin menu to perform
				an update against the music sources. 
				<br/><br/>
				Reload this page when done. (F5)
				<br/><br/>
				</td>
			</tr>
			</table>
			';

$kdesign['needupdate'] = 
	'?><table width="90%" bgcolor="#BBCCCC" cellpadding="8" cellspacing="8" border="1">
			<tr>
				<td class="importnant"><h3>Needs update</h3>
				Due to changes in the search database, you need to run a complete update. Click "Update" on the admin bar and select "Rebuild ID3".
				<br/><br/>
				Reload this page when done. (F5)
				<br/><br/>
				</td>
			</tr>
			</table>
			';


$kdesign['missing_getid3'] = '<font color="red">You don\'t have the latest supported version of getid3. Running kPlaylist without getid3 or an old version of getid3 is not recommended. Please click 
<a class="importnantlink" href="http://www.kplaylist.net/forum/viewtopic.php?t=1003" target="_blank">here</a> for more information.</font>';


function klogon($msg = '')
{
	kprintheader(get_lang(29), 1); 
	kprintlogin($msg);
	kprintend(); 
	die();
}

function errormessage($msg, $back = true)
{
	kprintheader(get_lang(56),0);
	if ($back) $code = '&nbsp;<a href="javascript:history.go(-1)" class="fatbuttom">&nbsp;'.get_lang(34).'&nbsp;</a>'; else $code = '';
	blackbox(get_lang(56),'<br/>'.$msg.'<br/><br/>'.$code.'<br/><br/>',0);
	kprintend();
	die();
}

function okmessage($msg, $window=false)
{
	kprintheader(get_lang(181),0);
	if ($window) $extra = '<a href="javascript: window.close(); window.opener.location.reload();" class="fatbuttom">&nbsp;'.get_lang(27).'&nbsp;</a><br/>'; else $extra = '';
	blackbox(get_lang(181),'<br/>'.$msg.'<br/><br/>'.$extra,0);
	kprintend();
	die();
}

function kprintlogin($msg = '')
{
	global $app_ver, $app_build, $phpenv;

	if (((REQUIRE_HTTPS) && ($phpenv['https'])) || (!REQUIRE_HTTPS)) define('HTTPS_REQ_MET', true); else define('HTTPS_REQ_MET', false);

	eval(gethtml('login'));	
}

class kpdesign
{
	function form()
	{
		global $runinit;
		?>
		<form style="margin:0;padding:0" name="psongs" action="<?php echo PHPSELF?>" method="post">
		<input type="hidden" name="action" value="listedres"/>
		<input type="hidden" name="previous" value="<?php echo $runinit['pdir64']; ?>"/>
		<?php
	}

	function top($form=true, $title='', $js=true, $ajax=true)
	{		
		if ($form) $this->form = true; else $this->form = false;
		kprintheader($title, $js, $ajax);
		eval(gethtml('top'));		
	}

	function bottom()
	{
		eval(gethtml('bottom'));
		kprintend();
	}
}

function updatestatistics()
{
	global $cfg, $streamtypes, $bd;

	$ids = array();
	$all = false;
	foreach($cfg['stat_count_ftype'] as $tag)
	{
		if (strlen($tag) > 1)
		{
			$fid = substr($tag, 1);
			if (!is_numeric($fid)) continue;
		}

		switch($tag[0])
		{
			case '*':
					foreach($streamtypes as $id => $val) $ids[$id] = true;
					$all = true;
					break;

			case '-':
					$ids[$fid] = false;
					$all = false;
					break;
			
			case '+':
					$ids[$fid] = true;
					break;
		}
	}

	$sql = 'SELECT SUM(lengths) AS ls, COUNT(*) AS nr, SUM(fsize) AS fs FROM '.TBL_SEARCH;

	$ok = false;

	if (is_array($ids) && !$all)
	{
		foreach($ids as $id => $val) if ($val) $ok = true;
		if ($ok)
		{
			$sql .= ' WHERE (ftypeid ';
			foreach($ids as $id => $val) if ($val) $sql .= ' = '.$id.' or ftypeid';
			$sql = substr($sql, 0, strlen($sql) - (strlen('ftypeid') + 4)).')';			
		}
	}

	$xsql = $bd->genxdrive();
	if (strlen($xsql) > 0)
	{
		if ($ok) $sql .= $xsql; else $sql .= $bd->genxdrive('drive', 'WHERE');	
	}

	$row = mysql_fetch_array(db_execquery($sql), true);
	if ($row)
	{
		$data = $row['ls'].':'.$row['nr'].':'.$row['fs'];
		updatecache(30, $data);
		return $data;
	}
}

function compute_statistics()
{
	global $cfg;
	$data = '';
	if (!getcache(30, $data) || $cfg['userhomedir']) $data = updatestatistics();

	$stats = explode(':', $data);
	if (count($stats) == 3 && is_numeric($stats[0]) && is_numeric($stats[1]) && is_numeric($stats[2]))
	{
		$secs = (int)$stats[0];
		$days = floor($secs/86400);
		$secs = $secs % 86400;
		$hours = floor($secs/3600);
		$secs = $secs % 3600;
		$min = floor($secs/60);
		$mb = floor($stats[2] / 1048576);
		return get_lang(155,$days, $hours, $min, $stats[1], $mb);
	}
}

function endmp3table($showalbum=1, $dirs=0, $files=0) 
{
	global $u_id, $runinit, $cfg, $valuser;

	$dlbts = $playbts = '';

	if ($files == 1 && $dirs == 0) $idnt = get_lang(65); else
	if ($files > 0 && $dirs == 0) $idnt = get_lang(66); else
	if ($files > 0 && $dirs > 0) $idnt = get_lang(67); else $idnt = '';

	$urlprep = '&amp;p='.$runinit['pdir64'].'&amp;d='.$runinit['drive'];

	if (WINDOWPLAYER) $kpwjs = new kpwinjs();

	if ($showalbum && $files > 0)
	{
		if (WINDOWPLAYER)
		{
			$playbts = '<input type="button" name="playwin" value="'.$idnt.'" onclick="'.$kpwjs->album($runinit['pdir64'], $runinit['drive']).'" class="fatbuttom"/>';
		} else $playbts = '<input type="hidden" name="drive" value="'.$runinit['drive'].'"/><input type="submit" name="psongsall" value="'.$idnt.'" class="fatbuttom"/>';
		$playbts .= '&nbsp;&nbsp;';
		$dlbts = '<input type="button" name="pdlall" value="'.$idnt.'" onclick="'.jswin('dlall', '?action=dlall'.$urlprep, 130, 450).'" class="fatbuttom"/>&nbsp;&nbsp;';
	} 
	
	if ($files > 0 || $dirs > 0)
	{
		if (WINDOWPLAYER)
		{
			$playbts .= '<input type="button" class="fatbuttom" name="playwin" value="'.get_lang(68).'" onclick="javascript: if (!anyselected()) { alert('.addsq().get_lang(159).addsq().'); return false; } else { '.$kpwjs->selected().' }"/>';
		} else
		$playbts .= '<input type="submit" onclick="javascript: if (!anyselected()) { alert('.addsq().get_lang(159).addsq().'); return false; }" name="psongsselected" value="'.get_lang(68).'" class="fatbuttom"/>';
	}

	$dlbts .= '<input type="button" onclick="javascript: if (!anyselected()) alert('.addsq().get_lang(159).addsq().'); else '.jswin('dlselected', '?action=dlselectedjs', 130, 450, false).'" name="pdlselected" value="'.get_lang(68).'" class="fatbuttom"/>';

	$playlists = db_getplaylist($u_id);
	$playlistbts = '<input type="hidden" name="drive" value="'.$runinit['drive'].'"/>';
	if (count($playlists) > 0)
	{
		if ($files > 0 || $dirs > 0) 
		{
			if (AJAX) $playlistbts = '<input type="button" onclick="javascript: if (!anyselected()) { alert('.addsq().get_lang(32).addsq().'); return false; } else addPlaylistSelected(\''.get_lang(33).'\');"';
				else $playlistbts = '<input type="submit" onclick="javascript: if (!anyselected()) { alert('.addsq().get_lang(32).addsq().'); return false; }"';		
			$playlistbts .= ' name="addplaylist" value="'.get_lang(69).'" class="fatbuttom"/>&nbsp;';
		}
		
		$playlistbts .= '<select name="sel_playlist" id="sel_playlist" class="file">';
		
		for ($c=0,$cnt=count($playlists);$c<$cnt;$c++) 
		{		
			$playlistbts .= '<option value="'.$playlists[$c][1].'"';
			if ($playlists[$c][1] == db_guinfo('defplaylist')) $playlistbts .= ' selected="selected"';
			$playlistbts .= '>'.$playlists[$c][0].'</option>';			
		}
		$playlistbts .= '</select>&nbsp;';
		
		if (WINDOWPLAYER)
		{
			$playlistbts .= '<input type="button" value="'.get_lang(70).'" class="fatbuttom" onclick="javascript: '.$kpwjs->userplaylist().'"/>';
		} else $playlistbts .= '<input type="submit" name="playplaylist" value="'.get_lang(70).'" class="fatbuttom"/>';		
		$playlistbts .= '&nbsp;<input type="submit" name="editplaylist" value="'.get_lang(71).'" class="fatbuttom"/>&nbsp;';
	}
	$playlistbts .= '<input type="button" name="newplaylist" onclick="'.jswin('playlist', '?action=playlist_new', 100, 350).'" value="'.get_lang(72).'" class="fatbuttom"/>';

	if (ALLOWDOWNLOAD && $valuser->get('u_allowdownload') && $cfg['archivemode'] && $valuser->get('allowarchive')) $archivedl = true; else $archivedl = false;

	eval(gethtml('endmp3table'));	
}

function infobox()
{
 	global $cfg, $app_ver, $setctl, $app_build, $homepage, $runinit, $valuser;
	$homepage = str_replace('KBUILD', $app_build, str_replace('KVER', $app_ver, $setctl->get('homepage')));
	$ca = new caction();
	$ca->updatelist();
	$kpshout = new kpshoutmessage();
	eval(gethtml('infobox'));
}

function kprintheader($title='',$js_out=0, $ajax=0, $addonload='')
{
	global $klang, $setctl, $app_build, $phpenv, $cfg;
	
	if (empty($title)) $title = '| kPlaylist'; else $title = '| '.$title;	
	if ($setctl->get('includeheaders')) 
	{
	?>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml">
		<head>
		<title><?php echo $title; ?></title>
		<!-- kp build <?php echo $app_build; ?> -->
		<meta http-equiv="Content-Type" content="text/html; charset=<?php echo get_lang(1); ?>"/>
		<?php if ($setctl->get('publicrssfeed')) 
		{
			?>
			<link rel="alternate" title="kPlaylist RSS Feed" href="<?php echo $setctl->get('streamurl').$phpenv['streamlocation'].'?streamrss'; ?>" type="application/rss+xml"/>
			<link rel="alternate" title="kPlaylist Whats New RSS Feed" href="<?php echo $setctl->get('streamurl').$phpenv['streamlocation'].'?whatsnewrss'; ?>" type="application/rss+xml"/> 
			<?php
		}
		kprintcss();
	}
	$extjs = $setctl->get('externaljavascript');

	if (AJAX)
	{
		echo '<script type="text/javascript" src="'.$setctl->get('ajaxurl').'"></script>';
		ajax($cfg['livestreamajax'], SHOUTBOX);
	}

	if (empty($extjs)) outjavascripts($js_out); else echo '<script type="text/javascript" src="'.$extjs.'"></script>';

	if ($setctl->get('includeheaders', 1, 1))
	{
		echo '</head>';

		$onload = '';
	
		if ($ajax && AJAX) $onload = 'KPlaylist.init(); ';

		if (strlen($addonload) > 0) $onload .= $addonload;

		if (strlen($onload) > 0) echo '<body onload="'.$onload.'">'; else echo '<body>';
	}
}

function ajax($stream, $shoutbox)
{
	global $cfg;

	?>
	<script type="text/javascript">
	<!--
	KPlaylist = 
	{
		init : function()
		{
			<?php if ($stream)
			{
			?>
			setInterval('KPlaylist.CAction.showStream()', <?php echo $cfg['livestreamajaxupdatetime']; ?>);
			<?php
			}
			?>

			<?php if ($shoutbox)
			{
			?>
			setInterval('KPlaylist.MessageAction.showMessage()', <?php echo $cfg['shoutboxupdatetime']; ?>);
			<?php
			}
			?>
		}
	}

	KPlaylist.Shout =
	{
		submitMessage :  function(object)
		{
			new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=sendshout&shoutmessage=' + encodeURIComponent(object.value),onSuccess:function(request) { KPlaylist.MessageAction.showMessage(); object.value = ''; object.focus(); }});		
		}
	}

	function submitSelected()
	{
		var selids = '';
		for(var i=0;i<document.psongs.elements.length;i++) 
			if(document.psongs.elements[i].type == "checkbox") 
				if (document.psongs.elements[i].checked == true) selids = selids + document.psongs.elements[i].value + ';';			
		new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=addtemplist&selids=' + encodeURIComponent(selids),asynchronous: false,onSuccess:function(request) { } } );
	}

	function addPlaylistSelected(message)
	{
		var selids = '';
		plsel = document.getElementById('sel_playlist');
		for(var i=0;i<document.psongs.elements.length;i++) 
			if(document.psongs.elements[i].type == "checkbox") 
				if (document.psongs.elements[i].checked == true) selids = selids + document.psongs.elements[i].value + ';';			
		new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=addplaylistajax&selids=' + encodeURIComponent(selids) + '&plid=' + plsel.value,asynchronous: false,onSuccess:function(request) { alert(message); } } );
	}

	function submitSelectedRandomizer()
	{
		var selids = '';
		var selobj = document.getElementById('selids'); 			
		for (i=0; i<selobj.options.length;i++) if (selobj.options[i].selected) selids = selids + selobj.options[i].value + ';';			
		new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=addtemplist&selids=' + encodeURIComponent(selids),asynchronous: false,onSuccess:function(request) {  }});
	}

	function submitSingle(sid)
	{
		new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=addtemplist&selids=' + encodeURIComponent(sid),asynchronous: false,onSuccess:function(request) {  }});
	}

	function submitPlaylist(id)
	{
		new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=playlistaddtemplist&id=' + encodeURIComponent(id),asynchronous: false,onSuccess:function(request) {  }});
	}
	
	function submitSharedPlaylist()
	{
		d = document.getElementById('sel_shplaylist'); 
		if (d) new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=playlistaddtemplist&id=' + encodeURIComponent(d.value),asynchronous: false,onSuccess:function(request) {  }});
	}

	function submitUserPlaylist()
	{
		d = document.getElementById('sel_playlist');
		if (d) new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=playlistaddtemplist&id=' + encodeURIComponent(d.value),asynchronous: false,onSuccess:function(request) {  }});
	}

	function submitAlbum(pdir, drive)
	{
		new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=diraddtemplist&p=' + pdir + '&d=' + drive,asynchronous: false,onSuccess:function(request) {  }});
	}

	KPlaylist.CAction = 
	{
		showStream : function()
		{
			new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=ajaxstreams', onSuccess:function(request) { $('streams').innerHTML = request.responseText; }});		
		}
	}

	KPlaylist.MessageAction = 
	{
		showMessage : function()
		{
			new Ajax.Request('<?php echo PHPSELF; ?>', {method:'post',parameters:'action=ajaxshoutmessages',onSuccess:function(request) { $('messages').innerHTML = request.responseText; }});		
		}
	}
	//-->
	</script>
	<?php
}

function kprintcss()
{
	global $setctl, $kpt;
	if ($setctl->get('includeheaders'))
	{
		if ($link = $kpt->getfile('kplaylist.css'))
		{
			if (strlen($link) > 0) 
			{
				echo '<link href="'.$link.'" rel="stylesheet" type="text/css"/>';
				return true;
			}
		}

		$css = $setctl->get('externalcss'); 
		if (strlen($css) > 0)
		{
			echo '<link href="'.$css.'" rel="stylesheet" type="text/css"/>';
		} else
		{
			if (function_exists('kpdefcss'))
			{
				?>
				<style type="text/css">
				<?php kpdefcss(); ?>
				</style>
				<?php
			}
		}
	}
}

function kprintend()
{
	global $setctl;
	if ($setctl->get('includeheaders', 1, 1)) echo '</body></html>';
}

function blackbox($title,$code,$returncode=1,$nowrap=true,$class='box',$textalign='left',$width=0, $extra='')
{
	return eval(gethtml('blackbox'));
}

function blackboxpart($title, $pos, $extra='')
{
	$data = blackbox($title, '%code', 1, true, 'box', 'left', 0, $extra);
	$p = strpos($data, '%code');
	if ($p !== false)
	{
		if ($pos == 1) return substr($data, 0, $p);
			else return substr($data, $p+5);
	}
}

function jswin($name, $url, $height=320, $width=675, $withj=true, $func='newwin', $urlprep='P')
{
	if ($urlprep == 'P') $urlprep = PHPSELF; else $urlprep = '';
	if ($withj) $js = "javascript: ".$func."('".$name."', '".$urlprep.$url."', ".$height.", ".$width.");";
		else $js = $func."('".$name."', '".$urlprep.$url."', ".$height.", ".$width.");";
	return $js;
}

function jswinscroll($name, $url, $height=320, $width=675, $withj=true, $func='newwinscroll', $urlprep='P')
{
	return jswin($name, $url, $height, $width, $withj, $func, $urlprep);
}

function outjavascripts()
{
	?>
	<script type="text/javascript">
	<!--
		
	function openwin(name, url) 
	{
		popupWin = window.open(url, name, 'resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,width=675,height=320,left=150,top=270');
		if (popupWin) popupWin.focus();
	}
	
	var jwflvwin = null;

	function openJWFLV(theFile, url, height, width)
	{
		jwflvwin = open("", "jwflvwin",  'width='+width+',height='+height);
		if (!jwflvwin || jwflvwin.closed || !jwflvwin.createPlayer) 
		{
			jwflvwin = window.open(url, "jwflvwin", 'width='+width+',height='+height);
		} else jwflvwin.focus();
		
		jwflvwin.loadXMLDoc(theFile);
	}

	function newwinscroll(name, url, height, width)
	{
		popupWin = window.open(url, name, 'resizable=yes,scrollbars=yes,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');
		if (popupWin) popupWin.focus();
	}
	
	function newwin(name, url, height, width) 
	{
		popupWin = window.open(url, name, 'resizable=yes,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');
		if (popupWin) popupWin.focus();
	}

	function flashwin(name, url, height, width)
	{
		flashpop = window.open(url, name, 'resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');		
		if (flashpop) flashpop.focus();
	}

	function flashwinsharedplaylist(name, url, height, width)
	{
		d = document.getElementById('sel_shplaylist'); 
		if (d) url = url + "&plid=" + d.value;
		flashpop = window.open(url, name, 'resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');		
		if (flashpop) flashpop.focus();
	}

	function flashwinuserplaylist(name, url, height, width)
	{
		d = document.getElementById('sel_playlist');
		if (d) url = url + "&plid=" + d.value;
		flashpop = window.open(url, name, 'resizable=no,scrollbars=no,status=no,toolbar=no,menubar=no,width='+width+',height='+height+',left=250,top=270');		
		if (flashpop) flashpop.focus();
	}

	function savescrolly()
	{
		var scrOfY = 0;
		if( typeof( window.pageYOffset ) == 'number' )
		{
			scrOfY = window.pageYOffset;
		} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop))
		{
			scrOfY = document.body.scrollTop;
		} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop))
		{
			scrOfY = document.documentElement.scrollTop;
		}
		
		sy = document.getElementById('scrolly');
		if (sy) sy.value = scrOfY; 
	}

	function kptoggle() 
	{
		for(var i=0;i<document.psongs.elements.length;i++) 
		{
			if(document.psongs.elements[i].type == "checkbox")
			{
				if (document.psongs.elements[i].checked == false) document.psongs.elements[i].checked = true; 
					else
				if (document.psongs.elements[i].checked == true) document.psongs.elements[i].checked = false;
			}
		}
	}	

	function selectall() 
	{
		for(var i=0;i<document.psongs.elements.length;i++) 
			if(document.psongs.elements[i].type == "checkbox") if (document.psongs.elements[i].checked == false) document.psongs.elements[i].checked = true; 
	}	

	function disselectall() 
	{
		for(var i=0;i<document.psongs.elements.length;i++) 
			if(document.psongs.elements[i].type == "checkbox") if (document.psongs.elements[i].checked == true) document.psongs.elements[i].checked = false; 
	}	

	function anyselected()
	{
		for(var i=0;i<document.psongs.elements.length;i++) if(document.psongs.elements[i].type == "checkbox") if (document.psongs.elements[i].checked == true) return true;
		return false;
	}

	function chhttp(where) { 
		document.location = where;
	}
	//-->
	</script>
	<?php
}


class kpwinjs
{
	function kpwinjs()
	{
		global $valuser, $setctl, $u_id, $u_cookieid, $cfg, $phpenv;

		$this->pltype = $valuser->get('pltype');
		
		switch($this->pltype) // init
		{		
			case 7:
			case 8:
				$this->width = 	$cfg['jw_window_x'];
				$this->height = $cfg['jw_window_y'];

				$this->playlist .= PHPSELF.'?templist='.$u_id.'&amp;encode=true&amp;c='.$u_cookieid.'&amp;file='.lzero(getrand(1,999999),6).'.xml';
				$this->openfw = 'openJWFLV(\''.$this->playlist.'\', \'?action=loadjw\', \''.$this->height.'\', \''.$this->width.'\');';

				break;

			default: // xspf
				$this->width =  $cfg['window_x'];
				$this->height = $cfg['window_y'];
				break;
		}
	}

	function clickwinjs($action, $par, $window)
	{
		global $cfg;
		return jswin('playwin', '?action='.$action.$par, $this->height, $this->width, false, $window);
	}

	function album($p, $d)
	{
		switch($this->pltype)
		{					
			default:	return $this->clickwinjs('playwin', '&amp;p='.$p.'&amp;d='.$d, 'flashwin');
			case 8:		return 'submitAlbum(\''.$p.'\', \''.$d.'\'); '.$this->openfw;
		}
	}

	function single($sid)
	{
		switch($this->pltype)
		{					
			default:	return $this->clickwinjs('playwinfile', '&amp;id='.$sid, 'flashwin');
			case 8:		return 'submitSingle(\''.$sid.'\'); '.$this->openfw;
		}
	}

	function randomizer()
	{
		switch($this->pltype)
		{					
			default:	return $this->clickwinjs('randomizerselected', '', 'flashwin');
			case 8:		return 'submitSelectedRandomizer(); '.$this->openfw;
		}
	}
	
	function sharedplaylist()
	{
		switch($this->pltype)
		{					
			default:	return $this->clickwinjs('playwinlist', '', 'flashwinsharedplaylist');
			case 8:		return 'submitSharedPlaylist(); '.$this->openfw;
		}
	}

	function userplaylist()
	{
		switch($this->pltype)
		{					
			default:	return $this->clickwinjs('playwinlist', '', 'flashwinuserplaylist');
			case 8:		return 'submitUserPlaylist(); '.$this->openfw;
		}
	}

	function playlist($id)
	{
		switch($this->pltype)
		{					
			default:	return $this->clickwinjs('playwinlist', '&amp;plid='.$id, 'flashwin');
			case 8:		return 'submitPlaylist(\''.$id.'\'); '.$this->openfw;
		}
	}

	function selected()
	{
		switch($this->pltype)
		{
			default: return $this->clickwinjs('playselectedjs', '', 'flashwin');
			case 8: return 'submitSelected(); '.$this->openfw;
		}
	}

}



$klang[0] = array('English', 'ISO-8859-1', 'English', 'What\'s hot', 'What\'s new', 'Search', '(only %1 shown)', 'sec', 'Search results: \'%1\'', 'found', 'None.', 'update search database options', 'Delete unused records?', 'Rebuild ID3?', 'Debug mode?', 'Update', 'Cancel', 'update search database', 'Found %1 files.', 'Could not determine this file: %1, skipped.', 'Installed: %1 - Update: %2, scan: ', 'Scan: ', 'Failed - query: %1', 'Could not read this file: %1. Skipped.', 'Removed link to: %1', 'Inserted %1, updated %2, deleted %3 where %4 failed and %5 skipped through %6 files - %7 sec - %8 marked for deletion.', 'Done.', 'Close', 'Found no files here: "%1"', 'kPlaylist logon', 'Album list for artist: %1', 'Hotselect %1', 'No tunes selected. Playlist not updated.', 'Playlist updated!', 'Back', 'Playlist added!', 'Remember to reload page.', 'login:', 'secret:', 'Notice! This is a non public website. All actions are logged.', 'Login', 'SSL required for logon.', 'Play', 'Delete', 'Shared access: ', 'Save', 'Control playlist: \'%1\' - %2 titles', 'Editor', 'Viewer', 'Select', 'Seq', 'Status', 'Info', 'Del', 'Name', 'Totals:', 'Error', 'Action on selected: ', 'Sequence:', 'edit playlist', 'Delete this entry', 'add playlist', 'Name:', 'Create', 'Play: ', 'File', 'Album', 'All', 'Selected', 'add', 'play', 'edit', 'new', 'Select:', 'Play Control: ', 'Playlist: ', 'Hotselect numeric', 'Keyteq gives you:', '(check for upgrade)', 'Homesite', 'only id3', 'album', 'title', 'artist', 'Hotselect album from artist', 'view', 'Shared playlists', 'Users', 'Admin control', 'What\'s new', 'What\'s hot', 'Logout', 'Options', 'Check', 'My', 'edit user', 'new user', 'Full name', 'Login', 'Change password?', 'Password', 'Comment', 'Access level', 'On', 'Off', 'Delete user', 'Logout user', 'Refresh', 'New user', 'del', 'logout', 'Use EXTM3U feature?', 'Show how many rows (hot/new)', 'Max number of search results', 'Reset', 'Open directory', 'Go to directory: %1', 'Download', 'Go one step up', 'Go to root directory.', 'Check for upgrade', 'users', 'Language', 'options', 'Booted', 'Shuffle:', 'Settings', 'Base directory', 'Stream location', 'Default language', 'A Windows system', 'Require HTTPS', 'Allow seek', 'Allow download', 'Session timeout (sec)', 'Report failed login attempts', 'Hold on - fetching file list', 'Playlist could not be added!', 'Admin', 'Login with HTTPS to change!', 'Enable streaming engine', 'Title', 'Artist', 'Album', 'Comment', 'Year', 'Track', 'Genre', 'not set', 'Max download rate (kbps)', 'User', '%1 mins - %2 titles', '%1 kbit %2 mins', 'Genre list: %1', 'Go', 'Playtime: %1d %2h %3m : %4 files : %5 mb', 'No relevant resources here.', 'Password changed!', 'Signup', 'Please make a selection!', 'What is update?', 'Click here for help', 'Use external images?', 'External images path', 'Current password', 'Current password does not match!', 'Preferred archiver', 'Could not create archive!', 'Possible duplicate found:  "%1" "%2"', 'Really delete playlist?', 'Alphabetical', 'Random', 'Sort', 'Original', 'Use javascript', 'Are you sure you want to delete this user?', 'View history', 'history', 'Rows', 'External CSS file', 'Remove duplicates', 'OK', 'ERR', 'Stream', '(show as)', 'files', 'albums', '%1d %2h %3m %4s', 'General', 'Customize', 'File handling', 'Click on ? for help.', 'Automatic database sync', 'Send file extension', 'Allow unauthorized streams', 'Include headers', 'External javascript', 'Homepage', 'Show Keyteq gives you part', 'Show upgrade part', 'Show statistics', 'Write ID3v2 with stream', 'Enable user signup', 'File types', 'Yes', 'No', 'Extension', 'MIME', 'Include in M3U', 'edit file type', 'Sure?', 'Optimistic filecheck', 'Randomizer', 'Mode', 'Playlist', 'None, directly', 'My favourites', 'Did not find any hits', 'All-time hits', 'Order', 'Enable LAME support?', 'Disabled', 'Allow LAME usage?', 'Email', 'Allow to mail files?', 'SMTP server', 'SMTP port', 'Mail to', 'Message', 'Send', 'Mail sent!', 'Activate upload', 'Upload directory', 'Activate mp3mail', 'Upload', 'File uploaded!', 'File could not be uploaded!', 'You must enable cookies to log in!', 'Period', 'ever', 'this week', 'this month', 'last month', 'hits', 'LAME command', 'Show album cover', 'Album files', 'Resize album images', 'Album height', 'Album width', 'Mail method', 'Direct', 'Pear', 'Wait!', 'Please enter a valid e-mail in options!', 'Playlists inline?', 'Show album from URL?', 'Album URL', 'Could not send!', 'User added!', 'Archive creator', 'Archive is deleted.', 'User updated!','Music match', '%1 entries filtered','Log access','Viewable', 'Archived','Bulletin','Written %1 by %2','more', 'Publish','%1 mb', '%1 kb', '%1 bytes', 'Recursive', 'Previous', 'Next', 'Goto page %1', 'Page: ', 'Never played', 'Manually approve signups', 'Pending', 'activate', 'All fields marked with * are mandatory', 'Your account will be inspected and activated manually.', 'Last streams', 'remember me', 'Style', 'find', 'Enter paths to search', 'Use selected?', 'Track time min/max', 'Minutes', 'm3u', 'asx (WMA)', 'If update stops, click here: %1', 'Follow symlinks?', 'File presentation template', 'Enable URL security', 'Upload whitelist', 'File type not allowed.', 'Playlist is empty!', 'Lyrics', 'Lyrics URL', 'Show lyrics link?', '(or?)', 'Unknown username or password', 'Max upload size: %1', 'Open public RSS feed?', 'Please set a password!', 'Need a name and login', 'Username already in use!', 'Drop admin access for this session?', 'Fetching database records: %1/%2', 'Could not find  "%1", is file deleted?', 'From/to date (DDMMYY)', 'Error in input field(s), please try again.', 'Maximum text length', 'Dir columns', 'New template', 'Template', 'Template name', 'Need a template name!', 'Default signup template', 'Tag extractor: ', 'Allow using archiver(s)', 'Maximum archive size (mb)', 'Archive exceeded maximum size! (%1mb, max is %2mb)', 'Home dir', 'Force LAME rate', 'Transcode', 'httpQ', 'Error when contacting httpQ server (%1).', 'Use database cache?', 'Unused records were not deleted due to skips.', 'Length', 'Play album', 'Listing view: ', 'Max number of detailed views', 'Effective', 'Detailed', 'AJAX Prototype URL', 'Radio', 'Loop', 'Sorry - there were problems logging you on.', 'Demo', 'Synchronizing %1 with %2 entries', 'Network status %1: %2', 'Network update %1/%2', 'Choose sublevel: %1', 'Current level: %1', 'Network', 'Enable network server mode', 'Network hosts', 'Host URL', 'Username', 'Stored', 'Updated', 'Missing CURL or url fopen support, read here: %1', 'Allow network', 'deactivate', 'Virtual dir', 'Selected archiver not found', 'Shoutbox', 'shout', 'Theme', 'Append', 'Full', 'Next radio sequence(s)', 'Store resized album covers', 'Album store directory');

$klang[1] = array('Norwegian', 'ISO-8859-1', 'Norsk (bokmål)', 'Hva er mest spilt', 'Hva er nytt', 'Søk', '(bare %1 vist)', 'sek', 'Søkeresultater: \'%1\'', 'fant', 'Ingen.', 'oppdateringsvalg for søkedatabase', 'Slett ubrukte rader?', 'Ombygg ID3?', 'Debugmodus?', 'Oppdater', 'Avbryt', 'oppdaterer søkedatabase', 'Fant %1 filer.', 'Kunne ikke lese fil: %1, hoppet over.', 'Installert: %1 - Oppdaterer: %2, skanner: ', 'Søker: ', 'Feilet - spørring: %1', 'Kunne ikke lese denne filen: %1. Hoppet over.', 'Fjernet referanse til: %1', 'La inn %1, oppdaterte %2, slettet %3 hvor %4 feilet og %5 ble hoppet over igjennom %6 filer - %7 sek - %8 markert for sletting.', 'Ferdig.', 'Lukk', 'Fant ingen filer her: "%1"', 'kPlaylist innlogging', 'Albumliste fra artist: %1', 'Hurtigvelg %1', 'Ingen låter valgt. Spilleliste ikke oppdatert.', 'Spilleliste oppdatert!', 'Tilbake', 'Spilleliste lagt til!', 'Husk å oppdatere side.', 'logg inn:', 'hemmelighet:', 'Advarsel! Dette er en privat webside. All aktivitet blir logget.', 'Logg inn', 'SSL kreves for pålogging.', 'Spill', 'Slett', 'Delte: ', 'Lagre', 'Kontroller spilleliste: \'%1\' - %2 titler', 'Redigerer', 'Viser', 'Velg', 'Sek', 'Status', 'Info', 'Slett', 'Navn', 'Totalt:', 'Feil', 'Handling på valgte: ', 'Sekvens:', 'rediger spilleliste', 'Slett denne oppføringen', 'ny spilleliste', 'Navn:', 'Lag', 'Spill: ', 'Fil', 'Album', 'Alle', 'Valgte', 'legg til', 'spill', 'editer', 'ny', 'Velg:', 'Spillekontroll: ', 'Spilleliste: ', 'Numerisk hurtigvalg', 'Keyteq gir deg:', '(se etter ny versjon)', 'Hjemmeside', 'bare id3', 'album', 'tittel', 'artist', 'Hurtigvelg album fra artist', 'vis', 'Delte spillelister', 'Brukere', 'Adminkontroll', 'Hva er nytt', 'Mest spilt', 'Logg ut', 'Valg', 'Sjekk', 'Min', 'endre brukerinformasjon', 'ny bruker', 'Fullt navn', 'Brukernavn', 'Endre passord?', 'Passord', 'Kommentar', 'Tilgangsnivå', 'På', 'Av', 'Slett bruker', 'Logg ut bruker', 'Oppdater', 'Ny bruker', 'slett', 'logg ut', 'Bruke EXTM3U egenskap?', 'Vise hvor mange rader (mest spilt/nytt)', 'Maks søkerader', 'Omsetting', 'Åpne katalog', 'Gå til katalog: %1', 'Last ned', 'Gå ett steg opp', 'Gå til hovedkatalog.', 'Se etter ny versjon', 'brukere', 'Språk', 'valg', 'Avsperret', 'Omskuff:', 'Innstillinger', 'Hovedkatalog', 'Nedlastningslokalisasjon', 'Standardspråk', 'Et Windows-system', 'Krev HTTPS', 'Tillat spoling', 'Tillat nedlastninger', 'Tidsavbrudd for innlogging (sek)', 'Rapportere mislykkede innloggingsforsøk', 'Vent - henter filliste', 'Spilleliste kunne ikke legges til!', 'Admin', 'Logg inn med HTTPS for å endre!', 'Aktiver innebygd kanalvirkning', 'Tittel', 'Artist', 'Album', 'Kommentar', 'År', 'Låtnummer', 'Stil', 'ikke satt', 'Maksimal nedlastningshastighet', 'Bruker', '%1 minutter - %2 titler', '%1 kbit %2 minutter', 'Sjangerliste: %1', 'Gå', 'Spilletid %1d %2t %3m : %4 filer : %5 mb', 'Ingen relevante ressurser her.', 'Passord endret!', 'Ny bruker', 'Vennligst foreta et valg!', 'Hva er oppdatering?', 'Klikk her for hjelp', 'Bruk eksterne bilder?', 'Plassering for eksterne bilder', 'Eksisterende passord', 'Det eksisterende passordet er feil!', 'Ønsket arkiveringsprogram', 'Arkiv kunne ikke opprettes', 'Mulig duplikat funnet: %1 - %2', 'Virkelig slette spilleliste?', 'Alfabetisk', 'Tilfeldig', 'Sorter', 'Original', 'Bruke javascript', 'Er du sikker på at du vil slette denne brukeren?', 'Vis historie', 'historie', 'Rader', 'Ekstern CSS fil', 'Fjern duplikater', 'OK', 'FEIL', 'Stream', '(vis som)', 'filer', 'album', '%1d %2t %3m %4s', 'Generelt', 'Skreddersy', 'Filhåndtering', 'Klikk på ? for hjelp.', 'Automatisk databasesynkronisering', 'Send filendelse', 'Tillat uautoriserte streams', 'Inkluder headere', 'Eksternt javascript', 'Hjemmeside', 'Vis Keyteq gir deg del', 'Vis oppgraderingsdel', 'Vis statistikk', 'Skriv ID3v2 i stream', 'Ny bruker funksjonalitet', 'Filtyper', 'Ja', 'Nei', 'Filendelse', 'MIME', 'Inkluder i M3U', 'editer filtype', 'Sikker?', 'Optimistisk filsjekk', 'Randomiserer', 'Modus', 'Spilleliste', 'Ingen, direkte', 'Mine favoritter', 'Fant ingen rader', 'Hits på systemet', 'Rekkefølge', 'Slå på LAME støtte', 'Deaktivert', 'Tillat LAME bruk?', 'E-post', 'Tillat e-post av filer', 'SMTP-tjener', 'SMTP-port', 'E-post til', 'Beskjed', 'Send', 'E-post sendt!', 'Aktiver opplastning', 'Opplastningskatalog', 'Aktiver mp3e