1
0
Fork 0
This commit is contained in:
pezcurrel 2020-01-11 00:51:02 +01:00
parent e0b182c8d7
commit 5d6d4d8fb7
6 changed files with 69 additions and 19 deletions

View file

@ -463,7 +463,12 @@ function langs($instid) {
$res=mysqli_query($link,'SELECT * FROM Languages WHERE Code=\''.myesc($link,$lang).'\'')
or mexit(mysqli_error($link).N,3);
if (mysqli_num_rows($res)<1) {
mysqli_query($link,'INSERT INTO Languages (ID, Code) VALUES (NULL, \''.myesc($link,truncs($lang,'Languages','Code','«'.$instrow['URI'].'»')).'\')')
$NameIt=myesc($link,truncs(ucfirst(locale_get_display_name($lang,'it')),'Languages','NameIT','«'.$instrow['URI'].'»'));
$NameEn=myesc($link,truncs(ucfirst(locale_get_display_name($lang,'en')),'Languages','NameEN','«'.$instrow['URI'].'»'));
$NameFr=myesc($link,truncs(ucfirst(locale_get_display_name($lang,'fr')),'Languages','NameFR','«'.$instrow['URI'].'»'));
$NameEs=myesc($link,truncs(ucfirst(locale_get_display_name($lang,'es')),'Languages','NameES','«'.$instrow['URI'].'»'));
$NameOrig=myesc($link,truncs(ucfirst(locale_get_display_name($lang,$lang)),'Languages','NameOrig','«'.$instrow['URI'].'»'));
mysqli_query($link,'INSERT INTO Languages (ID, Code, NameIT, NameEN, NameFR, NameES, NameOrig) VALUES (NULL, \''.myesc($link,truncs($lang,'Languages','Code','«'.$instrow['URI'].'»')).'\', \''.$NameIt.'\', \''.$NameEn.'\', \''.$NameFr.'\', \''.$NameEs.'\', \''.$NameOrig.'\')')
or mexit(mysqli_error($link).N,3);
$langid=mysqli_insert_id($link);
flushtronc($langid);
@ -642,7 +647,7 @@ while ($i<$cinsts) {
if (akeavinn('acct',$info['contact_account']))
$instrow['AdmAccount']=nempty(truncs($info['contact_account']['acct'],'Instances','AdmAccount','«'.$instrow['URI'].'»'));
if (akeavinn('display_name',$info['contact_account']))
$instrow['AdmDisplayName']=nempty(truncs($info['contact_account']['display_name'],'Instances','AdmAccount','«'.$instrow['URI'].'»'));
$instrow['AdmDisplayName']=nempty(truncs($info['contact_account']['display_name'],'Instances','AdmDisplayName','«'.$instrow['URI'].'»'));
if (akeavinn('created_at',$info['contact_account']))
$instrow['AdmCreatedAt']=pgdatetomy($info['contact_account']['created_at']);
if (akeavinn('note',$info['contact_account']))

View file

@ -2,11 +2,10 @@
session_name('mastostartadmin');
session_start();
if (!array_key_exists('id',$_SESSION)) {
if (!array_key_exists('AdmID',$_SESSION)) {
$_SESSION=array();
session_destroy();
// qui è ok usare muoribene perché per iframe viene caricato da muoribenepar.php
muoribene('Sessione scaduta.<br>Torna alla <a href="index.php">pagina di accesso</a>.',false);
muoribene('Sessione scaduta.<br>Puoi andare alla <a href="index.php">pagina di accesso</a>.',false);
}
?>

View file

@ -309,7 +309,7 @@ if (mysqli_num_rows($res)<1) {
$srow=mysqli_fetch_assoc($sres);
$attr.='<div class="colsectcont">Ultimo check '.strftime('%e %b %Y, %T',$srow['Time']).': '.(($srow['Status']) ? '<span class="good">OK</span>' : '<span class="bad">KO</span>').'</div>';
} else {
$attr.='<div class="colsectheader">Percentuale di risposta ai nostri check</div>';
$attr.='<div class="colsectheader">Percentuale di risposta ai nostri check</div>'.N;
$attr.='<div class="colsectcont nully">Non disponibile (?!?!?!)</div>'.N;
}
$attr.='<div class="colsectheader">Attività delle ultime 12 settimane</div>'.N;
@ -321,7 +321,7 @@ if (mysqli_num_rows($res)<1) {
if (mysqli_num_rows($sres)>0) {
$attr.='<div class="colsectcont">Stati: '.$tot['tstatuses'].'<br>Accessi: '.$tot['tlogins'].'<br>Registrazioni: '.$tot['tregs'].'</div>'.N;
while ($srow=mysqli_fetch_assoc($sres)) {
$attr.='<div class="colsectcontb">'.strftime('%e %b %Y',$srow['Week']).' ('.$srow['Week'].')</div>'.N;
$attr.='<div class="colsectcontb">'.strftime('%e %b %Y',$srow['Week']).'</div>'.N;
($tot['tstatuses']==0) ? $width=0 : $width=str_replace(',','.',100/$tot['tstatuses']*$srow['Statuses']);
$attr.='<div class="percstatuses" style="width:'.$width.'%;">'.$srow['Statuses'].'&nbsp;stati</div>'.N;
($tot['tlogins']==0) ? $width=0 : $width=str_replace(',','.',100/$tot['tlogins']*$srow['Logins']);
@ -457,6 +457,7 @@ mysqli_close($link);
<link rel="icon" type="image/png" href="imgs/icona-512.png" sizes="512x512">
<link rel="apple-touch-icon-precomposed" href="imgs/icona-180.png">
<script language="JavaScript" src="js/confirma.js?v=<?php echo($cjrand); ?>"></script>
<script language="JavaScript" src="js/alerta.js?v=<?php echo($cjrand); ?>"></script>
<link rel="stylesheet" type="text/css" href="theme.css?v=<?php echo($cjrand); ?>">
<script language="JavaScript">
<!--
@ -731,16 +732,55 @@ function manfil() {
confirma('Confermi di voler rimuovere tutti i criteri di ricerca?','truncfil();filbut.value=\'Aggiungi criteri di ricerca\'');
}
}
function ckf() {
function ckpar() {
var i=0;
var table=document.getElementById('planciafil');
var crows=table.rows.length;
document.getElementById('andor-'+(crows-1)).disabled=false;
document.getElementById('f').submit();
var nodes=table.querySelectorAll('.openpar');
var cnodes=nodes.length;
var opars=[];
var cpars=[];
for (i=0; i<cnodes; i++)
opars.push(nodes[i].value);
nodes=table.querySelectorAll('.closepar');
for (i=0; i<cnodes; i++)
cpars.push(nodes[i].value);
var spars='';
for (i=0; i<cnodes; i++) {
if (opars[i]!='null') spars+=opars[i];
if (cpars[i]!='null') spars+=cpars[i];
}
var opq=0, cpq=0, ok=true;
for (i=0; i<spars.length; i++) {
if (spars[i]=='(') {
opq++;
} else if (spars[i]==')') {
cpq++;
}
if (cpq>opq)
break;
}
if (opq!=cpq)
ok=false;
console.log(i+'/'+spars.length+': '+ok);
return ok;
}
function ckf() {
var emsg='';
if (!ckpar()) emsg+='Qualcosa non va con le parentesi!<br>\n';
emsg+='Comunque NO!<br>\n';
if (emsg=='') {
var table=document.getElementById('planciafil');
var crows=table.rows.length;
document.getElementById('andor-'+(crows-1)).disabled=false;
document.getElementById('f').submit();
} else {
alerta(emsg);
}
}
//-->
</script>
</head>
<body onload="console.log('body bu!');">
<body>
<nav>
<div id="hmenu">

View file

@ -1,13 +1,15 @@
<?php
header('Content-Type: application/json; charset=utf-8');
require('include/glob.php');
require('include/muoribene.php');
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 ORDER BY Locality ASC','optcol'=>'Pid','txtcol'=>'Txt'),
'LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',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'),
'OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',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'),
'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'),
'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'),
'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'),
'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'),
'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'),

View file

@ -29,7 +29,7 @@ if (mysqli_num_rows($res)<1 || !password_verify($_POST['password'],$row['Passwor
session_name('mastostartadmin');
session_start();
$_SESSION['id']=$row['ID'];
$_SESSION['AdmID']=$row['ID'];
header('Location: instances.php');

View file

@ -1,9 +1,9 @@
-- phpMyAdmin SQL Dump
-- version 5.0.0
-- version 5.0.1
-- https://www.phpmyadmin.net/
--
-- Host: localhost
-- Creato il: Gen 08, 2020 alle 14:46
-- Creato il: Gen 11, 2020 alle 00:49
-- Versione del server: 10.4.11-MariaDB
-- Versione PHP: 7.4.1
@ -213,7 +213,12 @@ CREATE TABLE `InstTrends` (
CREATE TABLE `Languages` (
`ID` int(11) UNSIGNED NOT NULL,
`Code` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL
`Code` varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL,
`NameIT` varchar(48) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`NameEN` varchar(48) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`NameFR` varchar(48) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`NameES` varchar(48) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`NameOrig` varchar(48) COLLATE utf8mb4_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- --------------------------------------------------------
@ -467,4 +472,3 @@ COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;