Exemple #1
0
 public function webfan_downloads_download($lid, &$r, $post = array(), $send_cookies = array())
 {
     $html = '';
     $html .= 'Download package...' . "\n";
     $C = new \webdof\Http\Client();
     @set_time_limit(ini_get('max_execution_time'));
     $idfile = time() . mt_rand(1000, 9999);
     $r = $C->request('http://www.webfan.de/dl/get.php?lid=' . $lid . '&idfile=' . $idfile, 'POST', $post, $send_cookies, E_USER_WARNING);
     @set_time_limit(ini_get('max_execution_time'));
     if (intval($r['status']) !== 200) {
         $html .= $this->e($this->lang('__DOWNLOAD_FAILED__'));
         return $html;
     }
     $check = sha1($r['body']);
     $url_checksum = 'http://www.webfan.de/dl/get.php?lid=' . $lid . '&ressource=checksum&';
     $url_checksum .= 'sha1=' . $check . '&idfile=' . $idfile;
     $checkfile = $C->SimpleGet($url_checksum);
     $checksum_server = trim($checkfile);
     if ($check !== $checksum_server) {
         $r['status'] = 409;
         $html .= $this->e($this->lang('__CHECKSUM_INVALID__'));
         return $html;
     }
     return $html;
 }