Code Duplication    Length = 12-13 lines in 2 locations

ecrire/base/objets.php 2 locations

@@ 766-778 (lines=13) @@
763
				'emb' => 'documents',
764
			));
765
		$infos_tables = lister_tables_objets_sql();
766
		foreach($infos_tables as $t=>$infos){
767
			// cas de base type=>table
768
			// et preg_replace(',^spip_|^id_|s$,',table)=>table
769
			if ($infos['table_objet']){ // securite, si la fonction est appelee trop tot, c'est vide
770
				// optimisations pour table_objet
771
				//$surnoms[$infos['type']] = $infos['table_objet'];
772
				$surnoms[preg_replace(',^spip_|^id_|s$,', '', $infos['table_objet'])] = $infos['table_objet'];
773
				$surnoms[preg_replace(',^spip_|^id_|s$,', '', $infos['type'])] = $infos['table_objet'];
774
				if (is_array($infos['table_objet_surnoms']) AND count($infos['table_objet_surnoms']))
775
					foreach($infos['table_objet_surnoms'] as $surnom)
776
						$surnoms[$surnom] = $infos['table_objet'];
777
			}
778
		}
779
		$md5 = lister_tables_objets_sql('::md5');
780
	}
781
	return $surnoms;
@@ 798-809 (lines=12) @@
795
		// declarer_table_objets_sql
796
		$surnoms = pipeline('declarer_type_surnoms', array('racine-site'=>'site'));
797
		$infos_tables = lister_tables_objets_sql();
798
		foreach($infos_tables as $t=>$infos){
799
			if ($infos['type']){ // securite, si la fonction est appelee trop tot, c'est vide
800
				// optimisations pour objet_type
801
				//$surnoms[$infos['type']] = $infos['type'];
802
				$surnoms[preg_replace(',^spip_|^id_|s$,', '', $infos['table_objet'])] = $infos['type'];
803
				$surnoms[preg_replace(',^spip_|^id_|s$,', '', $infos['type'])] = $infos['type'];
804
				// surnoms declares
805
				if (is_array($infos['type_surnoms']) AND count($infos['type_surnoms']))
806
					foreach($infos['type_surnoms'] as $surnom)
807
						$surnoms[$surnom] = $infos['type'];
808
			}
809
		}
810
		$md5 = lister_tables_objets_sql('::md5');
811
	}
812
	return $surnoms;