open note if search is a perfect match on title
This commit is contained in:
		
							parent
							
								
									1aeaffde97
								
							
						
					
					
						commit
						6d87adb4d5
					
				
							
								
								
									
										14
									
								
								index.php
								
								
								
								
							
							
						
						
									
										14
									
								
								index.php
								
								
								
								
							| 
						 | 
					@ -231,12 +231,20 @@
 | 
				
			||||||
						if (($_GET['param'] && isset($_GET['search'])) || isset($_GET['tags']))
 | 
											if (($_GET['param'] && isset($_GET['search'])) || isset($_GET['tags']))
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							$content = file_get_contents($path . '.md');
 | 
												$content = file_get_contents($path . '.md');
 | 
				
			||||||
 | 
												if (
 | 
				
			||||||
							if ((isset($_GET['search']) && !str_contains(strtolower($content), strtolower($param)) && !str_contains(strtolower($name), strtolower($param)))
 | 
													// param does not match content or title
 | 
				
			||||||
								|| (isset($_GET['tags']) && !preg_match('/tags:.*' . $param . '/i', $content)))
 | 
													(isset($_GET['search']) && !str_contains(strtolower($content), strtolower($param)) && !str_contains(strtolower($name), strtolower($param))) ||
 | 
				
			||||||
 | 
													// param does not match tags	
 | 
				
			||||||
 | 
													(isset($_GET['tags']) && !preg_match('/tags:.*' . $param . '/i', $content))
 | 
				
			||||||
 | 
												)
 | 
				
			||||||
							{
 | 
												{
 | 
				
			||||||
								continue;
 | 
													continue;
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
 | 
												else if (isset($_GET['search']) && $param == $name)
 | 
				
			||||||
 | 
												{
 | 
				
			||||||
 | 
													header('Location: index.php?open=true¶m=' . urlencode($name));
 | 
				
			||||||
 | 
													die();
 | 
				
			||||||
 | 
												}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
 | 
											echo '<div><a href=index.php?open=true¶m=' . urlencode($name) . '>' . $name .'</a>';
 | 
				
			||||||
						if (isset($content) && isset($_GET['tags']))
 | 
											if (isset($content) && isset($_GET['tags']))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue