Skip to content

Instantly share code, notes, and snippets.

@rbowen
Last active February 14, 2017 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbowen/45c47fad9836c1e33e0e308a3d1948aa to your computer and use it in GitHub Desktop.
Save rbowen/45c47fad9836c1e33e0e308a3d1948aa to your computer and use it in GitHub Desktop.
<html>
<head>
<title>OSAS Stories</title>
</head>
<body>
<script>
$("form :input").attr("autocomplete", "off");
</script>
<h2>Tell your stories</h2>
<form method="POST" action="http://stories.tm3.org/">
<input name="doit" value="doit" type="hidden">
<strong>(Optional) Your Twitter handle</strong> @<input name="twitter" autocomplete="off"><br />
<strong>I use</strong> <select name="project">
<option value="CentOS">CentOS</option>
<option value="RDO">RDO</option>
<option value="Gluster">Gluster</option>
<option value="Ceph">Ceph</option>
<option value="Fedora">Fedora</option>
<option value="oVirt">oVirt</option>
<option value="Atomic">Atomic</option>
<option value="Foreman">Foreman</option>
<option value="Ansible">Ansible</option>
</select>
<strong>to ...</strong><br />
<textarea name="story" rows="4" cols="45" onclick="this.select()">save the world</textarea>
<br />
<input type="submit" value="Send!">
</form>
<?php
// TODO: Capture an email address, to contact them later
if (isset($_POST['doit'])) { # Try to tweet
$key = 'KEYGOESHERE';
$apisecret = 'SECRETHERE';
$token = 'TOKENHERE';
$secret = 'SECRETHERE';
// require codebird -
// http://www.pontikis.net/blog/auto_post_on_twitter_with_php
require_once('/var/www/vhosts/stories.tm3.org/codebird.php');
\Codebird\Codebird::setConsumerKey( $key, $apisecret);
$cb = \Codebird\Codebird::getInstance();
$cb->setToken($token, $secret);
$status = '';
if ( $_POST['twitter'] ) {
$status = '. @' . $_POST['twitter'] . ' uses ';
} else {
$status = 'I use ';
}
$status .= $_POST['project'] . ' to ' . $_POST['story'];
$params = array(
'status' => $status,
'media[]' => '/var/www/vhosts/stories.tm3.org/'
. $_POST['project'] . '.png'
);
$reply = $cb->statuses_updateWithMedia($params);
}
?>
<a class="twitter-timeline" href="https://twitter.com/OSASStories">Tweets by OSASStories</a> <script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment