added google language and safe search settings, made the codebase prettier
|
@ -7,7 +7,16 @@
|
||||||
$query_encoded = urlencode($query);
|
$query_encoded = urlencode($query);
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
$url = "https://www.google.$config->google_domain/search?&q=$query_encoded&start=$page&hl=$config->google_language";
|
$domain = $config->google_domain;
|
||||||
|
$language = isset($_COOKIE["google_language"]) ? htmlspecialchars($_COOKIE["google_language"]) : $config->google_language;
|
||||||
|
|
||||||
|
$url = "https://www.google.$domain/search?&q=$query_encoded&start=$page&hl=$language&lr=lang_$language";
|
||||||
|
|
||||||
|
if (isset($_COOKIE["safe_search"]))
|
||||||
|
{
|
||||||
|
$url .= "&safe=medium";
|
||||||
|
}
|
||||||
|
|
||||||
$google_ch = curl_init($url);
|
$google_ch = curl_init($url);
|
||||||
curl_setopt_array($google_ch, $config->curl_settings);
|
curl_setopt_array($google_ch, $config->curl_settings);
|
||||||
curl_multi_add_handle($mh, $google_ch);
|
curl_multi_add_handle($mh, $google_ch);
|
||||||
|
|
14
search.php
|
@ -39,13 +39,13 @@
|
||||||
<input type="hidden" name="p" value="0">
|
<input type="hidden" name="p" value="0">
|
||||||
<div class="sub-search-button-wrapper">
|
<div class="sub-search-button-wrapper">
|
||||||
<?php
|
<?php
|
||||||
echo "
|
$categories = array("general", "images", "videos", "torrents", "tor");
|
||||||
<a href=\"/search.php?q=$query&p=0&t=0\"><img src=\"static/images/text_result.png\" alt=\"text result\" />General</a>
|
|
||||||
<a href=\"/search.php?q=$query&p=0&t=1\"><img src=\"static/images/image_result.png\" alt=\"image result\" />Images</a>
|
foreach ($categories as $category)
|
||||||
<a href=\"/search.php?q=$query&p=0&t=2\"><img src=\"static/images/video_result.png\" alt=\"video result\" />Videos</a>
|
{
|
||||||
<a href=\"/search.php?q=$query&p=0&t=3\"><img src=\"static/images/torrent_result.png\" alt=\"torrent result\" />Torrents</a>
|
$category_index = array_search($category, $categories);
|
||||||
<a href=\"/search.php?q=$query&p=0&t=4\"><img src=\"static/images/tor_result.png\" alt=\"tor result\" />Tor</a>
|
echo "<a href=\"/search.php?q=" . $query . "&p=0&t=" . $category_index . "\"><img src=\"static/images/" . $category . "_result.png\" alt=\"" . $category . " result\" />" . ucfirst($category) . "</a>";
|
||||||
";
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
16
settings.php
|
@ -77,7 +77,7 @@
|
||||||
</div>
|
</div>
|
||||||
<h2>Privacy friendly frontends</h2>
|
<h2>Privacy friendly frontends</h2>
|
||||||
<p>For an example if you want to view YouTube without getting spied on, click on "Invidious", find the instance that is most suitable for you then paste it in (correct format: https://example.com)</p>
|
<p>For an example if you want to view YouTube without getting spied on, click on "Invidious", find the instance that is most suitable for you then paste it in (correct format: https://example.com)</p>
|
||||||
<div class="instances-container">
|
<div class="settings-textbox-container">
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$frontends = array(
|
$frontends = array(
|
||||||
|
@ -107,6 +107,20 @@
|
||||||
<label>Disable frontends</label>
|
<label>Disable frontends</label>
|
||||||
<input type="checkbox" name="disable_frontends" <?php echo isset($_COOKIE["disable_frontends"]) ? "checked" : ""; ?> >
|
<input type="checkbox" name="disable_frontends" <?php echo isset($_COOKIE["disable_frontends"]) ? "checked" : ""; ?> >
|
||||||
</div>
|
</div>
|
||||||
|
<h2>Google settings</h2>
|
||||||
|
<div class="settings-textbox-container">
|
||||||
|
<div>
|
||||||
|
<span>Google language</span>
|
||||||
|
<?php
|
||||||
|
echo "<input type=\"text\" name=\"google_language\" placeholder=\"E.g.: de\" value=\"";
|
||||||
|
echo isset($_COOKIE["google_language"]) ? htmlspecialchars($_COOKIE["google_language"]) : $config->google_language;
|
||||||
|
?>">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label>Safe search</label>
|
||||||
|
<input type="checkbox" name="safe_search" <?php echo isset($_COOKIE["safe_search"]) ? "checked" : ""; ?> >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button type="submit" name="save" value="1">Save</button>
|
<button type="submit" name="save" value="1">Save</button>
|
||||||
<button type="submit" name="reset" value="1">Reset</button>
|
<button type="submit" name="reset" value="1">Reset</button>
|
||||||
|
|
|
@ -164,12 +164,12 @@ a:hover,
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.instances-container div {
|
.settings-textbox-container div {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin-bottom: 25px;
|
margin-bottom: 25px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.instances-container input {
|
.settings-textbox-container input {
|
||||||
color: inherit;
|
color: inherit;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
|
Before Width: | Height: | Size: 598 B After Width: | Height: | Size: 598 B |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 657 B After Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 360 B |