Add option to search builds using regex
This commit is contained in:
		
							
								
								
									
										22
									
								
								listid.php
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								listid.php
									
									
									
									
									
								
							| @@ -1,6 +1,6 @@ | ||||
| <?php | ||||
| /* | ||||
| Copyright 2019 UUP dump API authors | ||||
| Copyright 2019 whatever127 | ||||
|  | ||||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| you may not use this file except in compliance with the License. | ||||
| @@ -142,11 +142,22 @@ function uupListIds($search = null, $sortByDate = 0) { | ||||
|     } | ||||
|  | ||||
|     if($search) { | ||||
|         $searchSafe = preg_quote($search, '/'); | ||||
|         if(preg_match('/^".*"$/', $searchSafe)) { | ||||
|             $searchSafe = preg_replace('/^"|"$/', '', $searchSafe); | ||||
|         if(!preg_match('/^regex:/', $search)) { | ||||
|             $searchSafe = preg_quote($search, '/'); | ||||
|  | ||||
|             if(preg_match('/^".*"$/', $searchSafe)) { | ||||
|                 $searchSafe = preg_replace('/^"|"$/', '', $searchSafe); | ||||
|             } else { | ||||
|                 $searchSafe = str_replace(' ', '.*', $searchSafe); | ||||
|             } | ||||
|         } else { | ||||
|             $searchSafe = str_replace(' ', '.*', $searchSafe); | ||||
|             $searchSafe = preg_replace('/^regex:/', '', $search); | ||||
|         } | ||||
|  | ||||
|         //I really hope that this will not backfire at me | ||||
|         @preg_match("/$searchSafe/", ""); | ||||
|         if(preg_last_error()) { | ||||
|             return array('error' => 'SEARCH_NO_RESULTS'); | ||||
|         } | ||||
|  | ||||
|         foreach($builds as $key => $val) { | ||||
| @@ -172,4 +183,3 @@ function uupListIds($search = null, $sortByDate = 0) { | ||||
|         'builds' => $builds, | ||||
|     ); | ||||
| } | ||||
| ?> | ||||
|   | ||||
| @@ -16,7 +16,7 @@ limitations under the License. | ||||
| */ | ||||
|  | ||||
| function uupApiVersion() { | ||||
|     return '1.27.3'; | ||||
|     return '1.28.0'; | ||||
| } | ||||
|  | ||||
| require_once dirname(__FILE__).'/auths.php'; | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								shared/packs/3694794dad29fd02b78a9bc1334afb6a8843fae7.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/3694794dad29fd02b78a9bc1334afb6a8843fae7.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/3838bc96a67729859d49c6ddf9e317854405002a.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/3838bc96a67729859d49c6ddf9e317854405002a.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/a29f01a216590abcf25e99bb7fa44eb27c02ec53.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/a29f01a216590abcf25e99bb7fa44eb27c02ec53.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								shared/packs/f28009fb910556b56b9b0bb82e309dcb6b494f45.json.gz
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								shared/packs/f28009fb910556b56b9b0bb82e309dcb6b494f45.json.gz
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Reference in New Issue
	
	Block a user