'));
} elseif ($filter=='htmlchars') {
return(hspech($val));
} elseif ($filter=='timestamp') {
return(strftime('%a %d %b %Y, %T',$val));
} elseif ($filter=='email') {
return(''.strip_tags($val).'');
} elseif ($filter=='url') {
return(''.strip_tags($val).'');
} elseif ($filter=='image') {
return('');
} elseif ($filter=='boolt') {
if ($val)
return('Si');
else
return('No');
} elseif ($filter=='boolf') {
if ($val)
return('Si');
else
return('No');
} else {
return($val);
}
} else {
if (is_null($ntext)) {
if ($fem)
return('Non definita');
else
return('Non definito');
}
else {
return(''.$ntext.'');
}
}
}
function booly($pre,$val,$nottoobad=false,$invcol=false) {
if ($val) {
if (!$invcol) {
$p=' ';
} else {
if (!$nottoobad) {
$p=' ';
} else {
$p=' ';
}
}
return($p.$pre.'SI ';
} else {
$p=' ';
}
} else {
$p=' ';
}
return($p.$pre.'NO Nessuna istanza da mostrare.'.print_r($_POST,1).'
';
$cols=array(
'New'=>array('name'=>'Nuova','type'=>'bool'),
'Good'=>array('name'=>'Papabile','type'=>'bool'),
'Chosen'=>array('name'=>'Scelta','type'=>'bool'),
'Visible'=>array('name'=>'Visibile','type'=>'bool'),
'Blacklisted'=>array('name'=>'Blacklistata','type'=>'bool'),
'URI'=>array('name'=>'URI','type'=>'text'),
'Title'=>array('name'=>'Titolo','type'=>'text'),
'ShortDesc'=>array('name'=>'Descrizione breve','type'=>'text'),
'LongDesc'=>array('name'=>'Descrizione lunga','type'=>'text'),
'OurDesc'=>array('name'=>'Descrizione nostra','type'=>'text'),
'PlaceID'=>array('name'=>'[Località]','type'=>'join','join'=>array()),
'Places.Locality'=>array('name'=>'Località','type'=>'joini','join'=>array('Places ON Places.ID=Instances.PlaceID'),'subtype'=>'text'),
'Email'=>array('name'=>'Email di contatto','type'=>'text'),
'Software'=>array('name'=>'Software','type'=>'text'),
'Version'=>array('name'=>'Versione','type'=>'text'),
'UserCount'=>array('name'=>'Utenti','type'=>'int'),
'StatusCount'=>array('name'=>'Stati','type'=>'int'),
'DomainCount'=>array('name'=>'Istanze note','type'=>'int'),
'ActiveUsersMonth'=>array('name'=>'Utenti attivi (mese)','type'=>'int'),
'ActiveUsersHalfYear'=>array('name'=>'Utenti attivi (6 mesi)','type'=>'int'),
'Thumb'=>array('name'=>'Logo','type'=>'text'),
'RegOpen'=>array('name'=>'Registrazioni aperte','type'=>'bool'),
'RegReqApproval'=>array('name'=>'Approvazione registrazioni','type'=>'bool'),
'MaxTootChars'=>array('name'=>'Limite caratteri','type'=>'int'),
'AdmAccount'=>array('name'=>'Account admin','type'=>'text'),
'AdmDisplayName'=>array('name'=>'Nome account admin','type'=>'text'),
'AdmCreatedAt'=>array('name'=>'Data creazione account admin','type'=>'time'),
'AdmURL'=>array('name'=>'Pagina dell’admin','type'=>'text'),
'AdmAvatar'=>array('name'=>'Avatar admin','type'=>'text'),
'AdmNote'=>array('name'=>'Note dell’admin','type'=>'text'),
'LangID'=>array('name'=>'[Lingue dichiarate]','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID')),
'Languages.Code'=>array('name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text'),
'OurLangID'=>array('name'=>'[Lingue impostate da noi]','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID')),
'OurLanguages.Code'=>array('name'=>'Lingue impostate da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text'),
'FinID'=>array('name'=>'[Modalità di finanziamento]','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instnces.ID')),
'Financing.Type'=>array('name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instnces.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text'),
'PolID'=>array('name'=>'[Restrizioni sui contenuti]','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID')),
'Policies.Name'=>array('name'=>'Restrizioni sui contenuti','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text'),
'TagID'=>array('name'=>'[Tags]','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID')),
'Tags.Name'=>array('name'=>'Tags','type'=>'join','joini'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text'),
'Statuses'=>array('name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
'Logins'=>array('name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
'Registrations'=>array('name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
);
$types=array('bool','int','time','text','join','joini');
$fieldselopts='';
foreach ($cols as $key=>$val) {
if ($val['type']=='joini') {
$fieldselopts.='';
} else {
$fieldselopts.='';
}
}
/*
[openpar-1] => null
[fieldsel-1] => New§bool
[condsel-1] => IS
[valuesel-1] => TRUE
[closepar-1] => null
[andor-1] => AND
[openpar-2] => (
[fieldsel-2] => URI§text
[condsel-2] => LIKE
[valueinp-2] => bida
[closepar-2] => null
[andor-2] => OR
[openpar-3] => null
[fieldsel-3] => URI§text
[condsel-3] => IS NULL
[closepar-3] => )
[andor-3] => AND
[openpar-4] => null
[fieldsel-4] => PlaceID§join
[condsel-4] => =
[valuesel-4] => 1
[closepar-4] => null
[andor-4] => AND
[openpar-5] => null
[fieldsel-5] => UserCount§int
[condsel-5] => >=
[valueinp-5] => 123
[closepar-5] => null
[andor-5] => AND
[openpar-6] => null
[fieldsel-6] => LangID§join
[condsel-6] => =
[valuesel-6] => 20
[closepar-6] => null
*/
$sels=array();
$joins=array();
$where='';
foreach ($_POST as $key=>$val) {
if (preg_match('/^openpar-\d+/',$key)===1 && preg_match('/^\(+$/',$val)===1)
$where.=$val;
if (preg_match('/^fieldsel-\d+/',$key)===1 && preg_match('/^(.+)§(.+)§(.+)$/',$val,$buf)===1) {
if (array_key_exists($buf[1],$cols) && in_array($buf[2],$types)) {
$where.=$buf[1];
if ($buf[2]=='join' || $buf[2]=='joini') {
foreach ($cols[$buf[1]]['join'] as $join) {
if (!in_array($join,$joins))
$joins[]=$join;
}
if ($buf[2]=='joini' && array_key_exists('select',$cols[$buf[1]]) && !in_array($cols[$buf[1]]['select'],$sels))
$sels[]=$cols[$buf[1]]['select'];
}
} else {
muoribene($dbg.'
Dati POST corrotti.
Puoi riprovare o tornare al login.',true);
}
}
if (preg_match('/^condsel-\d+/',$key)===1) {
$where.=' '.$val.' ';
$cond=$val;
}
if (preg_match('/^valuesel-\d+/',$key)===1)
$where.=$val;
if (preg_match('/^valueinp-\d+/',$key)===1) {
if (preg_match('/^(LIKE|NOT LIKE)$/',$cond)===1)
$where.='\'%'.myesc($link,$val).'%\'';
else
$where.='\''.myesc($link,$val).'\'';
}
if (preg_match('/^closepar-\d+/',$key)===1 && preg_match('/^\)+$/',$val)===1)
$where.=$val;
if (preg_match('/^andor-\d+/',$key)===1 && preg_match('/^(AND|OR)$/',$val)===1)
$where.=' '.$val.' ';
}
if (count($sels)>0)
$sels=', '.implode(', ',$sels);
else
$sels='';
if ($where!='')
$where='WHERE '.$where;
if (count($joins)>0)
$joins='LEFT JOIN '.implode(' LEFT JOIN ',$joins);
else
$joins='';
$query='SELECT *, Instances.ID AS IID'.$sels.' FROM Instances '.$joins.' '.$where.' GROUP BY IID ORDER BY Instances.URI ASC LIMIT 50';
$dbg.='QUERONA: '.$query.'
'.N;
$res=mysqli_query($link,$query)
or muoribene($dbg.'
'.$query.': '.mysqli_error($link),true);
if (mysqli_num_rows($res)<1) {
$out=''.N;
// $out.='
'.N;
}
$out.='';
}
mysqli_close($link);
?>
'.N;
$out.=''.N;
$out.='Attributi Info '.N;
$attr=booly($cols['Blacklisted']['name'].': ',$row['Blacklisted'],false,true).N;
$attr.=booly($cols['New']['name'].': ',$row['New'],true).N;
$attr.=booly($cols['Good']['name'].': ',$row['Good']).N;
$attr.=booly($cols['Chosen']['name'].': ',$row['Chosen']).N;
$attr.=booly($cols['Visible']['name'].': ',$row['Visible']).N;
/* $attr.=booly($cols['RegOpen']['name'].': ',$row['RegOpen']).N;
$attr.=booly($cols['RegReqApproval']['name'].': ',$row['RegReqApproval'],true,true).N;*/
$sres=mysqli_query($link,'SELECT * FROM InstChecks WHERE InstID='.$row['IID'].' ORDER BY Time DESC')
or muoribene(mysqli_error($link),true);
$csres=mysqli_num_rows($sres);
if ($csres>0) {
$bene=0;
while ($srow=mysqli_fetch_assoc($sres)) {
if ($srow['Status']==1)
$bene++;
}
$width=str_replace(',','.',100/$csres*$bene);
$attr.=''.$row['URI'].' {'.$row['IID'].'}
Accessi: '.$tot['tlogins'].'
Registrazioni: '.$tot['tregs'].''.N;
while ($srow=mysqli_fetch_assoc($sres)) {
$attr.='
'.N;
$out.=''.N;
$out.=''.$attr.' '.N;
$out.='