add_block(new Block("Upload", $this->build_upload_block(), "left", 20));
}
public function display_page($page) {
global $config;
$tl_enabled = ($config->get_string("transload_engine", "none") != "none");
$upload_list = "";
for($i=0; $i<$config->get_int('upload_count'); $i++) {
$n = $i + 1;
$width = $tl_enabled ? "35%" : "80%";
$upload_list .= "
File $n |
|
";
if($tl_enabled) {
$upload_list .= "
URL $n |
|
";
}
$upload_list .= "
";
}
$max_size = $config->get_int('upload_size');
$max_kb = to_shorthand_int($max_size);
$html = "
(Max file size is $max_kb)
";
$page->set_title("Upload");
$page->set_heading("Upload");
$page->add_block(new NavBlock());
$page->add_block(new Block("Upload", $html, "main", 20));
}
public function display_upload_status($page, $ok) {
if($ok) {
$page->set_mode("redirect");
$page->set_redirect(make_link("post/list"));
}
else {
$page->set_title("Upload Status");
$page->set_heading("Upload Status");
$page->add_block(new NavBlock());
}
}
public function display_upload_error($page, $title, $message) {
$page->add_block(new Block($title, $message));
}
private function build_upload_block() {
global $config;
$upload_list = "";
for($i=0; $i<$config->get_int('upload_count'); $i++) {
if($i == 0) $style = ""; // "style='display:visible'";
else $style = "style='display:none'";
$upload_list .= "\n";
}
$max_size = $config->get_int('upload_size');
$max_kb = to_shorthand_int($max_size);
//
return "
(Max file size is $max_kb)
";
}
}
?>