extra stuff
git-svn-id: file:///home/shish/svn/shimmie2/trunk@1140 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
		
							parent
							
								
									c166630b57
								
							
						
					
					
						commit
						a9cb92e163
					
				| @ -8,10 +8,10 @@ | |||||||
| 
 | 
 | ||||||
| class AutoComplete implements Extension { | class AutoComplete implements Extension { | ||||||
| 	public function receive_event(Event $event) { | 	public function receive_event(Event $event) { | ||||||
| 		if(($event instanceof PageRequestEvent) && ($event->page_matches("index") || $event->page_matches("view"))) { | 		if(($event instanceof PageRequestEvent) && ($event->page_name == "index" || $event->page_name == "view")) { | ||||||
| 			$event->page->add_header("<script>autocomplete_url='".html_escape(make_link("autocomplete"))."';</script>"); | 			$event->page->add_header("<script>autocomplete_url='".html_escape(make_link("autocomplete"))."';</script>"); | ||||||
| 		} | 		} | ||||||
| 		if(($event instanceof PageRequestEvent) && $event->page_matches("autocomplete")) { | 		if(($event instanceof PageRequestEvent) && ($event->page_name == "autocomplete")) { | ||||||
| 			$event->page->set_mode("data"); | 			$event->page->set_mode("data"); | ||||||
| 			$event->page->set_type("text/plain"); | 			$event->page->set_type("text/plain"); | ||||||
| 			$event->page->set_data($this->get_completions($event->get_arg(0))); | 			$event->page->set_data($this->get_completions($event->get_arg(0))); | ||||||
|  | |||||||
| @ -30,7 +30,7 @@ class BrowserSearch implements Extension { | |||||||
| 		} | 		} | ||||||
| 		 | 		 | ||||||
| 		// The search.xml file that is generated on the fly
 | 		// The search.xml file that is generated on the fly
 | ||||||
| 		if(($event instanceof PageRequestEvent) && $event->page_matches("browser_search/please_dont_use_this_tag_as_it_would_break_stuff__search.xml")) { | 		if(($event instanceof PageRequestEvent) && ($event->page_name == "browser_search") && $event->get_arg(0) == "please_dont_use_this_tag_as_it_would_break_stuff__search.xml") { | ||||||
| 			// First, we need to build all the variables we'll need
 | 			// First, we need to build all the variables we'll need
 | ||||||
| 			 | 			 | ||||||
| 			$search_title = $config->get_string('title'); | 			$search_title = $config->get_string('title'); | ||||||
| @ -58,12 +58,7 @@ class BrowserSearch implements Extension { | |||||||
| 			$page->set_mode("data"); | 			$page->set_mode("data"); | ||||||
| 			$page->set_type("text/xml"); | 			$page->set_type("text/xml"); | ||||||
| 			$page->set_data($xml); | 			$page->set_data($xml); | ||||||
| 		} | 		} else if(($event instanceof PageRequestEvent) && ($event->page_name == "browser_search") && !$config->get_bool("disable_search_suggestions")) { // We need to return results!
 | ||||||
| 		 |  | ||||||
| 		else if(($event instanceof PageRequestEvent) && ( |  | ||||||
| 				$event->page_matches("browser_search") && |  | ||||||
| 				!$config->get_bool("disable_search_suggestions") |  | ||||||
| 		)) { |  | ||||||
| 			global $database; | 			global $database; | ||||||
| 			 | 			 | ||||||
| 			// We have to build some json stuff
 | 			// We have to build some json stuff
 | ||||||
|  | |||||||
| @ -83,11 +83,7 @@ class ImageBan implements Extension { | |||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 				else if($event->get_arg(0) == "list") { | 				else if($event->get_arg(0) == "list") { | ||||||
| 					$page_num = 0; | 					$this->theme->display_Image_hash_Bans($event->page, $this->get_image_hash_bans()); | ||||||
| 					if($event->count_args() == 2) { |  | ||||||
| 						$page_num = int_escape($event->get_arg(1)); |  | ||||||
| 					} |  | ||||||
| 					$this->theme->display_Image_hash_Bans($event->page, $page_num, $this->get_image_hash_bans($page_num)); |  | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| @ -128,12 +124,10 @@ class ImageBan implements Extension { | |||||||
| 
 | 
 | ||||||
| 	// DB funness
 | 	// DB funness
 | ||||||
| 
 | 
 | ||||||
| 	public function get_image_hash_bans($page, $size=1000) { | 	public function get_image_hash_bans() { | ||||||
| 		// FIXME: many
 | 		// FIXME: many
 | ||||||
| 		$size_i = int_escape($size); |  | ||||||
| 		$offset_i = int_escape($page)*$size_i; |  | ||||||
| 		global $database; | 		global $database; | ||||||
| 		$bans = $database->get_all("SELECT * FROM image_bans LIMIT $size_i OFFSET $offset_i"); | 		$bans = $database->get_all("SELECT * FROM image_bans"); | ||||||
| 		if($bans) {return $bans;} | 		if($bans) {return $bans;} | ||||||
| 		else {return array();} | 		else {return array();} | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ class ImageBanTheme extends Themelet { | |||||||
| 	 *  'date' => when the ban started | 	 *  'date' => when the ban started | ||||||
| 	 * ) | 	 * ) | ||||||
| 	 */ | 	 */ | ||||||
| 	public function display_image_hash_bans($page, $page_number, $bans) { | 	public function display_image_hash_bans($page, $bans) { | ||||||
| 		$h_bans = ""; | 		$h_bans = ""; | ||||||
| 		foreach($bans as $ban) { | 		foreach($bans as $ban) { | ||||||
| 			$h_bans .= " | 			$h_bans .= " | ||||||
| @ -50,20 +50,10 @@ class ImageBanTheme extends Themelet { | |||||||
| 				</tr> | 				</tr> | ||||||
| 			</table> | 			</table> | ||||||
| 		";
 | 		";
 | ||||||
| 
 |  | ||||||
| 		$prev = $page_number - 1; |  | ||||||
| 		$next = $page_number + 1; |  | ||||||
| 
 |  | ||||||
| 		$h_prev = ($page_number <= 1) ? "Prev" : "<a href='".make_link("image_hash_ban/list/$prev")."'>Prev</a>"; |  | ||||||
| 		$h_index = "<a href='".make_link()."'>Index</a>"; |  | ||||||
| 		$h_next = "<a href='".make_link("image_hash_ban/list/$next")."'>Next</a>"; |  | ||||||
| 
 |  | ||||||
| 		$nav = "$h_prev | $h_index | $h_next"; |  | ||||||
| 
 |  | ||||||
| 		$page->set_title("Image Bans"); | 		$page->set_title("Image Bans"); | ||||||
| 		$page->set_heading("Image Bans"); | 		$page->set_heading("Image Bans"); | ||||||
|  | 		$page->add_block(new NavBlock()); | ||||||
| 		$page->add_block(new Block("Edit Image Bans", $html)); | 		$page->add_block(new Block("Edit Image Bans", $html)); | ||||||
| 		$page->add_block(new Block("Navigation", $nav, "left", 0)); |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* | 	/* | ||||||
|  | |||||||
| @ -9,7 +9,7 @@ | |||||||
| class Tagger implements Extension { | class Tagger implements Extension { | ||||||
| 	var $theme; | 	var $theme; | ||||||
| 	 | 	 | ||||||
| 	public function receive_event(Event $event) { | 	public function receive_event ($event) { | ||||||
| 		if(is_null($this->theme)) | 		if(is_null($this->theme)) | ||||||
| 			$this->theme = get_theme_object($this); | 			$this->theme = get_theme_object($this); | ||||||
| 			 | 			 | ||||||
| @ -43,7 +43,10 @@ add_event_listener(new Tagger()); | |||||||
| // Tagger AJAX back-end
 | // Tagger AJAX back-end
 | ||||||
| class TaggerXML implements Extension { | class TaggerXML implements Extension { | ||||||
| 	public function receive_event(Event $event) { | 	public function receive_event(Event $event) { | ||||||
| 		if(($event instanceof PageRequestEvent) && $event->page_matches("tagger/tags")) { | 		if(($event instanceof PageRequestEvent) | ||||||
|  | 			&& $event->page_name == "tagger" | ||||||
|  | 			&& $event->get_arg(0) == "tags") | ||||||
|  | 		{ | ||||||
| 			global $page; | 			global $page; | ||||||
| 			 | 			 | ||||||
| 			//$match_tags = null;
 | 			//$match_tags = null;
 | ||||||
| @ -52,9 +55,9 @@ class TaggerXML implements Extension { | |||||||
| 			if (isset($_GET['s'])) { // tagger/tags[/...]?s=$string
 | 			if (isset($_GET['s'])) { // tagger/tags[/...]?s=$string
 | ||||||
| 				// return matching tags in XML form
 | 				// return matching tags in XML form
 | ||||||
| 				$tags = $this->match_tag_list($_GET['s']); | 				$tags = $this->match_tag_list($_GET['s']); | ||||||
| 			} else if($event->get_arg(0)) { // tagger/tags/$int
 | 			} else if($event->get_arg(1)) { // tagger/tags/$int
 | ||||||
| 				// return arg[1] AS image_id's tag list in XML form
 | 				// return arg[1] AS image_id's tag list in XML form
 | ||||||
| 				$tags = $this->image_tag_list($event->get_arg(0)); | 				$tags = $this->image_tag_list($event->get_arg(1)); | ||||||
| 			} | 			} | ||||||
| 			 | 			 | ||||||
| 			$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n". | 			$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n". | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user