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