Version 1.5.1
- [fix] Updated help.php, removed incorrect colorscheme information - [fix] Typo in text output for goosle-cron.php - [fix] Various php errors/warnings in goosle-cron.php - [fix] Url formatting for php function special searches
This commit is contained in:
parent
a5740b3dea
commit
cb36f0a3b9
|
@ -23,8 +23,8 @@ button { cursor:pointer; }
|
|||
a { text-decoration:none; color:var(--link); }
|
||||
a:hover { text-decoration:underline; }
|
||||
small { padding:5px 0; color:var(--meta); font-size:.8rem; }
|
||||
|
||||
input[type="text"]:invalid ~ input[type="submit"] { opacity:0.5; pointer-events:none; }
|
||||
|
||||
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -webkit-mask-image:url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMy40MSwxMmw0LjMtNC4yOWExLDEsMCwxLDAtMS40Mi0xLjQyTDEyLDEwLjU5LDcuNzEsNi4yOUExLDEsMCwwLDAsNi4yOSw3LjcxTDEwLjU5LDEybC00LjMsNC4yOWExLDEsMCwwLDAsMCwxLjQyLDEsMSwwLDAsMCwxLjQyLDBMMTIsMTMuNDFsNC4yOSw0LjNhMSwxLDAsMCwwLDEuNDIsMCwxLDEsMCwwLDAsMC0xLjQyWiIgZmlsbD0iIzY1NjNmZiIvPjwvc3ZnPg=="); }
|
||||
|
||||
/* Page structure */
|
||||
|
|
|
@ -46,7 +46,7 @@ class DefinitionRequest extends EngineRequest {
|
|||
if(empty($json_response)) return $engine_result;
|
||||
|
||||
// No results
|
||||
if(array_key_exists('title', $json_response)) return $engine_result;
|
||||
if(!array_key_exists('title', $json_response)) return $engine_result;
|
||||
|
||||
// Grab first result if there are multiple
|
||||
$result = $json_response[0];
|
||||
|
|
|
@ -12,13 +12,15 @@
|
|||
class PHPnetRequest extends EngineRequest {
|
||||
public function get_request_url() {
|
||||
$query = str_replace('%22', '\"', $this->query);
|
||||
|
||||
// Format query/url for php.net
|
||||
$query = str_replace('php ', '', $query);
|
||||
$query = str_replace('_', '-', $query);
|
||||
|
||||
// Is there no query left? Bail!
|
||||
if(empty($query)) return false;
|
||||
|
||||
$url = 'https://www.php.net/manual/function.'.urlencode($query);
|
||||
$url = 'https://www.php.net/manual/function.'.urlencode($query).'.php';
|
||||
|
||||
unset($query);
|
||||
|
||||
|
@ -61,7 +63,7 @@ class PHPnetRequest extends EngineRequest {
|
|||
// Required
|
||||
'title' => "Function: ".sanitize($title),
|
||||
'text' => "<p><em><small>".sanitize($php_versions)."</small></em></p><p>".sanitize($purpose)."</p><p>".highlight_string("<?php ".sanitize($usage)." ?>", 1)."</p><p>".$summary."</p>",
|
||||
'source' => "https://www.php.net/manual/function.".urlencode($query)
|
||||
'source' => "https://www.php.net/manual/function.".urlencode($query).".php"
|
||||
);
|
||||
}
|
||||
unset($response, $xpath, $scrape);
|
||||
|
|
|
@ -17,7 +17,7 @@ function check_update() {
|
|||
$cache_file = ABSPATH.'cache/version.data';
|
||||
|
||||
// Currently installed version
|
||||
$current_version = "1.5";
|
||||
$current_version = "1.5.1";
|
||||
|
||||
if(!is_file($cache_file)) {
|
||||
// Create update cache file if it doesn't exist
|
||||
|
@ -28,6 +28,9 @@ function check_update() {
|
|||
$version = unserialize(file_get_contents($cache_file));
|
||||
}
|
||||
|
||||
// TODO: Remove in a future version
|
||||
if(!isset($version['current'])) $version['current'] = "1.5.1";
|
||||
|
||||
// Update check, every week
|
||||
if($version['checked'] < time() - 604800) {
|
||||
$response = do_curl_request(
|
||||
|
@ -58,7 +61,7 @@ function show_version() {
|
|||
$version = unserialize(file_get_contents($cache_file));
|
||||
|
||||
// TODO: Remove in a future version
|
||||
if(!isset($version['current'])) $version['current'] = "1.5";
|
||||
if(!isset($version['current'])) $version['current'] = "1.5.1";
|
||||
|
||||
// Format current version for footer
|
||||
$show_version = "<a href=\"https://github.com/adegans/Goosle/\" target=\"_blank\">Goosle ".$version['current']."</a>.";
|
||||
|
|
|
@ -26,7 +26,7 @@ $auth = (isset($_GET['a'])) ? sanitize($_GET['a']) : $opts->user_auth;
|
|||
if(verify_hash($opts->hash_auth, $opts->hash, $auth)) {
|
||||
// Check for updates
|
||||
check_update();
|
||||
echo "Update cached updated!<br />";
|
||||
echo "Update cache updated!<br />";
|
||||
|
||||
// Clear out old cached files?
|
||||
if($opts->cache_type == 'file') {
|
||||
|
@ -45,19 +45,27 @@ if(verify_hash($opts->hash_auth, $opts->hash, $auth)) {
|
|||
|
||||
// Is the token expired?
|
||||
if($registration['expires'] < time()) {
|
||||
$new_token = do_curl_request(
|
||||
$response = do_curl_request(
|
||||
'https://api.openverse.org/v1/auth_tokens/token/', // (string) Where?
|
||||
array('Accept: application/json, */*;q=0.8', 'User-Agent: '.$opts->user_agents[0].';', 'Authorization: Bearer'.$registration['client_id']), // (array) Headers
|
||||
'post', // (string) post/get
|
||||
array('grant_type' => 'client_credentials', 'client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret']) // (assoc array) Post body
|
||||
);
|
||||
$new_token = json_decode($new_token, true);
|
||||
$json_response = json_decode($response, true);
|
||||
|
||||
$new_token['expires_in'] = time() + ($new_token['expires_in'] - 3600);
|
||||
|
||||
oauth_store_token($token_file, 'openverse', array('client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret'], 'access_token' => $new_token['access_token'], 'expires' => $new_token['expires_in']));
|
||||
|
||||
echo "New Openverse token stored!<br />";
|
||||
// Got a response
|
||||
if(!empty($json_response)) {
|
||||
// Got some data?
|
||||
if(array_key_exists('access_token', $json_response)) {
|
||||
|
||||
$json_response['expires_in'] = time() + ($json_response['expires_in'] - 3600);
|
||||
|
||||
oauth_store_token($token_file, 'openverse', array('client_id' => $registration['client_id'], 'client_secret' => $registration['client_secret'], 'access_token' => $json_response['access_token'], 'expires' => $json_response['expires_in']));
|
||||
|
||||
echo "New Openverse token stored!<br />";
|
||||
}
|
||||
}
|
||||
unset($response, $json_response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
3
help.php
3
help.php
|
@ -170,8 +170,7 @@ if(verify_hash($opts->hash_auth, $opts->hash, $auth)) {
|
|||
<p>Most browsers ask that you add <strong>%s</strong> for the search query as shown in the examples. If your browser has a different value for this simply replace %s with what your browser requires.
|
||||
|
||||
<h2>Colorschemes</h2>
|
||||
<p>Goose comes with several colorschemes. If you don't like the selected colorscheme you can override it with the <strong>c</strong> argument in your search url. For example: <strong>https://example.com/?c=dark</strong>.</p>
|
||||
<p>You can add this to your bookmark too to always override the colorscheme.</p>
|
||||
<p>Goose comes with several colorschemes, configurable through the config.php file.</p>
|
||||
|
||||
<h3>Available colorschemes are:</h3>
|
||||
<ol>
|
||||
|
|
|
@ -50,7 +50,7 @@ if(verify_hash($opts->hash_auth, $opts->hash, $auth)) {
|
|||
<h1><span class="goosle-g">G</span>oosle</h1>
|
||||
|
||||
<form action="results.php" method="get" autocomplete="off">
|
||||
<input tabindex="10" type="search" class="search-field" name="q" autofocus />
|
||||
<input tabindex="10" type="search" class="search-field" name="q" required autofocus />
|
||||
<input type="hidden" name="a" value="<?php echo $opts->hash; ?>"/>
|
||||
|
||||
<div class="search-buttons">
|
||||
|
|
|
@ -124,7 +124,13 @@ You can post your questions on Github Discussions or say hi on [Mastodon](https:
|
|||
- Sometimes TV Show episodes on the box office are not properly merged despite all required data matching.
|
||||
|
||||
## Changelog
|
||||
1.5 - June ??, 2024
|
||||
1.5.1 - June 22, 2024
|
||||
- [fix] Updated help.php, removed incorrect colorscheme information
|
||||
- [fix] Typo in text output for goosle-cron.php
|
||||
- [fix] Various php errors/warnings in goosle-cron.php
|
||||
- [fix] Url formatting for php function special searches
|
||||
|
||||
1.5 - June 19, 2024
|
||||
- NOTICE: config.default.php has changed, re-create your config.php!!
|
||||
- [fix] No longer caches empty results
|
||||
- [fix] No longer make a request if the search query is empty
|
||||
|
|
Loading…
Reference in a new issue