Index: trunk/admin/admin.php
===================================================================
--- trunk/admin/admin.php	(revision 20)
+++ trunk/admin/admin.php	(revision 21)
@@ -71,17 +71,17 @@
 
 foreach ($_GET as $sec_key => $secvalue) {
-    if ((eregi("<[^>]*script*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*object*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*iframe*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*applet*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*meta*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*style*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*form*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*img*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*onmouseover*\"?[^>]*>", $secvalue)) ||
-	(eregi("<[^>]*body*\"?[^>]*>", $secvalue)) ||
-	(eregi("\([^>]*\"?[^)]*\)", $secvalue)) ||
-	(eregi("\"", $secvalue)) ||
-	(eregi("inside_mod", $sec_key))) {
+    if ((preg_match("/<[^>]*script*\"?[^>]*>/i",$secvalue)) ||
+	(preg_match("/<[^>]*object*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*iframe*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*applet*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*meta*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*style*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*form*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*img*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*onmouseover*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/<[^>]*body*\"?[^>]*>/i", $secvalue)) ||
+	(preg_match("/\([^>]*\"?[^)]*\)/", $secvalue)) ||
+	(preg_match("/\"/", $secvalue)) ||
+	(preg_match("/inside_mod/i", $sec_key))) {
         die ("Operazione non consentita");
      }
@@ -89,5 +89,5 @@
 
   foreach ($_POST as $secvalue) {
-    if ((eregi("<[^>]*onmouseover*\"?[^>]*>", $secvalue)) || (eregi("<[^>]script*\"?[^>]*>", $secvalue)) || (eregi("<[^>]*body*\"?[^>]*>", $secvalue)) || (eregi("<[^>]style*\"?[^>]*>", $secvalue))) {
+    if ((preg_match("/<[^>]*onmouseover*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]script*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]*body*\"?[^>]*>/i", $secvalue)) || (preg_match("/<[^>]style*\"?[^>]*>/i", $secvalue))) {
       die ('Operazione non consentita');
     }
@@ -124,5 +124,6 @@
 		$dbi=mysql_connect($dbhost, $dbuname, $dbpass) or die("Connessione non riuscita: " . mysql_error());
 		mysql_select_db($dbname)or die("Connessione non riuscita:" . mysql_error());
-		mysql_set_charset('utf8', $dbi);
+#		mysql_set_charset('utf8', $dbi);
+	mysql_query("SET NAMES 'utf8'", $dbi);
 //---10/05/2009  gestione consultazione predefinita
 		$res_config = mysql_query("select * from ".$prefix."_config ",$dbi);
@@ -161,5 +162,5 @@
         if (strlen($aid)>25 ) { die ("Nome utente troppo lungo: $aid"); }	
 	if (!isset($param['id_ses']) or $param['id_ses'] != session_id()) logout();
-	if (ereg(" ", $aid)) { die ("Gli spazi non sono ammessi nel nome utente: $aid"); }
+	if (strstr( $aid," ")) { die ("Gli spazi non sono ammessi nel nome utente: $aid"); }
 	if (isset($_SESSION['aid'])){
 		logout();//se hai gia' una sessione aperta non puoi postare 'aid'
Index: trunk/client/modules/Elezioni/grafici.php
===================================================================
--- trunk/client/modules/Elezioni/grafici.php	(revision 20)
+++ trunk/client/modules/Elezioni/grafici.php	(revision 21)
@@ -442,6 +442,6 @@
 				//$descrizione=taglio(4,$descrizione);
 				
-				$gruppo[$i]=utf8_encode(substr($descrizione,0,21));
-				$gruppos[$e]=utf8_encode(substr($descrizione,0,21)); //flash
+				$gruppo[$i]=(substr($descrizione,0,21));
+				$gruppos[$e]=(substr($descrizione,0,21)); //flash
 
 				
Index: trunk/client/modules/Elezioni/grafici/affluenze_graf.php
===================================================================
--- trunk/client/modules/Elezioni/grafici/affluenze_graf.php	(revision 20)
+++ trunk/client/modules/Elezioni/grafici/affluenze_graf.php	(revision 21)
@@ -10,4 +10,5 @@
 include ("jpgraph.php");
 include ("jpgraph_pie.php");
+define("CURFONT1",FF_DV_SANSSERIF);
 
 $e=$_GET['e'];$f=$_GET['f'];$e1=$_GET['e1'];$f1=$_GET['f1'];
@@ -22,5 +23,5 @@
 
 $graph->title->Set($titolo);
-$graph->title->SetFont(FF_FONT1,FS_BOLD);
+$graph->title->SetFont(CURFONT1,FS_BOLD);
 $graph ->legend->Pos( 0.02,0.85,"left" ,"center");
 $graph->SetBackgroundImage("../images/logo.jpg",BGIMG_COPY);
Index: trunk/client/modules/Elezioni/grafici/barre.php
===================================================================
--- trunk/client/modules/Elezioni/grafici/barre.php	(revision 20)
+++ 	(revision )
@@ -1,135 +1,0 @@
-<?php
-/************************************************************************/
-/* Eleonline - Raccolta e diffusione dei dati elettorali                */
-/* by Luciano Apolito & Roberto Gigli                                   */
-/* http://www.eleonline.it                                              */
-/* info@eleonline.it  luciano@aniene.net rgigli@libero.it               */
-/************************************************************************/
-
-include ("jpgraph.php");
-include ("jpgraph_bar.php");
-
-
-$dati1=$_GET['dati1'];$dati2=$_GET['dati2'];$i=$_GET['i'];$l=$_GET['l'];$w=$_GET['w'];
-$titolo=$_GET['titolo'];$descr=$_GET['descr'];$cop=$_GET['cop'];
-$logo=$_GET['logo'];
-$datay=unserialize(stripslashes($dati1)); // percentuali
-$datax=unserialize(stripslashes($dati2)); // candidati
-
-
-// $i= numero candidati
-// $larghezza label
-if (!isset($l)) $l=180;
-if (!isset($w)) $w=500;
-if ($l=='') $l=180;
-if ($w=='') $w=500;
-
-// Size of graph
-$width=$w;
-$height=$i*30;
-
-// Set the basic parameters of the graph
-$graph = new Graph($width,$height,'auto');
-$graph->SetScale("textlin");
-
-$top = 50;
-$bottom = 80;
-$left = $l;
-$right = 40;
-$graph->Set90AndMargin($left,$right,$top,$bottom);
-#if(isset($logo)) $graph->SetBackgroundImage("../images/".$logo.".png",BGIMG_COPY);
-#else 
-//$graph->SetBackgroundImage("../images/vuoto.jpg",BGIMG_COPY);
-// Nice shadow
-$graph->SetShadow();
-$graph->SetBackgroundGradient('white','yellow',GRAD_HOR,BGRAD_MARGIN);
-// Setup title
-$graph->title->Set("$titolo");
-$graph->title->SetFont(FF_FONT1,FS_BOLD,10);
-$graph->subtitle->Set("$descr");
-
-// Setup X-axis
-$graph->xaxis->SetTickLabels($datax);
-$graph->xaxis->SetFont(FF_FONT1,FS_BOLD,8);
-$graph->xaxis->SetColor("black","darkred");
-// Some extra margin looks nicer
-$graph->xaxis->SetLabelMargin(5);
-
-// Label align for X-axis
-$graph->xaxis->SetLabelAlign('right','center');
-
-// Add some grace to y-axis so the bars doesn't go
-// all the way to the end of the plot area
-$graph->yaxis->scale->SetGrace(20);
-
-// Setup the Y-axis to be displayed in the bottom of the
-// graph. We also finetune the exact layout of the title,
-// ticks and labels to make them look nice.
-$graph->yaxis->SetPos('max');
-
-// First make the labels look right
-$graph->yaxis->SetLabelAlign('center','top');
-$graph->yaxis->SetLabelFormat('%d');
-$graph->yaxis->SetLabelSide(SIDE_RIGHT);
-
-// The fix the tick marks
-$graph->yaxis->SetTickSide(SIDE_LEFT);
-
-// Finally setup the title
-$graph->yaxis->SetTitleSide(SIDE_RIGHT);
-$graph->yaxis->SetTitleMargin(35);
-
-// To align the title to the right use :
-$graph->yaxis->SetTitle("$cop",'high');
-$graph->yaxis->title->Align('right');
-$graph->yaxis->SetColor("black","darkred");
-// To center the title use :
-//$graph->yaxis->SetTitle('Turnaround 2002','center');
-//$graph->yaxis->title->Align('center');
-
-$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD,12);
-$graph->yaxis->title->SetAngle(0);
-
-
-
-$graph->yaxis->SetFont(FF_FONT2,FS_NORMAL);
-// If you want the labels at an angle other than 0 or 90
-// you need to use TTF fonts
-//$graph->yaxis->SetLabelAngle(0);
-
-/*
-// testo
-$txt =new Text("$cop");
-$txt->Pos( 100,$i*29);
-$txt->SetColor( "red");
-$graph->AddText( $txt);
-*/
-
-
-
-
-
-
-
-
-// Now create a bar pot
-$bplot = new BarPlot($datay);
-$bplot->SetFillColor("orange");
-$bplot->SetShadow();
-
-//You can change the width of the bars if you like
-$bplot->SetWidth(0.1);
-
-// We want to display the value of each bar at the top
-$bplot->value->Show();
-$bplot->value->SetFont(FF_FONT1,FS_BOLD,12);
-$bplot->value->SetAlign('left','center');
-$bplot->value->SetColor("black","darkred");
-$bplot->value->SetFormat('%.2f perc');
-
-// Add the bar to the graph
-$graph->Add($bplot);
-
-
-$graph->Stroke();
-?>
Index: trunk/client/modules/Elezioni/grafici/jpg-config.inc.php
===================================================================
--- trunk/client/modules/Elezioni/grafici/jpg-config.inc.php	(revision 20)
+++ trunk/client/modules/Elezioni/grafici/jpg-config.inc.php	(revision 21)
@@ -31,4 +31,5 @@
 //   MBTTF_DIR /usr/share/fonts/ja/TrueType/
 //
+define("TTF_DIR","/usr/share/fonts/truetype/ttf-dejavu/");
 // WINDOWS:
 //   CACHE_DIR $SERVER_TEMP/jpgraph_cache/
