diff options
Diffstat (limited to 'lib/functions.php')
-rw-r--r-- | lib/functions.php | 24 |
1 files changed, 1 insertions, 23 deletions
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'); |