浏览代码

Version 1.6.1

- NOTICE: config.default.php has changed, update your config.php!!
- [new] Query logger for debugging (See config.default.php for details)
- [tweak] Scrape query for DuckDuckGo to be more direct
- [tweak] Added url arguments to the formatted url of search results
- [tweak] Improved tooltips to be popups with better explanations
- [tweak] Improved spacing for pagination links
- [fix] More accurately show the current version in the footer
- [fix] Current version not properly stored
- [fix] Pagination offset off by one result
- [fix] Unnecessary global in load_search()
- [fix] Typo in wordpress search
- [fix] Qwant initial total hits and ranking more accurate
- [fix] Goosle header title not bold on stats page
- [fix] Visual fixes to the design of Goosle
Arnan de Gans 1 年之前
父节点
当前提交
c5de195436

+ 16 - 17
assets/css/styles.css

@@ -42,6 +42,8 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
 .startpage .box-office { margin-left:0; border-left:1px solid var(--startpage-button-bg); border-radius:0 6px 6px 0; }
 .startpage .box-office { margin-left:0; border-left:1px solid var(--startpage-button-bg); border-radius:0 6px 6px 0; }
 .startpage .web-search:hover, .startpage .image-search:hover, .startpage .magnet-search:hover, .startpage .box-office:hover { border:1px solid var(--startpage-border-alt); background-color:var(--startpage-button-bg-alt); text-decoration:none; }
 .startpage .web-search:hover, .startpage .image-search:hover, .startpage .magnet-search:hover, .startpage .box-office:hover { border:1px solid var(--startpage-border-alt); background-color:var(--startpage-button-bg-alt); text-decoration:none; }
 
 
+.startpage .footer { border-top:1px solid var(--color-accent); }
+
 .password-generator { margin:30px auto; padding:0; }
 .password-generator { margin:30px auto; padding:0; }
 .password-generator .password { margin:10px auto; width:300px; text-align:center; font-size:.8rem; }
 .password-generator .password { margin:10px auto; width:300px; text-align:center; font-size:.8rem; }
 
 
@@ -55,11 +57,11 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
 .header .search-field[type="search"]::-webkit-search-cancel-button { background-size:20px 20px; height:20px; width:20px; background-color:var(--text-alt); }
 .header .search-field[type="search"]::-webkit-search-cancel-button { background-size:20px 20px; height:20px; width:20px; background-color:var(--text-alt); }
 .header .button { margin:0 10px 0 0; padding:5px 20px 5px 15px; color:var(--button-text); background-color:var(--button-bg); border:none; border-radius:0 10px 10px 0; }
 .header .button { margin:0 10px 0 0; padding:5px 20px 5px 15px; color:var(--button-text); background-color:var(--button-bg); border:none; border-radius:0 10px 10px 0; }
 
 
-.navigation { margin-left:158px; margin-bottom:8px; } /* Margin-bottom must match with padding-bottom on line 79 */
-.navigation a { margin-right:20px; border:none; cursor:pointer; text-decoration:none; }
-.navigation a:visited { color:var(--link); }
-.navigation a:hover { color:var(--text-alt); }
-.navigation .active { padding-bottom:8px; border-bottom:4px solid var(--color-accent); }
+.header .navigation { margin-left:158px; margin-bottom:10px; }
+.header .navigation a { margin-right:20px; border:none; cursor:pointer; text-decoration:none; }
+.header .navigation a:visited { color:var(--link); }
+.header .navigation a:hover { color:var(--text-alt); }
+.header .navigation .active { padding-bottom:8px; border-bottom:4px solid var(--color-accent); }
 
 
 /* Navigation icons */
 /* Navigation icons */
 .navigation a.tab-search::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--color-accent); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiwyMEg1YTEsMSwwLDAsMS0xLTFWNUExLDEsMCwwLDEsNSw0aDVWN2EzLDMsMCwwLDAsMywzaDN2MWExLDEsMCwwLDAsMiwwVjlzMCwwLDAtLjA2YTEuMzEsMS4zMSwwLDAsMC0uMDYtLjI3bDAtLjA5YTEuMDcsMS4wNywwLDAsMC0uMTktLjI4aDBsLTYtNmgwYTEuMDcsMS4wNywwLDAsMC0uMjgtLjE5LjMyLjMyLDAsMCwwLS4wOSwwQS44OC44OCwwLDAsMCwxMS4wNSwySDVBMywzLDAsMCwwLDIsNVYxOWEzLDMsMCwwLDAsMywzaDdhMSwxLDAsMCwwLDAtMlpNMTIsNS40MSwxNC41OSw4SDEzYTEsMSwwLDAsMS0xLTFaTTcsOGExLDEsMCwwLDAsMCwySDhBMSwxLDAsMCwwLDgsOFpNMjEuNzEsMjAuMjlsLTEuMTctMS4xNkEzLjQ0LDMuNDQsMCwwLDAsMjAsMTVoMEEzLjQ5LDMuNDksMCwwLDAsMTQsMTcuNDlhMy40NiwzLjQ2LDAsMCwwLDUuMTMsMy4wNWwxLjE2LDEuMTdhMSwxLDAsMCwwLDEuNDIsMEExLDEsMCwwLDAsMjEuNzEsMjAuMjlabS0zLjE3LTEuNzVhMS41NCwxLjU0LDAsMCwxLTIuMTEsMEExLjUsMS41LDAsMCwxLDE2LDE3LjQ5YTEuNDYsMS40NiwwLDAsMSwuNDQtMS4wNiwxLjQ4LDEuNDgsMCwwLDEsMS0uNDNBMS40NywxLjQ3LDAsMCwxLDE5LDE3LjQ5LDEuNSwxLjUsMCwwLDEsMTguNTQsMTguNTRaTTEzLDEySDdhMSwxLDAsMCwwLDAsMmg2YTEsMSwwLDAsMCwwLTJabS0yLDZhMSwxLDAsMCwwLDAtMkg3YTEsMSwwLDAsMCwwLDJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
 .navigation a.tab-search::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--color-accent); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiwyMEg1YTEsMSwwLDAsMS0xLTFWNUExLDEsMCwwLDEsNSw0aDVWN2EzLDMsMCwwLDAsMywzaDN2MWExLDEsMCwwLDAsMiwwVjlzMCwwLDAtLjA2YTEuMzEsMS4zMSwwLDAsMC0uMDYtLjI3bDAtLjA5YTEuMDcsMS4wNywwLDAsMC0uMTktLjI4aDBsLTYtNmgwYTEuMDcsMS4wNywwLDAsMC0uMjgtLjE5LjMyLjMyLDAsMCwwLS4wOSwwQS44OC44OCwwLDAsMCwxMS4wNSwySDVBMywzLDAsMCwwLDIsNVYxOWEzLDMsMCwwLDAsMywzaDdhMSwxLDAsMCwwLDAtMlpNMTIsNS40MSwxNC41OSw4SDEzYTEsMSwwLDAsMS0xLTFaTTcsOGExLDEsMCwwLDAsMCwySDhBMSwxLDAsMCwwLDgsOFpNMjEuNzEsMjAuMjlsLTEuMTctMS4xNkEzLjQ0LDMuNDQsMCwwLDAsMjAsMTVoMEEzLjQ5LDMuNDksMCwwLDAsMTQsMTcuNDlhMy40NiwzLjQ2LDAsMCwwLDUuMTMsMy4wNWwxLjE2LDEuMTdhMSwxLDAsMCwwLDEuNDIsMEExLDEsMCwwLDAsMjEuNzEsMjAuMjlabS0zLjE3LTEuNzVhMS41NCwxLjU0LDAsMCwxLTIuMTEsMEExLjUsMS41LDAsMCwxLDE2LDE3LjQ5YTEuNDYsMS40NiwwLDAsMSwuNDQtMS4wNiwxLjQ4LDEuNDgsMCwwLDEsMS0uNDNBMS40NywxLjQ3LDAsMCwxLDE5LDE3LjQ5LDEuNSwxLjUsMCwwLDEsMTguNTQsMTguNTRaTTEzLDEySDdhMSwxLDAsMCwwLDAsMmg2YTEsMSwwLDAsMCwwLTJabS0yLDZhMSwxLDAsMCwwLDAtMkg3YTEsMSwwLDAsMCwwLDJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
@@ -144,8 +146,8 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
 .goosebox-body .success, .goosebox-body .fail { font-weight:600; }
 .goosebox-body .success, .goosebox-body .fail { font-weight:600; }
 
 
 /* Stats display (stats page) */
 /* Stats display (stats page) */
-.statspage h1 { margin-bottom:10px; padding:0; text-align:center; font-size:2.5em; font-weight:400; }
-.statspage h2 { margin-bottom:10px; padding:0; text-align:center; font-size:1.5em; }
+.statspage .content h1 { margin-bottom:10px; padding:0; text-align:center; font-size:2.5em; font-weight:400; }
+.statspage .content h2 { margin-bottom:10px; padding:0; text-align:center; font-size:1.5em; }
 .statspage p { font-family:'american typewriter'; }
 .statspage p { font-family:'american typewriter'; }
 
 
 /* oAUTH page */
 /* oAUTH page */
@@ -156,9 +158,13 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
 .oauthpage .oauth-buttons button { margin:30px 20px 10px 20px; padding:13px 10px; min-width:130px; color:var(--text-alt); background-color:var(--startpage-button-bg); border:1px solid var(--startpage-border); font-size:1.2rem; border-radius:6px; }
 .oauthpage .oauth-buttons button { margin:30px 20px 10px 20px; padding:13px 10px; min-width:130px; color:var(--text-alt); background-color:var(--startpage-button-bg); border:1px solid var(--startpage-border); font-size:1.2rem; border-radius:6px; }
 .oauthpage .oauth-buttons button:hover { border:1px solid var(--startpage-border-alt); background-color:var(--startpage-button-bg-alt); text-decoration:none; }
 .oauthpage .oauth-buttons button:hover { border:1px solid var(--startpage-border-alt); background-color:var(--startpage-button-bg-alt); text-decoration:none; }
 
 
+/* Tooltips */
+.tooltip-question::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--link); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMS4yOSwxNS4yOWExLjU4LDEuNTgsMCwwLDAtLjEyLjE1Ljc2Ljc2LDAsMCwwLS4wOS4xOC42NC42NCwwLDAsMC0uMDYuMTgsMS4zNiwxLjM2LDAsMCwwLDAsLjIuODQuODQsMCwwLDAsLjA4LjM4LjkuOSwwLDAsMCwuNTQuNTQuOTQuOTQsMCwwLDAsLjc2LDAsLjkuOSwwLDAsMCwuNTQtLjU0QTEsMSwwLDAsMCwxMywxNmExLDEsMCwwLDAtLjI5LS43MUExLDEsMCwwLDAsMTEuMjksMTUuMjlaTTEyLDJBMTAsMTAsMCwxLDAsMjIsMTIsMTAsMTAsMCwwLDAsMTIsMlptMCwxOGE4LDgsMCwxLDEsOC04QTgsOCwwLDAsMSwxMiwyMFpNMTIsN0EzLDMsMCwwLDAsOS40LDguNWExLDEsMCwxLDAsMS43MywxQTEsMSwwLDAsMSwxMiw5YTEsMSwwLDAsMSwwLDIsMSwxLDAsMCwwLTEsMXYxYTEsMSwwLDAsMCwyLDB2LS4xOEEzLDMsMCwwLDAsMTIsN1oiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }
+.tooltip-alert::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--red); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiwxNmExLDEsMCwxLDAsMSwxQTEsMSwwLDAsMCwxMiwxNlptMTAuNjcsMS40Ny04LjA1LTE0YTMsMywwLDAsMC01LjI0LDBsLTgsMTRBMywzLDAsMCwwLDMuOTQsMjJIMjAuMDZhMywzLDAsMCwwLDIuNjEtNC41M1ptLTEuNzMsMmExLDEsMCwwLDEtLjg4LjUxSDMuOTRhMSwxLDAsMCwxLS44OC0uNTEsMSwxLDAsMCwxLDAtMWw4LTE0YTEsMSwwLDAsMSwxLjc4LDBsOC4wNSwxNEExLDEsMCwwLDEsMjAuOTQsMTkuNDlaTTEyLDhhMSwxLDAsMCwwLTEsMXY0YTEsMSwwLDAsMCwyLDBWOUExLDEsMCwwLDAsMTIsOFoiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }
+
 /* Pagination */
 /* Pagination */
 .pagination { text-align:center; }
 .pagination { text-align:center; }
-.pagination a { font-size:1.2em; }
+.pagination a { font-size:1.2em; padding:0 8px; }
 .pagination a.current { font-size:1.4em; font-weight:400; text-decoration:underline; }
 .pagination a.current { font-size:1.4em; font-weight:400; text-decoration:underline; }
 .arrow-left::before { content:""; display:inline-block; width:1.2em; height:1.2em; background:var(--link); vertical-align:text-top; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE3LDExSDkuNDFsMy4zLTMuMjlhMSwxLDAsMSwwLTEuNDItMS40MmwtNSw1YTEsMSwwLDAsMC0uMjEuMzMsMSwxLDAsMCwwLDAsLjc2LDEsMSwwLDAsMCwuMjEuMzNsNSw1YTEsMSwwLDAsMCwxLjQyLDAsMSwxLDAsMCwwLDAtMS40Mkw5LjQxLDEzSDE3YTEsMSwwLDAsMCwwLTJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
 .arrow-left::before { content:""; display:inline-block; width:1.2em; height:1.2em; background:var(--link); vertical-align:text-top; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE3LDExSDkuNDFsMy4zLTMuMjlhMSwxLDAsMSwwLTEuNDItMS40MmwtNSw1YTEsMSwwLDAsMC0uMjEuMzMsMSwxLDAsMCwwLDAsLjc2LDEsMSwwLDAsMCwuMjEuMzNsNSw1YTEsMSwwLDAsMCwxLjQyLDAsMSwxLDAsMCwwLDAtMS40Mkw5LjQxLDEzSDE3YTEsMSwwLDAsMCwwLTJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
 .arrow-right::before { content:""; display:inline-block; width:1.2em; height:1.2em; background:var(--link); vertical-align:text-top; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE3LjkyLDExLjYyYTEsMSwwLDAsMC0uMjEtLjMzbC01LTVhMSwxLDAsMCwwLTEuNDIsMS40MkwxNC41OSwxMUg3YTEsMSwwLDAsMCwwLDJoNy41OWwtMy4zLDMuMjlhMSwxLDAsMCwwLDAsMS40MiwxLDEsMCwwLDAsMS40MiwwbDUtNWExLDEsMCwwLDAsLjIxLS4zM0ExLDEsMCwwLDAsMTcuOTIsMTEuNjJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
 .arrow-right::before { content:""; display:inline-block; width:1.2em; height:1.2em; background:var(--link); vertical-align:text-top; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgZGF0YS1uYW1lPSJMYXllciAxIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE3LjkyLDExLjYyYTEsMSwwLDAsMC0uMjEtLjMzbC01LTVhMSwxLDAsMCwwLTEuNDIsMS40MkwxNC41OSwxMUg3YTEsMSwwLDAsMCwwLDJoNy41OWwtMy4zLDMuMjlhMSwxLDAsMCwwLDAsMS40MiwxLDEsMCwwLDAsMS40MiwwbDUtNWExLDEsMCwwLDAsLjIxLS4zM0ExLDEsMCwwLDAsMTcuOTIsMTEuNjJaIiBmaWxsPSIjNjU2M2ZmIi8+PC9zdmc+'); }
@@ -170,7 +176,7 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
 .footer-grid:nth-child(2) { text-align:right; }
 .footer-grid:nth-child(2) { text-align:right; }
 
 
 /* Footer */
 /* Footer */
-.footer { box-sizing:border-box; bottom:0; margin-top:auto; padding:10px 5px; width:100%; background-color:var(--background-alt); color:var(--text-alt); border-top:2px solid var(--color-accent); font-size:.9rem; }
+.footer { box-sizing:border-box; bottom:0; margin-top:auto; padding:10px 25px; width:100%; background-color:var(--background-alt); color:var(--text-alt); border-top:2px solid var(--color-accent); }
 .footer a { color:var(--text-alt); }
 .footer a { color:var(--text-alt); }
 
 
 /* MPA rating colors */
 /* MPA rating colors */
@@ -180,13 +186,6 @@ input[type="search"]::-webkit-search-cancel-button { -webkit-appearance:none; -w
 .mpa-r { color:#C0392B; }
 .mpa-r { color:#C0392B; }
 .mpa-nc17 { color:#1A5276; }
 .mpa-nc17 { color:#1A5276; }
 
 
-/* Tooltips */
-.tooltip { position:relative; display:inline-block; }
-.tooltip-question::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--link); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMS4yOSwxNS4yOWExLjU4LDEuNTgsMCwwLDAtLjEyLjE1Ljc2Ljc2LDAsMCwwLS4wOS4xOC42NC42NCwwLDAsMC0uMDYuMTgsMS4zNiwxLjM2LDAsMCwwLDAsLjIuODQuODQsMCwwLDAsLjA4LjM4LjkuOSwwLDAsMCwuNTQuNTQuOTQuOTQsMCwwLDAsLjc2LDAsLjkuOSwwLDAsMCwuNTQtLjU0QTEsMSwwLDAsMCwxMywxNmExLDEsMCwwLDAtLjI5LS43MUExLDEsMCwwLDAsMTEuMjksMTUuMjlaTTEyLDJBMTAsMTAsMCwxLDAsMjIsMTIsMTAsMTAsMCwwLDAsMTIsMlptMCwxOGE4LDgsMCwxLDEsOC04QTgsOCwwLDAsMSwxMiwyMFpNMTIsN0EzLDMsMCwwLDAsOS40LDguNWExLDEsMCwxLDAsMS43MywxQTEsMSwwLDAsMSwxMiw5YTEsMSwwLDAsMSwwLDIsMSwxLDAsMCwwLTEsMXYxYTEsMSwwLDAsMCwyLDB2LS4xOEEzLDMsMCwwLDAsMTIsN1oiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }
-.tooltip-alert::before { content:""; display:inline-block; width:1.1em; height:1.1em; background:var(--link); vertical-align:text-bottom; mask-image:url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik0xMiwxNmExLDEsMCwxLDAsMSwxQTEsMSwwLDAsMCwxMiwxNlptMTAuNjcsMS40Ny04LjA1LTE0YTMsMywwLDAsMC01LjI0LDBsLTgsMTRBMywzLDAsMCwwLDMuOTQsMjJIMjAuMDZhMywzLDAsMCwwLDIuNjEtNC41M1ptLTEuNzMsMmExLDEsMCwwLDEtLjg4LjUxSDMuOTRhMSwxLDAsMCwxLS44OC0uNTEsMSwxLDAsMCwxLDAtMWw4LTE0YTEsMSwwLDAsMSwxLjc4LDBsOC4wNSwxNEExLDEsMCwwLDEsMjAuOTQsMTkuNDlaTTEyLDhhMSwxLDAsMCwwLTEsMXY0YTEsMSwwLDAsMCwyLDBWOUExLDEsMCwwLDAsMTIsOFoiIGZpbGw9IiM2NTYzZmYiLz48L3N2Zz4='); }
-.tooltip .tooltiptext { visibility:hidden; position:absolute; padding:10px 15px; width:350px; background:var(--background-popup); border:1px solid var(--border); border-radius:10px; z-index: 10000; }
-.tooltip:hover .tooltiptext { visibility:visible; }
-
 /* Misc */
 /* Misc */
 .goosle-g { color:var(--color-accent); }
 .goosle-g { color:var(--color-accent); }
 .green { color:var(--green); }
 .green { color:var(--green); }
@@ -201,7 +200,7 @@ img.help { padding:0 .5rem .5rem 0; float:left; border-radius:20px; }
 .error { position:relative; overflow:hidden; margin:20px 0; padding:10px; color:var(--error); background-color:var(--error-background); border:1px solid var(--error); border-radius:10px; }
 .error { position:relative; overflow:hidden; margin:20px 0; padding:10px; color:var(--error); background-color:var(--error-background); border:1px solid var(--error); border-radius:10px; }
 .auth-success { margin-top:15%; text-align:center; color:var(--text-alt); }
 .auth-success { margin-top:15%; text-align:center; color:var(--text-alt); }
 .auth-error { margin-top:15%; font-size:2rem; text-align:center; color:var(--text-alt); }
 .auth-error { margin-top:15%; font-size:2rem; text-align:center; color:var(--text-alt); }
-a.update { color:var(--red); font-weight:600; }
+a.update { color:var(--yellow); font-weight:600; }
 
 
 @media only screen and (max-width:960px) { /* Tablet, landscape iPad, lo-res/smaller laptops */ 
 @media only screen and (max-width:960px) { /* Tablet, landscape iPad, lo-res/smaller laptops */ 
 	.content { position:relative; margin:15px 48px; }
 	.content { position:relative; margin:15px 48px; }

+ 1 - 1
box-office.php

@@ -140,7 +140,7 @@ if(verify_hash($opts->hash_auth, $opts->hash, $opts->user_auth)) {
 
 
 <div class="footer grid-container">
 <div class="footer grid-container">
 	<div class="footer-grid">
 	<div class="footer-grid">
-		&copy; <?php echo the_date('Y'); ?> <?php echo show_version(); ?> By <a href="https://ajdg.solutions/" target="_blank">Arnan de Gans</a>.
+		&copy; <?php echo the_date('Y'); ?> Goosle <?php echo $current_version; ?> <?php echo show_update_notification(); ?>
 	</div>
 	</div>
 	<div class="footer-grid">
 	<div class="footer-grid">
 		<a href="./?a=<?php echo $opts->user_auth; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->user_auth; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->user_auth; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>
 		<a href="./?a=<?php echo $opts->user_auth; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->user_auth; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->user_auth; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>

+ 16 - 0
changelog.md

@@ -1,6 +1,22 @@
 # Goosle
 # Goosle
 ## The best Meta Search Engine to find everything
 ## The best Meta Search Engine to find everything
 
 
+### 1.6.1 - July 19, 2024
+- NOTICE: config.default.php has changed, update your config.php!!
+- [new] Query logger for debugging (See config.default.php for details)
+- [tweak] Scrape query for DuckDuckGo to be more direct
+- [tweak] Added url arguments to the formatted url of search results
+- [tweak] Improved tooltips to be popups with better explanations
+- [tweak] Improved spacing for pagination links
+- [fix] More accurately show the current version in the footer
+- [fix] Current version not properly stored
+- [fix] Pagination offset off by one result
+- [fix] Unnecessary global in load_search()
+- [fix] Typo in wordpress search
+- [fix] Qwant initial total hits and ranking more accurate
+- [fix] Goosle header title not bold on stats page
+- [fix] Visual fixes to the design of Goosle
+
 ### 1.6 - July 15, 2024
 ### 1.6 - July 15, 2024
 - NOTICE: config.default.php has changed, update your config.php!!
 - NOTICE: config.default.php has changed, update your config.php!!
 - [change] Moved magnet popups into combined function
 - [change] Moved magnet popups into combined function

+ 13 - 0
config.default.php

@@ -59,6 +59,16 @@ CACHE_TIME:
 	The file cache is only limited by your hosting storage space and can safely be much much longer if you want.
 	The file cache is only limited by your hosting storage space and can safely be much much longer if you want.
 	To not show outdated results the 'limit' is 48 hours.
 	To not show outdated results the 'limit' is 48 hours.
 	Ignored if above 'CACHE_TYPE' option is set to off.
 	Ignored if above 'CACHE_TYPE' option is set to off.
+
+QUERYLOG:
+	The query log is useful if you make common requests and for some reason one engine returns no result and no error. Enabling the querylog lets you see if a request was made and how many results were found/scraped/retrieved. But also how many are left after initial processing.
+	The querylog logs requests per day into a file in /cache/. This function is not meant to be on for production use. Only for debugging or understanding results.
+	
+	Example: [18-07-2024 22:15:05][s] GoogleRequest: 30 -> 4, https://www.google.com/search?q=the+wild+goose+chase&safe=1&num=30&pws=0&udm=14&tbs=li%3A1&complete=0&sclient=web
+	Here a query is made to Google web search, Goosle scraped 30 results but after initial filtering only 4 remained. This can mean a lot of duplicate links were found (unlikely). More likely is that an inconsistent scrape was done. This can indicate that the website has changed its layout structure and Goosle needs to be updated.
+	
+	Example: [18-07-2024 23:06:58][a] QwantRequest: No results -> 0, https://api.qwant.com/v3/search/web?q=the+wild+goose+chase&t=web&safesearch=1&locale=en_gb&count=10&device=desktop
+	Here a query is made to Qwant web search via their API and no results were found at all. API calls can not make scrape errors. This likely means there simply were no results to begin with.
 /* ------------------------------------------------------------------------------------
 /* ------------------------------------------------------------------------------------
 LANGUAGE:
 LANGUAGE:
 	To not fit the USA mold, Goosle defaults to the United Kingdom for english results.
 	To not fit the USA mold, Goosle defaults to the United Kingdom for english results.
@@ -66,7 +76,9 @@ LANGUAGE:
 	Invalid values either cause the search engine to fail or will default to English depending on how wrong the value is.
 	Invalid values either cause the search engine to fail or will default to English depending on how wrong the value is.
 	
 	
 	Google has no language setting because as soon as you specify it all 'anonymous' settings stop working.
 	Google has no language setting because as soon as you specify it all 'anonymous' settings stop working.
+
 	DuckDuckGo uses language regions and defaults to the United Kingdom. To change it see if your region is available - https://duckduckgo.com/duckduckgo-help-pages/settings/params/.
 	DuckDuckGo uses language regions and defaults to the United Kingdom. To change it see if your region is available - https://duckduckgo.com/duckduckgo-help-pages/settings/params/.
+
 	Wikipedia needs to be told which language you want. This changes the search url. Use any of their supported languages (en, es, fr, nl, etc.)
 	Wikipedia needs to be told which language you want. This changes the search url. Use any of their supported languages (en, es, fr, nl, etc.)
 
 
 	Qwant uses a locale similar to DuckDuckGo and defaults to the United Kingdom as well.
 	Qwant uses a locale similar to DuckDuckGo and defaults to the United Kingdom as well.
@@ -104,6 +116,7 @@ return (object) array(
     'cache_type' => 'file', // Default: file
     'cache_type' => 'file', // Default: file
     'cache_time' => 8, // Default: 8 (Hours), see the recommendations above.
     'cache_time' => 8, // Default: 8 (Hours), see the recommendations above.
 	'timezone' => 'UTC', // Default: UTC (Enter UTC+1, UTC-6 etc. for your timezone - Find yours https://time.is/UTC)
 	'timezone' => 'UTC', // Default: UTC (Enter UTC+1, UTC-6 etc. for your timezone - Find yours https://time.is/UTC)
+	'querylog' => 'off', // Default: off (Log remote queries to see if they are made and how much results they find and end up with)
 
 
     'enable_duckduckgo' => 'on', // Default: on
     'enable_duckduckgo' => 'on', // Default: on
     'enable_google' => 'on', // Default: on
     'enable_google' => 'on', // Default: on

+ 11 - 3
engines/boxoffice/eztv.php

@@ -27,10 +27,16 @@ function eztv_boxoffice($opts) {
 	$results = $results_temp = array();
 	$results = $results_temp = array();
 	
 	
 	// No response
 	// No response
-	if(empty($json_response)) return $results;
+	if(empty($json_response)) {
+		if($opts->querylog == 'on') querylog('BoxofficeEZTV', 'a', $api_url, 'No response', 0);
+		return $results;
+	}
 
 
-	// Nothing found
-	if($json_response['torrents_count'] == 0) return $results;
+	// No Results
+	if($json_response['torrents_count'] == 0) {
+		if($opts->querylog == 'on') querylog('BoxofficeEZTV', 'a', $api_url, 'No Results', 0);
+		return $results;
+	}
 	
 	
 	foreach($json_response['torrents'] as $result) {
 	foreach($json_response['torrents'] as $result) {
 		$title = (!empty($result['title'])) ? sanitize($result['title']) : null;
 		$title = (!empty($result['title'])) ? sanitize($result['title']) : null;
@@ -92,6 +98,8 @@ function eztv_boxoffice($opts) {
 	}
 	}
 	unset($response, $json_response);
 	unset($response, $json_response);
 
 
+	if($opts->querylog == 'on') querylog('BoxofficeEZTV', 'a', $api_url, 'up-to 100', count($results));
+
 	// Cache last request if there is something to cache
 	// Cache last request if there is something to cache
 	if($opts->cache_type !== 'off') {
 	if($opts->cache_type !== 'off') {
 		if(count($results) > 0) store_cached_results($opts->cache_type, $opts->hash, $api_url, $results, $opts->cache_time);
 		if(count($results) > 0) store_cached_results($opts->cache_type, $opts->hash, $api_url, $results, $opts->cache_time);

+ 11 - 3
engines/boxoffice/yts.php

@@ -27,10 +27,16 @@ function yts_boxoffice($opts, $what) {
 	$results = array();
 	$results = array();
 
 
 	// No response
 	// No response
-	if(empty($json_response)) return $results;
+	if(empty($json_response)) {
+		if($opts->querylog == 'on') querylog('BoxofficeYTS', 'a', $api_url, 'No response', 0);
+		return $results;
+	}
 
 
-	// No results
-    if($json_response['data']['movie_count'] == 0) return $results;
+	// No Results
+	if($json_response['data']['movie_count'] == 0) {
+		if($opts->querylog == 'on') querylog('BoxofficeYTS', 'a', $api_url, 'No Results', 0);
+		return $results;
+	}
 
 
 	foreach($json_response['data']['movies'] as $result) {
 	foreach($json_response['data']['movies'] as $result) {
 		$title = sanitize($result['title']);
 		$title = sanitize($result['title']);
@@ -99,6 +105,8 @@ function yts_boxoffice($opts, $what) {
 	}
 	}
 	unset($response, $json_response);
 	unset($response, $json_response);
 
 
+	if($opts->querylog == 'on') querylog('BoxofficeYTS', 'a', $api_url, 'up-to 40', count($results));
+
 	// Cache last request if there is something to cache
 	// Cache last request if there is something to cache
 	if($opts->cache_type !== 'off') {
 	if($opts->cache_type !== 'off') {
 		if(count($results) > 0) store_cached_results($opts->cache_type, $opts->hash, $api_url, $results, $opts->cache_time);
 		if(count($results) > 0) store_cached_results($opts->cache_type, $opts->hash, $api_url, $results, $opts->cache_time);

+ 10 - 2
engines/image/openverse.php

@@ -51,13 +51,19 @@ class OpenverseRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Figure out results and base rank
 		// Figure out results and base rank
 		$number_of_results = $rank = $json_response['result_count'];
 		$number_of_results = $rank = $json_response['result_count'];
 		
 		
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);
+			return $engine_result;
+		}
 
 
 		// Use API result
 		// Use API result
 		foreach($json_response['results'] as $result) {
 		foreach($json_response['results'] as $result) {
@@ -106,6 +112,8 @@ class OpenverseRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $json_response, $number_of_results, $rank);
 		unset($response, $json_response, $number_of_results, $rank);
 
 
 		return $engine_result;
 		return $engine_result;

+ 10 - 2
engines/image/qwant-images.php

@@ -59,13 +59,19 @@ class QwantImageRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Figure out results and base rank
 		// Figure out results and base rank
 		$number_of_results = $rank = $json_response['data']['result']['total'];
 		$number_of_results = $rank = $json_response['data']['result']['total'];
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);
+			return $engine_result;
+		}
 
 
 		foreach($json_response['data']['result']['items'] as $result) {
 		foreach($json_response['data']['result']['items'] as $result) {
 			// Find data and process data
 			// Find data and process data
@@ -111,6 +117,8 @@ class QwantImageRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $json_response, $number_of_results, $rank);
 		unset($response, $json_response, $number_of_results, $rank);
 
 
 		return $engine_result;
 		return $engine_result;

+ 11 - 3
engines/image/yahoo-images.php

@@ -53,7 +53,10 @@ class YahooImageRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 	
 	
  		// No response
  		// No response
-       if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results
 		// Scrape the results
 //		$scrape = $xpath->query("//li[contains(@class, 'ld') and not(contains(@class, 'slotting'))][position() < 101]");
 //		$scrape = $xpath->query("//li[contains(@class, 'ld') and not(contains(@class, 'slotting'))][position() < 101]");
@@ -63,7 +66,10 @@ class YahooImageRequest extends EngineRequest {
 		$number_of_results = $rank = count($scrape);
 		$number_of_results = $rank = count($scrape);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		// Scrape recommended
 		// Scrape recommended
 		$didyoumean = $xpath->query(".//section[@class='dym-c']/section/h3/a")[0];
 		$didyoumean = $xpath->query(".//section[@class='dym-c']/section/h3/a")[0];
@@ -150,10 +156,12 @@ class YahooImageRequest extends EngineRequest {
 
 
 		// Base info
 		// Base info
 		if(!empty($engine_temp)) {
 		if(!empty($engine_temp)) {
-			$engine_result['source'] = 'Yahoo! Images';
+			$engine_result['source'] = 'Yahoo Images';
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $xpath, $scrape, $number_of_results, $rank);
 		unset($response, $xpath, $scrape, $number_of_results, $rank);
 
 
 		return $engine_result;
 		return $engine_result;

+ 11 - 3
engines/magnet/eztv.php

@@ -38,10 +38,16 @@ class EZTVRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 		
 		
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// No results
 		// No results
-        if($json_response['torrents_count'] == 0) return $engine_temp;
+        if($json_response['torrents_count'] == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($json_response['torrents'] as $result) {
 		foreach($json_response['torrents'] as $result) {
 			$title = sanitize($result['title']);
 			$title = sanitize($result['title']);
@@ -107,7 +113,9 @@ class EZTVRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
-		unset($response, $json_response, $number_of_results, $engine_temp);
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $json_response['torrents_count'], count($engine_temp));
+
+		unset($response, $json_response, $engine_temp);
 		
 		
 		return $engine_result;
 		return $engine_result;
 	}
 	}

+ 11 - 3
engines/magnet/lime.php

@@ -32,13 +32,19 @@ class LimeRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 		
 		
 		// No response
 		// No response
-		if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results
 		// Scrape the results
 		$scrape = $xpath->query("//table[@class='table2']//tr[position() > 1]");
 		$scrape = $xpath->query("//table[@class='table2']//tr[position() > 1]");
 
 
 		// No results
 		// No results
-        if(count($scrape) == 0) return $engine_temp;
+        if(count($scrape) == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($scrape as $result) {
 		foreach($scrape as $result) {
 			// Find data
 			// Find data
@@ -127,7 +133,9 @@ class LimeRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
-		unset($response, $xpath, $scrape, $number_of_results, $engine_temp);
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, count($scrape), count($engine_temp));
+
+		unset($response, $xpath, $scrape, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;
 	}
 	}

+ 11 - 3
engines/magnet/nyaa.php

@@ -27,13 +27,19 @@ class NyaaRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 		
 		
 		// No response
 		// No response
-		if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 		
 		
 		// Scrape the results
 		// Scrape the results
 		$scrape = $xpath->query("//tbody/tr");
 		$scrape = $xpath->query("//tbody/tr");
 
 
 		// No results
 		// No results
-        if(count($scrape) == 0) return $engine_temp;
+        if(count($scrape) == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($scrape as $result) {
 		foreach($scrape as $result) {
 			// Find data
 			// Find data
@@ -116,7 +122,9 @@ class NyaaRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
-		unset($response, $xpath, $scrape, $number_of_results, $engine_temp);
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, count($scrape), count($engine_temp));
+
+		unset($response, $xpath, $scrape, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;
 	}
 	}

+ 11 - 3
engines/magnet/sukebei.php

@@ -27,13 +27,19 @@ class SukebeiRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 		
 		
 		// No response
 		// No response
-		if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 		
 		
 		// Scrape the results
 		// Scrape the results
 		$scrape = $xpath->query("//tbody/tr");
 		$scrape = $xpath->query("//tbody/tr");
 
 
 		// No results
 		// No results
-        if(count($scrape) == 0) return $engine_temp;
+        if(count($scrape) == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($scrape as $result) {
 		foreach($scrape as $result) {
 			// Find data
 			// Find data
@@ -113,7 +119,9 @@ class SukebeiRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
-		unset($response, $xpath, $scrape, $number_of_results, $engine_temp);
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, count($scrape), count($engine_temp));
+
+		unset($response, $xpath, $scrape, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;
 	}
 	}

+ 11 - 3
engines/magnet/thepiratebay.php

@@ -32,10 +32,16 @@ class PirateBayRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 		
 		
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 		
 		
 		// No results
 		// No results
-        if($json_response[0]['name'] == 'No results returned') return $engine_temp;
+        if($json_response[0]['name'] == 'No results returned') {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		$categories = array(
 		$categories = array(
 			100 => 'Audio',
 			100 => 'Audio',
@@ -173,7 +179,9 @@ class PirateBayRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
-		unset($response, $json_response, $number_of_results, $engine_temp, $categories);
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, count($json_response), count($engine_temp));
+
+		unset($response, $json_response, $engine_temp, $categories);
 
 
 		return $engine_result;
 		return $engine_result;
 	}
 	}

+ 11 - 3
engines/magnet/yts.php

@@ -32,10 +32,16 @@ class YTSRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 		
 		
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// No results
 		// No results
-        if($json_response['data']['movie_count'] == 0) return $engine_temp;
+        if($json_response['data']['movie_count'] == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($json_response['data']['movies'] as $result) {
 		foreach($json_response['data']['movies'] as $result) {
 			// Find and process data
 			// Find and process data
@@ -113,7 +119,9 @@ class YTSRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
-		unset($response, $json_response, $number_of_results, $engine_temp);
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $json_response['data']['movie_count'], count($engine_temp));
+
+		unset($response, $json_response, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;
 	}
 	}

+ 10 - 2
engines/news/brave-news.php

@@ -33,7 +33,10 @@ class BraveNewsRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 
 
 		// No response
 		// No response
-		if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results (Max 30)
 		// Scrape the results (Max 30)
 		$scrape = $xpath->query("//main[contains(@class, 'main-column')]//div[contains(@class, 'snippet')][position() < 30]");
 		$scrape = $xpath->query("//main[contains(@class, 'main-column')]//div[contains(@class, 'snippet')][position() < 30]");
@@ -42,7 +45,10 @@ class BraveNewsRequest extends EngineRequest {
 		$number_of_results = $rank = count($scrape);
 		$number_of_results = $rank = count($scrape);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($scrape as $result) {
 		foreach($scrape as $result) {
 			// Find data
 			// Find data
@@ -88,6 +94,8 @@ class BraveNewsRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;

+ 10 - 2
engines/news/hackernews.php

@@ -43,13 +43,19 @@ class HackernewsRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Figure out results and base rank
 		// Figure out results and base rank
 		$number_of_results = $rank = count($json_response['hits']);
 		$number_of_results = $rank = count($json_response['hits']);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($json_response['hits'] as $result) {
 		foreach($json_response['hits'] as $result) {
 			// Skip broken/wrong results
 			// Skip broken/wrong results
@@ -86,6 +92,8 @@ class HackernewsRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;

+ 10 - 2
engines/news/qwant-news.php

@@ -48,13 +48,19 @@ class QwantNewsRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Figure out results and base rank
 		// Figure out results and base rank
 		$number_of_results = $rank = $json_response['data']['result']['total'];
 		$number_of_results = $rank = $json_response['data']['result']['total'];
 
 
 		// No results
 		// No results
-        if($number_of_results == 0 || $json_response['status'] == 'error') return $engine_temp;
+        if($number_of_results == 0 || $json_response['status'] == 'error') {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($json_response['data']['result']['items'] as $result) {
 		foreach($json_response['data']['result']['items'] as $result) {
 			// Find and process data
 			// Find and process data
@@ -86,6 +92,8 @@ class QwantNewsRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;

+ 10 - 2
engines/news/yahoo-news.php

@@ -39,7 +39,10 @@ class YahooNewsRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 
 
 		// No response
 		// No response
-		if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results (Max 30)
 		// Scrape the results (Max 30)
 		$scrape = $xpath->query("//div[@id='web']/ol/li[position() < 30]");
 		$scrape = $xpath->query("//div[@id='web']/ol/li[position() < 30]");
@@ -48,7 +51,10 @@ class YahooNewsRequest extends EngineRequest {
 		$number_of_results = $rank = count($scrape);
 		$number_of_results = $rank = count($scrape);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($scrape as $result) {
 		foreach($scrape as $result) {
 			// Find data
 			// Find data
@@ -102,6 +108,8 @@ class YahooNewsRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;

+ 6 - 6
engines/search-image.php

@@ -130,23 +130,23 @@ class ImageSearch extends EngineRequest {
     }
     }
 
 
     public static function print_results($goosle_results, $search, $opts) {
     public static function print_results($goosle_results, $search, $opts) {
-/*
 // Uncomment for debugging
 // Uncomment for debugging
-echo '<pre>Settings: ';
+/*
+echo "<pre>Settings: ";
 print_r($opts);
 print_r($opts);
-echo '</pre>';
+echo "</pre>";
 echo "<pre>Search data: ";
 echo "<pre>Search data: ";
 print_r($search);
 print_r($search);
 echo "</pre>";
 echo "</pre>";
-echo '<pre>Search results: ';
+echo "<pre>Search results: ";
 print_r($goosle_results);
 print_r($goosle_results);
-echo '</pre>';
+echo "</pre>";
 */
 */
 
 
 		if(array_key_exists('search', $goosle_results)) {
 		if(array_key_exists('search', $goosle_results)) {
 			// Pagination offset
 			// Pagination offset
 			if($opts->cache_type !== 'off') {
 			if($opts->cache_type !== 'off') {
-				$offset = ((($search->page - 1) * $opts->search_results_per_page) + 1);
+				$offset = ((($search->page - 1) * $opts->search_results_per_page));
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 			}
 			}
 
 

+ 20 - 8
engines/search-magnet.php

@@ -159,17 +159,17 @@ class MagnetSearch extends EngineRequest {
     }
     }
 
 
     public static function print_results($goosle_results, $search, $opts) {
     public static function print_results($goosle_results, $search, $opts) {
-/*
 // Uncomment for debugging
 // Uncomment for debugging
-echo '<pre>Settings: ';
+/*
+echo "<pre>Settings: ";
 print_r($opts);
 print_r($opts);
-echo '</pre>';
+echo "</pre>";
 echo "<pre>Search data: ";
 echo "<pre>Search data: ";
 print_r($search);
 print_r($search);
 echo "</pre>";
 echo "</pre>";
-echo '<pre>Search results: ';
+echo "<pre>Search results: ";
 print_r($goosle_results);
 print_r($goosle_results);
-echo '</pre>';
+echo "</pre>";
 */
 */
 
 
 		// Latest additions to yts
 		// Latest additions to yts
@@ -212,15 +212,17 @@ echo '</pre>';
 
 
 				// Get the result
 				// Get the result
 				$first = array($found_id => $goosle_results['search'][$found_id]);
 				$first = array($found_id => $goosle_results['search'][$found_id]);
+
 				// Delete the result wherever it is
 				// Delete the result wherever it is
 				unset($goosle_results['search'][$found_id], $keys, $found_id);
 				unset($goosle_results['search'][$found_id], $keys, $found_id);
+
 				// Add the result as the first item
 				// Add the result as the first item
 				$goosle_results['search'] = array_merge($first, $goosle_results['search']);
 				$goosle_results['search'] = array_merge($first, $goosle_results['search']);
 			}
 			}
 
 
 			// Pagination offset
 			// Pagination offset
 			if($opts->cache_type !== 'off') {
 			if($opts->cache_type !== 'off') {
-				$offset = ((($search->page - 1) * $opts->search_results_per_page) + 1);
+				$offset = ((($search->page - 1) * $opts->search_results_per_page));
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 			}
 			}
 
 
@@ -270,8 +272,9 @@ echo '</pre>';
 				// Result sources
 				// Result sources
 				if($opts->show_search_source == 'on') {
 				if($opts->show_search_source == 'on') {
 					// If available, add a link to the found torrent page
 					// If available, add a link to the found torrent page
-					$url = (!is_null($result['url'])) ? " &bull; <a href=\"".$result['url']."\" target=\"_blank\" title=\"Visit torrent page\">torrent page</a> <span class=\"tooltip tooltip-alert\"><span class=\"tooltiptext\"><strong>Careful!</strong> Site may contain intrusive popup ads and malware!</span></span>" : "";
-
+//					$url = (!is_null($result['url'])) ? " &bull; <a href=\"".$result['url']."\" target=\"_blank\" title=\"Visit torrent page\">torrent page</a>" : "";
+					$url = (!is_null($result['url'])) ? " &bull; <a href=\"".$result['url']."\" target=\"_blank\" title=\"Visit torrent page\">torrent page</a> <a onclick=\"openpopup('info-torrentpagelink')\" title=\"Click for more information\"><span class=\"tooltip-alert\"></span></a>" : "";
+					
 					echo "	<p><small>Found on ".replace_last_comma(implode(', ', $result['combo_source'])).$url."</small></p>";
 					echo "	<p><small>Found on ".replace_last_comma(implode(', ', $result['combo_source'])).$url."</small></p>";
 				}
 				}
 				echo "	</div>";
 				echo "	</div>";
@@ -307,6 +310,15 @@ echo '</pre>';
 			}
 			}
 
 
 			echo "<p class=\"text-center\"><small>Goosle does not index, offer or distribute torrent files.</small></p>";
 			echo "<p class=\"text-center\"><small>Goosle does not index, offer or distribute torrent files.</small></p>";
+
+			// Popup (Normally hidden)
+			echo "<div id=\"info-torrentpagelink\" class=\"goosebox\">";
+			echo "	<div class=\"goosebox-body\">";
+			echo "		<h2>Be careful with torrent sites</h2>";
+			echo "		<p>Many torrent websites have intrusive popup ads and malware! Be careful what you click on and close any popups that appear.</p>";
+			echo "		<p><a onclick=\"closepopup()\">Close</a></p>";
+			echo "	</div>";
+			echo "</div>";
 		}
 		}
 
 
 		// No results found
 		// No results found

+ 6 - 6
engines/search-news.php

@@ -144,23 +144,23 @@ class NewsSearch extends EngineRequest {
     }
     }
 
 
     public static function print_results($goosle_results, $search, $opts) {
     public static function print_results($goosle_results, $search, $opts) {
-/*
 // Uncomment for debugging
 // Uncomment for debugging
-echo '<pre>Settings: ';
+/*
+echo "<pre>Settings: ";
 print_r($opts);
 print_r($opts);
-echo '</pre>';
+echo "</pre>";
 echo "<pre>Search data: ";
 echo "<pre>Search data: ";
 print_r($search);
 print_r($search);
 echo "</pre>";
 echo "</pre>";
-echo '<pre>Search results: ';
+echo "<pre>Search results: ";
 print_r($goosle_results);
 print_r($goosle_results);
-echo '</pre>';
+echo "</pre>";
 */
 */
 
 
 		if(array_key_exists('search', $goosle_results)) {
 		if(array_key_exists('search', $goosle_results)) {
 			// Pagination offset
 			// Pagination offset
 			if($opts->cache_type !== 'off') {
 			if($opts->cache_type !== 'off') {
-				$offset = ((($search->page - 1) * $opts->search_results_per_page) + 1);
+				$offset = ((($search->page - 1) * $opts->search_results_per_page));
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 			}
 			}
 
 

+ 14 - 3
engines/search.php

@@ -52,7 +52,7 @@ class Search extends EngineRequest {
 		
 		
 		// Dictionary
 		// Dictionary
 		if($opts->special['definition'] == 'on') {
 		if($opts->special['definition'] == 'on') {
-			if($search->count_terms == 2 && ($search->query_terms[0] == 'define' || $search->query_terms[0] == 'meaning')) {
+			if($search->count_terms == 2 && ($search->query_terms[0] == 'def' || $search->query_terms[0] == 'define' || $search->query_terms[0] == 'meaning')) {
 		        require ABSPATH.'engines/special/definition.php';
 		        require ABSPATH.'engines/special/definition.php';
 				$this->special_request = new DefinitionRequest($search, $opts, $mh);
 				$this->special_request = new DefinitionRequest($search, $opts, $mh);
 			}
 			}
@@ -208,7 +208,7 @@ echo "</pre>";
 		if(array_key_exists('search', $goosle_results)) {
 		if(array_key_exists('search', $goosle_results)) {
 			// Pagination offset
 			// Pagination offset
 			if($opts->cache_type !== 'off') {
 			if($opts->cache_type !== 'off') {
-				$offset = ((($search->page - 1) * $opts->search_results_per_page) + 1);
+				$offset = ((($search->page - 1) * $opts->search_results_per_page));
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 				$goosle_results['search'] = array_slice($goosle_results['search'], $offset, $opts->search_results_per_page);
 			}
 			}
 
 
@@ -258,7 +258,8 @@ echo "</pre>";
 				echo "		<p>".$result['description']."</p>";
 				echo "		<p>".$result['description']."</p>";
 				if($opts->enable_magnet_search == 'on' && $opts->imdb_id_search == 'on') {
 				if($opts->enable_magnet_search == 'on' && $opts->imdb_id_search == 'on') {
 					if(stristr($result['url'], 'imdb.com') !== false && preg_match_all('/(?:tt[0-9]+)/i', $result['url'], $imdb_result)) {
 					if(stristr($result['url'], 'imdb.com') !== false && preg_match_all('/(?:tt[0-9]+)/i', $result['url'], $imdb_result)) {
-						echo "		<p><strong>Goosle detected an IMDb ID for this result, search for <a href=\"./results.php?q=".$imdb_result[0][0]."&a=".$opts->hash."&t=9\" title=\"Search for Magnet links\">Magnet links</a>?</strong> <span class=\"tooltip tooltip-question\"><span class=\"tooltiptext\">A Magnet link is a special link for torrent clients to download software, music, movies and tv-shows.</span></span></p>";
+//						echo "		<p><strong>Goosle detected an IMDb ID for this result, search for <a href=\"./results.php?q=".$imdb_result[0][0]."&a=".$opts->hash."&t=9\" title=\"Search for Magnet links\">Magnet links</a>?</strong></p>";
+						echo "		<p><strong>Goosle detected an IMDb ID for this result, search for <a href=\"./results.php?q=".$imdb_result[0][0]."&a=".$opts->hash."&t=9\" title=\"Search for Magnet links\">Magnet links</a>?</strong> <a onclick=\"openpopup('info-magnetresult')\" title=\"Click for more information\"><span class=\"tooltip-question\"></span></a></p>";
 					}
 					}
 				}
 				}
 
 
@@ -274,6 +275,16 @@ echo "</pre>";
 			if($opts->cache_type !== 'off' && $goosle_results['number_of_results'] > $opts->search_results_per_page) {
 			if($opts->cache_type !== 'off' && $goosle_results['number_of_results'] > $opts->search_results_per_page) {
 				echo "<p class=\"pagination\">".search_pagination($search, $opts, $goosle_results['number_of_results'])."</p>";
 				echo "<p class=\"pagination\">".search_pagination($search, $opts, $goosle_results['number_of_results'])."</p>";
 			}
 			}
+
+			// Popup (Normally hidden)
+			echo "<div id=\"info-magnetresult\" class=\"goosebox\">";
+			echo "	<div class=\"goosebox-body\">";
+			echo "		<h2>Magnet links</h2>";
+			echo "		<p>A Magnet link is a special link that torrent clients can use to find and download software, music, movies and tv-shows.</p>";
+			echo "		<p>Magnet links are part of the Magnet Search function. You'll need a Bittorrent client that accepts Magnet links in order to use these search results. You can find more information about how to use Magnet Search on the <a href=\"./help.php?a=".$opts->hash."\">Help page</a>.</p>";
+			echo "		<p><a onclick=\"closepopup()\">Close</a></p>";
+			echo "	</div>";
+			echo "</div>";
 		}
 		}
 
 
 		// Some error occured
 		// Some error occured

+ 10 - 2
engines/search/brave.php

@@ -33,7 +33,10 @@ class BraveRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 
 
 		// No response
 		// No response
-		if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results
 		// Scrape the results
 		$scrape = $xpath->query("//div[@id='results']//div[contains(@class, 'snippet')]");
 		$scrape = $xpath->query("//div[@id='results']//div[contains(@class, 'snippet')]");
@@ -42,7 +45,10 @@ class BraveRequest extends EngineRequest {
 		$number_of_results = $rank = count($scrape);
 		$number_of_results = $rank = count($scrape);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		foreach($scrape as $result) {
 		foreach($scrape as $result) {
 			// Find data
 			// Find data
@@ -80,6 +86,8 @@ class BraveRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;

+ 14 - 8
engines/search/duckduckgo.php

@@ -20,14 +20,11 @@ class DuckDuckGoRequest extends EngineRequest {
 			$safe = '-1';
 			$safe = '-1';
 		}
 		}
 
 
-		// Set locale
-		$language = (preg_match('/[a-z]{2}-[a-z]{2}/i', $this->opts->duckduckgo_language) && strlen($this->opts->duckduckgo_language) == 5) ? strtolower($this->opts->duckduckgo_language) : 'en_gb';
-
 		// All parameters and values: https://duckduckgo.com/duckduckgo-help-pages/settings/params/
 		// All parameters and values: https://duckduckgo.com/duckduckgo-help-pages/settings/params/
         $url = 'https://html.duckduckgo.com/html/?'.http_build_query(array(
         $url = 'https://html.duckduckgo.com/html/?'.http_build_query(array(
         	'q' => $this->search->query, // Search query
         	'q' => $this->search->query, // Search query
         	'kp' => $safe, // Safe search (1 = on, -1 = moderate, -2 = off
         	'kp' => $safe, // Safe search (1 = on, -1 = moderate, -2 = off
-        	'kl' => $language, // Language region
+        	'kl' => strtolower($this->opts->duckduckgo_language), // Language region
         	'kz' => '-1', // Instant answers (1 = on, -1 = off)
         	'kz' => '-1', // Instant answers (1 = on, -1 = off)
         	'kc' => '-1', // Autoload images (1 = on, -1 = off)
         	'kc' => '-1', // Autoload images (1 = on, -1 = off)
         	'kav' => '-1', // Autoload results (1 = on, -1 = off)
         	'kav' => '-1', // Autoload results (1 = on, -1 = off)
@@ -40,7 +37,7 @@ class DuckDuckGoRequest extends EngineRequest {
         	'k1' => '-1' // Ads (1 = on, -1 = off)
         	'k1' => '-1' // Ads (1 = on, -1 = off)
         ));
         ));
 
 
-        unset($safe, $language);
+        unset($safe);
 
 
         return $url;
         return $url;
     }
     }
@@ -56,16 +53,23 @@ class DuckDuckGoRequest extends EngineRequest {
 		$xpath = get_xpath($response);
 		$xpath = get_xpath($response);
 
 
 		// No response
 		// No response
-		if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results
 		// Scrape the results
-		$scrape = $xpath->query("/html/body/div[1]/div[".count($xpath->query("/html/body/div[1]/div"))."]/div/div/div[contains(@class, 'web-result')]/div");
+//		$scrape = $xpath->query("/html/body/div[1]/div[".count($xpath->query("/html/body/div[1]/div"))."]/div/div/div[contains(@class, 'web-result')]/div");
+		$scrape = $xpath->query("//div[contains(@class, 'result__body')]");
 
 
 		// Figure out results and base rank
 		// Figure out results and base rank
 		$number_of_results = $rank = count($scrape);
 		$number_of_results = $rank = count($scrape);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		// Scrape recommended
 		// Scrape recommended
 		$didyoumean = $xpath->query(".//div[@id='did_you_mean']/a[1]")[0];
 		$didyoumean = $xpath->query(".//div[@id='did_you_mean']/a[1]")[0];
@@ -112,6 +116,8 @@ class DuckDuckGoRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 
 
 		return $engine_result;
 		return $engine_result;

+ 10 - 2
engines/search/google.php

@@ -37,7 +37,10 @@ class GoogleRequest extends EngineRequest {
         $xpath = get_xpath($response);
         $xpath = get_xpath($response);
 
 
 		// No response
 		// No response
-        if(!$xpath) return $engine_temp;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results
 		// Scrape the results
 		$scrape = $xpath->query("//div[@id='search']//div[@class='MjjYud']");
 		$scrape = $xpath->query("//div[@id='search']//div[@class='MjjYud']");
@@ -46,7 +49,10 @@ class GoogleRequest extends EngineRequest {
 		$number_of_results = $rank = count($scrape);
 		$number_of_results = $rank = count($scrape);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		// Scrape recommended
 		// Scrape recommended
         $didyoumean = $xpath->query(".//a[@class='gL9Hy']")[0];
         $didyoumean = $xpath->query(".//a[@class='gL9Hy']")[0];
@@ -94,6 +100,8 @@ class GoogleRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 		unset($response, $xpath, $scrape, $number_of_results, $rank, $engine_temp);
 
 
         return $engine_result;
         return $engine_result;

+ 37 - 27
engines/search/qwant.php

@@ -11,20 +11,17 @@
 ------------------------------------------------------------------------------------ */
 ------------------------------------------------------------------------------------ */
 class QwantRequest extends EngineRequest {
 class QwantRequest extends EngineRequest {
     public function get_request_url() {
     public function get_request_url() {
-		// Set locale
-		$language = (preg_match('/[a-z]{2}_[a-z]{2}/i', $this->opts->qwant_language) && strlen($this->opts->qwant_language) == 5) ? strtolower($this->opts->qwant_language) : 'en_gb';
-
 		// Based on https://github.com/locness3/qwant-api-docs and variables from qwant website
 		// Based on https://github.com/locness3/qwant-api-docs and variables from qwant website
         $url = 'https://api.qwant.com/v3/search/web?'.http_build_query(array(
         $url = 'https://api.qwant.com/v3/search/web?'.http_build_query(array(
         	'q' => $this->search->query, // Search query
         	'q' => $this->search->query, // Search query
         	't' => 'web', // Type of search, web search
         	't' => 'web', // Type of search, web search
         	'safesearch' => $this->search->safe, // Safe search filter (0 = off, 1 = normal, 2 = strict)
         	'safesearch' => $this->search->safe, // Safe search filter (0 = off, 1 = normal, 2 = strict)
-        	'locale' => $language, // In which language should the search be done
+        	'locale' => strtolower($this->opts->qwant_language), // In which language should the search be done
         	'count' => 10, // How many results? (Maximum 10)
         	'count' => 10, // How many results? (Maximum 10)
         	'device' => 'desktop' // What kind of device are we searching from?
         	'device' => 'desktop' // What kind of device are we searching from?
         ));
         ));
 
 
-        unset($query, $language);
+        unset($query);
 
 
         return $url;
         return $url;
     }
     }
@@ -41,37 +38,48 @@ class QwantRequest extends EngineRequest {
 	}
 	}
 
 
 	public function parse_results($response) {
 	public function parse_results($response) {
-		$engine_temp = $engine_result = array();
+		$engine_temp = $engine_mess = $engine_result = array();
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
+
+		// Sort out the messy response from Qwant
+		foreach($json_response['data']['result']['items']['mainline'] as $mainline) {
+			if($mainline['type'] != 'web') continue;
+			
+			foreach($mainline['items'] as $result) {
+				$engine_mess[] = $result;
+			}
+
+			unset($mainline, $result);
+		}
 
 
 		// Figure out results and base rank
 		// Figure out results and base rank
-		$number_of_results = $rank = $json_response['data']['result']['total'];
+		$number_of_results = $rank = count($engine_mess);
 
 
 		// No results
 		// No results
-        if($number_of_results == 0 || $json_response['status'] == 'error') return $engine_temp;
-
-		$rank = $json_response['data']['result']['total'];
+        if($number_of_results == 0 || $json_response['status'] == 'error') {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
-		foreach($json_response['data']['result']['items']['mainline'] as $mainline) {
-			if($mainline['type'] != 'web') continue;
+		foreach($engine_mess as $result) {
+			// Find and process data
+			$title = strip_newlines(sanitize($result['title']));
+			$url = sanitize($result['url']);
+			$description = limit_string_length(strip_newlines(sanitize($result['desc'])));
 
 
-			foreach ($mainline['items'] as $result) {
-				// Find and process data
-				$title = strip_newlines(sanitize($result['title']));
-				$url = sanitize($result['url']);
-				$description = limit_string_length(strip_newlines(sanitize($result['desc'])));
-	
-				$engine_temp[] = array (
-					'title' => $title, 
-					'url' => $url, 
-					'description' => $description, 
-					'engine_rank' => $rank
-				);
-				$rank -= 1;
-			}
+			$engine_temp[] = array (
+				'title' => $title, 
+				'url' => $url, 
+				'description' => $description, 
+				'engine_rank' => $rank
+			);
+			$rank -= 1;
 		}
 		}
 
 
 		// Base info
 		// Base info
@@ -80,6 +88,8 @@ class QwantRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 		
 		
 		return $engine_result;
 		return $engine_result;

+ 11 - 9
engines/search/wikipedia.php

@@ -11,11 +11,8 @@
 ------------------------------------------------------------------------------------ */
 ------------------------------------------------------------------------------------ */
 class WikiRequest extends EngineRequest {
 class WikiRequest extends EngineRequest {
     public function get_request_url() {
     public function get_request_url() {
-	    // Set locale
-		$language = (strlen($this->opts->wikipedia_language) == 2) ? strtolower($this->opts->wikipedia_language) : 'en';
-
 		// Variables based on https://www.mediawiki.org/wiki/API:Search
 		// Variables based on https://www.mediawiki.org/wiki/API:Search
-        $url = 'https://'.$language.'.wikipedia.org/w/api.php?'.http_build_query(array(
+        $url = 'https://'.strtolower($this->opts->wikipedia_language).'.wikipedia.org/w/api.php?'.http_build_query(array(
         	'srsearch' => $this->search->query, // Search query
         	'srsearch' => $this->search->query, // Search query
         	'action' => 'query', // Search type (via a query?)
         	'action' => 'query', // Search type (via a query?)
         	'list' => 'search', // Full text search
         	'list' => 'search', // Full text search
@@ -23,8 +20,6 @@ class WikiRequest extends EngineRequest {
         	'srlimit' => 10 // How many search results to get, ideally as few as possible since it's just static wiki pages (max 500)
         	'srlimit' => 10 // How many search results to get, ideally as few as possible since it's just static wiki pages (max 500)
         ));
         ));
 
 
-		unset($language);
-
         return $url;
         return $url;
     }
     }
 
 
@@ -44,14 +39,19 @@ class WikiRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 		
 		
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_temp;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Figure out results and base rank
 		// Figure out results and base rank
 		$number_of_results = $rank = ($json_response['query']['searchinfo']['totalhits'] > 20) ? 20 : $json_response['query']['searchinfo']['totalhits'];
 		$number_of_results = $rank = ($json_response['query']['searchinfo']['totalhits'] > 20) ? 20 : $json_response['query']['searchinfo']['totalhits'];
 
 
 		// No results
 		// No results
-        if($number_of_results == 0) return $engine_temp;
-
+        if($number_of_results == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 		foreach($json_response['query']['search'] as $result) {
 		foreach($json_response['query']['search'] as $result) {
 			// Find and process data
 			// Find and process data
 			$title = strip_newlines(sanitize($result['title']));
 			$title = strip_newlines(sanitize($result['title']));
@@ -73,6 +73,8 @@ class WikiRequest extends EngineRequest {
 			$engine_result['search'] = $engine_temp;
 			$engine_result['search'] = $engine_temp;
 		}
 		}
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, $number_of_results, count($engine_temp));
+
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 		unset($response, $json_response, $number_of_results, $rank, $engine_temp);
 		
 		
 		return $engine_result;
 		return $engine_result;

+ 10 - 2
engines/special/currency.php

@@ -32,10 +32,16 @@ class CurrencyRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_result;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// No results
 		// No results
-        if(count($json_response['rates']) == 0) return $engine_result;
+        if(count($json_response['rates']) == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);
+			return $engine_result;
+		}
 
 
 		// Process query
 		// Process query
 		// [0] = AMOUNT
 		// [0] = AMOUNT
@@ -64,6 +70,8 @@ class CurrencyRequest extends EngineRequest {
             'source' => "https://moneyconvert.net/"
             'source' => "https://moneyconvert.net/"
         );
         );
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 1, 1);
+
 		unset($response, $json_response, $amount, $amount_currency, $conversion, $one_to_n, $conversion_currency, $last_update);
 		unset($response, $json_response, $amount, $amount_currency, $conversion, $one_to_n, $conversion_currency, $last_update);
 
 
 		return $engine_result;
 		return $engine_result;

+ 12 - 2
engines/special/definition.php

@@ -34,10 +34,18 @@ class DefinitionRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_result;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
+
 
 
 		// No results
 		// No results
-        if(isset($json_response['title']) && $json_response['title'] == 'No Definitions Found') return $engine_result;
+        if(isset($json_response['title']) && $json_response['title'] == 'No Definitions Found') {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No results', 0);
+			return $engine_result;
+		}
+
 
 
 		$result = $json_response[0]; // Always grab the first result
 		$result = $json_response[0]; // Always grab the first result
 
 
@@ -81,6 +89,8 @@ class DefinitionRequest extends EngineRequest {
 			'source' => sanitize($result['sourceUrls'][0])
 			'source' => sanitize($result['sourceUrls'][0])
 		);
 		);
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 1, 1);
+
 		unset($response, $json_response, $result, $phonetic, $definitions, $formatted_response);
 		unset($response, $json_response, $result, $phonetic, $definitions, $formatted_response);
 
 
 		return $engine_result;
 		return $engine_result;

+ 7 - 1
engines/special/ipify.php

@@ -32,7 +32,11 @@ class ipRequest extends EngineRequest {
 		$json_response = json_decode($response, true);
 		$json_response = json_decode($response, true);
 
 
 		// No response
 		// No response
-		if(empty($json_response)) return $engine_result;
+		if(empty($json_response)) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 'No response', 0);
+			return $engine_result;
+		}
+
 
 
 		// Return result
 		// Return result
         $engine_result = array(
         $engine_result = array(
@@ -42,6 +46,8 @@ class ipRequest extends EngineRequest {
             'note' => "Goosle is not a proxy server. Any website that you visit through Goosle Search Results will see your actual IP Address."
             'note' => "Goosle is not a proxy server. Any website that you visit through Goosle Search Results will see your actual IP Address."
         );
         );
 
 
+		if($this->opts->querylog == 'on') querylog(get_class($this), 'a', $this->url, 1, 1);
+
 		unset($response, $json_response);
 		unset($response, $json_response);
 
 
 		return $engine_result;
 		return $engine_result;

+ 11 - 2
engines/special/php.php

@@ -32,13 +32,19 @@ class PHPnetRequest extends EngineRequest {
         $xpath = get_xpath($response);
         $xpath = get_xpath($response);
 
 
 		// No response
 		// No response
-		if(!$xpath) return $engine_result;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results
 		// Scrape the results
 		$scrape = $xpath->query("//div[@class='refentry']");
 		$scrape = $xpath->query("//div[@class='refentry']");
 
 
 		// No results
 		// No results
-        if(count($scrape) == 0) return $engine_result;
+        if(count($scrape) == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		$query = str_replace('_', '-', $this->search->query_terms[1]);
 		$query = str_replace('_', '-', $this->search->query_terms[1]);
 
 
@@ -68,6 +74,9 @@ class PHPnetRequest extends EngineRequest {
 			'source' => "https://www.php.net/manual/function.".urlencode($query).".php",
 			'source' => "https://www.php.net/manual/function.".urlencode($query).".php",
 			'note' => "Description may be incomplete. Always check the documentation page for more information."
 			'note' => "Description may be incomplete. Always check the documentation page for more information."
 		);
 		);
+
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 1, 1);
+
 		unset($response, $xpath, $scrape);
 		unset($response, $xpath, $scrape);
 
 
 		return $engine_result;
 		return $engine_result;

+ 12 - 5
engines/special/wordpress.php

@@ -22,9 +22,7 @@ class WordPressRequest extends EngineRequest {
 			$query = $this->search->query_terms[1];
 			$query = $this->search->query_terms[1];
 		}
 		}
 
 
-		
-
-		$url = 'https://developer.wordpress.org/reference/'.$type.'/.'.urlencode($query).'/';
+		$url = 'https://developer.wordpress.org/reference/'.$type.'/'.urlencode($query).'/';
 
 
 		unset($query, $type);
 		unset($query, $type);
 		
 		
@@ -42,13 +40,19 @@ class WordPressRequest extends EngineRequest {
         $xpath = get_xpath($response);
         $xpath = get_xpath($response);
 
 
 		// No response
 		// No response
-		if(!$xpath) return $engine_result;
+		if(!$xpath) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No response', 0);
+			return $engine_result;
+		}
 
 
 		// Scrape the results
 		// Scrape the results
 		$scrape = $xpath->query("//div/main/article");
 		$scrape = $xpath->query("//div/main/article");
 
 
 		// No results
 		// No results
-        if(count($scrape) == 0) return $engine_result;
+        if(count($scrape) == 0) {
+			if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 'No results', 0);	        
+	        return $engine_result;
+	    }
 
 
 		if($this->search->query_terms[1] == 'hook') {
 		if($this->search->query_terms[1] == 'hook') {
 			$type = 'hooks';
 			$type = 'hooks';
@@ -84,6 +88,9 @@ class WordPressRequest extends EngineRequest {
 			'source' => "https://developer.wordpress.org/reference/".$type."/".urlencode($query)."/",
 			'source' => "https://developer.wordpress.org/reference/".$type."/".urlencode($query)."/",
 			'note' => "Description may be incomplete. Always check the documentation page for more information."
 			'note' => "Description may be incomplete. Always check the documentation page for more information."
 		);
 		);
+
+		if($this->opts->querylog == 'on') querylog(get_class($this), 's', $this->url, 1, 1);
+
 		unset($response, $xpath, $scrape);
 		unset($response, $xpath, $scrape);
 
 
 		return $engine_result;
 		return $engine_result;

+ 1 - 1
functions/tools-magnet.php

@@ -67,7 +67,7 @@ function detect_nsfw($string) {
 	// Forbidden terms
 	// Forbidden terms
 	//Basic pattern: ^cum[-_\s]?play(ing|ed|s)?
 	//Basic pattern: ^cum[-_\s]?play(ing|ed|s)?
 	$nsfw_keywords = array(
 	$nsfw_keywords = array(
-		'/(deepthroat|gangbang|cowgirl|dildo|fuck|cuckold|anal|humpfinger|kiss|pegg|fist|ballbust|twerk|dogg|squirt)(ing|ed|s)?/', 
+		'/(deepthroat|gangbang|cowgirl|dildo|fuck|cuckold|anal|hump|finger|kiss|pegg|fist|ballbust|twerk|dogg|squirt)(ing|ed|s)?/', 
 		'/(yaoi|porn|gonzo|erotica|blowbang|bukkake|gokkun|onlyfans|fansly|manyvids|softcore|hardcore|latex|lingerie|interracial|bdsm|chastity|hogtied|kinky|bondage|shibari|hitachi|upskirt)/', 
 		'/(yaoi|porn|gonzo|erotica|blowbang|bukkake|gokkun|onlyfans|fansly|manyvids|softcore|hardcore|latex|lingerie|interracial|bdsm|chastity|hogtied|kinky|bondage|shibari|hitachi|upskirt)/', 
 		'/(cock|creampie|cameltoe|enema|nipple|sybian|vibrator|cougar|threesome|foursome|pornstar|escort)(s)?/', 
 		'/(cock|creampie|cameltoe|enema|nipple|sybian|vibrator|cougar|threesome|foursome|pornstar|escort)(s)?/', 
 		'/(cmnf|cfnm|pov|cbt|bbw|pawg|ssbbw|joi|cei)/', 
 		'/(cmnf|cfnm|pov|cbt|bbw|pawg|ssbbw|joi|cei)/', 

+ 27 - 20
functions/tools.php

@@ -10,6 +10,9 @@
 *  liability that might arise from its use.
 *  liability that might arise from its use.
 ------------------------------------------------------------------------------------ */
 ------------------------------------------------------------------------------------ */
 
 
+// Current Goosle version
+$current_version = '1.6.1';
+
 /*--------------------------------------
 /*--------------------------------------
 // Verify the hash, or not, and let people in, or not
 // Verify the hash, or not, and let people in, or not
 --------------------------------------*/
 --------------------------------------*/
@@ -28,7 +31,7 @@ function load_opts() {
 	if(!is_file($config_file)) {
 	if(!is_file($config_file)) {
 		echo "<h3>config.php is missing!</h3>";
 		echo "<h3>config.php is missing!</h3>";
 		echo "<p>Please check the readme.md file for complete installation instructions.</p>";
 		echo "<p>Please check the readme.md file for complete installation instructions.</p>";
-		echo "<p>Configure Goosle properly by copying config.default.php to config.php. In config.php you can set your preferences.</p>";
+		echo "<p>Configure Goosle by copying config.default.php to config.php. In config.php you can set your preferences.</p>";
 
 
 		die();
 		die();
 	} else {
 	} else {
@@ -39,7 +42,6 @@ function load_opts() {
 		$opts->pixel = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
 		$opts->pixel = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
 
 
 		// Force a few defaults and safeguards
 		// Force a few defaults and safeguards
-		if(empty($opts->colorscheme)) $opts->colorscheme = 'default';
 		if($opts->cache_type == 'file' && !is_dir(ABSPATH.'cache/')) $opts->cache_type = 'off';
 		if($opts->cache_type == 'file' && !is_dir(ABSPATH.'cache/')) $opts->cache_type = 'off';
 		if($opts->cache_type == 'apcu' && !function_exists('apcu_exists')) $opts->cache_type = 'off';
 		if($opts->cache_type == 'apcu' && !function_exists('apcu_exists')) $opts->cache_type = 'off';
 		if($opts->cache_time < 1 || ($opts->cache_type == 'apcu' && $opts->cache_time > 8) || ($opts->cache_type == 'file' && $opts->cache_time > 48)) $opts->cache_time = 8;
 		if($opts->cache_time < 1 || ($opts->cache_type == 'apcu' && $opts->cache_time > 8) || ($opts->cache_type == 'file' && $opts->cache_time > 48)) $opts->cache_time = 8;
@@ -54,8 +56,6 @@ function load_opts() {
 // Process search query
 // Process search query
 --------------------------------------*/
 --------------------------------------*/
 function load_search() {
 function load_search() {
-	global $opts;
-
 	$search = new stdClass();
 	$search = new stdClass();
 
 
 	// From the url/request	
 	// From the url/request	
@@ -148,28 +148,22 @@ function count_stats() {
 }
 }
 
 
 /*--------------------------------------
 /*--------------------------------------
-// Show version in footer
+// Show update notification in footer
 --------------------------------------*/
 --------------------------------------*/
-function show_version() {
+function show_update_notification() {
+	global $current_version;
+	
 	$version_file = ABSPATH.'cache/version.data';
 	$version_file = ABSPATH.'cache/version.data';
 	
 	
 	if(is_file($version_file)) {
 	if(is_file($version_file)) {
 		// Get version information
 		// Get version information
 		$version = unserialize(file_get_contents($version_file));
 		$version = unserialize(file_get_contents($version_file));
-
-		// Format current version for footer
-		$show_version = "<a href=\"https://github.com/adegans/Goosle/\" target=\"_blank\">Goosle ".$version['current']."</a>.";
 	
 	
 		// Check if a newer version is available and add it to the version display
 		// Check if a newer version is available and add it to the version display
-		if(version_compare($version['current'], $version['latest'], '<')) {
-			$show_version .= " <a href=\"".$version['url']."\" target=\"_blank\" class=\"update\">Version ".$version['latest']." is available!</a>";
+		if(version_compare($current_version, $version['latest'], '<')) {
+			return "<a href=\"".$version['url']."\" target=\"_blank\" class=\"update\">Version ".$version['latest']." is available!</a>";
 		}
 		}
-	} else {
-		// If the update cache doesn't exist...
-		$show_version = "<a href=\"https://github.com/adegans/Goosle/\" target=\"_blank\">Goosle</a>.";
 	}
 	}
-
-	return $show_version;
 }
 }
 
 
 /*--------------------------------------
 /*--------------------------------------
@@ -300,6 +294,8 @@ function delete_cached_results($ttl) {
 	        while(($file = readdir($handle)) !== false) {
 	        while(($file = readdir($handle)) !== false) {
 		        // Skip some of them
 		        // Skip some of them
 				$extension = pathinfo($file, PATHINFO_EXTENSION);
 				$extension = pathinfo($file, PATHINFO_EXTENSION);
+
+				// Only delete cache files (*.result)
 				if($file == '.' OR $file == '..' OR $extension != 'result') continue; 
 				if($file == '.' OR $file == '..' OR $extension != 'result') continue; 
 
 
 				// Delete if expired
 				// Delete if expired
@@ -327,6 +323,14 @@ function oauth_store_token($token_file, $connect, $token) {
 	}
 	}
 }		
 }		
 
 
+/*--------------------------------------
+// Log requests
+--------------------------------------*/
+function querylog($engine, $type, $request_url, $scraped_results, $final_results) {
+	$log_file = ABSPATH.'cache/querylog_'.the_date('d_m_Y').'.log';
+    file_put_contents($log_file, '['.the_date('d-m-Y H:i:s').']['.$type.'] '.$engine.': '.$scraped_results.' -> '.$final_results.', '.$request_url."\n", FILE_APPEND);
+}		
+
 /*--------------------------------------
 /*--------------------------------------
 // Sanitize/format variables
 // Sanitize/format variables
 --------------------------------------*/
 --------------------------------------*/
@@ -395,7 +399,7 @@ function is_social_media($string) {
 	
 	
 	// Borrowed from https://github.com/lorey/social-media-profiles-regexs
 	// Borrowed from https://github.com/lorey/social-media-profiles-regexs
 	if(preg_match('/(?:https?:)?\/\/(?:www\.)?(?:facebook|fb)\.com\/(?P<profile>(?![A-z]+\.php)(?!marketplace|gaming|watch|me|messages|help|search|groups)[A-z0-9_\-\.]+)\/?/', $string)
 	if(preg_match('/(?:https?:)?\/\/(?:www\.)?(?:facebook|fb)\.com\/(?P<profile>(?![A-z]+\.php)(?!marketplace|gaming|watch|me|messages|help|search|groups)[A-z0-9_\-\.]+)\/?/', $string)
-		|| preg_match('/(?:https?:)?\/\/(?:www\.)facebook.com\/(?:profile.php\?id=)?(?P<id>[0-9]+)/', $string)
+		|| preg_match('/(?:https?:)?\/\/(?:www\.)facebook\.com\/(?:profile.php\?id=)?(?P<id>[0-9]+)/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/(?P<username>[A-Za-z0-9_](?:(?:[A-Za-z0-9_]|(?:\.(?!\.))){0,28}(?:[A-Za-z0-9_]))?)/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:www\.)?(?:instagram\.com|instagr\.am)\/(?P<username>[A-Za-z0-9_](?:(?:[A-Za-z0-9_]|(?:\.(?!\.))){0,28}(?:[A-Za-z0-9_]))?)/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?twitter\.com\/@?(?P<username>[A-z0-9_]+)\/status\/(?P<tweet_id>[0-9]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?twitter\.com\/@?(?P<username>[A-z0-9_]+)\/status\/(?P<tweet_id>[0-9]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?twitter\.com\/@?(?!home|share|privacy|tos)(?P<username>[A-z0-9_]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?twitter\.com\/@?(?!home|share|privacy|tos)(?P<username>[A-z0-9_]+)\/?/', $string)
@@ -405,8 +409,8 @@ function is_social_media($string) {
 		|| preg_match('/(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/(?P<company_type>(company)|(school))\/(?P<company_permalink>[A-z0-9-À-ÿ\.]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/(?P<company_type>(company)|(school))\/(?P<company_permalink>[A-z0-9-À-ÿ\.]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/feed\/update\/urn:li:activity:(?P<activity_id>[0-9]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/feed\/update\/urn:li:activity:(?P<activity_id>[0-9]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/in\/(?P<permalink>[\w\-\_À-ÿ%]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:[\w]+\.)?linkedin\.com\/in\/(?P<permalink>[\w\-\_À-ÿ%]+)\/?/', $string)
-		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?youtube.com\/(?:c(?:hannel)?)\/(?P<id>[A-z0-9-\_]+)\/?/', $string)
-		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?youtube.com\/(?:u(?:ser)?)\/(?P<username>[A-z0-9]+)\/?/', $string)
+		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?youtube\.com\/(?:c(?:hannel)?)\/(?P<id>[A-z0-9-\_]+)\/?/', $string)
+		|| preg_match('/(?:https?:)?\/\/(?:[A-z]+\.)?youtube\.com\/(?:u(?:ser)?)\/(?P<username>[A-z0-9]+)\/?/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:(?:www\.)?youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)(?P<id>[A-z0-9\-\_]+)/', $string)
 		|| preg_match('/(?:https?:)?\/\/(?:(?:www\.)?youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)(?P<id>[A-z0-9\-\_]+)/', $string)
 	) return true;
 	) return true;
 
 
@@ -454,12 +458,15 @@ function search_sources($results) {
 // Format search result urls
 // Format search result urls
 --------------------------------------*/
 --------------------------------------*/
 function search_formatted_url($url) {
 function search_formatted_url($url) {
-	$url = parse_url($url);
+	$url = parse_url(strtolower($url));
 
 
 	$formatted_url = $url['scheme'] . '://' . $url['host'];
 	$formatted_url = $url['scheme'] . '://' . $url['host'];
 	if(array_key_exists('path', $url)) {
 	if(array_key_exists('path', $url)) {
 		$formatted_url .= str_replace('/', ' &rsaquo; ', urldecode(str_replace('%20', ' ', rtrim($url['path'], '/'))));
 		$formatted_url .= str_replace('/', ' &rsaquo; ', urldecode(str_replace('%20', ' ', rtrim($url['path'], '/'))));
 	}
 	}
+	if(array_key_exists('query', $url)) {
+		$formatted_url .= ' &rsaquo; '.urldecode(str_replace('&', ' &rsaquo; ', str_replace('=', ':', str_replace('%20', ' ', trim($url['query'])))));
+	}
 	
 	
 	return $formatted_url;
 	return $formatted_url;
 }
 }

+ 3 - 5
goosle-cron.php

@@ -25,11 +25,9 @@ if(verify_hash('on', $opts->hash, $opts->user_auth)) {
 	/*--------------------------------------
 	/*--------------------------------------
 	// Do update check
 	// Do update check
 	--------------------------------------*/
 	--------------------------------------*/
+	global $current_version;
 	$version_file = ABSPATH.'cache/version.data';
 	$version_file = ABSPATH.'cache/version.data';
 	
 	
-	// Currently installed version
-	$current_version = "1.6";
-
 	if(!is_file($version_file)) {
 	if(!is_file($version_file)) {
 		// Create update cache file if it doesn't exist
 		// Create update cache file if it doesn't exist
 	    $version = array('current' => $current_version, 'latest' => '0.0', 'checked' => 0, 'url' => '');
 	    $version = array('current' => $current_version, 'latest' => '0.0', 'checked' => 0, 'url' => '');
@@ -43,7 +41,7 @@ if(verify_hash('on', $opts->hash, $opts->user_auth)) {
 	if($version['checked'] < time() - 604800) {
 	if($version['checked'] < time() - 604800) {
 		$response = do_curl_request( 
 		$response = do_curl_request( 
 			'https://api.github.com/repos/adegans/goosle/releases/latest', // (string) Where?
 			'https://api.github.com/repos/adegans/goosle/releases/latest', // (string) Where?
-			array('Accept: application/json, */*;q=0.7', 'User-Agent: goosle/'.$version['current'].';'), // (array) User agent + Headers
+			array('Accept: application/json, */*;q=0.7', 'User-Agent: goosle/'.$current_version.';'), // (array) User agent + Headers
 			'get', // (string) post/get
 			'get', // (string) post/get
 			null // (assoc array|null) Post body
 			null // (assoc array|null) Post body
 		);
 		);
@@ -52,7 +50,7 @@ if(verify_hash('on', $opts->hash, $opts->user_auth)) {
 		// Got a response? Store it!
 		// Got a response? Store it!
 		if(!empty($json_response)) {
 		if(!empty($json_response)) {
 			// Update version info
 			// Update version info
-			$version = array('current' => $version['current'], 'latest' => $json_response['tag_name'], 'checked' => time(), 'url' => $json_response['html_url']);
+			$version = array('current' => $current_version, 'latest' => $json_response['tag_name'], 'checked' => time(), 'url' => $json_response['html_url']);
 			file_put_contents($version_file, serialize($version));
 			file_put_contents($version_file, serialize($version));
 			
 			
 			echo "<p>- Checked for updates and update cache updated!</p>";
 			echo "<p>- Checked for updates and update cache updated!</p>";

+ 8 - 7
help.php

@@ -75,11 +75,9 @@ if(verify_hash($opts->hash_auth, $opts->hash, $opts->user_auth)) {
 	
 	
 <div class="content">
 <div class="content">
 	<h2>How to use Goosle</h2>
 	<h2>How to use Goosle</h2>
-	<p>If you're tired of traditional results from sites like Google search or DuckDuckGo and you want to have more varied results, or just everything at once, Goosle has your back! Goosle searches on multiple search engines at the same time and shows you the most relevant results through a neat, clean interface.</p>
-
-	<p><em>If you can't find it on page one, you're using the wrong search query!</em></p>
+	<p>Goosle tries to provide you with the right search results where-ever they may come from. An easy to use UI and no clutter go a long way in providing a pleasuring search experience. You will not find any unnessesary features or complex settings in Goosle. After-all, navigating the internet is hard and frustrating enough. Search engines should make that more easy, not harder!</p>
 	
 	
-	<p>Goosle tries to provide you with the right answer on page one and is designed to be as easy to use and function as logical as possible. You will not find any unnessesary features or complex settings in Goosle. After-all, navigating the internet is hard and frustrating enough. Search engines should make that more easy, not harder!</p>
+	<p>Goosle is created by <a href="https://www.arnan.me/" target="_blank">Arnan de Gans</a> with the intent to make search more productive and fun.</p>
 		
 		
 	<h3>Result ranking</h3>
 	<h3>Result ranking</h3>
 	<p>To try and provide the best results first. Goosle has a simple algorithm to rank results for Web and Image search. It works a little like a scoring system. A result with more points gets a higher ranking.</p>
 	<p>To try and provide the best results first. Goosle has a simple algorithm to rank results for Web and Image search. It works a little like a scoring system. A result with more points gets a higher ranking.</p>
@@ -104,7 +102,7 @@ if(verify_hash($opts->hash_auth, $opts->hash, $opts->user_auth)) {
 	
 	
 	<?php if($opts->special['definition'] == 'on') { ?>
 	<?php if($opts->special['definition'] == 'on') { ?>
 		<h4>Word Definition</h4>
 		<h4>Word Definition</h4>
-		<p>Look up the meaning of single words. Prefix the word you want to look up with any of the following keywords; <strong>define</strong>, <strong>meaning</strong>.<br />
+		<p>Look up the meaning of single words. Prefix the word you want to look up with <strong>define</strong>, <strong>def</strong> or <strong>meaning</strong>.<br />
 		For example: Searching for <strong>define goose</strong> will do a web search for 'goose' but will also show a dictionary definition highlighted above the search results.</p>
 		For example: Searching for <strong>define goose</strong> will do a web search for 'goose' but will also show a dictionary definition highlighted above the search results.</p>
 	<?php } ?>
 	<?php } ?>
 	
 	
@@ -195,12 +193,15 @@ if(verify_hash($opts->hash_auth, $opts->hash, $opts->user_auth)) {
 		<li>"auto" Let the browser decide what to use. This is typically linked to the darkmode setting of your device.</li>
 		<li>"auto" Let the browser decide what to use. This is typically linked to the darkmode setting of your device.</li>
 	</ol>
 	</ol>
 	
 	
-	<p><small><strong>Acknowledgements:</strong><br />Goosle started as a fork of LibreY, and takes some design cues from DuckDuckGo.com. Goosle is created by <a href="https://ajdg.solutions/" target="_blank">Arnan de Gans</a> with the intent to make search more productive and fun.</small></p>
+	<h4>Acknowledgements:</h4>
+	<p><small>All icons are borrowed from the IconFinder <a href="https://www.iconfinder.com/search/icons?family=unicons-line" target="_blank">Unicons Set</a>.<br />
+	The Goose icon is borrowed from the Flaticon <a href="https://www.flaticon.com/packs/farm-19" target="_blank">Farm pack</a>.<br />
+	Goosle started as a fork of LibreY, and takes some design cues from DuckDuckGo.com.</small></p>
 </div>
 </div>
 
 
 <div class="footer grid-container">
 <div class="footer grid-container">
 	<div class="footer-grid">
 	<div class="footer-grid">
-		&copy; <?php echo the_date('Y'); ?> <?php echo show_version(); ?> By <a href="https://ajdg.solutions/" target="_blank">Arnan de Gans</a>.
+		&copy; <?php echo the_date('Y'); ?> Goosle <?php echo $current_version; ?> <?php echo show_update_notification(); ?>
 	</div>
 	</div>
 	<div class="footer-grid">
 	<div class="footer-grid">
 		<a href="./?a=<?php echo $opts->hash; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->hash; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->hash; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>
 		<a href="./?a=<?php echo $opts->hash; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->hash; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->hash; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>

+ 9 - 0
index.php

@@ -75,6 +75,15 @@ if(verify_hash($opts->hash_auth, $opts->hash, $opts->user_auth)) {
 	<?php } ?>
 	<?php } ?>
 </div>
 </div>
 
 
+<div class="footer grid-container">
+	<div class="footer-grid">
+		&copy; <?php echo the_date('Y'); ?> Goosle <?php echo $current_version; ?> <?php echo show_update_notification(); ?>
+	</div>
+	<div class="footer-grid">
+		<a href="./box-office.php?a=<?php echo $opts->hash; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->hash; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>
+	</div>
+</div>
+
 <?php } else { ?>
 <?php } else { ?>
 	<div class="auth-error">Redirecting</div>
 	<div class="auth-error">Redirecting</div>
 	<meta http-equiv="refresh" content="1; url=<?php echo get_base_url($opts->siteurl); ?>/error.php" />
 	<meta http-equiv="refresh" content="1; url=<?php echo get_base_url($opts->siteurl); ?>/error.php" />

+ 2 - 7
results.php

@@ -43,12 +43,7 @@ $start_time = microtime(true);
 	<link rel="canonical" href="<?php echo get_base_url($opts->siteurl); ?>/results.php" />
 	<link rel="canonical" href="<?php echo get_base_url($opts->siteurl); ?>/results.php" />
     <link rel="stylesheet" type="text/css" href="<?php echo get_base_url($opts->siteurl); ?>/assets/css/styles.css"/>
     <link rel="stylesheet" type="text/css" href="<?php echo get_base_url($opts->siteurl); ?>/assets/css/styles.css"/>
     <link rel="stylesheet" type="text/css" href="<?php echo get_base_url($opts->siteurl); ?>/assets/css/<?php echo $opts->colorscheme; ?>.css"/>
     <link rel="stylesheet" type="text/css" href="<?php echo get_base_url($opts->siteurl); ?>/assets/css/<?php echo $opts->colorscheme; ?>.css"/>
-
-	<?php
-	if($search->type == "9") {
-    	echo "	<script src='".get_base_url($opts->siteurl)."/assets/js/goose.js' id='goosebox-js'></script>";
-	}
-	?>
+	<script src="<?php echo get_base_url($opts->siteurl);?>/assets/js/goose.js" id="goosebox-js"></script>
 </head>
 </head>
 
 
 <body class="resultspage">
 <body class="resultspage">
@@ -131,7 +126,7 @@ if(!empty($search->query)) {
 
 
 <div class="footer grid-container">
 <div class="footer grid-container">
 	<div class="footer-grid">
 	<div class="footer-grid">
-		&copy; <?php echo the_date('Y'); ?> <?php echo show_version(); ?> By <a href="https://ajdg.solutions/" target="_blank">Arnan de Gans</a>.
+		&copy; <?php echo the_date('Y'); ?> Goosle <?php echo $current_version; ?> <?php echo show_update_notification(); ?>
 	</div>
 	</div>
 	<div class="footer-grid">
 	<div class="footer-grid">
 		<a href="./?a=<?php echo $opts->hash; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->hash; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->hash; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>
 		<a href="./?a=<?php echo $opts->hash; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->hash; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->hash; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>

+ 1 - 1
stats.php

@@ -83,7 +83,7 @@ if(verify_hash($opts->hash_auth, $opts->hash, $opts->user_auth)) {
 
 
 <div class="footer grid-container">
 <div class="footer grid-container">
 	<div class="footer-grid">
 	<div class="footer-grid">
-		&copy; <?php echo the_date('Y'); ?> <?php echo show_version(); ?> By <a href="https://ajdg.solutions/" target="_blank">Arnan de Gans</a>.
+		&copy; <?php echo the_date('Y'); ?> Goosle <?php echo $current_version; ?> <?php echo show_update_notification(); ?>
 	</div>
 	</div>
 	<div class="footer-grid">
 	<div class="footer-grid">
 		<a href="./?a=<?php echo $opts->hash; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->hash; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->hash; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>
 		<a href="./?a=<?php echo $opts->hash; ?>">Start</a> - <a href="./box-office.php?a=<?php echo $opts->hash; ?>&t=9">Box office</a> - <a href="./help.php?a=<?php echo $opts->hash; ?>">Help</a> - <a href="./stats.php?a=<?php echo $opts->hash; ?>">Stats</a>