コード例 #1
0
ファイル: Unhandled.class.php プロジェクト: jramstedt/AVM
 private function getTorrentData($torrentFile)
 {
     $stream = @file_get_contents($torrentFile, FILE_BINARY);
     if ($stream == false) {
         $this->addInfo(Kernel::INFOBOX_ERROR, $object->torrent . ' could not be loaded!');
         return NULL;
     }
     $data = BDecode::decode($stream);
     if ($data === false) {
         $this->addInfo(Kernel::INFOBOX_ERROR, 'Error in file. Not valid BEncoded Data.');
         return NULL;
     } else {
         if (!isset($data['info'])) {
             $this->addInfo(Kernel::INFOBOX_ERROR, 'Error in file. Not a valid torrent file.');
             return NULL;
         }
     }
     return $data;
 }
コード例 #2
0
ファイル: BDecode.php プロジェクト: r4kib/cyberfun-xbtit
function BDecode($wholefile)
{
    $decoder = new BDecode();
    $return = $decoder->decodeEntry($wholefile);
    return $return[0];
}
コード例 #3
0
 public static function fromString($str)
 {
     $decoder = new BDecode();
     $return = $decoder->decodeEntry($str);
     return $return[0];
 }