Make title more descriptive

This commit is contained in:
2023-01-26 21:01:34 +01:00
parent c384a306aa
commit 63f50caa64
3 changed files with 32 additions and 6 deletions

View File

@ -24,6 +24,7 @@ function send_html(): void
{ {
global $categories, $db, $language, $dir, $locale, $canonical_query; global $categories, $db, $language, $dir, $locale, $canonical_query;
$numrows = 0; $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 = '.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 .= '.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}'; $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 ) { if ( $_REQUEST[ 'pg' ] > $pages && $_REQUEST[ 'pg' ] > 1 ) {
http_response_code( 404 ); 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 '<!DOCTYPE html><html lang="'.$language.'" dir="'.$dir.'"><head>'; echo '<!DOCTYPE html><html lang="'.$language.'" dir="'.$dir.'"><head>';
echo '<title>'._('Onion link list').'</title>'; echo '<title>'.$title.'</title>';
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'; echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">';
echo '<meta name="author" content="Daniel Winzen">'; echo '<meta name="author" content="Daniel Winzen">';
echo '<meta name="viewport" content="width=device-width, initial-scale=1">'; echo '<meta name="viewport" content="width=device-width, initial-scale=1">';
@ -102,15 +125,17 @@ function send_html(): void
echo '<link rel="alternate" href="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '" hreflang="x-default">'; echo '<link rel="alternate" href="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '" hreflang="x-default">';
alt_links(); alt_links();
echo '<meta property="og:type" content="website">'; echo '<meta property="og:type" content="website">';
echo '<meta property="og:title" content="' . _('Onion link list') . '">'; echo '<meta property="og:title" content="' . $title . '">';
echo '<meta property="og:description" content="' . _('Huge link list of Tor hidden service onions. All the darknet links you need in one place.') . '">'; echo '<meta property="og:description" content="' . _('Huge link list of Tor hidden service onions. All the darknet links you need in one place.') . '">';
echo '<meta property="og:url" content="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '">'; echo '<meta property="og:url" content="' . CANONICAL_URL . (empty($canonical_query) ? '' : '?' . http_build_query($canonical_query)) . '">';
echo '<meta property="og:locale" content="' . $locale . '">'; echo '<meta property="og:locale" content="' . $locale . '">';
if(empty($_SERVER['QUERY_STRING'])) {
echo '<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebSite","url":"' . CANONICAL_URL . '","potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"' . CANONICAL_URL . '/?q={search_term_string}"},"query-input":"required name=search_term_string","url":"' . CANONICAL_URL . '"}}</script>'; echo '<script type="application/ld+json">{"@context":"https://schema.org","@type":"WebSite","url":"' . CANONICAL_URL . '","potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"' . CANONICAL_URL . '/?q={search_term_string}"},"query-input":"required name=search_term_string","url":"' . CANONICAL_URL . '"}}</script>';
}
echo '<style>'.$style.'</style>'; echo '<style>'.$style.'</style>';
echo '<base target="_blank">'; echo '<base target="_blank">';
echo '</head><body><main>'; echo '</head><body><main>';
echo '<h1>'._('Onion link list').'</h1>'; echo '<h1>'.$title.'</h1>';
if(!isset($db)){ if(!isset($db)){
send_error(_('Error: No database connection!')); send_error(_('Error: No database connection!'));
} }
@ -182,7 +207,7 @@ function send_html(): void
echo '<ul class="list"><li>'._('Special categories:').'</li>'; echo '<ul class="list"><li>'._('Special categories:').'</li>';
$cat=count($categories); $cat=count($categories);
foreach($special as $name=>$query){ foreach($special as $name=>$query){
echo ' <li'.($category==$cat ? ' class="active"' : '').'><a href="?cat='.$cat.'" target="_self">'."$name ($category_count[$cat])</a></li>"; echo ' <li'.($category==$cat ? ' class="active"' : '').'><a href="'.($cat === count($categories) ? '' : '?cat='.$cat).'" target="_self">'."$name ($category_count[$cat])</a></li>";
++$cat; ++$cat;
} }
echo ' <li'.($category==$cat ? ' class="active"' : '').'><a href="?cat='.$cat.'" target="_self">'._('Phishing Clones')." ($category_count[$cat])</a></li>"; echo ' <li'.($category==$cat ? ' class="active"' : '').'><a href="?cat='.$cat.'" target="_self">'._('Phishing Clones')." ($category_count[$cat])</a></li>";

View File

@ -1,4 +1,5 @@
User-agent: * User-agent: *
Disallow: /*?*addr= Disallow: /*?*addr=
Disallow: /*?*q=
Allow: * Allow: *
Sitemap: /sitemap.php Sitemap: /sitemap.php

View File

@ -40,7 +40,7 @@ foreach (LANGUAGES as $lang_code => $data){
]; ];
$cat=count($categories); $cat=count($categories);
foreach($special as $query){ foreach($special as $query){
$links []= ['loc' => CANONICAL_URL . "/?cat=$cat&lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3']; $links []= ['loc' => CANONICAL_URL . "/?".($cat===count($categories) ? '' : "cat=$cat&")."lang=$lang_code", 'changefreq' => 'daily', 'priority' => '0.3'];
if($cat===count($categories)+1){ if($cat===count($categories)+1){
$num[0]=PER_PAGE; $num[0]=PER_PAGE;
}else{ }else{