Index: trunk/admin/aggiornadb.php
===================================================================
--- trunk/admin/aggiornadb.php	(revision 370)
+++ trunk/admin/aggiornadb.php	(revision 371)
@@ -102,7 +102,9 @@
 if(controllo($prefix.'_authors','admincomune',++$num))
 {
-	$sql="update `".$prefix."_authors` set admincomune='1' where aid='admin'";
-	$ret=aggiorna($sql,$dbi,'',$num);
-	$sql="update `".$prefix."_authors` set admincomune='0' where aid!='admin'";
+	$sql="UPDATE `soraldo_authors` SET `adminop` = '1', `adminsuper` = '0',`admincomune` = '0' WHERE `soraldo_authors`.`aid` != 'admin' AND `soraldo_authors`.`aid` != 'suser'";
+	$ret=aggiorna($sql,$dbi,'',$num);
+	$sql="UPDATE `soraldo_authors` SET `adminop` = '0', `adminsuper` = '1',`admincomune` = '0' WHERE `soraldo_authors`.`aid` = 'suser'";
+	$ret=aggiorna($sql,$dbi,'',$num);
+	$sql="UPDATE `soraldo_authors` SET `adminop` = '0', `adminsuper` = '0',`admincomune` = '1' WHERE `soraldo_authors`.`aid` = 'admin'";
 	$ret=aggiorna($sql,$dbi,'',$num);
 	echo "<br> La tabella dei permessi Ãš stata aggiornata<br>";
@@ -128,4 +130,16 @@
 	echo "<br>";
 }	
+++$num;
+$sql="ALTER TABLE `soraldo_ele_come` CHANGE `title` `title` VARCHAR(150) NOT NULL DEFAULT ' ', CHANGE `preamble` `preamble` TEXT NOT NULL DEFAULT ' ', CHANGE `content` `content` TEXT NOT NULL DEFAULT ' ', CHANGE `editimage` `editimage` VARCHAR(100) NOT NULL DEFAULT ' '"; 
+$ret=aggiorna($sql,$dbi,'',$num);
+echo "<br>";
+++$num;
+$sql="ALTER TABLE `soraldo_ele_link` CHANGE `title` `title` VARCHAR(150) NOT NULL DEFAULT ' ', CHANGE `preamble` `preamble` TEXT NOT NULL DEFAULT ' ', CHANGE `content` `content` TEXT NOT NULL DEFAULT ' ', CHANGE `editimage` `editimage` VARCHAR(100) NOT NULL DEFAULT ' '"; 
+$ret=aggiorna($sql,$dbi,'',$num);
+echo "<br>";
+++$num;
+$sql="ALTER TABLE `soraldo_ele_servizi` CHANGE `title` `title` VARCHAR(150) NOT NULL DEFAULT ' ', CHANGE `preamble` `preamble` TEXT NOT NULL DEFAULT ' ', CHANGE `content` `content` TEXT NOT NULL DEFAULT ' ', CHANGE `editimage` `editimage` VARCHAR(100) NOT NULL DEFAULT ' '"; 
+$ret=aggiorna($sql,$dbi,'',$num);
+echo "<br>";
 
 if(controllo($prefix.'_ele_rilaff','data',++$num))
Index: trunk/admin/modules/Elezioni/ele_controlli.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_controlli.php	(revision 370)
+++ trunk/admin/modules/Elezioni/ele_controlli.php	(revision 371)
@@ -383,5 +383,5 @@
 						$totsl+=$svl;
 						$tnl+=$nl;
-						if(($votig+$svl)<($votil+$svg+$nl) and $disg)
+						if(($votig+$svl)<($votil+$svg+$nl) and ($solog or $disg))
 						{ $err=1; $tipo='lista'; break; }
 					}				
Index: trunk/admin/modules/Elezioni/ele_sede.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_sede.php	(revision 370)
+++ trunk/admin/modules/Elezioni/ele_sede.php	(revision 371)
@@ -45,4 +45,5 @@
 if (isset($param['filemappa'])) $filemappa=addslashes($param['filemappa']); else $filemappa='';
 if (isset($param['mappa'])) $mappa=addslashes($param['mappa']); else $mappa='';
+if (isset($param['delmap'])) $delmap=addslashes($param['delmap']);
 
 
@@ -59,5 +60,5 @@
 
 function all() {
-   global $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min,$id_cons,$id_cons_gen,$do,$id_sede,$id_circ;
+   global $bgcolor1, $bgcolor2, $prefix, $dbi, $offset, $min,$id_cons,$id_cons_gen,$do,$id_sede,$id_circ,$delmap;
 
    echo "<center><font class=\"title\"><br><b>"._SEDE."</b></font><br><br>";
@@ -68,6 +69,9 @@
 	."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._CIRCO."</b></td>"
 	."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._INDIRIZZO."</b></td>"
-	."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._MAPPA."</b></td>"
-	."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._TEL."</b></td>"
+	."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._MAPPA."</b>";
+	if ($do=='modify')
+		echo "<br><input type=\"checkbox\" name=\"delmap\" value=\"false\"> "._DELETE;
+	echo "</td>";	
+	echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._TEL."</b></td>"
 	."<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FAX."</b></td>"
 	."<td bgcolor=\"$bgcolor1\" align=\"center\">&nbsp;<b>"._RESP."</b>&nbsp;</td>"
@@ -184,5 +188,5 @@
 
 function sede($ok, $do,$id_circ, $id_sede,$indir, $tel1, $tel2, $fax, $resp, $mappa, $filemappa, $id_sede2) {
-global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons,$id_cons_gen,$id_comune;
+global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons, $id_cons,$id_cons_gen,$id_comune,$delmap;
 $perms=ChiSei(0);
 
@@ -253,6 +257,8 @@
 				$mappanome=addslashes($nomemappa);
 				$cond=", mappa='$mappablob', filemappa='$mappanome'";
-			} else {$cond='';}
-        	
+			} else {
+					if ( $delmap=='false') {$cond=", mappa='', filemappa=''";}
+					else $cond='';
+			}       	
 			$sql="update  ".$prefix."_ele_sede set    id_circ='$id_circ',indirizzo='$indir' , telefono1='$tel1', telefono2='$tel2',fax='$fax',responsabile='$resp' $cond where id_sede='$id_sede2' ";
 			$res = $dbi->prepare("$sql");
Index: trunk/admin/modules/Elezioni/ele_spoglio.php
===================================================================
--- trunk/admin/modules/Elezioni/ele_spoglio.php	(revision 370)
+++ trunk/admin/modules/Elezioni/ele_spoglio.php	(revision 371)
@@ -164,5 +164,5 @@
 		."<input type=\"hidden\" name=\"id_gruppo\" value=\"$id_gruppo\"/>";
 		$riga[$y].= "</span>";
-		if (chisei($id_cons_gen)>=64 and ($y==$numril and $voti_t!='')) { $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"/></span>";}
+		if (chisei($id_cons_gen)>=64 and $y==$numril) { $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\">"._DELETE." <input type=\"checkbox\" name=\"delete\" value=\"true\"/></span>";}
 		else $riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"hidden\" name=\"delete\" value=\"\"/></span>";
 		$riga[$y].= "<span class=\"td\" style=\"text-align: right;\" rowspan=\"1\" colspan=\"6\"><input type=\"submit\" name=\"update\" value=\""._OK."\"/></span>";
Index: trunk/admin/versione.php
===================================================================
--- trunk/admin/versione.php	(revision 370)
+++ trunk/admin/versione.php	(revision 371)
@@ -1,7 +1,7 @@
 <?php
 
-$versione = "3.0 rev 370";
+$versione = "3.0 rev 371";
 $version_number = $versione;
-$datarel = "01 giugno 2022";
+$datarel = "03 settembre 2022";
 $version = "Eleonline $version_number (<i>Data Release: $datarel</i>)";
 
Index: trunk/client/modules/Elezioni/affluenze.php
===================================================================
--- trunk/client/modules/Elezioni/affluenze.php	(revision 370)
+++ trunk/client/modules/Elezioni/affluenze.php	(revision 371)
@@ -224,7 +224,7 @@
 #		if(($data==$ultdata) and ($ora==$ultora))
 		{
-			$tot[$data.$ora]="<table class=\"td-89\"><tr class=\"bggray2\"><td class=\"td-30\">
-			<b>".number_format($votiu,0,',','.')."</b></td><td class=\"td-30\">
-			<b>".number_format($votid,0,',','.')."</b></td><td>
+			$tot[$data.$ora]="<table style=\"width:180px;\"><tr class=\"bggray2\"><td style=\"width:33%;text-align:center;\">
+			<b>".number_format($votiu,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
+			<b>".number_format($votid,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
 			<b>".number_format($somma,0,',','.')."</b></td>
 			</tr></table>";
@@ -243,5 +243,5 @@
 		$ora_ril=$hour.":".$minute;
 		$html .= "<td"; 
-		if ($ud==$num_ril and ($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) {$ora_rif="$data1.$ora1";}
+		if ($ud==$num_ril and (isset($perc_u[$data1.$ora1]) or isset($perc_d[$data1.$ora1]))) {$ora_rif="$data1.$ora1";}
 		$html .= ">";
 		$data_a=form_data($data1);
@@ -253,5 +253,5 @@
 		$html .= "<br />"._SEZIONI." $num_scr "._SU." $num_sez";
 ##		if ($ud==$num_ril and ($perc_u or $perc_d)) $html .= "<br />
-		if (($perc_u[$data1.$ora1] or $perc_d[$data1.$ora1])) $html .= "<br />
+		if (isset($perc_u[$data1.$ora1]) or isset($perc_d[$data1.$ora1])) $html .= "<br />
 		
 		<table style=\"width:180px;\"><tr class=\"bggray\">
@@ -366,4 +366,7 @@
 	header ("Content-Type: application/vnd.ms-excel");
 	header ("Content-Disposition: inline; filename=$nomefile");
+	header("Pragma: no-cache");
+	header("Expires: 0");
+	$datipdf = mb_convert_encoding($datipdf , "HTML-ENTITIES", "UTF-8");
 	echo "$datipdf";
 	echo "$html \t\n $style";
Index: trunk/client/modules/Elezioni/affluenzephp5.php
===================================================================
--- trunk/client/modules/Elezioni/affluenzephp5.php	(revision 370)
+++ trunk/client/modules/Elezioni/affluenzephp5.php	(revision 371)
@@ -221,7 +221,7 @@
 #		if(($data==$ultdata) and ($ora==$ultora))
 		{
-			$tot[$data.$ora]="<table class=\"td-89\" width=\"100%\"><tr class=\"bggray2\"><td class=\"td-30\">
-			<b>".number_format($votiu,0,',','.')."</b></td><td class=\"td-30\">
-			<b>".number_format($votid,0,',','.')."</b></td><td>
+			$tot[$data.$ora]="<table style=\"width:180px;\"><tr class=\"bggray2\"><td style=\"width:33%;text-align:center;\">
+			<b>".number_format($votiu,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
+			<b>".number_format($votid,0,',','.')."</b></td><td style=\"width:33%;text-align:center;\">
 			<b>".number_format($somma,0,',','.')."</b></td>
 			</tr></table>";
@@ -363,4 +363,7 @@
 	header ("Content-Type: application/vnd.ms-excel");
 	header ("Content-Disposition: inline; filename=$nomefile");
+	header("Pragma: no-cache");
+	header("Expires: 0");
+	$datipdf = mb_convert_encoding($datipdf , "HTML-ENTITIES", "UTF-8");
 	echo "$datipdf";
 	echo "$html \t\n $style";
Index: trunk/client/modules/Elezioni/blocchi/00_affluenze.php
===================================================================
--- trunk/client/modules/Elezioni/blocchi/00_affluenze.php	(revision 370)
+++ trunk/client/modules/Elezioni/blocchi/00_affluenze.php	(revision 371)
@@ -24,10 +24,10 @@
 	
 // barre
-    $l_size = getimagesize("modules/Elezioni/images/barre/leftbar.gif");
-    $m_size = getimagesize("modules/Elezioni/images/barre/mainbar.gif");
-    $r_size = getimagesize("modules/Elezioni/images/barre/rightbar.gif");
-    $l_size2 = getimagesize("modules/Elezioni/images/barre/leftbar2.gif");
-    $m_size2 = getimagesize("modules/Elezioni/images/barre/mainbar2.gif");
-    $r_size2 = getimagesize("modules/Elezioni/images/barre/rightbar2.gif");
+    $l_size = getimagesize("modules/Elezioni/images/barre/leftbar.jpg");
+    $m_size = getimagesize("modules/Elezioni/images/barre/mainbar.jpg");
+    $r_size = getimagesize("modules/Elezioni/images/barre/rightbar.jpg");
+    $l_size2 = getimagesize("modules/Elezioni/images/barre/leftbar2.jpg");
+    $m_size2 = getimagesize("modules/Elezioni/images/barre/mainbar2.jpg");
+    $r_size2 = getimagesize("modules/Elezioni/images/barre/rightbar2.jpg");
                                                                                                                            
 #    $res = mysql_query("select orario,data  from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' order  by data desc,orario DESC limit 1", $dbi);
@@ -75,4 +75,5 @@
                                                                                                                              
                 while(list($voti_t, $num_gruppo,$id_gruppo) = $res1->fetch(PDO::FETCH_NUM)) {
+					if(!$id_gruppo) $id_gruppo=0;
 //  		$res1 = mysql_query(,$dbi);
 //                	$query="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where orario='$orario' and data='$data' and id_cons='$id_cons'";
@@ -109,10 +110,10 @@
                                                                                                                              
         	echo "<table><tr><td><table><tr><td>&nbsp;</td><td>
-<img src=\"modules/Elezioni/images/barre/leftbar2.gif\" height=\"$l_size2[1]\" width=\"$l_size2[0]\" alt=\"\" /><img src=\"modules/Elezioni/images/barre/mainbar2.gif\" alt=\"\" height=\"$m_size2[1]\" width=\"". ($perc * 1)."\" /><img src=\"modules/Elezioni/images/barre/rightbar2.gif\" height=\"$r_size2[1]\" width=\"$r_size2[0]\" alt=\"\" /><span class=\"red\"> $perc</span> % <br /></td></tr>\n";
+<img src=\"modules/Elezioni/images/barre/leftbar2.jpg\" height=\"$l_size2[1]\" width=\"$l_size2[0]\" alt=\"\" /><img src=\"modules/Elezioni/images/barre/mainbar2.jpg\" alt=\"\" height=\"$m_size2[1]\" width=\"". ($perc * 1)."\" /><img src=\"modules/Elezioni/images/barre/rightbar2.jpg\" height=\"$r_size2[1]\" width=\"$r_size2[0]\" alt=\"\" /><span class=\"red\"> $perc</span> % <br /></td></tr>\n";
 		
 		$tot_gen=$tot;
 
 
-		echo  "<tr><td></td><td><img src=\"modules/Elezioni/images/barre/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" alt=\"\" /><img src=\"modules/Elezioni/images/barre/mainbar.gif\" alt=\"\" height=\"$m_size[1]\" width=\"".(100 * 1)."\" /><img src=\"modules/Elezioni/images/barre/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" alt=\"\" /> 100 % </td></tr></table>";
+		echo  "<tr><td></td><td><img src=\"modules/Elezioni/images/barre/leftbar.jpg\" height=\"$l_size[1]\" width=\"$l_size[0]\" alt=\"\" /><img src=\"modules/Elezioni/images/barre/mainbar.jpg\" alt=\"\" height=\"$m_size[1]\" width=\"".(100 * 1)."\" /><img src=\"modules/Elezioni/images/barre/rightbar.jpg\" height=\"$r_size[1]\" width=\"$r_size[0]\" alt=\"\" /> 100 % </td></tr></table>";
 		 echo "</td></tr></table>";
 		 
Index: trunk/client/modules/Elezioni/blocchi/cerca_candidato.php
===================================================================
--- trunk/client/modules/Elezioni/blocchi/cerca_candidato.php	(revision 370)
+++ trunk/client/modules/Elezioni/blocchi/cerca_candidato.php	(revision 371)
@@ -13,6 +13,6 @@
     die ("You can't access this file dirrectly...");
 }
-global $id_comune,$id_cons_gen,$op;
-
+global $id_comune,$id_cons_gen,$op,$genere;
+if($genere>0){
 # validatore form
 echo '
@@ -122,5 +122,5 @@
 echo $cerca_cand;
 $_SESSION['cerca_cand']='';
-
+}
 
 ?>
Index: trunk/client/modules/Elezioni/consiglieri.php
===================================================================
--- trunk/client/modules/Elezioni/consiglieri.php	(revision 370)
+++ trunk/client/modules/Elezioni/consiglieri.php	(revision 371)
@@ -610,5 +610,5 @@
 				$z=0;
 				$arvin[$x][$pos++]=$desliste[$lst]; 
-				$sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY descr order by voti desc,t1.num_cand";
+				$sql = "SELECT concat(substring(concat('0',t1.num_cand),-2),') ',t1.cognome,' ',substring(t1.nome from 1 for 1),'.') as descr,sum(t2.voti) as voti from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_voti_candidati as t2 where t1.id_lista='$id_lista' and t1.id_cand=t2.id_cand GROUP BY t1.num_cand,t1.cognome,t1.nome order by voti desc,t1.num_cand";
 				$res_can = $dbi->prepare("$sql");
 				$res_can->execute();
Index: trunk/client/modules/Elezioni/crea_pagina.php
===================================================================
--- trunk/client/modules/Elezioni/crea_pagina.php	(revision 370)
+++ trunk/client/modules/Elezioni/crea_pagina.php	(revision 371)
@@ -115,5 +115,5 @@
 
 
-		$y=1;$i='';$e='';
+		$y=1;$i='';$e=0;
 		foreach ($ar as $riga) {
 		$e++;
@@ -133,5 +133,5 @@
 
 			 if ($e==1){ 
-				$t="<td";$f="</td>";
+				$t="<td style='text-align:left;'";$f="</td>";
 			}else{ 
 				$t="<td";$f="</td>";	
Index: trunk/client/modules/Elezioni/crea_paginaphp5.php
===================================================================
--- trunk/client/modules/Elezioni/crea_paginaphp5.php	(revision 370)
+++ trunk/client/modules/Elezioni/crea_paginaphp5.php	(revision 371)
@@ -21,103 +21,66 @@
 
 function crea_tabella($ar) {
-
-
-global $prefix,$dbi,$pdf,$csv,$xls,$lang,$descr_cons,$prefix,$dbi,$id_comune,$descrizione,$siteistat,$min,$offset,$minsez,$offsetsez,$datipdf,$orienta,$formato;
-$sql="SELECT descrizione,simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
+	global $prefix,$dbi,$pdf,$csv,$xls,$lang,$descr_cons,$prefix,$dbi,$id_comune,$descrizione,$siteistat,$min,$offset,$minsez,$offsetsez,$datipdf,$orienta,$formato;
+	$sql="SELECT descrizione,simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
 	$res = $dbi->prepare("$sql");
 	$res->execute();
-
 	list($descr_com,$simbolo,$stemma) = $res->fetch(PDO::FETCH_NUM);
-
-
-
-$datipdf=stripslashes($datipdf);
-
-$data=date("d-m-y G:i");
-
-if ($xls==1) {
-
-	$nomefile=strip_tags(str_replace(array('"', "'", ' ', ','), "_", $datipdf).".xls");
-#	$nomefile=$_SESSION['nomefile'].".xls";
-	header ("Content-Type: application/vnd.ms-excel");
-	header ("Content-Disposition: inline; filename=$nomefile");
-
-$datipdf=str_replace("<br/>","\n",$datipdf);
-
-$datipdf=strip_tags($datipdf);
-//			$cella=str_replace("</b>"," ",$cella);
-//			$cella=str_replace("<br />"," ",$cella);
-			
-
-echo "$datipdf";
-
-	$y=1;$i='';$e='';
+	$datipdf=stripslashes($datipdf);
+	$data=date("d-m-y G:i");
+	if ($xls==1) {
+		$nomefile=strip_tags(str_replace(array('"', "'", ' ', ','), "_", $datipdf).".xls");
+		header ("Content-Type: application/vnd.ms-excel");
+		header ("Content-Disposition: inline; filename=$nomefile");
+		$datipdf=str_replace("<br/>","\n",$datipdf);
+		$datipdf=strip_tags($datipdf);
+		echo "$datipdf";
+		$y=1;$i='';$e=0;
 		foreach ($ar as $riga) {
-		$e++;
-                        if($y) {
+			$e++;
+            if($y) {
 				echo "\n";
 			}else{
-				
-				echo "\n";
-				
-			}
-
-			
+				echo "\n";				
+			}
 			foreach ($riga as $cella) {
-			$cella=str_replace("<b>"," ",$cella);
-			$cella=str_replace("</b>"," ",$cella);
-			$cella=str_replace("<br>"," ",$cella);
-			$cella=str_replace("<br />"," ",$cella);
-			$cella=str_replace("<span class=\"red\"><i>"," - ",$cella);
-			$cella=str_replace("<span class=\"red\" style=\"font-size:80%;\"><i>"," - ",$cella);
-			$cella=str_replace("</span>%</i>","%",$cella);
-			$cella=str_replace("</i></span>","",$cella);
-			$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
-			$cella=str_replace("_SEZIONI","Sezione ",$cella);
-			$cella=str_replace("_TOT","Totale",$cella);
-			$cella=str_replace("_COMPLESSIVO","Complessivo",$cella);
-			 			
-				echo "$cella \t";
-					
-				
-			}
-			if ($y) $y=0;
-			
-		}
-
-	    echo"\n\n\nPowered by Eleonline http://www.eleonline.it \t \n";	
-	    echo"by luciano apolito & roberto gigli - stampato: $data \t \n";
-	    die();
-
-}else{
-
-  
-
-	$bg='bgw';
-	
-	$tmpbg='bggray2'; 
-	$tmpbg1='bgw';
-	$tmpbg2='bggray';
-	$tmpbg3='bggray2';
-	
-	$html ='';
-	if ($pdf!="1" && $csv=="1")
-	{
-	
-	$html .="<center><table><tr><td>
-		<img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" align=\"left\" alt=\"logo\" /> ";
-	$html .= "</td><td>$datipdf</td></td></table>";
+				$cella=str_replace("<b>"," ",$cella);
+				$cella=str_replace("</b>"," ",$cella);
+				$cella=str_replace("<br>"," ",$cella);
+				$cella=str_replace("<br />"," ",$cella);
+				$cella=str_replace("<span class=\"red\"><i>"," - ",$cella);
+				$cella=str_replace("<span class=\"red\" style=\"font-size:80%;\"><i>"," - ",$cella);
+				$cella=str_replace("</span>%</i>","%",$cella);
+				$cella=str_replace("</i></span>","",$cella);
+				$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
+				$cella=str_replace("_SEZIONI","Sezione ",$cella);
+				$cella=str_replace("_TOT","Totale",$cella);
+				$cella=str_replace("_COMPLESSIVO","Complessivo",$cella);
+				echo "$cella \t";				
+			}
+			if ($y) $y=0;			
+		}
+		echo"\n\n\nPowered by Eleonline http://www.eleonline.it \t \n";	
+		echo"by luciano apolito & roberto gigli - stampato: $data \t \n";
+		die();
+	}else{
+		$bg='bgw';	
+		$tmpbg='bggray2'; 
+		$tmpbg1='bgw';
+		$tmpbg2='bggray';
+		$tmpbg3='bggray2';	
+		$html ='';
+		if ($pdf!="1" && $csv=="1")
+		{		
+			$html .="<center><table><tr><td>
+			<img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" align=\"left\" alt=\"logo\" /> ";
+#			$html .= "</td><td>$datipdf";
+			$html .= "</td></tr></table>";
         }
-
-
-	
-	$html .= "<table class=\"table-docs\">";
-	
-
-
-
-		$y=1;$i='';$e='';
+		$html .= "<p style=\"text-align:center;\">$datipdf</p>";
+		$html .= "<table class=\"table-docs\">";
+		$y=1;$e=0;
 		foreach ($ar as $riga) {
-		$e++;
+			$e++;
+			$i=1;
 			if($y) {
 				$html .= "<tr class=\"bggray\">";
@@ -125,21 +88,21 @@
 				$bg= ($bg==$tmpbg) ? $tmpbg1:$tmpbg3;				  
 				$html .= "<tr class=\"$bg\">";
-				$i="class=\"td-150c\"";
 			}
 			foreach ($riga as $cella) {
-
-			$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
-			$cella=str_replace("_SEZIONI","Sezione ",$cella);
-			$cella=str_replace("_TOT","Totale",$cella);
-			$cella=str_replace("_COMPLESSIVO","",$cella);
-
-			 if ($e==1){ 
-				$t="<td";$f="</td>";
-			}else{ 
-				$t="<td";$f="</td>";	
-			}					
-				$html .= "$t $i>$cella $f";
-					$i="class=\"td-150b\"";
-				
+				if($cella) {
+					$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
+					$cella=str_replace("_SEZIONI","Sezione ",$cella);
+					$cella=str_replace("_TOT","Totale",$cella);
+					$cella=str_replace("_COMPLESSIVO","",$cella);
+				}
+				if ($e==1){ 
+					$t="<td";$f="</td>";
+				}elseif($i){ 
+					$t="<td style='text-align:left;'";$f="</td>";	
+				}else{ 
+					$t="<td";$f="</td>";	
+				}					
+				$html .= "$t >$cella $f";
+				$i=0;
 			}
 			if ($y) $y=0;
@@ -147,131 +110,113 @@
 		}
 		$html .= "</table>";
-
-
 		if ($pdf!="1" && $csv=="1"){
-		      $html .="<br/><span class=\"copy\"><i>Stampato: $data</i></span>";
-		      $html .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
-		      $html .="</center><br />";
+			$html .="<br/><span class=\"copy\"><i>Stampato: $data</i></span>";
+			$html .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
+			$html .="</center><br />";
 		}
 
 	    # inizio stampa a video o pdf
-
-
 		if ($pdf!='1'){
-		  echo $html;
-	        }else{
-
-		$style ="     
-		<style type=\"text/css\">
-		<!--
-		.table-docs {
-			font-size: 10px;
-			padding: 1px;
-			color: #000000;
-			/* margin: 4px 4px 40px;*/
-			border: solid  #666666;
-			text-align:center;
-		}
-		.bggray 	{
-			background: #d2d2d2; 
-			FONT-SIZE: 13px; 
-			FONT-FAMILY: Helvetica;
-			border: 1px;
-		}
-
-		.bggray2 	{
-			background: #EFEFEF; 
-			FONT-SIZE: 13px; 
-			FONT-FAMILY: Helvetica;
-			border: 1px;
-			}
-
-		bggray3 	{
-			background: #EFEFEF; 
-			FONT-SIZE: 10px; 
-			FONT-FAMILY:  Helvetica;
-			text-align: left
-			}
-
-		.bgw	{
-			background: #ffffff; 
-			FONT-SIZE: 13px; 
-			FONT-FAMILY: Helvetica;
-			border: 1px;
-	
-		}
-		.td-130 {
-			float: right;
-			margin: 0px 0 0 1px;
-			width: 130px;	
-			border: none;
-			background-color: #d2d2d2;
-			padding: 0px;
-	
-		}
-		.td-130c {
-			float: right;
-			text-align:left;
-			margin: 0px 0 0 1px;
-			width: 130px;	
-			border: none;
-			padding: 0px;
-		}		
-
-		td {
-		    border: .2px;
-		}
-		.red 	{
-			BACKGROUND: none; 
-			COLOR: #ff0000; 
-			FONT-SIZE: 12px; 
-			FONT-FAMILY:  Helvetica
-		}
-		.copy 	{
-			background: #d2d2d2; 
-			FONT-SIZE: 8px; 
-			FONT-FAMILY: Helvetica;
-			border: 1px;
-		}
-		.cen {
-		margin: 10px auto 0 auto; 
-		}
-		-->
-		</style>";
-
-
+			echo $html;
+	    }else{
+			$style ="     
+			<style type=\"text/css\">
+			<!--
+			.table-docs {
+				font-size: 12px;
+				text-align:center;
+				border: 1px;
+				border-color: black;
+				margin: auto;
+				border-collapse: collapse;
+			}
+			.bggray 	{
+				background: #d2d2d2; 
+				FONT-SIZE: 16px; 
+				FONT-FAMILY: Helvetica;
+				border: 1px;
+				border-spacing: 5px;
+			}
+
+			.bggray2 	{
+				background: #EFEFEF; 
+				FONT-SIZE: 13px; 
+				FONT-FAMILY: Helvetica;
+				text-align: center;
+				border-spacing: 5px;
+				}
+
+			bggray3 	{
+				background: #EFEFEF; 
+				FONT-SIZE: 10px; 
+				FONT-FAMILY:  Helvetica;
+				text-align: left
+				}
+
+			.bgw	{
+				background: #ffffff; 
+				FONT-SIZE: 13px; 
+				FONT-FAMILY: Helvetica;
+				border: 1px;
+				text-align: center;
+				border-spacing: 5px;		
+			}
+			.td-130 {
+				float: right;
+				margin: 0px 0 0 1px;
+				width: 130px;	
+				border: 1px;
+				background-color: #d2d2d2;
+				padding: 0px;
+			}
+			.td-130c {
+				float: right;
+				text-align:left;
+				margin: 0px 0px 0px 1px;
+				width: 130px;	
+				border: 1px;
+
+			}		
+
+			td {
+				border: 2px;
+			}
+			.red 	{
+				BACKGROUND: none; 
+				COLOR: #ff0000; 
+				FONT-SIZE: 12px; 
+				FONT-FAMILY:  Helvetica
+			}
+			.copy 	{
+				background: #d2d2d2; 
+				FONT-SIZE: 8px; 
+				FONT-FAMILY: Helvetica;
+				border: 1px;
+			}
+			.cen {
+			margin: 10px auto 0 auto; 
+			}
+			-->
+			</style>";
 			# salva sull'hardisk lo stemma del comune
 			$logo=verificasimbolo();
 			$immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
-
-
-		$style .="<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>$immagine</td> ";	
-	
-		$style .= "<td border=0>$datipdf</td></tr></table><br/><br/>";
-		$style .= "<table style=\"margin: auto;\"><tr><td>$html</td></tr></table>";
-		$style .= "<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>";
-
-		$data=date("d-m-y G:i");
-		$style .="<br/><span class=\"copy\"><i>Stampato il $data</i></span>";
-		$style .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
-		$style .="</td></tr></table>";
-		$nomefile=strip_tags($datipdf).".pdf";
-#		$nomefile=$_SESSION['nomefile'].".pdf";
-		$nomefile=str_replace(" ", "_",$nomefile);
-		// conversion HTML => PDF
-		//$nomefile="elezioni_tabelle.pdf";
-		//$orienta="P";
-		$html2pdf = new Html2Pdf($orienta,$formato, 'it');
-		$html2pdf->WriteHTML($style, isset($_GET['vuehtml']));
-		$html2pdf->Output($nomefile);
-
-
-
-	      }
-
-	
-
-
-   }
+			$style .="<table style=\"margin: auto;border-collapse: collapse;text-align: center;\"><tr><td border=0>$immagine</td></tr></table> ";	
+#			$style .= "<tr style=\"border-spacing: 25px;\"><td>$datipdf</td></tr></table><br/><br/>";
+			$style .= "<br/>".$html;
+#			$style .= "<table style=\"margin: auto;\"><tr><td>$html</td></tr></table>";
+			$style .= "<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>";
+			$data=date("d-m-y G:i");
+			$style .="<br/><span class=\"copy\"><i>Stampato il $data</i></span>";
+			$style .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
+			$style .="</td></tr></table>";
+			$nomefile=strip_tags($datipdf).".pdf";
+			$nomefile=str_replace(" ", "_",$nomefile);
+			// conversion HTML => PDF
+			$html2pdf = new Html2Pdf($orienta,$formato, 'it');
+			$html2pdf->WriteHTML($style, isset($_GET['vuehtml']));
+			$html2pdf->Output($nomefile);
+		}
+	}
 }
 
@@ -280,3 +225,4 @@
 
 
+
 ?>
Index: trunk/client/modules/Elezioni/crea_paginaphp7.php
===================================================================
--- trunk/client/modules/Elezioni/crea_paginaphp7.php	(revision 370)
+++ trunk/client/modules/Elezioni/crea_paginaphp7.php	(revision 371)
@@ -24,103 +24,66 @@
 
 function crea_tabella($ar) {
-
-
-global $prefix,$dbi,$pdf,$csv,$xls,$lang,$descr_cons,$prefix,$dbi,$id_comune,$descrizione,$siteistat,$min,$offset,$minsez,$offsetsez,$datipdf,$orienta,$formato;
-$sql="SELECT descrizione,simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
+	global $prefix,$dbi,$pdf,$csv,$xls,$lang,$descr_cons,$prefix,$dbi,$id_comune,$descrizione,$siteistat,$min,$offset,$minsez,$offsetsez,$datipdf,$orienta,$formato;
+	$sql="SELECT descrizione,simbolo,stemma FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
 	$res = $dbi->prepare("$sql");
 	$res->execute();
-
 	list($descr_com,$simbolo,$stemma) = $res->fetch(PDO::FETCH_NUM);
-
-
-
-$datipdf=stripslashes($datipdf);
-
-$data=date("d-m-y G:i");
-
-if ($xls==1) {
-
-	$nomefile=strip_tags(str_replace(array('"', "'", ' ', ','), "_", $datipdf).".xls");
-#	$nomefile=$_SESSION['nomefile'].".xls";
-	header ("Content-Type: application/vnd.ms-excel");
-	header ("Content-Disposition: inline; filename=$nomefile");
-
-$datipdf=str_replace("<br/>","\n",$datipdf);
-
-$datipdf=strip_tags($datipdf);
-//			$cella=str_replace("</b>"," ",$cella);
-//			$cella=str_replace("<br />"," ",$cella);
-			
-
-echo "$datipdf";
-
-	$y=1;$i='';$e='';
+	$datipdf=stripslashes($datipdf);
+	$data=date("d-m-y G:i");
+	if ($xls==1) {
+		$nomefile=strip_tags(str_replace(array('"', "'", ' ', ','), "_", $datipdf).".xls");
+		header ("Content-Type: application/vnd.ms-excel");
+		header ("Content-Disposition: inline; filename=$nomefile");
+		$datipdf=str_replace("<br/>","\n",$datipdf);
+		$datipdf=strip_tags($datipdf);
+		echo "$datipdf";
+		$y=1;$i='';$e=0;
 		foreach ($ar as $riga) {
-		$e++;
-                        if($y) {
+			$e++;
+            if($y) {
 				echo "\n";
 			}else{
-				
-				echo "\n";
-				
-			}
-
-			
+				echo "\n";				
+			}
 			foreach ($riga as $cella) {
-			$cella=str_replace("<b>"," ",$cella);
-			$cella=str_replace("</b>"," ",$cella);
-			$cella=str_replace("<br>"," ",$cella);
-			$cella=str_replace("<br />"," ",$cella);
-			$cella=str_replace("<span class=\"red\"><i>"," - ",$cella);
-			$cella=str_replace("<span class=\"red\" style=\"font-size:80%;\"><i>"," - ",$cella);
-			$cella=str_replace("</span>%</i>","%",$cella);
-			$cella=str_replace("</i></span>","",$cella);
-			$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
-			$cella=str_replace("_SEZIONI","Sezione ",$cella);
-			$cella=str_replace("_TOT","Totale",$cella);
-			$cella=str_replace("_COMPLESSIVO","Complessivo",$cella);
-			 			
-				echo "$cella \t";
-					
-				
-			}
-			if ($y) $y=0;
-			
-		}
-
-	    echo"\n\n\nPowered by Eleonline http://www.eleonline.it \t \n";	
-	    echo"by luciano apolito & roberto gigli - stampato: $data \t \n";
-	    die();
-
-}else{
-
-  
-
-	$bg='bgw';
-	
-	$tmpbg='bggray2'; 
-	$tmpbg1='bgw';
-	$tmpbg2='bggray';
-	$tmpbg3='bggray2';
-	
-	$html ='';
-	if ($pdf!="1" && $csv=="1")
-	{
-	
-	$html .="<center><table><tr><td>
-		<img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" align=\"left\" alt=\"logo\" /> ";
-	$html .= "</td><td>$datipdf</td></td></table>";
+				$cella=str_replace("<b>"," ",$cella);
+				$cella=str_replace("</b>"," ",$cella);
+				$cella=str_replace("<br>"," ",$cella);
+				$cella=str_replace("<br />"," ",$cella);
+				$cella=str_replace("<span class=\"red\"><i>"," - ",$cella);
+				$cella=str_replace("<span class=\"red\" style=\"font-size:80%;\"><i>"," - ",$cella);
+				$cella=str_replace("</span>%</i>","%",$cella);
+				$cella=str_replace("</i></span>","",$cella);
+				$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
+				$cella=str_replace("_SEZIONI","Sezione ",$cella);
+				$cella=str_replace("_TOT","Totale",$cella);
+				$cella=str_replace("_COMPLESSIVO","Complessivo",$cella);
+				echo "$cella \t";				
+			}
+			if ($y) $y=0;			
+		}
+		echo"\n\n\nPowered by Eleonline http://www.eleonline.it \t \n";	
+		echo"by luciano apolito & roberto gigli - stampato: $data \t \n";
+		die();
+	}else{
+		$bg='bgw';	
+		$tmpbg='bggray2'; 
+		$tmpbg1='bgw';
+		$tmpbg2='bggray';
+		$tmpbg3='bggray2';	
+		$html ='';
+		if ($pdf!="1" && $csv=="1")
+		{		
+			$html .="<center><table><tr><td>
+			<img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" align=\"left\" alt=\"logo\" /> ";
+#			$html .= "</td><td>$datipdf";
+			$html .= "</td></tr></table>";
         }
-
-
-	
-	$html .= "<table class=\"table-docs\">";
-	
-
-
-
-		$y=1;$i='';$e='';
+		$html .= "<p style=\"text-align:center;\">$datipdf</p>";
+		$html .= "<table class=\"table-docs\">";
+		$y=1;$e=0;
 		foreach ($ar as $riga) {
-		$e++;
+			$e++;
+			$i=1;
 			if($y) {
 				$html .= "<tr class=\"bggray\">";
@@ -128,21 +91,21 @@
 				$bg= ($bg==$tmpbg) ? $tmpbg1:$tmpbg3;				  
 				$html .= "<tr class=\"$bg\">";
-				$i="class=\"td-150c\"";
 			}
 			foreach ($riga as $cella) {
-
-			$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
-			$cella=str_replace("_SEZIONI","Sezione ",$cella);
-			$cella=str_replace("_TOT","Totale",$cella);
-			$cella=str_replace("_COMPLESSIVO","",$cella);
-
-			 if ($e==1){ 
-				$t="<td";$f="</td>";
-			}else{ 
-				$t="<td";$f="</td>";	
-			}					
-				$html .= "$t $i>$cella $f";
-					$i="class=\"td-150b\"";
-				
+				if($cella) {
+					$cella=str_replace("_CIRCOS","Circoscrizione ",$cella);
+					$cella=str_replace("_SEZIONI","Sezione ",$cella);
+					$cella=str_replace("_TOT","Totale",$cella);
+					$cella=str_replace("_COMPLESSIVO","",$cella);
+				}
+				if ($e==1){ 
+					$t="<td";$f="</td>";
+				}elseif($i){ 
+					$t="<td style='text-align:left;'";$f="</td>";	
+				}else{ 
+					$t="<td";$f="</td>";	
+				}					
+				$html .= "$t >$cella $f";
+				$i=0;
 			}
 			if ($y) $y=0;
@@ -150,131 +113,113 @@
 		}
 		$html .= "</table>";
-
-
 		if ($pdf!="1" && $csv=="1"){
-		      $html .="<br/><span class=\"copy\"><i>Stampato: $data</i></span>";
-		      $html .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
-		      $html .="</center><br />";
+			$html .="<br/><span class=\"copy\"><i>Stampato: $data</i></span>";
+			$html .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
+			$html .="</center><br />";
 		}
 
 	    # inizio stampa a video o pdf
-
-
 		if ($pdf!='1'){
-		  echo $html;
-	        }else{
-
-#			padding: 1px;
-#			border: solid  #666666;			border-color: black;	
-
-			/* margin: 4px 4px 40px;*/
-
-		$style ="     
-		<style type=\"text/css\">
-		<!--
-		.table-docs {
-			font-size: 10px;
-			text-align:center;
-			border: 1px;
-			border-color: black;
-		}
-		.bggray 	{
-			background: #d2d2d2; 
-			FONT-SIZE: 13px; 
-			FONT-FAMILY: Helvetica;
-		}
-
-		.bggray2 	{
-			background: #EFEFEF; 
-			FONT-SIZE: 13px; 
-			FONT-FAMILY: Helvetica;
-			}
-
-		bggray3 	{
-			background: #EFEFEF; 
-			FONT-SIZE: 10px; 
-			FONT-FAMILY:  Helvetica;
-			text-align: left
-			}
-
-		.bgw	{
-			background: #ffffff; 
-			FONT-SIZE: 13px; 
-			FONT-FAMILY: Helvetica;
-			border: 1px;
-	
-		}
-		.td-130 {
-			float: right;
-			margin: 0px 0 0 1px;
-			width: 130px;	
-			border: 1px;
-			background-color: #d2d2d2;
-			padding: 0px;
-		}
-		.td-130c {
-			float: right;
-			text-align:left;
-			margin: 0px 0px 0px 1px;
-			width: 130px;	
-			border: 1px;
-
-		}		
-
-		td {
-		    border: 2px;
-		}
-		.red 	{
-			BACKGROUND: none; 
-			COLOR: #ff0000; 
-			FONT-SIZE: 12px; 
-			FONT-FAMILY:  Helvetica
-		}
-		.copy 	{
-			background: #d2d2d2; 
-			FONT-SIZE: 8px; 
-			FONT-FAMILY: Helvetica;
-			border: 1px;
-		}
-		.cen {
-		margin: 10px auto 0 auto; 
-		}
-		-->
-		</style>";
-
-
+			echo $html;
+	    }else{
+			$style ="     
+			<style type=\"text/css\">
+			<!--
+			.table-docs {
+				font-size: 12px;
+				text-align:center;
+				border: 1px;
+				border-color: black;
+				margin: auto;
+				border-collapse: collapse;
+			}
+			.bggray 	{
+				background: #d2d2d2; 
+				FONT-SIZE: 16px; 
+				FONT-FAMILY: Helvetica;
+				border: 1px;
+				border-spacing: 5px;
+			}
+
+			.bggray2 	{
+				background: #EFEFEF; 
+				FONT-SIZE: 13px; 
+				FONT-FAMILY: Helvetica;
+				text-align: center;
+				border-spacing: 5px;
+				}
+
+			bggray3 	{
+				background: #EFEFEF; 
+				FONT-SIZE: 10px; 
+				FONT-FAMILY:  Helvetica;
+				text-align: left
+				}
+
+			.bgw	{
+				background: #ffffff; 
+				FONT-SIZE: 13px; 
+				FONT-FAMILY: Helvetica;
+				border: 1px;
+				text-align: center;
+				border-spacing: 5px;		
+			}
+			.td-130 {
+				float: right;
+				margin: 0px 0 0 1px;
+				width: 130px;	
+				border: 1px;
+				background-color: #d2d2d2;
+				padding: 0px;
+			}
+			.td-130c {
+				float: right;
+				text-align:left;
+				margin: 0px 0px 0px 1px;
+				width: 130px;	
+				border: 1px;
+
+			}		
+
+			td {
+				border: 2px;
+			}
+			.red 	{
+				BACKGROUND: none; 
+				COLOR: #ff0000; 
+				FONT-SIZE: 12px; 
+				FONT-FAMILY:  Helvetica
+			}
+			.copy 	{
+				background: #d2d2d2; 
+				FONT-SIZE: 8px; 
+				FONT-FAMILY: Helvetica;
+				border: 1px;
+			}
+			.cen {
+			margin: 10px auto 0 auto; 
+			}
+			-->
+			</style>";
 			# salva sull'hardisk lo stemma del comune
 			$logo=verificasimbolo();
 			$immagine= "<img src=\"modules/Elezioni/images/$logo\" alt=\"logo\" align=\"left\"/>";
-
-
-		$style .="<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>$immagine</td> ";	
-	
-		$style .= "<td border=0>$datipdf</td></tr></table><br/><br/>";
-		$style .= "<table style=\"margin: auto;\"><tr><td>$html</td></tr></table>";
-		$style .= "<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>";
-
-		$data=date("d-m-y G:i");
-		$style .="<br/><span class=\"copy\"><i>Stampato il $data</i></span>";
-		$style .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
-		$style .="</td></tr></table>";
-		$nomefile=strip_tags($datipdf).".pdf";
-#		$nomefile=$_SESSION['nomefile'].".pdf";
-		$nomefile=str_replace(" ", "_",$nomefile);
-		// conversion HTML => PDF
-		//$nomefile="elezioni_tabelle.pdf";
-		//$orienta="P";
-		$html2pdf = new Html2Pdf($orienta,$formato, 'it');
-		$html2pdf->WriteHTML($style, isset($_GET['vuehtml']));
-		$html2pdf->Output($nomefile);
-
-
-
-	      }
-
-	
-
-
-   }
+			$style .="<table style=\"margin: auto;border-collapse: collapse;text-align: center;\"><tr><td border=0>$immagine</td></tr></table> ";	
+#			$style .= "<tr style=\"border-spacing: 25px;\"><td>$datipdf</td></tr></table><br/><br/>";
+			$style .= "<br/>".$html;
+#			$style .= "<table style=\"margin: auto;\"><tr><td>$html</td></tr></table>";
+			$style .= "<table style=\"margin: auto;border-collapse: collapse;\"><tr><td border=0>";
+			$data=date("d-m-y G:i");
+			$style .="<br/><span class=\"copy\"><i>Stampato il $data</i></span>";
+			$style .="<br/><span class=\"copy\"><i>Eleonline by luciano apolito & roberto gigli - www.eleonline.it</i></span>";
+			$style .="</td></tr></table>";
+			$nomefile=strip_tags($datipdf).".pdf";
+			$nomefile=str_replace(" ", "_",$nomefile);
+			// conversion HTML => PDF
+			$html2pdf = new Html2Pdf($orienta,$formato, 'it');
+			$html2pdf->WriteHTML($style, isset($_GET['vuehtml']));
+			$html2pdf->Output($nomefile);
+		}
+	}
 }
 
Index: trunk/client/modules/Elezioni/grafici.php
===================================================================
--- trunk/client/modules/Elezioni/grafici.php	(revision 370)
+++ trunk/client/modules/Elezioni/grafici.php	(revision 371)
@@ -48,10 +48,10 @@
 	
 // barre
-    $l_size = getimagesize("modules/Elezioni/images/barre/leftbar.gif");
-    $m_size = getimagesize("modules/Elezioni/images/barre/mainbar.gif");
-    $r_size = getimagesize("modules/Elezioni/images/barre/rightbar.gif");
-    $l_size2 = getimagesize("modules/Elezioni/images/barre/leftbar2.gif");
-    $m_size2 = getimagesize("modules/Elezioni/images/barre/mainbar2.gif");
-    $r_size2 = getimagesize("modules/Elezioni/images/barre/rightbar2.gif");
+    $l_size = getimagesize("modules/Elezioni/images/barre/leftbar.jpg");
+    $m_size = getimagesize("modules/Elezioni/images/barre/mainbar.jpg");
+    $r_size = getimagesize("modules/Elezioni/images/barre/rightbar.jpg");
+    $l_size2 = getimagesize("modules/Elezioni/images/barre/leftbar2.jpg");
+    $m_size2 = getimagesize("modules/Elezioni/images/barre/mainbar2.jpg");
+    $r_size2 = getimagesize("modules/Elezioni/images/barre/rightbar2.jpg");
     // totali
 
@@ -98,7 +98,7 @@
 			echo "<td>$voti_t</td><td>$perc %</td><td>$numero</td></tr></table>";
  // barre
-			echo "<table><tr><td><table><tr><td>&nbsp;"._VOTANTI."       : </td><td><img src=\"modules/Elezioni/images/barre/leftbar2.gif\" height=\"$l_size2[1]\" width=\"$l_size2[0]\" alt=\"votanti\" /><img src=\"modules/Elezioni/images/barre/mainbar2.gif\" alt=\"votanti\" height=\"$m_size2[1]\" width=\"". ($perc * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar2.gif\" height=\"$r_size2[1]\" width=\"$r_size2[0]\" alt=\"votanti\" /><span class=\"red\"> $perc</span> % ($voti_t)<br /></td></tr>\n";
+			echo "<table><tr><td><table><tr><td>&nbsp;"._VOTANTI."       : </td><td><img src=\"modules/Elezioni/images/barre/leftbar2.jpg\" height=\"$l_size2[1]\" width=\"$l_size2[0]\" alt=\"votanti\" /><img src=\"modules/Elezioni/images/barre/mainbar2.jpg\" alt=\"votanti\" height=\"$m_size2[1]\" width=\"". ($perc * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar2.jpg\" height=\"$r_size2[1]\" width=\"$r_size2[0]\" alt=\"votanti\" /><span class=\"red\"> $perc</span> % ($voti_t)<br /></td></tr>\n";
 			$tot_gen=$tot;
-			echo  "<tr><td>&nbsp;"._AVENTI.": </td><td><img src=\"modules/Elezioni/images/barre/leftbar.gif\" height=\"$l_size[1]\" width=\"$l_size[0]\" alt=\"elettori\" /><img src=\"modules/Elezioni/images/barre/mainbar.gif\" alt=\"elettori\" height=\"$m_size[1]\" width=\"".(100 * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar.gif\" height=\"$r_size[1]\" width=\"$r_size[0]\" alt=\"elettori\" /> 100 % ($tot_gen)</td></tr></table>";
+			echo  "<tr><td>&nbsp;"._AVENTI.": </td><td><img src=\"modules/Elezioni/images/barre/leftbar.jpg\" height=\"$l_size[1]\" width=\"$l_size[0]\" alt=\"elettori\" /><img src=\"modules/Elezioni/images/barre/mainbar.jpg\" alt=\"elettori\" height=\"$m_size[1]\" width=\"".(100 * 2)."\" /><img src=\"modules/Elezioni/images/barre/rightbar.jpg\" height=\"$r_size[1]\" width=\"$r_size[0]\" alt=\"elettori\" /> 100 % ($tot_gen)</td></tr></table>";
 			 echo "</td></tr></table>";
 		}	
@@ -442,5 +442,5 @@
         		left join ".$prefix."_ele_voti_$tab as t2 on (t1.id_lista=t2.id_lista)
 				where 	t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons $circondt1
-				group by t2.id_lista
+				group by t1.id_lista,t1.num_lista,t1.descrizione
 				order by somma desc";
 				$res = $dbi->prepare("$sql");
Index: trunk/client/modules/Elezioni/gruppo.php
===================================================================
--- trunk/client/modules/Elezioni/gruppo.php	(revision 370)
+++ trunk/client/modules/Elezioni/gruppo.php	(revision 371)
@@ -252,5 +252,11 @@
 			$res_cand->execute();
 
-			if ($circo) $condcirc="and t5.id_circ=$id_circ";
+			if ($circo) {$condcirc="and t5.id_circ=$id_circ";$condcircdes="and t2.id_circ=$id_circ";}
+			$sqldesc="select '','', t1.num_cand, concat(t1.cognome,' ', t1.nome) as nome, '','','','','','' 
+			from ".$prefix."_ele_candidati as t1, ".$prefix."_ele_lista as t2
+			where t1.id_lista=$id_lista
+			and t1.id_lista=t2.id_lista
+			and t1.id_cons=$id_cons
+			order by t1.num_cand";
 
 			$sqlvoti="select $tab2, t1.num_cand, concat(t1.cognome,' ', t1.nome) as nome, sum(t2.voti),'','','','','' 
@@ -310,4 +316,12 @@
 				if ($votog) $votigl=" (t3.validi_lista),(t3.nulli),(t3.bianchi),(t3.contestati),(t3.voti_nulli_lista+t3.voti_nulli)";
 				else $votigl=" sum(t3.validi_lista),sum(t3.nulli),sum(t3.bianchi),sum(t3.contestati_lista),sum(t3.voti_nulli_lista+t3.voti_nulli)";
+
+			$sqldesc="select '','', $t.num_$tab15, $t.descrizione, '', '','','','',''
+			from 
+			".$prefix."_ele_$tab as t1 			
+			where t1.id_cons=$id_cons 
+			$condcirc
+			order by t1.num_$tab15";
+#include("TEST:$sqldesc");
 			$sqlvoti="select $tab2, $t.num_$tab15, $t.descrizione, sum(t2.voti), $votigl
 			from 
@@ -470,4 +484,6 @@
 			        $_SESSION['nomefile']=strip_tags(str_replace(" ", "_", $nomefile));
 					$datipdf="<b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons<br/><b>$pagina</b><br/><br/> $list1 $list2 $list3 ";
+					$datipdf=str_replace("("," ",$datipdf);
+					$datipdf=str_replace(")"," ",$datipdf);
 # verificare la stampa sulle circoscrizioni					
 					 echo "<div style=\"text-align:right;width:65%;margin-left:10px;margin-right:0px;font-size:12px; \">";
@@ -653,17 +669,22 @@
 				#	if($res_voti->rowCount()) {
 						$res_voti = $dbi->prepare("$sqlvoti");
-						$res_voti->execute();			 
+						$res_voti->execute();
+						if (!$res_voti->rowCount()) { 
+							$res_voti = $dbi->prepare("$sqldesc");
+							$res_voti->execute();
+#include("TEST: $sqldesc");
+						}	
 					#}
 					
-					while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = $res_voti->fetch(PDO::FETCH_NUM)){
+					while (list($num_circ,$desc_circ,$num_cand,$nome,$voti,$sevalidi,$senulli,$sebianchi,$secontestati,$sevonulli) = $res_voti->fetch(PDO::FETCH_NUM)){ 
 						if($num_cand<$min or $num_cand>$offset) continue;
 				if($genere==4) $sevalidi=$voti;
 
 						if (!isset($temp[$num_cand])) $temp[$num_cand]=0;
-						$temp[$num_cand]+=$voti;
+						$temp[$num_cand]+=intval($voti);
 						$z=array_search($num_circ, $pos); 
-						if (!$z) continue;
+						if (!$z) $z=$minpos; #continue;
 						if ($num_cand>=$min and $num_cand<=$offset){
-							if($num_circ>=$minpos and $num_circ <=$maxpos){
+							if(($num_circ>=$minpos and $num_circ <=$maxpos) or $num_circ==''){
 								$ar[0][$num_cand]=$num_cand.") ".$nome;
 								if ($desc_circ && $onetime!=$desc_circ) {$ar[($z)][0].=") ".$desc_circ; $onetime=$desc_circ;}
@@ -679,5 +700,5 @@
 						if (!strstr( $op,'candidato')){
 							if (!isset($tempar[$num_cand])) $tempar[$num_cand]=0;
-							$tempar[$num_cand]+=$voti;
+							$tempar[$num_cand]+=intval($voti);
 						}
 						if ($visvot!='cand'){ 
@@ -814,5 +835,5 @@
 
 			}
-
+			if(!$id_gruppo) $id_gruppo=0;
 			$sql="select num_gruppo,descrizione from ".$prefix."_ele_gruppo where id_gruppo=$id_gruppo";
 			$res_ref = $dbi->prepare("$sql");
@@ -833,7 +854,10 @@
 			$res->execute();
 
-			if($res) $num_sez=$res->rowCount(); else $num_sez=0;
-			if($res_ref) list($num_gruppo,$descr)= $res_ref->fetch(PDO::FETCH_NUM); else {$num_gruppo=0;$descr='';}
-			
+			if($res->rowCount()) $num_sez=$res->rowCount(); 
+			else 
+			{	
+				$num_sez=0;
+			}
+			if($res_ref->rowCount()) list($num_gruppo,$descr)= $res_ref->fetch(PDO::FETCH_NUM); else {$num_gruppo=0;$descr='';}
 			if (!$csv){
 				# stampa
@@ -841,4 +865,5 @@
 				$datipdf="<b>"._COMUNE." $descr_comune</b> - "._RISULTATI.": $descr_cons<br/><b>$pagina</b><br/><br/> ";
 				$datipdf .="<br/><b>Referendum n. ".$num_gruppo." </b><br/>".$descr."";
+	            $datipdf=str_replace('"',"'",$datipdf);
 				echo "<div style=\"text-align:right;width:900px;margin-left:10px;margin-right:20px;font-size:12px \">";
 				echo "<table style=\"text-align:center;margin-right:0px;border-top : 1px solid Blue;width: 140px;\"><tr style=\" background:#eceff5;\"><td>"._ESPORTA."<br />";
@@ -850,5 +875,5 @@
 				
 
-			echo "<img class=\"image\"  src=\"modules/Elezioni/images/rss.png\" alt=\"Export rss\" />";
+				echo "<img class=\"image\"  src=\"modules/Elezioni/images/rss.png\" alt=\"Export rss\" />";
 				
 				echo "	</td></tr>";
@@ -919,4 +944,5 @@
 
 			if (!$csv)echo "<b>Referendum n. ".$num_gruppo." </b><br />".$descr."";
+#			die("TEST: $csv - $num_gruppo - $descr");
 
 		$y=1;
@@ -928,5 +954,5 @@
 		$ar[0][5]=_BIANCHI;
 		$ar[0][6]=_CONTESTATI;
-		if($res_ref)
+		if($res_ref->rowCount())
 		    while (list($num_gruppo,$desc_ref) = $res_ref->fetch(PDO::FETCH_NUM)){
 			$ar[0][$i++]= $num_gruppo.") ".$desc_ref;
@@ -941,5 +967,5 @@
 		$tot_bi=0;
 		$tot_co=0;
-		if($res)
+		if($res->rowCount())
 		    while (list($num_circ,$desc_circ,$num_gruppo,$desc_ref,$simbolo,$si,$no,$validi,$nulli,$bianchi, $contestati)  = $res->fetch(PDO::FETCH_NUM)){
 			$i=1;
Index: trunk/client/modules/Elezioni/index.php
===================================================================
--- trunk/client/modules/Elezioni/index.php	(revision 370)
+++ trunk/client/modules/Elezioni/index.php	(revision 371)
@@ -153,5 +153,5 @@
 	echo "<img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_comune=".$id_comune."\" alt=\"logo\" />";
 	}else{
-	echo "<img src=\"modules/Elezioni/images/logo.gif\" alt=\"logo\" />";
+	echo "<img src=\"modules/Elezioni/images/logo.gif\" alt=\"logo\" height=\"100\" />";
 	}
 
@@ -459,5 +459,5 @@
 	$res1->execute();
 	list($ind) = $res1->fetch(PDO::FETCH_NUM);
-	$indir=str_replace(" ","+",$ind."+".$descr_com."+".$cap);
+	$indir=str_replace(" ","+",$ind.",+".$descr_com.",+".$cap);
 	echo "<br /><div><a href=\"https://maps.google.it/maps/place/".$indir."\"><img src=\"modules.php?name=Elezioni&amp;file=foto&amp;id_sede=".$id_sede."\" alt=\"mappa\" /></a></div>";
  }elseif($id_sede!='0' && $googlemaps=='1'){
@@ -790,16 +790,22 @@
 					}else {$var1="";}
 				}else{ //referendum
-					$sql="select sum(si),sum(no),sum(validi),sum(bianchi),sum(nulli),sum(contestati)   from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_gruppo='$id_gruppo2'";
+					$sql="select sum(si),sum(no),sum(validi),sum(bianchi),sum(nulli),sum(contestati) from ".$prefix."_ele_voti_ref where id_cons='$id_cons' and id_gruppo='$id_gruppo2'";
 					$res_ref = $dbi->prepare("$sql");
 					$res_ref->execute();
-					list($voti_si,$voti_no,$validi,$bianchi,$nulli,$conte) = $res_ref->fetch(PDO::FETCH_NUM);
-					$sql="select t3.orario,t3.data from ".$prefix."_ele_rilaff as t1 left join ".$prefix."_ele_cons_comune as t2 on t1.id_cons_gen=t2.id_cons_gen left join ".$prefix."_ele_voti_parziale as t3 on t2.id_cons=t3.id_cons where t1.id_cons_gen='$id_cons_gen' and t2.id_cons='$id_cons' order by t3.data desc, t3.orario desc limit 0,1";
-					$aff = $dbi->prepare("$sql");
-					$aff->execute();
-					list($ora,$data) = $aff->fetch(PDO::FETCH_NUM);					
-					$sql="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and orario='$ora' and data='$data' and id_gruppo='$id_gruppo2'";
-					$tot_rel = $dbi->prepare("$sql");
-					$tot_rel->execute();
-					list($tot_relativo) = $tot_rel->fetch(PDO::FETCH_NUM);					
+					if($res_ref->rowCount())
+						list($voti_si,$voti_no,$validi,$bianchi,$nulli,$conte) = $res_ref->fetch(PDO::FETCH_NUM);
+					if(($voti_si+$voti_no+$validi+$bianchi+$nulli+$conte)>0) 
+					{
+						$sql="select t3.orario,t3.data from ".$prefix."_ele_rilaff as t1 left join ".$prefix."_ele_cons_comune as t2 on t1.id_cons_gen=t2.id_cons_gen left join ".$prefix."_ele_voti_parziale as t3 on t2.id_cons=t3.id_cons where t1.id_cons_gen='$id_cons_gen' and t2.id_cons='$id_cons' order by t3.data desc, t3.orario desc limit 0,1";
+						$aff = $dbi->prepare("$sql");
+						$aff->execute();
+						list($ora,$data) = $aff->fetch(PDO::FETCH_NUM);					
+						$sql="select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons='$id_cons' and orario='$ora' and data='$data' and id_gruppo='$id_gruppo2'";
+						$tot_rel = $dbi->prepare("$sql");
+						$tot_rel->execute();
+						list($tot_relativo) = $tot_rel->fetch(PDO::FETCH_NUM);
+					}else{
+						$voti_si=0;$voti_no=0;$validi=0;$bianchi=0;$nulli=0;$conte=0;$tot_relativo=0;
+					}
 					// totale assoluto
 					$sql="select sum(maschi+femmine) from ".$prefix."_ele_sezioni where id_cons='$id_cons'";
@@ -811,13 +817,13 @@
 					if($tot_assoluto)
 						  $perc_tot=number_format(($tot_relativo*100)/$tot_assoluto,2);
-						  else $perc_tot=0;
+					else $perc_tot=0;
 					
-					$tot_ref=0;$tot_ref=$voti_si+$voti_no;
+					$tot_ref=$voti_si+$voti_no;
 					if($tot_ref){
-					$perc_si=number_format(($voti_si*100)/$tot_ref,2);
-					$perc_no=number_format(($voti_no*100)/$tot_ref,2);
+						$perc_si=number_format(($voti_si*100)/$tot_ref,2);
+						$perc_no=number_format(($voti_no*100)/$tot_ref,2);
 					}else{ $perc_si=0;$perc_no=0;}
 					$var1="<table class=\"table-80\" style=\"text-align: center;\">";				
-					if($ora){	
+					if(isset($ora)){	
 						list ($ore,$minuti,$secondi)=explode(':',$ora);
 						$var1.=	"<tr>
Index: trunk/client/modules/Elezioni/votanti.php
===================================================================
--- trunk/client/modules/Elezioni/votanti.php	(revision 370)
+++ trunk/client/modules/Elezioni/votanti.php	(revision 371)
@@ -249,5 +249,5 @@
 		if (!($genere==4) and $pag==0){  //se non e' una lista uninominale ed e' la prima pagina
                         
-			$tab="SELECT 0,t2.id_sez,t2.num_sez,t2.validi,'0','0',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0',t2.voti_nulli FROM ".$prefix."_ele_sezioni as t2 left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t2.id_cons='$id_cons' and t2.validi+t2.nulli+t2.bianchi+t2.contestati>0 group by t2.id_sez order by t2.num_sez ";
+			$tab="SELECT 0,t2.id_sez,t2.num_sez,t2.validi,'0','0',t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,'0',t2.voti_nulli FROM ".$prefix."_ele_sezioni as t2 left join ".$prefix."_ele_sede as t4 on (t2.id_sede=t4.id_sede) where t2.id_cons='$id_cons' and t2.validi+t2.nulli+t2.bianchi+t2.contestati>0 group by t2.id_sez,t2.num_sez,t2.validi,t2.nulli,t2.bianchi,t2.contestati, t4.id_circ,t2.id_sede,t2.voti_nulli order by t2.num_sez ";
 		
 		}else{ // e' una lista uninominale o la seconda pagina
@@ -260,5 +260,5 @@
 			FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
 			left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
-			where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t2.id_sez order by t1.num_sez ";
+			where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.solo_lista,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli order by t1.num_sez ";
 		     }else{
 			
@@ -266,5 +266,5 @@
 			FROM ".$prefix."_ele_sezioni as t1 left join ".$prefix.$tab3." as t2 on (t1.id_sez=t2.id_sez)
 			left join ".$prefix."_ele_sede as t4 on (t1.id_sede=t4.id_sede)
-			where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t2.id_sez order by t1.num_sez ";
+			where t1.id_cons='$id_cons' and t1.id_cons=t2.id_cons group by t1.id_sez,t1.num_sez,t1.solo_gruppo,t1.validi,t1.nulli,t1.bianchi,t1.contestati,t4.id_circ,t1.id_sede,t1.voti_nulli order by t1.num_sez ";
 			}
 		}
@@ -509,5 +509,7 @@
 	header ("Content-Type: application/vnd.ms-excel");
 	header ("Content-Disposition: inline; filename=$nomefile");
-
+	header("Pragma: no-cache");
+	header("Expires: 0");
+	$datipdf = mb_convert_encoding($datipdf , "HTML-ENTITIES", "UTF-8");
 	echo "$datipdf";
 	echo "$html \n";
Index: trunk/client/temi/Futura2/index.php
===================================================================
--- trunk/client/temi/Futura2/index.php	(revision 370)
+++ trunk/client/temi/Futura2/index.php	(revision 371)
@@ -112,5 +112,5 @@
 	
 	    while(list($id,$descrizione) = $res->fetch(PDO::FETCH_NUM)) {
-		$descrizione=substr(str_replace("+"," ",$descrizione),0,30);
+#		$descrizione=substr(str_replace("+"," ",$descrizione),0,30);
      		$sel = ($id == $id_cons_gen) ? "selected=\"selected\"":"";		
 	        echo "<option style=\"font-size:12px;\" value=\"$id\" $sel >$descrizione</option>";
Index: trunk/client/versione.php
===================================================================
--- trunk/client/versione.php	(revision 370)
+++ trunk/client/versione.php	(revision 371)
@@ -1,7 +1,7 @@
 <?php
 
-$versione = "3.0 rev 370";
+$versione = "3.0 rev 371";
 $version_number = $versione;
-$datarel = "01 giugno 2022";
+$datarel = "03 settembre 2022";
 $version = "Eleonline $version_number (<i>Data Release: $datarel</i>)";
 
