source: trunk/admin/modules/Elezioni/ele.php@ 345

Last change on this file since 345 was 336, checked in by roby, 4 years ago

Admin: prime modifiche per compatibilità con php 7.4

File size: 13.4 KB
RevLine 
[2]1<?php
2/************************************************************************/
3/* Eleonline - Raccolta e diffusione dei dati elettorali */
4/* by Roberto Gigli & Luciano Apolito */
5/* http://www.eleonline.it */
6/* info@eleonline.it luciano@aniene.net rgigli@libero.it */
7/************************************************************************/
8/* Modulo menu */
9/* Amministrazione */
10/************************************************************************/
11
12if (!defined('ADMIN_FILE')) {
13 die ("You can't access this file directly...");
14}
15if (!ini_get("register_globals")) {
16 $php_ver = phpversion();
17 $php_ver = explode(".", $php_ver);
18 $phpver = "$php_ver[0]$php_ver[1]";
19 if ($phpver >= 41) {
20 $PHP_SELF = $_SERVER['PHP_SELF'];
21 }
22}
[255]23global $dbi;
[2]24$aid=$_SESSION['aid'];
[255]25#$dbi=$_SESSION['dbi'];
[2]26$id_comune=$_SESSION['id_comune'];
27$prefix=$_SESSION['prefix'];
28$currentlang=$_SESSION['lang'];
29$bgcolor1=$_SESSION['bgcolor1'];
30$bgcolor2=$_SESSION['bgcolor2'];
31$bgcolor1='#e7e7e7';
32$param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
33
34if (!isset($id_cons_gen)) if (isset($param['id_cons_gen'])) $id_cons_gen=$param['id_cons_gen'];else $id_cons_gen='0';
35$perms=ChiSei($id_cons_gen);
36
37##modifica
38if ($perms>128){
39 if (isset($param['id_comune']) && intval($param['id_comune'])>0) {
40 $id_comune=intval($param['id_comune']);
41 $_SESSION['id_comune']=$id_comune;
42 }
43}
[255]44include_once("modules/Elezioni/query.sql");
[2]45
[336]46$row=setconsultazione();
47if(isset($row[0])) {
48 $tipo_cons=$row[0]; $descr_cons=$row[1]; $id_cons_gen=$row[2];
49} else {
50 $tipo_cons=0; $descr_cons=''; $id_cons_gen=0;
51}
52$row=tipocons();
53if(isset($row[0])) {
54 $genere=$row[0];$votog=$row[1];$votol=$row[2];$votoc=$row[3];$conscirc=$row[4];
55} else {
56 $genere=0;$votog=0;$votol=0;$votoc=0;$conscirc=0;
57}
[2]58
59if (!$perms) $perms=ChiSei($id_cons_gen);
60 //include("modules/Elezioni/language/lang-$currentlang.php");
61 //**************************************************************************
62 // ELE
63 //**************************************************************************
64
65
66function ele() {
67
[96]68 global $espandi, $aid, $bgcolor1, $bgcolor2,$bgcolor5, $prefix, $dbi, $offset, $min,$descr_cons, $id_cons_gen,$tipo_cons,$genere,$op,$id_comune,$perms,$id_cons,$votog,$votol,$votoc,$votocirc,$tema,$fascia;
[2]69
70 include ("header.php");
[258]71# include("modules/Elezioni/testa.php");
[2]72 //immagine bullet
73 $bullet="<img src=\"temi/$tema/images/bullet.gif\" alt =\" \" align=\"left\" border=\"0\">";
[230]74 $bullet_red="<img src=\"temi/$tema/images/bullet_red.gif\" alt =\" \" align=\"left\" border=\"0\">";
[2]75 $bgcolor1='#e7e7e7';
[255]76 $row=descr_comune();$descr_comu=$row['descrizione'];
[256]77
78 $row=daticonscom();
[257]79 if (isset($row['fascia'])) $fascia=$row['fascia'];
[196]80 else
81 $fascia=0;
[2]82 $otable= "<table bgcolor=\"$bgcolor1\" width=\"100%\" cellpadding=\"0\" cellspacing=\"2\" BORDER=\"0\">\n <tr><td>&nbsp;&nbsp;&nbsp;</td><td valign=\"top\" align=\"left\">";
83 $otable1= "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"2\" BORDER=\"0\">\n <tr><td valign=\"top\" width=\"180\">";
84 $ctable= "</td></tr></table>";
85$currentlang=$_SESSION['lang'];
86
87
88
89 echo "<form name=\"scelta\" action=\"admin.php\">";
90 echo $otable;
91 echo "<input type=\"hidden\" name=\"pag_cons\" value=\"admin.php?id_cons_gen=\">";
92 echo "<input type=\"hidden\" name=\"op\" value=\"ele\">";
[255]93###########################
94$row=elenco_cons();
95
96
97##################################
[2]98 echo "<font size=-1><b>"._SCELTA_CONS.":</b> </font><select name=\"id_cons_gen\" onChange=\"top.location.href=this.form.pag_cons.value+this.form.id_cons_gen.options[this.form.id_cons_gen.selectedIndex].value;return false\">";
[255]99
100 foreach ($row as $riga)
101 {
102 $id=$riga[0];$descrizione=$riga[1];$gen2=$riga[2];$idgen=$riga[3];$chiusa=$riga[4];
103# while(list() = mysql_fetch_row($res)) {
[2]104 if (($chiusa==0) OR ($perms>32)) {
105 if (($idgen==$id_cons_gen or !$id_cons_gen)) {
106 $sel = "selected";
107 $genere=$gen2;
108 $id_cons_gen=$idgen;
109 } else {
110 $sel = "";
111 }
112 echo "<option value=\"$idgen\" $sel>$descrizione";
113 }
114 }
115 echo "</select>";
116 // controllo delle opzioni utilizzabili: sono quelle che hanno genitori in quella precedente
117 // esempio si possono inserire i candidati solo se prima sono state inserite le liste
[256]118 $sql="select count(0) from ".$prefix."_ele_circoscrizione where id_cons=$id_cons";
119 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrcirco=$row[0];}
120 catch(PDOException $e) {$nrcirco=0; }
121 $sql="select count(0) from ".$prefix."_ele_sede where id_cons=$id_cons";
122 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrsede=$row[0];}
123 catch(PDOException $e) {$nrsede=0; }
124 $sql="select count(0) from ".$prefix."_ele_gruppo where id_cons=$id_cons";
125 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrgruppo=$row[0];}
126 catch(PDOException $e) {$nrgruppo=0; }
127 $sql = "select count(0) from ".$prefix."_ele_lista where id_cons=$id_cons";
128 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrlista=$row[0];}
129 catch(PDOException $e) {$nrlista=0; }
130 $sql = "SELECT sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_cons=$id_cons";
131 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH); $nraff=$row[0];}
132 catch(PDOException $e) {$nraff=0; }
[2]133 if ($genere==0) $tmpval='voti_ref'; else $tmpval='sezioni';
[256]134 $sql = "SELECT sum(validi) from ".$prefix."_ele_$tmpval where id_cons=$id_cons";
135 try { $sth = $dbi->prepare("$sql"); $sth->execute(); $row = $sth->fetch(PDO::FETCH_BOTH);$nrvoti=$row[0];}
136 catch(PDOException $e) {$nrvoti=0; }
137 unset($row);
[2]138 if ($perms==256) // il superuser puo' scegliere il comune su cui lavorare
139 {
[255]140 $row=elenco_comuni();
[2]141 echo "<select name=\"id_comune\" onChange=\"top.location.href=this.form.pag_cons.value+$id_cons_gen+'&amp;id_comune='+this.form.id_comune.options[this.form.id_comune.selectedIndex].value;return false\"><option value=\"\">";
[255]142 foreach($row as $riga)
[2]143 {
[255]144 $id=$riga[0];$descrizione=$riga[1];
[2]145 $sel=($id == $id_comune) ? "selected":"";
146 echo "<option value=\"$id\" $sel>$descrizione";
147 }
148 }
149 echo "</select>";
150 echo $ctable;
151 echo "</form>";
152
153
154 echo "<br>";
155
156 echo $otable1;
157 echo "<table width=\"180\" align=\"left\"><tr><td><table>";
[56]158 echo "<tr align=\"left\" bgcolor=\"$bgcolor1\"><td valign=\"top\" align=\"left\" width=\"150\" colspan=\"2\">
[92]159 <a href=\"admin.php?op=$op&amp;id_cons_gen=$id_cons_gen&amp;help=1\">$bullet"._HELP."</a>
[45]160 </td></tr>";
[2]161
162 if ($perms>128) {
163
164
165# <a href=\"admin.php?op=inscollegi&amp;id_cons_gen=$id_cons_gen\">$bullet"._COLLEGI."</a><br>
166
167 echo "
[56]168 <tr align=\"left\" bgcolor=\"$bgcolor1\">
[45]169 <td valign=\"top\" align=\"center\" bgcolor=\"#000000\" rowspan=\"3\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._SUPER."
[2]170
171 </b></font></font>
172
173 </td>
[92]174<td valign=\"top\" align=\"left\" width=\"150\">
[2]175
[92]176
[56]177 <a href=\"admin.php?op=configurazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFIGURAZIONE."</a><br>";
[2]178 if($op=="configurazione" || $op=="widget" || $op=="plugin"){
179 echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - <a href=\"admin.php?op=widget&amp;id_cons_gen=$id_cons_gen\"> "._WIDGET."</a>";
[175]180 echo "<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - "._PLUGINS."";
181 echo "<hr>";
[2]182 }
[92]183 echo "
[2]184 <a href=\"admin.php?op=constipi&amp;id_cons_gen=$id_cons_gen\">$bullet"._TIPO_ADM."</a><br>
[92]185 <a href=\"admin.php?op=confconsiglio&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONFCONS."</a>
[56]186 </td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
[45]187 <a href=\"admin.php?op=inscomuni&amp;id_cons_gen=$id_cons_gen\">$bullet"._DEFCOMUNE."</a><br>
[92]188 <a href=\"admin.php?op=oper_admin&amp;id_cons_gen=$id_cons_gen\">$bullet"._AMMINISTRATORI."</a>
[56]189 </td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
[45]190 <a href=\"admin.php?op=consultazione&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONE_ADM."</a><br>
[2]191
192 <a href=\"admin.php?op=rec_add_aff&amp;id_cons_gen=$id_cons_gen\">$bullet"._AFFLUENZE."</a><br>
[256]193 <a href=\"admin.php?op=associazioni&amp;id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a><br>
[246]194 <a href=\"http://www.eleonline.it/portal/segnala.php?tmp=test123\" target=\"_blank\">$bullet_red <b>"._SEGNALA."</b></a>
[92]195 </td></tr>";
[45]196# <a href=\"admin.php?op=backup&amp;id_cons_gen=$id_cons_gen\">$bullet"._BACKUP."</a><br>
197# <a href=\"admin.php?op=restore&amp;id_cons_gen=$id_cons_gen\">$bullet"._RESTORE."</a>
[2]198
199 }
200// Amministrazione locale solo superuser e adminuser
201 if ($perms>16 and ! $espandi) {
202 echo "
203 <tr bgcolor=\"$bgcolor1\">
204 <td valign=\"top\" align=\"center\" bgcolor=\"#000000\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._ADMIN."
205
206 </b></font></font>
207
208 </td>
209 <td valign=\"top\">";
210 if ($perms>32) {
211 echo "<a href=\"admin.php?op=cons_comuni&amp;id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONI."</a><br>
212 <a href=\"admin.php?op=scarica&amp;id_cons_gen=$id_cons_gen\">$bullet"._SCARICA."</a><br>";
213# if($nrgruppo==0 and $nrlista==0)
214 echo "<a href=\"admin.php?op=importa&amp;id_cons_gen=$id_cons_gen\">$bullet"._IMPORTA."</a><br>";
215 echo "<a href=\"admin.php?op=operatori&amp;id_cons_gen=$id_cons_gen\">$bullet"._OPERATORI."</a> <br><a href=\"admin.php?op=permessi&amp;id_cons_gen=$id_cons_gen\">$bullet"._PERMESSI."</a> <br>";
216 }
217 echo "<a href=\"admin.php?op=come&amp;vai=come&amp;id_cons_gen=$id_cons_gen\">$bullet "._COME."</a> <br>
218 <a href=\"admin.php?op=numeri&amp;vai=numeri&amp;id_cons_gen=$id_cons_gen\">$bullet "._NUMERI."</a> <br>
219 <a href=\"admin.php?op=servizi&amp;vai=servizi&amp;id_cons_gen=$id_cons_gen\">$bullet "._SERVIZI."</a> <br>
220 <a href=\"admin.php?op=link&amp;vai=link&amp;id_cons_gen=$id_cons_gen\">$bullet "._LINK."</a> <br>
221 <a href=\"admin.php?op=circo&amp;id_cons_gen=$id_cons_gen\">
222
223 $bullet"._CIRCO."</a> <br>";
224 if ($nrcirco){
225 echo "<a href=\"admin.php?op=sede&amp;id_cons_gen=$id_cons_gen\">$bullet "._SEDE."</a> <br>";
226 if ($nrsede){
227 echo "<a href=\"admin.php?op=sezione&amp;id_cons_gen=$id_cons_gen\">$bullet "._SEZIONE."</a><br>";
228 }
229 }
230 if ($genere!=4) { //gestisce gruppi if ($tipo_cons!=8){ $genere!=2 and
231 echo "<a href=\"admin.php?op=gruppo&amp;id_cons_gen=$id_cons_gen\">$bullet "._GRUPPO."</a><br>";
232 }
233
234 if ($genere>2 or $genere==1){ ####prova
235 if ($genere==4 or $nrgruppo){ // or $tipo_cons==10 or $tipo_cons==11){
236 echo "
237 <a href=\"admin.php?op=lista&amp;id_cons_gen=$id_cons_gen\">$bullet "._LISTA."</a> <br>";
238 if ($genere>2){ ####prova
239 if ($nrlista){
240 echo "<a href=\"admin.php?op=candidato&amp;id_cons_gen=$id_cons_gen\">$bullet"._CANDIDATO."</a> <br>";
241 }else{
242 echo "$bullet "._CANDIDATO." ";
243 }
244 }
245 }else{
246 echo "
247 $bullet"._LISTA." <br>";
248 echo "$bullet "._CANDIDATO." <br>";
249
250 }
251
252 }
253
254 echo "</td></tr>";
255 }
256
257
258 //Amministrazione normale operatore
259 echo "<tr bgcolor=\"$bgcolor1\">
260 <td valign=\"top\" align=\"center\" bgcolor=\"#000000\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._OPER."
261
262 </b></font></font>
263
264 </td>
265 <td valign=\"top\" width=\"150\">";
266 if ($op!='consultazione' and $perms>0 and $nrcirco and ($nrlista or $nrgruppo)) {
[76]267 echo "<a href=\"admin.php?op=voti&amp;id_cons_gen=$id_cons_gen&amp;do=spoglio\">$bullet "._GEST." "._SPOGLIO."</a><br>";
[2]268 if ($nraff) {
269 echo "<a href=\"admin.php?op=controllo_votanti&amp;id_cons_gen=$id_cons_gen\">$bullet "._STATO." "._AFFLUENZE."</a><br>";
270 }else{
[63]271 echo "<img src=\"modules/Elezioni/images/site.gif\" alt =\" \" align=\"center\" border=\"0\"> "._STATO." "._AFFLUENZE."<br>";
[2]272 }
273 if ($nrvoti) {
274 echo "<a href=\"admin.php?op=controllo_voti&amp;id_cons_gen=$id_cons_gen\">$bullet "._STATO." "._VOTI."</a><br>";
275 }else{
[63]276 echo "<img src=\"modules/Elezioni/images/site.gif\" alt =\" \" align=\"middle\" border=\"0\"> "._STATO." "._VOTI."<br>";
[2]277 }
[139]278 echo "<a href=\"admin.php?op=riepilogo&amp;id_cons_gen=$id_cons_gen\">$bullet "._RIEPILOGO."</a><br>";
[254]279 if($tipo_cons==18 or $tipo_cons==19)
280 echo "<a href=\"admin.php?op=riepilogovoti&amp;id_cons_gen=$id_cons_gen\">$bullet Tabella dei Totali </a><br>";
[2]281 }
[129]282
283
284 echo "<br><a href=\"admin.php?op=cambiopwd&amp;id_cons_gen=$id_cons_gen\">$bullet"._CAMBIOPWD."</a><br>";
[170]285
286 if (file_exists("../client/modules.php"))
[175]287 echo "<hr><a href=\"../client/modules.php?id_comune=$id_comune&amp;id_cons_gen=$id_cons_gen\" target=\"_blank\">$bullet Guarda il sito</a><br><hr>";
[170]288
289 //echo "<hr /><a href=\"../client/modules.php\" target=\"_blank\">$bullet Guarda il sito</a><br /><hr />";
[297]290 echo "<a href=\"admin.php?op=logout\">$bullet "._ESCI."</a>";
[2]291 echo "</td></tr></table>";
292 // continua la tabella su ele.voti con le sezioni
293 // altrimenti inizia la tabella centrale
294
295 if ($op!="voti")
296 echo "</td></tr></table></td><td valign=\"top\" align=left>";
297
298}
299
300 switch ($op){
301 case "ele":
[92]302 ele();
303 global $language;
[258]304 include("language/$currentlang/ele.html");
[2]305 echo"</td></tr></table>";
306 include("footer.php");
307
308 break;
309
310 }
311
312
313?>
Note: See TracBrowser for help on using the repository browser.