'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; // Read here before enabling: http://www.kplaylist.net/forum/viewtopic.php?t=196 $cfg['id3editor'] = 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; // demo mode on/off. Default off. $cfg['demomode'] = 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/'; // 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:s'; // 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'] = 100; // where to break 'last stream' titles $cfg['laststreambreak'] = 33; // miniumum hits to show in whats'hot $cfg['whatshotminimumhits'] = 5; // lame command $cfg['lamecmd'] = '/usr/local/bin/lame --silent --nores --mp3input -h -m s -b %bitrate% "%file%" -'; $lamebitrates = array(0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320); // enabled (0/1) name cmd (%D = destination file, %F source OR %LIST if using filelist.) // YOU MUST SUIT THESE ARCHIVERS TO YOUR OWN NEED. DO NOT USE THE DEFAULT BLINDLY. $archivers = array( 0 => array(1, 'zip', '/usr/bin/zip -j -0 %D "%F"', 'application/zip'), 1 => array(1, 'rar', 'C:\Programfiler\WinRAR\rar.exe -m0 a %D "%F"', 'application/x-rar'), 2 => array(0, 'rar2', 'C:\Programfiler\WinRAR\rar.exe -m0 a %D @"%LIST"', 'application/x-rar') ); // Not much to see at yet. (id, name and css style) - not finished - more will come. $themes = array( 0 => array('menu right', 0), 1 => array('menu left', 0) ); // stream 'engine' finetune settings. $streamsettings = array( 'preload' => 195, 'buffer' => 100, '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', 0, 0, 1, 1), 6 => array ('mpeg', 'video/mpeg', 0, 0, 1, 1), 7 => array ('avi', 'video/avi', 0, 0, 1, 1), 8 => array ('wmv', 'video/x-ms-wmv', 0, 0, 1, 1), 9 => array ('asf', 'application/vnd.ms-asf', 0, 0, 1, 1), 10 => array ('m3u', 'audio/x-mpegurl', 0, 0, 1, 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) ); // 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; if (file_exists('kpconfig.php')) include('kpconfig.php'); // order by tracks (second sorting.) $cfg['ordertrack'] = true; // end of configuration $app_ver = 1.6; $app_build = 401; $kpdbtables = array('playlist', 'playlist_list', 'search', 'users', 'kplayversion', 'mhistory', 'config', 'filetypes', 'settings', 'bulletin', 'cache'); foreach ($kpdbtables as $name) define('TBL_'.strtoupper($name), $cfg['dbprepend'].$name); if ($cfg['enablegetid3']) { include($cfg['getid3include']); if (defined('GETID3VERSION')) define('GETID3_V', 16); else if (defined('GETID3_VERSION')) define('GETID3_V', 17); } function db_gconnect() { global $db; if (@mysql_connect($db['host'], $db['user'], $db['pass']) && mysql_select_db ($db['name'])) return true; return false; } function db_execquery($query, $fast=false) { if ($fast && function_exists('mysql_unbuffered_query')) return mysql_unbuffered_query($query); return mysql_query($query); } function db_execcheck($query) { if (db_gconnect()) return mysql_query($query); else return 0; } class settings { function settings() { $this->dbperform = true; $this->defaultsloaded = false; $this->defaults = false; $this->keys = false; $this->keysvtype = false; } function setdbperform($dbperform) { $this->dbperform = $dbperform; } function update($key, $value, $vtype = 0) { if (!isset($this->keys[$key])) $sql = 'INSERT INTO '.TBL_CONFIG.' SET `key` = "'.$key.'", value = "'.mysql_escape_string($value).'", vtype = '.$vtype; else $sql = 'UPDATE '.TBL_CONFIG.' SET value = "'.mysql_escape_string($value).'", vtype = '.$vtype.' WHERE `key` = "'.$key.'"'; if ($this->dbperform) db_execquery($sql, true); $this->keys[$key] = $this->recast($value, $vtype); } function get($key) { if (!isset($this->keys[$key])) { $this->loaddefaults(); if (isset($this->defaults[$key])) { $sql = 'INSERT INTO '.TBL_CONFIG.' SET `key` = "'.$key.'", value = "'.mysql_escape_string($this->defaults[$key][0]).'", vtype = '.$this->defaults[$key][1]; if ($this->dbperform) db_execquery($sql, true); $this->insert($key, $this->defaults[$key][0], $this->defaults[$key][1]); } else return false; } return $this->keys[$key]; } function set($key, $value) { if (isset($this->keys[$key])) { $sql = 'UPDATE '.TBL_CONFIG.' SET value = "'.mysql_escape_string($value).'" WHERE `key` = "'.$key.'"'; if ($this->dbperform) db_execquery($sql, true); $this->keys[$key] = $this->recast($value, $this->keysvtype[$key]); } } function publish($key) { if (isset($this->keys[$key])) define(strtoupper($key), $this->keys[$key]); else { $this->loaddefaults(); if (isset($this->defaults[$key])) define(strtoupper($key), $this->defaults[$key][0]); else define(strtoupper($key), 0); } } function recast($value, $vtype) { switch ($vtype) { case 0: return $value; case 1: return (bool) $value; case 2: return (int) $value; case 3: return (float) $value; default: break; } } function getchecked($key, $defaultvalue = 0, $vtype = 1) { $this->get($key, $defaultvalue, $vtype); if ($this->keys[$key]) return 'checked="checked"'; } function insert($key, $value, $vtype) { $this->keys[$key] = $this->recast($value, $vtype); $this->keysvtype[$key] = $vtype; } function fetch_old() { $res = db_execquery('SELECT * FROM '.TBL_SETTINGS); $row = mysql_fetch_assoc($res); if ($row) { @$this->update('allowseek', $row['s_allowseek'], 1); @$this->update('allowdownload', $row['s_allowdownload'], 1); @$this->update('base_dir', $row['s_base_dir'], 0); @$this->update('streamlocation', $row['s_streamlocation'], 0); @$this->update('default_language', $row['s_default_language'], 2); @$this->update('windows', $row['s_windows'], 1); @$this->update('timeout', $row['s_timeout'], 2); @$this->update('require_https', $row['s_require_https'], 1); @$this->update('report_attempts', $row['s_report_attempts'], 1); @$this->update('streamingengine', $row['s_streamingengine'], 1); @$this->update('usersignup', $row['u_usersignup'], 1); @$this->update('externimagespath', $row['s_externimagespath'], 0); @$this->update('dlrate', $row['dlrate'], 2); if (isset($row['s_streamurl'])) $this->update('streamurl', $row['s_streamurl'], 0); @$this->update('externalcss', $row['s_externalcss'], 0); } } function loaddefaults() { global $app_ver, $app_build; if (!$this->defaultsloaded) { $this->defaults = array( 'windows' => array(0, 1), 'allowseek' => array(1,1), 'allowdownload' => array(1,1), 'base_dir' => array('/path/to/my/music/archive/', 0), 'streamlocation' => array('', 0), 'default_language' => array(0, 2), 'timeout' => array(43200, 2), 'require_https' => array(0, 1), 'report_attempts' => array(1,1), 'streamingengine' => array(0, 1), 'usersignup' => array(0, 1), 'externimagespath' => array('', 0), 'dlrate' => array(0, 2), 'streamurl' => array('http://', 0), 'externalcss' => array('', 0), 'includeheaders' => array(1, 1), 'homepage' => array('http://www.kplaylist.net/?ver=KVER&build=KBUILD', 0), 'unauthorizedstreams' => array(0, 1), 'sendfileextension' => array(1, 1), 'disksync' => array(1, 1), 'externaljavascript' => array('', 0), 'showkeyteq' => array(1,1), 'showupgrade' => array(1,1), 'showstatistics' => array(0, 1), 'writeid3v2' => array(0, 1), 'unauthorizedstreamsextm3u' => array(0, 1), 'optimisticfile' => array(1, 0), 'lamesupport' => array(0, 1), 'smtphost' => array('127.0.0.1', 0), 'smtpport' => array('25', 0), 'enableupload' => array(0, 1), 'uploadpath' => array('', 0), 'mailmp3' => array(0, 1), 'albumcover' => array(1, 1), 'albumfiles' => array('*album*.jpg,*album*.gif,*cover*.jpg,*cover*.gif,*front*.jpg,*front*.gif', 0), 'albumresize' => array(1, 1), 'albumheight' => array(320, 2), 'albumwidth' => array(400, 2), 'mailmethod' => array(2,2), 'albumurl' => array('http://www.last.fm/music/%artist/%album', 0), 'fetchalbum' => array(0, 1), 'bulletin' => array(1, 1), 'approvesignup' => array(1, 1), 'followsymlinks' => array(0, 1), 'filetemplate' => array('[%R. ][%t - %l|%f] [(%b kbit %s mins)] %S', 0), 'urlsecurity' => array(0, 1), 'oldbase_dir' => array('', 0), 'basedir_changed' => array(0, 1), 'uploadflist' => array('*', 0) ); $this->defaultsloaded = true; } } function defaults() { $this->loaddefaults(); foreach ($this->defaults as $name => $value) $this->update($name, $this->defaults[$name][0], $this->defaults[$name][1]); } function load() { $this->keys = array(); $this->keysvtype = array(); $res = db_execquery('SELECT * FROM '.TBL_CONFIG); if ($res) { if (mysql_num_rows($res) > 0) while ($row = mysql_fetch_row($res)) $this->insert($row[1], $row[2], $row[3]); else $this->fetch_old(); } } } function getcache($id, &$data) { $res = db_execquery('SELECT value FROM '.TBL_CACHE.' WHERE id = '.$id); if (mysql_num_rows($res) > 0) { $row = mysql_fetch_row($res); $data = $row[0]; return true; } return false; } function updatecache($id, $value) { $out = ''; if (getcache($id, $out)) $sql = 'UPDATE '.TBL_CACHE.' SET value = "'.mysql_escape_string($value).'" WHERE id = '.$id; else $sql = 'INSERT INTO '.TBL_CACHE.' SET id = '.$id.', value = "'.mysql_escape_string($value).'"'; db_execquery($sql); } $setctl = new settings(); if (db_gconnect()) { define('DBCONNECTION', true); $enable_install = 0; $setctl->load(); if ($resetconfiguration) { $setctl->defaults(); echo 'Configuration has been reset. Set $resetconfiguration = false; and reload.'; die(); } } else { define('DBCONNECTION', false); $enable_install = 1; $setctl->setdbperform(false); $setctl->defaults(); } $setctl->publish('allowdownload'); $setctl->publish('allowseek'); $setctl->publish('require_https'); $setctl->publish('usersignup'); $setctl->publish('optimisticfile'); $setctl->publish('mailmp3'); $setctl->publish('enableupload'); $setctl->publish('unauthorizedstreams'); $setctl->publish('albumcover'); $setctl->publish('mailmethod'); $setctl->publish('fetchalbum'); $setctl->publish('disksync'); $setctl->publish('bulletin'); $setctl->publish('filetemplate'); $setctl->publish('urlsecurity'); $base_dir = explode(';', $setctl->get('base_dir')); $deflanguage = $setctl->get('default_language'); $win32 = $setctl->get('windows'); if (!$win32) $dlrate = $setctl->get('dlrate'); else $dlrate = 0; $runinit = array('pdir' => '', 'pdir64' => '', 'drive' => 0, 'astream' => 1); if (!function_exists('mysql_list_processes') || !function_exists('mysql_thread_id')) $runinit['astream'] = 0; // general - used as globals $dir_list = $mark = $validated_user = array(); $marksid = $u_cookieid = $u_id = -1; if (isset($_GET['d'])) $runinit['drive'] = $_GET['d']; else if (isset($_POST['drive'])) $runinit['drive'] = $_POST['drive']; $phpenv = array(); if (!isset($PHP_SELF) || empty($PHP_SELF)) $PHP_SELF = $_SERVER['PHP_SELF']; if ($cfg['badblue']) { $qpos = strrpos($PHP_SELF, '?'); if ($qpos !== false) $PHP_SELF = substr($PHP_SELF, 0, $qpos); } if ($cfg['ordertrack']) define('ORDERBYTRACK', true); else define('ORDERBYTRACK', false); function phpfigure() { global $phpenv, $setctl, $PHP_SELF, $_SERVER; $phpenv['streamlocation'] = $setctl->get('streamlocation'); if (empty($phpenv['streamlocation'])) { if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) $streamport = ':'.$_SERVER['SERVER_PORT']; else $streamport = ''; $host = ''; if (isset($_SERVER['HTTP_HOST'])) $host = $_SERVER['HTTP_HOST']; else if (isset($_SERVER['SERVER_NAME'])) $host = $_SERVER['SERVER_NAME'].$streamport; $i = @strpos('php.exe', strtolower($_SERVER['SCRIPT_NAME'])); if ($i !== false) $script = $_SERVER['SCRIPT_NAME']; else $script = $PHP_SELF; $phpenv['streamlocation'] = $host.$script; } if (isset($_SERVER['REQUEST_URI'])) $phpenv['uri'] = $_SERVER['REQUEST_URI']; else $phpenv['uri'] = ''; $phpenv['remote'] = $_SERVER['REMOTE_ADDR']; $phpenv['useragent'] = @$_SERVER['HTTP_USER_AGENT']; $phpenv['https'] = false; if (isset($_SERVER['HTTPS'])) { $phpenv['https'] = true; if (stristr($_SERVER['HTTPS'],'off')) $phpenv['https'] = false; } } phpfigure(); if (DBCONNECTION) { $streamtypes = $streamtypes_default; $res = db_execquery('SELECT extension, mime, m3u, getid, search, logaccess FROM '.TBL_FILETYPES.' WHERE enabled = 1', true); if ($res) while ($row = mysql_fetch_row($res)) $streamtypes[] = $row; } else $streamtypes = array(); function verchar($in) { if ($in == '1' || $in == '0') return $in; else return 0; } 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 make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } function timeresults($name) { global $kqm; if (class_exists('kqMeasure') && $kqm) { $kqm->stop(); user_error('Operation '.$name.' took '.$kqm->resultinsec(3)); } } function fruser($name, $numeric=false) { if (isset($_POST[$name])) return $_POST[$name]; if (isset($_GET[$name])) return $_GET[$name]; if ($numeric) return 0; else return ''; } function refreshurl($url) { ?>
Make your own free website on Tripod.com
'; for ($i=0,$c=count($options);$i<$c;$i++) { $out .= '