You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			83 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			PHP
		
	
			
		
		
	
	
			83 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			PHP
		
	
<?php
 | 
						|
	include_once "+getenv.php";
 | 
						|
	$instruction_files = glob("+instructions/*.txt");
 | 
						|
	function file_language($file) { return pathinfo($file)['filename']; }
 | 
						|
?>
 | 
						|
<!DOCTYPE html>
 | 
						|
<html>
 | 
						|
	<head>
 | 
						|
		<?php include "+components/page-head.php" ?>
 | 
						|
 | 
						|
		<link rel="canonical" href="https://sessioncommunities.online/instructions.php">
 | 
						|
		<link rel="stylesheet" href="css/instructions.css">
 | 
						|
		<style type="text/css">
 | 
						|
		<?php foreach ($instruction_files as $i => $file): ?>
 | 
						|
			#language-selection-<?=$i?>:checked ~
 | 
						|
			#instructions #instructions-<?=$i?> {
 | 
						|
				display: block;
 | 
						|
			}
 | 
						|
		<?php endforeach; ?>
 | 
						|
		</style>
 | 
						|
		<meta name="description" content="
 | 
						|
			Discover how to use the sessioncommunities.online website
 | 
						|
			to help you join Session Open Groups; available in <?php
 | 
						|
			// Print languages instructions are available in.
 | 
						|
			$languages = array_map('file_language', array_slice($instruction_files, 0, 10));
 | 
						|
			echo(join(", ", $languages));
 | 
						|
			?>. In short: Use the Copy button or scan the QR code!
 | 
						|
		">
 | 
						|
		<meta property="og:title" content="How to join Session Communities">
 | 
						|
		<meta property="og:description" content="Learn how to use sessioncommunities.online to join">
 | 
						|
		<meta property="og:url" content="https://sessioncommunities.online/instructions.php">
 | 
						|
		<meta property="og:type" content="article">
 | 
						|
	</head>
 | 
						|
	<body>
 | 
						|
		<header>
 | 
						|
			<h1>Instructions for joining Session Communities</h1>
 | 
						|
		</header>
 | 
						|
		<main>
 | 
						|
			<p>
 | 
						|
				<a href="/" title="Return to the Session Community listing">
 | 
						|
					Go back to Community list
 | 
						|
				</a>
 | 
						|
			</p>
 | 
						|
			Choose your language:
 | 
						|
			<?php foreach ($instruction_files as $i => $file): ?>
 | 
						|
			<br>
 | 
						|
			<input
 | 
						|
				id="language-selection-<?=$i?>"
 | 
						|
				class="language-selection"
 | 
						|
				name="language"
 | 
						|
				type="radio"
 | 
						|
				<?=file_language($file) == 'English' ? 'checked="checked"' : ''?>
 | 
						|
			>
 | 
						|
			<label for="language-selection-<?=$i?>">
 | 
						|
				<?=
 | 
						|
					// Name of the language
 | 
						|
					// Can be later parsed from i.e. first line of file
 | 
						|
					file_language($file);
 | 
						|
				?>
 | 
						|
			</label>
 | 
						|
			<?php endforeach; ?>
 | 
						|
 | 
						|
 | 
						|
			<article id="instructions">
 | 
						|
			<?php foreach ($instruction_files as $i => $file): ?>
 | 
						|
			<section id="instructions-<?=$i?>" class="instructions"><?php
 | 
						|
				// Sanitization as second layer of protection
 | 
						|
				// for user-submitted instruction files.
 | 
						|
				// Should not ever have to be used.
 | 
						|
				$content = trim(file_get_contents($file));
 | 
						|
				$content = htmlentities($content);
 | 
						|
				// Minimal formatting so that contributions are easier
 | 
						|
				$content = str_replace("\n-", "\n\n•", $content);
 | 
						|
				$content = str_replace("\n\n\n", "<br><br>", $content);
 | 
						|
				$content = str_replace("\n\n", "<br>", $content);
 | 
						|
				echo $content;
 | 
						|
			?>
 | 
						|
			</section>
 | 
						|
			<?php endforeach; ?>
 | 
						|
			</article>
 | 
						|
		</main>
 | 
						|
	</body>
 | 
						|
</html>
 |