// are we admin? no → leave if (in_array($me, getAdmins())) { } else { header("Location: /"); exit; } include_once 'includes/functions_events.php'; include_once 'includes/functions_cast.php'; include_once 'includes/functions_twitter.php'; $action = "Failure"; $body = ""; $style = " panel-success"; $nextGameEvent = getNextEvent(false, 3600); $nextCastEvent = getNextEvent(true, 3600); $latestCast = getLatestCast(); $recentTweets = getRecentTweets(); // are we supplying tweet, message via POST? → send tweet if (isset($_POST['tweet']) and isset($_POST['message'])) { $action = "Post Tweet"; // set $body to a success or fail message $reply = postTweet($_POST['message']); // test reply here… if (array_key_exists('errors', $reply)) { $style = "panel-danger"; // TODO, do additional checks in the future. Ask admins to copy/paste the error $body = 'Error code ' . $reply['errors'][0]['code'] . ', with message: ' . $reply['errors'][0]['message'] . '<br>'; $body .= print_r($reply, true); $body .= "<br>Please copy/paste the above error, put it in a gist and share with webmaster."; } else { $body = 'Sent ‘' . $_POST['message'] . "’<br>\n"; $body .= print_r($reply, true);
<?php $pageTitle = "News"; include_once 'includes/header.php'; include_once 'includes/lastRSS.php'; if (true) { include_once 'includes/functions_twitter.php'; $tweetblob = '<span class="follow"><a href="//twitter.com/intent/follow?screen_name=SteamLUG&tw_p=followbutton"><i class="fa-twitter"></i><span id="l" class="follow-label">Follow <b>@SteamLUG</b></span></a></span>' . "\n"; $tweetblob .= '<ol>' . "\n"; foreach (getRecentTweets(3) as $tweet) { $time = humanTime($tweet['created_at']); $user = $tweet['user']; if (array_key_exists('retweeted_status', $tweet)) { $user = $tweet['retweeted_status']['user']; $tweet = $tweet['retweeted_status']; } $msg = populateTweet($tweet); $tweetblob .= "<li\n\tclass=\"tweet\">"; $tweetblob .= "<div\n\t\tclass=\"header\"><a class=\"permalink\" href=\"//twitter.com/{$user['screen_name']}/status/{$tweet['id']}\">{$time}</a><div class=\"h-card p-author\"><a class=\"profile\" href=\"//twitter.com/{$user['screen_name']}\"><img class=\"avatar\" alt=\"\" src=\"{$user['profile_image_url_https']}\"><span class=\"full-name\"><span class=\"p-name\">{$user['name']}</span></span><span class=\"p-nickname\">@<b>{$user['screen_name']}</b></span></a></div></div>"; $tweetblob .= "<div\n\t\tclass=\"content\"><p class=\"e-entry-title\" lang=\"en\">{$msg}</p></div>"; $tweetblob .= "<div\n\t\tclass=\"footer\"><ul class=\"tweets\" role=\"menu\"><li><a href=\"//twitter.com/intent/tweet?in_reply_to={$tweet['id']}\" class=\"reply\" title=\"Reply\"><i class=\"fa-reply\"></i><b>Reply</b></a></li><li><a href=\"//twitter.com/intent/retweet?tweet_id={$tweet['id']}\" class=\"retweet\" title=\"Retweet\"><i class=\"fa-retweet\"></i><b>Retweet</b></a></li><li><a href=\"//twitter.com/intent/favorite?tweet_id={$tweet['id']}\" class=\"favourite\" title=\"Favorite\"><i class=\"fa-star\"></i><b>Favorite</b></a></li></ul></div>"; $tweetblob .= "</li>"; } $tweetblob .= '</ol>'; echo <<<TWITTERWIDGET \t\t<h1 class="text-center">News</h1> \t\t<article class="panel panel-default tweets col-md-4 col-md-push-8"> \t\t\t<header class="panel-heading"> \t\t\t\t<h3 class="panel-title">Tweets</h3> \t\t\t</header> \t\t\t<div class="panel-body" id="twitter-here">