diff options
author | Colin Smith <colin@pfsense.org> | 2005-05-30 03:20:26 +0000 |
---|---|---|
committer | Colin Smith <colin@pfsense.org> | 2005-05-30 03:20:26 +0000 |
commit | 3a6cd22a65855c22876c2e4168ca7a3f8e725a4b (patch) | |
tree | d59add754004c9b810b2d4d160c0d04f24b00d53 /usr/local/www/guiconfig.inc | |
parent | 5763777e0a6313c0af3ade66eadb45ba5a4bd024 (diff) | |
download | pfsense-3a6cd22a65855c22876c2e4168ca7a3f8e725a4b.zip pfsense-3a6cd22a65855c22876c2e4168ca7a3f8e725a4b.tar.gz |
Remove cURL functions.
Diffstat (limited to 'usr/local/www/guiconfig.inc')
-rwxr-xr-x | usr/local/www/guiconfig.inc | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index 7dbdc44..d97061b 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -514,108 +514,6 @@ function update_if_changed($varname, & $orig, $new) { return false; } -function download_file_with_progress_bar($url_file, $destination_file) { - global $ch, $fout, $file_size, $downloaded, $counter; - $file_size = 1; - $downloaded = 1; - /* open destination file */ - $fout = fopen($destination_file, "wb"); - - /* - Originally by Author: Keyvan Minoukadeh - Modified by Scott Ullrich to return Content-Length size - */ - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url_file); - curl_setopt($ch, CURLOPT_HEADERFUNCTION, 'read_header'); - curl_setopt($ch, CURLOPT_WRITEFUNCTION, 'read_body'); - curl_setopt($ch, CURLOPT_NOPROGRESS, '1'); - - curl_exec($ch); - fclose($fout); - curl_close($ch); - - return 1; -} - -function read_header($ch, $string) { - global $file_size, $ch, $fout; - $length = strlen($string); - ereg("(Content-Length:) (.*)", $string, $regs); - if($regs[2] <> "") { - $file_size = intval($regs[2]); - } - return $length; -} - -function read_body($ch, $string) { - global $fout, $file_size, $downloaded, $counter, $sendto, $static_output, $lastseen; - $length = strlen($string); - $downloaded += intval($length); - $downloadProgress = round(100 * (1 - $downloaded / $file_size), 0); - $downloadProgress = 100 - $downloadProgress; - /* - lastseen is used to prevent from spamming firefox with hundreds of - unnecessary javascript update messages which sends the clients - firefox utilization to 100% - */ - if($lastseen <> $downloadProgress and $downloadProgress < 101) { - if($sendto == "status") { - $tostatus = $static_status . $downloadProgress . "%"; - update_status($tostatus); - } else { - $tooutput = $static_output . $downloadProgress . "%"; - update_output_window($tooutput); - } - update_progress_bar($downloadProgress); - $lastseen = $downloadProgress; - } - fwrite($fout, $string); - return $length; -} - -function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = 'http://ftp2.freebsd.org/pub/FreeBSD/ports/i386/packages-5.4-release/Latest') { - global $pkgent, $static_status, $static_output, $g, $fd_log; - $pkg_extension = strrchr($filename, '.'); - $static_output .= "\n" . str_repeat(" ", $dependlevel * 2) . $pkgname . " "; - $fetchto = "/tmp/apkg_" . $pkgname . $pkg_extension; - download_file_with_progress_bar($base_url . "/" . $filename, $fetchto); -// update_output_window($static_output . "\n\n" . $pkg_progress); - exec("/usr/bin/bzcat {$fetchto} | /usr/bin/tar -O -f - -x +CONTENTS", $slaveout); - $workingdir = preg_grep("/instmp/", $slaveout); - $workingdir = $workingdir[0]; - $raw_depends_list = array_values(preg_grep("/\@pkgdep/", $slaveout)); - if($raw_depends_list != "") { - if($pkgent['exclude_dependency'] != "") - $raw_depends_list = array_values(preg_grep($pkent['exclude_dependency'], PREG_GREP_INVERT)); - foreach($raw_depends_list as $adepend) { - $working_depend = explode(" ", $adepend); - //$working_depend = explode("-", $working_depend[1]); - $depend_filename = $working_depend[1] . $pkg_extension; - exec("ls /var/db/pkg", $is_installed); - $pkg_installed = false; - foreach($is_installed as $is_inst) { - if($is_inst == $working_depend[1]) { - $pkg_installed = true; - break; - } - } -// $is_installed = array_values(preg_grep("/\b{$working_depend[0]}\b/i", $is_installed)); - if($pkg_installed === false) { - pkg_fetch_recursive($working_depend[1], $depend_filename, $dependlevel + 1, $base_url); - } else { - $dependlevel++; - $static_output .= "\n" . str_repeat(" ", $dependlevel * 2) . $working_depend[1] . " "; - fwrite($fd_log, $working_depend[1] . "\n"); - } - } - } - exec("cat {$g['tmp_path']}/y | /usr/sbin/pkg_add -fv {$fetchto} 2>&1", $pkgaddout); - fwrite($fd_log, $pkgname . " " . print_r($pkgaddout, true) . "\n"); - return true; -} - function address_to_pconfig($adr, &$padr, &$pmask, &$pnot, &$pbeginport, &$pendport) { if (isset($adr['any'])) |