curl might not be installed

This commit is contained in:
Shish 2010-07-26 22:48:15 +01:00
parent c0cebccb27
commit 9bd19fe320

View File

@ -110,17 +110,20 @@ class Upload implements Extension {
} }
if($event instanceof SetupBuildingEvent) { if($event instanceof SetupBuildingEvent) {
$tes = array();
$tes["Disabled"] = "none";
if(function_exists("curl_init")) {
$tes["cURL"] = "curl";
}
$tes["fopen"] = "fopen";
$tes["WGet"] = "wget";
$sb = new SetupBlock("Upload"); $sb = new SetupBlock("Upload");
$sb->position = 10; $sb->position = 10;
$sb->add_int_option("upload_count", "Max uploads: "); $sb->add_int_option("upload_count", "Max uploads: ");
$sb->add_shorthand_int_option("upload_size", "<br>Max size per file: "); $sb->add_shorthand_int_option("upload_size", "<br>Max size per file: ");
$sb->add_bool_option("upload_anon", "<br>Allow anonymous uploads: "); $sb->add_bool_option("upload_anon", "<br>Allow anonymous uploads: ");
$sb->add_choice_option("transload_engine", array( $sb->add_choice_option("transload_engine", $tes, "<br>Transload: ");
"Disabled" => "none",
"cURL" => "curl",
"fopen" => "fopen",
"WGet" => "wget"
), "<br>Transload: ");
$event->panel->add_block($sb); $event->panel->add_block($sb);
} }
@ -209,7 +212,7 @@ class Upload implements Extension {
fclose($fp); fclose($fp);
} }
if($config->get_string("transload_engine") == "curl") { if($config->get_string("transload_engine") == "curl" && function_exists("curl_init")) {
$ch = curl_init($url); $ch = curl_init($url);
$fp = fopen($tmp_filename, "w"); $fp = fopen($tmp_filename, "w");