[Scummvm-cvs-logs] scummvm-web master -> d9b92099d3e41456a029418e4a68c28ce42bacf6

sev- sev at scummvm.org
Sat Jun 18 11:51:18 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-web' repo located at https://github.com/scummvm/scummvm-web .

Summary:
d9b92099d3 WEB: Updated Cloud code URL code


Commit: d9b92099d3e41456a029418e4a68c28ce42bacf6
    https://github.com/scummvm/scummvm-web/commit/d9b92099d3e41456a029418e4a68c28ce42bacf6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-06-18T11:50:44+02:00

Commit Message:
WEB: Updated Cloud code URL code

Changed paths:
  A c/logo.png
  A c/style.css
    c/index.php



diff --git a/c/index.php b/c/index.php
index 1a35df2..6b19809 100644
--- a/c/index.php
+++ b/c/index.php
@@ -3,8 +3,57 @@
 	<head>
 		<title>ScummVM</title>
 		<meta charset="utf-8"/>
+		<link rel="stylesheet" type="text/css" href="style.css"/>
 	</head>
 	<body>
-		<?php echo "<h1>".htmlentities($_GET["code"], ENT_QUOTES | ENT_HTML5)."</h1>"; ?>
+		<div class="container">
+			<div class='header'>
+				<center><img src="logo.png"/></center>
+			</div>
+			<div class="content">
+				<p>Now please enter this code in ScummVM:</p>
+				<?php
+					function crc16($data) { //"CRC16_CCITT_FALSE"
+						$crc = 0xFFFF;
+						for ($i = 0; $i < strlen($data); ++$i) {
+							$x = (($crc >> 8) ^ ord($data[$i])) & 0xFF;
+							$x ^= $x >> 4;
+							$crc = (($crc << 8) ^ ($x << 12) ^ ($x << 5) ^ $x) & 0xFFFF;
+						}
+						return $crc;
+					}
+
+					if (isset($_GET["code"])) {
+						$hashchars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ?!";
+
+						//remove "bad" characters from the given code:
+						$code = preg_replace("/[^_\-\/\\a-z0-9]/i", "", $_GET["code"]);
+
+						//append code's crc16 to the code
+						$crc = crc16($code);
+						$code .= $hashchars[($crc & 0x003F)];
+						$code .= $hashchars[($crc & 0x0FC0) >> 6];
+						$code .= $hashchars[($crc & 0xF000) >> 12];
+
+						//break the code into pieces of 6 chars
+						//and calculate the checksum character for each piece
+						$len = strlen($code);
+						$new_code = "";
+						for ($i = 0; $i < $len; $i+=6) {
+							$bits = 0x2A;
+							for ($j = 0; $j < 6 && $i + $j < $len; ++$j) {
+								$byte = ord($code[$i + $j]);
+								$bits = $bits ^ $byte;
+								$new_code .= $code[$i + $j];
+							}
+							$new_code .= $hashchars[$bits % 64]." ";
+						}
+
+						//show the "new code" - groups with checksums
+						echo "<b class='code'>".$new_code."</b>";						
+					}
+				?>
+			</div>
+		</div>
 	</body>
-</html>
+</html>
\ No newline at end of file
diff --git a/c/logo.png b/c/logo.png
new file mode 100644
index 0000000..9fdd2d0
Binary files /dev/null and b/c/logo.png differ
diff --git a/c/style.css b/c/style.css
new file mode 100644
index 0000000..e1f3c65
--- /dev/null
+++ b/c/style.css
@@ -0,0 +1,34 @@
+html {
+	background: rgb(212, 117, 11);
+	background: linear-gradient(to bottom, rgb(212, 117, 11) 0%, rgb(212, 117, 11) 36%, rgb(239, 196, 24) 100%);
+	height: 100vh;
+}
+
+.container {
+	width: 80%;
+	margin: 0 auto;
+}
+
+.header {
+	padding: 10pt;
+	/*margin: 8pt;*/
+	margin-bottom: 0;
+}
+
+.content {
+	padding: 8pt;
+	background: rgb(251, 241, 206);
+	font-family: Tahoma;
+	font-size: 16pt;
+}
+
+.content p { margin: 0 0 6pt 0; }
+
+.code {
+	display: block;
+	background: #FFFFFF;
+	font-family: Consolas;
+	font-size: 24pt;
+	padding: 4pt;
+	margin: 6pt 0;
+}






More information about the Scummvm-git-logs mailing list