Skip to content

Commit

Permalink
tabs to spaces
Browse files Browse the repository at this point in the history
Change-Id: I90ea2a9172cb2b11e90c5f302a45f9676edc67be
  • Loading branch information
thesandlord committed Apr 7, 2016
1 parent f3636d7 commit 7918927
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 138 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"google/recaptcha": "~1.1"
}
"require": {
"google/recaptcha": "~1.1"
}
}
10 changes: 5 additions & 5 deletions constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
define('SUBDOMAIN','<YOUR-SUBDOMAIN>');
define('TOKEN','<YOUR-API-TOKEN>');
define('SECRET', '<YOUR-reCAPTCHA-SECRET>');
define('SITEKEY', '<YOUR-reCAPTCHA-SITEKEY>');
define('NOTE', '<YOUR-NOTE>');
define('SUBDOMAIN','<YOUR-SUBDOMAIN>');
define('TOKEN','<YOUR-API-TOKEN>');
define('SECRET', '<YOUR-reCAPTCHA-SECRET>');
define('SITEKEY', '<YOUR-reCAPTCHA-SITEKEY>');
define('NOTE', '<YOUR-NOTE>');
?>
118 changes: 59 additions & 59 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,74 +32,74 @@
// Get team data from slack
if($reply['ok']){

$img = $reply['team']['icon']['image_68'];
$name = $reply['team']['name'];
$img = $reply['team']['icon']['image_68'];
$name = $reply['team']['name'];

foreach($reply['users'] as $val) {
foreach($reply['users'] as $val) {

$total = $total + 1;
if('active' == $val['presence']) {
$active = $active + 1;
}
}
$total = $total + 1;
if('active' == $val['presence']) {
$active = $active + 1;
}
}
}
?>
<html>
<head>
<title>Join <?php echo $name; ?> on Slack!</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,user-scalable=no">
<link rel="shortcut icon" href="https://slack.global.ssl.fastly.net/272a/img/icons/favicon-32.png">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<div style="text-align: center; margin-top: 75px">
<head>
<title>Join <?php echo $name; ?> on Slack!</title>
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,user-scalable=no">
<link rel="shortcut icon" href="https://slack.global.ssl.fastly.net/272a/img/icons/favicon-32.png">
<link rel="stylesheet" href="style.css" type="text/css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
<div style="text-align: center; margin-top: 75px">

<div style="margin-bottom: 40px;">
<img src="<?php echo $img; ?>" class="logo" />
<span class="plus">+</span>
<img src="https://upload.wikimedia.org/wikipedia/en/7/76/Slack_Icon.png" class="logo" />
</div>
<div style="margin-bottom: 40px;">
<img src="<?php echo $img; ?>" class="logo" />
<span class="plus">+</span>
<img src="https://upload.wikimedia.org/wikipedia/en/7/76/Slack_Icon.png" class="logo" />
</div>

<div style="margin:5px;">Join <b><?php echo $name; ?></b> on Slack.</div>
<div style="margin:5px;">Join <b><?php echo $name; ?></b> on Slack.</div>

<div style="margin:5px;"> <b style="color: #E01563;"><?php echo $active;?></b> users online now of <b><?php echo $total; ?></b> registered.</div>
<div style="margin:5px;"> <b style="color: #E01563;"><?php echo $active;?></b> users online now of <b><?php echo $total; ?></b> registered.</div>

<form class="form" id="user_info" action="signup.php" method="POST">
<input type="email" class="form-item" placeholder="[email protected]" autofocus="true" name="email">
<button class="button form-item" id='button' type="submit"> Get my Invite </button>
<p class="muted"> <a href="https://<?php echo $name; ?>.slack.com">Already have an account? Click here to go to Slack.<a> </p>
<div class="g-recaptcha" data-sitekey="<?php echo SITEKEY; ?>"></div>
<p class="muted note"> <b>Note:</b> <?php echo NOTE; ?></p>
</form>
</div>
<form class="form" id="user_info" action="signup.php" method="POST">
<input type="email" class="form-item" placeholder="[email protected]" autofocus="true" name="email">
<button class="button form-item" id='button' type="submit"> Get my Invite </button>
<p class="muted"> <a href="https://<?php echo $name; ?>.slack.com">Already have an account? Click here to go to Slack.<a> </p>
<div class="g-recaptcha" data-sitekey="<?php echo SITEKEY; ?>"></div>
<p class="muted note"> <b>Note:</b> <?php echo NOTE; ?></p>
</form>
</div>

<script>
$('#user_info').submit(function(e) {
e.preventDefault();
var button = document.getElementById('button');
button.style.background = "#D6D6D6";
button.innerHTML = "Please Wait...";
$this = $(this);
$.ajax({
type: "POST",
url: "signup.php",
data: $this.serialize()
}).done(function(response) {
response = JSON.parse(response);
if(response.ok)
button.style.background = "#68C200";
else
button.style.background = "#F4001E";
button.innerHTML = response.message;
}).fail(function( jqXHR, textStatus ) {
button.style.background = "#F4001E";
button.innerHTML = "Backend Failure"
});
});
</script>
<script>
$('#user_info').submit(function(e) {
e.preventDefault();
var button = document.getElementById('button');
button.style.background = "#D6D6D6";
button.innerHTML = "Please Wait...";
$this = $(this);
$.ajax({
type: "POST",
url: "signup.php",
data: $this.serialize()
}).done(function(response) {
response = JSON.parse(response);
if(response.ok)
button.style.background = "#68C200";
else
button.style.background = "#F4001E";
button.innerHTML = response.message;
}).fail(function( jqXHR, textStatus ) {
button.style.background = "#F4001E";
button.innerHTML = "Backend Failure"
});
});
</script>

</body>
<footer><a href="https://github.com/thesandlord/SlackEngine">SlackEngine</a>, powered by <a href="https://cloud.google.com/appengine/" target="_blank">App Engine</a></footer>
</body>
<footer><a href="https://github.com/thesandlord/SlackEngine">SlackEngine</a>, powered by <a href="https://cloud.google.com/appengine/" target="_blank">App Engine</a></footer>
</html>
78 changes: 39 additions & 39 deletions signup.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,51 +30,51 @@

if ($resp->isSuccess()) {

if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

$out["message"] = "Invalid Email";
} else {
$out["message"] = "Invalid Email";
} else {

$slackInviteUrl = 'https://'.SUBDOMAIN.'.slack.com/api/users.admin.invite?t='.time();
$slackInviteUrl = 'https://'.SUBDOMAIN.'.slack.com/api/users.admin.invite?t='.time();

// add fileds
$fields .= "email=".urlencode($email)."&";
$fields .= "token=".TOKEN."&";
$fields .= "set_active=true&";
$fields .= "_attempts=1";
// add fileds
$fields .= "email=".urlencode($email)."&";
$fields .= "token=".TOKEN."&";
$fields .= "set_active=true&";
$fields .= "_attempts=1";

// open connection
$ch = curl_init();
// open connection
$ch = curl_init();

// set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $slackInviteUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 4);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
// set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL, $slackInviteUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 4);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);

// send the request to Slack
$reply = json_decode(curl_exec($ch), true);
curl_close($ch);
// send the request to Slack
$reply = json_decode(curl_exec($ch), true);
curl_close($ch);

// output
if ($reply['ok'] == false) {
// error sending invite
if($reply['error'] == "already_in_team") {
$out["message"] = "You have already joined this Slack!";
} elseif($reply['error'] == "already_invited") {
$out["message"] = "Your invite has already been sent!";
} else {
$out["message"] = "Error Code: ".$reply['error'];
}
} else {
// invitation was sent sucessfully
$out["message"] = "Invitation sent!";
$out["ok"] = true;
}
}
//send JSON response back
echo (json_encode($out, JSON_PRETTY_PRINT));
// output
if ($reply['ok'] == false) {
// error sending invite
if($reply['error'] == "already_in_team") {
$out["message"] = "You have already joined this Slack!";
} elseif($reply['error'] == "already_invited") {
$out["message"] = "Your invite has already been sent!";
} else {
$out["message"] = "Error Code: ".$reply['error'];
}
} else {
// invitation was sent sucessfully
$out["message"] = "Invitation sent!";
$out["ok"] = true;
}
}
//send JSON response back
echo (json_encode($out, JSON_PRETTY_PRINT));
} else {
$out["message"] = "ReCAPTCHA Error. Refresh and try again!";
echo (json_encode($out, JSON_PRETTY_PRINT));
$out["message"] = "ReCAPTCHA Error. Refresh and try again!";
echo (json_encode($out, JSON_PRETTY_PRINT));
}
64 changes: 32 additions & 32 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2015, Google, Inc.
Copyright 2015, Google, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -13,57 +13,57 @@
limitations under the License.
*/
html{
font-family: sans-serif;
font-family: sans-serif;
}
.form{
margin:auto;
width: 300px;
margin:auto;
width: 300px;
}
.form-item{
font-size: 12px;
height: 32px;
line-height: 32px;
margin-top: 10px;
text-align: center;
width: 300px;
font-size: 12px;
height: 32px;
line-height: 32px;
margin-top: 10px;
text-align: center;
width: 300px;
}
.button{
color: #fff;
font-weight: bold;
border-width: 0;
background: #E01563;
text-transform: uppercase;
cursor: pointer;
padding: 0;
transition: background-color 150ms ease-in, color 150ms ease-in;
color: #fff;
font-weight: bold;
border-width: 0;
background: #E01563;
text-transform: uppercase;
cursor: pointer;
padding: 0;
transition: background-color 150ms ease-in, color 150ms ease-in;
}
.logo{
width: 48px;
height: 48px;
vertical-align:middle;
width: 48px;
height: 48px;
vertical-align:middle;
}
.plus{
margin: 20px;
color: #D6D6D6;
margin: 20px;
color: #D6D6D6;
}
footer{
color: #D6D6D6;
font-size: 11px;
margin: 200px auto 0;
width: 300px;
text-align: center;
color: #D6D6D6;
font-size: 11px;
margin: 200px auto 0;
width: 300px;
text-align: center;
}
footer a:active,
footer a:visited{
color: #D6D6D6;
color: #D6D6D6;
}
.muted{
font-size: 0.7em;
font-size: 0.7em;
}
.muted a{
color: grey;
color: grey;
}

.note{
color: grey;
color: grey;
}

0 comments on commit 7918927

Please sign in to comment.