this.'); exit(0); } $bt=hrtime(true); $btu=time(); $dlanguc=strtoupper($dlang); require '../lib/n2es.php'; require '../lib/grace.php'; require '../lib/fnum.php'; require '../lib/realfloat.php';// had to resort to this because php 7.3 has a bug: when echoing a float, it uses the decimal separator of the locale that was set with setlocale, making a mess when the separator is different than "." with stuff expecting it to be "." use function mysqli_real_escape_string as myesc; /*$dlang='fr'; $dtzbl=['ca'=>'Europe/Madrid','en'=>'Europe/London','es'=>'Europe/Madrid','fr'=>'Europe/Paris','it'=>'Europe/Rome']; date_default_timezone_set($dtzbl[$dlang]);*/ $lc=localeconv(); $lcc=['decimal_point'=>'.', 'thousands_sep'=>'']; $debug=''; debug(date('r',$btu).N,$debug); debug('REQUEST_URI: '.$_SERVER['REQUEST_URI'].N,$debug); debug('$_GET: '.print_r($_GET,true),$debug); debug('LOCALE: '.setlocale(LC_ALL,0).N,$debug); // an instance is displayed as "New" if its age, relative to the InsertTS field, is less or equal than this (currently 30 days) $oldline=30*24*60*60;// todo: do it relative to firstseen? if (array_key_exists('id',$_GET) && preg_match('/^\d+$/',$_GET['id'])===1) { $_GET['id']+=0; $single=true; } else { $single=false; } //$getc=count($_GET); //forcing $getc to 1 to never display the explanation of search engine workings $getc=1; $minudef=10; $minumax=4294967295; $maxudef=30000; $maxumax=4294967295; $minaudef=5; $minaumax=4294967295; $mincdef=''; $mincmax=16777215; $link=mysqli_connect($conf['db_host'],$conf['db_user_name'],$conf['db_user_password'],$conf['db_name'],$conf['db_port'],$conf['db_socket']) or muorimeglio(_('Couldn’t connect to database: ').mysqli_connect_error().' ['.mysqli_connect_errno().']',false); mysqli_set_charset($link,'utf8mb4'); // if and when ... put it soon after below /*

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

*/ echo('
'.N); if ($single) { setfedipact(); echo('

↑ '._('Go to search').'

'.N); $p=1; $que='SELECT * FROM Instances WHERE ID='.$_GET['id']; } else { echo('

'._('Instances').'

'.N); setfedipact(); $que='SELECT COUNT(ID) AS Unknown, SUM(UserCount) AS UnknownU FROM Instances WHERE IsMastodon=1 AND Visible=1 AND LastOkCheckTS>='.$graceline.' AND Threads IS NULL'; if ($cfedipact>0) $que.=' AND URI NOT IN ('.$fedipact['uris_me'].')'; $res=tquery($que,__LINE__); $row=mysqli_fetch_assoc($res); $metastats['unknown']=['instances'=>$row['Unknown'], 'users'=>nulltozero($row['UnknownU'])]; $que='SELECT COUNT(ID) AS Suspending, SUM(UserCount) AS SuspendingU FROM Instances WHERE IsMastodon=1 AND Visible=1 AND LastOkCheckTS>='.$graceline; if ($cfedipact>0) $que.=' AND (Threads="suspended" OR URI IN ('.$fedipact['uris_me'].'))'; else $que.=' AND Threads="suspended"'; $res=tquery($que,__LINE__); $row=mysqli_fetch_assoc($res); $metastats['suspending']=['instances'=>$row['Suspending'], 'users'=>nulltozero($row['SuspendingU'])]; $res=tquery('SELECT COUNT(ID) AS Silencing, SUM(UserCount) AS SilencingU FROM Instances WHERE IsMastodon=1 AND Visible=1 AND LastOkCheckTS>='.$graceline.' AND Threads="limited"',__LINE__); $row=mysqli_fetch_assoc($res); $metastats['limiting']=['instances'=>$row['Silencing'], 'users'=>nulltozero($row['SilencingU'])]; $metastats['fpsuspending']['instances']=0; $metastats['fpsuspending']['users']=0; $metastats['fpliars']['instances']=0; $metastats['fpliars']['users']=0; $metastats['fpliars']['instlist']=[]; if ($cfedipact>0) { $res=tquery('SELECT COUNT(ID) AS FPSuspending, SUM(UserCount) AS FPSuspendingU FROM Instances WHERE IsMastodon=1 AND Visible=1 AND LastOkCheckTS>='.$graceline.' AND URI IN ('.$fedipact['uris_me'].')',__LINE__); $row=mysqli_fetch_assoc($res); $metastats['fpsuspending']['instances']=$row['FPSuspending']; $metastats['fpsuspending']['users']=nulltozero($row['FPSuspendingU']); $res=tquery('SELECT URI, UserCount FROM Instances WHERE IsMastodon=1 AND Visible=1 AND LastOkCheckTS>='.$graceline.' AND Threads="accessible" AND URI IN ('.$fedipact['uris_me'].')',__LINE__); while ($row=mysqli_fetch_assoc($res)) { $metastats['fpliars']['instances']++; $metastats['fpliars']['users']+=nulltozero($row['UserCount']); $metastats['fpliars']['instlist'][]=['uri'=>$row['URI'], 'usercount'=>nulltozero($row['UserCount'])]; } } $res=tquery('SELECT COUNT(ID) AS tinsts, SUM(UserCount) AS tusers, SUM(StatusCount) AS tstatuses, SUM(ActiveUsersMonth) AS tactusers FROM Instances WHERE IsMastodon=1 AND Visible=1 AND LastOkCheckTS>='.$graceline,__LINE__); $row=mysqli_fetch_assoc($res); echo(_('

This search engine for Mastodon instances is based on a database that gets updated by our crawler every night (CET). Instances are considered new for 30 days after they are discovered. When an instance has not responded to our daily checks for more than 30 days it’s no longer considered in statistics and searches and it gets checked only on the first of the month, rather than daily, until it possibly responds again. “Random ordering” of results varies daily.

Default search criteria reflect our fondness for a decentralized and egalitarian Fediverse and our attempt to exclude instances accepting fascist, racist, sexist, ableist or sovereignist contents by marking them as noxious.

').N); printf(_('

We currently count %s Mastodon instances, with %s users (%s active during last month) and %s published statuses. [Show Threads moderation statistics]

'), fnum($row['tinsts'],$lc), fnum($row['tusers'],$lc), fnum($row['tactusers'],$lc), fnum($row['tstatuses'],$lc)); //echo '
'.print_r($metastats,true).'
'.N; $metastats['known']=[ 'instances'=>$row['tinsts']-$metastats['unknown']['instances'], 'users'=>$row['tusers']-$metastats['unknown']['users'] ]; $metastats['known']['iperc']=$metastats['known']['instances']*100/$row['tinsts']; $metastats['known']['uperc']=$metastats['known']['users']*100/$row['tusers']; $metastats['unknown']['iperc']=$metastats['unknown']['instances']*100/$row['tinsts']; $metastats['unknown']['uperc']=$metastats['unknown']['users']*100/$row['tusers']; $metastats['suspending']['iperc']=$metastats['suspending']['instances']*100/$row['tinsts']; $metastats['suspending']['uperc']=$metastats['suspending']['users']*100/$row['tusers']; $metastats['suspending']['kiperc']=$metastats['suspending']['instances']*100/$metastats['known']['instances']; $metastats['suspending']['kuperc']=$metastats['suspending']['users']*100/$metastats['known']['users']; $metastats['fpsuspending']['iperc']=$metastats['fpsuspending']['instances']*100/$row['tinsts']; $metastats['fpsuspending']['uperc']=$metastats['fpsuspending']['users']*100/$row['tusers']; $metastats['fpsuspending']['kiperc']=$metastats['fpsuspending']['instances']*100/$metastats['known']['instances']; $metastats['fpsuspending']['kuperc']=$metastats['fpsuspending']['users']*100/$metastats['known']['users']; $metastats['limiting']['iperc']=$metastats['limiting']['instances']*100/$row['tinsts']; $metastats['limiting']['uperc']=$metastats['limiting']['users']*100/$row['tusers']; $metastats['limiting']['kiperc']=$metastats['limiting']['instances']*100/$metastats['known']['instances']; $metastats['limiting']['kuperc']=$metastats['limiting']['users']*100/$metastats['known']['users']; $metastats['notsusporlim']=[ 'instances'=>$row['tinsts']-$metastats['unknown']['instances']-$metastats['suspending']['instances']-$metastats['limiting']['instances'], 'users'=>$row['tusers']-$metastats['unknown']['users']-$metastats['suspending']['users']-$metastats['limiting']['users'] ]; $metastats['notsusporlim']['iperc']=$metastats['notsusporlim']['instances']*100/$row['tinsts']; $metastats['notsusporlim']['uperc']=$metastats['notsusporlim']['users']*100/$row['tusers']; $metastats['notsusporlim']['kiperc']=$metastats['notsusporlim']['instances']*100/$metastats['known']['instances']; $metastats['notsusporlim']['kuperc']=$metastats['notsusporlim']['users']*100/$metastats['known']['users']; $metastats['susporlim']=[ 'instances'=>$metastats['suspending']['instances']+$metastats['limiting']['instances'], 'users'=>$metastats['suspending']['users']+$metastats['limiting']['users'] ]; $metastats['susporlim']['iperc']=$metastats['susporlim']['instances']*100/$row['tinsts']; $metastats['susporlim']['uperc']=$metastats['susporlim']['users']*100/$row['tusers']; $metastats['susporlim']['kiperc']=$metastats['susporlim']['instances']*100/$metastats['known']['instances']; $metastats['susporlim']['kuperc']=$metastats['susporlim']['users']*100/$metastats['known']['users']; debug('fpsuspending: instances: '.$metastats['fpsuspending']['instances'].'; users: '.$metastats['fpsuspending']['users'].N.'fpliars: instances: '.$metastats['fpliars']['instances'].'; users: '.$metastats['fpliars']['users'].N,$debug); if (count($metastats['fpliars']['instlist'])>0) foreach ($metastats['fpliars']['instlist'] as $val) debug($val['uri'].': '.$val['usercount'].N,$debug); echo '

'._('Threads moderation statistics').'

'._('These statistics on the status of Threads moderation are based on the list of moderated instances, which is accessible only on some instances, and on the list of instances adhering to the Anti-Meta Fedi Pact.').'

'._('Statistics on the state of Threads moderation
related to instances on which it is known').'

 '._('Instances suspending Threads').': '.fnum($metastats['suspending']['instances'],$lc).' / '.fnum($metastats['known']['instances'],$lc).' ('.fnum($metastats['suspending']['kiperc'],$lc,2).'%)
 '._('Instances limiting Threads').': '.fnum($metastats['limiting']['instances'],$lc).' / '.fnum($metastats['known']['instances'],$lc).' ('.fnum($metastats['limiting']['kiperc'],$lc,2).'%)
+ '._('Instances suspending or limiting Threads').': '.fnum($metastats['suspending']['instances']+$metastats['limiting']['instances'],$lc).' / '.fnum($metastats['known']['instances'],$lc).' ('.fnum($metastats['suspending']['kiperc']+$metastats['limiting']['kiperc'],$lc,2).'%)
 '._('Instances not suspending or limiting Threads').': '.fnum($metastats['notsusporlim']['instances'],$lc).' / '.fnum($metastats['known']['instances'],$lc).' ('.fnum($metastats['notsusporlim']['kiperc'],$lc,2).'%)
 '._('Users on instances suspending Threads').': '.fnum($metastats['suspending']['users'],$lc).' / '.fnum($metastats['known']['users'],$lc).' ('.fnum($metastats['suspending']['kuperc'],$lc,2).'%)
 '._('Users on instances limiting Threads').': '.fnum($metastats['limiting']['users'],$lc).' / '.fnum($metastats['known']['users'],$lc).' ('.fnum($metastats['limiting']['kuperc'],$lc,2).'%)
+ '._('Users on instances suspending or limiting Threads').': '.fnum($metastats['suspending']['users']+$metastats['limiting']['users'],$lc).' / '.fnum($metastats['known']['instances'],$lc).' ('.fnum($metastats['suspending']['kuperc']+$metastats['limiting']['kuperc'],$lc,2).'%)
 '._('Users on instances not suspending or limiting Threads').': '.fnum($metastats['notsusporlim']['users'],$lc).' / '.fnum($metastats['known']['users'],$lc).' ('.fnum($metastats['notsusporlim']['kuperc'],$lc,2).'%)

'._('Statistics on the state of Threads
moderation related to all instances.').'

 '._('Instances suspending Threads').': '.fnum($metastats['suspending']['instances'],$lc).' / '.fnum($row['tinsts'],$lc).' ('.fnum($metastats['suspending']['iperc'],$lc,2).'%)
 '._('Instances limiting Threads').': '.fnum($metastats['limiting']['instances'],$lc).' / '.fnum($row['tinsts'],$lc).' ('.fnum($metastats['limiting']['iperc'],$lc,2).'%)
+ '._('Instances suspending or limiting Threads').': '.fnum($metastats['suspending']['instances']+$metastats['limiting']['instances'],$lc).' / '.fnum($row['tinsts'],$lc).' ('.fnum($metastats['suspending']['iperc']+$metastats['limiting']['iperc'],$lc,2).'%)
 '._('Instances not suspending or limiting Threads').': '.fnum($metastats['notsusporlim']['instances'],$lc).' / '.fnum($row['tinsts'],$lc).' ('.fnum($metastats['notsusporlim']['iperc'],$lc,2).'%)
 '._('Instances whose Threads moderation status is unknown').': '.fnum($metastats['unknown']['instances'],$lc).' / '.fnum($row['tinsts'],$lc).' ('.fnum($metastats['unknown']['iperc'],$lc,2).'%)
 '._('Users on instances suspending Threads').': '.fnum($metastats['suspending']['users'],$lc).' / '.fnum($row['tusers'],$lc).' ('.fnum($metastats['suspending']['uperc'],$lc,2).'%)
 '._('Users on instances limiting Threads').': '.fnum($metastats['limiting']['users'],$lc).' / '.fnum($row['tusers'],$lc).' ('.fnum($metastats['limiting']['uperc'],$lc,2).'%)
+ '._('Users on instances suspending or limiting Threads').': '.fnum($metastats['suspending']['users']+$metastats['limiting']['users'],$lc).' / '.fnum($row['tusers'],$lc).' ('.fnum($metastats['suspending']['uperc']+$metastats['limiting']['uperc'],$lc,2).'%)
 '._('Users on instances not suspending or limiting Threads').': '.fnum($metastats['notsusporlim']['users'],$lc).' / '.fnum($row['tusers'],$lc).' ('.fnum($metastats['notsusporlim']['uperc'],$lc,2).'%)
 '._('Users on instances whose Threads mod. status is unknown').': '.fnum($metastats['unknown']['users'],$lc).' / '.fnum($row['tusers'],$lc).' ('.fnum($metastats['unknown']['uperc'],$lc,2).'%)
'.N; if ((array_key_exists('exnox',$_GET) && $_GET['exnox']=='1') || !array_key_exists('exnox',$_GET)) { $_GET['cbexnox']=' checked'; $_GET['exnox']=1; } else { $_GET['cbexnox']=''; $_GET['exnox']=0; } if ((array_key_exists('exregc',$_GET) && $_GET['exregc']=='1') || !array_key_exists('exregc',$_GET)) { $_GET['cbexregc']=' checked'; $_GET['exregc']=1; } else { $_GET['cbexregc']=''; $_GET['exregc']=0; } // if ((array_key_exists('inths',$_GET) && $_GET['inths']=='1') || !array_key_exists('inths',$_GET)) { if (array_key_exists('inths',$_GET) && $_GET['inths']=='1') { $_GET['cbinths']=' checked'; $_GET['inths']=1; } else { $_GET['cbinths']=''; $_GET['inths']=0; } if (array_key_exists('exappr',$_GET) && $_GET['exappr']=='1') { $_GET['cbexappr']=' checked'; $_GET['exappr']=1; } else { $_GET['cbexappr']=''; $_GET['exappr']=0; } if (array_key_exists('exlcko',$_GET) && $_GET['exlcko']=='1') { $_GET['cbexlcko']=' checked'; $_GET['exlcko']=1; } else { $_GET['cbexlcko']=''; $_GET['exlcko']=0; } if (array_key_exists('lang',$_GET)) { if (preg_match('#^[0-9]+$#',$_GET['lang'])===1) $_GET['lang']=$_GET['lang']+0; else $_GET['lang']=0; } else { $res=tquery('SELECT ID FROM Languages WHERE Code="'.myesc($link,$dlang).'"',__LINE__); if (mysqli_num_rows($res)>0) { $row=mysqli_fetch_assoc($res); $_GET['lang']=$row['ID']; } else { $_GET['lang']=0; } } if ($_GET['lang']>5000000000) $_GET['lang']=0; if (array_key_exists('desc',$_GET) && preg_match('#^.+$#',$_GET['lang'])===1) $_GET['desc']=trim(n2es($_GET['desc'])); else $_GET['desc']=''; if (mb_strlen($_GET['desc'])>64) $_GET['desc']=''; ckgnum('minu',$minudef,$minumax); ckgnum('maxu',$maxudef,$maxumax); if (is_int($_GET['maxu']) && is_int($_GET['minu']) && $_GET['maxu']<$_GET['minu']) $_GET['maxu']=$_GET['minu']; ckgnum('minau',$minaudef,$minaumax); ckgnum('minc',$mincdef,$mincmax); $order=[ 'rand'=>['t'=>_('Random'), 'q'=>'Instances.RPos ASC'], 'invold'=>['t'=>_('By users’ involvement (active users / users), descending'), 'q'=>'(Instances.ActiveUsersMonth / Instances.UserCount) DESC'], 'invola'=>['t'=>_('By users’ involvement (active users / users), ascending'), 'q'=>'(Instances.ActiveUsersMonth / Instances.UserCount) ASC'], 'fseend'=>['t'=>_('By date and time of first sighting, descending'), 'q'=>'Instances.FirstSeen DESC'], 'fseena'=>['t'=>_('By date and time of first sighting, ascending'), 'q'=>'Instances.FirstSeen ASC'], 'tusersd'=>['t'=>_('By number of users, descending'), 'q'=>'Instances.UserCount DESC'], 'tusersa'=>['t'=>_('By number of users, ascending'), 'q'=>'Instances.UserCount ASC'], 'ausersd'=>['t'=>_('By number of active users, descending'), 'q'=>'Instances.ActiveUsersMonth DESC'], 'ausersa'=>['t'=>_('By number of active users, ascending'), 'q'=>'Instances.ActiveUsersMonth ASC'], 'checksd'=>['t'=>_('By responsiveness to our checks, descending'), 'q'=>'(Instances.OkChecks / Instances.TotChecks) DESC, Instances.TotChecks DESC'], 'checksa'=>['t'=>_('By responsiveness to our checks, ascending'), 'q'=>'(Instances.OkChecks / Instances.TotChecks) ASC, Instances.TotChecks ASC'], 'charsd'=>['t'=>_('By available characters per post, descending'), 'q'=>'Instances.MaxTootChars DESC'], 'charsa'=>['t'=>_('By available characters per post, ascending'), 'q'=>'Instances.MaxTootChars ASC'], 'noxd'=>['t'=>_('Noxious first (switches off “Exclude noxious”)'), 'q'=>'Instances.Noxious DESC'] ]; if (!array_key_exists('ord',$_GET) || !array_key_exists($_GET['ord'],$order)) $_GET['ord']='rand'; // $res=tquery('SELECT COUNT(Instances.ID) AS Recomm FROM Instances LEFT JOIN InstOurLangs ON InstOurLangs.InstID=Instances.ID WHERE InstOurLangs.OurLangID='.$_GET['lang'].' AND Instances.IsMastodon=1 AND Instances.Visible=1 AND Instances.LastOkCheckTS>='.$graceline.' AND InstOurLangs.Pos=1 AND Instances.Priority>127',__LINE__); $res=tquery('SELECT InstOurLangs.OurLangID FROM Instances LEFT JOIN InstOurLangs ON InstOurLangs.InstID=Instances.ID WHERE Instances.IsMastodon=1 AND Instances.Visible=1 AND Instances.LastOkCheckTS>='.$graceline.' AND InstOurLangs.Pos=1 AND Instances.Priority>127 GROUP BY InstOurLangs.OurLangID',__LINE__); $langswri=[];// langs with recommended instances while ($row=mysqli_fetch_assoc($res)) $langswri[]=$row['OurLangID']; if (count($langswri)>0) array_unshift($langswri,0); if (in_array($_GET['lang'],$langswri)) $order['rand']=['t'=>_('Random, recommended first'), 'q'=>'Instances.Priority DESC, Instances.RPos ASC']; $p=1; if (array_key_exists('p',$_GET) && preg_match('#^[0-9]+$#',$_GET['p'])===1) $p=$_GET['p']+0; echo('

'._('Search instances').'

'.N); ($_GET['lang']==0) ? $selected=' selected' : $selected=''; echo '
'._('Search criteria').'
'._('Show instances where...').'
'._('Order of results').'
'.N); $joins=[]; $wheres=[]; $wheres[]='Instances.IsMastodon=1 AND Instances.Visible=1 AND Instances.LastOkCheckTS>='.$graceline; if ($_GET['exnox']==1) $wheres[]='Instances.Noxious=0'; if ($_GET['exregc']==1) $wheres[]='Instances.RegOpen=1'; if ($_GET['exappr']==1) $wheres[]='Instances.RegReqApproval=0'; if ($_GET['exlcko']==1) $wheres[]='Instances.WasLastCheckOk=1'; /*if ($_GET['exlcko']==1) { $joins[]='LEFT JOIN InstChecks AS InstChecks ON InstChecks.InstID=Instances.ID AND InstChecks.Time=(SELECT MAX(InstChecks.Time) AS MaxTime FROM InstChecks WHERE InstChecks.InstID=Instances.ID)'; $wheres[]='InstChecks.Status=1'; }*/ if ($_GET['inths']==1) { if ($cfedipact>0) $wheres[]='Instances.Threads="suspended" OR Instances.ID IN ('.implode(', ',$fedipact['instids']).')'; else $wheres[]='Instances.Threads="suspended"'; } if ($_GET['lang']>0) { $joins[]='LEFT JOIN InstOurLangs ON InstOurLangs.InstID=Instances.ID'; $wheres[]='(InstOurLangs.OurLangID='.$_GET['lang'].' AND InstOurLangs.Pos=1)'; } $buf=preg_replace('#%#','\%',myesc($link,$_GET['desc'])); if ($_GET['desc']!='') $wheres[]='(Instances.URI LIKE "%'.$buf.'%" OR Instances.Title LIKE "%'.$buf.'%" OR Instances.ShortDesc LIKE "%'.$buf.'%" OR Instances.LongDesc LIKE "%'.$buf.'%")'; if ($_GET['minu']!='') $wheres[]='Instances.UserCount>='.$_GET['minu']; if ($_GET['maxu']!='') $wheres[]='Instances.UserCount<='.$_GET['maxu']; if ($_GET['minau']!='') $wheres[]='Instances.ActiveUsersMonth>='.$_GET['minau']; if ($_GET['minc']!='' && $_GET['minc']!='""') $wheres[]='Instances.MaxTootChars>='.$_GET['minc']; $joins=implode(' ',$joins); $wheres='WHERE '.implode(' AND ',$wheres); $que='SELECT * FROM Instances '.$joins.' '.$wheres.' ORDER BY '.$order[$_GET['ord']]['q']; } debug('MAIN QUERY: «'.$que.'»'.N,$debug); $res=tquery($que,__LINE__); $itot=mysqli_num_rows($res); debug('RESULTS: '.$itot.N,$debug); /*if ($itot==0) { echo(_('No instance matches with the search criteria.').N.'
'.N.'
'.N.'
'.N.''.N.''.N); exit(0); }*/ $ipp=10;// istanze per pagina $if=$ipp*($p-1); if ($if>=$itot) { $if=0; $p=1; } $ptot=ceil($itot/$ipp); ($p!=$ptot) ? $il=$if+$ipp : $il=$itot; $dfmt=datefmt_create($blang,IntlDateFormatter::MEDIUM,IntlDateFormatter::NONE,'UTC',IntlDateFormatter::GREGORIAN); $defmt=datefmt_create($blang,IntlDateFormatter::SHORT,IntlDateFormatter::MEDIUM,'UTC',IntlDateFormatter::GREGORIAN); $wrfss=1602633600;// we record FirstSeen since October 14, 2020, 0:0:0 UTC $wrfsstxt=datefmt_format($dfmt,$wrfss).' UTC'; mysqli_data_seek($res,$if); while ($if<$il && $row=mysqli_fetch_assoc($res)) { $if++; $out='
'.hspech($row['URI']).''; if (!$single) $out.=' ('.$if.'/'.$itot.')'; $out.='
'.N; ($if<$il) ? $out.='
'.N : $out.='
'.N; $rres=tquery('SELECT CONCAT(Languages.Name'.$dlanguc.'," (",Languages.Code,")") AS Lang FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=InstOurLangs.OurLangID WHERE InstOurLangs.InstID='.$row['ID'].' ORDER BY InstOurLangs.Pos ASC',__LINE__); $buf=[]; while ($rrow=mysqli_fetch_assoc($rres)) $buf[]=hspech($rrow['Lang']); ($row['Thumb']=='unavailable') ? $thumb=$prepath.'imgs/InstThumbUnavailable.svg' : $thumb=$row['Thumb']; $out.='
'; // if (!is_null($row['Priority'])) $out.=''; if (!is_null($row['Priority'])) $out.='
'._('Recommended').'
'; if ($row['Thumb']=='unavailable' && $row['WasLastCheckOk']==1) $out.='
'._('It seems like this instance’s server thumbnail’s URL points to a non existent file. This is usually easily fixable by the instance’s admin(s) by uploading again the image to their server. Note that the change won’t be displayed here before the nightly automatic update of this instance’s infos occurs.').'
'; $out.='
'.N; $out.='
'.N; $out.='
'._('Name').' '.nully(hspech($row['Title'])).'
'.N; /*$out.='
'._('Consigliata').' '; (!is_null($row['Priority'])) ? $out.=''._('Si!').'' : $out.=_('No'); $out.='
'.N;*/ $out.='
'._('Languages').' '.nully(implode(', ',$buf)).'
'.N; $out.='
'._('Users').' '.nully(fnum($row['UserCount'],$lc)).'
'.N; $out.='
'._('Active users (last month)').' '.nully(fnum($row['ActiveUsersMonth'],$lc)).'
'.N; $out.='
'._('Active users (last six months)').' '.nully(fnum($row['ActiveUsersHalfYear'],$lc)).'
'.N; $out.='
'._('Characters per post (max)').' '; if (nullemp(fnum($row['MaxTootChars'],$lc))) $out.='500'; else $out.=$row['MaxTootChars']; $out.='
'.N; $out.='
'._('Known instances').' '.nully(fnum($row['DomainCount'],$lc)).'
'.N; $out.='
'.N; $out.='
'.N; if (is_null($row['FirstSeen'])) {// can't currently happen, but we put it there in any event $fdate=''._('Not available{singular}').''; } elseif ($row['FirstSeen']<$wrfss) { $fdate=''._('Before').' '.$wrfsstxt.''; } else { $fdate=datefmt_format($dfmt,$row['FirstSeen']).' UTC'; } $out.='
'._('First sight').' '.$fdate.'
'.N; (is_null($row['LastOkCheckTS'])) ? $fdate=''._('Not available{singular}').'' : $fdate=datefmt_format($dfmt,$row['LastOkCheckTS']).' UTC'; $out.='
'._('Last successful check').' '.$fdate.'
'.N; $out.='
'._('Noxious').' '; ($row['Noxious']==1) ? $out.=''._('Yes (see why below)').'' : $out.=''._('No').''; $out.='
'.N; $out.='
'._('New').' '; ($btu-$row['InsertTS']<=$oldline) ? $out.=''._('Yes!').'' : $out.=_('No'); $out.='
'.N; $software=''; if (!is_null($row['Software'])) $software.=ucfirst($row['Software']); if (!is_null($row['Version'])) $software.=' '.$row['Version']; $out.='
'._('Software').' '.nully(hspech($software)).'
'.N; $out.='
'._('Registrations').' '; ($row['RegReqApproval']==1) ? $buf=' ('._('by admin approval').')' : $buf=''; if (nullemp($row['RegOpen'])) $out.=''._('Not available{singular}').''; elseif ($row['RegOpen']==1) $out.=''._('Open').''.$buf; else $out.=''._('Closed').''; $out.='
'.N; $out.='
'._('E-mail').' '; if (nullemp($row['Email'])) $out.=''._('Not available{singular}').''; else $out.=''.$row['Email'].''; $out.='
'.N; $out.='
'.N; $out.='
'._('Meta’s Threads moderation').' '; if (in_array($row['ID'],$fedipact['instids'])) { $out.=_('Threads is suspended').', '._('according to the Anti-Meta Fedi Pact list'); if (is_null($row['Threads'])) $out.=', '._('but it’s currently impossible to verify it because this instance’s list of moderated instances is not accessible').'.'; elseif ($row['Threads']=='accessible') $out.=', '._('but it appears to be accessible, instead').', '._('according to this instance’s list of moderated instances').'.'; elseif ($row['Threads']=='suspended') $out.=', '._('and also').' '._('according to this instance’s list of moderated instances').'.'; elseif ($row['Threads']=='limited') $out.=', '._('but it appears to be only limited, instead').', '._('according to this instance’s list of moderated instances').'.'; else $out.='.'; } elseif (is_null($row['Threads'])) { $out.=_('Unknown (this instance is not listed in the Anti-Meta Fedi Pact list), and its list of moderated instances is not accessible').'.'; } elseif ($row['Threads']=='accessible') { $out.=_('Threads is neither suspended nor limited').', '._('according to this instance’s list of moderated instances').'.'; } elseif ($row['Threads']=='suspended') { $out.=_('Threads is suspended').', '._('according to this instance’s list of moderated instances').'.'; } elseif ($row['Threads']=='limited') { $out.=_('Threads is limited').', '._('according to this instance’s list of moderated instances').'.'; } else { $out.=_('Unknown value').': «'.htmlentities($row['Threads']).'»; '._('please contact masthelp[at]insicuri.net').'.'; } $out.='
'.N; $out.='
'._('Most used hashtags (last week)').' '; $rres=tquery('SELECT * FROM InstTrends WHERE InstID='.$row['ID'].' ORDER BY Pos ASC',__LINE__); if (mysqli_num_rows($rres)>0) { $buf=[]; while ($rrow=mysqli_fetch_assoc($rres)) $buf[]=''.hspech($rrow['Name']).''; $out.=implode(', ',$buf); } else { $out.=''._('Not available{plural}').''; } $out.='
'.N; if ($row['Noxious']) { $out.='
'._('Why we consider this instance noxious').'
'.nully(strip($row['NoxReason'],$row['URI'])).'
'.N; } $out.='
'._('Short description').'
'.nully(strip($row['ShortDesc'],$row['URI'])).'
'.N; $out.='
'._('Long description').'
'.nully(strip($row['LongDesc'],$row['URI'])).'
'.N; $out.='
'._('Instance rules').'
'; $rres=tquery('SELECT Text FROM InstRules WHERE InstID='.$row['ID'],__LINE__); if (mysqli_num_rows($rres)>0) { $out.='
    '.N; while ($rrow=mysqli_fetch_assoc($rres)) $out.='
  1. '.hspech($rrow['Text']).'
  2. '.N;// no strip, do hspech, because instance rules don’t support html nor markdown in mastodon $out.='
'.N; } else { $out.=''._('Not available{plural}').''; } $out.='
'.N; $out.='
'._('Moderated instances').'
'; $sevmap=['silence'=>_('limited'), 'suspend'=>_('sospeso')]; $rres=tquery('SELECT Domain, Severity, Comment FROM InstBlocks WHERE InstID='.$row['ID'],__LINE__); if (mysqli_num_rows($rres)>0) { $out.='
    '.N; while ($rrow=mysqli_fetch_assoc($rres)) { $out.='
  • '.hspech($rrow['Domain']).': '.$sevmap[$rrow['Severity']]; if (!is_null($rrow['Comment'])) $out.=' - '.hspech($rrow['Comment']);// no strip, do hspech, because moderated instances comments don’t support html nor markdown in mastodon $out.='
  • '.N; } $out.='
'.N; } else { $out.=''._('Not available{plural}').''; } $out.='
'.N; $admacc=nully(null); $thumb=$prepath.'imgs/AdmAccThumbUnavailable.svg'; if (!is_null($row['AdmAccount']) && $row['AdmAccount']!='OPTED OUT') { $admacc='' . hspech($row['AdmAccount']) . '@' . hspech($row['URI']) . ''; if ($row['AdmAvatar']!='unavailable') $thumb=$row['AdmAvatar']; } elseif ($row['AdmAccount']=='OPTED OUT') { $admacc=''._('Opted out of search engines indexing').''; } (is_null($row['AdmCreatedAt'])) ? $fdate=''._('Not available{singular}').'' : $fdate=datefmt_format($dfmt,$row['AdmCreatedAt']).' UTC'; $out.='
'._('Admin account').' '.$admacc.'
'._('Date of creation').' '.$fdate.'
'._('Display name').' '.nully(hspech($row['AdmDisplayName'])).'
'._('Bio').'
'.nully(strip($row['AdmNote'],$row['URI'])).'
'.N; $out.='
'; $out.='
'._('Statistics').'
'; $rres=tquery('SELECT COUNT(InstID) AS cnt, SUM(Statuses) AS tstatuses, SUM(Logins) AS tlogins, SUM(Registrations) AS tregs FROM InstActivity WHERE InstID='.$row['ID'],__LINE__); $out.='
'._('Last 12 weeks activity'); if (mysqli_num_rows($rres)>0) { $rrow=mysqli_fetch_assoc($rres); if ($rrow['cnt']>0) $out.=' ('._('totals:').' '.$rrow['tstatuses'].' '._('statuses').', '.$rrow['tlogins'].' '._('logins').', '.$rrow['tregs'].' '._('registrations').')'; } $out.='
'.N; $rres=tquery('SELECT * FROM InstActivity WHERE InstID='.$row['ID'].' ORDER BY Week ASC',__LINE__); $out.=''; $tot=mysqli_num_rows($rres); if ($tot>0) { while ($rrow=mysqli_fetch_assoc($rres)) // initials for Statuses, Logins, Registrations $out.=''; } else { $out.=''; } $out.='
'._('S').': '.$rrow['Statuses'].'
'._('L').': '.$rrow['Logins'].'
'._('R').': '.$rrow['Registrations'].'
'._('Not available{singular}').'
'.N; $rres=tquery('SELECT * FROM InstChecks WHERE InstID='.$row['ID'].' ORDER BY Time DESC LIMIT 0,8',__LINE__); $tot=mysqli_num_rows($rres); $buf=[]; while ($rrow=mysqli_fetch_assoc($rres)) $buf[]=$rrow; $out.='
'._('Last checks (green: OK; red: KO)').'
'; for ($i=$tot-1; $i>=0; $i--) { $out.='
'; } $out.='
'.N; $out.='
'._('Succesful checks').': '.$row['OkChecks'].'/'.$row['TotChecks'].' ('.round($row['OkChecks']*100/$row['TotChecks'], 2).'%)
'.N; $out.='
'.N; $out.='
'.N; echo($out); } mysqli_close($link); echo(''.N); if ($ptot>1) { echo('
'.N); echo('
'.N); $pnav=''; if ($p>1) $pnav.=''; else $pnav.=''; //$pnav.=''; $pnav.=''.N; if ($p<$ptot) $pnav.=''; else $pnav.=''; $pnav.='
Page '.$p.'/'.$ptot.'
'.N; echo($pnav); echo('
'.N); } echo('
'.N); echo(''.N); debug('TOTAL RENDERING TIME: '.hrte($bt).N,$debug); if (array_key_exists('debug',$_GET) && $_GET['debug']=='1') echo(''.N); // functions function setfedipact() { global $link, $graceline, $fedipact, $cfedipact; $fedipact=['uris'=>[], 'uris_me'=>[], 'instids'=>[]]; $fedipactfp='../clitools/fedipact.list'; $fedipact['uris']=@file($fedipactfp,FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); if (!is_array($fedipact['uris'])) { debug('WARNING: could not open «'.$fedipactfp.'».'.N,$debug); $fedipact['uris']=[]; } $cfedipact=count($fedipact['uris']); if ($cfedipact>0) { foreach ($fedipact['uris'] as $val) $fedipact['uris_me'][]=myesc($link,$val); $fedipact['uris_me']='"'.implode('", "',$fedipact['uris_me']).'"'; //echo '
'.print_r($fedipact,true).'
'.N; $res=tquery('SELECT ID, URI FROM Instances WHERE IsMastodon=1 AND Visible=1 AND LastOkCheckTS>='.$graceline.' AND URI IN ('.$fedipact['uris_me'].')', __LINE__); $fedipact['uris']=[]; $fedipact['uris_me']=[]; while ($row=mysqli_fetch_assoc($res)) { $fedipact['uris'][]=$row['URI']; $fedipact['instids'][]=$row['ID']; } foreach ($fedipact['uris'] as $val) $fedipact['uris_me'][]=myesc($link,$val); $fedipact['uris_me']='"'.implode('", "',$fedipact['uris_me']).'"'; $cfedipact=count($fedipact['instids']); } else { $fedipact['uris_me']=''; } } function debug($msg,&$debug) { if (array_key_exists('debug',$_GET) && $_GET['debug']=='1') $debug.=$msg; } function ckgnum($key,$def,$max) { if (array_key_exists($key,$_GET)) { $_GET[$key]=trim($_GET[$key]); if (preg_match('#^\d+$#',$_GET[$key])===1) { $_GET[$key]=$_GET[$key]+0; if ($_GET[$key]>$max) $_GET[$key]=$max; } elseif ($_GET[$key]!='') { $_GET[$key]=$def; } } else { $_GET[$key]=$def; } } function nullemp($inp) { if (is_null($inp) || preg_match('/^\s*$/',$inp)===1) return true; return false; } function nulltozero($inp) { if (is_null($inp)) return 0; return $inp; } function hspech($str) { if (nullemp($str)) return(null); return htmlspecialchars($str,ENT_QUOTES|ENT_HTML5,'UTF-8'); } function muorimeglio($msg,$close) { global $link; if ($close) mysqli_close($link); echo('

'.$msg.'

'.N.''.N.''.N.''.N.''.N); exit(2); } function nully($str) { // "Not available" in singular form - translators, please omit "{singular}" from translation, // it's there just to diversify this "Not available" from the next one if (nullemp($str)) return(''._('Not available{singular}').''); return $str; } function nullyp($str) { // "Not available" in plural form - translators, please omit "{plural}" from translation, // it's there just to diversify this "Not available" from the previous one if (nullemp($str)) return(''._('Not available{plural}').''); return $str; } function strip($str,$uri) { if (nullemp($str)) return(null); $str=preg_replace('#]*)?>.*#is','',$str); $str=preg_replace('#','

'],$str); $str=preg_replace(['#


#i','#
#i','#
#i','#

    #i'],['

    ','','
','
$#i', '#]*>(.*)$#i'],['

$1

', '
    $1
', '
    $1
', '
$1
'],$str); return $str; } function hrte($bt) { if (function_exists('bcdiv')) return bcdiv(bcsub(hrtime(true),$bt,9),1000000000,9); else return (hrtime(true)-$bt)/1000000000; } function tquery($query,$line) { global $link, $debug; $bt=hrtime(true); //usleep(rand(10000,1050000)); $res=mysqli_query($link,$query) or muorimeglio('Error on line '.$line.': '.mysqli_error($link),true); debug(sprintf('%f secs. for query «'.$query.'»'.N,hrte($bt)),$debug); return $res; } ?>