1<?php
2/**
3 * Sono presenti in questo file le procedure per inizializzare, inserire e eliminare le informazioni
4 * sulle tabelle nel registro di VFront per tenerlo allineato con l'information_schema del database.
5 * Questo file � la versione per MySQL
6 *
7 * @desc Procedure di manutenzione del registro per MySQL
8 * @package VFront
9 * @subpackage Administration
10 * @author M.Marcello Verona
11 * @copyright 2007-2010 M.Marcello Verona
12 * @version 0.96 $Id: sync_reg_tab.php 880 2010-12-14 12:43:47Z marciuz $
13 * @license http://www.gnu.org/licenses/gpl.html GNU Public License
14 * @see sync_reg_tab.postgres.php
15 */
16
17
18require_once("../inc/conn.php");
19require_once("../inc/layouts.php");
20require_once("../inc/func.comuni.php");
21require_once("../inc/func.frontend.php");
22
23 proteggi(3);
24
25##############################################
26#
27#	PROCEDURA AGGIORNAMENTO DEI CAMPI DELLE TABELLE
28#
29#
30
31if(isset($_POST['aggiorna'])){
32
33
34	$ar_campi=$_POST['campo_aggiorna'];
35
36
37	require_once("./gestione_registro.inc.php");
38
39	for($i=0;$i<count($ar_campi);$i++){
40
41		list($tabella,$campo,$operazione) = explode(";",$ar_campi[$i]);
42
43		$feed[] = aggiorna_campo($tabella,$campo,$operazione);
44
45	}
46
47
48	header("Location: ".$_SERVER['PHP_SELF']."?diff=".$tabella);
49	exit;
50
51}
52
53##############################################
54#
55#	PROCEDURA ELIMINAZIONE TABELLE OBSOLETE
56#
57#
58
59if(isset($_POST['elimina_obsolete'])){
60
61	$tabelle=explode(",",$_POST['obsolete']);
62
63	if(is_array($tabelle)){
64
65		// inizia la transazione
66		$vmreg->begin();
67
68		$ok_del=0;
69		$c=0;
70
71		for($d=0;$d<count($tabelle);$d++){
72
73			$sql_del="DELETE FROM {$db1['frontend']}{$db1['sep']}registro_tab WHERE table_name='".$tabelle[$d]."'";
74
75			$q_del=$vmreg->query($sql_del,true);
76
77			if($vmreg->affected_rows($q_del)>0){
78				$ok_del++;
79			}
80
81			$c++;
82		}
83
84//		echo $c."<br/>$ok_del";
85
86		// FEEDBACK
87		if($ok_del==$c){
88			$vmreg->commit();
89			header("Location: ".$_SERVER['PHP_SELF']."?feed=ok_del");
90		}
91		else{
92			$vmreg->rollback();
93			header("Location: ".$_SERVER['PHP_SELF']."?feed=ko_del");
94		}
95
96
97	}
98	else{
99
100		header("Location: ".$_SERVER['PHP_SELF']."?feed=ko_del");
101	}
102
103
104	exit;
105}
106
107#
108#	--fine tabelle obsolete
109#
110################################################################################�
111
112
113
114##############################################
115#
116#	PROCEDURA INSERIMENTO TABELLE NUOVE
117#
118if(isset($_POST['sincronizza_nuove'])){
119
120
121	$tabelle=explode(",",$_POST['nuove']);
122
123	if(is_array($tabelle)){
124
125		require_once("./gestione_registro.inc.php");
126
127
128		// PRENDI GRUPPI
129		$qg=$vmreg->query("SELECT gid FROM {$db1['frontend']}{$db1['sep']}gruppo");
130
131		list($gruppi)=$vmreg->fetch_row_all($qg,true);
132
133
134
135
136		/*
137			Anche se ho a disposizione il nome delle tabelle le prendo di nuovo,
138			perch� mi servono anche i commenti
139		*/
140
141		// PRENDI nomi tabelle e commenti
142		$IS=new iSchema();
143		$tables_all=$IS->get_tables();
144
145		$vmreg->begin();
146
147		for($i=0;$i<count($tables_all);$i++){
148
149			if(in_array($tables_all[$i]['table_name'], $tabelle)){
150
151				// PER OGNI GRUPPO
152				for($g=0;$g<count($gruppi);$g++){
153
154					inserisci_registro($tables_all[$i],$gruppi[$g]);
155				}
156
157			}
158		}
159
160		$vmreg->commit();
161
162		header("Location: ".$_SERVER['PHP_SELF']."?feed=ok_nuove");
163
164	}
165	else{
166
167		header("Location: ".$_SERVER['PHP_SELF']."?feed=ko_nuove");
168	}
169
170	exit;
171
172}
173
174
175#
176#	--fine nuove tabelle
177#
178################################################################################�
179
180
181
182
183
184##############################################
185#
186#	PROCEDURA RIPRISTIONO TABELLA
187#
188if(isset($_GET['azzera'])){
189
190	$tabella=trim($_GET['azzera']);
191
192	if(is_tabella($tabella)){
193
194
195		// ELIMINA LE IMPOSTAZIONI DI TABELLA NEL FRONTEND
196		$sql_del="DELETE FROM {$db1['frontend']}{$db1['sep']}registro_tab WHERE table_name='".$tabella."'";
197
198		$vmreg->begin();
199
200		$q_del=$vmreg->query($sql_del,true);
201
202		if($vmreg->affected_rows($q_del)>0){
203
204			$vmreg->commit();
205		}
206		else{
207			$vmreg->rollback();
208			header("Location: ".$_SERVER['PHP_SELF']."?feed=ko_azzera1");
209			exit;
210		}
211
212
213		require_once("./gestione_registro.inc.php");
214
215
216
217		// PRENDI GRUPPI
218		$qg=$vmreg->query("SELECT gid FROM {$db1['frontend']}{$db1['sep']}gruppo");
219
220		list($gruppi)=$vmreg->fetch_row_all($qg,true);
221
222		/*
223			Anche se ho a disposizione il nome delle tabelle le prendo di nuovo,
224			perch� mi servono anche i commenti
225		*/
226
227		// PRENDI nomi tabelle e commenti
228
229		$IS=new iSchema();
230
231		list($info_tab)=$IS->get_tables(false,$tabella);
232
233		$vmreg->begin();
234
235			// PER OGNI GRUPPO
236			for($g=0;$g<count($gruppi);$g++){
237
238				inserisci_registro($info_tab,$gruppi[$g]);
239			}
240
241
242
243		$vmreg->commit();
244
245		header("Location: ".$_SERVER['PHP_SELF']."?feed=ok_azzera");
246
247	}
248	else{
249
250
251		header("Location: ".$_SERVER['PHP_SELF']."?feed=ko_azzera2");
252	}
253
254
255
256
257	exit;
258
259}
260
261
262#
263#	--fine procedura ripristino tabella
264#
265################################################################################
266
267
268
269
270
271
272##############################################
273#
274#	PROCEDURA VISUALIZZAZIONE DIFFERENZE
275#
276if(isset($_GET['diff'])){
277
278	$tabella=trim($_GET['diff']);
279
280	if(is_tabella($tabella)){
281
282
283		$colonne1=array();
284		$colonne2=array();
285
286
287		// INFO COLONNE DALL' information_schema
288
289		$IS = new iSchema();
290
291		$col_def=$IS->get_columns($tabella);
292
293
294		for($j=0;$j<count($col_def);$j++){
295
296			$colonne1[$col_def[$j]['column_name']]=array('column_name'=>$col_def[$j]['column_name'],
297														 'column_type'=>$col_def[$j]['column_type'],
298														 'character_maximum_length'=>$col_def[$j]['character_maximum_length'],
299														 'is_nullable'=>$col_def[$j]['is_nullable']
300														 );
301			$colonne[$col_def[$j]['column_name']]=1;
302		}
303
304
305
306		// INFO COLONNE DAL frontend
307		/*
308			$SQL_confronto_colonne2="
309		SELECT column_name,column_type,character_maximum_length,is_nullable
310		FROM {$db1['frontend']}{$db1['sep']}registro_col c, {$db1['frontend']}{$db1['sep']}registro_tab t
311		WHERE t.id_table=c.id_table
312		AND c.gid=0
313		AND t.table_name='$tabella'
314		ORDER BY ordinal_position,column_name
315			";
316
317		$q_conf2=$vmreg->query($SQL_confronto_colonne2);
318		 *
319		 */
320
321		$col_front=prendi_colonne_frontend($tabella,
322					" column_name, column_type, character_maximum_length, is_nullable",
323					false, 0, "assoc");
324
325		foreach($col_front as $k=>$RSc2){
326
327//		while($RSc2=$vmreg->fetch_assoc($q_conf2)){
328
329			if($RSc2['character_maximum_length']=='0'){
330				$RSc2['character_maximum_length']='';
331			}
332
333			$colonne2[$RSc2['column_name']]=$RSc2;
334
335			$colonne[$RSc2['column_name']]=1;
336		}
337
338
339
340
341
342		if($colonne1!=$colonne2){
343
344			$TESTO= "<table id=\"diff-tab\" summary=\""._("differences between tables")."\" border=\"1\">";
345
346
347			$TESTO.= "
348				<tr >
349					  <th>"._("column_name A")."</th><th>"._("column_type A")."</th><th>"._("max_chars")." A</th><th>"._("is_nullable A")."</th>
350					  <th style=\"background-color:#444;\" rowspan=\"".(count($colonne)+1) ."\">&nbsp;</th>
351					  <th>"._("column_name B")."</th><th>"._("column_type B")."</th><th>"._("max_chars")." B</th><th>"._("is_nullable B")."</th>
352
353				</tr>\n";
354
355
356			foreach($colonne as $campo=>$val){
357
358
359				if(!isset($colonne1[$campo]) || !isset($colonne2[$campo]) || $colonne1[$campo]!=$colonne2[$campo]){
360
361					$class="evidenza";
362
363
364
365					// tipo di differenza:
366					if(!isset($colonne1[$campo]) || $colonne1[$campo]['column_name']==''){
367
368						$campi_diversi[]=array($campo,"DELETE") ;
369
370						$TESTO.= "
371						<tr class=\"$class\">
372							  ".str_repeat("<td>&nbsp;</td>",4)."
373
374							  <td>".implode("</td>\t\n<td>", (array) $colonne2[$campo])."</td>
375						</tr>\n";
376
377					}
378					elseif(!isset($colonne2[$campo]) || $colonne2[$campo]['column_name']==''){
379
380						$campi_diversi[]=array($campo,"INSERT") ;
381
382						$TESTO.= "
383						<tr class=\"$class\">
384							  <td>".implode("</td>\t\n<td>",(array) $colonne1[$campo])."</td>
385
386							  ".str_repeat("<td>&nbsp;</td>",4)."
387						</tr>\n";
388
389
390					}
391					else{
392
393						$campi_diversi[]=array($campo,"UPDATE") ;
394
395						$TESTO.= "
396						<tr class=\"$class\">
397							  <td>".implode("</td>\t\n<td>",(array) $colonne1[$campo])."</td>
398
399							  <td>".implode("</td>\t\n<td>", (array) $colonne2[$campo])."</td>
400						</tr>\n";
401
402					}
403
404
405				}
406				else{
407
408					$class="null";
409
410					$TESTO.= "
411						<tr class=\"$class\">
412							  <td>".implode("</td>\t\n<td>",(array) $colonne1[$campo])."</td>
413
414							  <td>".implode("</td>\t\n<td>", (array) $colonne2[$campo])."</td>
415						</tr>\n";
416				}
417
418
419
420			}
421
422
423
424			$TESTO.= "</table>";
425
426			$TESTO.="<p><strong>A</strong>: information_schema<br /><strong>B</strong>: db vfront</p>\n";
427
428
429			$differenza=true;
430
431
432
433		}
434
435		else{
436
437			$TESTO=_("No inconsistencies in this table");
438
439			$differenza=false;
440
441		}
442
443
444	}else{
445
446		header("Location: ".$_SERVER['PHP_SELF']);
447	}
448
449
450	$files=array("sty/admin.css","sty/log.css","sty/tabelle.css");
451
452	echo openLayout1(_("Synchronize database/frontend"),$files);
453
454	echo breadcrumbs(array("HOME","ADMIN",
455					basename($_SERVER['PHP_SELF'])=>_("syncronize db/frontend"),
456					_("differences for the table")." $tabella"));
457
458
459	echo "<h1>"._("Setting differences for the table")." <span class=\"var\">$tabella</span></h1>\n";
460
461	echo $TESTO;
462
463	if($differenza){
464
465		echo "<form action=\"".$_SERVER['PHP_SELF']."?aggiorna_campi\" method=\"post\">\n";
466
467		foreach($campi_diversi as $k=>$v){
468
469			echo "<input type=\"hidden\" name=\"campo_aggiorna[]\" value=\"$tabella;{$v[0]};{$v[1]}\" />\n";
470
471		}
472
473		echo "<input type=\"submit\" name=\"aggiorna\" value=\" "._("Synchonize fields")." \" />\n";
474
475		echo "</form>\n";
476	}
477
478	echo closeLayout1();
479
480	exit;
481
482}
483
484
485#
486#	--fine procedura visualizzazione differneze
487#
488################################################################################�
489
490
491
492
493
494$files=array("sty/admin.css","sty/tabelle.css","sty/linguette.css");
495
496$OUT= openLayout1(_("Database synchronization"),$files);
497
498
499	$OUT.= "
500	<script type=\"text/javascript\">
501
502		var divs = new Array('integrita','manuale');
503
504
505		function eti(ido){
506
507			for (var i in divs){
508				document.getElementById('cont-eti-'+divs[i]).style.display='none';
509				document.getElementById('li-'+divs[i]).className='disattiva';
510			}
511
512			// attiva il selezionato
513			document.getElementById('cont-eti-'+ido).style.display='';
514			document.getElementById('li-'+ido).className='attiva';
515
516		}
517
518
519	</script>
520	";
521
522
523	$OUT.= breadcrumbs(array("HOME","ADMIN",_("syncronize db/frontend")));
524
525	$OUT.="<h1>"._("Synchronize database/frontend")."</h1>\n";
526
527	$OUT.="<img src=\"../img/registri.gif\" class=\"img-float\" alt=\""._("registry settings")."\" />\n";
528
529	echo $OUT;
530
531
532	// FEEDBACK
533		if(isset($_GET['feed'])){
534
535			if($_GET['feed']=='ok_nuove')
536				echo "<div class=\"feed-mod-ok\">"._("New tables set correctly")."</div><br />";
537
538			elseif($_GET['feed']=='ko_nuove')
539				echo "<div class=\"feed-mod-ko\">"._("No new table set: procedure exception")."</div><br />";
540
541			elseif($_GET['feed']=='ok_del')
542				echo "<div class=\"feed-mod-ok\">"._("Table settings deleted correctly")."</div><br />";
543
544			elseif($_GET['feed']=='ko_del')
545					echo "<div class=\"feed-mod-ko\">"._("No setting deleted from the table: procedure exception")."</div><br />";
546
547			elseif($_GET['feed']=='ko_azzera1')
548				echo "<div class=\"feed-mod-ko\">"._("No changes were made in the register of the table: procedure exception")."</div><br />";
549
550			elseif($_GET['feed']=='ko_azzera2')
551					echo "<div class=\"feed-mod-ko\">"._("No changes were made in the register of the table: procedure exception")."</div><br />";
552
553			elseif($_GET['feed']=='ok_azzera')
554					echo "<div class=\"feed-mod-ok\">"._("Table settings reconfigured correctly")."</div><br />";
555
556		}
557
558
559	echo "<p>"._("This page contains functions for frontend maintenance and synchronizing with the database")."<br /><br />
560			<strong>"._("Please note!")."</strong> "._("None of the operations listed below change the structure of the database!")."<br />
561			"._("Each operation will only change the content of the frontend.")."
562			</p><br />\n";
563
564	echo "
565<div id=\"contenitore-variabili\">
566	<div id=\"box-etichette\">
567
568		<ul class=\"eti-var-gr\">
569
570
571			<li onclick=\"eti('integrita');\" id=\"li-integrita\" class=\"attiva\">"._("Frontend integrity")."</li>
572			<li onclick=\"eti('manuale');\" id=\"li-manuale\" class=\"disattiva\">"._("Manual restore")."</li>
573
574		</ul>
575
576	</div>";
577
578
579
580	$IS=new iSchema();
581
582	// IS Tables
583
584	$tables_info=$IS->get_tables();
585
586	// reg Tables
587	$reg_tables0=prendi_tabelle(0,false,false,true);
588
589	$tables=array();
590	for($i=0;$i<count($tables_info);$i++){
591
592		$tables[]=$tables_info[$i]['table_name'];
593	}
594
595	$reg_tables=array();
596	for($i=0;$i<count($reg_tables0);$i++){
597
598		$reg_tables[]=$reg_tables0[$i]['table_name'];
599	}
600
601	$mat_nuove_tabelle=array();
602	for($i=0;$i<count($tables);$i++){
603
604		if(!in_array($tables[$i],$reg_tables)){
605			$mat_nuove_tabelle[]=$tables_info[$i];
606		}
607	}
608
609	$mat_vecchie_tabelle=array();
610	for($i=0;$i<count($reg_tables0);$i++){
611
612		if(!in_array($reg_tables[$i],$tables)){
613			$mat_vecchie_tabelle[]=$reg_tables0[$i];
614		}
615	}
616
617
618
619
620	// TEST 1 DB->FRONTEND
621	if(count($mat_nuove_tabelle)>0){
622
623		$test1=false;
624		$matrice_t1 = $mat_nuove_tabelle;
625	}
626	else{
627
628		$test1=true;
629		$matrice_t1=array();
630	}
631
632
633
634
635	// TEST 2 FRONTEND->DB
636	if(count($mat_vecchie_tabelle)>0){
637
638		$test2=false;
639		$matrice_t2 = $mat_vecchie_tabelle;
640	}
641	else{
642
643		$test2=true;
644	}
645
646
647###########################################################################
648#
649#	CONTROLLO CAMPI TABELLE
650#
651#
652	// prendi le tabelle dal frontend
653
654	$uguali = true;
655
656	$IS=new iSchema();
657
658	for($i=0;$i<count($reg_tables);$i++){
659
660		$colonne1=array();
661		$colonne2=array();
662
663		$col_def=$IS->get_columns($reg_tables[$i]);
664
665
666		for($j=0;$j<count($col_def);$j++){
667
668			$colonne1[$col_def[$j]['column_name']]=array('column_name'=>$col_def[$j]['column_name'],
669														 'column_type'=>$col_def[$j]['column_type'],
670														 'character_maximum_length'=>intval($col_def[$j]['character_maximum_length']),
671														 'is_nullable'=>$col_def[$j]['is_nullable']
672														 );
673		}
674
675
676		// INFO COLONNE DAL frontend
677			$SQL_confronto_colonne2="
678		SELECT column_name,column_type,character_maximum_length,is_nullable
679		FROM {$db1['frontend']}{$db1['sep']}registro_col c, {$db1['frontend']}{$db1['sep']}registro_tab t
680		WHERE t.id_table=c.id_table
681		AND c.gid=0
682		AND t.table_name='{$reg_tables[$i]}'
683		ORDER BY ordinal_position
684			";
685
686		$q_conf2=$vmreg->query($SQL_confronto_colonne2);
687
688		while($RSc2=$vmreg->fetch_assoc($q_conf2)){
689
690			$colonne2[$RSc2['column_name']]=$RSc2;
691		}
692
693
694		if($colonne1!=$colonne2){
695
696			$diversi[$reg_tables[$i]]=array($colonne1,$colonne2);
697			$tab_diverse[]=$reg_tables[$i];
698			$uguali=false;
699		}
700
701	}
702
703#
704#
705################################################
706
707
708	$OUT_TEST='';
709	$TAB_SYNC1='';
710	$TAB_SYNC2='';
711
712	if($test1 && $test2 && $uguali){
713
714		$OUT_TEST.="<p class=\"verde\"><strong>"._("All done!")."</strong><br />"._("The database is synchronized with frontend.")."</p>\n";
715		$TAB_SYNC1.="";
716		$TAB_SYNC2.="";
717	}
718	elseif(!$test1 && $test2){
719		$OUT_TEST="<p><strong class=\"var\">"._("Warning!")."</strong><br />
720		"._("There are <strong>new tables</strong> in the database to be synchronized with the frontend")."</p>\n";
721	}
722	elseif($test1 && !$test2){
723		$OUT_TEST="<p><strong class=\"var\">"._("Warning!")."</strong><br />
724		"._("There are <strong> outdated </strong> tables in the frontend to be removed (no longer in the database)")."</p>\n";
725	}
726	elseif(!$test1 && !$test2){
727		$OUT_TEST="<p><strong class=\"var\">"._("Warning!")."</strong><br />
728		"._("There are <strong>new tables</strong> in the database to be synchronized")." <br />
729		"._("and <strong>old tables</strong> in the frontend to be removed (no longer in the database)")."</p>\n";
730	}
731
732
733
734
735
736
737
738	$new_t=array();
739	$old_t=array();
740
741
742// TABELLE NUOVE DA SINCRONIZZARE
743	if(!$test1){
744
745		$TAB_SYNC1="<table class=\"tab-color\" summary=\""._("Tables to synchronize")."\">\n\t<tbody>\n";
746
747		$TAB_SYNC1.="
748
749			<tr>
750				<th>"._("new table")."</th>
751				<th>"._("comment")."</th>
752			</tr>
753		";
754
755		$VAL1="";
756
757		for($i=0;$i<count($matrice_t1);$i++){
758
759			$VAL1.=$matrice_t1[$i]['table_name'].",";
760			$new_t[]=$matrice_t1[$i]['table_name'];
761
762			$TAB_SYNC1.="
763			<tr>
764				<td>".$matrice_t1[$i]['table_name']."</td>
765				<td>".$matrice_t1[$i]['comment']."</td>
766			</tr>
767			";
768		}
769
770		$TAB_SYNC1.="\t</tbody>\n</table>
771
772		<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">
773			<input type=\"hidden\" name=\"nuove\" value=\"".substr($VAL1,0,-1)."\" />
774
775			<input type=\"submit\" name=\"sincronizza_nuove\" value=\""._("Insert tables in frontend")."\" />
776			<br /><br /><br />
777		</form>\n";
778
779	}
780
781
782// TABELLE OBSOLETE DA ELIMINARE
783	if(!$test2){
784
785		$TAB_SYNC2="<table class=\"tab-color\" summary=\""._("Tables to synchronize")."\">\n\t<tbody>\n";
786
787		$TAB_SYNC2.="
788
789			<tr>
790				<th class=\"arancio\">"._("obsolete table")."</th>
791				<th class=\"arancio\">"._("comment")."</th>
792			</tr>
793		";
794
795		$VAL2="";
796
797		for($i=0;$i<count($matrice_t2);$i++){
798
799			$VAL2.=$matrice_t2[$i]['table_name'].",";
800			$old_t[]=$matrice_t2[$i]['table_name'];
801
802			$TAB_SYNC2.="
803			<tr>
804				<td>".$matrice_t2[$i]['table_name']."</td>
805				<td>".$matrice_t2[$i]['commento']."</td>
806			</tr>
807			";
808		}
809
810		$TAB_SYNC2.="\t</tbody>\n</table>
811
812		<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">
813			<input type=\"hidden\" name=\"obsolete\" value=\"".substr($VAL2,0,-1)."\" />
814
815			<input type=\"submit\" name=\"elimina_obsolete\" value=\""._("Delete obsolete tables")."\" />
816			<br /><br /><br />
817		</form>\n";
818	}
819
820
821
822
823	// differenze campi
824	$OUT_TEST_TAB='';
825
826	if(!$uguali){
827
828		$mostra_diff_campi=false;
829
830
831
832		$tab_string="";
833
834		for($k=0;$k<count($tab_diverse);$k++){
835
836				if(!in_array($tab_diverse[$k],$new_t) && !in_array($tab_diverse[$k],$old_t)){
837
838					$tab_string.="<a class=\"rosso\" href=\"".$_SERVER['PHP_SELF']."?diff=".$tab_diverse[$k]."\">".$tab_diverse[$k]."</a>, <br />\n";
839
840					$mostra_diff_campi=true;
841				}
842		}
843
844		if($mostra_diff_campi){
845
846			$OUT_TEST_TAB="<p><strong class=\"var\">"._("Warning!")."</strong><br />
847			"._("There are fields with <strong>differences in settings </strong> between database and frontend")."</p>\n";
848
849			if(count($tab_diverse)>1){
850
851				$OUT_TEST_TAB.="<p>"._("The tables to synchronize are")." <br /> $tab_string \n<br />
852							"._("Synchronize the tables by clicking on the table names (in red) or performing a <em>manual restore</em> for these tables")."</p>";
853			}
854			else{
855				$OUT_TEST_TAB.="<p>"._("The table to synchronize is")." $tab_string \n<br />
856							"._("Synchronize the table by clicking on its name (in red) or perform a <em>manual reset</em> for this table")."</p>";
857			}
858		}
859	}
860
861
862
863
864
865
866
867
868	// CONTENITORE TEST INTEGRITA'
869	echo "
870	<div class=\"cont-eti\" id=\"cont-eti-integrita\">
871
872		$OUT_TEST
873		$TAB_SYNC1
874		$TAB_SYNC2
875		$OUT_TEST_TAB
876	</div>
877	";
878
879
880	// PRENDI TUTTE LE TABELLE DAL FRONTEND
881
882	$q_front=$vmreg->query("SELECT table_name,data_modifica,commento FROM {$db1['frontend']}{$db1['sep']}registro_tab
883						  WHERE gid=0
884						 ORDER BY table_name");
885
886	$matrice_front=$vmreg->fetch_assoc_all($q_front);
887
888
889	$TAB_FRONT="<table class=\"tab-color\" summary=\""._("Frontend tables")."\">\n\t<tbody>\n";
890
891
892	$TAB_FRONT.="
893
894			<tr>
895				<th class=\"arancio\">"._("table")."</th>
896				<th class=\"arancio\">"._("comment")."</th>
897				<th class=\"arancio\">"._("configuration data")."</th>
898				<th class=\"arancio\">"._("restore configuration")."</th>
899			</tr>
900		";
901
902
903		for($i=0;$i<count($matrice_front);$i++){
904
905			$data_config = (intval($matrice_front[$i]['data_modifica'])>0) ? date("d/m/Y H:i",$matrice_front[$i]['data_modifica']) : "-";
906
907			$TAB_FRONT.="
908			<tr>
909				<td>".$matrice_front[$i]['table_name']."</td>
910				<td>".$matrice_front[$i]['commento']."</td>
911				<td>".$data_config."</td>
912				<td><a href=\"".$_SERVER['PHP_SELF']."?azzera=".$matrice_front[$i]['table_name']."\">"._("rollback")."</a></td>
913			</tr>
914			";
915		}
916
917
918
919		$TAB_FRONT.="\t</tbody>\n</table>";
920
921
922
923
924	echo "
925	<div class=\"cont-eti\" id=\"cont-eti-manuale\" style=\"display:none;\">
926
927			<p><strong>"._("Warning!")."</strong><br />
928			"._("If you restore the configuration of a table this will remove all settings so far defined for that table for all groups,")."<br />
929			"._("including settings for subforms. Use this feature with caution").".</p>
930
931	$TAB_FRONT
932
933	</div>
934</div>
935
936	";
937
938
939
940echo closeLayout1();
941?>