1
0
Fork 0

Ristrutturazione totale globale dell'arrayone portante

This commit is contained in:
pezcurrel 2020-01-12 07:14:48 +01:00
parent 1f0fd14058
commit a8a72189f2
2 changed files with 138 additions and 122 deletions

View file

@ -88,64 +88,77 @@ function booly($pre,$val,$nottoobad=false,$invcol=false) {
$dbg.='<pre>'.print_r($_POST,1).'</pre>';
function aske($key,&$arr) {
$count=count($arr);
$found=false;
$i=0;
while (!$found && $i<$count) {
if (array_key_exists($key,$arr[$i]))
$found=true;
else
$i++;
}
return($found);
}
$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'),
'Instances.New'=>array('field'=>'Instances.New','name'=>'Nuova','type'=>'bool'),
'Instances.Good'=>array('field'=>'Instances.Good','name'=>'Papabile','type'=>'bool'),
'Instances.Chosen'=>array('field'=>'Instances.Chosen','name'=>'Scelta','type'=>'bool'),
'Instances.Visible'=>array('field'=>'Instances.Visible','name'=>'Visibile','type'=>'bool'),
'Instances.Blacklisted'=>array('field'=>'Instances.Blacklisted','name'=>'Blacklistata','type'=>'bool'),
'Instances.URI'=>array('field'=>'Instances.URI','name'=>'URI','type'=>'text'),
'Instances.Title'=>array('field'=>'Instances.Title','name'=>'Titolo','type'=>'text'),
'Instances.ShortDesc'=>array('field'=>'Instances.ShortDesc','name'=>'Descrizione breve','type'=>'text'),
'Instances.LongDesc'=>array('field'=>'Instances.LongDesc','name'=>'Descrizione lunga','type'=>'text'),
'Instances.OurDesc'=>array('field'=>'Instances.OurDesc','name'=>'Descrizione nostra','type'=>'text'),
'PlaceID'=>array('name'=>'Località ⮞','type'=>'join','join'=>array(),'ord'=>false),
'Places.Locality'=>array('name'=>'Località','type'=>'joini','join'=>array('Places ON Places.ID=Instances.PlaceID'),'subtype'=>'text'),
'Instances.PlaceID'=>array('field'=>'Instances.PlaceID','name'=>'Località ⮞','type'=>'join','join'=>array(),'ord'=>false),
'Places.Locality'=>array('field'=>'Places.Locality','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','search'=>false,'ord'=>false),
'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 delladmin','type'=>'text','ord'=>false),
'AdmAvatar'=>array('name'=>'Avatar admin','type'=>'text','search'=>false,'ord'=>false),
'AdmNote'=>array('name'=>'Note delladmin','type'=>'text'),
'Instances.Email'=>array('field'=>'Instances.Email','name'=>'Email di contatto','type'=>'text'),
'Instances.Software'=>array('field'=>'Instances.Software','name'=>'Software','type'=>'text'),
'Instances.Version'=>array('field'=>'Instances.Version','name'=>'Versione','type'=>'text'),
'Instances.UserCount'=>array('field'=>'Instances.UserCount','name'=>'Utenti','type'=>'int'),
'Instances.StatusCount'=>array('field'=>'Instances.StatusCount','name'=>'Stati','type'=>'int'),
'Instances.DomainCount'=>array('field'=>'Instances.DomainCount','name'=>'Istanze note','type'=>'int'),
'Instances.ActiveUsersMonth'=>array('field'=>'Instances.ActiveUsersMonth','name'=>'Utenti attivi (mese)','type'=>'int'),
'Instances.ActiveUsersHalfYear'=>array('field'=>'Instances.ActiveUsersHalfYear','name'=>'Utenti attivi (6 mesi)','type'=>'int'),
'Instances.Thumb'=>array('field'=>'Instances.Thumb','name'=>'Logo','type'=>'text','search'=>false,'ord'=>false),
'Instances.RegOpen'=>array('field'=>'Instances.RegOpen','name'=>'Registrazioni aperte','type'=>'bool'),
'Instances.RegReqApproval'=>array('field'=>'Instances.RegReqApproval','name'=>'Approvazione registrazioni','type'=>'bool'),
'Instances.MaxTootChars'=>array('field'=>'Instances.MaxTootChars','name'=>'Limite caratteri','type'=>'int'),
'Instances.AdmAccount'=>array('field'=>'Instances.AdmAccount','name'=>'Account admin','type'=>'text'),
'Instances.AdmDisplayName'=>array('field'=>'Instances.AdmDisplayName','name'=>'Nome account admin','type'=>'text'),
'Instances.AdmCreatedAt'=>array('field'=>'Instances.AdmCreatedAt','name'=>'Data creazione account admin','type'=>'time'),
'Instances.AdmURL'=>array('field'=>'Instances.AdmURL','name'=>'Pagina delladmin','type'=>'text','search'=>false,'ord'=>false),
'Instances.AdmAvatar'=>array('field'=>'Instances.AdmAvatar','name'=>'Avatar admin','type'=>'text','search'=>false,'ord'=>false),
'Instances.AdmNote'=>array('field'=>'Instances.AdmNote','name'=>'Note delladmin','type'=>'text'),
'LangID'=>array('name'=>'Lingue dichiarate ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'ord'=>false),
'Languages.Code'=>array('name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','ord'=>false),
'InstLangs.LangID'=>array('name'=>'Lingua primaria dichiarata ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'wheremore'=>'AND InstLangs.Pos=1','ord'=>false),
'Languages.NameIT'=>array('name'=>'Lingua primaria dichiarata','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','wheremore'=>'AND InstLangs.Pos=1'),
'InstLangs.LangID'=>array('field'=>'InstLangs.LangID','name'=>'Lingue dichiarate ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'ord'=>false),
'Languages.NameIT'=>array('field'=>'Languages.NameIT','name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','ord'=>false),
'InstLangs.LangID.First'=>array('field'=>'InstLangs.LangID','name'=>'Lingua primaria dichiarata ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'wheremore'=>'AND InstLangs.Pos=1','ord'=>false),
'Languages.NameIT.First'=>array('field'=>'Languages.NameIT','name'=>'Lingua primaria dichiarata','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','wheremore'=>'AND InstLangs.Pos=1'),
'OurLangID'=>array('name'=>'Lingue impostate da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'ord'=>false),
'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','ord'=>false),
'InstOurLangs.OurLangID'=>array('name'=>'Lingua primaria impostata da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'wheremore'=>'AND InstOurLangs.Pos=1','ord'=>false),
'OurLanguages.NameIT'=>array('name'=>'Lingua primaria impostata da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text','wheremore'=>'AND InstOurLangs.Pos=1'),
'InstOurLangs.OurLangID'=>array('field'=>'InstOurLangs.OurLangID','name'=>'Lingue impostate da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'ord'=>false),
'OurLanguages.NameIT'=>array('field'=>'OurLanguages.NameIT','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','ord'=>false),
'InstOurLangs.OurLangID.First'=>array('field'=>'InstOurLangs.OurLangID','name'=>'Lingua primaria impostata da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'wheremore'=>'AND InstOurLangs.Pos=1','ord'=>false),
'OurLanguages.NameIT.First'=>array('field'=>'OurLanguages.NameIT','name'=>'Lingua primaria impostata da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text','wheremore'=>'AND InstOurLangs.Pos=1'),
'FinID'=>array('name'=>'Modalità di finanziamento ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'ord'=>false),
'Financing.Type'=>array('name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text'),
'InstFinancing.FinID'=>array('name'=>'Modalità di finanziamento primaria ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'wheremore'=>'AND InstFinancing.Pos=1','ord'=>false),
'XFinancing.Type'=>array('name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing AS XFinancing ON XFinancing.ID=InstFinancing.FinID'),'subtype'=>'text','wheremore'=>'AND InstFinancing.Pos=1'),
'InstFinancing.FinID'=>array('field'=>'InstFinancing.FinID','name'=>'Modalità di finanziamento ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'ord'=>false),
'Financing.Type'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text'),
'InstFinancing.FinID.First'=>array('field'=>'InstFinancing.FinID','name'=>'Modalità di finanziamento primaria ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'wheremore'=>'AND InstFinancing.Pos=1','ord'=>false),
'Financing.Type.First'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text','wheremore'=>'AND InstFinancing.Pos=1'),
'PolID'=>array('name'=>'Restrizioni sui contenuti ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'ord'=>false),
'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'),
'InstPolicies.PolID'=>array('name'=>'Restrizione sui contenuti primaria ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'wheremore'=>'AND InstPolicies.Pos=1','ord'=>false),
'XPolicies.Name'=>array('name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies AS XPolicies ON XPolicies.ID=InstPolicies.PolID'),'subtype'=>'text','wheremore'=>'AND InstPolicies.Pos=1'),
'InstPolicies.PolID'=>array('field'=>'InstPolicies.PolID','name'=>'Restrizioni sui contenuti ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'ord'=>false),
'Policies.Name'=>array('field'=>'Policies.Name','name'=>'Restrizioni sui contenuti','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text'),
'InstPolicies.PolID.First'=>array('field'=>'InstPolicies.PolID','name'=>'Restrizione sui contenuti primaria ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'wheremore'=>'AND InstPolicies.Pos=1','ord'=>false),
'Policies.Name.First'=>array('field'=>'Policies.Name','name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text','wheremore'=>'AND InstPolicies.Pos=1'),
'TagID'=>array('name'=>'Tags ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'ord'=>false),
'Tags.Name'=>array('name'=>'Tags','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text'),
'InstTags.TagID'=>array('name'=>'Tag primaria ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'wheremore'=>'AND InstTags.Pos=1','ord'=>false),
'XTags.Name'=>array('name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags AS XTags ON XTags.ID=InstTags.TagID'),'subtype'=>'text','wheremore'=>'AND InstTags.Pos=1'),
'InstTags.TagID'=>array('field'=>'InstTags.TagID','name'=>'Tags ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'ord'=>false),
'Tags.Name'=>array('field'=>'Tags.Name','name'=>'Tags','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text'),
'InstTags.TagID.First'=>array('field'=>'InstTags.TagID','name'=>'Tag primaria ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'wheremore'=>'AND InstTags.Pos=1','ord'=>false),
'Tags.Name.First'=>array('field'=>'Tags.Name','name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text','wheremore'=>'AND InstTags.Pos=1'),
/*'Statuses'=>array('name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','selmore'=>'MAX(Week) AS maxweek'),
'Logins'=>array('name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','selmore'=>'MAX(Week) AS maxweek'),
@ -156,76 +169,79 @@ $types=array('bool','int','time','text','join','joini');
$fieldselopts='';
$ordfieldselopts='';
foreach ($cols as $key=>$val) {
if (!array_key_exists('search',$val)) {
if ($val['type']=='joini') {
$fieldselopts.='<option value="'.$key.':'.$val['type'].':'.$val['subtype'].'">'.$val['name'].'</option>';
foreach ($cols as $key=>$arr) {
if (!array_key_exists('search',$arr) || $arr['search']==true) {
if ($arr['type']=='joini') {
$fieldselopts.='<option value="'.$key.':'.$arr['type'].':'.$arr['subtype'].'">'.$arr['name'].'</option>';
} else {
$fieldselopts.='<option value="'.$key.':'.$val['type'].':null">'.$val['name'].'</option>';
$fieldselopts.='<option value="'.$key.':'.$arr['type'].':null">'.$arr['name'].'</option>';
}
}
if (!array_key_exists('ord',$val)) {
if ($val['type']=='joini') {
$ordfieldselopts.='<option value="'.$key.':'.$val['type'].':'.$val['subtype'].'">'.$val['name'].'</option>';
if (!array_key_exists('ord',$arr) || $arr['ord']==true) {
if ($arr['type']=='joini') {
$ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':'.$arr['subtype'].'">'.$arr['name'].'</option>';
} else {
$ordfieldselopts.='<option value="'.$key.':'.$val['type'].':null">'.$val['name'].'</option>';
$ordfieldselopts.='<option value="'.$key.':'.$arr['type'].':null">'.$arr['name'].'</option>';
}
}
}
$pblocks=0;
foreach ($_POST as $key=>$val)
if (preg_match('/^openpar-\d+$/',$key)===1)
$pblocks++;
$i=0;
$jsaddrows='';
$jssetrows='';
$cp=count($_POST)/6; // /6 perché ogni "blocco" contiene 6 righe
$sels=array();
$joins=array();
$where='';
foreach ($_POST as $key=>$val) {
if (preg_match('/^openpar-\d+/',$key)===1) {
if (preg_match('/^openpar-\d+$/',$key)===1) {
$i++;
if (preg_match('/^\(+$/',$val)===1)
$where.=$val;
$jsaddrows.='addrow('.$i.',false);'.N;
$jssetrows.='setrow('.$i.','.json_encode($val);
}
if (preg_match('/^fieldsel-\d+/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) {
if (preg_match('/^fieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) {
$col=$buf[1];
$type=$buf[2];
$subtype=$buf[3];
if (array_key_exists($col,$cols) && in_array($type,$types)) {
if (array_key_exists('wheremore',$cols[$col]))
$where.='(';
$where.=$col;
$where.=$cols[$col]['field'];
if ($type=='join' || $type=='joini') {
foreach ($cols[$col]['join'] as $join) {
if (!in_array($join,$joins))
$joins[]=$join;
}
if (array_key_exists('selmore',$cols[$col]) && !in_array($cols[$col]['selmore'],$sels))
$sels[]=$cols[$col]['selmore'];
/* if (array_key_exists('selmore',$cols[$col]) && !in_array($cols[$col]['selmore'],$sels))
$sels[]=$cols[$col]['selmore'];*/
}
$jssetrows.=','.json_encode($val);
} else {
muoribene($dbg.'<br>Dati POST corrotti.<br>Puoi <a href="instances.php">riprovare</a> o <a href="index.php">tornare al login</a>.',true);
muoribene($dbg.'<br>Dati POST corrotti.<br>Puoi <a href="instances.php">riprovare resettando i parametri</a> o <a href="index.php">tornare al login</a>.',true);
}
}
if (preg_match('/^condsel-\d+/',$key)===1) {
if (preg_match('/^condsel-\d+$/',$key)===1) {
$where.=' '.$val.' ';
$cond=$val;
$jssetrows.=','.json_encode($val);
// nel caso qui sotto, valuesel e valueinp sono entrambi disabilitati (non ci sono in $_POST), quindi li riempio di introvabile e nulla
if (preg_match('/^(IS NULL|IS NOT NULL)$/',$val)===1)
if (preg_match('/^IS NULL|IS NOT NULL$/',$val)===1)
$jssetrows.=',"NOMMITROVI!",""';
}
if (preg_match('/^valuesel-\d+/',$key)===1) {
if (preg_match('/^valuesel-\d+$/',$key)===1) {
$where.=$val;
if (array_key_exists('wheremore',$cols[$col]))
$where.=' '.$cols[$col]['wheremore'].')';
$jssetrows.=','.json_encode($val);
$jssetrows.=',""';
}
if (preg_match('/^valueinp-\d+/',$key)===1) {
if (preg_match('/^(LIKE|NOT LIKE)$/',$cond)===1)
if (preg_match('/^valueinp-\d+$/',$key)===1) {
if (preg_match('/^LIKE|NOT LIKE$/',$cond)===1)
$where.='\'%'.myesc($link,$val).'%\'';
else
$where.='\''.myesc($link,$val).'\'';
@ -234,13 +250,13 @@ foreach ($_POST as $key=>$val) {
$jssetrows.=',"NOMMITROVIHODETTO!"';
$jssetrows.=','.json_encode($val);
}
if (preg_match('/^closepar-\d+/',$key)===1) {
if (preg_match('/^closepar-\d+$/',$key)===1) {
if (preg_match('/^\)+$/',$val)===1)
$where.=$val;
$jssetrows.=','.json_encode($val);
}
if (preg_match('/^andor-\d+/',$key)===1 && preg_match('/^(AND|OR)$/',$val)===1) {
if ($i<$cp)
if (preg_match('/^andor-\d+$/',$key)===1 && preg_match('/^AND|OR$/',$val)===1) {
if ($i<$pblocks)
$where.=' '.$val.' ';
$jssetrows.=','.json_encode($val).');'.N;
}
@ -277,13 +293,13 @@ if (mysqli_num_rows($res)<1) {
// $out.='<thead><tr><th class="tdattr">Attributi</th><th>Info</th></thead>'.N;
$out.='<tbody>'.N;
$out.='<tr><td colspan="2" class="insthead">'.$row['URI'].' {'.$row['IID'].'}</td></tr>'.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;*/
$attr=booly($cols['Instances.Blacklisted']['name'].': ',$row['Blacklisted'],false,true).N;
$attr.=booly($cols['Instances.New']['name'].': ',$row['New'],true).N;
$attr.=booly($cols['Instances.Good']['name'].': ',$row['Good']).N;
$attr.=booly($cols['Instances.Chosen']['name'].': ',$row['Chosen']).N;
$attr.=booly($cols['Instances.Visible']['name'].': ',$row['Visible']).N;
/* $attr.=booly($cols['Instances.RegOpen']['name'].': ',$row['RegOpen']).N;
$attr.=booly($cols['Instances.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);
@ -336,13 +352,13 @@ if (mysqli_num_rows($res)<1) {
$attr.='<div class="colsectcont nully">Non disponibili</div>'.N;
}
$out.='<tr><td class="tdattr">'.$attr.'</td><td>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['URI']['name'].':</span> <a href="https://'.$row['URI'].'" target="_blank">'.$row['URI'].'</a></div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Title']['name'].':</span> '.nully($row['Title'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Thumb']['name'].':</span> '.nully($row['Thumb'],true,'image').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['ShortDesc']['name'].':</span> '.nully($row['ShortDesc'],true,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['LongDesc']['name'].':</span> '.nully($row['LongDesc'],true,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.URI']['name'].':</span> <a href="https://'.$row['URI'].'" target="_blank">'.$row['URI'].'</a></div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.Title']['name'].':</span> '.nully($row['Title'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.Thumb']['name'].':</span> '.nully($row['Thumb'],true,'image').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.ShortDesc']['name'].':</span> '.nully($row['ShortDesc'],true,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.LongDesc']['name'].':</span> '.nully($row['LongDesc'],true,'strip').'</div>'.N;
// 'strip' o 'htmlent' per la descrizione nostra?
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurDesc']['name'].':</span> '.nully($row['OurDesc'],true,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['Instances.OurDesc']['name'].':</span> '.nully($row['OurDesc'],true,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['Places.Locality']['name'].':</span> ';
if (!is_null($row['PlaceID'])) {
$sres=mysqli_query($link,'SELECT * FROM Places WHERE Places.ID='.$row['PlaceID'])
@ -359,11 +375,11 @@ if (mysqli_num_rows($res)<1) {
$buf=array();
while ($srow=mysqli_fetch_assoc($sres)) {
$i++;
$buf[]=$i.': '.hspech($srow['Code'].' ['.ucfirst(locale_get_display_name($srow['Code'])).']');
$buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']');
}
$out.='<div class="baloo"><span class="field">'.$cols['Languages.Code']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Languages.NameIT']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else {
$out.='<div class="baloo"><span class="field">'.$cols['Languages.Code']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Languages.NameIT']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
}
$sres=mysqli_query($link,'SELECT * FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
or muoribene(mysqli_error($link),true);
@ -372,11 +388,11 @@ if (mysqli_num_rows($res)<1) {
$buf=array();
while ($srow=mysqli_fetch_assoc($sres)) {
$i++;
$buf[]=$i.': '.hspech($srow['Code'].' ['.ucfirst(locale_get_display_name($srow['Code'],'it')).']');
$buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']');
}
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.Code']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.NameIT']['name'].':</span> '.implode('; ',$buf).'</div>'.N;
} else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.Code']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
$out.='<div class="baloo"><span class="ourfield">'.$cols['OurLanguages.NameIT']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
}
$sres=mysqli_query($link,'SELECT * FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC')
or muoribene(mysqli_error($link),true);
@ -417,23 +433,23 @@ if (mysqli_num_rows($res)<1) {
} else {
$out.='<div class="baloo"><span class="ourfield">'.$cols['Tags.Name']['name'].':</span> <span class="nully">Non definite</span></div>'.N;
}
$out.='<div class="baloo"><span class="field">'.$cols['Email']['name'].':</span> '.nully($row['Email'],true,'email').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Software']['name'].':</span> '.nully($row['Software'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Version']['name'].':</span> '.nully($row['Version'],true,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['UserCount']['name'].':</span> '.nully($row['UserCount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['StatusCount']['name'].':</span> '.nully($row['StatusCount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['DomainCount']['name'].':</span> '.nully($row['DomainCount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['ActiveUsersMonth']['name'].':</span> '.nully($row['ActiveUsersMonth'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['ActiveUsersHalfYear']['name'].':</span> '.nully($row['ActiveUsersHalfYear'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['RegOpen']['name'].':</span> '.nully($row['RegOpen'],false,'boolt').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['RegReqApproval']['name'].':</span> '.nully($row['RegReqApproval'],false,'boolf').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['MaxTootChars']['name'].':</span> '.nully($row['MaxTootChars'],false,'strip','500').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['AdmAccount']['name'].':</span> '.nully($row['AdmAccount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['AdmDisplayName']['name'].':</span> '.nully($row['AdmDisplayName'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['AdmCreatedAt']['name'].':</span> '.nully($row['AdmCreatedAt'],true,'timestamp').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['AdmURL']['name'].':</span> '.nully($row['AdmURL'],true,'url').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['AdmAvatar']['name'].':</span> '.nully($row['AdmAvatar'],false,'image').'</div>'.N;
$out.='<div><span class="field">'.$cols['AdmNote']['name'].':</span> '.nully($row['AdmNote'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.Email']['name'].':</span> '.nully($row['Email'],true,'email').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.Software']['name'].':</span> '.nully($row['Software'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.Version']['name'].':</span> '.nully($row['Version'],true,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.UserCount']['name'].':</span> '.nully($row['UserCount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.StatusCount']['name'].':</span> '.nully($row['StatusCount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.DomainCount']['name'].':</span> '.nully($row['DomainCount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.ActiveUsersMonth']['name'].':</span> '.nully($row['ActiveUsersMonth'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.ActiveUsersHalfYear']['name'].':</span> '.nully($row['ActiveUsersHalfYear'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.RegOpen']['name'].':</span> '.nully($row['RegOpen'],false,'boolt').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.RegReqApproval']['name'].':</span> '.nully($row['RegReqApproval'],false,'boolf').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.MaxTootChars']['name'].':</span> '.nully($row['MaxTootChars'],false,'strip','500').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.AdmAccount']['name'].':</span> '.nully($row['AdmAccount'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.AdmDisplayName']['name'].':</span> '.nully($row['AdmDisplayName'],false,'strip').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.AdmCreatedAt']['name'].':</span> '.nully($row['AdmCreatedAt'],true,'timestamp').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.AdmURL']['name'].':</span> '.nully($row['AdmURL'],true,'url').'</div>'.N;
$out.='<div class="baloo"><span class="field">'.$cols['Instances.AdmAvatar']['name'].':</span> '.nully($row['AdmAvatar'],false,'image').'</div>'.N;
$out.='<div><span class="field">'.$cols['Instances.AdmNote']['name'].':</span> '.nully($row['AdmNote'],false,'strip').'</div>'.N;
$out.='</td></tr>'.N;
$out.='</tbody>'.N;
$out.='</table>'.N;
@ -816,7 +832,7 @@ function ckf() {
<?php echo($dbg); ?>
</div>
<form method="post" id="f">
<form method="post" id="f" onsubmit="ckf();">
<div id="plancia">
<table id="planciafil" class="planciatab">
<tr><td colspan="8"><input type="button" id="filbut" value="Aggiungi criteri di ricerca" class="ctrlbut" onclick="manfil();"></td></tr>

View file

@ -8,27 +8,27 @@ require('include/sessionstart.php');
$cols=array(
'PlaceID'=>array('select'=>'SELECT Places.ID AS Pid, CONCAT(Locality,\' (\',COUNT(Places.ID),\')\') AS Txt FROM Instances LEFT JOIN Places ON Places.ID=PlaceID WHERE PlaceID IS NOT NULL GROUP BY Pid ORDER BY Locality ASC','optcol'=>'Pid','txtcol'=>'Txt'),
'Instances.PlaceID'=>array('select'=>'SELECT Places.ID AS Pid, CONCAT(Locality,\' (\',COUNT(Places.ID),\')\') AS Txt FROM Instances LEFT JOIN Places ON Places.ID=PlaceID WHERE PlaceID IS NOT NULL GROUP BY Pid ORDER BY Locality ASC','optcol'=>'Pid','txtcol'=>'Txt'),
'LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'InstLangs.LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'InstLangs.LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID WHERE InstLangs.Pos=1 GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'InstLangs.LangID.First'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID WHERE InstLangs.Pos=1 GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'InstOurLangs.OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'InstOurLangs.OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstOurLangs.Pos=1 GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'InstOurLangs.OurLangID.First'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code, \' [\', NameIT, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstOurLangs.Pos=1 GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
'FinID'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID GROUP BY Financing.ID ORDER BY Type ASC','optcol'=>'Fid','txtcol'=>'Txt'),
'InstFinancing.FinID'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID GROUP BY Financing.ID ORDER BY Type ASC','optcol'=>'Fid','txtcol'=>'Txt'),
'InstFinancing.FinID'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstFinancing.Pos=1 GROUP BY Financing.ID ORDER BY Type ASC ','optcol'=>'Fid','txtcol'=>'Txt'),
'InstFinancing.FinID.First'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstFinancing.Pos=1 GROUP BY Financing.ID ORDER BY Type ASC ','optcol'=>'Fid','txtcol'=>'Txt'),
'PolID'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID GROUP BY Policies.ID ORDER BY Name ASC','optcol'=>'Pid','txtcol'=>'Txt'),
'InstPolicies.PolID'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID GROUP BY Policies.ID ORDER BY Name ASC','optcol'=>'Pid','txtcol'=>'Txt'),
'InstPolicies.PolID'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID WHERE InstPolicies.Pos=1 GROUP BY Policies.ID ORDER BY Name ASC','optcol'=>'Pid','txtcol'=>'Txt'),
'InstPolicies.PolID.First'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID WHERE InstPolicies.Pos=1 GROUP BY Policies.ID ORDER BY Name ASC','optcol'=>'Pid','txtcol'=>'Txt'),
'TagID'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
'InstTags.TagID'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
'InstTags.TagID'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID WHERE InstTags.Pos=1 GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
'InstTags.TagID.First'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID WHERE InstTags.Pos=1 GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
);
if (array_key_exists('key',$_GET) && array_key_exists($_GET['key'],$cols)) {