Ejemplo n.º 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();
Ejemplo n.º 2
0
 public static function init()
 {
     date_default_timezone_set("Etc/GMT");
     if (get_magic_quotes_gpc()) {
         $_GET = self::stripslashesDeep($_GET);
         $_POST = self::stripslashesDeep($_POST);
         $_COOKIE = self::stripslashesDeep($_COOKIE);
     }
     $_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
     Flight::map("db", array(__CLASS__, "db"));
     //Flight::map("cache", array(__CLASS__, "cache"));
     Flight::map("log", array(__CLASS__, "log"));
     Flight::map("curl", array(__CLASS__, "curl"));
     Flight::map("halt", array(__CLASS__, "halt"));
     Flight::map("getRunTime", array(__CLASS__, "getRunTime"));
     Flight::map("returnJson", array(__CLASS__, "returnJson"));
     Flight::map("controller", array(__CLASS__, "getController"));
     Flight::map("model", array(__CLASS__, "getModel"));
     Flight::map("url", array(__CLASS__, "url"));
     Flight::map("connectMysqlDB", array(__CLASS__, "connectMysqlDB"));
     Flight::map("closeMysqlDB", array(__CLASS__, "closeMysqlDB"));
     Flight::map("connectMongoDB", array(__CLASS__, "connectMongoDB"));
     Flight::map("closeMongoDB", array(__CLASS__, "closeMongoDB"));
     Flight::map("connectRedis", array(__CLASS__, "connectRedis"));
     Flight::set('flight.log_errors', true);
     //写一个日志
     //if(Flight::request()->method == "POST") {
     // Flight::log("post-".date("Ymd"))->info(print_r($_POST, TRUE));
     //}
     self::initRoute();
 }
Ejemplo n.º 3
0
 /**
  * check if user is logged in as admin
  */
 private function checkAdmin()
 {
     $admin = false;
     if (isset($_SESSION['admin'])) {
         F::set('admin', 1);
         $admin = true;
     }
     F::view()->assign(array('admin' => $admin));
 }
Ejemplo n.º 4
0
 function testGetAndSet()
 {
     Flight::set('a', 1);
     $var = Flight::get('a');
     $this->assertEquals(1, $var);
     Flight::clear();
     $vars = Flight::get();
     $this->assertEquals(0, count($vars));
     Flight::set('a', 1);
     Flight::set('b', 2);
     $vars = Flight::get();
     $this->assertEquals(2, count($vars));
     $this->assertEquals(1, $vars['a']);
     $this->assertEquals(2, $vars['b']);
 }
Ejemplo n.º 5
0
/**
 * Get, and store for the session, location data for the current visitor
 *
 * @return object IP location data.
 */
function sd_location_data()
{
    $key = 'sd.location';
    $data = Flight::get($key);
    if (empty($data)) {
        if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
            $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
        }
        if ('dev' == ENV) {
            $_SERVER['REMOTE_ADDR'] = '';
        }
        $path = 'https://freegeoip.net/json/' . $_SERVER['REMOTE_ADDR'];
        $data = file_get_contents($path);
        Flight::set($key, $data);
    }
    return json_decode($data);
}
Ejemplo n.º 6
0
<?php

if (!function_exists('avg')) {
    function avg(array $data)
    {
        return array_sum($data) / count($data);
    }
}
/**
 * Registers a class and set a variable to framework method.
 *
 * @param string $name Method name
 * @param string $class Class name
 * @param array $params Class initialization parameters
 * @param callback $callback Function to call after object instantiation
 * @throws \Exception If trying to map over a framework method
 */
Flight::map('instance', function ($name, $class, array $params = array(), $callback = null) {
    Flight::register($name, $class, $params, $callback);
    Flight::set($name, Flight::$name());
});
Ejemplo n.º 7
0
 public function set($key, $value)
 {
     return Flight::set($key, $value);
 }
Ejemplo n.º 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();
Ejemplo n.º 9
0
<?php

Flight::set("organizer.settings.path", "config/settings.json");
Flight::map("read_settings", function () {
    if (($settings = file_get_contents(Flight::get("organizer.settings.path"))) !== false) {
        return json_decode($settings, true);
    } else {
        return false;
    }
});
Flight::map("load_settings", function () {
    $settings = Flight::read_settings();
    Flight::set("organizer.settings", $settings);
    return $settings;
});
Flight::map("setting", function ($path) {
    $settings = Flight::get("organizer.settings");
    foreach (explode(".", $path) as $key) {
        $settings = $settings[$key];
    }
    return $settings;
});
Flight::map("write_settings", function ($settings) {
    $settings = json_encode($settings);
    return file_put_contents(Flight::get("organizer.settings.path"), $settings);
});
Flight::map("dump_settings", function () {
    return Flight::write_settings(Flight::get("organizer.settings"));
});
<?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();
Ejemplo n.º 11
0
<?php

Flight::route('*', array('Base', 'index'));
Flight::route('/', function () {
    Flight::redirect('/admin/index');
});
Flight::route('/backend/*', function () {
    Flight::redirect('/admin/index');
});
// 运行action
Flight::route("/@app/@act", function ($app, $act) {
    $class = ucwords("{$app}");
    // 设置当前操作在全局变量里面
    Flight::set('app', strtolower($app));
    Flight::set('act', $act);
    $class::$act();
});
Ejemplo n.º 12
0
<?php

Flight::path("model/");
Flight::path("controller/");
Flight::register('db', 'mysqli', [$config['db']['host'], $config['db']['username'], $config['db']['password'], $config['db']['databasename']]);
Flight::register("util", "util");
Flight::register("auth", "authController");
Flight::register("posts", "postController");
Flight::register("users", "userController");
Flight::set("flight.base_url", $config['web']['base_url']);
Flight::map('link', function ($url) {
    echo Flight::get('flight.base_url') . $url;
});
Ejemplo n.º 13
0
<?php

# Site name to appear in the <title> tags and footer copyright text
define('SITE_NAME', 'Your Name');
# Database connection information
Flight::register('db', 'PDO', array('sqlite:../db.sqlite3'));
# The directory to look for views in
Flight::set('flight.views.path', '../views');
# The file extension of view files
Flight::set('flight.views.extension', '.phtml');
Ejemplo n.º 14
0
<?php

/**
 * @copyright Copyright (C) 2015 hiphper, All rights reserved.
 * @license GNU/GPL V2 http://gnu.org/licenses/gpl-2.0.html
 * @author hiphper at 163 dot com
 * @link https://github.com/hi-phper/xieblog
 */
require 'vendor/autoload.php';
require 'libs/Config.php';
require 'libs/Post.php';
use JasonGrimes\Paginator;
$config = new Config('config.json');
Flight::set('flight.views.path', './templates/' . $config->get('template'));
Flight::route('/', function () use($config) {
    $post = new Post();
    $page = 1;
    $posts = $post->getPosts($page, $config->get('per_page'));
    $totalItems = count($post->getPostNames());
    $urlPattern = $config->get('base_url') . 'page/(:num)';
    $paginator = new Paginator($totalItems, $config->get('per_page'), $page, $urlPattern);
    Flight::render('index', array('posts' => $posts, 'config' => $config, 'paginator' => $paginator), 'content_layout');
    Flight::render('layouts/default');
});
Flight::route('/page/@page', function ($page) use($config) {
    $post = new Post();
    $posts = $post->getPosts($page, $config->get('per_page'));
    $totalItems = count($post->getPostNames());
    $urlPattern = $config->get('base_url') . 'page/(:num)';
    $paginator = new Paginator($totalItems, $config->get('per_page'), $page, $urlPattern);
    Flight::render('index', ['posts' => $posts, 'config' => $config, 'paginator' => $paginator], 'content_layout');
Ejemplo n.º 15
0
<?php

require_once "flight/Flight.php";
require_once "conf/config.php";
require_once "conf/settings.php";
session_start();
Flight::set('currentUser', isset($_SESSION['user']) ? $_SESSION['user'] : null);
require_once "conf/routes.php";
Flight::start();
Ejemplo n.º 16
0
<?php

define("START_TIME", microtime());
define("APP_PATH", __DIR__ . "/../app");
require __DIR__ . "/../vendor/autoload.php";
Flight::set(require APP_PATH . "/config/app.php");
Flight::path(Flight::get("flight.controllers.path"));
Flight::path(Flight::get("flight.models.path"));
Flight::path(Flight::get("flight.libs.path"));
Ejemplo n.º 17
0
function setLang($lang)
{
    setcookie("extractLang", $lang, time() + 31536000, '/');
    Flight::set('lang', $lang);
}
Ejemplo n.º 18
0
// Register classes
Flight::register('db', 'PDO', array("mysql:host={$db_host};dbname={$db_name}", $db_user, $db_pass));
Flight::register('config', 'Config', array(Flight::db()));
Flight::register('auth', 'Auth', array(Flight::db(), Flight::config()));
// Set Timezone
date_default_timezone_set(Flight::config()->site_timezone);
// Check if user is logged in
if (Flight::request()->cookies->{Flight::config()->cookie_name} == false) {
    Flight::set('loggedin', false);
} else {
    if (Flight::auth()->checkSession(Flight::request()->cookies->{Flight::config()->cookie_name})) {
        Flight::set('loggedin', true);
        $uid = Flight::auth()->getSessionUID(Flight::request()->cookies->{Flight::config()->cookie_name});
        Flight::set('userdata', Flight::auth()->getUser($uid));
    } else {
        Flight::set('loggedin', false);
        setcookie(Flight::config()->cookie_name, "", time() - 3600, Flight::config()->cookie_path, Flight::config()->cookie_domain, Flight::config()->cookie_secure, Flight::config()->cookie_http);
    }
}
// Routes
Flight::route('POST /auth/login', function () {
    if (Flight::get('loggedin') == true) {
        $call['message'] = Flight::get('lang')['already_authenticated'];
        $call['code'] = 403;
    } else {
        $call = Flight::auth()->login(Flight::request()->data->username, Flight::request()->data->password, Flight::request()->data->remember);
        $call['message'] = Flight::get('lang')[$call['message']];
        if ($call['code'] == 200) {
            setcookie(Flight::config()->cookie_name, $call['hash'], $call['expire'], Flight::config()->cookie_path, Flight::config()->cookie_domain, Flight::config()->cookie_secure, Flight::config()->cookie_http);
        }
    }
Ejemplo n.º 19
0
<?php

header('Content-Type: text/html; charset=utf-8');
define('PATH_LIBS', $_SERVER['DOCUMENT_ROOT'] . '/../libs/');
define('SERVER_DIR', $_SERVER['DOCUMENT_ROOT'] . '/../');
require PATH_LIBS . 'flight/Flight.php';
error_reporting(E_ERROR);
require PATH_LIBS . 'phpactiverecord/ActiveRecord.php';
ActiveRecord\Config::initialize(function ($cfg) {
    $cfg->set_model_directory($_SERVER['DOCUMENT_ROOT'] . '/../app/Models');
    $cfg->set_connections(array('development' => 'mysql://*****:*****@localhost/vzapertiru_quest?charset=utf8'));
});
ActiveRecord\Connection::$datetime_format = 'Y-m-d';
ActiveRecord\Connection::$date_format = 'Y.m.d';
ActiveRecord\Serialization::$DATETIME_FORMAT = 'Y-m-d';
ActiveRecord\DateTime::$DEFAULT_FORMAT = 'Y-m-d';
Flight::set('flight.views.path', SERVER_DIR . 'view/template/');
require $_SERVER['DOCUMENT_ROOT'] . '/../config/classes.php';
Auth::getInstance()->init();
require SERVER_DIR . 'config/routes.php';
Flight::start();
Ejemplo n.º 20
0
Archivo: index.php Proyecto: npk/Ourls
<?php

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../app/helpers.php';
require __DIR__ . '/../app/routes.php';
$config = (require __DIR__ . '/../app/config.php');
Flight::set('flight.base_url', $config['base_url']);
Flight::set('flight.views.path', __DIR__ . '/../app/views');
Flight::set('alphabet', $config['hash']['alphabet']);
Flight::instance('hash', '\\app\\components\\Hash', [$config['hash']]);
Flight::instance('db', 'medoo', [$config['db']]);
Flight::start();
Ejemplo n.º 21
0
    if (CONF_LOGS_DIR != 'default' && is_writable(CONF_LOGS_DIR)) {
        // Override default configuration
        define('REAL_LOGGING_DIR', CONF_LOGS_DIR);
    } else {
        // Default configuration
        define('REAL_LOGGING_DIR', LOGS_DIR);
    }
    function bgp_log4php_def_conf()
    {
        return array('rootLogger' => array('appenders' => array('default')), 'loggers' => array('core' => array('additivity' => false, 'appenders' => array('coreAppender'))), 'appenders' => array('default' => array('class' => 'LoggerAppenderFile', 'layout' => array('class' => 'LoggerLayoutPattern', 'params' => array('conversionPattern' => '[%date{Y-m-d H:i:s,u}] %-5level %-10.10logger %-12session{USERNAME} %-3session{ID} %-15.15server{REMOTE_ADDR} %-30class %-30method %-35server{REQUEST_URI} "%msg"%n')), 'params' => array('file' => REAL_LOGGING_DIR . '/' . date('Y-m-d') . '.txt', 'append' => true)), 'coreAppender' => array('class' => 'LoggerAppenderFile', 'layout' => array('class' => 'LoggerLayoutPattern', 'params' => array('conversionPattern' => '[%date{Y-m-d H:i:s,u}] %-5level System Core V2 localhost %-30class %-30method "%msg"%n')), 'params' => array('file' => REAL_LOGGING_DIR . '/' . date('Y-m-d') . '.core.txt', 'append' => true))));
    }
    function bgp_log4php_api_conf()
    {
        return array('rootLogger' => array('appenders' => array('default')), 'appenders' => array('default' => array('class' => 'LoggerAppenderFile', 'layout' => array('class' => 'LoggerLayoutPattern', 'params' => array('conversionPattern' => '[%date{Y-m-d H:i:s,u}] %-5level %-3server{PHP_AUTH_USER} %-15.15server{REMOTE_ADDR} %-30class %-30method %-6.6server{REQUEST_METHOD} %-100server{REQUEST_URI} "%msg"%n')), 'params' => array('file' => REAL_LOGGING_DIR . '/' . date('Y-m-d') . '.api.txt', 'append' => true))));
    }
    /**
     * ROUTING Configuration
     * FlightPHP configuration
     *
     * flight.base_url - Override the base url of the request. (default: null)
     * flight.handle_errors - Allow Flight to handle all errors internally. (default: true)
     * flight.log_errors - Log errors to the web server's error log file. (default: false)
     * flight.views.path - Directory containing view template files (default: ./views)
     *
     * @link http://flightphp.com/learn#configuration
     */
    Flight::set('flight.handle_errors', TRUE);
    Flight::set('flight.log_errors', FALSE);
}
// Clean Up
unset($CONFIG, $bgpCoreInfo, $lang, $headers, $key, $value);
Ejemplo n.º 22
0
    $created = $data['created'];
    $query = "INSERT INTO poll VALUES(NULL, {$owner}, '{$title}', '{$question}', '{$is_open}', {$created})";
    mysql_query($query) or die(mysql_error());
    $query = "SELECT id, owner as ownerId, title, question, is_open as isOpen, created FROM poll WHERE title like '{$title}'";
    $ret = queryArray($query, Flight::get('pollCols'));
    echo Flight::json($ret[0]);
});
//---------
// UPDATE
//---------
// ! PUT does not work for unknown reasons here. So we circumvent this problem by using a post to a different url instead
Flight::route('POST /api/poll/put', function () {
    $json = Flight::request()->data->json;
    $data = json_decode($json, true);
    $id = $data['id'];
    $owner = $data['ownerId'];
    $title = $data['title'];
    $question = $data['question'];
    $is_open = getBoolean($data['isOpen']);
    $created = $data['created'];
    $query = "UPDATE poll SET owner={$owner}, title='{$title}', question='{$question}', is_open='{$is_open}', created={$created} WHERE id={$id}";
    mysql_query($query) or die(mysql_error());
    $query = "SELECT id, owner as ownerId, title, question, is_open as isOpen, created FROM poll WHERE title like '{$title}'";
    $ret = queryArray($query, Flight::get('pollCols'));
    echo Flight::json($ret[0]);
});
Flight::route('*', function () {
    echo 'Invalid path requested!';
});
Flight::set('dbConn', getDBconn());
Flight::start();
Ejemplo n.º 23
0
     Flight::redirect('/403');
     exit(1);
 }
 // Vars Init
 if (isset($module) && preg_match("#\\w#", $module)) {
     $module = strtolower($module);
 } else {
     $module = '';
 }
 if (isset($page) && preg_match("#\\w#", $page)) {
     $page = strtolower($page);
 } else {
     $page = '';
 }
 if (isset($id) && is_numeric($id)) {
     Flight::set('RESOURCE_ID', $id);
 } else {
     $id = 0;
 }
 // User Authentication
 $authService = Core_AuthService::getAuthService();
 // Test if the user is allowed to access the system
 if ($authService->getSessionValidity() == FALSE) {
     // The user is not logged in
     if (!empty($module) && $module != 'login') {
         // Redirect to login form
         $return = '/' . str_replace(BASE_URL, '', REQUEST_URI);
         Flight::redirect('/login?page=' . $return);
     }
     // Login
     switch (Flight::request()->method) {
Ejemplo n.º 24
0
<?php

require 'vendor/flight/Flight.php';
require "vendor/markdown/markdown.php";
//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);
    }
Ejemplo n.º 25
0
 * You should have received a copy of the GNU Affero General Public License
 * along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
// This module handles all interaction with the user's browser
// and Facebook
// TODO: this only works if the script is installed in root
define('FACEBOOK_SDK_V4_SRC_DIR', __DIR__ . '/../include/facebook-php-sdk-v4/src/Facebook/');
require_once __DIR__ . '/../include/facebook-php-sdk-v4/autoload.php';
require_once __DIR__ . '/../tokens.php';
use Facebook\FacebookSession;
use Facebook\FacebookRequest;
use Facebook\FacebookRequestException;
use Facebook\FacebookRedirectLoginHelper;
FacebookSession::setDefaultApplication(APP_ID, APP_SECRET);
Flight::set('retry_url', MY_URL . 'login');
function render_boilerplate()
{
    Flight::render('head', array('my_url' => MY_URL, 'title' => _('WLAN at ') . PAGE_NAME), 'head');
    Flight::render('foot', array('privacy_url' => MY_URL . 'privacy/', 'imprint_url' => IMPRINT_URL), 'foot');
    Flight::render('back_to_code_widget', array('retry_url' => Flight::get('retry_url')), 'back_to_code_widget');
    Flight::render('access_code_widget', array('codeurl' => MY_URL . 'access_code/'), 'access_code_widget');
}
function check_permissions($session)
{
    $request = new FacebookRequest($session, 'GET', '/me/permissions');
    try {
        $response = $request->execute();
        $graphObject = $response->getGraphObject()->asArray();
        // http://stackoverflow.com/q/23527919
        foreach ($graphObject as $key => $permissionObject) {
Ejemplo n.º 26
0
<?php

date_default_timezone_set('America/New_York');
require_once 'flight/Flight.php';
require_once 'vendor/github/GitHubClient.php';
// Autoload models and controllers
Flight::path('models');
Flight::path('controllers');
Flight::path('models/division_structures');
// Set views path and environment
Flight::set('flight.views.path', 'views');
Flight::set('root_dir', dirname(__FILE__));
Flight::set('base_url', '/Division-Tracker/');
// Set database credentials
define('DB_HOST', '');
define('DB_USER', '');
define('DB_PASS', '');
define('ARCH_PASS', '');
Flight::register('aod', 'Database', array('aod'));
// defines for website URLs
define('CLANAOD', 'http://www.clanaod.net/forums/member.php?u=');
define('BATTLELOG', 'http://battlelog.battlefield.com/bfh/agent/');
define('BATTLEREPORT', 'http://battlelog.battlefield.com/bf4/battlereport/show/1/');
define('BF4DB', 'http://bf4db.com/players/');
define('PRIVMSG', 'http://www.clanaod.net/forums/private.php?do=newpm&u=');
define('EMAIL', 'http://www.clanaod.net/forums/sendmessage.php?do=mailmember&u=');
define('REMOVE', 'http://www.clanaod.net/forums/modcp/aodmember.php?do=remaod&u=');
// defines for BF4 division activity status display
define('PERCENTAGE_CUTOFF_GREEN', 75);
define('PERCENTAGE_CUTOFF_AMBER', 50);
define('INACTIVE_MIN', 0);
Ejemplo n.º 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();
Ejemplo n.º 28
0
 function SaveChange($id, $planeId, $from, $to, $depatureDate, $landingDate, $boardingtime, $landingTime, $noOfStops, $ticketPrice, $option = null)
 {
     $flight = new Flight();
     $flight->set($planeId, $from, $to, $depatureDate, $landingDate, $boardingtime, $landingTime, $ticketPrice, $noOfStops);
     $flight->Id = $id;
     $this->flightModelView->flight = $flight;
     $flight->mode = "edit";
     $flightModel = new FlightModel();
     if ($flightModel->IsExistId($id)) {
         $flightModel->Update($flight->Id, $flight);
     }
     $this->flightModelView->flightList = $flightModel->GetAllFlights();
     return $this->View($this->flightModelView, "Flight", "Index");
 }
Ejemplo n.º 29
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();
Ejemplo n.º 30
-1
<?php

define('START_TIME', microtime());
define('APP_PATH', __DIR__ . '/../app');
require __DIR__ . '/../vendor/autoload.php';
//include helpers.php
require APP_PATH . '/core/helpers.php';
//Load Dotenv
$dotenv = new Dotenv\Dotenv(__DIR__ . '/../');
$dotenv->load();
Flight::set(require APP_PATH . '/config/app.php');
//setting url case_sensitive, default false
Flight::set('flight.case_sensitive', true);
/*-----
Flight autoload start
-----*/
//controllers
Flight::path(Flight::get('flight.controllers.path'));
//models
Flight::path(Flight::get('flight.models.path'));
//core
Flight::path(Flight::get('flight.core.path'));
/*-----
Flight autoload end
-----*/