'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) { ?>
block so the print_r's are readable. // define('ID3_SHOW_DEBUG', true); class id3 { /* * id3 - A Class for reading/writing MP3 ID3 tags * * By Sandy McArthur, Jr. * * Copyright 2001 (c) All Rights Reserved, All Responsibility Yours * * This code is released under the GNU LGPL Go read it over here: * http://www.gnu.org/copyleft/lesser.html * * I do make one optional request, I would like an account on or a * copy of where this code is used. If that is not possible then * an email would be cool. * * Warning: I really hope this doesn't mess up your MP3s but you * are on your own if bad things happen. * * Note: This code doesn't try to deal with corrupt mp3s. So if you get * incorrect length times or something else it may be your mp3. To fix just * re-enocde from the CD. :~) * * To use this code first create a id3 object passing the path to the mp3 as the first * parameter. Then just access the ID3 fields directly (look below for their names). * If you want to update a tag just change the fields and then $id3->write(); * The methods designed for general use are study(), write(), copy($from), remove(), * and genres(). Please read the comment before each method for the specifics of each. * * eg: * require_once('class.id3.php'); * $id3 = new id3('/path/to/our lady peace - middle of yesterday.mp3'); * echo $id3->artists, ' - ', $id3->name; * $id3->comment = 'Go buy some OLP CDs, they rock!'; * $id3->write(); * * Change Log: * 1.24: Small change to the write() method because the old way it worked was poorly * thought out. The new write() method has optional parameters. $id3->frameoffset * added which will have the byte offset of the first mpeg frame and $id3->filesize * 1.23: MPEG Frame pasrsion code should be perfect on everything but VBR mp3's. * 1.20: Reimplemented most of the mpeg frame parsing code plus a whole lot more. * 1.10: ID3v1 and v1.1 functionality completed. * 1.00: Decided to rewrite and correct all my poor choices and to implement ID3v1.1 * Looking at my old code I'm ashamed I ever released it and called it functional. * * TODO: * Implement ID3v2 reader and maybe writer if enought people want it. * * The most recent version is available at: * http://Leknor.com/code/ * */ /* * id3 constructor - creates a new id3 object and maybe loads a tag * from a file. * * $file - the path to the mp3/mpeg file. When in doubt use a full path. * $study - (Optional) - study the mpeg frame to get extra info like bitrate and frequency * You should advoid studing alot of files as it will siginficantly slow this down. */ function id3($file, $study = false) { $this->_version = 1.24; // Version of the id3 class $this->file = false; // mp3/mpeg file name $this->id3v1 = false; // ID3 v1 tag found? (also true if v1.1 found) $this->id3v11 = false; // ID3 v1.1 tag found? $this->id3v2 = false; // ID3 v2 tag found? (not used yet) // ID3v1.1 Fields: $this->name = ''; // track name $this->artists = ''; // artists $this->album = ''; // album $this->year = ''; // year $this->comment = ''; // comment $this->track = 0; // track number $this->genre = ''; // genre name $this->genreno = 255; // genre number // MP3 Frame Stuff $this->studied = false; // Was the file studied to learn more info? $this->mpeg_ver = false; // version of mpeg $this->layer = false; // version of layer $this->bitrate = false; // bitrate $this->crc = false; // Frames are crc protected? $this->frequency = 0; // Frequency $this->padding = false; // Frames padded $this->private = false; // Private bit set? $this->mode = ''; // Mode (Stereo etc) $this->copyright = false; // Copyrighted? $this->original = false; // On Original Media? (never used) $this->emphasis = ''; // Emphasis (also never used) $this->filesize = -1; // Bytes in file $this->frameoffset = -1; // Byte at which the first mpeg header was found. $this->length = false; // length of mp3 format hh:ss $this->lengths = false; // length of mp3 in seconds $this->error = false; // if any errors they will be here $this->debug = false; // print debugging info? $this->debugbeg = ''; $this->debugend = ''; if (defined('ID3_SHOW_DEBUG')) $this->debug = true; if ($this->debug) print($this->debugbeg . "id3('$file')\n"); if (!empty($file)) { $this->file = $file; $this->_read_v1(); if ($study or defined('ID3_AUTO_STUDY')) $this->study(); if ($this->debug) print($this->debugend); } } // id3($file) /* * write - update the id3v1 tags on the file. * * $v1 - if true update/create an id3v1 tag on the file. (defaults to true) * * Note: If/when ID3v2 is implemented this method will probably get another * parameters. */ function write($v1 = true) { if ($this->debug) print($this->debugbeg . "write()\n"); if ($v1) { $this->_write_v1(); } if ($this->debug) print($this->debugend); } // write() /* * study() - does extra work to get the MPEG frame info. */ function study() { $this->studied = true; $this->_readframe(); } // study() /* * copy($from) - set's the ID3 fields to the same as the fields in $from */ function copy($from) { if ($this->debug) print($this->debugbeg . "copy(\$from)\n"); $this->name = $from->name; $this->artists = $from->artists; $this->album = $from->album; $this->year = $from->year; $this->comment = $from->comment; $this->track = $from->track; $this->genre = $from->genre; $this->genreno = $from->genreno; if ($this->debug) print($this->debugend); } // copy($from) /* * remove - removes the id3 tag(s) from a file. * * $id3v1 - true to remove the tag * $id3v2 - true to remove the tag (Not yet implemented) */ function remove($id3v1 = true, $id3v2 = true) { if ($this->debug) print($this->debugbeg . "remove()\n"); if ($id3v1) { $this->_remove_v1(); } if ($id3v2) { // TODO: write ID3v2 code } if ($this->debug) print($this->debugend); } // remove /* * _read_v1 - read a ID3 v1 or v1.1 tag from a file * * $file should be the path to the mp3 to look for a tag. * When in doubt use the full path. * * if there is an error it will return false and a message will be * put in $this->error */ function _read_v1() { if ($this->debug) print($this->debugbeg . "_read_v1()\n"); if (! ($f = fopen($this->file, 'rb')) ) { $this->error = 'Unable to open ' . $file; return false; } if (fseek($f, -128, SEEK_END) == -1) { $this->error = 'Unable to see to end - 128 of ' . $this->file; return false; } $r = fread($f, 128); fclose($f); if ($this->debug) { $unp = unpack('H*raw', $r); print_r($unp); } $id3tag = $this->_decode_v1($r); if($id3tag) { $this->id3v1 = true; $tmp = explode(Chr(0), $id3tag['NAME']); $this->name = $tmp[0]; $tmp = explode(Chr(0), $id3tag['ARTISTS']); $this->artists = $tmp[0]; $tmp = explode(Chr(0), $id3tag['ALBUM']); $this->album = $tmp[0]; $tmp = explode(Chr(0), $id3tag['YEAR']); $this->year = $tmp[0]; $tmp = explode(Chr(0), $id3tag['COMMENT']); $this->comment = $tmp[0]; if (isset($id3tag['TRACK'])) { $this->id3v11 = true; $this->track = $id3tag['TRACK']; } $this->genreno = $id3tag['GENRENO']; $this->genre = $id3tag['GENRE']; } if ($this->debug) print($this->debugend); } // _read_v1() /* * _decode_v1 - decodes that ID3v1 or ID3v1.1 tag * * false will be returned if there was an error decoding the tag * else an array will be returned */ function _decode_v1($rawtag) { if ($this->debug) print($this->debugbeg . "_decode_v1(\$rawtag)\n"); if ($rawtag[125] == Chr(0) and $rawtag[126] != Chr(0)) { // ID3 v1.1 $format = 'a3TAG/a30NAME/a30ARTISTS/a30ALBUM/a4YEAR/a28COMMENT/x1/C1TRACK/C1GENRENO'; } else { // ID3 v1 $format = 'a3TAG/a30NAME/a30ARTISTS/a30ALBUM/a4YEAR/a30COMMENT/C1GENRENO'; } $id3tag = unpack($format, $rawtag); if ($this->debug) print_r($id3tag); if ($id3tag['TAG'] == 'TAG') { $id3tag['GENRE'] = $this->getgenre($id3tag['GENRENO']); } else { $this->error = 'TAG not found'; $id3tag = false; } if ($this->debug) print($this->debugend); return $id3tag; } // _decode_v1() /* * _write_v1 - writes a ID3 v1 or v1.1 tag to a file * * if there is an error it will return false and a message will be * put in $this->error */ function _write_v1() { if ($this->debug) print($this->debugbeg . "_write_v1()\n"); $file = $this->file; if (! ($f = fopen($file, 'r+b')) ) { $this->error = 'Unable to open ' . $file; return false; } if (fseek($f, -128, SEEK_END) == -1) { $this->error = 'Unable to see to end - 128 of ' . $file; return false; } $this->genreno = $this->getgenreno($this->genre, $this->genreno); $newtag = $this->_encode_v1(); $r = fread($f, 128); if ($this->_decode_v1($r)) { if (fseek($f, -128, SEEK_END) == -1) { $this->error = 'Unable to see to end - 128 of ' . $file; return false; } fwrite($f, $newtag); } else { if (fseek($f, 0, SEEK_END) == -1) { $this->error = 'Unable to see to end of ' . $file; return false; } fwrite($f, $newtag); } fclose($f); if ($this->debug) print($this->debugend); } // _write_v1() /* * _encode_v1 - encode the ID3 tag * * the newly built tag will be returned */ function _encode_v1() { if ($this->debug) print($this->debugbeg . "_encode_v1()\n"); if ($this->track) { // ID3 v1.1 $id3pack = 'a3a30a30a30a4a28x1C1C1'; $newtag = pack($id3pack, 'TAG', $this->name, $this->artists, $this->album, $this->year, $this->comment, $this->track, $this->genreno ); } else { // ID3 v1 $id3pack = 'a3a30a30a30a4a30C1'; $newtag = pack($id3pack, 'TAG', $this->name, $this->artists, $this->album, $this->year, $this->comment, $this->genreno ); } if ($this->debug) { print('id3pack: ' . $id3pack . "\n"); $unp = unpack('H*new', $newtag); print_r($unp); } if ($this->debug) print($this->debugend); return $newtag; } // _encode_v1() /* * _remove_v1 - if exists it removes an ID3v1 or v1.1 tag * * returns true if the tag was removed or none was found * else false if there was an error */ function _remove_v1() { if ($this->debug) print($this->debugbeg . "_remove_v1()\n"); $file = $this->file; if (! ($f = fopen($file, 'r+b')) ) { $this->error = 'Unable to open ' . $file; return false; } if (fseek($f, -128, SEEK_END) == -1) { $this->error = 'Unable to see to end - 128 of ' . $file; return false; } $r = fread($f, 128); $success = false; if ($this->_decode_v1($r)) { $size = filesize($this->file) - 128; if ($this->debug) print('size: old: ' . filesize($this->file)); $success = ftruncate($f, $size); clearstatcache(); if ($this->debug) print(' new: ' . filesize($this->file)); } fclose($f); if ($this->debug) print($this->debugend); return $success; } // _remove_v1() function _readframe() { if ($this->debug) print($this->debugbeg . "_readframe()\n"); $file = $this->file; if (! ($f = fopen($file, 'rb')) ) { $this->error = 'Unable to open ' . $file; if ($this->debug) print($this->debugend); return false; } $this->filesize = filesize($file); do { while (fread($f,1) != Chr(255)) { // Find the first frame //if ($this->debug) echo "Find...\n"; if (feof($f)) { $this->error = 'No mpeg frame found'; if ($this->debug) print($this->debugend); return false; } } fseek($f, ftell($f) - 1); // back up one byte $frameoffset = ftell($f); $r = fread($f, 4); // Binary to Hex to a binary sting. ugly but best I can think of. $bits = @unpack('H*bits', $r); $bits = base_convert($bits['bits'],16,2); } while (!$bits[8] and !$bits[9] and !$bits[10]); // 1st 8 bits true from the while if ($this->debug) print('Bits: ' . $bits . "\n"); $this->frameoffset = $frameoffset; fclose($f); if ($bits[11] == 0) { $this->mpeg_ver = "2.5"; $bitrates = array( '1' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0), '2' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0), '3' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0), ); } else if ($bits[12] == 0) { $this->mpeg_ver = "2"; $bitrates = array( '1' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256, 0), '2' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0), '3' => array(0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160, 0), ); } else { $this->mpeg_ver = "1"; $bitrates = array( '1' => array(0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, 0), '2' => array(0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 0), '3' => array(0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0), ); } if ($this->debug) print('MPEG' . $this->mpeg_ver . "\n"); $layer = array( array(0,3), array(2,1), ); $this->layer = $layer[$bits[13]][$bits[14]]; if ($this->debug) print('layer: ' . $this->layer . "\n"); if ($bits[15] == 0) { // It's backwards, if the bit is not set then it is protected. if ($this->debug) print("protected (crc)\n"); $this->crc = true; } $bitrate = 0; if ($bits[16] == 1) $bitrate += 8; if ($bits[17] == 1) $bitrate += 4; if ($bits[18] == 1) $bitrate += 2; if ($bits[19] == 1) $bitrate += 1; $this->bitrate = @$bitrates[$this->layer][$bitrate]; $frequency = array( '1' => array( '0' => array(44100, 48000), '1' => array(32000, 0), ), '2' => array( '0' => array(22050, 24000), '1' => array(16000, 0), ), '2.5' => array( '0' => array(11025, 12000), '1' => array(8000, 0), ), ); $this->frequency = $frequency[$this->mpeg_ver][$bits[20]][$bits[21]]; $this->padding = $bits[22]; $this->private = $bits[23]; $mode = array( array('Stereo', 'Joint Stereo'), array('Dual Channel', 'Mono'), ); $this->mode = $mode[$bits[24]][$bits[25]]; // XXX: I dunno what the mode extension is for bits 26,27 $this->copyright = $bits[28]; $this->original = $bits[29]; $emphasis = array( array('none', '50/15ms'), array('', 'CCITT j.17'), ); $this->emphasis = $emphasis[$bits[30]][$bits[31]]; if ($this->bitrate == 0) { $s = -1; } else { $s = ((8*filesize($this->file))/1000) / $this->bitrate; } $this->length = sprintf('%02d:%02d',floor($s/60),floor($s-(floor($s/60)*60))); $this->lengths = (int)$s; if ($this->debug) print($this->debugend); } // _readframe() /* * getgenre - return the name of a genre number * * if no genre number is specified the genre number from * $this->genreno will be used. * * the genre is returned or false if an error or not found * no error message is ever returned */ function getgenre($genreno) { if ($this->debug) print($this->debugbeg . "getgenre($genreno)\n"); $genres = $this->genres(); if (isset($genres[$genreno])) { $genre = $genres[$genreno]; if ($this->debug) print($genre . "\n"); } else { $genre = ''; } if ($this->debug) print($this->debugend); return $genre; } // getgenre($genreno) /* * getgenreno - return the number of the genre name * * the genre number is returned or 0xff (255) if a match is not found * you can specify the default genreno to use if one is not found * no error message is ever returned */ function getgenreno($genre, $default = 0xff) { if ($this->debug) print($this->debugbeg . "getgenreno('$genre',$default)\n"); $genres = $this->genres(); $genreno = false; if ($genre) { foreach ($genres as $no => $name) { if (strtolower($genre) == strtolower($name)) { if ($this->debug) print("$no:'$name' == '$genre'"); $genreno = $no; } } } if ($genreno === false) $genreno = $default; if ($this->debug) print($this->debugend); return $genreno; } // getgenreno($genre, $default = 0xff) /* * genres - reuturns an array of the ID3v1 genres */ function genres() { return array( 0 => 'Blues', 1 => 'Classic Rock', 2 => 'Country', 3 => 'Dance', 4 => 'Disco', 5 => 'Funk', 6 => 'Grunge', 7 => 'Hip-Hop', 8 => 'Jazz', 9 => 'Metal', 10 => 'New Age', 11 => 'Oldies', 12 => 'Other', 13 => 'Pop', 14 => 'R&B', 15 => 'Rap', 16 => 'Reggae', 17 => 'Rock', 18 => 'Techno', 19 => 'Industrial', 20 => 'Alternative', 21 => 'Ska', 22 => 'Death Metal', 23 => 'Pranks', 24 => 'Soundtrack', 25 => 'Euro-Techno', 26 => 'Ambient', 27 => 'Trip-Hop', 28 => 'Vocal', 29 => 'Jazz+Funk', 30 => 'Fusion', 31 => 'Trance', 32 => 'Classical', 33 => 'Instrumental', 34 => 'Acid', 35 => 'House', 36 => 'Game', 37 => 'Sound Clip', 38 => 'Gospel', 39 => 'Noise', 40 => 'Alternative Rock', 41 => 'Bass', 42 => 'Soul', 43 => 'Punk', 44 => 'Space', 45 => 'Meditative', 46 => 'Instrumental Pop', 47 => 'Instrumental Rock', 48 => 'Ethnic', 49 => 'Gothic', 50 => 'Darkwave', 51 => 'Techno-Industrial', 52 => 'Electronic', 53 => 'Pop-Folk', 54 => 'Eurodance', 55 => 'Dream', 56 => 'Southern Rock', 57 => 'Comedy', 58 => 'Cult', 59 => 'Gangsta', 60 => 'Top 40', 61 => 'Christian Rap', 62 => 'Pop/Funk', 63 => 'Jungle', 64 => 'Native US', 65 => 'Cabaret', 66 => 'New Wave', 67 => 'Psychadelic', 68 => 'Rave', 69 => 'Showtunes', 70 => 'Trailer', 71 => 'Lo-Fi', 72 => 'Tribal', 73 => 'Acid Punk', 74 => 'Acid Jazz', 75 => 'Polka', 76 => 'Retro', 77 => 'Musical', 78 => 'Rock & Roll', 79 => 'Hard Rock', 80 => 'Folk', 81 => 'Folk-Rock', 82 => 'National Folk', 83 => 'Swing', 84 => 'Fast Fusion', 85 => 'Bebob', 86 => 'Latin', 87 => 'Revival', 88 => 'Celtic', 89 => 'Bluegrass', 90 => 'Avantgarde', 91 => 'Gothic Rock', 92 => 'Progressive Rock', 93 => 'Psychedelic Rock', 94 => 'Symphonic Rock', 95 => 'Slow Rock', 96 => 'Big Band', 97 => 'Chorus', 98 => 'Easy Listening', 99 => 'Acoustic', 100 => 'Humour', 101 => 'Speech', 102 => 'Chanson', 103 => 'Opera', 104 => 'Chamber Music', 105 => 'Sonata', 106 => 'Symphony', 107 => 'Booty Bass', 108 => 'Primus', 109 => 'Porn Groove', 110 => 'Satire', 111 => 'Slow Jam', 112 => 'Club', 113 => 'Tango', 114 => 'Samba', 115 => 'Folklore', 116 => 'Ballad', 117 => 'Power Ballad', 118 => 'Rhytmic Soul', 119 => 'Freestyle', 120 => 'Duet', 121 => 'Punk Rock', 122 => 'Drum Solo', 123 => 'Acapella', 124 => 'Euro-House', 125 => 'Dance Hall', 126 => 'Goa', 127 => 'Drum & Bass', 128 => 'Club-House', 129 => 'Hardcore', 130 => 'Terror', 131 => 'Indie', 132 => 'BritPop', 133 => 'Negerpunk', 134 => 'Polsk Punk', 135 => 'Beat', 136 => 'Christian Gangsta Rap', 137 => 'Heavy Metal', 138 => 'Black Metal', 139 => 'Crossover', 140 => 'Contemporary Christian', 141 => 'Christian Rock', 142 => 'Merengue', 143 => 'Salsa', 144 => 'Trash Metal', 145 => 'Anime', 146 => 'Jpop', 147 => 'Synthpop' ); } // genres } // end of id3 // THIS IS BETA. DO NOT USE UNLESS YOU ENJOY THE RISK OF VERY BAD THINGS // HAPPENING TO YOUR DATA. That said, it doesn't write anything so it // should be harmless. This has been tested on a few ogg files I've // created for testing but that is it. // Uncomment the following define if you want tons of debgging info. // Tip: make sure you use a block so the print_r's are readable. // define('OGG_SHOW_DEBUG', true); class ogg { /* * ogg - A Class for reading Ogg comment tags * * By Sandy McArthur, Jr. * * Copyright 2001 (c) All Rights Reserved, All Responsibility Yours * * This code is released under the GNU LGPL Go read it over here: * http://www.gnu.org/copyleft/lesser.html * * I do make one optional request, I would like an account on or a * copy of where this code is used. If that is not possible then * an email would be cool. * * Warning: I really hope this doesn't mess up your Ogg files but you * are on your own if bad things happen. * * To use this code first create a new instance on a file. Then loop * though the $ogg->fields array. Inside that loop, loop again. The * ogg comment format allows mome then one field with the same name * so it is possible for the ARTIST fields to appear twice if a work * has two performers. * * eg: * require_once('class.ogg.php'); * $ogg = new ogg('/path/to/filename.ogg'); * echo ''; * foreach ($ogg->fields AS $name => $val) { * echo "$name:"; * foreach ($val AS $contents) { * echo '', $contents; * } * echo ''; * } * echo ''; * * This site was useful to me: * http://www.xiph.org/ogg/vorbis/docs.html * * Change Log: * 0.10: Clean up for release. * 0.01: Got off my ass and wrote something until it works enough. * * Thanks To: * * TODO: * Collect nifty info like bitrate, etc... * Maybe implement ogg comment writer. We'll see I don't like using php * to manipulate large amounts of data. * * The most recent version is available at: * http://Leknor.com/code/ * */ /* * ogg constructor - creates a new ogg object * * $file - the path to the ogg file. When in doubt use a full path. */ function ogg($file) { $this->file = false; // ogg file name (you should never modify this) $this->_version = 0.10; // Version of the ogg class (float, not major/minor) $this->fields = array(); // comments fields, this is a two dimentional array. $this->_rawfields = array(); // The comments fields read and split but not orgainzed. $this->error = false; // Check here for an error message $this->debug = false; // print debugging info? $this->debugbeg = ''; $this->debugend = ''; if (defined('OGG_SHOW_DEBUG')) $this->debug = true; if ($this->debug) print($this->debugbeg . "ogg('$file')\n"); $this->file = $file; $this->_read(); if ($this->debug) print($this->debugend); } // ogg($file) /* * _read() - finds the comment in a ogg stream. You should not call this. */ function _read() { if ($this->debug) print($this->debugbeg . "_read()\n"); if (! ($f = fopen($this->file, 'rb')) ) { $this->error = 'Unable to open ' . $file; if ($this->debug) print("$this->error$this->debugend"); return false; } $this->_find_page($f); $this->_find_page($f); fseek($f, 26 - 4, SEEK_CUR); $segs = fread($f, 1); $segs = unpack('C1size', $segs); $segs = $segs['size']; if ($this->debug) print("segs: $segs"); fseek($f, $segs, SEEK_CUR); // Skip preable //$r = fread($f, 1); //print_r(unpack('H*raw', $r)); fseek($f, 7, SEEK_CUR); // Skip Vendor $size = fread($f, 4); $size = unpack('V1size', $size); $size = $size['size']; if ($this->debug) print("vendor size: $size"); fseek($f, $size, SEEK_CUR); // Comments $comments = fread($f, 4); $comments = unpack('V1comments', $comments); $comments = $comments['comments']; if ($this->debug) print("Comments: $comments"); for ($i=0; $i < $comments; $i++) { $size = fread($f, 4); $size = unpack('V1size', $size); $size = $size['size']; if ($this->debug) print("comment size: $size"); $comment = fread($f, $size); if ($this->debug) print("comment: $comment"); $comment = explode('=', $comment, 2); $this->fields[strtoupper($comment[0])][] = $comment[1]; $this->_rawfields[] = $comment; } if ($this->debug) print($this->debugend); } // _read() /* * _find_page - seeks to the next ogg page start. */ function _find_page(&$f) { if ($this->debug) print($this->debugbeg . "_find_page($f)\n"); $header = 'OggS'; // 0xf4 . 0x67 . 0x 67 . 0x53 $bytes = fread($f, 4); while ($header != $bytes) { //if ($this->debug) print('.'); $bytes = substr($bytes, 1); $bytes .= fread($f, 1); } if ($this->debug) { echo 'Page found at byte: ', ftell($f) - 4, ''; print($this->debugend); } } // _find_page(&$file) } // end of class ogg $cssthemes[0] = ' body { background-color: #FFFFFF; color: #000000; margin-top: 10px; margin-left: 10px; margin-right: 5px; margin-bottom: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px } .smalltext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #FFFFFF; color: #003333 } .tblbulletin { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #FFFFFF; color: #000000; border: 1px #000000; border-style: solid } .row2nd { background-color : #dcdef4 } .tdlogin { background-color : #000000 } .logintext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; color: #FFFFFF; background-color: #000000 } .loginkplaylist { color: #BBBBBB; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px } .statistics { color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8px } a:hover.hot { color: #EF610C; text-decoration: underline; font-style: normal } .warning { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal } .notice { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000000 } .fatbuttom { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #FFFFFF; border: 1px #000000; border-style: solid } .fatfield { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #dcdef4; border: 1px #000000; border-style: solid } .logonbuttom { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #000000; border: 1px #CCCCCC solid; color: #FFFFFF } .wtext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000000 } .text { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; color: #FFFFFF } .dir { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; color: #030670 } .finfo { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #333333 } a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000000; text-decoration: none } .file { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000066 } .filemarked { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #EF6100 } .curdir { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #000000; text-decoration: none } .userfield { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small } .boxhotlist { color: #BBBBBB; background-color: #EF6100; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 1px } .box { color: #BBBBBB; background-color: #4F35B3; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 1px } .tdborder { border-color: black black black #666666; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px } .importnant { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #000000 } .importnantlink { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #0000FF } .header { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #000000 } .headermarked { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #EF6100 } .bbox { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; color: #FFFFFF } .bboxtable { background-color: #FFFFFF }'; 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 = ' '.get_lang(34).' '; else $code = ''; blackbox(get_lang(56),''.$msg.''.$code.'',0); kprintend(); die(); } class kpdesign { function kpdesign() { $this->style = db_guinfo('theme'); $this->addform = true; } function form() { global $PHP_SELF, $runinit; ?> style) { case 0: ?> addform) $this->form(); ?> addform) $this->form(); ?> style) { case 0: echo ''; infobox(); echo ''; break; case 1: echo ''; break; } } } function compute_statistics() { $row = mysql_fetch_array(db_execquery('SELECT SUM(lengths) AS ls, COUNT(*) AS nr, SUM(fsize) AS fs FROM '.TBL_SEARCH), true); if ($row) { $secs = (int)$row['ls']; $days = floor($secs/86400); $secs = $secs % 86400; $hours = floor($secs/3600); $secs = $secs % 3600; $min = floor($secs/60); $mb = floor($row['fs'] / 1048576); return get_lang(155,$days, $hours, $min, $row['nr'],$mb); } } function endmp3table($showalbum=1, $dirs=0, $files=0, $recursive = true) { global $u_id, $PHP_SELF, $runinit, $cfg; echo ''; $text = $crstr_dl = $crstr = ''; if ($showalbum && $files > 0) { $crstr .= ' '; $crstr_dl = ' '; } if ($files > 0) $crstr .= ''; if ($dirs > 0 && $recursive) $crstr .= ' '; $crstr_dl .= '"; $playlists = db_getplaylist($u_id); $ploutput = ''; if (count($playlists)>0) { if ($files > 0) $ploutput .= ' '; $ploutput .= ''; $playid = db_guinfo("defplaylist"); for ($c=0,$cnt=count($playlists);$c<$cnt;$c++) { if ($playlists[$c][1] == $playid) $sel=' selected="selected" '; else $sel=''; $ploutput .= ''.$playlists[$c][0].''; } $ploutput .= ' '; } $ploutput .= ''; if (count($playlists)>0) { $ploutput .= ' '; $ploutput .= ' '; } $upload = ''; $ploutput .= "'; $selectallcode=' '; ?> 0) echo ''.blackbox(get_lang(73), $selectallcode).''; if (!empty($crstr)) echo ' '.blackbox(get_lang(74), $crstr).''; if (ALLOWDOWNLOAD && db_guinfo('u_allowdownload') && $cfg['archivemode'] && $files > 0) echo ' '.blackbox(get_lang(117), $crstr_dl).''; echo ''.blackbox(get_lang(75), $ploutput).''; if (ENABLEUPLOAD) echo ''.blackbox(get_lang(234), $upload).''; ?> 0) { $out .= ''; $out .= ''; $options = array(); while ($row = mysql_fetch_assoc($res)) $options[] = array($row['listid'], $row['name']); $out .= genselect('sel_shplaylist', $options, db_guinfo('defshplaylist'), 'file'); $out .= ' '; $out .= ''; } return $out; } function infobox() { global $PHP_SELF, $u_cookieid, $u_id, $app_ver, $setctl, $u_id, $app_build, $homepage; $homepage = str_replace('KBUILD', $app_build, str_replace('KVER', $app_ver, $setctl->get('homepage'))); ?> get('showkeyteq')) { ?>'.substr(get_lang(77),0,3).''.substr(get_lang(77),3); ?>get('showupgrade')) { ?> get('showkeyteq')) echo ''; ?> v get('showstatistics')) { ?> ' maxlength="150" size="46" class="fatbuttom"/> /> /> /> /> /> > > getlatest(), 0, false, 'box', 'left', '240'); ?> updatelist(); ?> show(), 0, false, 'box', 'left', '240'); ?> '. ' '; echo blackbox(get_lang(88),$admincode, 0, false, 'box', 'left', '240'); ?> '; $othercode = ' '; $othercode .= ' '; $usermisc = ' '. ' '; $usermisc .= ' '; ?> get('includeheaders', 1, 1)) { ?> get('externaljavascript'); if (empty($extjs)) outjavascripts($js_out); else echo ''; if ($setctl->get('includeheaders', 1, 1)) { ?> get('includeheaders', 1, 1)) { $css = $setctl->get('externalcss', '', 0); if (!empty($css)) { ?> get('includeheaders', 1, 1)) echo ''; } function blackbox($title,$code,$returncode=1,$nowrap=true,$class='box',$textalign='left',$width=0) { $mix = ''. ''; $mix .= ''. ''. ''; if (!$returncode) echo $mix; else return($mix); } function blackboxpart($title, $pos) { $data = blackbox($title, '%code'); $p = strpos($data, '%code'); if ($p !== false) { if ($pos == 1) return substr($data, 0, $p); else return substr($data, $p+5); } } function outjavascripts() { ?> $db['user'], 'host' => $db['host'], 'name' => $db['name'], 'pass' => $db['pass']); $mysqlserverv = ''; function check_all_tables(&$dbcount) { global $dbtables, $dbtable, $dbalter, $installdb; $ignore = array(); if (db_gconnect()) { $sql = array(); foreach ($dbtable AS $name => $val) if (db_execquery('DESC '.$name) == false) { $sql[] = $installdb[$val]; if ($val == 5) $sql[] = $installdb[9]; $ignore[$name] = true; } else $dbcount++; foreach ($dbtables AS $name => $val) { if (!isset($ignore[$name])) { for ($i=0,$c=count($dbtables[$name]);$i<$c;$i++) if (db_execquery('SELECT '.$dbtables[$name][$i].' FROM '.$name.' LIMIT 1') == false) $sql[] = $dbalter[$name][$dbtables[$name][$i]]; } } return $sql; } } function check_version() { global $enable_tablecheck, $app_build, $oldbuild; $result = db_execcheck('SELECT * from '.TBL_KPLAYVERSION); if ($result) { $data = mysql_fetch_array($result); if (isset($data['app_build'])) { $oldbuild = (int)$data['app_build']; if ($oldbuild != $app_build) $enable_tablecheck = true; } } else $enable_tablecheck = true; } function kinstall_logo($height='64', $width='208') { return ''; } function kcheckaccess($user, $pass, &$errmsg, &$errno) { global $db; $status = 0; $link = @mysql_connect($db['host'], $user, $pass, true); if ($link) { if (@mysql_select_db($db['name'], $link)) $status = 1; else { $errmsg = mysql_error($link); $errno = mysql_errno($link); switch ($errno) { case 1049: $status = 1; break; // database not exist. OK. default: $status = 0; break; } } @mysql_close($link); } else { $errno = mysql_errno(); $errmsg = mysql_error(); } return $status; } function showsql() { global $installdb, $installdbuser; echo ''; echo ''."\n"; echo 'The installers SQL code:'; echo "\n".''; if (isset($_GET['dbi'])) $dbi = $_GET['dbi']; else $dbi = 1; if ($dbi) $start = 1; else $start = 2; for ($i=$start;$i'.str_replace("\n", '', $installdb[$i]).';'; if ($dbi) { echo ''.$installdbuser[0].';'; echo ''.$installdbuser[2].';'; } echo ''; } function show_feedback($upgrade = false) { global $app_ver, $app_build, $oldbuild, $mysqlserverv; ?> '; echo ''; } ?> Software MySQL Version Build Have a comment? An error occured during install! You can restart the installation process by opening up a new window and enter the same URL. Click here for opening the INSTALL reference. ', $installdb[$i]).''; $errors .= mysql_error($link).''; $error = $i; } } } else insterror('Could not use the database ('.$db['name'].')'); if (!$error) { kprintheader('Installing MySQL database', 1); ?> Installation is now completed. To log in to kPlaylist, reload this page (firm reload) and you should be able to log in. All settings and configuration is available via WEB, click the 'Settings' button to the right. The default kPlaylist login is admin with admin as the password. Would you like to send the following information about this successful installation? This would give the kPlaylist site valuable information about supported systems, but also to increase the motivation knowing that this script actually is used. Thank you! Remember to visit http://www.kplaylist.net for updates and help. '.$errors); } function kinstall_selectmethod() { global $PHP_SELF; kprintheader('Install', 1); ?> Welcome to the kPlaylist installer! To install kPlaylist, you'll need a working and running copy of MySQL. This is a GPL product, please read the disclaimer of liability before you continue. If you do not agree with the disclaimer you must abort the installation and use of this product. Click on one of the following installation methods to continue: PS! If you are running kPlaylist on your own machine, the suggested method is to create a new database. Manual upgrade necessary Please enter a user and a password who has access to create a new database and a user for kPlaylist. In most cases, the root user of MySQL should be used. Please open the kPlaylist file in a text editor and modify the section called $db to suit your database settings. Click 'Reload' when you are done. Click here to view what the installer is going to do. Click 'Continue' when ready to install ! Note! The root password will only be used to create the tables, a new user called with password will be created for the operation of kPlaylist. If you like to change the name and password for this user, please edit the script, and click Reload. '.$text.''; ?> MySQL user: value="" class="fatbuttom"/> default: MySQL password: value="" class="fatbuttom"/> default: If you need to change the settings below, please edit them in the script and click Reload. MySQL host: MySQL database: Table prepend You'll find documentation here: kPlaylist Homepage Could not login with the supplied user name and password! MySQL said: '.$err.''; if ($errno == 1251) $msg .= 'Seems like you are running MySQL 4.1. Please go to the following location to read the solution: http://www.kplaylist.net/forum/viewtopic.php?p=2231'; kinstall_show_form($msg, $dbmethod); } } else if (isset($_POST['usedatabase']) || isset($_POST['newdatabase']) || isset($_POST['instmethod'])) { kinstall_show_form('', $dbmethod); } else if (isset($_GET['showgpl'])) { kprintheader(); echo 'The GPL license is available here: http://www.kplaylist.net/COPYING'; kprintend(); } else if (isset($_GET['showsql'])) { kprintheader(); showsql(); kprintend(); } else kinstall_selectmethod(); die(); } if ($enable_install) kinstall_handler(); function show_upgrade($sql, $error="") { global $db, $dbi, $PHP_SELF; kprintheader(); ?> kPlaylist database upgrader. We are sorry for the inconvience, but there are some changes in the database in this new version of kPlaylist and we have to perform a simple upgrade. Please supply a user who has access to alter the MySQL database (usually the root user of MySQL.). You can also run the SQL calls listed below manually and reload this page. Errors during upgrade, please check the errors below and try again. SQL call(s) we will be executing: ', $sql[$i]).';'; } ?> MySQL database: MySQL host: If either the database name or the host is wrong, please edit the script and reload this page. MySQL user: MySQL password: load(); kprintheader(); ?> kPlaylist database upgrader. Upgrading performed successfully. Enjoy your new version of kPlaylist. Reload this page to get started. Would you like to send the following information about this successful upgrade? This would give the kPlaylist site valuable information about supported systems, but also to increase the motivation knowing that this script actually is used. Thank you! get('lamecmd'); if (!empty($lc)) { if (crc32($lc) != 237452143 && $lc != $cfg['lamecmd']) { $stxt = 'Due to security reasons, the lame command is no longer available in the settings, and you have to edit the kPlaylist file manually to suit your existing setup. Please change the $cfg[\'lamecmd\'] in the kPlaylist file or create a kpconfig file (look here) and change it to this: '; $stxt .= '$cfg[\'lamecmd\'] = \''.str_replace("'", "\'", $lc).'\';'; $stxt .= 'When you are finished, press F5.'; manual_upgrade($stxt); die(); } else $setctl->set('lamecmd', ''); } } $cnt = 0; $update_sql = check_all_tables($cnt); if ($cnt == 0) kinstall_handler(); if (count($update_sql) > 0) { $error = ""; if (isset($_POST['executeupgrade'])) { $dbi['user'] = $_POST['mysqluser']; $dbi['pass'] = $_POST['mysqlpass']; $link = mysql_connect($db['host'], $dbi['user'], $dbi['pass'], true); if ($link) { $mysqlserverv = mysql_get_server_info($link); $sqls = check_all_tables($cnt); if (mysql_select_db($db['name'],$link)) { for ($i=0,$c=count($sqls);$i<$c;$i++) { if (!empty($sqls[$i])) { if (!mysql_query($sqls[$i], $link)) { $error = "Could not execute: ".$sqls[$i]."MySQL said: ".mysql_error($link).""; break; } } } } else $error = "Could not select the database name"; } else $error = "Could not connect. Please check that the username or password is correct."; if (empty($error)) upgrade_ok(); } show_upgrade(check_all_tables($cnt),$error); } else { $sql = 'update '.TBL_KPLAYVERSION.' set app_build = "'.$app_build.'", app_ver = "'.$app_ver.'"'; db_execcheck($sql); } } function kprintlogin($msg = '') { global $app_ver, $app_build, $PHP_SELF, $phpenv; ?> '.get_lang(41).''; ?> www.kplaylist.net listid = -1; $this->name = ''; $this->status = false; $res = db_execquery('SELECT * FROM '.TBL_PLAYLIST.' WHERE listid = '.$listid); if ($res && mysql_num_rows($res) > 0) { $row = mysql_fetch_assoc($res); $this->status = $row['status']; $this->name = $row['name']; $this->listid = $listid; } } function getres() { return db_execquery('SELECT sid FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$this->listid.' ORDER BY seq ASC'); } function play() { if ($this->listid >= 0) { $result = $this->getres(); if ($result && mysql_num_rows($result) > 0) { $tunes = array(); $i=0; while ($row = mysql_fetch_row($result)) $tunes[$i++] = $row[0]; $cnt = $i; if ($this->status) { srand ((double)microtime()*1000000); for ($j=count($tunes)-1; $j>0; $j--) { if (($i = rand(0,$j))<$j) { $swp=$tunes[$i]; $tunes[$i]=$tunes[$j]; $tunes[$j]=$swp; } } } $m3ug = new m3ugenerator(); for ($i=0;$i<$cnt;$i++) $m3ug->sendlink2($tunes[$i]); $m3ug->start(); return true; } } return false; } } function playlist_createnew($name,$shared=0) { global $u_id; if (db_execquery('INSERT INTO '.TBL_PLAYLIST.' SET name = "'.$name.'", u_id = '.$u_id.', public = '.$shared)) return 1; return 0; } function playlist_delete($nr) { db_execquery('DELETE FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$nr); db_execquery('DELETE FROM '.TBL_PLAYLIST.' WHERE listid = '.$nr); } function pl_sortoriginal($id) { $result = db_execquery('SELECT id from '.TBL_PLAYLIST_LIST.' WHERE listid = '.$id.' ORDER BY ID ASC'); $seq = 1; while ($row = mysql_fetch_row($result)) { $id = $row[0]; db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$seq.' WHERE id = '.$id, true); $seq++; } } function pl_removeduplicates($playlist_id) { $result = db_execquery('SELECT sid,id from '.TBL_PLAYLIST_LIST.' WHERE listid = '.$playlist_id.' ORDER BY ID ASC'); $sids = array(); while ($row = mysql_fetch_row($result)) { $sid = $row[0]; $id = $row[1]; if (isset($sids[$sid])) db_execquery('DELETE FROM '.TBL_PLAYLIST_LIST.' WHERE id = '.$id, true); $sids[$sid] = true; } playlist_rewriteseq($playlist_id); } function pl_sortrandom($id) { $result = db_execquery('SELECT id from '.TBL_PLAYLIST_LIST.' WHERE listid = '.$id.' ORDER BY ID ASC'); srand(make_seed()); while ($row = mysql_fetch_row($result)) db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.getrand().' WHERE id = '.$row[0], true); playlist_rewriteseq($id); } function pl_sortalphabetic($id) { $result = db_execquery('SELECT pl.id as id FROM '.TBL_PLAYLIST_LIST.' pl, '.TBL_SEARCH.' s WHERE pl.listid = '.$id.' and pl.sid = s.id order by s.free asc'); $seq = 1; while ($row = mysql_fetch_row($result)) { db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$seq.' WHERE id = '.$row[0], true); $seq++; } } function db_addtoplaylist($playlistnr, $tunes) { global $u_id, $base_dir; $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$playlistnr); $row = mysql_num_rows($result); $cntr=$row; $cntr++; if (count($tunes) > 0) { for ($i=0,$c=count($tunes);$i<$c;$i++) { $f2 = new file2($tunes[$i]); if ($f2->ifexists()) { db_execquery('INSERT INTO '.TBL_PLAYLIST_LIST.' (listid, sid, seq) VALUES ('.$playlistnr.', '.$f2->sid.', '. $cntr.')'); $cntr++; } } } } function db_readplaylist($playlistnr) { global $u_id; $result = db_execquery('SELECT list FROM '.TBL_PLAYLIST.' WHERE u_id = '.$u_id.' AND listid = '.$playlistnr); $row = mysql_fetch_array($result); return $row['list']; } function playlist_rewriteseq($plid) { if (is_numeric($plid)) { $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$plid.' ORDER BY seq ASC'); if (mysql_num_rows($result) > 0) { $cntr=1; while ($row = mysql_fetch_array($result)) { db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$cntr.' WHERE id = '.$row['id'], true); $cntr++; } } } } function playlist_savesequence($seqlist, $id) { global $u_id; $result = db_execquery('SELECT id FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$id.' ORDER BY seq ASC'); $data = array(); $cnt=0; while ($row = mysql_fetch_array($result)) { $data['id'][$cnt] = $row['id']; $data['seq'][$cnt] = (int)$seqlist[$cnt]; $cnt++; } if ($cnt > 0) { for ($i=0;$i<$cnt;$i++) db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$data['seq'][$i].' WHERE id = '.$data['id'][$i]); playlist_rewriteseq($id); } } function playlist_editor($plid, $prev, $sort = 0) { global $PHP_SELF,$u_cookieid, $base_dir, $u_id, $runinit,$phpenv, $cfg; kprintheader(get_lang(59), 1); $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST.' WHERE listid = '.$plid); if ($result) { $row = mysql_fetch_array($result); $name = $row['name']; $public = $row['public']; if ($row['u_id'] == $u_id || db_guinfo('u_access') == 0) $myown = 1; else $myown = 0; $shuffle = $row['status']; } $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$plid.' ORDER BY seq ASC'); if ($result) $many = mysql_num_rows($result); else $many = 0; $playlistlink = ''. ''. ''. ''; $code = ''; $code .= ' ". $playlistlink. ' '; if ($myown) $code .= " "; if (ALLOWDOWNLOAD && db_guinfo('u_allowdownload') && $cfg['archivemode']) $code .= ' '; if ($myown) $code .= ' '; if ($myown) { $code .= ''.get_lang(44).' '. get_lang(125).' '. ''; $e = array(0 => '', 1 => '', 2 => '', 3 => ''); $e[$sort] = ' selected="selected"'; $code .= ' '. ''.get_lang(170).''. ''.get_lang(171).''. ''.get_lang(173).''. ''.get_lang(180).''. ''; $code .= ' '; } $code .= ' '; if (UNAUTHORIZEDSTREAMS) $code .= 'i'; $code .= ''; echo ''; blackbox(get_lang(46, $name, $many),$code,0); echo ''; echo ''; echo ''; if ($myown) echo blackboxpart(get_lang(47),1); else echo blackboxpart(get_lang(48),1); $out = ''; if ($many > 0) { echo ''; echo ''; echo ''; echo ''; echo ' '.get_lang(49).' '.get_lang(50).' '.get_lang(51).' '.get_lang(52).' '; if ($myown) echo get_lang(53); echo ' '.get_lang(54).' '; echo ''; echo ''; echo ''; $totplaytime = $count = $countfails = 0; while ($row = mysql_fetch_array($result)) { $count++; $id = $row['id']; $f2 = new file2($row['sid'], true); if (!$f2) continue; $fexists = $f2->ifexists(); $id3 = $f2->getid3(); if (($count % 2) == 0) echo ''; else echo ''; echo ' '; if ($myown) echo ''; else echo lzero($row['seq']); echo ''; $idv3info = ''; if (!$fexists) { echo ''.get_lang(182).''; $countfails++; } else { if (!empty($id3['bitrate']) && !empty($id3['length'])) $idv3info = $id3['bitrate'].'kb - '.$id3['length']; if (is_numeric($id3['lengths'])) $totplaytime += $id3['lengths']; echo get_lang(181); } echo ''.$idv3info.''; echo ''; if ($myown) echo ' '.get_lang(43).' '; echo ''; if ($fexists) echo ''.$f2->gentitle(array('title', 'artist'), 70).''; else echo ' '; echo ''; } ?> '.get_lang(56).''; echo ''; $secs = $totplaytime; $days = floor($secs/86400); $secs = $secs % 86400; $hours = floor($secs/3600); $secs = $secs % 3600; $min = floor($secs/60); $secs = $secs % 60; $totshow = get_lang(187, $days, $hours, $min, $secs); echo ''.$totshow.''; echo ' '; echo ''; echo ''. ' '.get_lang(73).' '. ' '. get_lang(57).' '; if ($myown) echo ' '.get_lang(58).' '; echo ' '; echo ''; } if ($myown) echo blackboxpart(get_lang(47),2); else echo blackboxpart(get_lang(48),2); echo '
block so the print_r's are readable. // define('OGG_SHOW_DEBUG', true); class ogg { /* * ogg - A Class for reading Ogg comment tags * * By Sandy McArthur, Jr. * * Copyright 2001 (c) All Rights Reserved, All Responsibility Yours * * This code is released under the GNU LGPL Go read it over here: * http://www.gnu.org/copyleft/lesser.html * * I do make one optional request, I would like an account on or a * copy of where this code is used. If that is not possible then * an email would be cool. * * Warning: I really hope this doesn't mess up your Ogg files but you * are on your own if bad things happen. * * To use this code first create a new instance on a file. Then loop * though the $ogg->fields array. Inside that loop, loop again. The * ogg comment format allows mome then one field with the same name * so it is possible for the ARTIST fields to appear twice if a work * has two performers. * * eg: * require_once('class.ogg.php'); * $ogg = new ogg('/path/to/filename.ogg'); * echo ''; * foreach ($ogg->fields AS $name => $val) { * echo "$name:"; * foreach ($val AS $contents) { * echo '', $contents; * } * echo ''; * } * echo ''; * * This site was useful to me: * http://www.xiph.org/ogg/vorbis/docs.html * * Change Log: * 0.10: Clean up for release. * 0.01: Got off my ass and wrote something until it works enough. * * Thanks To: * * TODO: * Collect nifty info like bitrate, etc... * Maybe implement ogg comment writer. We'll see I don't like using php * to manipulate large amounts of data. * * The most recent version is available at: * http://Leknor.com/code/ * */ /* * ogg constructor - creates a new ogg object * * $file - the path to the ogg file. When in doubt use a full path. */ function ogg($file) { $this->file = false; // ogg file name (you should never modify this) $this->_version = 0.10; // Version of the ogg class (float, not major/minor) $this->fields = array(); // comments fields, this is a two dimentional array. $this->_rawfields = array(); // The comments fields read and split but not orgainzed. $this->error = false; // Check here for an error message $this->debug = false; // print debugging info? $this->debugbeg = ''; $this->debugend = ''; if (defined('OGG_SHOW_DEBUG')) $this->debug = true; if ($this->debug) print($this->debugbeg . "ogg('$file')\n"); $this->file = $file; $this->_read(); if ($this->debug) print($this->debugend); } // ogg($file) /* * _read() - finds the comment in a ogg stream. You should not call this. */ function _read() { if ($this->debug) print($this->debugbeg . "_read()\n"); if (! ($f = fopen($this->file, 'rb')) ) { $this->error = 'Unable to open ' . $file; if ($this->debug) print("$this->error$this->debugend"); return false; } $this->_find_page($f); $this->_find_page($f); fseek($f, 26 - 4, SEEK_CUR); $segs = fread($f, 1); $segs = unpack('C1size', $segs); $segs = $segs['size']; if ($this->debug) print("segs: $segs"); fseek($f, $segs, SEEK_CUR); // Skip preable //$r = fread($f, 1); //print_r(unpack('H*raw', $r)); fseek($f, 7, SEEK_CUR); // Skip Vendor $size = fread($f, 4); $size = unpack('V1size', $size); $size = $size['size']; if ($this->debug) print("vendor size: $size"); fseek($f, $size, SEEK_CUR); // Comments $comments = fread($f, 4); $comments = unpack('V1comments', $comments); $comments = $comments['comments']; if ($this->debug) print("Comments: $comments"); for ($i=0; $i < $comments; $i++) { $size = fread($f, 4); $size = unpack('V1size', $size); $size = $size['size']; if ($this->debug) print("comment size: $size"); $comment = fread($f, $size); if ($this->debug) print("comment: $comment"); $comment = explode('=', $comment, 2); $this->fields[strtoupper($comment[0])][] = $comment[1]; $this->_rawfields[] = $comment; } if ($this->debug) print($this->debugend); } // _read() /* * _find_page - seeks to the next ogg page start. */ function _find_page(&$f) { if ($this->debug) print($this->debugbeg . "_find_page($f)\n"); $header = 'OggS'; // 0xf4 . 0x67 . 0x 67 . 0x53 $bytes = fread($f, 4); while ($header != $bytes) { //if ($this->debug) print('.'); $bytes = substr($bytes, 1); $bytes .= fread($f, 1); } if ($this->debug) { echo 'Page found at byte: ', ftell($f) - 4, ''; print($this->debugend); } } // _find_page(&$file) } // end of class ogg $cssthemes[0] = ' body { background-color: #FFFFFF; color: #000000; margin-top: 10px; margin-left: 10px; margin-right: 5px; margin-bottom: 5px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px } .smalltext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #FFFFFF; color: #003333 } .tblbulletin { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #FFFFFF; color: #000000; border: 1px #000000; border-style: solid } .row2nd { background-color : #dcdef4 } .tdlogin { background-color : #000000 } .logintext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; color: #FFFFFF; background-color: #000000 } .loginkplaylist { color: #BBBBBB; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px } .statistics { color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8px } a:hover.hot { color: #EF610C; text-decoration: underline; font-style: normal } .warning { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal } .notice { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000000 } .fatbuttom { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #FFFFFF; border: 1px #000000; border-style: solid } .fatfield { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #dcdef4; border: 1px #000000; border-style: solid } .logonbuttom { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; background-color: #000000; border: 1px #CCCCCC solid; color: #FFFFFF } .wtext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000000 } .text { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; color: #FFFFFF } .dir { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; color: #030670 } .finfo { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #333333 } a { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000000; text-decoration: none } .file { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #000066 } .filemarked { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small; font-style: normal; color: #EF6100 } .curdir { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; color: #000000; text-decoration: none } .userfield { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: xx-small } .boxhotlist { color: #BBBBBB; background-color: #EF6100; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 1px } .box { color: #BBBBBB; background-color: #4F35B3; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 1px } .tdborder { border-color: black black black #666666; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px } .importnant { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #000000 } .importnantlink { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #0000FF } .header { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #000000 } .headermarked { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; color: #EF6100 } .bbox { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: x-small; font-style: normal; color: #FFFFFF } .bboxtable { background-color: #FFFFFF }'; 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 = ' '.get_lang(34).' '; else $code = ''; blackbox(get_lang(56),''.$msg.''.$code.'',0); kprintend(); die(); } class kpdesign { function kpdesign() { $this->style = db_guinfo('theme'); $this->addform = true; } function form() { global $PHP_SELF, $runinit; ?> style) { case 0: ?> addform) $this->form(); ?> addform) $this->form(); ?> style) { case 0: echo ''; infobox(); echo ''; break; case 1: echo ''; break; } } } function compute_statistics() { $row = mysql_fetch_array(db_execquery('SELECT SUM(lengths) AS ls, COUNT(*) AS nr, SUM(fsize) AS fs FROM '.TBL_SEARCH), true); if ($row) { $secs = (int)$row['ls']; $days = floor($secs/86400); $secs = $secs % 86400; $hours = floor($secs/3600); $secs = $secs % 3600; $min = floor($secs/60); $mb = floor($row['fs'] / 1048576); return get_lang(155,$days, $hours, $min, $row['nr'],$mb); } } function endmp3table($showalbum=1, $dirs=0, $files=0, $recursive = true) { global $u_id, $PHP_SELF, $runinit, $cfg; echo ''; $text = $crstr_dl = $crstr = ''; if ($showalbum && $files > 0) { $crstr .= ' '; $crstr_dl = ' '; } if ($files > 0) $crstr .= ''; if ($dirs > 0 && $recursive) $crstr .= ' '; $crstr_dl .= '"; $playlists = db_getplaylist($u_id); $ploutput = ''; if (count($playlists)>0) { if ($files > 0) $ploutput .= ' '; $ploutput .= ''; $playid = db_guinfo("defplaylist"); for ($c=0,$cnt=count($playlists);$c<$cnt;$c++) { if ($playlists[$c][1] == $playid) $sel=' selected="selected" '; else $sel=''; $ploutput .= ''.$playlists[$c][0].''; } $ploutput .= ' '; } $ploutput .= ''; if (count($playlists)>0) { $ploutput .= ' '; $ploutput .= ' '; } $upload = ''; $ploutput .= "'; $selectallcode=' '; ?> 0) echo ''.blackbox(get_lang(73), $selectallcode).''; if (!empty($crstr)) echo ' '.blackbox(get_lang(74), $crstr).''; if (ALLOWDOWNLOAD && db_guinfo('u_allowdownload') && $cfg['archivemode'] && $files > 0) echo ' '.blackbox(get_lang(117), $crstr_dl).''; echo ''.blackbox(get_lang(75), $ploutput).''; if (ENABLEUPLOAD) echo ''.blackbox(get_lang(234), $upload).''; ?> 0) { $out .= ''; $out .= ''; $options = array(); while ($row = mysql_fetch_assoc($res)) $options[] = array($row['listid'], $row['name']); $out .= genselect('sel_shplaylist', $options, db_guinfo('defshplaylist'), 'file'); $out .= ' '; $out .= ''; } return $out; } function infobox() { global $PHP_SELF, $u_cookieid, $u_id, $app_ver, $setctl, $u_id, $app_build, $homepage; $homepage = str_replace('KBUILD', $app_build, str_replace('KVER', $app_ver, $setctl->get('homepage'))); ?> get('showkeyteq')) { ?>'.substr(get_lang(77),0,3).''.substr(get_lang(77),3); ?>get('showupgrade')) { ?> get('showkeyteq')) echo ''; ?> v get('showstatistics')) { ?> ' maxlength="150" size="46" class="fatbuttom"/> /> /> /> /> /> > > getlatest(), 0, false, 'box', 'left', '240'); ?> updatelist(); ?> show(), 0, false, 'box', 'left', '240'); ?> '. ' '; echo blackbox(get_lang(88),$admincode, 0, false, 'box', 'left', '240'); ?> '; $othercode = ' '; $othercode .= ' '; $usermisc = ' '. ' '; $usermisc .= ' '; ?> get('includeheaders', 1, 1)) { ?> get('externaljavascript'); if (empty($extjs)) outjavascripts($js_out); else echo ''; if ($setctl->get('includeheaders', 1, 1)) { ?> get('includeheaders', 1, 1)) { $css = $setctl->get('externalcss', '', 0); if (!empty($css)) { ?> get('includeheaders', 1, 1)) echo ''; } function blackbox($title,$code,$returncode=1,$nowrap=true,$class='box',$textalign='left',$width=0) { $mix = ''. ''; $mix .= ''. ''. ''; if (!$returncode) echo $mix; else return($mix); } function blackboxpart($title, $pos) { $data = blackbox($title, '%code'); $p = strpos($data, '%code'); if ($p !== false) { if ($pos == 1) return substr($data, 0, $p); else return substr($data, $p+5); } } function outjavascripts() { ?> $db['user'], 'host' => $db['host'], 'name' => $db['name'], 'pass' => $db['pass']); $mysqlserverv = ''; function check_all_tables(&$dbcount) { global $dbtables, $dbtable, $dbalter, $installdb; $ignore = array(); if (db_gconnect()) { $sql = array(); foreach ($dbtable AS $name => $val) if (db_execquery('DESC '.$name) == false) { $sql[] = $installdb[$val]; if ($val == 5) $sql[] = $installdb[9]; $ignore[$name] = true; } else $dbcount++; foreach ($dbtables AS $name => $val) { if (!isset($ignore[$name])) { for ($i=0,$c=count($dbtables[$name]);$i<$c;$i++) if (db_execquery('SELECT '.$dbtables[$name][$i].' FROM '.$name.' LIMIT 1') == false) $sql[] = $dbalter[$name][$dbtables[$name][$i]]; } } return $sql; } } function check_version() { global $enable_tablecheck, $app_build, $oldbuild; $result = db_execcheck('SELECT * from '.TBL_KPLAYVERSION); if ($result) { $data = mysql_fetch_array($result); if (isset($data['app_build'])) { $oldbuild = (int)$data['app_build']; if ($oldbuild != $app_build) $enable_tablecheck = true; } } else $enable_tablecheck = true; } function kinstall_logo($height='64', $width='208') { return ''; } function kcheckaccess($user, $pass, &$errmsg, &$errno) { global $db; $status = 0; $link = @mysql_connect($db['host'], $user, $pass, true); if ($link) { if (@mysql_select_db($db['name'], $link)) $status = 1; else { $errmsg = mysql_error($link); $errno = mysql_errno($link); switch ($errno) { case 1049: $status = 1; break; // database not exist. OK. default: $status = 0; break; } } @mysql_close($link); } else { $errno = mysql_errno(); $errmsg = mysql_error(); } return $status; } function showsql() { global $installdb, $installdbuser; echo ''; echo ''."\n"; echo 'The installers SQL code:'; echo "\n".''; if (isset($_GET['dbi'])) $dbi = $_GET['dbi']; else $dbi = 1; if ($dbi) $start = 1; else $start = 2; for ($i=$start;$i'.str_replace("\n", '', $installdb[$i]).';'; if ($dbi) { echo ''.$installdbuser[0].';'; echo ''.$installdbuser[2].';'; } echo ''; } function show_feedback($upgrade = false) { global $app_ver, $app_build, $oldbuild, $mysqlserverv; ?> '; echo ''; } ?> Software MySQL Version Build Have a comment? An error occured during install! You can restart the installation process by opening up a new window and enter the same URL. Click here for opening the INSTALL reference. ', $installdb[$i]).''; $errors .= mysql_error($link).''; $error = $i; } } } else insterror('Could not use the database ('.$db['name'].')'); if (!$error) { kprintheader('Installing MySQL database', 1); ?> Installation is now completed. To log in to kPlaylist, reload this page (firm reload) and you should be able to log in. All settings and configuration is available via WEB, click the 'Settings' button to the right. The default kPlaylist login is admin with admin as the password. Would you like to send the following information about this successful installation? This would give the kPlaylist site valuable information about supported systems, but also to increase the motivation knowing that this script actually is used. Thank you! Remember to visit http://www.kplaylist.net for updates and help. '.$errors); } function kinstall_selectmethod() { global $PHP_SELF; kprintheader('Install', 1); ?> Welcome to the kPlaylist installer! To install kPlaylist, you'll need a working and running copy of MySQL. This is a GPL product, please read the disclaimer of liability before you continue. If you do not agree with the disclaimer you must abort the installation and use of this product. Click on one of the following installation methods to continue: PS! If you are running kPlaylist on your own machine, the suggested method is to create a new database. Manual upgrade necessary Please enter a user and a password who has access to create a new database and a user for kPlaylist. In most cases, the root user of MySQL should be used. Please open the kPlaylist file in a text editor and modify the section called $db to suit your database settings. Click 'Reload' when you are done. Click here to view what the installer is going to do. Click 'Continue' when ready to install ! Note! The root password will only be used to create the tables, a new user called with password will be created for the operation of kPlaylist. If you like to change the name and password for this user, please edit the script, and click Reload. '.$text.''; ?> MySQL user: value="" class="fatbuttom"/> default: MySQL password: value="" class="fatbuttom"/> default: If you need to change the settings below, please edit them in the script and click Reload. MySQL host: MySQL database: Table prepend You'll find documentation here: kPlaylist Homepage Could not login with the supplied user name and password! MySQL said: '.$err.''; if ($errno == 1251) $msg .= 'Seems like you are running MySQL 4.1. Please go to the following location to read the solution: http://www.kplaylist.net/forum/viewtopic.php?p=2231'; kinstall_show_form($msg, $dbmethod); } } else if (isset($_POST['usedatabase']) || isset($_POST['newdatabase']) || isset($_POST['instmethod'])) { kinstall_show_form('', $dbmethod); } else if (isset($_GET['showgpl'])) { kprintheader(); echo 'The GPL license is available here: http://www.kplaylist.net/COPYING'; kprintend(); } else if (isset($_GET['showsql'])) { kprintheader(); showsql(); kprintend(); } else kinstall_selectmethod(); die(); } if ($enable_install) kinstall_handler(); function show_upgrade($sql, $error="") { global $db, $dbi, $PHP_SELF; kprintheader(); ?> kPlaylist database upgrader. We are sorry for the inconvience, but there are some changes in the database in this new version of kPlaylist and we have to perform a simple upgrade. Please supply a user who has access to alter the MySQL database (usually the root user of MySQL.). You can also run the SQL calls listed below manually and reload this page. Errors during upgrade, please check the errors below and try again. SQL call(s) we will be executing: ', $sql[$i]).';'; } ?> MySQL database: MySQL host: If either the database name or the host is wrong, please edit the script and reload this page. MySQL user: MySQL password: load(); kprintheader(); ?> kPlaylist database upgrader. Upgrading performed successfully. Enjoy your new version of kPlaylist. Reload this page to get started. Would you like to send the following information about this successful upgrade? This would give the kPlaylist site valuable information about supported systems, but also to increase the motivation knowing that this script actually is used. Thank you! get('lamecmd'); if (!empty($lc)) { if (crc32($lc) != 237452143 && $lc != $cfg['lamecmd']) { $stxt = 'Due to security reasons, the lame command is no longer available in the settings, and you have to edit the kPlaylist file manually to suit your existing setup. Please change the $cfg[\'lamecmd\'] in the kPlaylist file or create a kpconfig file (look here) and change it to this: '; $stxt .= '$cfg[\'lamecmd\'] = \''.str_replace("'", "\'", $lc).'\';'; $stxt .= 'When you are finished, press F5.'; manual_upgrade($stxt); die(); } else $setctl->set('lamecmd', ''); } } $cnt = 0; $update_sql = check_all_tables($cnt); if ($cnt == 0) kinstall_handler(); if (count($update_sql) > 0) { $error = ""; if (isset($_POST['executeupgrade'])) { $dbi['user'] = $_POST['mysqluser']; $dbi['pass'] = $_POST['mysqlpass']; $link = mysql_connect($db['host'], $dbi['user'], $dbi['pass'], true); if ($link) { $mysqlserverv = mysql_get_server_info($link); $sqls = check_all_tables($cnt); if (mysql_select_db($db['name'],$link)) { for ($i=0,$c=count($sqls);$i<$c;$i++) { if (!empty($sqls[$i])) { if (!mysql_query($sqls[$i], $link)) { $error = "Could not execute: ".$sqls[$i]."MySQL said: ".mysql_error($link).""; break; } } } } else $error = "Could not select the database name"; } else $error = "Could not connect. Please check that the username or password is correct."; if (empty($error)) upgrade_ok(); } show_upgrade(check_all_tables($cnt),$error); } else { $sql = 'update '.TBL_KPLAYVERSION.' set app_build = "'.$app_build.'", app_ver = "'.$app_ver.'"'; db_execcheck($sql); } } function kprintlogin($msg = '') { global $app_ver, $app_build, $PHP_SELF, $phpenv; ?> '.get_lang(41).''; ?> www.kplaylist.net listid = -1; $this->name = ''; $this->status = false; $res = db_execquery('SELECT * FROM '.TBL_PLAYLIST.' WHERE listid = '.$listid); if ($res && mysql_num_rows($res) > 0) { $row = mysql_fetch_assoc($res); $this->status = $row['status']; $this->name = $row['name']; $this->listid = $listid; } } function getres() { return db_execquery('SELECT sid FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$this->listid.' ORDER BY seq ASC'); } function play() { if ($this->listid >= 0) { $result = $this->getres(); if ($result && mysql_num_rows($result) > 0) { $tunes = array(); $i=0; while ($row = mysql_fetch_row($result)) $tunes[$i++] = $row[0]; $cnt = $i; if ($this->status) { srand ((double)microtime()*1000000); for ($j=count($tunes)-1; $j>0; $j--) { if (($i = rand(0,$j))<$j) { $swp=$tunes[$i]; $tunes[$i]=$tunes[$j]; $tunes[$j]=$swp; } } } $m3ug = new m3ugenerator(); for ($i=0;$i<$cnt;$i++) $m3ug->sendlink2($tunes[$i]); $m3ug->start(); return true; } } return false; } } function playlist_createnew($name,$shared=0) { global $u_id; if (db_execquery('INSERT INTO '.TBL_PLAYLIST.' SET name = "'.$name.'", u_id = '.$u_id.', public = '.$shared)) return 1; return 0; } function playlist_delete($nr) { db_execquery('DELETE FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$nr); db_execquery('DELETE FROM '.TBL_PLAYLIST.' WHERE listid = '.$nr); } function pl_sortoriginal($id) { $result = db_execquery('SELECT id from '.TBL_PLAYLIST_LIST.' WHERE listid = '.$id.' ORDER BY ID ASC'); $seq = 1; while ($row = mysql_fetch_row($result)) { $id = $row[0]; db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$seq.' WHERE id = '.$id, true); $seq++; } } function pl_removeduplicates($playlist_id) { $result = db_execquery('SELECT sid,id from '.TBL_PLAYLIST_LIST.' WHERE listid = '.$playlist_id.' ORDER BY ID ASC'); $sids = array(); while ($row = mysql_fetch_row($result)) { $sid = $row[0]; $id = $row[1]; if (isset($sids[$sid])) db_execquery('DELETE FROM '.TBL_PLAYLIST_LIST.' WHERE id = '.$id, true); $sids[$sid] = true; } playlist_rewriteseq($playlist_id); } function pl_sortrandom($id) { $result = db_execquery('SELECT id from '.TBL_PLAYLIST_LIST.' WHERE listid = '.$id.' ORDER BY ID ASC'); srand(make_seed()); while ($row = mysql_fetch_row($result)) db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.getrand().' WHERE id = '.$row[0], true); playlist_rewriteseq($id); } function pl_sortalphabetic($id) { $result = db_execquery('SELECT pl.id as id FROM '.TBL_PLAYLIST_LIST.' pl, '.TBL_SEARCH.' s WHERE pl.listid = '.$id.' and pl.sid = s.id order by s.free asc'); $seq = 1; while ($row = mysql_fetch_row($result)) { db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$seq.' WHERE id = '.$row[0], true); $seq++; } } function db_addtoplaylist($playlistnr, $tunes) { global $u_id, $base_dir; $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$playlistnr); $row = mysql_num_rows($result); $cntr=$row; $cntr++; if (count($tunes) > 0) { for ($i=0,$c=count($tunes);$i<$c;$i++) { $f2 = new file2($tunes[$i]); if ($f2->ifexists()) { db_execquery('INSERT INTO '.TBL_PLAYLIST_LIST.' (listid, sid, seq) VALUES ('.$playlistnr.', '.$f2->sid.', '. $cntr.')'); $cntr++; } } } } function db_readplaylist($playlistnr) { global $u_id; $result = db_execquery('SELECT list FROM '.TBL_PLAYLIST.' WHERE u_id = '.$u_id.' AND listid = '.$playlistnr); $row = mysql_fetch_array($result); return $row['list']; } function playlist_rewriteseq($plid) { if (is_numeric($plid)) { $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$plid.' ORDER BY seq ASC'); if (mysql_num_rows($result) > 0) { $cntr=1; while ($row = mysql_fetch_array($result)) { db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$cntr.' WHERE id = '.$row['id'], true); $cntr++; } } } } function playlist_savesequence($seqlist, $id) { global $u_id; $result = db_execquery('SELECT id FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$id.' ORDER BY seq ASC'); $data = array(); $cnt=0; while ($row = mysql_fetch_array($result)) { $data['id'][$cnt] = $row['id']; $data['seq'][$cnt] = (int)$seqlist[$cnt]; $cnt++; } if ($cnt > 0) { for ($i=0;$i<$cnt;$i++) db_execquery('UPDATE '.TBL_PLAYLIST_LIST.' SET seq = '.$data['seq'][$i].' WHERE id = '.$data['id'][$i]); playlist_rewriteseq($id); } } function playlist_editor($plid, $prev, $sort = 0) { global $PHP_SELF,$u_cookieid, $base_dir, $u_id, $runinit,$phpenv, $cfg; kprintheader(get_lang(59), 1); $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST.' WHERE listid = '.$plid); if ($result) { $row = mysql_fetch_array($result); $name = $row['name']; $public = $row['public']; if ($row['u_id'] == $u_id || db_guinfo('u_access') == 0) $myown = 1; else $myown = 0; $shuffle = $row['status']; } $result = db_execquery('SELECT * FROM '.TBL_PLAYLIST_LIST.' WHERE listid = '.$plid.' ORDER BY seq ASC'); if ($result) $many = mysql_num_rows($result); else $many = 0; $playlistlink = ''. ''. ''. ''; $code = ''; $code .= ' ". $playlistlink. ' '; if ($myown) $code .= " "; if (ALLOWDOWNLOAD && db_guinfo('u_allowdownload') && $cfg['archivemode']) $code .= ' '; if ($myown) $code .= ' '; if ($myown) { $code .= ''.get_lang(44).' '. get_lang(125).' '. ''; $e = array(0 => '', 1 => '', 2 => '', 3 => ''); $e[$sort] = ' selected="selected"'; $code .= ' '. ''.get_lang(170).''. ''.get_lang(171).''. ''.get_lang(173).''. ''.get_lang(180).''. ''; $code .= ' '; } $code .= ' '; if (UNAUTHORIZEDSTREAMS) $code .= 'i'; $code .= ''; echo ''; blackbox(get_lang(46, $name, $many),$code,0); echo ''; echo ''; echo ''; if ($myown) echo blackboxpart(get_lang(47),1); else echo blackboxpart(get_lang(48),1); $out = ''; if ($many > 0) { echo ''; echo ''; echo ''; echo ''; echo ' '.get_lang(49).' '.get_lang(50).' '.get_lang(51).' '.get_lang(52).' '; if ($myown) echo get_lang(53); echo ' '.get_lang(54).' '; echo ''; echo ''; echo ''; $totplaytime = $count = $countfails = 0; while ($row = mysql_fetch_array($result)) { $count++; $id = $row['id']; $f2 = new file2($row['sid'], true); if (!$f2) continue; $fexists = $f2->ifexists(); $id3 = $f2->getid3(); if (($count % 2) == 0) echo ''; else echo ''; echo ' '; if ($myown) echo ''; else echo lzero($row['seq']); echo ''; $idv3info = ''; if (!$fexists) { echo ''.get_lang(182).''; $countfails++; } else { if (!empty($id3['bitrate']) && !empty($id3['length'])) $idv3info = $id3['bitrate'].'kb - '.$id3['length']; if (is_numeric($id3['lengths'])) $totplaytime += $id3['lengths']; echo get_lang(181); } echo ''.$idv3info.''; echo ''; if ($myown) echo ' '.get_lang(43).' '; echo ''; if ($fexists) echo ''.$f2->gentitle(array('title', 'artist'), 70).''; else echo ' '; echo ''; } ?> '.get_lang(56).''; echo ''; $secs = $totplaytime; $days = floor($secs/86400); $secs = $secs % 86400; $hours = floor($secs/3600); $secs = $secs % 3600; $min = floor($secs/60); $secs = $secs % 60; $totshow = get_lang(187, $days, $hours, $min, $secs); echo ''.$totshow.''; echo ' '; echo ''; echo ''. ' '.get_lang(73).' '. ' '. get_lang(57).' '; if ($myown) echo ' '.get_lang(58).' '; echo ' '; echo ''; } if ($myown) echo blackboxpart(get_lang(47),2); else echo blackboxpart(get_lang(48),2); echo '