From aa1bac9aa30c6ba8ff48c8b70dfc523e3197e315 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Sat, 2 Sep 2023 00:18:55 -0600 Subject: Remove ActivityPub and Twitter support, and fix localhost --- lib/functions.php | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'lib/functions.php') diff --git a/lib/functions.php b/lib/functions.php index 6fe13d8..608d473 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -12,7 +12,7 @@ function check_login() { if(isset($_COOKIE['microblog_login'])) { if($_COOKIE['microblog_login'] === sha1($config['url'].$config['admin_pass'])) { // correct auth data, extend cookie life - $domain = ($_SERVER['HTTP_HOST'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false; + $domain = ($_SERVER['SERVER_NAME'] != 'localhost') ? $_SERVER['HTTP_HOST'] : false; setcookie('microblog_login', sha1($config['url'].$config['admin_pass']), NOW+$config['cookie_life'], '/', $domain, false); return true; @@ -607,25 +607,3 @@ function uuidv4($data = null) { // https://stackoverflow.com/a/15875555/3625228 return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } - -function twitter_post_status($status='') { - global $config; - require_once(ROOT.DS.'lib'.DS.'twitter_api.php'); - - if(empty($status)) return array('errors' => 1); - if(empty($config['twitter']['oauth_access_token']) || - empty($config['twitter']['oauth_access_token_secret']) || - empty($config['twitter']['consumer_key']) || - empty($config['twitter']['consumer_secret'])) return array('errors' => 2); - - $url = 'https://api.twitter.com/1.1/statuses/update.json'; - $postfields = array( - 'status' => $status, - 'trim_user' => 1 - ); - - $twitter = new TwitterAPIExchange($config['twitter']); - return $twitter->buildOauth($url, 'POST')->setPostfields($postfields)->performRequest(); -} - -require_once(__DIR__.DS.'activitypub-functions.php'); -- cgit v1.2.3