<commit_before><?php
function effacer_screen($screen) {
	global $prefs;
	$file = $prefs->screenFile($screen);
	if($file != "") {
		$prefs->screens[$screen] = array(
			'file' => "",
			'top' => 0,
			'left' => 0,
			'zoom' => 0,
		);
		$prefs->save();
		if(file_exists($file)) {
			unlink($file);
		}
	}
}

if(isset($_POST["effacer_source"])) {
	$file = $_POST["effacer_source"];
	$file = basename($file);
	$file = SOURCES_DIR.$file;
	if(file_exists($file)) {
		unlink($file);
	}
	exit_redirect();
}

if(isset($_POST['assign_source'])) {
	$screen = intval($_POST['assign_source']);
	if($screen>0) {
		$source = $_POST['image_file'];
		$source = basename($source);
		$source = SOURCES_DIR.$source;
		if(file_exists($source)) {
			$ext = pathinfo($source,PATHINFO_EXTENSION);
			$screen_cible = sprintf(IMAGE_FORMAT,md5($source),$ext);
			effacer_screen($screen);
			copy($source,SCREENS_DIR.$screen_cible);
			$prefs->screens[$screen] = array(
				"file" => basename($screen_cible),
				"top" => 0,
				"left" => 0,
				"zoom" => 0,
			);
			if(isset($_POST['image_top']))
				$prefs->screens[$screen]['top'] = intval($_POST['image_top']);
			if(isset($_POST['image_left']))
				$prefs->screens[$screen]['left'] = intval($_POST['image_left']);
			if(isset($_POST['image_zoom']))
				$prefs->screens[$screen]['zoom'] = floatval($_POST['image_zoom']);
			$prefs->save();
		}
	}
	exit_redirect();
}

if(isset($_POST['changer_screen'])) {
	$screen = intval($_POST['changer_screen']);
	$file = $prefs->screenFile($screen);
	if($file != "") {
		if(isset($_POST['image_top']))
			$prefs->screens[$screen]['top'] = intval($_POST['image_top']);
		if(isset($_POST['image_left']))
			$prefs->screens[$screen]['left'] = intval($_POST['image_left']);
		if(isset($_POST['image_zoom']))
			$prefs->screens[$screen]['zoom'] = floatval($_POST['image_zoom']);
		$prefs->save();
	}
	exit_redirect();
}

if(isset($_POST["effacer_screen"])) {
	$screen = intval($_POST["effacer_screen"]);
	effacer_screen($screen);
	exit_redirect();
}

if(isset($_POST['screen_switch'])) {
	$screen = intval($_POST["screen_num"]);
	$value = intval($_POST['screen_switch']);
	if(isset($prefs->screens[$screen])) {
		$prefs->screens[$screen]['on'] = $value?true:false;
		$prefs->save();
	}
	exit_redirect();
}

function disp_screens($thisurl) {
	global $Nscreens,$prefs,$url_miniature_stream;
	?>
	<div id="ecrans">
	<?php 
	for($index=1; $index<=$Nscreens; $index++) {
		$imageurl = $prefs->screenFile($index);
		$imgPos = $prefs->screenPos($index);
		$isOn = $prefs->screenOn($index);
		$base_lien = dirname($thisurl);
		$lien = $base_lien ."/slide.php?screen=".$index;
		if($imageurl != "" && file_exists(SCREENS_DIR.$imageurl)) {
			$sizes = getimagesize(SCREENS_DIR.$imageurl);
			$imageurl = SCREENS_URL.$imageurl;
			$w = $sizes[0];
			$h = $sizes[1];
		} else {
			$w = 0;
			$h = 0;
		}
		?>
		<div class='screen screen<?=$index?>'>
			<form action="<?=$thisurl?>" name="screens" method="POST">
			<h3><a href="<?=$lien?>" target="_BLANK">Écran <?=$index?></a><!-- <input type="text" class="lien" name="lien" value="<?=$lien?>" readonly/> --></h3>
			<?php
			if($isOn) {
				?><button class="btn_switch btn_switch_on" name="screen_switch" value="0" title="Activé, cliquer pour désactiver l'affichage des scores">ON</button><?
			} else {
				?><button class="btn_switch btn_switch_off" name="screen_switch" value="1" title="Désactivé, cliquer pour activer l'affichage des scores">OFF</button><?
			}
			?>
			<div class="pimage">
				<?php if($url_miniature_stream): ?>
				<img class="back_screen" src="<?=$url_miniature_stream?>" />
				<?php endif; ?>
				<img class="image" data-width="<?=$w?>" data-height="<?=$h?>" data-top="<?=$imgPos[1]?>" data-left="<?=$imgPos[0]?>" data-zoom="<?=$imgPos[2]?>" src="<?=$imageurl?>"/>
				<input type="hidden" name="screen_num" value="<?=$index?>"/>
				<input type="hidden" name="image_top" value="0"/>
				<input type="hidden" name="image_left" value="0"/><commit_msg>utilisation des liens slide sans ".php"<commit_after><?php
function effacer_screen($screen) {
	global $prefs;
	$file = $prefs->screenFile($screen);
	if($file != "") {
		$prefs->screens[$screen] = array(
			'file' => "",
			'top' => 0,
			'left' => 0,
			'zoom' => 0,
		);
		$prefs->save();
		if(file_exists($file)) {
			unlink($file);
		}
	}
}

if(isset($_POST["effacer_source"])) {
	$file = $_POST["effacer_source"];
	$file = basename($file);
	$file = SOURCES_DIR.$file;
	if(file_exists($file)) {
		unlink($file);
	}
	exit_redirect();
}

if(isset($_POST['assign_source'])) {
	$screen = intval($_POST['assign_source']);
	if($screen>0) {
		$source = $_POST['image_file'];
		$source = basename($source);
		$source = SOURCES_DIR.$source;
		if(file_exists($source)) {
			$ext = pathinfo($source,PATHINFO_EXTENSION);
			$screen_cible = sprintf(IMAGE_FORMAT,md5($source),$ext);
			effacer_screen($screen);
			copy($source,SCREENS_DIR.$screen_cible);
			$prefs->screens[$screen] = array(
				"file" => basename($screen_cible),
				"top" => 0,
				"left" => 0,
				"zoom" => 0,
			);
			if(isset($_POST['image_top']))
				$prefs->screens[$screen]['top'] = intval($_POST['image_top']);
			if(isset($_POST['image_left']))
				$prefs->screens[$screen]['left'] = intval($_POST['image_left']);
			if(isset($_POST['image_zoom']))
				$prefs->screens[$screen]['zoom'] = floatval($_POST['image_zoom']);
			$prefs->save();
		}
	}
	exit_redirect();
}

if(isset($_POST['changer_screen'])) {
	$screen = intval($_POST['changer_screen']);
	$file = $prefs->screenFile($screen);
	if($file != "") {
		if(isset($_POST['image_top']))
			$prefs->screens[$screen]['top'] = intval($_POST['image_top']);
		if(isset($_POST['image_left']))
			$prefs->screens[$screen]['left'] = intval($_POST['image_left']);
		if(isset($_POST['image_zoom']))
			$prefs->screens[$screen]['zoom'] = floatval($_POST['image_zoom']);
		$prefs->save();
	}
	exit_redirect();
}

if(isset($_POST["effacer_screen"])) {
	$screen = intval($_POST["effacer_screen"]);
	effacer_screen($screen);
	exit_redirect();
}

if(isset($_POST['screen_switch'])) {
	$screen = intval($_POST["screen_num"]);
	$value = intval($_POST['screen_switch']);
	if(isset($prefs->screens[$screen])) {
		$prefs->screens[$screen]['on'] = $value?true:false;
		$prefs->save();
	}
	exit_redirect();
}

function disp_screens($thisurl) {
	global $Nscreens,$prefs,$url_miniature_stream;
	?>
	<div id="ecrans">
	<?php 
	for($index=1; $index<=$Nscreens; $index++) {
		$imageurl = $prefs->screenFile($index);
		$imgPos = $prefs->screenPos($index);
		$isOn = $prefs->screenOn($index);
		$base_lien = dirname($thisurl);
		$lien = $base_lien ."/slide";
		if($imageurl != "" && file_exists(SCREENS_DIR.$imageurl)) {
			$sizes = getimagesize(SCREENS_DIR.$imageurl);
			$imageurl = SCREENS_URL.$imageurl;
			$w = $sizes[0];
			$h = $sizes[1];
		} else {
			$w = 0;
			$h = 0;
		}
		?>
		<div class='screen screen<?=$index?>'>
			<form action="<?=$thisurl?>" name="screens" method="POST">
			<h3><a href="<?=$lien?>" target="_BLANK">Écran <?=$index?></a></h3>
			<?php
			if($isOn) {
				?><button class="btn_switch btn_switch_on" name="screen_switch" value="0" title="Activé, cliquer pour désactiver l'affichage des scores">ON</button><?
			} else {
				?><button class="btn_switch btn_switch_off" name="screen_switch" value="1" title="Désactivé, cliquer pour activer l'affichage des scores">OFF</button><?
			}
			?>
			<div class="pimage">
				<?php if($url_miniature_stream): ?>
				<img class="back_screen" src="<?=$url_miniature_stream?>" />
				<?php endif; ?>
				<img class="image" data-width="<?=$w?>" data-height="<?=$h?>" data-top="<?=$imgPos[1]?>" data-left="<?=$imgPos[0]?>" data-zoom="<?=$imgPos[2]?>" src="<?=$imageurl?>"/>
				<input type="hidden" name="screen_num" value="<?=$index?>"/>
				<input type="hidden" name="image_top" value="0"/>
				<input type="hidden" name="image_left" value="0"/>
{'fraction_non_alphanumeric': 0.24299302473050094, 'fraction_numerical': 0.0055802155992390615, 'mean_word_length': 5.555278470490441, 'pattern_counts': {'":': 0, '<': 80, '<?xml version=': 0, '>': 134, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '622434', 'n_tokens_mistral': 3289, 'n_tokens_neox': 2995, 'n_words': 417}