function nfostrip($nfo) { $match = array("/[^a-zA-Z0-9-+.,&=������:\"���\\/\\@\\(\\)\\s]/", "/((\r\n\\s*){3,}|(\n\\s*){3,}|(\r\\s*){3,})/", "/\r\n|\n|\r/"); $replace = array("", "<br />\n<br />\n", "<br />\n"); $nfo = preg_replace($match, $replace, trim($nfo)); return $nfo; } if (empty($_FILES["nfofile"]["name"]) && empty($_POST["nfo"])) { echo $language['rip_desc']; } // NFO STRIP FROM TEXTAREA: if (isset($_POST["submit"])) { echo "<div style=\"margin-left: 80px;\" align=\"left\">" . nfostrip($_POST["nfo"]) . "</div>"; } elseif (isset($_POST["submitup"]) && isset($_FILES["nfofile"]) && !empty($_FILES["nfofile"]["name"])) { $nfofile = $_FILES['nfofile']['tmp_name']; echo "<center>" . $language['rip_done'] . "<hr></center><div id=\"selection\" style=\"margin-left: 80px;\" align=\"left\" onclick=\"selectText()\">" . nfostrip(file_get_contents($nfofile)) . "</div><script type=\"text/javascript\">\n function selectText() {\n if (document.selection) {\n var range = document.body.createTextRange();\n range.moveToElementText(document.getElementById('selection'));\n range.select();\n }\n else if (window.getSelection) {\n var range = document.createRange();\n range.selectNode(document.getElementById('selection'));\n window.getSelection().addRange(range);\n }\n }\n </script>\n"; } if (empty($_FILES["nfofile"]["name"]) && empty($_POST["nfo"])) { ?> <center> <form enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post"> <input type="file" name="nfofile" size="20" /><input type="submit" name="submitup" value="Upload!" /> </form> <form action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post">
} if (isset($_FILES['nfo']) && !empty($_FILES['nfo']['name'])) { $nfofile = $_FILES['nfo']; if ($nfofile['size'] == 0) { throw new Exception("NFO file size to small."); } if ($nfofile['size'] > 65535) { throw new Exception("NFO file size to big."); } $nfofilename = $nfofile['tmp_name']; if (@(!is_uploaded_file($nfofilename))) { throw new Exception("NFO file upload failed."); } $nfo = str_replace("\r\r\n", "\r\n", @file_get_contents($nfofilename)); } $nfo = nfostrip($nfo); $dict = Bcode::bdec_file($tmpname, filesize($tmpname)); if (!isset($dict)) { throw new Exception("torrent file not benc coded"); } list($ann, $info) = Bcode::dict_check($dict, "announce(string):info"); $tmaker = isset($dict['value']['created by']) && !empty($dict['value']['created by']['value']) ? $dict['value']['created by']['value'] : "Unknown"; list($dname, $plen, $pieces) = Bcode::dict_check($info, "name(string):piece length(integer):pieces(string)"); if (strlen($pieces) % 20 != 0) { throw new Exception("somthing bad happend. and we dont know what."); } $filelist = array(); $totallen = Bcode::dict_get($info, "length", "integer"); if (isset($totallen)) { $filelist[] = array($dname, $totallen); $type = "single";
} function nfostrip($nfo) { $match = array("/[^a-zA-Z0-9-+.,&=זרוצײה:;*'\"ֶ״ֵ\\/\\@\\[\\]\\(\\)\\s]/", "/((\r\n\\s*){3,}|(\n\\s*){3,}|(\r\\s*){3,})/", "/\r\n|\n|\r/"); $replace = array("", "<br />\n<br />\n", "<br />\n"); $nfo = preg_replace($match, $replace, trim($nfo)); return $nfo; } stdhead("NFO Ripper"); echo "<h1>NFO Ripper</h1>"; // NFO STRIP FROM TEXTAREA: if (isset($_POST["submit"])) { echo "<div style=\"margin-left: 100px;\" align=\"left\">" . nfostrip($_POST["nfo"]) . "</div>"; } elseif (isset($_POST["submitup"]) && isset($_FILES["nfofile"]) && !empty($_FILES["nfofile"]["name"])) { $nfofile = $_FILES['nfofile']['tmp_name']; echo "<div style=\"margin-left: 100px;\" align=\"left\">" . nfostrip(file_get_contents($nfofile)) . "</div>"; } ?> <form enctype="multipart/form-data" action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post"> <input type="file" name="nfofile" size="81" /><input type="submit" name="submitup" value="Upload!" /> </form> <form action="<?php echo $_SERVER["PHP_SELF"]; ?> " method="post"> <textarea style="font-size: 11px; width: 80%; height: 200px; margin: 15px; border: 1px solid black;" name="nfo"></textarea> <br />