Beispiel #1
0
if (NULL == $m->sports->users->findOne(array("id" => $response->getGraphUser()['id']))) {
    $m->sports->users->update(array("id" => $response->getGraphUser()['id']), $document, array("upsert" => true));
}
$val = $m->sports->sport->find();
echo "<form action='postActivity.php' method='post'><br>What? <select name='sport'>";
foreach ($val as $doc) {
    echo "<option value=" . $doc['internal'] . ">" . $doc['name'] . "</option>";
}
echo "</select>";
echo "<br>When?";
echo "<br><input type='submit'>";
echo "</form>";
$val = $m->sports->events->find();
echo "<ul id='events'>";
foreach ($val as $doc) {
    echo render_event($doc);
    //echo "<li>".$doc['sport'];
    //echo " by ".$m->sports->users->findOne(array("id" => $doc['user_id']))['name'];
    //echo "</li>";
}
echo "</ul>";
//$col->update($document);
//$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
//$collection = new MongoDB\Collection($manager, "demo.beers");
//$result = $collection->insertOne( [ 'name' => 'Hinterland', 'brewery' => 'BrewDog' ] );
?>
  <script>
    // Enable pusher logging - don't include this in production
    Pusher.log = function(message) {
      if (window.console && window.console.log) {
        window.console.log(message);
Beispiel #2
0
<?php

require 'vendor/autoload.php';
// include Composer goodies
require_once 'event_render.php';
session_start();
$_POST['user_id'] = $_SESSION['fb_user_id'];
$m = new MongoClient();
$m->sports->events->insert($_POST);
$app_id = '160654';
$app_key = 'b227f5df488b51be2735';
$app_secret = '4fd04b73ede5c049508e';
$pusher = new Pusher($app_key, $app_secret, $app_id, array('encrypted' => true));
$mes = render_event($_POST);
$pusher->trigger('events_channel', 'my_event', $mes);
echo 'Created event';
header("Location: http://" . $_SERVER['SERVER_NAME'] . "/SportsBuddy/viewevents.php");
Beispiel #3
0
include 'header.php';
require_once 'event_render.php';
?>
</div>
  <div class="banner">

    <div class="banner-content">
      <div class="banner-content-header">Find a sports bud and get playing</div>
      Some recent events and sessions:
      <div id="home-events">
      <?php 
require_once __DIR__ . '/../event_render.php';
$val = DB::getEvents(3);
while ($val->hasNext()) {
    $val->next();
    echo render_event($val->current());
}
?>
    </div>
    <a class="viewmore" href="viewevents.php">view more &raquo;</a><br />
      <?php 
require_once __DIR__ . '/../vendor/autoload.php';
$fb = new Facebook\Facebook(['app_id' => '1666203576993752', 'app_secret' => '08bd94f8c9633e0c13d93b1db60706f5', 'default_graph_version' => 'v2.5', 'default_access_token' => 'APP-ID|APP-SECRET']);
$helper = $fb->getRedirectLoginHelper();
$permissions = ['email'];
// Optional permissions
$loginUrl = $helper->getLoginUrl('http://' . $_SERVER['HTTP_HOST'] . '/SportsBuddy/fb-callback.php', $permissions);
echo '<a class="facebook-loginbtn" href="' . htmlspecialchars($loginUrl) . '"><img src="static/img/facebook55.png" /> Login with facebook</a>';
?>
    </div>
  </div>