Make categories translatable and remove pg=1 as canonical parameter

This commit is contained in:
2023-01-25 19:11:28 +01:00
parent 3f3455f29d
commit c6be012ce1
12 changed files with 854 additions and 369 deletions

View File

@ -2,6 +2,7 @@
if($_SERVER['REQUEST_METHOD']==='HEAD'){
exit; // ignore headers, no further processing needed
}
global $canonical_query;
require_once(__DIR__.'/../common_config.php');
try{
$db=new PDO('mysql:host=' . DBHOST . ';dbname=' . DBNAME . ';charset=utf8mb4', DBUSER, DBPASS, [PDO::ATTR_ERRMODE=>PDO::ERRMODE_WARNING, PDO::ATTR_PERSISTENT=>PERSISTENT]);
@ -37,10 +38,14 @@ function send_html(): void
_('Last added')=>"address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing)',
_('Offline > 1 week')=>"address!='' AND id NOT IN (SELECT onion_id FROM " . PREFIX . 'phishing) AND timediff>604800'
];
$canonical_query = [];
if(!isset($_REQUEST['pg'])){
$_REQUEST['pg']=1;
}else{
settype($_REQUEST['pg'], 'int');
if($_REQUEST['pg'] !== 1) {
$canonical_query[ 'pg' ] = $_REQUEST[ 'pg' ];
}
}
if($_REQUEST['pg']>0){
$_REQUEST['newpg']=1;
@ -51,13 +56,7 @@ function send_html(): void
if(isset($_REQUEST['cat']) && $_REQUEST['cat']<(count($categories)+count($special)+1) && $_REQUEST['cat']>=0){
settype($_REQUEST['cat'], 'int');
$category=$_REQUEST['cat'];
}
$canonical_query = [];
if(isset($_REQUEST['cat'])) {
$canonical_query['cat'] = intval($_REQUEST['cat']);
}
if(isset($_REQUEST['pg'])) {
$canonical_query['pg'] = $_REQUEST['pg'];
$canonical_query['cat'] = $category;
}
$pages=1;
$admin_approval = '';

View File

@ -105,10 +105,8 @@ if(!empty($_REQUEST['addr'])){
}
echo '<p class="green" role="alert">'._('Yes, the service is online!').'</p>';
}else{
if(isset($db)){
$time=time();
$db->prepare('UPDATE ' . PREFIX . 'onions SET lasttest=?, timediff=lasttest-lastup WHERE md5sum=? AND lasttest<?;')->execute([$time, $md5, $time]);
}
$time=time();
$db->prepare('UPDATE ' . PREFIX . 'onions SET lasttest=?, timediff=lasttest-lastup WHERE md5sum=? AND lasttest<?;')->execute([$time, $md5, $time]);
echo '<p class="red" role="alert">'._('No, the service is offline!').'</p>';
}
curl_close($ch);