You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
97 lines
3.3 KiB
97 lines
3.3 KiB
<?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/>
|
|
*/
|
|
|
|
// Return source code
|
|
if(isset($_GET['source'])) {
|
|
header("Content-Type: text/plain");
|
|
die(file_get_contents(basename($_SERVER['PHP_SELF'])));
|
|
}
|
|
|
|
$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="/">back</a>]
|
|
[<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://bbs.xn--rck9c.xn--tckwe/?comment=$urlmessage"; ?>">bbs</a>]
|
|
[<a target="_blank" href="<?php echo "https://old.reddit.com/submit" . ($mobile ? '.compact' : '') . "?title=$subject&text=$urlmessage"; ?>">reddit</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>]
|
|
<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
|