Add opt-out

parent 07322b2d
<?php
$logEnabled=true;
$logMode="verbose";
$serverEnv="dev";
if($serverEnv!="dev"){
......@@ -26,6 +27,7 @@ if($logEnabled){
foreach ($headers as $header => $value) {
$echolog.="$header: $value\n";
}
$echolog.="Accept: ".$_SERVER["HTTP_ACCEPT"]."\n";
file_put_contents("log/".date("d-m-Y").".txt",date("h:i:sa")." : ".$_SERVER["REQUEST_URI"]."\r".$echolog."\r",FILE_USE_INCLUDE_PATH | FILE_APPEND);
}
......
This diff is collapsed.
body{
font-family: sans-serif;
background-color: #fcfcfc;
}
.content{
width: 80vw;
margin: auto;
}
img{
max-width: 100%;
}
header{
header {
margin-top: 20px;
line-height: 0;
border: 1px solid #eaeaea;
border-radius: 3vw;
border-radius: 2.5vw;
overflow: hidden;
-webkit-box-shadow: 0 10px 40px -5px rgba(0,0,0,0.05);
box-shadow: 0 10px 40px -5px rgba(0,0,0,0.05);
-webkit-box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
}
/*header:focus{
-webkit-box-shadow: 0 10px 40px -5px rgba(0,0,0,0.1);
box-shadow: 0 10px 40px -5px rgba(0,0,0,0.1);
}*/
header>.footer{
header > .footer {
position: relative;
background-color: white;
padding: 20px;
padding-left: calc(6vw + 15vw);
padding-top: 2vw;
line-height: normal;
}
.banner{
.banner {
min-height: 12vw;
background-color: #1da1f2;
}
.avatar{
.avatar {
position: absolute;
left: 3vw;
top: calc(-8.9vw - 5px);
width: 15vw;
height: 15vw;
border-radius: 100%;
-webkit-box-shadow: 0 0 20px 0 rgba(0,0,0,0.1);
box-shadow: 0 0 20px 0 rgba(0,0,0,0.1);
-webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
border: 5px solid white;
background-color: #fcfcfc;
}
header h1, header h2{
header h1,
header h2 {
margin: 10px 0;
}
header h1{
header h1 {
font-size: 2.5em;
}
header h2{
color:#8e8e8e;
header h2 {
color: #8e8e8e;
}
header>div>.externallink{
header > div > .externallink {
position: absolute;
right: 3vw;
top: 3vw;
top: 2vw;
padding: 10px 15px;
color: white;
text-decoration: none;
......@@ -68,7 +66,8 @@ header>div>.externallink{
border: 1px solid #6b6b6b;
border-radius: 4px;
}
header>div>.externallink:hover{
header > div > .externallink:hover {
color: #eaeaea;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
......@@ -76,46 +75,116 @@ header>div>.externallink:hover{
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
}
header>div>.externallink:focus{
transform: translate(0,1px);
header > div > .externallink:focus {
transform: translate(0, 1px);
}
header>div>.externallink>.fa-external-link{
header > div > .externallink > .fa-external-link {
top: 3px;
position: relative;
margin-left: 3px;
font-size: 1.2em;
}
@media only screen and (max-width: 1000px) {
.content{
width: 95vw;
}
}
@media only screen and (max-width: 700px) {
header>.footer{
padding-top: 8vw!important;
header > .footer {
padding-top: 8vw !important;
padding-left: 3vw;
padding-bottom: 3vw;
padding-right: 3vw;
}
header>div>.externallink{
header > div > .externallink {
display: block;
position: relative;
right: 0;
top: 0;
margin: 5px 0;
}
header>div>.externallink>.fa-external-link{
header > div > .externallink > .fa-external-link {
float: right;
}
}
header .optionmenu{
#optionmenu {
position: absolute;
right: 1.5vw;
top: 3vw;
top: 2vw;
padding: 10px 0;
font-size: 2em;
color: #8e8e8e;
cursor: pointer;
}
#optionmenu:hover {
color: black;
}
#optionmenu:active {
color: #8e8e8e;
}
#optionmenu > input {
display: none;
}
#optionmenu > ul {
display: none;
position: absolute;
top: 0;
right: 20px;
min-width: 100px;
width: 12vw;
margin: 0;
padding: 0;
list-style: none;
font-size: 16px;
background-color: white;
border: 1px solid #eaeaea;
border-radius: 3px;
overflow: hidden;
-webkit-box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
}
#optionmenu > ul:before {
content: "";
position: absolute;
left: 100%;
top: 26px;
width: 0;
height: 0;
border-top: 8px solid transparent;
border-right: 10px solid white;
border-bottom: 8px solid transparent;
}
#optionmenu > ul > li {
padding: 5px;
}
#optionmenu > input:checked + ul {
display: block;
}
main {
color: #8e8e8e;
font-style: italic;
}
main a {
color: #6a6a6a;
text-decoration: none;
}
main a:hover {
text-decoration: underline;
}
main a:focus {
text-decoration: none;
}
main .code {
background-color: #8e8e8e;
}
\ No newline at end of file
body{
font-family: sans-serif;
background-color: #fcfcfc;
}
.content{
width: 80vw;
margin: auto;
}
img{
max-width: 100%;
}
@media only screen and (max-width: 1000px) {
.content{
width: 95vw;
}
}
main {
padding: 2vw;
}
a{
text-decoration: none;
color: #8e8e8e;
}
a:hover{
text-decoration: underline;
}
a:focus{
text-decoration: none;
}
.code {
background-color: #454545;
border: 1px solid #eaeaea;
border-radius: 5px;
color: white;
font-style: normal;
}
span.code {
display: inline-block;
font-weight: bold;
padding: 5px;
}
pre.code{
padding: 15px;
}
input[type="text"] {
padding: 7px;
font-size: 0.8em;
border-radius: 5px;
border: 1px solid #eaeaea;
}
button, [type="submit"] {
padding: 7px;
font-size: 0.8em;
border-radius: 5px;
border: 1px solid white;
background-color: #eaeaea;
cursor: pointer;
}
button:hover, [type="submit"]:hover{
border: 1px solid #454545;
}
button:focus, [type="submit"]:focus{
border: 1px solid #eaeaea;
}
\ No newline at end of file
header{
margin-top: 20px;
line-height: 0;
border: 1px solid #eaeaea;
border-radius: 2.5vw;
overflow: hidden;
-webkit-box-shadow: 0 10px 40px -5px rgba(0,0,0,0.05);
box-shadow: 0 10px 40px -5px rgba(0,0,0,0.05);
padding: 5vw;
background-color: white;
text-align: center;
}
header>p{
color: #8e8e8e;
margin: 2vw 0;
}
header>h1:last-child{
color: #1da1f2;
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="fr">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Activitypub.actor</title>
<title>ActivityPub.Actor</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#0070C0">
<meta name="theme-color" content="#1da1f2">
<meta property="og:title" content="Activitypub.actor" />
<link rel="stylesheet" href="https://dav.li/forkawesome/1.0.11/css/fork-awesome.min.css"/>
<link rel="stylesheet" href="/general.css" type="text/css"/>
<link rel="stylesheet" href="/index.css" type="text/css"/>
</head>
<body>
<h1>Hello, world</h1>
<p>WIP.</p>
<div class="content">
<header>
<h1>ActivityPub.Actor</h1>
<p><i class="fa fa-heart" aria-hidden="true"></i></p>
<h1>Twitter.com</h1>
</header>
<main>
<p>WIP (beta) - <a href="https://framagit.org/DavidLibeau/activitypubactor" target="_blank">Open source</a> - <a href="https://mastodon.xyz/@David" target="_blank">Dev contact</a></p>
</main>
</div>
</body>
</html>
header {
margin-top: 20px;
padding: 5vw;
background-color: white;
text-align: center;
border-radius: 2.5vw;
border: 1px solid #eaeaea;
-webkit-box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
overflow: hidden;
}
header > p {
color: #8e8e8e;
margin-top: 40px;
}
#services {
position: relative;
display: grid;
grid-template-columns: repeat(auto-fill, calc(33% - 7.5px));
grid-gap: 15px;
justify-content: space-between;
list-style: none;
margin: 0 -2vw;
padding: 0;
z-index: 9;
}
@media only screen and (max-width: 850px) {
#services {
grid-template-columns: repeat(auto-fill, calc(50% - 7.5px));
}
}
@media only screen and (max-width: 550px) {
#services {
grid-template-columns: repeat(auto-fill, 100%);
}
}
#services > li {
display: inline-block;
position: relative;
background-color: white;
border-radius: 1vw;
border: 1px solid #eaeaea;
-webkit-box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
box-shadow: 0 10px 40px -5px rgba(0, 0, 0, 0.05);
text-overflow: ellipsis;
overflow: hidden;
}
#services > li > a {
display: block;
padding: 15px;
padding-bottom: 30px;
}
#services > li > a:hover {
text-decoration: none;
}
#services > li h2,
#services > li h3 {
margin: 0;
margin-bottom: 10px;
}
#services > li p {
color: black;
}
#services > li button {
position: absolute;
right: 15px;
bottom: 15px;
padding: 10px;
width: 30px;
height: 30px;
text-align: center;
line-height: 0;
color: #8e8e8e;
background-color: #fcfcfc;
border: 0;
border-radius: 50%;
cursor: pointer;
}
.twitter h2 {
color: #1da1f2
}
.facebook h2 {
color: #4267b2
}
.instagram h2 {
color: #3f729b;
}
.youtube h2 {
color: #FF0000;
}
.vimeo h2 {
color: #aad450;
}
.twitch h2 {
color: #6441A4;
}
.linkedin h2 {
color: #007bb5;
}
.github h2 {
color: #000000;
}
.stackoverflow h2 {
color: #F48024;
}
.behance h2 {
color: #1769ff;
}
.pinterest h2 {
color: #cb2027;
}
.reddit h2 {
color: #ff4500;
}
.medium h2 {
color: #000;
}
.tumblr h2 {
color: #32506d;
}
.wikipedia h2 {
color: #000;
}
#arrow {
position: relative;
margin-top: -10vh;
text-align: center;
font-size: 15em;
color: white;
z-index: 1;
}
#arrow:after {
content: "";
width: 100%;
height: 50%;
display: block;
position: absolute;
top: 0;
background: -moz-linear-gradient(top, rgba(252, 252, 252, 1) 0%, rgba(252, 252, 252, 0.99) 1%, rgba(252, 252, 252, 0) 100%);
background: -webkit-linear-gradient(top, rgba(252, 252, 252, 1) 0%, rgba(252, 252, 252, 0.99) 1%, rgba(252, 252, 252, 0) 100%);
background: linear-gradient(to bottom, rgba(252, 252, 252, 1) 0%, rgba(252, 252, 252, 0.99) 1%, rgba(252, 252, 252, 0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#00fcfcfc', GradientType=0);
}
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Optout - Activitypub.actor</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#1da1f2">
<meta property="og:title" content="Activitypub.actor" />
<link rel="stylesheet" href="https://dav.li/forkawesome/1.0.11/css/fork-awesome.min.css" />
<link rel="stylesheet" href="/general.css" type="text/css" />
</head>
<body>
<div class="content">
<h1>Opt-out from Twitter.ActivityPub.Actor</h1>
<p>WIP. By using the opt-out function, you consent the website to store your username and a link to your tweet in its database.</p>
<h3>1. Tweet this</h3>
<p>Tweet this text :<br/>
<pre class="code">@1da1f2 I want to opt-out from TwitterActivityPubActor 🚷</pre>
<br/><a href="https://twitter.com/intent/tweet?text=@1da1f2%20I%20want%20to%20opt-out%20from%20TwitterActivityPubActor%20%F0%9F%9A%B7" target="_blank"><button>Instant tweet</button></a>
</p>
<p>As almost nobody is following @1da1f2, this tweet will not be broadcasted to your followers.</p>
<h3>2. Copy the link</h3>
<p>Copy the link of your tweet here : <br/>
<?php
if(isset($_GET["link"]) && $_GET["link"]!=""){
?>
<form method="get">
<input disabled type="text" name="link" placeholder="https://twitter.com/username/status/000000000000000" style="width:350px" />
</form>
</p>
<p>
<?php
$linkexplode=explode("/",$_GET["link"]);
if($linkexplode[2]!="twitter.com" || $linkexplode[3]==null){
?>
<i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <strong>Error</strong> : wrong link. <a href="?link"><button>Try again</button></a><br/>
<?php
}else{
$username=$linkexplode[3];
?>
<i class="fa fa-user-circle-o" aria-hidden="true"></i> User <?php echo("@".$username); ?> successfully detected! <br/>
<?php
$database=file_get_contents("optoutdb.txt");
$duplicate=false;
foreach(preg_split("/((\r?\n)|(\r\n?))/", $database) as $line){
$dbuser=explode(";", $line);
if($dbuser[0]==$username){
$duplicate=true;
}
}
if($duplicate){
?><i class="fa fa-warning" aria-hidden="true"></i> <?php echo("@".$username); ?> already opt-out! <br/><?php
}else{
error_reporting(E_ERROR | E_PARSE);
$dom = new \PHPHtmlParser\Dom();
$dom->loadFromUrl($_GET["link"]);
if($dom->find('meta[property="og:description"]')[0]!=null){
$tweet=$dom->find('meta[property="og:description"]')[0]->getAttribute("content");
}else{
$tweet="";
}
error_reporting(E_ALL);
if($tweet=="“@1da1f2 I want to opt-out from TwitterActivityPubActor 🚷”"){
?><i class="fa fa-check-square" aria-hidden="true"></i> Tweet successfully checked! <br/><?php
if(file_put_contents("optoutdb.txt",$username.";".$_GET["link"]."\r\n",FILE_APPEND)!=false){
?><i class="fa fa-database" aria-hidden="true"></i> ...and successfully saved in database! <br/><?php
}else{
?><i class="fa fa-warning" aria-hidden="true"></i> Error while saving in database. Please contact an admin! <br/><?php
}
}else{
?><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <strong>Error</strong> : wrong tweet. <a href="?link"><button>Try again</button></a><?php
}
}
}
}else{ ?>
<form method="get">
<input type="text" name="link" placeholder="https://twitter.com/username/status/000000000000000" style="width:350px" />
<input type="submit" />
</form>
<?php } ?>
</p>
<h3>3. Keep your tweet</h3>
<p>Do not delete your tweet, this is a proof!</p>
<hr>
<h3>Cancel your opt-out</h3>
<p>
<?php
if(isset($_GET["cancelusername"]) && $_GET["cancelusername"]!=""){
$username=str_replace("@","",$_GET["cancelusername"]);
$database=file_get_contents("optoutdb.txt");
$inDatabase=false;
foreach(preg_split("/((\r?\n)|(\r\n?))/", $database) as $line){
$dbuser=explode(";", $line);
if($dbuser[0]==$username){
$inDatabase=true;
$tweetlink=$dbuser[1];
}
}
if($inDatabase){
error_reporting(E_ERROR | E_PARSE);
$dom = new \PHPHtmlParser\Dom();
$dom->loadFromUrl($tweetlink);
if($dom->find('meta[property="og:description"]')[0]!=null){
$tweet=$dom->find('meta[property="og:description"]')[0]->getAttribute("content");
}else{
$tweet="";
}
error_reporting(E_ALL);
if($tweet=="“@1da1f2 I want to opt-out from TwitterActivityPubActor 🚷”"){
?><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <strong>Error</strong> : the opt-out tweet is still online. You need to delete your tweet first. To find it, search "from:yourUsername TwitterActivityPubActor" on Twitter.com!<?php
}else{
$database=str_replace($username.";".$tweetlink."\r\n","",$database);
if(file_put_contents("optoutdb.txt",$database)!=false || strlen($database)==0){
?><i class="fa fa-check-square" aria-hidden="true"></i> You have been successfully removed from opt-out database! <br/><?php
}else{
?><i class="fa fa-warning" aria-hidden="true"></i> Error while saving in database. Please contact an admin! <br/><?php
}
}
}else{
?><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <strong>Error</strong> : this username is not in database. Check spelling (case-sentitive). <a href="?tryagain"><button>Try again</button></a><?php
}
?>
</p>
<?php }else{ ?>
<p>If you want to cancel your opt-out, enter your username here :<br/>
<form method="get">
<input type="text" name="cancelusername" placeholder="@username" />
<input type="submit" />
</form>
</p>
<?php } ?>
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="fr">
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@<?php echo($username); ?> - Twitter account - Activitypub.actor</title>
<title>@<?php echo($username); ?> - Twitter account - ActivityPub.Actor</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="theme-color" content="#0070C0">
<meta name="theme-color" content="#1da1f2">
<meta property="og:title" content="@<?php echo($username); ?> - Twitter account - Activitypub.actor" />
<meta property="og:type" content="profile" />
<meta property="og:url" content="https://twitter.activitypub.actor/<?php echo($username); ?>" />
<meta property="og:image" content="https://twitter.activitypub.actor/<?php echo($username); ?>/avatar.jpg" />
<meta property="og:image" content="https://twitter.activitypub.actor/<?php echo($username); ?>/header.jpg" />
<meta property="og:profile:username" content="<?php echo($username); ?>" />
<meta property="og:profile:profile:first_name" content="<?php echo($name); ?>" />
<meta property="og:profile:profile:last_name" content="" />
<link rel="stylesheet" href="https://dav.li/forkawesome/1.0.11/css/fork-awesome.min.css"/>
<link rel="stylesheet" href="/general.css" type="text/css"/>
<link rel="stylesheet" href="/account.css" type="text/css"/>
</head>
<body>
......@@ -19,10 +28,26 @@
<img class="avatar" src="/<?php echo($username); ?>/avatar.jpg"/>
<h1><?php echo($name); ?></h1>
<h2>@<?php echo($username); ?></h2>
<p class="description"><?php echo($description); ?></p>
<a class="externallink" href="http://twitter.com/<?php echo($username); ?>" rel="noopener noreferrer" title="By clicking on this link, you will be redirected to Twitter.com">See on <i class="fa fa-twitter" aria-hidden="true"></i> Twitter.com <i class="fa fa-external-link" aria-hidden="true"></i></a>
<a class="optionmenu" href="#optionmenu"><i class="fa fa-ellipsis-v" aria-hidden="true"></i></a>
<label id="optionmenu">
<i class="fa fa-ellipsis-v" aria-hidden="true"></i>
<input type="checkbox"/>
<ul>
<li><a href=""><i class="fa fa-share-alt" aria-hidden="true"></i> Share</a></li>
<li><a href="/<?php echo($username); ?>/json"><i class="fa fa-code" aria-hidden="true"></i> See JSON Actor</a></li>
<li><a href=""><i class="fa fa-refresh" aria-hidden="true"></i> Flush cache</a></li>
<li><a href="/optout/<?php echo($username); ?>"><i class="fa fa-sign-out" aria-hidden="true"></i> Opt-out</a></li>
</ul>
</label>
</div>
</header>
<main>
<p>This account is hosted on <a href="http://twitter.com/" rel="noopener noreferrer" target="_blank"><i class="fa fa-twitter" aria-hidden="true"></i> Twitter.com</a>.</p>