Browse Source

Modifichine varie

pezcurrel 4 years ago
parent
commit
d2975c46f8
8 changed files with 47 additions and 40 deletions
  1. 0 6
      crawler/crawler.ini
  2. 23 13
      crawler/crawler.php
  3. 2 1
      web/about_en.php
  4. 2 1
      web/about_it.php
  5. 0 1
      web/home_en.php
  6. 1 0
      web/home_it.php
  7. 15 15
      web/index.php
  8. 4 3
      web/theme.css

+ 0 - 6
crawler/crawler.ini

@@ -1,6 +0,0 @@
-excludeafter=2592000
-sistersfp=istanzesorelle
-dontloadbl=0
-timeout=5
-biglistfp=listona.json
-prodlistfp=listina.json

+ 23 - 13
crawler/crawler.php

@@ -95,14 +95,14 @@ if (file_exists($inifp)) {
 		echo('Attenzione: non ho potuto leggere la configurazione dal file "'.$inifp.'", potrebbe essere non leggibile o corrotto.'.N);
 	}
 }
-$f=@fopen($inifp,'w');
+/*$f=@fopen($inifp,'w');
 if ($f!==false) {
 	foreach ($opts as $key=>$val)
 		fwrite($f,$key.'='.$val.N);
 	fclose($f);
 } else {
 	echo('Attenzione: non ho potuto salvare la configurazione nel file "'.$inifp.'".'.N);
-}
+}*/
 
 for ($i=1; $i<$argc; $i++) {
 	if (substr($argv[$i],0,1)=='-') {
@@ -170,7 +170,7 @@ if ($buf!==false) {
 	echo('OK :-)'.N);
 	$buf=explode(N,$buf);
 	foreach ($buf as $val) {
-		if ($val!='' && $val{0}!='#') {
+		if ($val!='' && $val[0]!='#') {
 			$kv=explode('|',$val);
 			if ($kv[1]=='') $kv[1]=NULL;
 			$sisters[$kv[0]]=$kv[1];
@@ -223,6 +223,7 @@ foreach ($sisters as $dom=>$bluri) {
 	}
 }
 ksort($blinstances);
+echo(count($blinstances).' istanze bloccate.'.N);
 
 foreach ($sisters as $dom=>$bluri) {
 	echo('Recupero la lista delle istanze note a "'.$dom.'" ... ');
@@ -242,6 +243,7 @@ foreach ($sisters as $dom=>$bluri) {
 ksort($biglist);
 
 $prodlist=array();
+$newbiglist=array();
 $i=0;
 $qinst=count($biglist);
 foreach ($biglist as $dom=>$oinfo) {
@@ -250,20 +252,23 @@ foreach ($biglist as $dom=>$oinfo) {
 	if ($buf!==false) {
 		echo('OK :-)'.N);
 		$info=json_decode($buf,true);
-		$info['cr-last_checked']=time();
-		$info['cr-was_ok']=true;
-		$biglist[$dom]=$info;
-		if (!array_key_exists('registrations',$info) || $info['registrations']==true) {
+		if (!is_null($oinfo) && array_key_exists('cr-checks',$oinfo))
+			$info['cr-checks']=$oinfo['cr-checks'];
+		$info['cr-checks'][]=array('time'=>time(),'ok'=>true);
+		$newbiglist[$dom]=$info;
+		if (array_key_exists('registrations',$info) && $info['registrations']==true
+			&& array_key_exists('stats',$info) && array_key_exists('user_count',$info['stats'] && $info['stats']['user_count']>10 && $info['stats']['user_count']<=30000
+			&& array_key_exists('domain_count',$info['stats'] && $info['stats']['domain_count']>=500
+		) {
 			$prodlist[$dom]=$info;
 			echo('"'.$dom.'" aggiunta alla lista delle istanze ok! :-)'.N);
 		}
 	} else {
 		echo('ERRORE :-( ... ');
-		if (is_null($oinfo) || time()-$oinfo['cr-last_checked']<=$opts['excludeafter']) {
+		if (is_null($oinfo) || time()-$oinfo['cr-checks'][count($oinfo['cr-checks'])-1]['time']<=$opts['excludeafter']) {
 			echo('ma riproveremo...'.N);
-			$oinfo['cr-last_checked']=time();
-			$oinfo['cr-was_ok']=false;
-			$biglist[$dom]=$oinfo;
+			$oinfo['cr-checks'][]=array('time'=>time(),'ok'=>false);
+			$newbiglist[$dom]=$oinfo;
 		} else {
 			echo('e non riproveremo...'.N);
 		}
@@ -271,12 +276,17 @@ foreach ($biglist as $dom=>$oinfo) {
 	$i++;
 }
 
-$json=json_encode($biglist,JSON_PRETTY_PRINT);
+$json=json_encode($newbiglist,JSON_PRETTY_PRINT);
 file_put_contents($opts['biglistfp'],$json);
 $json=json_encode($prodlist,JSON_PRETTY_PRINT);
 file_put_contents($opts['prodlistfp'],$json);
 
-echo('Totale istanze nella listona: '.count($biglist).N);
+$diff=count($newbiglist)-count($biglist);
+if ($diff<0)
+	$diff='-'.$diff;
+else
+	$diff='+'.$diff;
+echo('Totale istanze nella listona: '.count($newbiglist).' ('.$diff.' rispetto all\'ultima volta)'.N);
 echo('Totale istanze nella listina di quelle occhei: '.count($prodlist).N);
 
 ?>

+ 2 - 1
web/about_en.php

@@ -3,6 +3,7 @@
 <div id="hmenu">
 <ul>
 <?php echo($menuout); ?>
+</ul>
 </div>
 </nav>
 <div class="scrwide">
@@ -13,7 +14,7 @@
 <p>Here are some contacts of those involved</p>
 <ul>
 <li>Ca_Gi: <a href="https://mastodon.bida.im/@Ca_Gi">@Ca_Gi@mastodon.bida.im</a></li>
-<li>Pongrèbio: <a href="https://mastodon.bida.im/@pongrebio">@pongrebio@mastodon.bida.im</a></li>
+<li>Pongrèbio: <a href="https://mastodon.bida.im/@pongrebio" style="letter-spacing:-0.3px;">@pongrebio@mastodon.bida.im</a></li>
 </ul>
 <p>Except where otherwise noted, content on this site is licensed under a <a href="https://creativecommons.org/licenses/by/4.0">Creative Commons Attribution 4.0 International license</a>.</p>
 </section>

+ 2 - 1
web/about_it.php

@@ -3,6 +3,7 @@
 <div id="hmenu">
 <ul>
 <?php echo($menuout); ?>
+</ul>
 </div>
 </nav>
 <div class="scrwide">
@@ -13,7 +14,7 @@
 <p>Ecco alcuni contatti</p>
 <ul>
 <li>Ca_Gi: <a href="https://mastodon.bida.im/@Ca_Gi">@Ca_Gi@mastodon.bida.im</a></li>
-<li>Pongrèbio: <a href="https://mastodon.bida.im/@pongrebio">@pongrebio@mastodon.bida.im</a></li>
+<li>Pongrèbio: <a href="https://mastodon.bida.im/@pongrebio" style="letter-spacing:-0.3px;">@pongrebio@mastodon.bida.im</a></li>
 </ul>
 <p>Eccetto dove diversamente specificato, i contenuti di questo sito sono rilasciati sotto <a href="https://creativecommons.org/licenses/by/4.0">Licenza Creative Commons Attribuzione 4.0 Internazionale</a>.</p>
 </section>

+ 0 - 1
web/home_en.php

@@ -1,7 +1,6 @@
 <body onscroll="scrolltrack()">
 <nav>
 <div id="hmenu">
-
 <ul>
 <?php echo($menuout); ?>
 </ul>

+ 1 - 0
web/home_it.php

@@ -3,6 +3,7 @@
 <div id="hmenu">
 <ul>
 <?php echo($menuout); ?>
+</ul>
 </div>
 </nav>
 <div class="scrwide">

+ 15 - 15
web/index.php

@@ -10,12 +10,12 @@ for ($i=0; $i<$ndir; $i++)
 	$prepath.='../';
 
 $menu=array(
-	'guide'=>array('lijs'=>null, 'href'=>$instpath, 'title'=>'Guide', 'selected'=>false, 'submenu'=>null),
-	'instances'=>array('lijs'=>null, 'href'=>$instpath.'/instances', 'title'=>'Instances', 'selected'=>false, 'submenu'=>null),
-	'about'=>array('lijs'=>null, 'href'=>$instpath.'/about', 'title'=>'About', 'selected'=>false, 'submenu'=>null),
-	'language'=>array('lijs'=>null, 'href'=>null, 'title'=>'Language', 'selected'=>false, 'submenu'=>array(
-			'inglese'=>array('lijs'=>'onclick=golang("en")', 'href'=>null, 'title'=>'English', 'selected'=>false, 'submenu'=>null),
-			'italiano'=>array('lijs'=>'onclick=golang("it")', 'href'=>null, 'title'=>'Italiano', 'selected'=>false, 'submenu'=>null)
+	'guide'=>array('liadd'=>null, 'href'=>$instpath, 'title'=>'Guide', 'selected'=>false, 'submenu'=>null),
+	'instances'=>array('liadd'=>null, 'href'=>$instpath.'/instances', 'title'=>'Instances', 'selected'=>false, 'submenu'=>null),
+	'about'=>array('liadd'=>null, 'href'=>$instpath.'/about', 'title'=>'About', 'selected'=>false, 'submenu'=>null),
+	'language'=>array('liadd'=>null, 'href'=>null, 'title'=>'Language', 'selected'=>false, 'submenu'=>array(
+			'inglese'=>array('liadd'=>'onclick="golang(\'en\')" onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'English', 'selected'=>false, 'submenu'=>null),
+			'italiano'=>array('liadd'=>'onclick="golang(\'it\')" onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'Italiano', 'selected'=>false, 'submenu'=>null)
 		)
 	)
 );
@@ -44,10 +44,10 @@ switch($path) {
 		'atit'=>' - Guide',
 		'js'=>array('shsum','guideanchors','scrolltrack')
 	);
-	$menu['guide']['lijs']='onclick="shsum()" onmouseover="this.style.cursor=\'pointer\'"';
+	$menu['guide']['liadd']='onclick="shsum()" onmouseover="this.style.cursor=\'pointer\'"';
 	$menu['guide']['href']=null;
 	$menu['guide']['selected']=true;
-	$menu['language']['submenu']['inglese']['lijs']=null;
+	$menu['language']['submenu']['inglese']['liadd']=null;
 	$menu['language']['submenu']['inglese']['selected']=true;
 	break;
 
@@ -59,10 +59,10 @@ switch($path) {
 		'js'=>array('shsum','guideanchors','scrolltrack')
 	);
 	tradmenu('it');
-	$menu['guide']['lijs']='onclick="shsum()" onmouseover="this.style.cursor=\'pointer\'"';
+	$menu['guide']['liadd']='onclick="shsum()" onmouseover="this.style.cursor=\'pointer\'"';
 	$menu['guide']['href']=null;
 	$menu['guide']['selected']=true;
-	$menu['language']['submenu']['italiano']['lijs']=null;
+	$menu['language']['submenu']['italiano']['liadd']=null;
 	$menu['language']['submenu']['italiano']['selected']=true;
 	break;
 
@@ -75,7 +75,7 @@ switch($path) {
 	);
 	$menu['instances']['href']=null;
 	$menu['instances']['selected']=true;
-	$menu['language']['submenu']['inglese']['lijs']=null;
+	$menu['language']['submenu']['inglese']['liadd']=null;
 	$menu['language']['submenu']['inglese']['selected']=true;
 	break;
 
@@ -89,7 +89,7 @@ switch($path) {
 	tradmenu('it');
 	$menu['instances']['href']=null;
 	$menu['instances']['selected']=true;
-	$menu['language']['submenu']['italiano']['lijs']=null;
+	$menu['language']['submenu']['italiano']['liadd']=null;
 	$menu['language']['submenu']['italiano']['selected']=true;
 	break;
 
@@ -102,7 +102,7 @@ switch($path) {
 	);
 	$menu['about']['href']=null;
 	$menu['about']['selected']=true;
-	$menu['language']['submenu']['inglese']['lijs']=null;
+	$menu['language']['submenu']['inglese']['liadd']=null;
 	$menu['language']['submenu']['inglese']['selected']=true;
 	break;
 
@@ -116,7 +116,7 @@ switch($path) {
 	tradmenu('it');
 	$menu['about']['href']=null;
 	$menu['about']['selected']=true;
-	$menu['language']['submenu']['italiano']['lijs']=null;
+	$menu['language']['submenu']['italiano']['liadd']=null;
 	$menu['language']['submenu']['italiano']['selected']=true;
 	break;
 
@@ -148,7 +148,7 @@ function buildmenu($menu) {
 	global $menuout;
 	foreach ($menu as $key=>$arr) {
 		$menuout.='<li';
-		if (!is_null($arr['lijs'])) $menuout.=' '.$arr['lijs'];
+		if (!is_null($arr['liadd'])) $menuout.=' '.$arr['liadd'];
 		if (!is_null($arr['submenu'])) $menuout.=' onmouseover="chulsh(this,true)" onmouseout="chulsh(this,false)"';
 		if ($arr['selected']) $menuout.=' class="hil"';
 		$menuout.='>';

+ 4 - 3
web/theme.css

@@ -92,7 +92,7 @@ section, #header {
 	font-weight: bold;
 }
 ul {
-	padding-left: 20pt;
+	padding-left: 15pt;
 }
 ul li {
 	padding-left: 0;
@@ -129,6 +129,7 @@ a:active {
 	height: 40px;
 	margin: 0;
 	padding: 0;
+	/*box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.4);*/
 	/*padding-left: 40px;*/
 	z-index: 2;
 	/*display: none;*/
@@ -149,7 +150,7 @@ a:active {
 }
 #hmenu ul li:hover {
 	background-color: rgba(255,255,255,0.10);
-	cursor: pointer;
+	cursor: default;
 }
 #hmenu .hil {
 	background-color: rgba(255,255,255,0.10);
@@ -286,7 +287,7 @@ a:active {
 	.sectcont {
 		padding: 20pt;
 	}
-	#content {
+	#content, .sectcont {
 		text-align: left;
 		-webkit-hyphens: none;
 		-ms-hyphens: none;