Added the possibility to include only instances where max chars per post is at least x; added som strings; modified some others

This commit is contained in:
pezcurrel 2023-01-01 11:05:51 +01:00
parent ac6c5b0585
commit c3b58faa23

View file

@ -48,11 +48,13 @@ if (array_key_exists('advc',$_GET)) {
}
$minudef=10;
$minumax=10000000000;
$minumax=4294967295;
$maxudef=30000;
$maxumax=10000000000;
$maxumax=4294967295;
$minaudef=10;
$minaumax=10000000;
$minaumax=4294967295;
$mincdef='""';
$mincmax=16777215;
echo('</nav>
<div id="popupback">
@ -132,6 +134,7 @@ function ckadvcri() {
if (document.getElementById("minu").value!='.$minudef.' ||
document.getElementById("maxu").value!='.$maxudef.' ||
document.getElementById("minau").value!='.$minaudef.' ||
document.getElementById("minc").value!='.$mincdef.' ||
document.getElementById("cbnoxious").checked==false ||
document.getElementById("cbcreg").checked==false ||
document.getElementById("cbappr").checked==true ||
@ -150,6 +153,7 @@ function endisadvcri() {
document.getElementById("minu").value="";
document.getElementById("maxu").value="";
document.getElementById("minau").value="";
document.getElementById("minc").value="";
document.getElementById("cbnoxious").checked=false;
document.getElementById("noxious").value=0;
document.getElementById("cbcreg").checked=false;
@ -162,6 +166,7 @@ function endisadvcri() {
document.getElementById("minu").value='.$minudef.';
document.getElementById("maxu").value='.$maxudef.';
document.getElementById("minau").value='.$minaudef.';
document.getElementById("minc").value='.$mincdef.';
document.getElementById("cbnoxious").checked=true;
document.getElementById("noxious").value=1;
document.getElementById("cbcreg").checked=true;
@ -324,6 +329,7 @@ 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=array(
'rand'=>array('t'=>_('Random, recommended first'),'q'=>'Instances.Priority DESC, Instances.RPos ASC'),
@ -337,8 +343,8 @@ $order=array(
'ausersa'=>array('t'=>_('By number of active users, ascending'),'q'=>'Instances.ActiveUsersMonth ASC'),
'checksd'=>array('t'=>_('By responsiveness to our checks, descending'),'q'=>'(Instances.OkChecks / Instances.TotChecks) DESC, Instances.TotChecks DESC'),
'checksa'=>array('t'=>_('By responsiveness to our checks, ascending'),'q'=>'(Instances.OkChecks / Instances.TotChecks) ASC, Instances.TotChecks ASC'),
'charsd'=>array('t'=>_('By maximum number of characters per toot, descending'),'q'=>'Instances.MaxTootChars DESC'),
// 'charsa'=>array('t'=>_('By maximum number of characters per toot, ascending'),'q'=>'Instances.MaxTootChars ASC'),
'charsd'=>array('t'=>_('By available characters per post, descending'),'q'=>'Instances.MaxTootChars DESC'),
'charsa'=>array('t'=>_('By available characters per post, ascending'),'q'=>'Instances.MaxTootChars ASC'),
'noxd'=>array('t'=>_('Noxious first (switches off “Exclude noxious”)'),'q'=>'Instances.Noxious DESC')
);
if (!(array_key_exists('ord',$_GET) && array_key_exists($_GET['ord'],$order)))
@ -359,6 +365,7 @@ echo('<form method="get" id="curvf" name="curvf">
<input name="minu" type="hidden" value="'.$_GET['minu'].'">
<input name="maxu" type="hidden" value="'.$_GET['maxu'].'">
<input name="minau" type="hidden" value="'.$_GET['minau'].'">
<input name="minc" type="hidden" value="'.$_GET['minc'].'">
<input name="ord" type="hidden" value="'.$_GET['ord'].'">
<input name="p" type="hidden" value="'.$p.'">
</form>'.N);
@ -381,7 +388,7 @@ echo('</select>
</div>
<div class="sdrow">
<div class="sdlabel"><label for="desc" title="'._('Include only instances whose URI, name or description (short or long) contains the specified expression').'">'._('URI, name or descriptions contains').'</label></div>
<div class="sdinput"><input type="text" id="desc" name="desc" class="sinput" maxlength="64" value="'.hspech($_GET['desc']).'"></div>
<div class="sdinput"><input type="text" id="desc" name="desc" class="sinput" maxlength="64" value="'.hspech($_GET['desc']).'" autofocus></div>
</div>
<div id="mctrl">
@ -389,19 +396,23 @@ echo('</select>
<input type="button" class="litbut" id="disadvcrib" value="'._('Disable all advanced criteria').'" onclick="endisadvcri();">
</div>
<div class="sdrow">
<div class="sdlabel"><label for="minu" title="'._('Include only instances which have at least this number of users (set to empty to disable this criterion)').'">'._('Minimum number of users is').'</label></div>
<div class="sdlabel"><label for="minu" title="'._('Include only instances which have at least this number of users [set to empty to disable this criterion]').'">'._('Users are at least').'</label></div>
<div class="sdinput"><input type="number" id="minu" name="minu" min="0" max="'.$minumax.'" class="sinput" value="'.$_GET['minu'].'" onchange="ckadvcri();"></div>
</div>
<div class="sdrow">
<div class="sdlabel"><label for="maxu" title="'._('Include only instances which have at most this number of users (set to empty to disable this criterion)').'">'._('Maximum number of users is').'</label></div>
<div class="sdlabel"><label for="maxu" title="'._('Include only instances which have at most this number of users [set to empty to disable this criterion]').'">'._('Users are at most').'</label></div>
<div class="sdinput"><input type="number" id="maxu" name="maxu" min="0" max="'.$maxumax.'" class="sinput" value="'.$_GET['maxu'].'" onchange="ckadvcri();"></div>
</div>
<div class="sdrow">
<div class="sdlabel"><label for="minau" title="'._('Include only instances which had at least this number of active users during the last 30 days (set to empty to disable this criterion)').'">'._('Minimum number of active users is').'</label></div>
<div class="sdlabel"><label for="minau" title="'._('Include only instances which had at least this number of active users during the last 30 days [set to empty to disable this criterion]').'">'._('Active users are at least').'</label></div>
<div class="sdinput"><input type="number" id="minau" name="minau" min="0" max="'.$minaumax.'" class="sinput" value="'.$_GET['minau'].'" onchange="ckadvcri();"></div>
</div>
<div class="sdrow">
<div class="sdlabel"><label for="cbnoxious" title="'._('Exclude noxious instances').'">'._('Exclude noxious').'</label></div>
<div class="sdlabel"><label for="minc" title="'._('Include only instances on which the number of available characters per post is at least this [set to empty to disable this criterion]').'">'._('Max. chars per post are at least').'</label></div>
<div class="sdinput"><input type="number" id="minc" name="minc" min="0" max="'.$mincmax.'" class="sinput" value="'.$_GET['minc'].'" onchange="ckadvcri();"></div>
</div>
<div class="sdrow">
<div class="sdlabel"><label for="cbnoxious" title="'._('Exclude noxious instances').'">'._('Exclude if noxious').'</label></div>
<div class="sdinput">
<input type="checkbox" class="sckbox" id="cbnoxious" value="1"'.$_GET['cbnoxious'].' onchange="sethid(\'noxious\');">
<input type="hidden" id="noxious" name="noxious" value="'.$_GET['noxious'].'">
@ -486,6 +497,7 @@ if ($_GET['desc']!='') $wheres[]='(Instances.URI LIKE "%'.$buf.'%" OR Instances.
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']!='') $wheres[]='Instances.MaxTootChars>='.$_GET['minc'];
$joins=implode(' ',$joins);
$wheres='WHERE '.implode(' AND ',$wheres);
if (!$single)
@ -540,7 +552,7 @@ while ($if<$il && $row=mysqli_fetch_assoc($res)) {
$out.='<div><span class="ilab">'._('Users').'</span> '.nully(fnum($row['UserCount'],0,$dlang)).'</div>'.N;
$out.='<div><span class="ilab">'._('Active users (last month)').'</span> '.nully(fnum($row['ActiveUsersMonth'],0,$dlang)).'</div>'.N;
$out.='<div><span class="ilab">'._('Active users (last six months)').'</span> '.nully(fnum($row['ActiveUsersHalfYear'],0,$dlang)).'</div>'.N;
$out.='<div><span class="ilab">'._('Characters per toot (max)').'</span> ';
$out.='<div><span class="ilab">'._('Characters per post (max)').'</span> ';
if (nullemp(fnum($row['MaxTootChars'],0,$dlang)))
$out.='<span class="null">500</span>';
else