PluginProbe
ANAC XML Bandi di Gara / 3
ANAC XML Bandi di Gara v3
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 3, at settings.php

374 lines 15.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', '3.0' );
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 register_setting( 'avcp_options', 'avcp_abilita_ruoli');
38 }
39
40 function avcp_setting_menu()
41 {
42 add_submenu_page('edit.php?post_type=avcp', 'Impostazioni', 'Impostazioni', 'manage_options', 'avcp_settings', 'avcp_settings_menu');
43 }
44
45 function avcp_settings_menu()
46 {
47 if (!current_user_can('manage_options')) {
48 wp_die(__('You do not have sufficient permissions to access this page.'));
49 }
50
51 if(isset($_POST['XMLgenBUTTON'])) {
52 $terms = get_terms( 'annirif', array('hide_empty' => 0) );
53 $count = count($terms);
54 if ( $count > 0 ){
55 foreach ( $terms as $term ) {
56 creafilexml ($term->name);
57 $verificafilecreati = $term->name . ' - ' . $verificafilecreati;
58 echo '<div class="updated"><p>';
59 printf(__('AVCP | Il seguente file .xml รจ generato: <b>' . $term->name . '</b>'));
60 echo "</p></div>";
61 }
62 } else {
63 echo '<div class="error"><p>';
64 printf(__('AVCP | Impossibile creare il file .xml!<br/>Controlla che sia presente qualche gara e che siano collegate al proprio "Anno di Riferimento"...'));
65 echo "</p></div>";
66 }
67 }
68
69 if(isset($_POST['Submit'])) {
70 $get_avcp_denominazione_ente = $_POST["avcp_denominazione_ente_n"];
71 update_option( 'avcp_denominazione_ente', $get_avcp_denominazione_ente );
72 $get_avcp_codicefiscale_ente = $_POST["avcp_codicefiscale_ente_n"];
73 update_option( 'avcp_codicefiscale_ente', $get_avcp_codicefiscale_ente );
74 if (isset($_POST['avcp_autopublish_n'])){
75 update_option('avcp_autopublish', '1');
76 } else {
77 update_option('avcp_autopublish', '0');
78 }
79 if (isset($_POST['avcp_dis_archivioditte_n'])){
80 update_option('avcp_dis_archivioditte', '0'); //Invertito
81 } else {
82 update_option('avcp_dis_archivioditte', '1');
83 }
84 if (isset($_POST['avcp_dis_archivioanni_n'])){
85 update_option('avcp_dis_archivioanni', '0'); //Invertito
86 } else {
87 update_option('avcp_dis_archivioanni', '1');
88 }
89 if (isset($_POST['avcp_dis_styledbackend_n'])){
90 update_option('avcp_dis_styledbackend', '0'); //Invertito
91 } else {
92 update_option('avcp_dis_styledbackend', '1');
93 }
94 if (isset($_POST['avcp_tab_jqueryui_n'])){
95 update_option('avcp_tab_jqueryui', '1');
96 } else {
97 update_option('avcp_tab_jqueryui', '0');
98 }
99 if (isset($_POST['avcp_showxml_n'])){
100 update_option('avcp_showxml', '1');
101 } else {
102 update_option('avcp_showxml', '0');
103 }
104 if (isset($_POST['avcp_showlove_n'])){
105 update_option('avcp_showlove', '1');
106 } else {
107 update_option('avcp_showlove', '0');
108 }
109 if (isset($_POST['avcp_abilita_ruoli_n'])){
110 update_option('avcp_abilita_ruoli', '1');
111 } else {
112 update_option('avcp_abilita_ruoli', '0');
113 }
114 }
115
116 echo '<div class="wrap">';
117 screen_icon();
118 printf(
119 '
120 <div style="float:right;">
121 <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
122 <input type="hidden" name="cmd" value="_s-xclick">
123 <input type="hidden" name="hosted_button_id" value="F2JK36SCXKTE2">
124 <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.">
125 <img alt="" border="0" src="https://www.paypalobjects.com/it_IT/i/scr/pixel.gif" width="1" height="1">
126 </form>
127 </div>
128
129 <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>'
130 );
131
132 // SYSTEM CHECK
133 echo '<form method="post" name="options" target="_self">';
134 settings_fields('avcp_options');
135 echo '<div id="welcome-panel" style="margin:10px;width:50%;float:left;" class="welcome-panel">
136 <h3><span>Generazione file .xml</span></h3>
137 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/>';
138
139 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>';
140
141 echo '</div>';
142 echo '
143 <div id="alert" style="margin:10px;width:40%;float:left;" class="welcome-panel">
144 <h3><span>System Check-UP</span></h3>';
145
146 $dir = ABSPATH . 'avcp';
147 $file = $dir . '/index.php';
148 echo '<br/>';
149 $system_ok = true;
150 if(is_dir($dir)) {
151 echo 'Presenza cartella /avcp<font style="color:green;font-weight:bold;"> ==> OK</font>';
152 } else {
153 echo 'Presenza cartella /avcp<font style="color:red;font-weight:bold;"> ==> NON TROVATA</font>';
154 $system_ok = false;
155 }
156 echo '<br/>';
157 if (is_writeable($dir)) {
158 echo 'Permessi scrittura cartella /avcp<font style="color:green;font-weight:bold;"> ==> OK</font>';
159 } else {
160 echo 'Permessi scrittura cartella /avcp<font style="color:red;font-weight:bold;"> ==> NON CORRISPONDENTI</font>';
161 $system_ok = false;
162 }
163 echo '<br/>';
164
165 if (file_exists($file)) {
166 echo 'Presenza index.php /avcp<font style="color:green;font-weight:bold;"> ==> OK</font>';
167 } else {
168 echo 'Presenza index.php /avcp<font style="color:red;font-weight:bold;"> ==> NON TROVATO</font>';
169 $system_ok = false;
170 }
171 echo '<br/>';
172
173 $urlcheck = get_site_url() . '/avcp/index.php';
174
175 $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";
176
177 if(is_callable('curl_init')){
178
179 // initializes curl session
180 $ch=curl_init();
181
182 // sets the URL to fetch
183 curl_setopt ($ch, CURLOPT_URL,$urlcheck );
184
185 // sets the content of the User-Agent header
186 curl_setopt($ch, CURLOPT_USERAGENT, $agent);
187
188 // return the transfer as a string
189 curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
190
191 // disable output verbose information
192 curl_setopt ($ch,CURLOPT_VERBOSE,false);
193
194 // max number of seconds to allow cURL function to execute
195 curl_setopt($ch, CURLOPT_TIMEOUT, 5);
196
197 curl_exec($ch);
198
199 // get HTTP response code
200 $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
201
202 curl_close($ch);
203
204 if($httpcode==200) {
205 echo 'Test Accesso pubblico /avcp<font style="color:green;font-weight:bold;"> ==> OK [200]</font>';
206 } else if($httpcode==500) {
207 echo 'Test Accesso pubblico /avcp<font style="color:red;font-weight:bold;"> ==> ERRORE 500 ISE</font>';
208 $headers = get_headers($urlcheck);
209 echo ' - ' . $headers[0];
210 $system_ok = false;
211 } else {
212 echo 'Test Accesso pubblico /avcp<font style="color:red;font-weight:bold;"> ==> ERRORE ' . $httpcode . '</font>';
213 $headers = get_headers($urlcheck);
214 echo ' - ' . $headers[0];
215 $system_ok = false;
216 }
217 } else {
218 echo 'Test Accesso pubblico /avcp<font style="color:red;font-weight:bold;"> ==> CURL_INIT MANCANTE</font>';
219 $system_ok = false;
220 }
221
222
223 echo '<h4>Esito:</h4>';
224 if ($system_ok) {
225 echo 'Nessun problema tecnico rilevato con il server. Molto bene!';
226 } else {
227 echo '
228 <style>
229 #alert {
230 background: white url(' . plugin_dir_url(__FILE__) . 'includes/alert.jpg) no-repeat center;
231 }
232 </style>';
233 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!';
234 }
235 echo '</div>
236 <div class="clear"></div>';
237
238 //Qui inizia la sezione delle impostazioni
239
240 echo '
241 <div class="postbox-container" style="width: 100%">
242 <div class="metabox-holder">
243
244 <div class="postbox" id="second">
245 <h3 class="hndle"><span>Impostazioni Ente</span></h3>
246 <div class="inside">
247
248 <table class="form-table"><tbody>';
249
250 echo '<tr>';
251 echo '<th><label>Denominazione Ente</label></th>';
252 echo '<td><input type="text" name="avcp_denominazione_ente_n" value="'; echo get_option('avcp_denominazione_ente'); echo '" class="regular-text">';
253 echo '<span class="description">Inserire la denominazione dell\'Ente # massimo 250 caratteri</span></td>';
254 echo '</tr>';
255
256 echo '<tr>';
257 echo '<th><label>Codice Fiscale Ente</label></th>';
258 echo '<td><input type="text" name="avcp_codicefiscale_ente_n" value="'; echo get_option('avcp_codicefiscale_ente'); echo '" class="regular-text">';
259 echo '<span class="description">Inserire il codice fiscale/partita iva dell\'ente # 9 caratteri.</span></td>';
260 echo '</tr>';
261
262 echo '<tr>';
263 echo '<th><label>.XML Automatico</label></th>';
264 echo '<td><input type="checkbox" name="avcp_autopublish_n" ';
265 $get_avcp_autopublish = get_option('avcp_autopublish');
266 if ($get_avcp_autopublish == '1') {
267 echo 'checked="checked" ';
268 }
269 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>';
270 echo '</tr>';
271
272 echo'</tbody></table>
273 </div></div>';
274
275 echo '
276 <div class="postbox" id="second">
277 <h3 class="hndle"><span>Impostazioni Varie</span></h3>
278 <div class="inside">
279
280 <table class="form-table"><tbody>';
281
282 echo '<tr>';
283 echo '<th><label>JQuery UI</label></th>';
284 echo '<td><input type="checkbox" name="avcp_tab_jqueryui_n" ';
285 $get_avcp_tab_jqueryui = get_option('avcp_tab_jqueryui');
286 if ($get_avcp_tab_jqueryui == '1') {
287 echo 'checked="checked" ';
288 }
289 echo '><span class="description">Spunta questa casella se vuoi abilitare il tema jQueryUI Themeroller per la tabella</span></td>';
290 echo '</tr>';
291
292 echo '<tr>';
293 echo '<th><label>Ruoli & Permessi</label></th>';
294 echo '<td><input type="checkbox" name="avcp_abilita_ruoli_n" ';
295 $get_avcp_abilita_ruoli = get_option('avcp_abilita_ruoli');
296 if ($get_avcp_abilita_ruoli == '1') {
297 echo 'checked="checked" ';
298 }
299 echo '><span class="description">Le voci di AVCP ereditano i permessi di pubblicazione/modifica/eliminazione degli articoli. Se vuoi avere un maggior controllo abilita questa opzione e segui <a href="http://supporto.marcomilesi.ml/?p=571" target="_blank" title="Istruzioni per la configurazione di Ruoli & Permessi">questo tutorial</span></td>';
300 echo '</tr>';
301
302 echo '<tr>';
303 echo '<th><label>Mostra Link XML</label></th>';
304 echo '<td><input type="checkbox" name="avcp_showxml_n" ';
305 $get_avcp_showxml = get_option('avcp_showxml');
306 if ($get_avcp_showxml == '1') {
307 echo 'checked="checked" ';
308 }
309 echo '><span class="description">Spunta questa casella se vuoi mostrare il collegamento alla pagina dei file .xml generati (vedi in alto)</span></td>';
310 echo '</tr>';
311
312 echo '<tr>';
313 echo '<th><label>Mostra un po\' di Amore</label></th>';
314 echo '<td><input type="checkbox" name="avcp_showlove_n" ';
315 $get_avcp_showlove = get_option('avcp_showlove');
316 if ($get_avcp_showlove == '1') {
317 echo 'checked="checked" ';
318 }
319 echo '><span class="description">Spunta questa casella se vuoi mostrare il link al plugin sotto alla tabella generata</span></td>';
320 echo '</tr>';
321
322 echo '</tbody></table>
323 </div></div>';
324
325 echo '
326 <div class="postbox" id="second">
327 <h3 class="hndle"><span>Visualizzazioni archivio</span></h3>
328 <div class="inside">
329
330 <table class="form-table"><tbody>';
331
332 echo '<tr>';
333 echo '<th><label>Archivio Ditte</label></th>';
334 echo '<td><input type="checkbox" name="avcp_dis_archivioditte_n" ';
335 $get_avcp_dis_archivioditte = get_option('avcp_dis_archivioditte');
336 if ($get_avcp_dis_archivioditte == '0') {
337 echo 'checked="checked" ';
338 }
339 echo '><span class="description">Abilita i link con la visualizzazione archivio delle ditte con i bandi a cui la ditta ha partecipato</span></td>';
340 echo '</tr>';
341
342 echo '<tr>';
343 echo '<th><label>Archivio Annuale</label></th>';
344 echo '<td><input type="checkbox" name="avcp_dis_archivioanni_n" ';
345 $get_avcp_dis_archivioanni = get_option('avcp_dis_archivioanni');
346 if ($get_avcp_dis_archivioanni == '0') {
347 echo 'checked="checked" ';
348 }
349 echo '><span class="description">Abilita i link con la visualizzazione archivio su base annuale dei bandi</span></td>';
350 echo '</tr>';
351
352 echo '</tbody></table>
353 </div></div>';
354
355 echo '</div></div>
356 <p class="submit"><input type="submit" class="button-primary" name="Submit" value="AGGIORNA IMPOSTAZIONI" /></p>';
357
358 echo '</form>';
359
360 //Qui finisce la sezione delle impostazione
361
362 echo '<center><h3>Scopri gli altri plugin pensati per la Pubblica Amministrazione</h3>
363 <hr/>
364 <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">
365 <img src="' . plugin_dir_url(__FILE__) . 'includes/at.png"/></a>
366 <hr/>
367 <a href="http://wordpress.org/plugins/amministrazione-aperta/" target="_blank" title="Plugin Wordpress per la gestione di Spese, Contributi, Concessioni, Incarichi...">
368 <img src="' . plugin_dir_url(__FILE__) . 'includes/aa.png"/></a>
369 <hr/>
370 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>
371 </div>';
372
373 }
374 ?>