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