parent
03bc13347f
commit
4ba290679e
@ -1,8 +1,94 @@
|
||||
<?php
|
||||
/* This is free and unencumbered software released into the public domain.
|
||||
*
|
||||
* Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
* distribute this software, either in source code form or as a compiled
|
||||
* binary, for any purpose, commercial or non-commercial, and by any
|
||||
* means.
|
||||
*
|
||||
* In jurisdictions that recognize copyright laws, the author or authors
|
||||
* of this software dedicate any and all copyright interest in the
|
||||
* software to the public domain. We make this dedication for the benefit
|
||||
* of the public at large and to the detriment of our heirs and
|
||||
* successors. We intend this dedication to be an overt act of
|
||||
* relinquishment in perpetuity of all present and future rights to this
|
||||
* software under copyright law.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* For more information, please refer to <http://unlicense.org/>
|
||||
*/
|
||||
|
||||
$r = $_GET['r'];
|
||||
// Return source code
|
||||
if(isset($_GET['source'])) {
|
||||
header("Content-Type: text/plain");
|
||||
die(file_get_contents(basename($_SERVER['PHP_SELF'])));
|
||||
}
|
||||
|
||||
if(!empty($r))
|
||||
header("Location: {$_GET['r']}", true, 307);
|
||||
else
|
||||
echo "Invalid redirect";
|
||||
$message = $_GET['message'];
|
||||
$urlmessage = rawurlencode($message);
|
||||
$subject = rawurlencode(strstr($message, "\n", TRUE));
|
||||
|
||||
$mobile = !!strpos($_SERVER['HTTP_USER_AGENT'], 'Mobile');
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Wordle DS URL Share</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Wordle DS URL Share</h1>
|
||||
<?php if(empty($message)) { ?>
|
||||
<p>Error: No share message provided</p>
|
||||
<?php } else { ?>
|
||||
<blockquote>
|
||||
<pre id="message"><?php echo $message; ?></pre>
|
||||
</blockquote>
|
||||
[<a href="?source">source</a>]
|
||||
[<a href="<?php echo "mailto:?subject=$subject&body=$urlmessage"; ?>">email</a>]
|
||||
[<a href="<?php echo "sms:?body=$urlmessage"; ?>">sms</a>]
|
||||
[<a target="_blank" href="<?php echo "https://www.tumblr.com/widgets/share/tool?shareSource=legacy&canonicalUrl=&posttype=text&url=xn--rck9c.xn--tckwe&title=$subject&content=$urlmessage"; ?>">tumblr</a>]
|
||||
[<a target="_blank" href="<?php echo "https://old.reddit.com/submit" . ($mobile ? '.compact' : '') . "?title=$subject&text=$urlmessage"; ?>">reddit</a>]
|
||||
<script>
|
||||
if(navigator.clipboard) {
|
||||
document.write('[<a href="javascript:copyText()">copy</a>] ');
|
||||
}
|
||||
if(navigator.share) {
|
||||
document.write('[<a href="javascript:share()">share</a>] ');
|
||||
}
|
||||
</script>
|
||||
<?php } ?>
|
||||
|
||||
<script>
|
||||
function copyText() {
|
||||
var message = document.getElementById("message");
|
||||
|
||||
if(message && navigator.clipboard)
|
||||
navigator.clipboard.writeText(message.innerText);
|
||||
}
|
||||
|
||||
function share() {
|
||||
var message = document.getElementById("message");
|
||||
|
||||
if(navigator.share) {
|
||||
navigator.share({
|
||||
title: message.innerText.substr(0, message.innerText.indexOf("\n")),
|
||||
text: message.innerText
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
<?php
|
||||
|
Loading…
Reference in new issue