From 63f50caa64e82f865f9fe8f159078a0a0838eb1b Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Thu, 26 Jan 2023 21:01:34 +0100 Subject: [PATCH] Make title more descriptive --- www/index.php | 35 ++++++++++++++++++++++++++++++----- www/robots.txt | 1 + www/sitemap.php | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/www/index.php b/www/index.php index 9ed9e71..e933e05 100644 --- a/www/index.php +++ b/www/index.php @@ -24,6 +24,7 @@ function send_html(): void { global $categories, $db, $language, $dir, $locale, $canonical_query; $numrows = 0; + $not_found = false; $style = '.row{display:flex;flex-wrap:wrap}.headerrow{font-weight:bold}.col{display:flex;flex:1;padding:3px 3px;flex-direction:column}'; $style .= '.red{color:red}.green{color:green}.up .col:nth-child(0n+3){background-color:#aaff88}.down .col:nth-child(0n+3){background-color:#ff4444}'; $style .= '.promo{outline:medium solid #FFD700}.list{padding:0;}.list li{display:inline-block;padding:0.35em}.pagination{font-size:1.2em}'; @@ -89,10 +90,32 @@ function send_html(): void } if ( $_REQUEST[ 'pg' ] > $pages && $_REQUEST[ 'pg' ] > 1 ) { http_response_code( 404 ); + $not_found = true; } } + if($not_found) { + $title = _( 'Onion link list - Not found'); + }elseif(!empty($_REQUEST['q'])) { + $title = sprintf(_( 'Onion link list - Searching for %s' ), htmlspecialchars($_REQUEST['q'])); + } elseif ($cat === count($categories) && $_REQUEST[ 'pg' ] > 1){ + $title = sprintf(_( 'Onion link list - Page %d' ), $_REQUEST[ 'pg' ]); + } elseif ($cat < count($categories) && $_REQUEST[ 'pg' ] > 1){ + $title = sprintf(_( 'Onion link list - %1$s - Page %2$d' ), $categories[$cat], $_REQUEST[ 'pg' ]); + } elseif ($cat < count($categories)){ + $title = sprintf(_( 'Onion link list - %s' ), $categories[$cat]); + } elseif ($cat === count($categories) + 3){ + $title = sprintf(_( 'Onion link list - %s' ), _('Phishing Clones')); + } elseif ($cat === count($categories) + 2 && $_REQUEST[ 'pg' ] > 1){ + $title = sprintf(_( 'Onion link list - %1$s - Page %2$d' ), _('Offline > 1 week'), $_REQUEST['pg']); + } elseif ($cat === count($categories) + 2){ + $title = sprintf(_( 'Onion link list - %s' ), _('Offline > 1 week')); + } elseif ($cat === count($categories) + 1){ + $title = sprintf(_( 'Onion link list - %s' ), _('Last added')); + } else { + $title = _( 'Onion link list' ); + } echo ''; - echo ''._('Onion link list').''; + echo ''.$title.''; echo ''; echo ''; echo ''; @@ -102,15 +125,17 @@ function send_html(): void echo ''; alt_links(); echo ''; - echo ''; + echo ''; echo ''; echo ''; echo ''; - echo ''; + if(empty($_SERVER['QUERY_STRING'])) { + echo ''; + } echo ''; echo ''; echo '
'; - echo '

'._('Onion link list').'

'; + echo '

'.$title.'

'; if(!isset($db)){ send_error(_('Error: No database connection!')); } @@ -182,7 +207,7 @@ function send_html(): void echo '