blob: 135e8aedf1a6ed88ddd8075357c6a155040f651b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
{{ define "customphp" -}}
{{ "<?php" | safeHTML }}
$q = '';
if (isset($_GET['q']) && $_GET['q'] != '') {
$q =$_GET['q'];
}
$manticore = new mysqli("127.0.0.1", "", "", "", 9306);
$q=$manticore->real_escape_string($q);
$sphinxQl="SELECT * ,SNIPPET(content,'".$q."','limit=200') as snippet FROM hugo WHERE MATCH('".$q."')";
$result = $manticore->query($sphinxQl);
?>
{{- end }}
{{ define "customheader" -}}
<div class="w3-container w3-center w3-padding-32 w3-hide-small">
<h1 class="w3-xxxlarge w3-text-blue w3-wide w3-allerta" style="text-shadow:1px 1px 0 #444" ><u>
{{ with .Site.Params.logotext }}
{{ . }}
{{ else }}
W3 SIMPLE
{{ end }}
</u></h1>
</div>
<div class="w3-content w3-center">
<div class="w3-bar w3-light-grey w3-border w3-padding">
<a href="{{ "/" | relURL }}" class="w3-bar-item w3-button w3-large w3-green w3-mobile"><i class="fa fa-home"></i></a>
<input id="searchinput" name="search" type="text" style="width: 600px;" class="w3-bar-item w3-input w3-white w3-mobile" placeholder="Search.." value="<?php echo $q;?>">
<button type="button" onclick="gosearch()" class="w3-bar-item w3-button w3-green w3-mobile">Go</button>
</div>
</div>
<script>
var input = document.getElementById("searchinput");
input.addEventListener("keyup", function(event) {
event.preventDefault();
if (event.keyCode === 13) {
gosearch();
}
});
</script>
<script>
function gosearch() {
var x;
// Get the value of the input field with id="numb"
x = document.getElementById("searchinput").value;
window.location.replace("https://jesselau.com/q/"+x);
}
</script>
{{- end }}
{{ define "main" -}}
{{ "<?php" | safeHTML }}
{{ "if ($q<>'')" | safeHTML }}
{
?>
<div id="searchresult" class="w3-content w3-card-4" >
{{ "<?php" | safeHTML }}
if (mysqli_num_rows($result)==0)
{
?>
<div class="w3-panel w3-pale-yellow w3-display-container">
<span onclick="this.parentElement.style.display='none'"
class="w3-button w3-large w3-display-topright">×</span>
<h3>No Results!</h3>
<p>There are no posts about <b>{{ "<?php echo $q;?> " | safeHTML }}</b>. Please try another keywords.</p>
</div>
{{ "<?php" | safeHTML }}
}
else
{
foreach($result as $row)
{
?>
<div class ="w3-container" >
<div class="w3-panel w3-card-2" >
<div class="w3-container">
<h4> <a href="<?php echo $row['link'];?>" > {{ "<?php echo $row['title'];?> " | safeHTML }} </a></h4>
</div>
<div class="w3-container">
<p> {{ "<?php echo $row['snippet'];?> " | safeHTML }} </p>
</div>
</div>
</div>
{{ "<?php" | safeHTML }}
}
}
?>
</div>
{{ "<?php" | safeHTML }}
}
?>
{{- end }}
{{ define "commentornotes" -}}
<div class="w3-container w3-center w3-padding-32">
<p>Search function is powered by <a href="https://manticoresearch.com/">Manticoresearch</a> | <a href="https://jesselau.com/tags/manticore/">tutorials Here</a>
</p>
</div>
{{- end }}
|