Samx Here
n1udSecurity


Server : Apache
System : Linux webd348.cluster026.gra.hosting.ovh.net 5.15.148-ovh-vps-grsec-zfs-classid #1 SMP Thu Feb 8 09:41:04 UTC 2024 x86_64
User : hednacluml ( 122243)
PHP Version : 8.3.9
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
Directory :  /home/hednacluml/god/plugins/auto/yaml/demo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/hednacluml/god/plugins/auto/yaml/demo/yaml_fonctions.php
<?php

if (!defined('_ECRIRE_INC_VERSION')) {
	return;
}

function ajouter_libyaml($librairies) {

	if (function_exists('yaml_parse')) {
		$librairies['libyaml'] = 'libYAML';
	}

	return $librairies;
}

function decoder_fichier_yaml($filename, $options = []) {

	include_spip('inc/yaml');
	$file = find_in_path($filename);
	$timestamp_debut = microtime(true);

	$parsed = yaml_decode_file($file, $options);

	$timestamp_fin = microtime(true);
	$duree = ($timestamp_fin - $timestamp_debut) * 1000;

	return [
		'lib' => sinon($options['library'], 'symfony'),
		'fichier' => $file,
		'duree' => $duree . ' ms',
		'yaml' => $parsed,
	];
}

function comparer_decodage($fichier, $libraries, $options = []) {

	include_spip('inc/yaml');

	$compared = [];
	$first = [];
	foreach ($libraries as $_library) {
		$options = array_merge($options, ['library' => $_library]);
		$parsed = yaml_decode_file($fichier, $options);
		if (!$compared) {
			$first = $parsed;
			$compared[$_library] = 'référence';
		} else {
			$difference = array_diff_assoc_recursive($first, $parsed, $fichier);
			$compared[$_library] = $difference ? bel_env($difference, true) : 'idem';
		}
	}

	return $compared;
}

function array_diff_assoc_recursive($array1, $array2, $fichier) {

	$difference = [];

	foreach ($array1 as $_key => $_value) {
		if (is_array($_value)) {
			if (!isset($array2[$_key]) || !is_array($array2[$_key])) {
				$difference[$_key] = $_value;
			} else {
				$new_diff = array_diff_assoc_recursive($_value, $array2[$_key], $fichier);
				if (!empty($new_diff)) {
					$difference[$_key] = $new_diff;
				}
			}
		} elseif (!is_array($array2)) {
			echo $fichier, ' - ', $_key, ' - ', $_value, '<br />';
		} elseif (!array_key_exists($_key, $array2) || ($array2[$_key] !== $_value)) {
			$difference[$_key] = $_value;
		}
	}

	return $difference;
}

SAMX