a.binder 8 лет назад
Родитель
Сommit
bb54dac717
1 измененных файлов с 21 добавлено и 11 удалено
  1. 21 11
      SE/dev/audit_krs_con_digger/audit_krs_con_digger.php

+ 21 - 11
SE/dev/audit_krs_con_digger/audit_krs_con_digger.php

@@ -176,10 +176,10 @@ function sql($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl,$path,$ta
 						 	foreach($z_rel_and_name as $z_rel_and_name_cur=>$z_rel_and_name_col_to) {
 							 	if(isset($prev_dig->$prev_tbl['rel_and'][$z_rel_and][$z_rel_and_name_cur]) and ( strlen($prev_dig->$prev_tbl['rel_and'][$z_rel_and][$z_rel_and_name_cur])) > 0  ) {//and ( strlen($prev_dig->$z_rel_and_name_cur) > 2) 
 								 	if($rel_and_ok<>0) $rel_and_ok=2;
-								 	echo "\n<br>121 rel_and from:".$last_tbl." name: ".$z_rel_and_name_cur." OK for tbl ".$Z." z_rel_and_name_col_to: ".$z_rel_and_name_col_to." value:".$prev_dig->$prev_tbl['rel_and'][$z_rel_and][$z_rel_and_name_cur]." rel_and_ok=".$rel_and_ok;
+								 //	echo "\n<br>121 rel_and from:".$last_tbl." name: ".$z_rel_and_name_cur." OK for tbl ".$Z." z_rel_and_name_col_to: ".$z_rel_and_name_col_to." value:".$prev_dig->$prev_tbl['rel_and'][$z_rel_and][$z_rel_and_name_cur]." rel_and_ok=".$rel_and_ok;
 								} else {
 							 	echo "<br>\n #127 UNSET rel_and from:".$last_tbl." name ".$z_rel_and_name_cur." / ".$z_rel_and_name_col_to." ";
-								 	$rel_and_ok=0;
+								// 	$rel_and_ok=0;
 								}
 						 	}
 
@@ -222,13 +222,13 @@ function sql($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl,$path,$ta
 						$and=1;
 					}
 					$sql_rel_and_sql[$T][$z_rel_and_name].="  ) " ;
-					if( isset($hist_loop[$T])) {
-					 	 foreach($hist_loop[$T] as $hist_rec) {
+					if( isset($hist_loop[$table_class][$T]) and $table_class!='X') {
+					 	 foreach($hist_loop[$table_class][$T] as $hist_rec) {
 						 	 $sql_rel_and_sql[$T][$z_rel_and_name].=" and ID!='".$hist_rec->ID."' ";
 					 	 }
 				 	 }
 					$sql_rel_and_sql[$T][$z_rel_and_name].=" ; " ;
-				 	 dig_arr_cur($hist_loop,$T,$sql_rel_and_sql[$T][$z_rel_and_name],$hist_time,$loop,$last_tbl,$path);
+				 	 dig_arr_cur($hist_loop,$T,$sql_rel_and_sql[$T][$z_rel_and_name],$hist_time,$loop,$last_tbl,$path,$table_class);
 				}
 			}	  
 			  
@@ -243,9 +243,9 @@ function sql($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl,$path,$ta
 					 	 }
 					 	 $sql_t[$T].=$sql_t_str[$T]." ) ";
 					 	 //not loop
-					 	 if( isset($hist_loop[$T])) {
+					 	 if( isset($hist_loop[$table_class][$T]) and $table_class!='X'  ) {
 						 	 echo "<br> hist loop cnt: ". count($hist_loop[$T]);
-						 	 foreach($hist_loop[$T] as $hist_rec) {
+						 	 foreach($hist_loop[$table_class][$T] as $hist_rec) {
 							 	 $sql_t[$T].=" and ID!='".$hist_rec->ID."' ";
 						 	 }
 					 	 }
@@ -255,7 +255,7 @@ function sql($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl,$path,$ta
 				 	 if( isset($sql_t)) {
 					  foreach($sql_t as $T => $sql_ext)  { 
 						 // $path.=$path_rel[$T][ key($sql_ext) ];
-						  dig_arr_cur($hist_loop,$T,$sql_ext,$hist_time,$loop,$last_tbl,$path);
+						  dig_arr_cur($hist_loop,$T,$sql_ext,$hist_time,$loop,$last_tbl,$path,$table_class);
 					  }
 				  }
 		}
@@ -273,6 +273,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
 			 $sql_RELAND = array();
 			 
 			 sql($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl,$path,'Z');
+			 sql($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl,$path,'X');
 			 
 			 /*foreach($tables['Z'] as $Z=>$z) {
 				 	//rels in tbls
@@ -354,6 +355,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
 			}
 			}
 			 */
+			 {
 			 //echo "<br>164:sql_rel_and_sql <pre>";
 				//	 	print_r($sql_rel_and_sql);
 				//	 	echo " .EOF</pre>";
@@ -366,7 +368,8 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
 			  //	  print_r($prev_tbl);
 			 
 			//  echo "</pre>";
-			 
+			}
+			 /*			 
 			 foreach($tables['X'] as $X=>$x) {
 				 	//rels in tbls
 				 	if( isset($x['rel']) ) {
@@ -466,7 +469,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
 				 }
 			 }
 			 //X test eof
-			 
+			 */
 			/* 
 			 
 			 	 foreach($sql as $T => $rel) {
@@ -512,7 +515,7 @@ function dig_next($hist_loop,$prev_tbl,$prev_dig,$loop,$hist_time,$last_tbl='n/s
 }
 
 
-function dig_arr_cur($hist_loop,$T,$sql_ext,$hist_time,$loop,$last_tbl,$path) {
+function dig_arr_cur($hist_loop,$T,$sql_ext,$hist_time,$loop,$last_tbl,$path,$table_class) {
 	global $db,$tables;
 	
 	  echo "\n<br>216: from:".$last_tbl." Querying  :T ".$T." ext: ".$sql_ext ;//$sql_ext
@@ -521,6 +524,13 @@ function dig_arr_cur($hist_loop,$T,$sql_ext,$hist_time,$loop,$last_tbl,$path) {
 			  $res=$db->query($sql_ext) or die('211 blad '.$sql_ext);
 			  while($h=$db->fetch($res)) {
 				  echo "\n<br> #149 found ".$h->ID;
+				  if($table_class=='X') {
+					   echo "\n<hr> #177 POWIAZANIE ZNALEZIONE DLA X <pre>";
+						  print_r($h);
+						  echo "<br> Historia sledzen:";
+						  print_r($hist_time);
+						  echo "#177 eof </pre>";
+				  }
 				 // echo "<pre>"; print_r($h); echo "</pre>";
 //				 $hist_loop[$T][]=$h;
 //				 $hist_time[][$T]=$sql_ext." ##408 ".$path;