$files = array(); $result2 = mysql_query("SELECT * FROM files WHERE FilmID={$film} ORDER BY Path"); $mirrors = array(); while ($result2 && ($field2 = mysql_fetch_assoc($result2))) { $tmp = $field2; unset($tmp['Path'], $tmp['Marked'], $tmp['MD5'], $tmp['FilmID']); $ftp = ""; if (isset($config['ftp']) && $config['modes'][$user['Mode']]['ftp'] == 1) { $ftp = str_replace($config['source'], $config['ftp'], $field2["Path"]); if (isset($config['ftp_license']) && $config['ftp_license']) { $v = getLeechProtectionCode(array($film, $field2["ID"], $user['ID'])); $tmp["ftp_license"] = "pl.php?player=ftp&uid={$user['ID']}&filmid={$film}&fileid=" . $field2["ID"] . "&v={$v}"; } else { $tmp["ftp"] = $ftp; if (isset($config['enc_ftpforclient'])) { $tmp["ftp"] = my_convert_cyr_string($tmp["ftp"], "w", $config['enc_ftpforclient']); } $is_ie = preg_match("/(MSIE)/i", $_SERVER['HTTP_USER_AGENT']) && !preg_match("/(opera|gecko)/i", $_SERVER['HTTP_USER_AGENT']); if (!(isset($config['do_not_escape_link_for_ie']) && $config['do_not_escape_link_for_ie'] && $is_ie)) { $t = explode("/", $tmp["ftp"]); for ($i = 3; $i < count($t); $i++) { $t[$i] = rawurlencode($t[$i]); } $tmp["ftp"] = implode("/", $t); } } } $url = $ftp ? $ftp : "smb:" . str_replace($config['source'], $config['smb'], $field2["Path"]); $url = parse_url($url); $tmp["mirror"] = isset($url["host"]) ? $url["host"] : ""; $mirrors[$tmp["mirror"]] = 1;
function getMetaInfo($path, $size = 0, $disableMplayer = false) { global $config; if (!$this->getID3) { if (!class_exists("getID3")) { require_once dirname(dirname(__FILE__)) . "/getid3/getid3.php"; } $this->getID3 = new getID3(); } $ext = $this->getDirExtension($path); $path_dec = my_convert_cyr_string($path, "w", $ext["encoding"]); $tmpfname = null; if (preg_match("/^ftp:\\/\\//i", $path_dec)) { $urlparts = parse_url($path_dec); $urlparts["username"] = $ext["login"]; $urlparts["password"] = $ext["password"]; $path_dec = $this->buildUrl($urlparts); $fd = fopen($path_dec, "rb"); if ($fd) { $contents = ""; while (!feof($fd) && strlen($contents) < 32768) { $contents .= fread($fd, 32768); } fclose($fd); $tmpfname = tempnam("/tmp", "FOO"); $handle = fopen($tmpfname, "w"); fwrite($handle, $contents); fclose($handle); } } $extensionsForMplayerUse = @$config['mplayer_extensions'] ? $config['mplayer_extensions'] : array('mp4'); $extension = pathinfo($path_dec, PATHINFO_EXTENSION); if (!$disableMplayer && in_array($extension, $extensionsForMplayerUse)) { require_once dirname(dirname(__FILE__)) . "/common/mplayer.php"; $mplayer = new Mplayer(@$config['mplayer'] ? $config['mplayer'] : 'mplayer'); $ThisFileInfo = $mplayer->analyze($tmpfname ? $tmpfname : $path_dec); } else { $this->getID3->option_max_2gb_check = true; $ThisFileInfo = $this->getID3->analyze($tmpfname ? $tmpfname : $path_dec); getid3_lib::CopyTagsToComments($ThisFileInfo); if (!isset($ThisFileInfo['video']) && !isset($ThisFileInfo['audio']) && !$disableMplayer) { require_once dirname(dirname(__FILE__)) . "/common/mplayer.php"; $mplayer = new Mplayer(@$config['mplayer'] ? $config['mplayer'] : 'mplayer'); $ThisFileInfo = $mplayer->analyze($tmpfname ? $tmpfname : $path_dec); } } if ($tmpfname) { unlink($tmpfname); } return $ThisFileInfo; }
$i = 1; while ($result && ($field = mysql_fetch_assoc($result))) { $path = str_replace($config['source'], $config['smb'], $field["Path"]); if ($path[0] == '/') { $path = "smb:" . $path; } $name = $field["Name"]; echo "\nFile" . $i++ . "=" . $path; } } break; case "xspf": header("Content-type: video/xspf"); header('Content-Disposition: attachment; filename="playlist.xspf"'); echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\" xmlns:vlc=\"http://www.videolan.org/vlc/playlist/ns/0/\">\n<trackList>"; if ($filmid) { $sql = "SELECT files.Path as Path, files.Name as Name FROM films INNER JOIN files ON (films.ID = files.FilmID) WHERE films.ID = '{$filmid}' {$wherefile} ORDER BY files.Name"; $result = mysql_query($sql); while ($result && ($field = mysql_fetch_assoc($result))) { $path = str_replace($config['source'], $config['smb'], $field["Path"]); if ($path[0] == '/') { $path = str_replace("/", "\\", $path); } $path = htmlspecialchars(my_convert_cyr_string($path, 'w', 'UTF-8')); $name = htmlspecialchars(my_convert_cyr_string($field["Name"], 'w', 'UTF-8')); echo "\n<track>\n <title>{$name}</title>\n <location>{$path}</location>\n</track>\n"; } } echo "\n</trackList>\n</playlist>"; break; }