0.9.0 - the ZapV version updated to current php standards. Brave search used, while Bing and Google search api are deprecated

This commit is contained in:
Fabian de Boer 2026-07-15 13:57:05 +02:00
commit 4ddaddda3d
31 changed files with 1778 additions and 1 deletions

89
www/css/style.css Executable file
View file

@ -0,0 +1,89 @@
body, html {
margin:0;
padding:0;
color:#000;
background-color: #fff;
}
img {
padding: 12px;
border: #bbb dotted thin;
}
h1 {
font-family: Georgia, serif;
letter-spacing: 3px;
font-size: 16px;
position: relative;
margin-left: 22%;
}
h2 {
font-family: Georgia, serif;
font-size: 14px;
position: relative;
margin-left: 22%;
}
.inpSection {
margin-top: 6%;
position: relative;
border: #bbb dotted thin;
}
.inp {
font-family: sans-serif;
font-size: 10px;
display: block;
}
.inpTxt {
width: 18px;
text-align: right;
overflow: visible;
margin-right: 20px;
display: inline;
}
form {
padding: 7px 0 20px 20%;
}
input {
margin: 12px 15px 0 15px;
}
select {
margin: 12px 0 0 15px;
}
#status {
font-size: 10px;
color: red;
margin:15px 20px 0 0;
position: relative;
left: 20px;
}
#loading {
width: 100%;
height: 100%;
margin: 0;
position: absolute;
left: 0;
top: 0;
visibility: hidden;
background: white url('../images/downloading.gif') no-repeat fixed center center;
}
#ready {
text-align: center;
font-size: 14px;
text-decoration: blink;
}
.btn {
font-family: sans-serif;
font-size: 10px;
}

BIN
www/images/._downloading.gif Executable file

Binary file not shown.

BIN
www/images/._error_noHit.png Executable file

Binary file not shown.

BIN
www/images/downloading.gif Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

BIN
www/images/error_noHit.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

42
www/index.php Executable file
View file

@ -0,0 +1,42 @@
<?php
/**
* ZapMachine (re)based on the ZapV
* ZAPV - Zap Machine as modified by Vincent Bruijn
* that was based on ApFab - Zap Machine V0.3.2
* ApFab: thanks for the basic work,
* Vincent Bruijn thanks for enhencing
* version 0.9.0
*/
if (!extension_loaded('imagick')) {
echo 'Enable the php imagick extension to get this running.';
die;
}
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'home';
require_once '..' . DIRECTORY_SEPARATOR . 'conf' . DIRECTORY_SEPARATOR . 'init.php';
if (defined('ZAP_DEBUG') && ZAP_DEBUG) {
error_reporting(E_ALL);
ini_set('display_startup_errors', '1');
// Only display errors inline for HTML pages; raw image responses must stay clean.
if ($mode === 'zap') {
ini_set('display_errors', '0');
} else {
ini_set('display_errors', '1');
}
} else {
error_reporting(0);
ini_set('display_errors', '0');
}
$config = Config::getInstance();
$config->register('engines', $search_engines);
$frontcontroller = new ZAPController($mode);
$output = $frontcontroller->fetch();
print($output);
exit;
?>

33
www/js/display.js Executable file
View file

@ -0,0 +1,33 @@
var go = function(b, img_id, interval) {
var i = 0;
var img0 = document.getElementById(img_id[0]);
var img1 = document.getElementById(img_id[1]);
var img = [img0, img1];
var activeImage = 1; // index of visible image
var url = 'index.php?mode=zap';
if (isNaN(interval)) {
interval = 5000;
}
// Trigger the next image fetch after the current one has loaded.
img[0].onload = img[1].onload = function() {
var inactiveImage = activeImage === 0 ? 1 : 0;
img[activeImage].style.display = 'none';
img[inactiveImage].style.display = '';
activeImage = inactiveImage;
setTimeout(function() {
img[inactiveImage].src = url + '&i=' + (i++);
}, interval);
};
// When the backend signals completion it returns a small HTML page.
// Show the ready link and stop fetching new images.
img[0].onerror = img[1].onerror = function() {
document.getElementById('ready').innerHTML = '<a href="/">Ready</a>';
};
// Kick off the first request.
img[activeImage].src = url + '&i=' + (i++);
};

54
www/js/main.js Executable file
View file

@ -0,0 +1,54 @@
function IsNumeric(sText) {
var ValidChars = "0123456789";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) {
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1) {
IsNumber = false;
}
}
return IsNumber;
}
function form1Submit() {
//check if form is well filled
//Minimum of two words required
var word1 = document.getElementById('word01').value;
var word2 = document.getElementById('word02').value;
var width = document.getElementById('width').value;
var height = document.getElementById('height').value;
if (word1.length <= 0) {
document.getElementById('status').innerHTML = 'Minimum of two words required';
return;
}
if (word2.length <= 0) {
document.getElementById('status').innerHTML = 'Minimum of two words required';
return;
}
if (width.length <= 0) {
document.getElementById('status').innerHTML = 'Value <b>width</b> required';
return;
}
if (height.length <= 0) {
document.getElementById('status').innerHTML = 'Value <b>height</b> required';
return;
}
if (!IsNumeric(width)) {
document.getElementById('status').innerHTML = 'Value <b>width</b> needs numeric input';
return;
}
if (!IsNumeric(height)) {
document.getElementById('status').innerHTML = 'Value <b>height</b> needs numeric input';
return;
}
//tests ok
document.getElementById('status').innerHTML = ' ';
//download image visible and form invisible
document.getElementById('loading').style.visibility = 'visible';
document.getElementById('form1').style.visibility = 'hidden';
//document.getElementById('inpNrs').style.visibility = 'hidden';
//go for it!
document.getElementById('form1').submit();
}