2023-12-05 22:11:28 +00:00
< ? php
/* ------------------------------------------------------------------------------------
2024-06-20 00:08:00 +00:00
* Goosle - The fast , privacy oriented search tool that just works .
2023-12-05 22:11:28 +00:00
*
* COPYRIGHT NOTICE
* Copyright 2023 - 2024 Arnan de Gans . All Rights Reserved .
*
* COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT .
* By using this code you agree to indemnify Arnan de Gans from any
* liability that might arise from its use .
------------------------------------------------------------------------------------ */
2024-07-15 20:11:08 +00:00
if ( ! defined ( 'ABSPATH' )) define ( 'ABSPATH' , $_SERVER [ 'DOCUMENT_ROOT' ] . '/' );
date_default_timezone_set ( 'UTC' );
require ABSPATH . 'functions/tools.php' ;
require ABSPATH . 'functions/search_engine.php' ;
$opts = load_opts ();
$search = load_search ();
$start_time = microtime ( true );
2023-12-05 22:11:28 +00:00
?>
2024-01-02 06:24:27 +00:00
<! DOCTYPE html >
2023-12-05 22:11:28 +00:00
< html lang = " en " >
< head >
2024-06-20 00:08:00 +00:00
< title > Goosle Search Results </ title >
2024-05-17 01:12:14 +00:00
< meta charset = " utf-8 " />
< meta name = " viewport " content = " width=device-width, initial-scale=1, user-scalable=no " />
< meta name = " robots " content = " noodp,noydir " />
2023-12-05 22:11:28 +00:00
< meta name = " referrer " content = " no-referrer " />
2024-06-20 00:08:00 +00:00
< meta name = " description " content = " Check out these Goosle search results! " />
2024-07-15 20:11:08 +00:00
< meta property = " og:site_name " content = " Goosle Search " />
2024-06-20 00:08:00 +00:00
< meta property = " og:title " content = " The best meta search engine " />
< meta property = " og:description " content = " Check out these Goosle search results! " />
< meta property = " og:url " content = " <?php echo get_base_url( $opts->siteurl ); ?>/results.php " />
< meta property = " og:image " content = " <?php echo get_base_url( $opts->siteurl ); ?>/assets/images/goosle.webp " />
< meta property = " og:type " content = " website " />
2024-05-17 01:12:14 +00:00
< link rel = " icon " href = " favicon.ico " />
< link rel = " apple-touch-icon " href = " apple-touch-icon.png " />
< link rel = " canonical " href = " <?php echo get_base_url( $opts->siteurl ); ?>/results.php " />
2024-06-20 00:08:00 +00:00
< 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 " />
2024-07-19 21:57:40 +00:00
< script src = " <?php echo get_base_url( $opts->siteurl );?>/assets/js/goose.js " id = " goosebox-js " ></ script >
2023-12-05 22:11:28 +00:00
</ head >
2024-05-17 01:12:14 +00:00
2024-06-20 00:08:00 +00:00
< body class = " resultspage " >
2023-12-05 22:11:28 +00:00
< ? php
2024-07-15 20:11:08 +00:00
if ( verify_hash ( $opts -> hash_auth , $opts -> hash , $opts -> user_auth , $search -> share )) {
2023-12-05 22:11:28 +00:00
?>
2024-05-17 01:12:14 +00:00
< div class = " header " >
< form action = " results.php " method = " get " autocomplete = " off " >
2024-06-20 00:08:00 +00:00
< h1 class = " logo " >< a href = " ./?a=<?php echo $opts->hash ; ?> " >< span class = " goosle-g " > G </ span > oosle </ a ></ h1 >
2024-07-15 20:11:08 +00:00
< input tabindex = " 1 " class = " search-field " type = " search " value = " <?php echo (strlen( $search->query ) > 0) ? htmlspecialchars( $search->query ) : " " ; ?> " name = " q " />< input tabindex = " 2 " class = " button " type = " submit " value = " Search " />
2024-05-17 01:12:14 +00:00
2024-07-15 20:11:08 +00:00
< input type = " hidden " name = " t " value = " <?php echo $search->type ; ?> " />
< input type = " hidden " name = " a " value = " <?php echo $opts->user_auth ; ?> " >
2024-06-20 00:08:00 +00:00
</ form >
2024-05-17 01:12:14 +00:00
2024-06-20 00:08:00 +00:00
< div class = " navigation " >
2024-07-15 20:11:08 +00:00
< a class = " <?php echo ( $search->type == '0') ? 'active ' : ''; ?>tab-search " href = " ./results.php?q=<?php echo $search->query ; ?>&a=<?php echo $opts->user_auth ; ?>&t=0 " > Search </ a >
2024-05-17 01:12:14 +00:00
2024-06-20 00:08:00 +00:00
< ? php if ( $opts -> enable_image_search == 'on' ) { ?>
2024-07-15 20:11:08 +00:00
< a class = " <?php echo ( $search->type == '1') ? 'active ' : ''; ?>tab-image " href = " ./results.php?q=<?php echo $search->query ; ?>&a=<?php echo $opts->user_auth ; ?>&t=1 " > Images </ a >
2024-06-20 00:08:00 +00:00
< ? php } ?>
2024-05-17 01:12:14 +00:00
2024-06-20 00:08:00 +00:00
< ? php if ( $opts -> enable_news_search == 'on' ) { ?>
2024-07-15 20:11:08 +00:00
< a class = " <?php echo ( $search->type == '2') ? 'active ' : ''; ?>tab-news " href = " ./results.php?q=<?php echo $search->query ; ?>&a=<?php echo $opts->user_auth ; ?>&t=2 " > News </ a >
2024-06-20 00:08:00 +00:00
< ? php } ?>
< ? php if ( $opts -> enable_magnet_search == 'on' ) { ?>
2024-07-15 20:11:08 +00:00
< a class = " <?php echo ( $search->type == '9') ? 'active ' : ''; ?>tab-magnet " href = " ./results.php?q=<?php echo $search->query ; ?>&a=<?php echo $opts->user_auth ; ?>&t=9 " > Magnet links </ a >
2024-06-20 00:08:00 +00:00
< ? php } ?>
</ div >
2023-12-05 22:11:28 +00:00
</ div >
2024-05-17 01:12:14 +00:00
< div class = " content " >
< ? php
2024-07-15 20:11:08 +00:00
if ( ! empty ( $search -> query )) {
2024-05-17 01:12:14 +00:00
// Curl
$mh = curl_multi_init ();
// Load search script
2024-07-15 20:11:08 +00:00
if ( $search -> type == 0 ) {
2024-06-20 00:08:00 +00:00
require ABSPATH . 'engines/search.php' ;
2024-07-15 20:11:08 +00:00
$search_results = new Search ( $search , $opts , $mh );
} else if ( $search -> type == 1 ) {
2024-06-20 00:08:00 +00:00
require ABSPATH . 'engines/search-image.php' ;
2024-07-15 20:11:08 +00:00
$search_results = new ImageSearch ( $search , $opts , $mh );
} else if ( $search -> type == 2 ) {
2024-06-20 00:08:00 +00:00
require ABSPATH . 'engines/search-news.php' ;
2024-07-15 20:11:08 +00:00
$search_results = new NewsSearch ( $search , $opts , $mh );
} else if ( $search -> type == 9 ) {
2024-06-20 00:08:00 +00:00
require ABSPATH . 'engines/search-magnet.php' ;
2024-07-15 20:11:08 +00:00
$search_results = new MagnetSearch ( $search , $opts , $mh );
2024-05-17 01:12:14 +00:00
}
$running = null ;
do {
$status = curl_multi_exec ( $mh , $running );
if ( $running ) {
curl_multi_select ( $mh );
}
} while ( $running && $status == CURLM_OK );
2024-07-15 20:11:08 +00:00
$results = $search_results -> get_results ();
2024-05-17 01:12:14 +00:00
curl_multi_close ( $mh );
// Add elapsed time to results
$results [ 'time' ] = number_format ( microtime ( true ) - $start_time , 5 , '.' , '' );
// Echoes results and special searches
2024-07-15 20:11:08 +00:00
$search_results -> print_results ( $results , $search , $opts );
2024-05-17 01:12:14 +00:00
} else {
2024-06-20 00:08:00 +00:00
echo " <div class= \" warning \" > " ;
echo " <h3>Search query can not be empty!</h3> " ;
2024-07-15 20:11:08 +00:00
echo " <p>Not sure what went wrong? Learn more about <a href= \" ./help.php?a= " . $opts -> user_auth . " \" title= \" how to use Goosle! \" >how to use Goosle</a>.</p> " ;
2024-06-20 00:08:00 +00:00
echo " </div> " ;
2024-05-17 01:12:14 +00:00
}
?>
</ div >
2024-06-20 00:08:00 +00:00
< div class = " footer grid-container " >
< div class = " footer-grid " >
2024-07-19 21:57:40 +00:00
& copy ; < ? php echo the_date ( 'Y' ); ?> Goosle <?php echo $current_version; ?> <?php echo show_update_notification(); ?>
2024-05-17 01:12:14 +00:00
</ div >
2024-06-20 00:08:00 +00:00
< div class = " footer-grid " >
2024-07-15 20:11:08 +00:00
< 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 >
2023-12-05 22:11:28 +00:00
</ div >
</ div >
2024-07-15 20:11:08 +00:00
< ? php } else { ?>
< div class = " auth-error " > Redirecting </ div >
< meta http - equiv = " refresh " content = " 1; url=<?php echo get_base_url( $opts->siteurl ); ?>/error.php " />
< ? php } ?>
2023-12-05 22:11:28 +00:00
</ body >
</ html >