예제 #1
0
<?php

require 'vendor/autoload.php';
Epi::init('template', 'route');
Epi::setPath('view', 'templates');
getRoute()->get('/', array('DomainChecker', 'Run'));
getRoute()->run();
class DomainChecker
{
    public static function Run()
    {
        if (file_exists("cache.json")) {
            $cache = json_decode(file_get_contents("cache.json"), true);
        } else {
            $cache = array();
        }
        $tlds = explode(",", isset($_GET['tlds']) ? $_GET['tlds'] : "com,co.uk,net,org");
        $domains = explode(",", isset($_GET['domains']) ? $_GET['domains'] : "");
        $whois = new Whois();
        $rows = array();
        foreach ($domains as $domain) {
            if (strlen($domain) == 0) {
                continue;
            }
            $results = array();
            $domain = trim($domain);
            $alltaken = true;
            foreach ($tlds as $tld) {
                if (array_key_exists($domain . "." . $tld, $cache) && $cache[$domain . "." . $tld]['time'] > time() - 60 * 60 * 24) {
                    $info = $cache[$domain . "." . $tld]['data'];
                } else {
예제 #2
0
파일: index.php 프로젝트: Jpsstack/epiphany
<?php

chdir('..');
include_once '../src/Epi.php';
Epi::setPath('base', '../src');
Epi::init('route');
/*
 * This file is an example of using regular expressions in a route.
 * You can use subpatterns which are passed to the function as parameters.
 */
getRoute()->get('/', 'home');
getRoute()->get('/(\\w+)/(\\w+)', 'greeting');
getRoute()->run();
/*
 * ******************************************************************************************
 * Define functions and classes which are executed by EpiRoute
 * ******************************************************************************************
 */
function home()
{
    echo '<h1>Home page. <a href="jaisen/mathai">Click for greeting</a></h1>';
}
function greeting($firstName, $lastName)
{
    echo "<h1>Welcome, {$firstName} {$lastName}</h1>";
}
예제 #3
0
<?php

date_default_timezone_set('America/Los_Angeles');
$basePath = dirname(dirname(__FILE__));
$libraryPath = sprintf('%s/libraries', $basePath);
$epiPath = sprintf('%s/epi', $libraryPath);
require sprintf('%s/Epi.php', $epiPath);
Epi::setPath('base', $epiPath);
Epi::setPath('view', sprintf('%s/templates', $basePath));
Epi::setSetting('exceptions', true);
Epi::init('api', 'cache', 'config', 'logger', 'route', 'session', 'template', 'database');
EpiSession::employ(EpiSession::PHP);
require sprintf('%s/initialize.php', $libraryPath);
getRoute()->run();
예제 #4
0
<?php

// TODO, remove these
date_default_timezone_set('America/Los_Angeles');
if (isset($_GET['__route__']) && strstr($_GET['__route__'], '.json')) {
    header('Content-type: application/json');
}
$basePath = dirname(dirname(__FILE__));
$epiPath = "{$basePath}/libraries/external/epi";
require "{$epiPath}/Epi.php";
require "{$basePath}/libraries/compatability.php";
require "{$basePath}/libraries/models/UserConfig.php";
Epi::setSetting('exceptions', true);
Epi::setPath('base', $epiPath);
Epi::setPath('config', "{$basePath}/configs");
Epi::setPath('view', '');
Epi::init('api', 'cache', 'config', 'curl', 'form', 'logger', 'route', 'session', 'template', 'database');
$routeObj = getRoute();
$apiObj = getApi();
// loads configs and dependencies
$userConfigObj = new UserConfig();
$hasConfig = $userConfigObj->load();
$configObj = getConfig();
EpiCache::employ($configObj->get('epi')->cache);
$sessionParams = array($configObj->get('epi')->session);
if ($configObj->get('epiSessionParams')) {
    $sessionParams = array_merge($sessionParams, (array) $configObj->get('epiSessionParams'));
    // for TLDs we need to override the cookie domain if specified
    if (isset($sessionParams['domain']) && stristr($_SERVER['HTTP_HOST'], $sessionParams['domain']) === false) {
        $sessionParams['domain'] = $_SERVER['HTTP_HOST'];
    }
예제 #5
0
파일: index.php 프로젝트: Jpsstack/epiphany
<?php

chdir('..');
include_once '../src/Epi.php';
Epi::setPath('base', '../src');
Epi::setPath('view', 'site-with-templates');
Epi::init('route', 'template');
/*
 * This is a sample page whch uses EpiCode.
 * There is a .htaccess file which uses mod_rewrite to redirect all requests to index.php while preserving GET parameters.
 * The $_['routes'] array defines all uris which are handled by EpiCode.
 * EpiCode traverses back along the path until it finds a matching page.
 *  i.e. If the uri is /foo/bar and only 'foo' is defined then it will execute that route's action.
 * It is highly recommended to define a default route of '' for the home page or root of the site (yoursite.com/).
 */
getRoute()->get('/', array('MyClass', 'MyMethod'));
getRoute()->run();
/*
 * ******************************************************************************************
 * Define functions and classes which are executed by EpiCode based on the $_['routes'] array
 * ******************************************************************************************
 */
class MyClass
{
    public static function MyMethod()
    {
        $template = new EpiTemplate();
        $params = array();
        $params['heading'] = 'This is a heading';
        $params['imageSrc'] = 'https://github.com/images/modules/header/logov3-hover.png';
        $params['content'] = str_repeat('Lorem ipsum ', 100);
예제 #6
0
파일: index.php 프로젝트: Jpsstack/epiphany
<?php

include_once '../epiphany/src/Epi.php';
include_once 'controllers/home.class.php';
include_once 'controllers/login.class.php';
include_once 'controllers/dashboard.class.php';
include_once 'controllers/logout.class.php';
include_once 'lib/constants.class.php';
Epi::setSetting('exceptions', true);
Epi::setPath('base', '../epiphany/src');
Epi::setPath('view', './views');
Epi::init('route', 'template', 'session');
getRoute()->get('/', array('HomeController', 'display'));
getRoute()->get('/login', array('LoginController', 'display'));
getRoute()->post('/login', array('LoginController', 'processLogin'));
getRoute()->get('/dashboard', array('DashboardController', 'display'));
getRoute()->get('/logout', array('LogoutController', 'processLogout'));
getRoute()->run();
예제 #7
0
파일: index.php 프로젝트: Jpsstack/epiphany
<?php

chdir('..');
include_once '../src/Epi.php';
Epi::setPath('base', '../src');
Epi::setPath('config', dirname(__FILE__));
Epi::init('route');
/*
 * ******************************************************************************************
 * Load the routes from routes.ini then call run()
 * ******************************************************************************************
 */
getRoute()->load('routes.ini');
getRoute()->run();
/*
 * ******************************************************************************************
 * Define functions and classes which are executed by EpiCode based on the $_['routes'] array
 * ******************************************************************************************
 */
class MyClass
{
    public static function MyMethod()
    {
        echo '<h1>You are looking at the output from MyClass::MyMethod</h1>
          <ul>
            <li><a href="/routes-in-ini-file">Call MyClass::MyMethod</a></li>
            <li><a href="/routes-in-ini-file/anotherpage">Call MyClass::MyOtherMethod</a></li>
            </ul>
            <p><img src="https://github.com/images/modules/header/logov3-hover.png"></p>';
    }
    public static function MyOtherMethod()
예제 #8
0
<?php

//Include Epiphany library
include_once './lib/epiphany/src/Epi.php';
Epi::setPath('base', './lib/epiphany/src');
Epi::init('template');
Epi::init('config');
Epi::init('api');
//Epi::setSetting('exceptions', true);
//Include Application classes and configuration
include_once './controlers/api.class.php';
include_once './controlers/site.class.php';
Epi::setPath('view', './views');
Epi::setPath('config', './conf');
getConfig()->load('config.ini');
//Include plugin classes and configuration
$dir = new DirectoryIterator(dirname(__FILE__) . '/plugins');
foreach ($dir as $fileinfo) {
    if (!$fileinfo->isDot() && $fileinfo->isDir()) {
        $file = $fileinfo->getFilename();
        include_once './plugins/' . $file . '/index.php';
    }
}
/*
 * We create 1 normal route (think of these are user viewable pages).
 * We also create 7 api routes (this of these as data methods).
 *  The beauty of the api routes are they can be accessed natively from PHP
 *    or remotely via HTTP.
 *  When accessed over HTTP the response is json.
 *  When accessed natively it's a php array/string/boolean/etc.
 */