Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
function BDecode($wholefile)
{
    $decoder = new BDecode();
    $return = $decoder->decodeEntry($wholefile);
    return $return[0];
}
 public static function fromString($str)
 {
     $decoder = new BDecode();
     $return = $decoder->decodeEntry($str);
     return $return[0];
 }