📱Add mobile support

This commit is contained in:
Victor Bodinaud
2025-03-18 11:26:37 +01:00
parent d70edb9f2e
commit dd78fcafd9
7 changed files with 391 additions and 226 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -4,14 +4,28 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html>
<head> <head>
<title>FrogFind!</title> <title>FrogFind!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style type="text/css">
a {
padding: 4px 0;
display: inline-block;
}
h3 {
margin-top: 16px;
}
</style>
</head> </head>
<body>
<body style="margin: 5px; padding: 0;">
<form action="/" method="get"> <form action="/" method="get">
<a href="/"><font size=6 color="#008000">Frog</font><font size=6 color="#000000">Find!</font></a> Leap again: <input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>"> <a href="/">
<font size=6 color="#008000">Frog</font>
<font size=6 color="#000000">Find!</font>
</a> Leap again: <input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>">
<input type="submit" value="Ribbbit!"> <input type="submit" value="Ribbbit!">
</form> </form>
<hr> <hr>
@@ -30,4 +44,5 @@
<h3>How can I get in touch with you?</h3> <h3>How can I get in touch with you?</h3>
Send me an email! <a href="mailto:actionretro@pm.me">actionretro@pm.me</a> Send me an email! <a href="mailto:actionretro@pm.me">actionretro@pm.me</a>
</body> </body>
</html> </html>

237
composer.lock generated
View File

@@ -8,30 +8,30 @@
"packages": [ "packages": [
{ {
"name": "fivefilters/readability.php", "name": "fivefilters/readability.php",
"version": "v3.1.6", "version": "v3.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/fivefilters/readability.php.git", "url": "https://github.com/fivefilters/readability.php.git",
"reference": "a00d35cb5eb14a236ba42326da9ac52c8c9f80a1" "reference": "2cd2d3d7b24d3df9cc1dcb8919451876c693d69b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/fivefilters/readability.php/zipball/a00d35cb5eb14a236ba42326da9ac52c8c9f80a1", "url": "https://api.github.com/repos/fivefilters/readability.php/zipball/2cd2d3d7b24d3df9cc1dcb8919451876c693d69b",
"reference": "a00d35cb5eb14a236ba42326da9ac52c8c9f80a1", "reference": "2cd2d3d7b24d3df9cc1dcb8919451876c693d69b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-xml": "*", "ext-xml": "*",
"league/uri": "~6.7.2", "league/uri": "^7.0",
"masterminds/html5": "^2.0", "masterminds/html5": "^2.0",
"php": ">=7.4.0", "php": ">=8.1",
"psr/log": "^1.0 || ^2.0 || ^3.0" "psr/log": "^1.0 || ^2.0 || ^3.0"
}, },
"require-dev": { "require-dev": {
"monolog/monolog": "^2.3", "monolog/monolog": "^3.0",
"phpunit/phpunit": "^9" "phpunit/phpunit": "^10.0 || ^11.0"
}, },
"suggest": { "suggest": {
"monolog/monolog": "Allow logging debug information" "monolog/monolog": "Allow logging debug information"
@@ -67,59 +67,50 @@
], ],
"support": { "support": {
"issues": "https://github.com/fivefilters/readability.php/issues", "issues": "https://github.com/fivefilters/readability.php/issues",
"source": "https://github.com/fivefilters/readability.php/tree/v3.1.6" "source": "https://github.com/fivefilters/readability.php/tree/v3.3.2"
}, },
"time": "2023-06-15T18:06:49+00:00" "time": "2025-03-07T18:17:00+00:00"
}, },
{ {
"name": "league/uri", "name": "league/uri",
"version": "6.7.2", "version": "7.5.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/uri.git", "url": "https://github.com/thephpleague/uri.git",
"reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06" "reference": "81fb5145d2644324614cc532b28efd0215bda430"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri/zipball/d3b50812dd51f3fbf176344cc2981db03d10fe06", "url": "https://api.github.com/repos/thephpleague/uri/zipball/81fb5145d2644324614cc532b28efd0215bda430",
"reference": "d3b50812dd51f3fbf176344cc2981db03d10fe06", "reference": "81fb5145d2644324614cc532b28efd0215bda430",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "league/uri-interfaces": "^7.5",
"league/uri-interfaces": "^2.3", "php": "^8.1"
"php": "^7.4 || ^8.0",
"psr/http-message": "^1.0"
}, },
"conflict": { "conflict": {
"league/uri-schemes": "^1.0" "league/uri-schemes": "^1.0"
}, },
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.3.2",
"nyholm/psr7": "^1.5",
"php-http/psr7-integration-tests": "^1.1",
"phpstan/phpstan": "^1.2.0",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.1.0",
"phpunit/phpunit": "^9.5.10",
"psr/http-factory": "^1.0"
},
"suggest": { "suggest": {
"ext-fileinfo": "Needed to create Data URI from a filepath", "ext-bcmath": "to improve IPV4 host parsing",
"ext-intl": "Needed to improve host validation", "ext-fileinfo": "to create Data URI from file contennts",
"league/uri-components": "Needed to easily manipulate URI objects", "ext-gmp": "to improve IPV4 host parsing",
"psr/http-factory": "Needed to use the URI factory" "ext-intl": "to handle IDN host with the best performance",
"jeremykendall/php-domain-parser": "to resolve Public Suffix and Top Level Domain",
"league/uri-components": "Needed to easily manipulate URI objects components",
"php-64bit": "to improve IPV4 host parsing",
"symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "6.x-dev" "dev-master": "7.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"League\\Uri\\": "src" "League\\Uri\\": ""
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@@ -159,8 +150,8 @@
"support": { "support": {
"docs": "https://uri.thephpleague.com", "docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com", "forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri/issues", "issues": "https://github.com/thephpleague/uri-src/issues",
"source": "https://github.com/thephpleague/uri/tree/6.7.2" "source": "https://github.com/thephpleague/uri/tree/7.5.1"
}, },
"funding": [ "funding": [
{ {
@@ -168,46 +159,44 @@
"type": "github" "type": "github"
} }
], ],
"time": "2022-09-13T19:50:42+00:00" "time": "2024-12-08T08:40:02+00:00"
}, },
{ {
"name": "league/uri-interfaces", "name": "league/uri-interfaces",
"version": "2.3.0", "version": "7.5.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/uri-interfaces.git", "url": "https://github.com/thephpleague/uri-interfaces.git",
"reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383" "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/08cfc6c4f3d811584fb09c37e2849e6a7f9b0742",
"reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383", "reference": "08cfc6c4f3d811584fb09c37e2849e6a7f9b0742",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-json": "*", "ext-filter": "*",
"php": "^7.2 || ^8.0" "php": "^8.1",
}, "psr/http-factory": "^1",
"require-dev": { "psr/http-message": "^1.1 || ^2.0"
"friendsofphp/php-cs-fixer": "^2.19",
"phpstan/phpstan": "^0.12.90",
"phpstan/phpstan-phpunit": "^0.12.19",
"phpstan/phpstan-strict-rules": "^0.12.9",
"phpunit/phpunit": "^8.5.15 || ^9.5"
}, },
"suggest": { "suggest": {
"ext-intl": "to use the IDNA feature", "ext-bcmath": "to improve IPV4 host parsing",
"symfony/intl": "to use the IDNA feature via Symfony Polyfill" "ext-gmp": "to improve IPV4 host parsing",
"ext-intl": "to handle IDN host with the best performance",
"php-64bit": "to improve IPV4 host parsing",
"symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.x-dev" "dev-master": "7.x-dev"
} }
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"League\\Uri\\": "src/" "League\\Uri\\": ""
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@@ -221,17 +210,32 @@
"homepage": "https://nyamsprod.com" "homepage": "https://nyamsprod.com"
} }
], ],
"description": "Common interface for URI representation", "description": "Common interfaces and classes for URI representation and interaction",
"homepage": "http://github.com/thephpleague/uri-interfaces", "homepage": "https://uri.thephpleague.com",
"keywords": [ "keywords": [
"data-uri",
"file-uri",
"ftp",
"hostname",
"http",
"https",
"parse_str",
"parse_url",
"psr-7",
"query-string",
"querystring",
"rfc3986", "rfc3986",
"rfc3987", "rfc3987",
"rfc6570",
"uri", "uri",
"url" "url",
"ws"
], ],
"support": { "support": {
"issues": "https://github.com/thephpleague/uri-interfaces/issues", "docs": "https://uri.thephpleague.com",
"source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0" "forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri-src/issues",
"source": "https://github.com/thephpleague/uri-interfaces/tree/7.5.0"
}, },
"funding": [ "funding": [
{ {
@@ -239,20 +243,20 @@
"type": "github" "type": "github"
} }
], ],
"time": "2021-06-28T04:27:21+00:00" "time": "2024-12-08T08:18:47+00:00"
}, },
{ {
"name": "masterminds/html5", "name": "masterminds/html5",
"version": "2.8.1", "version": "2.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Masterminds/html5-php.git", "url": "https://github.com/Masterminds/html5-php.git",
"reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf" "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f47dcf3c70c584de14f21143c55d9939631bc6cf", "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/f5ac2c0b0a2eefca70b2ce32a5809992227e75a6",
"reference": "f47dcf3c70c584de14f21143c55d9939631bc6cf", "reference": "f5ac2c0b0a2eefca70b2ce32a5809992227e75a6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -260,7 +264,7 @@
"php": ">=5.3.0" "php": ">=5.3.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8" "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@@ -304,31 +308,32 @@
], ],
"support": { "support": {
"issues": "https://github.com/Masterminds/html5-php/issues", "issues": "https://github.com/Masterminds/html5-php/issues",
"source": "https://github.com/Masterminds/html5-php/tree/2.8.1" "source": "https://github.com/Masterminds/html5-php/tree/2.9.0"
}, },
"time": "2023-05-10T11:58:31+00:00" "time": "2024-03-31T07:05:07+00:00"
}, },
{ {
"name": "psr/http-message", "name": "psr/http-factory",
"version": "1.1", "version": "1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/http-message.git", "url": "https://github.com/php-fig/http-factory.git",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba" "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"reference": "cb6ce4845ce34a8ad9e68117c10ee90a29919eba", "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.2 || ^8.0" "php": ">=7.1",
"psr/http-message": "^1.0 || ^2.0"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1.x-dev" "dev-master": "1.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@@ -343,7 +348,61 @@
"authors": [ "authors": [
{ {
"name": "PHP-FIG", "name": "PHP-FIG",
"homepage": "http://www.php-fig.org/" "homepage": "https://www.php-fig.org/"
}
],
"description": "PSR-17: Common interfaces for PSR-7 HTTP message factories",
"keywords": [
"factory",
"http",
"message",
"psr",
"psr-17",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-factory"
},
"time": "2024-04-15T12:06:14+00:00"
},
{
"name": "psr/http-message",
"version": "2.0",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "https://www.php-fig.org/"
} }
], ],
"description": "Common interface for HTTP messages", "description": "Common interface for HTTP messages",
@@ -357,22 +416,22 @@
"response" "response"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/http-message/tree/1.1" "source": "https://github.com/php-fig/http-message/tree/2.0"
}, },
"time": "2023-04-04T09:50:52+00:00" "time": "2023-04-04T09:54:51+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "3.0.0", "version": "3.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -407,18 +466,18 @@
"psr-3" "psr-3"
], ],
"support": { "support": {
"source": "https://github.com/php-fig/log/tree/3.0.0" "source": "https://github.com/php-fig/log/tree/3.0.2"
}, },
"time": "2021-07-14T16:46:02+00:00" "time": "2024-09-11T13:17:53+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": [], "stability-flags": {},
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": {},
"platform-dev": [], "platform-dev": {},
"plugin-api-version": "2.3.0" "plugin-api-version": "2.6.0"
} }

View File

@@ -28,14 +28,20 @@
<html> <html>
<head> <head>
<title>FrogFind Image Viewer</title> <title>FrogFind Image Viewer</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
</head> </head>
<body">
<small><a href="<?php echo $_SERVER['HTTP_REFERER'] ?>">< Back to previous page</a></small> <body style="margin: 5px; padding: 0;">
<small><a href="<?php echo $_SERVER['HTTP_REFERER'] ?>">
< Back to previous page</a></small>
<p><small><b>Viewing image:</b> <?php echo $url ?></small></p> <p><small><b>Viewing image:</b> <?php echo $url ?></small></p>
<img src="/image_compressed.php?i=<?php echo $url; ?>"> <img src="/image_compressed.php?i=<?php echo $url; ?>">
<br><br> <br><br>
<small><a href="<?php echo $_SERVER['HTTP_REFERER'] ?>">< Back to previous page</a></small> <small><a href="<?php echo $_SERVER['HTTP_REFERER'] ?>">
< Back to previous page</a></small>
</body> </body>
</html> </html>

View File

@@ -31,10 +31,10 @@ $raw_imagex = imagesx($raw_image);
$raw_imagey = imagesy($raw_image); $raw_imagey = imagesy($raw_image);
if ($raw_imagex >= $raw_imagey) { if ($raw_imagex >= $raw_imagey) {
$dest_imagex = 300; $dest_imagex = 240; // Réduit de 300 à 240
$dest_imagey = intval(($raw_imagey / $raw_imagex) * $dest_imagex); $dest_imagey = intval(($raw_imagey / $raw_imagex) * $dest_imagex);
} else { } else {
$dest_imagey = 200; $dest_imagey = 160; // Réduit de 200 à 160
$dest_imagex = intval(($raw_imagex / $raw_imagey) * $dest_imagey); $dest_imagex = intval(($raw_imagex / $raw_imagey) * $dest_imagey);
} }
@@ -48,5 +48,3 @@ if ($filetype = "jpg") {
} elseif ($filetype = "png") { } elseif ($filetype = "png") {
imagepng($dest_image, NULL, 8); //80% compression imagepng($dest_image, NULL, 8); //80% compression
} }
?>

View File

@@ -9,7 +9,14 @@ if(isset( $_GET['q'])) { // if there's a search query, show the results for it
$query = urlencode($_GET["q"]); $query = urlencode($_GET["q"]);
$show_results = TRUE; $show_results = TRUE;
$search_url = "https://html.duckduckgo.com/html?q=" . $query; $search_url = "https://html.duckduckgo.com/html?q=" . $query;
if(!$results_html = file_get_contents($search_url)) { $context = stream_context_create([
'http' => [
'header' => "Cache-Control: no-cache\r\n" .
"Pragma: no-cache\r\n" .
"User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 2_0 like Mac OS X) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A347 Safari/525.20\r\n"
]
]);
if (!$results_html = file_get_contents($search_url, false, $context)) {
$error_text .= "Failed to get results, sorry :( <br>"; $error_text .= "Failed to get results, sorry :( <br>";
} }
$simple_results = $results_html; $simple_results = $results_html;
@@ -43,7 +50,8 @@ if(isset( $_GET['q'])) { // if there's a search query, show the results for it
} }
//replace chars that old machines probably can't handle //replace chars that old machines probably can't handle
function clean_str($str) { function clean_str($str)
{
$str = str_replace("", "'", $str); $str = str_replace("", "'", $str);
$str = str_replace("", "'", $str); $str = str_replace("", "'", $str);
$str = str_replace("", '"', $str); $str = str_replace("", '"', $str);
@@ -59,15 +67,52 @@ function clean_str($str) {
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html> <html>
<head> <head>
<title>FrogFind!</title> <title>FrogFind!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style type="text/css">
a {
padding: 4px 0;
display: inline-block;
}
input[type="text"] {
font-size: 16px;
height: 24px;
margin-bottom: 8px;
width: 80%;
max-width: 280px;
}
input[type="submit"] {
font-size: 16px;
height: 32px;
padding: 2px 12px;
margin-top: 5px;
margin-bottom: 5px;
display: block;
}
.search-form {
margin: 10px 0;
}
</style>
</head> </head>
<body>
<?php if($show_results) { // there's a search query in q, so show search results ?> <body style="margin: 5px; padding: 0;">
<form action="/" method="get"> <?php if ($show_results) { // there's a search query in q, so show search results
<a href="/"><font size=6 color="#008000">Frog</font><font size=6 color="#000000">Find!</font></a> Leap again: <input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>"> ?>
<form action="/" method="get" class="search-form">
<a href="/">
<font size=6 color="#008000">Frog</font>
<font size=6 color="#000000">Find!</font>
</a>
<div style="margin: 8px 0;">Leap again: <br>
<input type="text" size="30" name="q" value="<?php echo urldecode($query) ?>">
</div>
<input type="submit" value="Ribbbit!"> <input type="submit" value="Ribbbit!">
</form> </form>
<hr> <hr>
@@ -76,22 +121,38 @@ function clean_str($str) {
<br> <br>
<?php echo $final_result_html ?> <?php echo $final_result_html ?>
<?php } else { // no search query, so show new search ?> <?php } else { // no search query, so show new search
<br><br><center><h1><font size=7><font color="#008000">Frog</font>Find!</font></h1></center> ?>
<center><h3>The Search Engine for Vintage Computers</h3></center> <br><br>
<center>
<h1>
<font size=7>
<font color="#008000">Frog</font>Find!
</font>
</h1>
</center>
<center>
<h3>The Search Engine for Vintage Computers</h3>
</center>
<br><br> <br><br>
<center> <center>
<form action="/" method="get"> <form action="/" method="get">
Leap to: <input type="text" size="30" name="q"><br> Leap to: <br>
<input type="submit" value="Ribbbit!"> <input type="text" size="30" name="q"><br>
<input type="submit" value="Ribbbit!" style="margin: 10px auto;">
</form>
</center> </center>
<br><br><br> <br><br><br>
<small><center>Built by <b><a href="https://youtube.com/ActionRetro">Action Retro</a></b> on YouTube | <a href="about.php">Why build such a thing?</a></center><br> <small>
<small><center>Powered by DuckDuckGo</center></small> <center>Built by <b><a href="https://youtube.com/ActionRetro">Action Retro</a></b> on YouTube | <a href="about.php">Why build such a thing?</a></center><br>
<small>
<center>Powered by DuckDuckGo</center>
</small>
</form> </form>
</form> </form>
<?php } ?> <?php } ?>
</body> </body>
</html> </html>

View File

@@ -38,8 +38,7 @@ $headers = get_headers($article_url, true, $context);
if (!array_key_exists('Content-Type', $headers) || !array_key_exists('Content-Length', $headers)) { if (!array_key_exists('Content-Type', $headers) || !array_key_exists('Content-Length', $headers)) {
$error_text .= "Failed to get the article, its server did not return expected details :( <br>"; $error_text .= "Failed to get the article, its server did not return expected details :( <br>";
} } else {
else {
// Attempt to handle downloads or other mime-types by passing proxying them through. // Attempt to handle downloads or other mime-types by passing proxying them through.
if (!in_array($headers['Content-Type'], $compatible_content_types)) { if (!in_array($headers['Content-Type'], $compatible_content_types)) {
$filesize = $headers['Content-Length']; $filesize = $headers['Content-Length'];
@@ -49,8 +48,7 @@ else {
echo 'Failed to proxy file download, it\'s too large. :( <br>'; echo 'Failed to proxy file download, it\'s too large. :( <br>';
echo 'You can try downloading the file directly: ' . $article_url; echo 'You can try downloading the file directly: ' . $article_url;
die(); die();
} } else {
else {
$contentType = $headers['Content-Type']; $contentType = $headers['Content-Type'];
// Only use the last-provided content type if an array was returned (ie. when there were redirects involved) // Only use the last-provided content type if an array was returned (ie. when there were redirects involved)
if (is_array($contentType)) { if (is_array($contentType)) {
@@ -107,7 +105,8 @@ try {
} }
//replace chars that old machines probably can't handle //replace chars that old machines probably can't handle
function clean_str($str) { function clean_str($str)
{
$str = str_replace("", "'", $str); $str = str_replace("", "'", $str);
$str = str_replace("", "'", $str); $str = str_replace("", "'", $str);
$str = str_replace("", '"', $str); $str = str_replace("", '"', $str);
@@ -121,13 +120,35 @@ function clean_str($str) {
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<html> <html>
<head> <head>
<title><?php echo $readability->getTitle(); ?></title> <title><?php echo $readability->getTitle(); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<style type="text/css">
a {
padding: 4px 0;
display: inline-block;
}
input[type="text"] {
font-size: 16px;
height: 24px;
}
input[type="submit"] {
font-size: 16px;
height: 32px;
padding: 2px 8px;
}
</style>
</head> </head>
<body>
<body style="margin: 5px; padding: 0;">
<p> <p>
<form action="/read.php" method="get"> <form action="/read.php" method="get">
<a href="/">Back to <b><font color="#008000">Frog</font><font color="000000">Find!</font></a></b> | Browsing URL: <input type="text" size="38" name="a" value="<?php echo $article_url ?>"> <a href="/">Back to <b>
<font color="#008000">Frog</font>
<font color="000000">Find!</font></a></b> | Browsing URL: <input type="text" size="38" name="a" value="<?php echo $article_url ?>">
<input type="submit" value="Go!"> <input type="submit" value="Go!">
</form> </form>
</p> </p>
@@ -147,7 +168,12 @@ function clean_str($str) {
echo $imgline_html; echo $imgline_html;
} }
?></small></p> ?></small></p>
<?php if($error_text) { echo "<p><font color='red'>" . $error_text . "</font></p>"; } ?> <?php if ($error_text) {
<p><font size="4"><?php echo $readable_article;?></font></p> echo "<p><font color='red'>" . $error_text . "</font></p>";
} ?>
<p>
<font size="4"><?php echo $readable_article; ?></font>
</p>
</body> </body>
</html> </html>