add_block(new Block("Upload", $this->build_upload_block(), "left", 20)); } public function display_full(Page $page) { $page->add_block(new Block("Upload", "Disk nearly full, uploads disabled", "left", 20)); } public function display_page(Page $page) { global $config; $tl_enabled = ($config->get_string("transload_engine", "none") != "none"); // Uploader 2.0! $upload_list = ""; for($i=0; $i<$config->get_int('upload_count'); $i++) { $a=$i+1; $s=$i-1; if(!$i==0){ $upload_list .=""; }else{ $upload_list .= ""; } $upload_list .= ""; if($i==0){ $upload_list .= "
" . "". "
"; }else{ $upload_list .="
". ""; if($a==$config->get_int('upload_count')){ $upload_list .=""; }else{ $upload_list .= "". ""; } $upload_list .= "
"; } $upload_list .= "
File
"; if($tl_enabled) { $upload_list .= " URL
"; } else { $upload_list .= " "; } $upload_list .= " "; } $max_size = $config->get_int('upload_size'); $max_kb = to_shorthand_int($max_size); $html = " ".make_form(make_link("upload"), "POST", $multipart=True)." $upload_list
Tags
Source
(Max file size is $max_kb) "; if($tl_enabled) { $link = make_http(make_link("upload")); if($config->get_bool('nice_urls')){ $delimiter = '?'; } else { $delimiter = '&'; } { $title = "Upload to " . $config->get_string('title'); $html .= '

' . $title . ' (Drag & drop onto your bookmarks toolbar, then click when looking at an image)'; } { /* Danbooru > Shimmie Bookmarklet. This "should" work on any site running danbooru, unless for some odd reason they switched around the id's or aren't using post/list. Most likely this will stop working when Danbooru updates to v2, all depends if they switch the ids or not >_>. Clicking the link on a danbooru image page should give you something along the lines of: 'http://www.website.com/shimmie/upload?url="http://sonohara.donmai.us/data/crazylongurl.jpg&tags="too many tags"&rating="s"&source="http://danbooru.donmai.us/post/show/012345/"' TODO: Possibly make the entire/most of the script into a .js file, and just make the bookmarklet load it on click (Something like that?) */ $title = "Danbooru to " . $config->get_string('title'); $html .= '

' . $title . ' (As above, Click on a Danbooru-run image page. (This also grabs the tags/rating/source!))'; } } $page->set_title("Upload"); $page->set_heading("Upload"); $page->add_block(new NavBlock()); $page->add_block(new Block("Upload", $html, "main", 20)); } /* only allows 1 file to be uploaded - for replacing another image file */ public function display_replace_page(Page $page, $image_id) { global $config; $tl_enabled = ($config->get_string("transload_engine", "none") != "none"); $upload_list = ''; $upload_list .= "

File
"; if($tl_enabled) { $upload_list .=" URL
"; } else { $upload_list .= " "; } $max_size = $config->get_int('upload_size'); $max_kb = to_shorthand_int($max_size); $image = Image::by_id($image_id); $thumbnail = $this->build_thumb_html($image, null); $html = "

Replacing Image ID ".$image_id."
Please note: You will have to refresh the image page, or empty your browser cache.

" .$thumbnail."
" .make_form(make_link("upload/replace/".$image_id), "POST", $multipart=True)." $upload_list
Source
(Max file size is $max_kb) "; $page->set_title("Replace Image"); $page->set_heading("Replace Image"); $page->add_block(new NavBlock()); $page->add_block(new Block("Upload Replacement Image", $html, "main", 20)); } public function display_upload_status(Page $page, $ok) { if($ok) { $page->set_mode("redirect"); $page->set_redirect(make_link()); } else { $page->set_title("Upload Status"); $page->set_heading("Upload Status"); $page->add_block(new NavBlock()); } } public function display_upload_error(Page $page, $title, $message) { $page->add_block(new Block($title, $message)); } protected 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 " ".make_form(make_link("upload"), "POST", $multipart=True)." $upload_list
(Max file size is $max_kb)
"; } } ?>