Example #1
1
<?php

session_start();
define('ROOT', dirname(__FILE__));
require "flight/Flight.php";
require 'constants/conContainer.php';
require "models/modContainer.php";
require "controllers/objContainer.php";
require "tools/tooContainer.php";
/*引入配置文件*/
$error_info = parse_ini_file("configs/error.ini");
Flight::set('errorn', $error_info);
Flight::route('/', function () {
    echo 'hello world! :-)';
});
Flight::start();
Example #2
0
 function __construct()
 {
     Flight::route("GET /test", function () {
         $this->test();
     });
     Flight::route("POST /createuser", function () {
         $this->createUSer();
     });
 }
 function __construct()
 {
     Flight::route("POST /media/@namespace/@class/@id", function ($namespace, $class, $id) {
         $this->uploadMedia($namespace, $class, $id);
     });
     Flight::route("GET /media/@namespace/@class/@id", function ($namespace, $class, $id) {
         $this->getMedia($namespace, $class, $id);
     });
     Flight::route("GET /media/test", function () {
         $this->test();
     });
     Flight::route("GET /thumbnails/@size/@namespace/@class/@id", function ($size, $namespace, $class, $id) {
         $this->getThumbnail($size, $namespace, $class, $id);
     });
 }
Example #4
0
 function __construct()
 {
     Flight::route("GET /getInvoiceNumber", function () {
         $this->getInvoiceNumber();
     });
     Flight::route("POST /createLedgerEntry", function () {
         $this->createLedgerEntry();
     });
     Flight::route("POST /transactionForTennent", function () {
         $this->transactionForTennent();
     });
     Flight::route("POST /transactionDetails", function () {
         $this->TransactionDetails();
     });
     Flight::route("POST /payment ", function () {
         $this->Payment();
     });
 }
Example #5
0
Flight::route('/administracion/alta-de-usuario/', function () {
    require_once 'controllers/administracion/usuario_controller.php';
});
Flight::route('/administracion/guarda-usuario/', function () {
    require_once 'controllers/administracion/guardaUsuario_controller.php';
});
Flight::route('/administracion/duracion-de-servicios/', function () {
    require_once 'controllers/administracion/duracion_servicios_controller.php';
});
Flight::route('/administracion/actualizacion-de-duracion/', function () {
    require_once 'controllers/administracion/actualizaDuracion_controller.php';
});
Flight::route('/administracion/firmas-autorizadas/', function () {
    require_once 'controllers/administracion/firmas_autorizadas_controller.php';
});
Flight::route('/administracion/actualiza-firmas/', function () {
    require_once 'controllers/administracion/actualizaFirmas_controller.php';
});
/*Ayuda*/
Flight::route('/ayuda/cambiar-contra/', function () {
    require_once 'controllers/ayuda/cambiarContra_controller.php';
});
/*Salir*/
Flight::route('/salir/', function () {
    session_start();
    $_SESSION = array();
    session_destroy();
    session_unset();
    Flight::redirect('/');
});
Flight::start();
Example #6
0
    $cgi->getPkgAtt();
});
Flight::route('POST /user/', function () {
    $user = new user\src\User();
    $user->register();
});
Flight::route('GET /user/', function () {
    $user = new user\src\User();
    $user->getUserInfo();
});
Flight::route('PUT /user/', function () {
    $user = new user\src\User();
    $user->updateUserInfo();
});
Flight::route('POST /users/', function () {
    $user = new user\src\User();
    $user->batRegister();
});
Flight::route('GET /alluser/', function () {
    $user = new user\src\User();
    $user->getAllUser();
});
Flight::route('DELETE /users/', function () {
    $user = new user\src\User();
    $user->deleteUsers();
});
Flight::route('POST /session/', function () {
    $user = new user\src\User();
    $user->login();
});
Flight::start();
Example #7
0
Flight::route('/', function () {
    return Flight::view()->display('index.php', Flight::get('config')->getTemplateData());
});
// ! --- ROUTE: About ---------------------------
Flight::route('/we', function () {
    return Flight::get('config')->renderPage('about');
});
// ! --- ROUTE: Sitemap -------------------------
/**
 * Publishes all routes in the /sitemap.xml
 */
Flight::route('/sitemap.xml', function () {
    $items = Flight::get('navigation.loader')->getNavigationItems();
    $sitemap = array();
    foreach ($items as $item) {
        $sitemap[] = array('Url' => $item->get('Url'), 'DateTime' => $item->get('DateTime'));
    }
    Flight::response()->header('Content-Type', 'application/xml');
    Flight::view()->display('sitemap.php', array('Sitemap' => $sitemap));
});
// ! --- ROUTE: Project -------------------------
Flight::route('/@name', function ($name) {
    return Flight::get('config')->renderPage($name);
});
// ! --- ROUTE: 404 - Not Found -----------------
Flight::map('notFound', function () {
    Flight::view()->display('404.php', Flight::get('config')->getTemplateData());
    Flight::stop(404);
});
// ! --- Kick things off! -----------------------
Flight::start();
Example #8
0
<?php

require_once 'vendor/autoload.php';
// Config views
Flight::set(array('flight.views.path' => './app', 'flight.views.extension' => '.html'));
class Api
{
    public static function related($id)
    {
        $headers = array("Accept" => "application/json");
        $url = "https://api.spotify.com/v1/artists/{$id}/related-artists";
        $related_artists = Unirest\Request::get($url, $headers)->body->artists;
        Flight::json($related_artists);
    }
    public static function toptrack($artist_id)
    {
        $headers = array("Accept" => "application/json");
        $url = "https://api.spotify.com/v1/artists/{$artist_id}/top-tracks?country=US";
        $artist_top_track = Unirest\Request::get($url, $headers)->body;
        Flight::json($artist_top_track);
    }
}
Flight::route('GET /', function () {
    Flight::render('index');
});
Flight::route('GET /api/related/@id', array('Api', 'related'));
Flight::route('GET /api/toptrack/@artist_id', array('Api', 'toptrack'));
Flight::start();
Example #9
0
<?php

// Start a Session
if (!session_id()) {
    @session_start();
}
// define some constants for the project
define('PROJECT_FOLDER', '/');
define('EMAIL_TO', '*****@*****.**');
// load libraries through composer
require_once 'vendor/autoload.php';
WingCommander::init();
Flight::set('flight.base_url', PROJECT_FOLDER);
// load dotenv
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
// routes
Flight::route('/', array('AcaSeDona\\Home', 'index'));
Flight::route('POST /send-place', array('AcaSeDona\\Home', 'save_place'));
Flight::route('/places', array('AcaSeDona\\Home', 'display_places'));
// Flight::route('POST /send-mail', array('AcaSeDona\Contact', 'send'));
Flight::route('/backend/places', array('AcaSeDona\\Backend', 'places'));
Flight::route('/backend/hide_place/@id', array('AcaSeDona\\Backend', 'hide_place'));
Flight::start();
Example #10
0
<?php

//routes
/*
Flight::route('GET /', function(){
    return Flight::render('index');
});
*/
Flight::route('GET /', ['HomeController', 'index']);
<?php

include 'flight/Flight.php';
include 'lib/lib.php';
// GET /urn
Flight::route('GET /urn', function () {
    echo '--';
});
// POST /urn
Flight::route('POST /urn/@urn', function ($urn) {
    $urnValid = isUrnValid($urn);
    // Build response
    $response = array();
    // Info
    $response['info'] = array();
    $response['info']['name'] = 'universal-document-server';
    $response['info']['version'] = '0.1';
    // Data
    $response['data'] = array();
    $response['data']['type'] = 'urnRequestResponse';
    $response['data']['requestedUrn'] = $urn;
    $response['data']['validated'] = $urnValid;
    $response['data']['message'] = '';
    header('Content-type: application/json');
    $jsonResponse = json_encode($response);
    echo $jsonResponse;
});
// Start
Flight::start();
Example #12
0
<?php

require 'flight/Flight.php';
Flight::route('*', function () {
    Flight::render('hello.php');
});
Flight::start();
<?php

require __DIR__ . '/database/bootEloquent.php';
Flight::set('flight.views.path', __DIR__ . '/views');
// routes
Flight::route('/', function () {
    Flight::render('hello.php', ['pessoas' => Pessoa::all()]);
});
Flight::route('POST /pessoas', function () {
    $pessoa = new Pessoa();
    $pessoa->nome = Flight::request()->data['nome'];
    $pessoa->save();
    Flight::redirect('/');
});
Flight::start();
Example #14
0
<?php

// Index
Flight::route('/', array('IndexController', 'index'));
// Php Infos
Flight::route('/php-infos', array('IndexController', 'phpInfos'));
// Symfony Infos
Flight::route('/symfony', array('IndexController', 'symfony'));
// Majesteel Infos
Flight::route('/majesteel', array('IndexController', 'majesteel'));
Example #15
0
session_start();
//главная страница
Flight::route('/(\\?p=@p)', function ($p) {
    $s_login = SetLogin();
    //gettin page index
    $page = 1;
    if ($p > 1) {
        $page = $p;
    }
    $postselector = ($page - 1) * 5;
    $posts = Flight::db()->GetPosts($postselector, 5);
    $postscount = Flight::db()->CountPosts();
    $pages_count = ceil($postscount / 5);
    Flight::render('home.php', array('headertext' => 'Мой летучий блог', 'authorname' => $s_login, 'footertext' => '@ProgForce forever'), 'home_page_content');
    Flight::render('post.php', array('posts' => $posts), 'posts_block');
    Flight::render('page_hyperlinks.php', array('pages_count' => $pages_count, 'current_page' => $page), 'pages_n_links');
    Flight::render('auth_view.php', null, 'auth_view');
    Flight::render('home_layout.php', null);
});
Flight::route('/exit', function () {
    session_destroy();
    Flight::redirect('/');
});
Flight::route('/auth/', function () {
    Flight::render('auth.php', null);
});
/*Flight::route('POST /authconfirm/', function()
		{ 
			Flight::render('authconfirm.php',array('post_args' => $_POST));
		});*/
Flight::start();
Example #16
0
File: routes.php Project: npk/Ourls
            $id = Flight::get('hash')->decode($hash);
            if (!$id) {
                Flight::json(['status' => 0, 'msg' => '短址无法解析']);
            } else {
                $store = Flight::get('db')->select('urls', ['url'], ['id' => $id]);
                if (!$store) {
                    Flight::json(['status' => 0, 'msg' => '地址不存在']);
                } else {
                    Flight::json(['status' => 1, 'url' => $store[0]['url']]);
                }
            }
        }
    }
});
Flight::route('/@hash', function ($hash) {
    $id = Flight::get('hash')->decode($hash);
    if (!$id) {
        Flight::notFound('短址无法解析');
    } else {
        $store = Flight::get('db')->select('urls', ['url'], ['id' => $id]);
        if (!$store) {
            Flight::notFound('地址不存在');
        } else {
            Flight::get('db')->update('urls', ['count[+]' => 1], ['id' => $id]);
            Flight::redirect($store[0]['url'], 302);
        }
    }
});
Flight::map('notFound', function ($message) {
    Flight::response()->status(404)->header('content-type', 'text/html; charset=utf-8')->write('<h1>404 页面未找到</h1>' . "<h3>{$message}</h3>" . '<p><a href="' . Flight::get('flight.base_url') . '">回到首页</a></p>' . str_repeat(' ', 512))->send();
});
Example #17
0
<?php

require dirname(__DIR__) . '/vendor/autoload.php';
Flight::route('/', function () {
    echo "OK Route: /";
});
Flight::route('/something', function () {
    echo "OK Route: /something";
});
Flight::map('notFound', function () {
    echo "KO";
});
Flight::start();
Example #18
0
});
// update comment by id and by book
Flight::route("PUT /books/@book_id/comments/@comment_id", function ($book_id, $comment_id) use($connection) {
    $result = $connection->prepare("UPDATE comments SET content = :content, rating = :rating WHERE id = :comment_id");
    $result->execute(array(":content" => Flight::request()->data->content, ":rating" => Flight::request()->data->rating, ":comment_id" => $comment_id));
    $status = false;
    $message = "Impossible to update this comment";
    if ($result->rowCount() == 1) {
        $status = true;
        $message = "Comment updated";
    }
    $return = array("success" => $status, "message" => $message);
    Flight::json($return);
});
// remove comment by id
Flight::route("DELETE /books/@book_id/comments/@comment_id", function ($book_id, $comment_id) use($connection) {
    $result = $connection->prepare("DELETE FROM comments WHERE id = :comment_id");
    $result->execute(array(":comment_id" => $comment_id));
    $status = false;
    $message = "This comment don't exist or an error emerged";
    if ($result->rowCount() == 1) {
        $status = true;
        $message = "Comment removed";
    }
    $return = array("success" => $status, "message" => $message);
    Flight::json($return);
});
/**
 * START API
 */
Flight::start();
Example #19
0
Flight::route('/', function () {
    Flight::render('header.php');
    Flight::render('map.php');
    Flight::render('footer.php');
});
Flight::route('/signup', function () {
    Flight::render('header.php');
    Flight::render('signup.php');
    Flight::render('footer.php');
});
Flight::route('/account', function () {
    Flight::render('header.php');
    Flight::render('account.php');
    Flight::render('footer.php');
});
Flight::route('/commits', function () {
    Flight::render('header.php');
    Flight::render('commits.php');
    Flight::render('footer.php');
});
Flight::route('/tokens', function () {
    Flight::render('header.php');
    Flight::render('tokens.php');
    Flight::render('footer.php');
});
Flight::route('/confirm', function () {
    Flight::render('header.php');
    Flight::render('confirm.php');
    Flight::render('footer.php');
});
Flight::start();
Example #20
0
<?php

if (!in_array(getIp(), $GLOBALS['IP_WHITELIST']) && USE_IP_WHITELIST) {
    Flight::route('/*', function () {
        RejectController::ipRejected();
    });
} else {
    Flight::route('GET|POST|UPDATE|PUT|DELETE|PATCH /serv/@client_name/@api_name/@api_version/*', function ($client_name, $api_name, $api_version, $request_json) {
        RestController::act($client_name, $api_name, $api_version, $request_json->splat);
    }, true);
    Flight::route('/*', function () {
        RejectController::reject();
    });
}
Example #21
0
    ini_set('session.cookie_secure', '1');
}
// A special bit of configuration for our host:
// An SSL proxy is provided at https://sslsites.de/your.domain/
// By default, a cookie is set for sslsites.de which means
// other websites available over that proxy can read the cookies!
ini_set('session.cookie_path', parse_url(MY_URL, PHP_URL_PATH));
// Sessions valid for one hour
session_set_cookie_params(COOKIE_SESSION_DURATION);
session_start();
require_once 'include/flight/flight/Flight.php';
require_once 'tokens.php';
init_token_db();
require_once 'handlers/fb_handlers.php';
Flight::route('/', 'handle_root');
Flight::route('/login', 'handle_login');
Flight::route('/fb_callback', 'handle_fb_callback');
Flight::route('/checkin', 'handle_checkin');
Flight::route('/access_code', 'handle_access_code');
Flight::route('/privacy', 'handle_privacy');
Flight::route('/rerequest_permission/', 'handle_rerequest_permission');
require_once 'handlers/gw_handlers.php';
Flight::route('/ping', 'handle_ping');
Flight::route('/auth', 'handle_auth');
// Once login is done, the gateway redirects
// the user to MY_URL . 'portal'
// We don't serve this here, so use external page
Flight::route('/portal', function () {
    Flight::redirect(PORTAL_URL);
});
Flight::start();
Example #22
0
    } else {
        http_response_code(404);
    }
});
Flight::route('POST /report/add', function () {
    $list = Flight::Lists();
    $reportAdd = $list->addReport($_POST['bus'], $_POST['tripId'], $_POST['report'], $_POST['time']);
    if ($reportAdd) {
        http_response_code(200);
    } else {
        http_response_code(404);
    }
});
Flight::route('/csv/@type/@trip/@status', function ($type, $trip, $status) {
    $list = Flight::Lists();
    $tripName = $list->getTripName($trip);
    $fileName = date("m-d-Y") . " - " . $tripName . " - " . $type . ".csv";
    //Gets CSV data from POST and returns file download
    header("Content-type: text/csv");
    header("Content-Disposition: attachment; filename=" . $fileName);
    header("Pragma: no-cache");
    header("Expires: 0");
    echo $list->csv($type, $trip, $status);
});
Flight::route('/message', function () {
    $lists = Flight::Lists();
    $lists->sendMessage();
    $report = "Message send to: " . $_POST['message']['Group'] . " Text:" . $_POST['message']['Message'];
    $lists->addReport($_POST['message']['Bus'], $_POST['message']['Trip'], $report, $_POST['message']['Time']);
});
Flight::start();
Example #23
0
//SETUP Navigation
$nav = file_get_contents('./content/nav.md', FILE_USE_INCLUDE_PATH);
if ($nav === FALSE) {
    $nav = 'Navigation file missing';
}
Flight::set('nav_contents', Markdown($nav));
//Site Title
Flight::set('site_title', 'Markdown Directory');
//ROUTES
Flight::route('/', function () {
    $listing_content = file_get_contents("./content/home.md", FILE_USE_INCLUDE_PATH);
    Flight::display('Welcome to Markdown Directory', $listing_content);
});
Flight::route('/@listing', function ($listing) {
    $listing_content = file_get_contents("./content/listings/{$listing}.md", FILE_USE_INCLUDE_PATH);
    $title = ucwords(str_replace("_", " ", $listing));
    Flight::display($title, $listing_content);
});
//Render
Flight::map('display', function ($title, $list_content) {
    $siteTitle = Flight::get('site_title');
    $title = $title . ' - ' . $siteTitle;
    if ($list_content === FALSE) {
        $list_content = '<p>Listing cannot be found</p>';
    } else {
        $list_content = Markdown($list_content);
    }
    Flight::render('header', array('title' => $title), 'header_content');
    Flight::render('footer', array(), 'footer_content');
    Flight::render('layout', array('nav' => Flight::get('nav_contents'), 'listing' => $list_content, 'site_title' => $siteTitle));
});
Example #24
0
    $track = json_decode(getTrack($id));
    if (!isset($track->error)) {
        Flight::render('editTRack', array('track' => $track), 'body_content');
        Flight::render('layout', array('Titre' => 'Modifier le track ' . $track[0]->title));
    } else {
        Flight::redirect($request->referrer);
    }
});
Flight::route('GET|POST /album/@id/edit', function ($id) {
    $request = Flight::request();
    if ($request->method == "GET") {
        $album = json_decode(getAlbum($id));
        if (!isset($album->error)) {
            Flight::render('editAlbum', array('album' => $album), 'body_content');
            Flight::render('layout', array('Titre' => 'Modifier un track à ' . $album[0]->title));
        } else {
            Flight::redirect($request->referrer);
        }
    } else {
        if ($request->method == "POST") {
            $album = json_encode($_POST);
            $result = json_decode(editAlbum($album));
            if (isset($result->ID)) {
                Flight::redirect($request->referrer);
            } else {
                Flight::redirect('http://localhost/php/App/playlists');
            }
        }
    }
});
Flight::start();
Example #25
0
<?php

require 'flight/Flight.php';
require 'extensions/Bcrypt.php';
// Register Bcrypt class to use later on
Flight::register('bcrypt', 'Bcrypt');
Flight::route('GET /', function () {
    Flight::render('index.php', array('hashResult' => 'Waiting...'));
});
Flight::route('POST /', function () {
    $bcrypt = Flight::bcrypt();
    $hashResult = '';
    $hashMatches = '';
    $hashCheck = false;
    switch ($_POST['method']) {
        case 'hash':
            $hashResult = $bcrypt->hash($_POST['stringToHash']);
            break;
        case 'check':
            $hashMatches = $bcrypt->check($_POST['plainText'], $_POST['hashText']);
            $hashCheck = true;
            break;
    }
    Flight::render('index.php', array('hashResult' => $hashResult, 'hashMatches' => $hashMatches, 'hashCheck' => $hashCheck));
});
Flight::start();
Example #26
0
    
    Flight::route('/manage/division', array('DivisionController', '_manage_division'));
    Flight::route('/manage/loas', array('DivisionController', '_manage_loas'));
    
    
    // admin
    Flight::route('/admin', array('AdminController', '_show'));
    */
    // update user activity
    if (isset($_SESSION['userid'])) {
        User::updateActivityStatus($_SESSION['userid']);
    }
}
// 404 redirect
Flight::map('notFound', array('ApplicationController', '_404'));
// error handler
Flight::route('/error', array('ApplicationController', '_error'));
// graphics
Flight::route('/stats/@division/top10.png', array('GraphicsController', '_generateDivisionTop10'));
// authenticate
Flight::route('GET /authenticate', array('UserController', '_authenticate'));
Flight::route('POST /do/authenticate', array('UserController', '_doAuthenticate'));
Flight::route('POST /do/reset-authentication', array('UserController', '_doResetAuthentication'));
/*// handle errors privately unless localhost
if(!in_array($_SERVER['REMOTE_ADDR'], array( '127.0.0.1', '::1' ))){
    Flight::set('flight.log_errors', true);
    Flight::map('error', function(Exception $ex){
        Flight::redirect('/error', 500);
    });
}
*/
Example #27
0
    PhpReports::displayDashboard($name);
});
//JSON list of reports (used for typeahead search)
Flight::route('/report-list-json', function () {
    header("Content-Type: application/json");
    header("Cache-Control: max-age=3600");
    echo PhpReports::getReportListJSON();
});
//if no report format is specified, default to html
Flight::route('/report', function () {
    PhpReports::displayReport($_REQUEST['report'], 'html');
});
//reports in a specific format (e.g. 'html','csv','json','xml', etc.)
Flight::route('/report/@format', function ($format) {
    PhpReports::displayReport($_REQUEST['report'], $format);
});
Flight::route('/edit', function () {
    PhpReports::editReport($_REQUEST['report']);
});
Flight::route('/set-environment', function () {
    header("Content-Type: application/json");
    $_SESSION['environment'] = $_REQUEST['environment'];
    echo '{ "status": "OK" }';
});
//email report
Flight::route('/email', function () {
    PhpReports::emailReport();
});
Flight::set('flight.handle_errors', false);
Flight::set('flight.log_errors', true);
Flight::start();
Example #28
0
    $t->maintenance();
});
Flight::route('GET /get_task_result/', function () {
    $t = new operation\src\PackageOperation();
    $t->getTaskResult();
});
Flight::route('GET /get_task_result_all/', function () {
    $t = new operation\src\PackageOperation();
    $t->getTaskResultAll();
});
Flight::route('GET /get_task_by_operator/', function () {
    $t = new operation\src\PackageOperation();
    $t->getTaskByOperator();
});
Flight::route('GET /get_task_count_by_operator/', function () {
    $t = new operation\src\PackageOperation();
    $t->getTaskCountByOperator();
});
Flight::route('POST /mark_task_read/', function () {
    $t = new operation\src\PackageOperation();
    $t->markTaskRead();
});
Flight::route('GET /get_update_filelist/', function () {
    $t = new operation\src\PackageOperation();
    $t->getUpdateFileList();
});
Flight::route('POST /start_task/', function () {
    $t = new operation\src\PackageOperation();
    $t->startTaskApi();
});
Flight::start();
Example #29
0
});
Flight::route('/projects', function () {
    Flight::render('projects' . PREFIX, array('active' => 'projects', 'lang' => 'en'));
});
Flight::route('/works', function () {
    Flight::render('projects' . PREFIX, array('active' => 'projects', 'lang' => 'en'));
});
Flight::route('/attorneys', function () {
    Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'en'));
});
Flight::route('/nuestrosabogados', function () {
    Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'es'));
});
Flight::route('/equipo', function () {
    Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'es'));
});
Flight::route('/team', function () {
    Flight::render('home' . PREFIX, array('active' => 'team', 'lang' => 'es'));
});
Flight::route('/contacto', function () {
    Flight::render('contact' . PREFIX . '.es', array('active' => 'contact', 'lang' => 'es'));
});
Flight::route('/contact', function () {
    Flight::render('contact' . PREFIX . '.en', array('active' => 'contact', 'lang' => 'en'));
});
Flight::route('/admin', function () {
    Flight::render('admin', array('active' => '', 'lang' => 'en'));
});
//Config
//Flight::set('flight.views.path', '/path/to/views');
Flight::start();
Example #30
-1
<?php

session_start();
require 'vendor/autoload.php';
use predictionio\EventClient;
Flight::register('mdb', 'Mongo', array('mongodb://localhost'));
//Flight::register('prediction', 'predictionio\EventClient');
Flight::register('guzzle', 'GuzzleHttp\\Client');
Flight::map('prediction_client', function () {
    //$accessKey = 'GJBuFYODWTwFBVQ2D2nbBFW5C0iKClNLEMbYGGhDGoZGEtLre62BLwLJlioTEeJP';
    //$client = new EventClient($accessKey, 'http://localhost:7070');
    $predictionio_appkey = "sD13KDmvVn8RVWaxlkuVUS0wxropKJTdUPbm6vWD7BvheZsqmrW0FJHdZa2y7wR2";
    $predictionio_eventserver = "http://127.0.0.1:7070";
    $client = new EventClient($predictionio_appkey, $predictionio_eventserver);
    return $client;
});
Flight::route('GET /', array('Home', 'index'));
Flight::route('GET /movies/recommended', array('Home', 'recommended'));
Flight::route('POST /movie/random', array('Home', 'random'));
Flight::route('/movies/import', array('Admin', 'import'));
Flight::route('/test', function () {
    $accessKey = 'sD13KDmvVn8RVWaxlkuVUS0wxropKJTdUPbm6vWD7BvheZsqmrW0FJHdZa2y7wR2';
    $client = new EventClient($accessKey, 'http://127.0.0.1:7070');
    $response = $client->setUser(2);
    echo 'a';
    print_r($response);
});
Flight::start();