danbooru api: fix uploaded filename, other small stuff
git-svn-id: file:///home/shish/svn/shimmie2/trunk@397 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
		
							parent
							
								
									cbb1dc4be9
								
							
						
					
					
						commit
						2e78d1689a
					
				@ -123,7 +123,7 @@ class DanbooruApi extends Extension
 | 
				
			|||||||
				if(isset($_FILES['file']))
 | 
									if(isset($_FILES['file']))
 | 
				
			||||||
				{	// A file was POST'd in
 | 
									{	// A file was POST'd in
 | 
				
			||||||
					$file = $_FILES['file']['tmp_name'];
 | 
										$file = $_FILES['file']['tmp_name'];
 | 
				
			||||||
					$filename = $file['name'];
 | 
										$filename = $_FILES['file']['name'];
 | 
				
			||||||
					// If both a file is posted and a source provided, I'm assuming source is the source of the file
 | 
										// If both a file is posted and a source provided, I'm assuming source is the source of the file
 | 
				
			||||||
					$source = isset($_REQUEST['source']) ? $_REQUEST['source'] : "";
 | 
										$source = isset($_REQUEST['source']) ? $_REQUEST['source'] : "";
 | 
				
			||||||
				} elseif(isset($_REQUEST['source']))
 | 
									} elseif(isset($_REQUEST['source']))
 | 
				
			||||||
@ -207,7 +207,7 @@ class DanbooruApi extends Extension
 | 
				
			|||||||
				if(!is_null($existing)) {
 | 
									if(!is_null($existing)) {
 | 
				
			||||||
					header("HTTP/1.0 409 Conflict");
 | 
										header("HTTP/1.0 409 Conflict");
 | 
				
			||||||
					header("X-Danbooru-Errors: duplicate");
 | 
										header("X-Danbooru-Errors: duplicate");
 | 
				
			||||||
					$existinglink = "http://" . $_SERVER['HTTP_HOST'] . make_link("post/view/" . $existing->id);
 | 
										$existinglink = make_link("post/view/" . $existing->id);
 | 
				
			||||||
					header("X-Danbooru-Location: $existinglink");
 | 
										header("X-Danbooru-Location: $existinglink");
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -216,6 +216,7 @@ class DanbooruApi extends Extension
 | 
				
			|||||||
				send_event($nevent);
 | 
									send_event($nevent);
 | 
				
			||||||
				// Did something screw up?
 | 
									// Did something screw up?
 | 
				
			||||||
				if($event->vetoed) {
 | 
									if($event->vetoed) {
 | 
				
			||||||
 | 
										header("HTTP/1.0 409 Conflict");
 | 
				
			||||||
					header("X-Danbooru-Errors: $event->veto_reason");
 | 
										header("X-Danbooru-Errors: $event->veto_reason");
 | 
				
			||||||
					return;
 | 
										return;
 | 
				
			||||||
				} else
 | 
									} else
 | 
				
			||||||
@ -232,6 +233,7 @@ class DanbooruApi extends Extension
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			} else 
 | 
								} else 
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
									header("HTTP/1.0 409 Conflict");
 | 
				
			||||||
				header("X-Danbooru-Errors: authentication error");
 | 
									header("X-Danbooru-Errors: authentication error");
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user