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 Come si vota, servizi, numeri e link */
|
---|
9 | /* Amministrazione */
|
---|
10 | /************************************************************************/
|
---|
11 |
|
---|
12 |
|
---|
13 | if (!defined('ADMIN_FILE')) {
|
---|
14 | die ("You can't access this file directly...");
|
---|
15 | }
|
---|
16 |
|
---|
17 | $aid=$_SESSION['aid'];
|
---|
18 | $dbi=$_SESSION['dbi'];
|
---|
19 | $prefix=$_SESSION['prefix'];
|
---|
20 | $currentlang=$_SESSION['lang'];
|
---|
21 | $id_comune=$_SESSION['id_comune'];
|
---|
22 | $param=strtolower($_SERVER['REQUEST_METHOD']) == 'get' ? $_GET : $_POST;
|
---|
23 | $id_cons_gen=$param['id_cons_gen'];
|
---|
24 | $perms=ChiSei(0);
|
---|
25 |
|
---|
26 |
|
---|
27 | if (isset($param['add_title'])) get_magic_quotes_gpc() ? $add_title=$param['add_title']:$add_title=addslashes($param['add_title']); else $add_title='';
|
---|
28 | if (isset($param['add_preamble'])) get_magic_quotes_gpc() ? $add_preamble=$param['add_preamble']:$add_preamble=addslashes($param['add_preamble']); else $add_preamble='';
|
---|
29 | if (isset($param['add_content'])) get_magic_quotes_gpc() ? $add_content=$param['add_content']:$add_content=addslashes($param['add_content']); else $add_content='';
|
---|
30 | if (isset($param['vai'])) get_magic_quotes_gpc() ? $vai=$param['vai']:$vai=addslashes($param['vai']); else $vai='come';
|
---|
31 | if (isset($param['mid'])) get_magic_quotes_gpc() ? $mid=$param['mid']:$mid=addslashes($param['mid']); else $mid='';
|
---|
32 | if (isset($param['ok'])) get_magic_quotes_gpc() ? $ok=$param['ok']:$ok=addslashes($param['ok']); else $ok='';
|
---|
33 | if (isset($param['op'])) get_magic_quotes_gpc() ? $op=$param['op']:$op=addslashes($param['op']); else $op='come';
|
---|
34 | $tab='_ele_'.$op;
|
---|
35 |
|
---|
36 | /*********************************************************/
|
---|
37 | /* come Functions */
|
---|
38 | /*********************************************************/
|
---|
39 | $sql="SELECT t1.descrizione,t1.tipo_cons,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'";
|
---|
40 | $res = mysql_query("$sql", $dbi);
|
---|
41 | list($descr_cons,$tipo_cons,$id_cons) = mysql_fetch_row($res);
|
---|
42 |
|
---|
43 | include("modules/Elezioni/ele.php");
|
---|
44 | include("inc/funzioni.php");
|
---|
45 |
|
---|
46 |
|
---|
47 | function come() {
|
---|
48 |
|
---|
49 | global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $id_cons, $tipo_cons, $id_cons,$id_cons_gen, $editimage1,
|
---|
50 | $add_content, $add_preamble, $add_title, $vai,$mid,$tab,$op,$editor;
|
---|
51 |
|
---|
52 | if ($tab=='_ele_come') echo "<center><font class=\"title\"><b>"._ADMINCOME."</b></font></center><br>";
|
---|
53 | elseif ($tab=='_ele_numeri') echo "<center><font class=\"title\"><b>"._ADMINNUMERI."</b></font></center><br>";
|
---|
54 | elseif ($tab=='_ele_servizi') echo "<center><font class=\"title\"><b>"._ADMINSERVIZI."</b></font></center><br>";
|
---|
55 | elseif ($tab=='_ele_link') echo "<center><font class=\"title\"><b>"._ADMINLINK."</b></font></center><br>";
|
---|
56 |
|
---|
57 | //echo "<br />";
|
---|
58 |
|
---|
59 |
|
---|
60 | echo "<center><font class=\"title\"><b>"._ALLCOME."</b></font><br/><br/>\n
|
---|
61 | <table border=\"0\" width=\"100%\" >\n
|
---|
62 | <td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._TITOLO."</b></td>\n
|
---|
63 | <td bgcolor=\"$bgcolor1\" align=\"center\"> <b>"._FUNZIONI."</b> </td></tr>\n";
|
---|
64 |
|
---|
65 |
|
---|
66 | $result = mysql_query("select mid, title,preamble, content, editimage from ".$prefix.$tab." where id_cons='$id_cons'", $dbi);
|
---|
67 | while(list($mid2, $title, $preamble, $content, $editimage) = mysql_fetch_row($result)) {
|
---|
68 |
|
---|
69 | echo "<tr>"
|
---|
70 | ."<td align=\"center\" width=\"100%\">$title</td>"
|
---|
71 | ."<td align=\"right\" nowrap bgcolor=\"$bgcolor1\"><a href=\"admin.php?op=$op&vai=editedit&mid=$mid2&id_cons_gen=$id_cons_gen\">
|
---|
72 | <img src=\"modules/Elezioni/images/edit.gif\" border=\"0\" align=\"middle\"> "._EDIT."</a> -
|
---|
73 | <a href=\"admin.php?op=$op&vai=deleteedit&mid=$mid2&id_cons_gen=$id_cons_gen\">"._DELETE."
|
---|
74 | <img src=\"modules/Elezioni/images/delete.gif\" border=\"0\" align=\"middle\"></a>"
|
---|
75 | ."</td></tr>";
|
---|
76 |
|
---|
77 | }
|
---|
78 | echo "</table><br/>";
|
---|
79 | echo "<table border=\"0\" width=\"100%\"><tr><td>";
|
---|
80 | echo "<br>";
|
---|
81 | if($vai=='editedit'){
|
---|
82 | $result = mysql_query("select title, preamble,content, editimage from ".$prefix.$tab." WHERE mid='$mid' AND id_cons='$id_cons'", $dbi);
|
---|
83 | list($add_title,$add_preamble, $add_content, $editimage) = mysql_fetch_row($result);
|
---|
84 | }
|
---|
85 | //25.05.2009
|
---|
86 | $sql="SELECT editor,ed_user FROM ".$prefix."_config";
|
---|
87 | $res = mysql_query("$sql", $dbi);
|
---|
88 | list($editor,$ed_user) = mysql_fetch_row($res);
|
---|
89 | //
|
---|
90 |
|
---|
91 | echo "<center><font class=\"title\"><b>"._ADDCOME."</b></font></center><br>";
|
---|
92 | echo "<form action=\"admin.php\" method=\"post\">";
|
---|
93 | echo "<br><b><h6>"._TITOLO.":</b><br>
|
---|
94 | <input class=\"modulo\" type=\"text\" name=\"add_title\" value=\"$add_title\" size=\"50\" maxlength=\"100\"><br><br>";
|
---|
95 | if ($op=="link"){
|
---|
96 | if ($add_preamble=='')$add_preamble="http://";
|
---|
97 | echo "<b>"._LINK.":</b><br>"
|
---|
98 | ."<input class=\"modulo\" name=\"add_preamble\" size=\"50\" value=\"$add_preamble\"><br><br><b>";
|
---|
99 | }else{
|
---|
100 | echo "<b>"._PREAMBOLO.":</b><br>";
|
---|
101 | //25 maggio 2009
|
---|
102 |
|
---|
103 | if ($editor=="1"){ // cambiato ckeditori giugno 2015
|
---|
104 | echo "<textarea class=\"modulo\" id=\"add_preamble\" name=\"add_preamble\" rows=\"7\" wrap=\"virtual\" cols=\"60\"></textarea><br><br><b>
|
---|
105 | <script type=\"text/javascript\">
|
---|
106 | CKEDITOR.replace('add_preamble');
|
---|
107 | </script>";
|
---|
108 | // old fckeditor
|
---|
109 | //js_textarea("add_preamble", "$add_preamble", "$ed_user", "80", "10"); // 25 --> 24 maggio 2009 editor'
|
---|
110 | }else{
|
---|
111 | echo "<textarea class=\"modulo\" name=\"add_preamble\" rows=\"7\" wrap=\"virtual\" cols=\"60\">$add_preamble</textarea><br><br><b>";
|
---|
112 | }
|
---|
113 |
|
---|
114 | //
|
---|
115 | echo "<br><br><b>";
|
---|
116 | }
|
---|
117 | if ($op=='come') echo _CONTENUTO;
|
---|
118 | elseif ($op=='numeri') echo _NUMERITEL;
|
---|
119 | elseif ($op=='servizi') echo _DESCRAPP;
|
---|
120 | elseif ($op=='link') echo _DESCRLINK;
|
---|
121 | echo ":</b><br>";
|
---|
122 | //( "._HELPHTML." )<br>";
|
---|
123 | //25 maggio 2009
|
---|
124 |
|
---|
125 | if ($editor=="1")
|
---|
126 | echo "<textarea class=\"modulo\" id= \"add_content\" name=\"add_content\" rows=\"15\" wrap=\"virtual\" cols=\"60\"></textarea><br><br>
|
---|
127 | <script type=\"text/javascript\">
|
---|
128 | CKEDITOR.replace('add_content');
|
---|
129 | </script>";
|
---|
130 |
|
---|
131 | // js_textarea("add_content", "$add_content", "$ed_user", "80", "20"); // 25 -->24 maggio 2009 editor old
|
---|
132 | else
|
---|
133 | echo "<textarea class=\"modulo\" name=\"add_content\" rows=\"15\" wrap=\"virtual\" cols=\"60\">$add_content</textarea><br><br>";
|
---|
134 | //
|
---|
135 | echo "<br/><br/>";
|
---|
136 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">"
|
---|
137 | ."<input type=\"hidden\" name=\"mid\" value=\"$mid\">"
|
---|
138 | ."<input type=\"hidden\" name=\"tab\" value=\"$tab\">"
|
---|
139 | ."<input type=\"hidden\" name=\"op\" value=\"$op\">";
|
---|
140 | if ($vai=='editedit'){
|
---|
141 | echo "<input type=\"hidden\" name=\"vai\" value=\"saveedit\">"
|
---|
142 | ."<input class=\"modulo-button\"type=\"submit\" value=\""._OK."\">";
|
---|
143 | }else{
|
---|
144 | echo "<input type=\"hidden\" name=\"vai\" value=\"addedit\">"
|
---|
145 | ."<input class=\"modulo-button\" type=\"submit\" value=\""._ADDCOME."\">";
|
---|
146 | }
|
---|
147 |
|
---|
148 | echo "</form>";
|
---|
149 | echo "</td></tr></table></center>";
|
---|
150 | echo"</td></tr></table>";
|
---|
151 | include ("footer.php");
|
---|
152 | }
|
---|
153 |
|
---|
154 | function saveedit($mid, $title, $preamble, $content) {
|
---|
155 | global $prefix, $dbi,$id_cons,$id_cons_gen,$tab,$op;
|
---|
156 |
|
---|
157 | $temp=$title.$preamble.$content;
|
---|
158 | if (preg_match("/script/i",$temp)) die("La parola script e' proibita, devi toglierla dal testo.");
|
---|
159 | $result = mysql_query("update ".$prefix.$tab." set title='$title', preamble='$preamble', content='$content' WHERE mid='$mid' AND id_cons='$id_cons'", $dbi);
|
---|
160 | Header("Location: admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen");
|
---|
161 | }
|
---|
162 |
|
---|
163 | function addedit($add_title, $add_preamble, $add_content) {
|
---|
164 | global $prefix, $dbi,$id_cons, $id_cons_gen,$tab,$op;
|
---|
165 |
|
---|
166 | $result = mysql_query("insert into ".$prefix.$tab." (id_cons,title,preamble,content) values ('$id_cons', '$add_title', '$add_preamble','$add_content')", $dbi);
|
---|
167 | if (!$result) {
|
---|
168 | exit();
|
---|
169 | }
|
---|
170 | Header("Location: admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen");
|
---|
171 | }
|
---|
172 |
|
---|
173 |
|
---|
174 | function deleteedit($mid, $ok=0) {
|
---|
175 | global $prefix, $dbi, $id_cons,$id_cons_gen,$tab,$op;
|
---|
176 | if($ok) {
|
---|
177 | $result = mysql_query("delete from ".$prefix.$tab." where mid=$mid and id_cons='$id_cons'", $dbi);
|
---|
178 | if (!$result) {
|
---|
179 | return;
|
---|
180 | }
|
---|
181 | Header("Location: admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen");
|
---|
182 | } else {
|
---|
183 | ele();
|
---|
184 | OpenTable();
|
---|
185 | echo "<center><font size=\"4\"><b>"._ADMINCOME."</b></font></center>";
|
---|
186 | CloseTable();
|
---|
187 | echo "<br>";
|
---|
188 | OpenTable();
|
---|
189 | echo "<center>"._REMOVEINFO."";
|
---|
190 | echo "<br><br>[ <a href=\"admin.php?op=$op&vai=come&id_cons_gen=$id_cons_gen\">"._NO."</a> | <a href=\"admin.php?op=$op&vai=deleteedit&mid=$mid&ok=1&id_cons_gen=$id_cons_gen\">"._YES."</a> ]</center>";
|
---|
191 | CloseTable();
|
---|
192 | echo"</td></tr></table>";
|
---|
193 | include("footer.php");
|
---|
194 | }
|
---|
195 |
|
---|
196 |
|
---|
197 |
|
---|
198 | }
|
---|
199 | switch ($vai){
|
---|
200 |
|
---|
201 | // or "come" or "servizi" or "editedit"
|
---|
202 | case "come":
|
---|
203 | ele();
|
---|
204 | come();
|
---|
205 | break;
|
---|
206 | case "editedit":
|
---|
207 | ele();
|
---|
208 | come();
|
---|
209 | break;
|
---|
210 |
|
---|
211 | case "saveedit":
|
---|
212 | saveedit($mid, $add_title, $add_preamble,$add_content);
|
---|
213 | break;
|
---|
214 |
|
---|
215 | case "numeri":
|
---|
216 | ele();
|
---|
217 | come();
|
---|
218 | break;
|
---|
219 |
|
---|
220 | case "servizi":
|
---|
221 | ele();
|
---|
222 | come();
|
---|
223 | break;
|
---|
224 |
|
---|
225 | case "link":
|
---|
226 | ele();
|
---|
227 | come();
|
---|
228 | break;
|
---|
229 |
|
---|
230 |
|
---|
231 |
|
---|
232 | case "addedit":
|
---|
233 | addedit($add_title, $add_preamble,$add_content);
|
---|
234 | break;
|
---|
235 |
|
---|
236 | case "deleteedit":
|
---|
237 | deleteedit($mid, $ok);
|
---|
238 | break;
|
---|
239 |
|
---|
240 |
|
---|
241 |
|
---|
242 | }
|
---|
243 |
|
---|
244 | ?>
|
---|