PluginProbe
ANAC XML Bandi di Gara / 2.2
ANAC XML Bandi di Gara v2.2
7.8 trunk 0.1 1.0.0.1 1.0.1 1.0.2 1.0.3 1.0.4 1.1 1.1.1 1.1.2 2.0 2.0.1 2.0.2 2.0.3 2.1 2.2 2.3 2.3.1 3 3.0.1 3.1 3.1.1 3.1.2 3.1.3 All 57 releases
avcp / settings.php

settings.php in ANAC XML Bandi di Gara 2.2, at settings.php

352 lines 14.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 function get_meta_values( $key = '', $type = 'avcp', $status = 'publish' ) {
4 global $wpdb;
5 if( empty( $key ) )
6 return;
7 $r = $wpdb->get_col( $wpdb->prepare( "
8 SELECT pm.meta_value FROM {$wpdb->postmeta} pm
9 LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id
10 WHERE pm.meta_key = '%s'
11 AND p.post_status = '%s'
12 AND p.post_type = '%s'
13 ", $key, $status, $type ) );
14 return $r;
15 }
16
17 /* =========== Settings Menu ============ */
18 add_action('admin_menu', 'avcp_setting_menu');
19 add_action('admin_init', 'avcp_reg_settings');
20 if ( is_admin() ){ // admin actions
21
22 } else {
23 // non-admin enqueues, actions, and filters
24 }
25
26 function avcp_reg_settings() {
27 register_setting( 'avcp_options', 'avcp_version_number'); update_option( 'avcp_version_number', '2.2' );
28 register_setting( 'avcp_options', 'avcp_denominazione_ente');
29 register_setting( 'avcp_options', 'avcp_codicefiscale_ente');
30 register_setting( 'avcp_options', 'avcp_autopublish');
31 register_setting( 'avcp_options', 'avcp_dis_archivioditte');
32 register_setting( 'avcp_options', 'avcp_dis_archivioanni');
33 register_setting( 'avcp_options', 'avcp_tab_jqueryui');
34 register_setting( 'avcp_options', 'avcp_showxml');
35 register_setting( 'avcp_options', 'avcp_showlove');
36 register_setting( 'avcp_options', 'avcp_invalid');
37 }
38
39 function avcp_setting_menu()
40 {
41 add_submenu_page('edit.php?post_type=avcp', 'Impostazioni', 'Impostazioni', 'manage_options', 'avcp_settings', 'avcp_settings_menu');
42 }
43
44 function avcp_settings_menu()
45 {
46 if (!current_user_can('manage_options')) {
47 wp_die(__('You do not have sufficient permissions to access this page.'));
48 }
49
50 if(isset($_POST['XMLgenBUTTON'])) {
51 $terms = get_terms( 'annirif', array('hide_empty' => 0) );
52 $count = count($terms);
53 if ( $count > 0 ){
54 foreach ( $terms as $term ) {
55 creafilexml ($term->name);
56 $verificafilecreati = $term->name . ' - ' . $verificafilecreati;
57 echo '<div class="updated"><p>';
58 printf(__('AVCP | Il seguente file .xml è generato: <b>' . $term->name . '</b>'));
59 echo "</p></div>";
60 }
61 } else {
62 echo '<div class="error"><p>';
63 printf(__('AVCP | Impossibile creare il file .xml!<br/>Controlla che sia presente qualche gara e che siano collegate al proprio "Anno di Riferimento"...'));
64 echo "</p></div>";
65 }
66 }
67
68 if(isset($_POST['Submit'])) {
69 $get_avcp_denominazione_ente = $_POST["avcp_denominazione_ente_n"];
70 update_option( 'avcp_denominazione_ente', $get_avcp_denominazione_ente );
71 $get_avcp_codicefiscale_ente = $_POST["avcp_codicefiscale_ente_n"];
72 update_option( 'avcp_codicefiscale_ente', $get_avcp_codicefiscale_ente );
73 if (isset($_POST['avcp_autopublish_n'])){
74 update_option('avcp_autopublish', '1');
75 } else {
76 update_option('avcp_autopublish', '0');
77 }
78 if (isset($_POST['avcp_dis_archivioditte_n'])){
79 update_option('avcp_dis_archivioditte', '0'); //Invertito
80 } else {
81 update_option('avcp_dis_archivioditte', '1');
82 }
83 if (isset($_POST['avcp_dis_archivioanni_n'])){
84 update_option('avcp_dis_archivioanni', '0'); //Invertito
85 } else {
86 update_option('avcp_dis_archivioanni', '1');
87 }
88 if (isset($_POST['avcp_dis_styledbackend_n'])){
89 update_option('avcp_dis_styledbackend', '0'); //Invertito
90 } else {
91 update_option('avcp_dis_styledbackend', '1');
92 }
93 if (isset($_POST['avcp_tab_jqueryui_n'])){
94 update_option('avcp_tab_jqueryui', '1');
95 } else {
96 update_option('avcp_tab_jqueryui', '0');
97 }
98 if (isset($_POST['avcp_showxml_n'])){
99 update_option('avcp_showxml', '1');
100 } else {
101 update_option('avcp_showxml', '0');
102 }
103 if (isset($_POST['avcp_showlove_n'])){
104 update_option('avcp_showlove', '1');
105 } else {
106 update_option('avcp_showlove', '0');
107 }
108 }
109
110 echo '<div class="wrap">';
111 screen_icon();
112 printf(
113 '
114 <div style="float:right;">
115 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
116 <input type="hidden" name="cmd" value="_s-xclick">
117 <input type="hidden" name="hosted_button_id" value="F2JK36SCXKTE2">
118 <input type="image" src="https://www.paypalobjects.com/it_IT/IT/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - Il metodo rapido, affidabile e innovativo per pagare e farsi pagare.">
119 <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
120 </form>
121 </div>
122
123 <h2>AVCP XML v' . get_option('avcp_version_number') . ' <a href="http://wordpress.org/plugins/avcp/installation/" target="_blank" class="add-new-h2">Installazione</a><a href="http://supporto.marcomilesi.ml/" target="_blank" class="add-new-h2">Forum di Supporto</a><a href="http://wordpress.org/plugins/avcp/changelog/" target="_blank" class="add-new-h2">CHANGELOG</a></h2>'
124 );
125
126 // SYSTEM CHECK
127 echo '<form method="post" name="options" target="_self">';
128 settings_fields('avcp_options');
129 echo '<div id="welcome-panel" style="margin:10px;width:50%;float:left;" class="welcome-panel">
130 <h3><span>Generazione file .xml</span></h3>
131 I file .xml generati sono pubblicamente accessibili all\'indirizzo <b><a href="' . get_site_url() . '/avcp' . '" target="_blank">' . get_site_url() . '/avcp' . '</a>*</b><br/>';
132
133 echo'<p style="text-align:center;" class="submit"><input type="submit" class="button-primary" name="XMLgenBUTTON" value="Crea Dataset" /><br/><br/><br/><font style="color:red;">*Attenzione! Questa funzione non sostituisce la comunicazione obbligatoria dell\'url del file .xml ad AVCP, secondo le disposizioni normative vigenti.</font></p>';
134
135 echo '</div>';
136 echo '
137 <div id="alert" style="margin:10px;width:40%;float:left;" class="welcome-panel">
138 <h3><span>System Check-UP</span></h3>';
139
140 $dir = ABSPATH . 'avcp';
141 $file = $dir . '/index.php';
142 echo '<br/>';
143 $system_ok = true;
144 if(is_dir($dir)) {
145 echo 'Presenza cartella /avcp<font style="color:green;font-weight:bold;"> ==> OK</font>';
146 } else {
147 echo 'Presenza cartella /avcp<font style="color:red;font-weight:bold;"> ==> NON TROVATA</font>';
148 $system_ok = false;
149 }
150 echo '<br/>';
151 if (is_writeable($dir)) {
152 echo 'Permessi scrittura cartella /avcp<font style="color:green;font-weight:bold;"> ==> OK</font>';
153 } else {
154 echo 'Permessi scrittura cartella /avcp<font style="color:red;font-weight:bold;"> ==> NON CORRISPONDENTI</font>';
155 $system_ok = false;
156 }
157 echo '<br/>';
158
159 if (file_exists($file)) {
160 echo 'Presenza index.php /avcp<font style="color:green;font-weight:bold;"> ==> OK</font>';
161 } else {
162 echo 'Presenza index.php /avcp<font style="color:red;font-weight:bold;"> ==> NON TROVATO</font>';
163 $system_ok = false;
164 }
165 echo '<br/>';
166
167 $urlcheck = get_site_url() . '/avcp/index.php';
168
169 $agent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; pt-pt) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27";
170
171 // initializes curl session
172 $ch=curl_init();
173
174 // sets the URL to fetch
175 curl_setopt ($ch, CURLOPT_URL,$urlcheck );
176
177 // sets the content of the User-Agent header
178 curl_setopt($ch, CURLOPT_USERAGENT, $agent);
179
180 // return the transfer as a string
181 curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
182
183 // disable output verbose information
184 curl_setopt ($ch,CURLOPT_VERBOSE,false);
185
186 // max number of seconds to allow cURL function to execute
187 curl_setopt($ch, CURLOPT_TIMEOUT, 5);
188
189 curl_exec($ch);
190
191 // get HTTP response code
192 $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
193
194 curl_close($ch);
195
196 if($httpcode==200) {
197 echo 'Test Accesso pubblico /avcp<font style="color:green;font-weight:bold;"> ==> OK [200]</font>';
198 } else if($httpcode==500) {
199 echo 'Test Accesso pubblico /avcp<font style="color:red;font-weight:bold;"> ==> ERRORE 500 ISE</font>';
200 $headers = get_headers($urlcheck);
201 echo ' - ' . $headers[0];
202 $system_ok = false;
203 } else {
204 echo 'Test Accesso pubblico /avcp<font style="color:red;font-weight:bold;"> ==> ERRORE ' . $httpcode . '</font>';
205 $headers = get_headers($urlcheck);
206 echo ' - ' . $headers[0];
207 $system_ok = false;
208 }
209
210
211 echo '<h4>Esito:</h4>';
212 if ($system_ok) {
213 echo 'Nessun problema tecnico rilevato con il server. Molto bene!';
214 } else {
215 echo '
216 <style>
217 #alert {
218 background: white url(' . plugin_dir_url(__FILE__) . 'includes/alert.jpg) no-repeat center;
219 }
220 </style>';
221 echo 'Sono stati trovati alcuni problemi <b>critici</b>. Affinchè AVCP funzioni correttamente è necessario risolvere al più presto questi problemi. Consultare la documentazione del plugin per conoscere le cause più probabili di questo problema!';
222 }
223 echo '</div>
224 <div class="clear"></div>';
225
226 //Qui inizia la sezione delle impostazioni
227
228 echo '
229 <div class="postbox-container" style="width: 100%">
230 <div class="metabox-holder">
231
232 <div class="postbox" id="second">
233 <h3 class="hndle"><span>Impostazioni Ente</span></h3>
234 <div class="inside">
235
236 <table class="form-table"><tbody>';
237
238 echo '<tr>';
239 echo '<th><label>Denominazione Ente</label></th>';
240 echo '<td><input type="text" name="avcp_denominazione_ente_n" value="'; echo get_option('avcp_denominazione_ente'); echo '" class="regular-text">';
241 echo '<span class="description">Inserire la denominazione dell\'Ente # massimo 250 caratteri</span></td>';
242 echo '</tr>';
243
244 echo '<tr>';
245 echo '<th><label>Codice Fiscale Ente</label></th>';
246 echo '<td><input type="text" name="avcp_codicefiscale_ente_n" value="'; echo get_option('avcp_codicefiscale_ente'); echo '" class="regular-text">';
247 echo '<span class="description">Inserire il codice fiscale/partita iva dell\'ente # 9 caratteri.</span></td>';
248 echo '</tr>';
249
250 echo '<tr>';
251 echo '<th><label>.XML Automatico</label></th>';
252 echo '<td><input type="checkbox" name="avcp_autopublish_n" ';
253 $get_avcp_autopublish = get_option('avcp_autopublish');
254 if ($get_avcp_autopublish == '1') {
255 echo 'checked="checked" ';
256 }
257 echo '><span class="description">Spunta questa casella se vuoi generare aggiungere automaticamente le gare al corrispettivo file .xml (in base all\'anno di riferimento impostato).<br/><small>Attenzione! Con questa funzione ad ogni nuova pubblicazione viene ricreato solo file .xml relativo all\'anno di riferimento della gara. Per creare i file .xml relativi ad ogni anno di riferimento è comunque necessario cliccare sul pulsante di questa pagina, in alto.</small></span></td>';
258 echo '</tr>';
259
260 echo'</tbody></table>
261 </div></div>';
262
263 echo '
264 <div class="postbox" id="second">
265 <h3 class="hndle"><span>Impostazioni Tabella</span></h3>
266 <div class="inside">
267
268 <table class="form-table"><tbody>';
269
270 echo '<tr>';
271 echo '<th><label>JQuery UI</label></th>';
272 echo '<td><input type="checkbox" name="avcp_tab_jqueryui_n" ';
273 $get_avcp_tab_jqueryui = get_option('avcp_tab_jqueryui');
274 if ($get_avcp_tab_jqueryui == '1') {
275 echo 'checked="checked" ';
276 }
277 echo '><span class="description">Spunta questa casella se vuoi abilitare il tema jQueryUI Themeroller per la tabella</span></td>';
278 echo '</tr>';
279
280 echo '<tr>';
281 echo '<th><label>Mostra Link XML</label></th>';
282 echo '<td><input type="checkbox" name="avcp_showxml_n" ';
283 $get_avcp_showxml = get_option('avcp_showxml');
284 if ($get_avcp_showxml == '1') {
285 echo 'checked="checked" ';
286 }
287 echo '><span class="description">Spunta questa casella se vuoi mostrare il collegamento alla pagina dei file .xml generati (vedi in alto)</span></td>';
288 echo '</tr>';
289
290 echo '<tr>';
291 echo '<th><label>Mostra un po\' di Amore</label></th>';
292 echo '<td><input type="checkbox" name="avcp_showlove_n" ';
293 $get_avcp_showlove = get_option('avcp_showlove');
294 if ($get_avcp_showlove == '1') {
295 echo 'checked="checked" ';
296 }
297 echo '><span class="description">Spunta questa casella se vuoi mostrare il link al plugin sotto alla tabella generata</span></td>';
298 echo '</tr>';
299
300 echo '</tbody></table>
301 </div></div>';
302
303 echo '
304 <div class="postbox" id="second">
305 <h3 class="hndle"><span>Visualizzazioni archivio</span></h3>
306 <div class="inside">
307
308 <table class="form-table"><tbody>';
309
310 echo '<tr>';
311 echo '<th><label>Archivio Ditte</label></th>';
312 echo '<td><input type="checkbox" name="avcp_dis_archivioditte_n" ';
313 $get_avcp_dis_archivioditte = get_option('avcp_dis_archivioditte');
314 if ($get_avcp_dis_archivioditte == '0') {
315 echo 'checked="checked" ';
316 }
317 echo '><span class="description">Abilita i link con la visualizzazione archivio delle ditte con i bandi a cui la ditta ha partecipato</span></td>';
318 echo '</tr>';
319
320 echo '<tr>';
321 echo '<th><label>Archivio Annuale</label></th>';
322 echo '<td><input type="checkbox" name="avcp_dis_archivioanni_n" ';
323 $get_avcp_dis_archivioanni = get_option('avcp_dis_archivioanni');
324 if ($get_avcp_dis_archivioanni == '0') {
325 echo 'checked="checked" ';
326 }
327 echo '><span class="description">Abilita i link con la visualizzazione archivio su base annuale dei bandi</span></td>';
328 echo '</tr>';
329
330 echo '</tbody></table>
331 </div></div>';
332
333 echo '</div></div>
334 <p class="submit"><input type="submit" class="button-primary" name="Submit" value="AGGIORNA IMPOSTAZIONI" /></p>';
335
336 echo '</form>';
337
338 //Qui finisce la sezione delle impostazione
339
340 echo '<center><h3>Scopri gli altri plugin pensati per la Pubblica Amministrazione</h3>
341 <hr/>
342 <a href="http://wordpress.org/plugins/amministrazione-trasparente" target="_blank" title="Plugin Wordpress per la gestione della sezione AMMINISTRAZIONE TRASPARENTE prevista dal d.lgs 33/2013">
343 <img src="' . plugin_dir_url(__FILE__) . 'includes/at.png"/></a>
344 <hr/>
345 <a href="http://wordpress.org/plugins/amministrazione-aperta/" target="_blank" title="Plugin Wordpress per la gestione di Spese, Contributi, Concessioni, Incarichi...">
346 <img src="' . plugin_dir_url(__FILE__) . 'includes/aa.png"/></a>
347 <hr/>
348 Sviluppo e ideazione Wordpress a cura di <a href="http://marcomilesi.ml" target="_blank" title="www.marcomilesi.ml">Marco Milesi</a><br/><small>Per la preparazione di questo programma sono state impiegate diverse ore a titolo volontario. Se vuoi, puoi effettuare una piccola donazione utilizzando il link che trovi in alto a destra.<br/>Per qualsiasi informazione e per segnalare un problema è attivo il forum di supporto su <a href="http://supporto.marcomilesi.ml/" target="_blank" title="supporto.marcomilesi.ml">supporto.marcomilesi.ml</a></small></center>
349 </div>';
350
351 }
352 ?>