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, $id_cons_gen,$tipo_cons,$genere,$op,$id_comune,$perms,$id_cons,$votog,$votol,$votoc,$votocirc,$tema,$fascia;
|
---|
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 | echo "<tr align=\"left\" bgcolor=\"$bgcolor1\"><td valign=\"top\" align=\"left\" width=\"150\" colspan=\"2\">
|
---|
157 | <a href=\"admin.php?op=$op&id_cons_gen=$id_cons_gen&help=1\">$bullet"._HELP."</a>
|
---|
158 | </td></tr>";
|
---|
159 |
|
---|
160 | if ($perms>128) {
|
---|
161 |
|
---|
162 |
|
---|
163 | # <a href=\"admin.php?op=inscollegi&id_cons_gen=$id_cons_gen\">$bullet"._COLLEGI."</a><br>
|
---|
164 |
|
---|
165 | echo "
|
---|
166 | <tr align=\"left\" bgcolor=\"$bgcolor1\">
|
---|
167 | <td valign=\"top\" align=\"center\" bgcolor=\"#000000\" rowspan=\"3\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._SUPER."
|
---|
168 |
|
---|
169 | </b></font></font>
|
---|
170 |
|
---|
171 | </td>
|
---|
172 | <td valign=\"top\" align=\"left\" width=\"150\">
|
---|
173 |
|
---|
174 |
|
---|
175 | <a href=\"admin.php?op=configurazione&id_cons_gen=$id_cons_gen\">$bullet"._CONFIGURAZIONE."</a><br>";
|
---|
176 | if($op=="configurazione" || $op=="widget" || $op=="plugin"){
|
---|
177 | echo " - <a href=\"admin.php?op=widget&id_cons_gen=$id_cons_gen\"> "._WIDGET."</a>";
|
---|
178 | echo "<br> - "._PLUGINS."";
|
---|
179 | echo "<hr>";
|
---|
180 | }
|
---|
181 | echo "
|
---|
182 | <a href=\"admin.php?op=constipi&id_cons_gen=$id_cons_gen\">$bullet"._TIPO_ADM."</a><br>
|
---|
183 | <a href=\"admin.php?op=confconsiglio&id_cons_gen=$id_cons_gen\">$bullet"._CONFCONS."</a>
|
---|
184 | </td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
|
---|
185 | <a href=\"admin.php?op=inscomuni&id_cons_gen=$id_cons_gen\">$bullet"._DEFCOMUNE."</a><br>
|
---|
186 | <a href=\"admin.php?op=oper_admin&id_cons_gen=$id_cons_gen\">$bullet"._AMMINISTRATORI."</a>
|
---|
187 | </td></tr><tr align=\"left\" bgcolor=\"$bgcolor1\"><td>
|
---|
188 | <a href=\"admin.php?op=consultazione&id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONE_ADM."</a><br>
|
---|
189 |
|
---|
190 | <a href=\"admin.php?op=rec_add_aff&id_cons_gen=$id_cons_gen\">$bullet"._AFFLUENZE."</a><br>
|
---|
191 | <a href=\"admin.php?op=associazioni&id_cons_gen=$id_cons_gen\">$bullet"._INSCOMUNE."</a>
|
---|
192 | </td></tr>";
|
---|
193 | # <a href=\"admin.php?op=backup&id_cons_gen=$id_cons_gen\">$bullet"._BACKUP."</a><br>
|
---|
194 | # <a href=\"admin.php?op=restore&id_cons_gen=$id_cons_gen\">$bullet"._RESTORE."</a>
|
---|
195 |
|
---|
196 | }
|
---|
197 | // Amministrazione locale solo superuser e adminuser
|
---|
198 | if ($perms>16 and ! $espandi) {
|
---|
199 | echo "
|
---|
200 | <tr bgcolor=\"$bgcolor1\">
|
---|
201 | <td valign=\"top\" align=\"center\" bgcolor=\"#000000\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._ADMIN."
|
---|
202 |
|
---|
203 | </b></font></font>
|
---|
204 |
|
---|
205 | </td>
|
---|
206 | <td valign=\"top\">";
|
---|
207 | if ($perms>32) {
|
---|
208 | echo "<a href=\"admin.php?op=cons_comuni&id_cons_gen=$id_cons_gen\">$bullet"._CONSULTAZIONI."</a><br>
|
---|
209 | <a href=\"admin.php?op=scarica&id_cons_gen=$id_cons_gen\">$bullet"._SCARICA."</a><br>";
|
---|
210 | # if($nrgruppo==0 and $nrlista==0)
|
---|
211 | echo "<a href=\"admin.php?op=importa&id_cons_gen=$id_cons_gen\">$bullet"._IMPORTA."</a><br>";
|
---|
212 | 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>";
|
---|
213 | }
|
---|
214 | echo "<a href=\"admin.php?op=come&vai=come&id_cons_gen=$id_cons_gen\">$bullet "._COME."</a> <br>
|
---|
215 | <a href=\"admin.php?op=numeri&vai=numeri&id_cons_gen=$id_cons_gen\">$bullet "._NUMERI."</a> <br>
|
---|
216 | <a href=\"admin.php?op=servizi&vai=servizi&id_cons_gen=$id_cons_gen\">$bullet "._SERVIZI."</a> <br>
|
---|
217 | <a href=\"admin.php?op=link&vai=link&id_cons_gen=$id_cons_gen\">$bullet "._LINK."</a> <br>
|
---|
218 | <a href=\"admin.php?op=circo&id_cons_gen=$id_cons_gen\">
|
---|
219 |
|
---|
220 | $bullet"._CIRCO."</a> <br>";
|
---|
221 | if ($nrcirco){
|
---|
222 | echo "<a href=\"admin.php?op=sede&id_cons_gen=$id_cons_gen\">$bullet "._SEDE."</a> <br>";
|
---|
223 | if ($nrsede){
|
---|
224 | echo "<a href=\"admin.php?op=sezione&id_cons_gen=$id_cons_gen\">$bullet "._SEZIONE."</a><br>";
|
---|
225 | }
|
---|
226 | }
|
---|
227 | if ($genere!=4) { //gestisce gruppi if ($tipo_cons!=8){ $genere!=2 and
|
---|
228 | echo "<a href=\"admin.php?op=gruppo&id_cons_gen=$id_cons_gen\">$bullet "._GRUPPO."</a><br>";
|
---|
229 | }
|
---|
230 |
|
---|
231 | if ($genere>2 or $genere==1){ ####prova
|
---|
232 | if ($genere==4 or $nrgruppo){ // or $tipo_cons==10 or $tipo_cons==11){
|
---|
233 | echo "
|
---|
234 | <a href=\"admin.php?op=lista&id_cons_gen=$id_cons_gen\">$bullet "._LISTA."</a> <br>";
|
---|
235 | if ($genere>2){ ####prova
|
---|
236 | if ($nrlista){
|
---|
237 | echo "<a href=\"admin.php?op=candidato&id_cons_gen=$id_cons_gen\">$bullet"._CANDIDATO."</a> <br>";
|
---|
238 | }else{
|
---|
239 | echo "$bullet "._CANDIDATO." ";
|
---|
240 | }
|
---|
241 | }
|
---|
242 | }else{
|
---|
243 | echo "
|
---|
244 | $bullet"._LISTA." <br>";
|
---|
245 | echo "$bullet "._CANDIDATO." <br>";
|
---|
246 |
|
---|
247 | }
|
---|
248 |
|
---|
249 | }
|
---|
250 |
|
---|
251 | echo "</td></tr>";
|
---|
252 | }
|
---|
253 |
|
---|
254 |
|
---|
255 | //Amministrazione normale operatore
|
---|
256 | echo "<tr bgcolor=\"$bgcolor1\">
|
---|
257 | <td valign=\"top\" align=\"center\" bgcolor=\"#000000\"><font face=\"Arial,Helvetica\" size=-1><font color=\"#ffffff\"><b>"._OPER."
|
---|
258 |
|
---|
259 | </b></font></font>
|
---|
260 |
|
---|
261 | </td>
|
---|
262 | <td valign=\"top\" width=\"150\">";
|
---|
263 | if ($op!='consultazione' and $perms>0 and $nrcirco and ($nrlista or $nrgruppo)) {
|
---|
264 | echo "<a href=\"admin.php?op=voti&id_cons_gen=$id_cons_gen&do=spoglio\">$bullet "._GEST." "._SPOGLIO."</a><br>";
|
---|
265 | if ($nraff) {
|
---|
266 | echo "<a href=\"admin.php?op=controllo_votanti&id_cons_gen=$id_cons_gen\">$bullet "._STATO." "._AFFLUENZE."</a><br>";
|
---|
267 | }else{
|
---|
268 | echo "<img src=\"modules/Elezioni/images/site.gif\" alt =\" \" align=\"center\" border=\"0\"> "._STATO." "._AFFLUENZE."<br>";
|
---|
269 | }
|
---|
270 | if ($nrvoti) {
|
---|
271 | echo "<a href=\"admin.php?op=controllo_voti&id_cons_gen=$id_cons_gen\">$bullet "._STATO." "._VOTI."</a><br>";
|
---|
272 | }else{
|
---|
273 | echo "<img src=\"modules/Elezioni/images/site.gif\" alt =\" \" align=\"middle\" border=\"0\"> "._STATO." "._VOTI."<br>";
|
---|
274 | }
|
---|
275 | echo "<a href=\"admin.php?op=riepilogo&id_cons_gen=$id_cons_gen\">$bullet "._RIEPILOGO."</a><br>";
|
---|
276 | }
|
---|
277 |
|
---|
278 |
|
---|
279 | echo "<br><a href=\"admin.php?op=cambiopwd&id_cons_gen=$id_cons_gen\">$bullet"._CAMBIOPWD."</a><br>";
|
---|
280 |
|
---|
281 | if (file_exists("../client/modules.php"))
|
---|
282 | 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>";
|
---|
283 |
|
---|
284 | //echo "<hr /><a href=\"../client/modules.php\" target=\"_blank\">$bullet Guarda il sito</a><br /><hr />";
|
---|
285 | echo "<a href=\"admin.php?op=logout\">$bullet "._ESCI."</a>";
|
---|
286 | echo "</td></tr></table>";
|
---|
287 | // continua la tabella su ele.voti con le sezioni
|
---|
288 | // altrimenti inizia la tabella centrale
|
---|
289 |
|
---|
290 | if ($op!="voti")
|
---|
291 | echo "</td></tr></table></td><td valign=\"top\" align=left>";
|
---|
292 |
|
---|
293 | }
|
---|
294 |
|
---|
295 | switch ($op){
|
---|
296 | case "ele":
|
---|
297 | ele();
|
---|
298 | global $language;
|
---|
299 | include("language/$language/ele.html");
|
---|
300 | echo"</td></tr></table>";
|
---|
301 | include("footer.php");
|
---|
302 |
|
---|
303 | break;
|
---|
304 |
|
---|
305 | }
|
---|
306 |
|
---|
307 |
|
---|
308 | ?>
|
---|