$value){ switch($key){ case "explicit": $user_settings['explicit'] = htmlentities($value); break; case "emoji": $user_settings['emoji'] = intval($value); break; case "text": $user_settings['text'] = ($value == "on" ? "on" : "off"); break; case "attach": $user_settings['attach'] = ($value == "on" ? "on" : "off"); break; case "replies": $user_settings['replies'] = ($value == "on" ? "on" : "off"); break; case "setreblog": $user_settings['reblog'] = ($value == "on" ? "on" : "off"); break; case "videoloop": $user_settings['videoloop'] = ($value == "on" ? "on" : "off"); break; case "instance": if (!isset($_COOKIE['token'])){ $user_settings['instance'] = htmlentities($value); } break; } } setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); die(); } $thread = (isset($_GET['thread']) ? htmlentities($_GET['thread']) : false); $mode = (isset($_GET['mode']) ? htmlentities($_GET['mode']) : false); $ajax = (isset($_GET['a']) ? true : false); foreach($_GET as $key => $value){ switch($key){ case "fav": $result = favourite($value,($mode === 'on' ? true : false)); if ($ajax){ echo $result; die(); } else { header("Location: ?thread=".$value); } break; case "reblog": $result =reblog($value,($mode === 'on' ? true : false)); if ($ajax){ echo $result; die(); } else { header("Location: ?thread=".$value); } break; case "mute": if($thread){ $rel = api_post("statuses/".htmlentities($value)."/".($mode === 'true' ? "" : "un")."mute",array()); echo (isset($rel[0]['muting']) ? "1" : "0" ); } else { $rel = api_post("accounts/".htmlentities($value)."/".($mode === 'true' ? "" : "un")."mute",array()); echo (isset($rel[0]['muting']) ? "1" : "0" ); } die(); break; case "list": if($mode === 'true'){ $rel = api_post("lists/".htmlentities($value)."/accounts?account_ids[]=".$_GET['user'],array()); var_dump($rel); } else { $rel = api_delete("lists/".htmlentities($value)."/accounts?account_ids[]=".$_GET['user'],array()); var_dump($rel); } die(); break; case "block": $rel = api_post("accounts/".htmlentities($value)."/".($mode === 'true' ? "" : "un")."block",array()); echo (isset($rel[0]['blocking']) ? "1" : "0" ); die(); break; case "bookmark": $status = api_get("statuses/".htmlentities($value)); $rel = api_post("statuses/".htmlentities($value)."/".($status['bookmarked'] == 'true' ? "un" : "")."bookmark",array()); die(); break; case "notif": echo getnotif(intval($value),(isset($_GET['max']) ? true : false)); die(); break; case "delete": echo delpost(htmlentities($value)); die(); break; case "replies": $since = (isset($_GET['since']) ? htmlentities($_GET['since']) : false); foreach(getreplies(htmlentities($value),$since) as $elem){ echo render_reply($elem['content']); } die(); break; case "notes": $notes = getnotes($value); foreach ($notes as $note){ echo "
"; } die(); break; case "follow": $rel = api_post("accounts/".htmlentities($value)."/follow",array()); echo ($rel[0]['following'] == true || $rel[0]['requested'] == true ? "1" : "0" ); die(); break; case "unfollow": $rel = api_post("accounts/".htmlentities($value)."/unfollow",array()); echo ($rel[0]['following'] == false ? "1" : "0" ); die(); break; case "nsfw": if(in_array($value,$user_settings['nsfw'])){ $key = array_search($value, $user_settings['nsfw']); unset($user_settings['nsfw'][$key]); setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); } else { $user_settings['nsfw'][] = htmlentities($value); setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); } echo "1"; die(); break; case "hide": if(!isset($user_settings['hide'])|| !is_array($user_settings['hide'])){ $user_settings['hide'] = array(); } if(in_array($value,$user_settings['hide'])){ $key = array_search($value, $user_settings['hide']); unset($user_settings['hide'][$key]); setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); } else { $user_settings['hide'][] = htmlentities($value); setrawcookie("user_settings",base64_encode(json_encode($user_settings)),time()+60*60*24*30,'/'); } echo "1"; die(); break; case "userinfo": $info = api_get("accounts/".htmlentities($value)); $rel = api_get("accounts/relationships?id=".htmlentities($value)); $image=imagecreatefromstring(file_get_contents($info['avatar'])); $thumb=imagecreatetruecolor(1,1); imagecopyresampled($thumb,$image,0,0,0,0,1,1,imagesx($image),imagesy($image)); $mainColor=strtoupper(dechex(imagecolorat($thumb,0,0))); echo "