Beispiel #1
0
<?php

namespace esee;

require_once 'esee/App.php';
App::autoload();
$data = [['т', 4.5, 2.7222222222222], ['о', 4.5, 4.5], ['0', 4, 6], ['0', 5.5, 6]];
$provider = new provider\ProviderFile('data.txt');
foreach ($data as $item) {
    $char = new model\Char();
    $char->init($item[0], $item[1], $item[2]);
    $provider->addChar($char);
}
            printf("Unkown option '%s' (available commands: -e).\n", $_SERVER['argv'][1]);
            exit(0);
    }
} else {
    die('This file must be execute in CLI mode');
}
/**
 * Load required files
 */
require_once APPLICATION_BASE_URI . '/vendor/silex.phar';
require_once APPLICATION_BASE_URI . '/vendor/App.php';
require_once APPLICATION_BASE_URI . '/vendor/yaml/lib/sfYaml.php';
require_once APPLICATION_BASE_URI . '/vendor/rrdtool/required.php';
require_once APPLICATION_BASE_URI . '/vendor/asker/required.php';
require_once APPLICATION_BASE_URI . '/vendor/swiftmailer/lib/swift_required.php';
App::autoload(APPLICATION_BASE_URI . '/app/controllers/helpers/');
/**
 * Initialize new Application
 */
$app = App::getInstance('jobCron');
$config = App::loadConfigs(__DIR__ . '/../app/configs/', APPLICATION_ENV);
$config->app['db']['path'] = APPLICATION_BASE_URI . $config->app['db']['path'];
/**
 *  Register Extensions
 */
$app->register(new Silex\Extension\MonologExtension(), array('monolog.logfile' => APPLICATION_BASE_URI . '/data/log/development.jobCron.log', 'monolog.class_path' => APPLICATION_BASE_URI . '/vendor/monolog/src', 'monolog.name' => 'jobCron'));
$app['monolog.level'] = APPLICATION_ENV == 'development' ? \Monolog\Logger::DEBUG : \Monolog\Logger::WARNING;
$app['monolog']->addInfo("CLI EXEC : " . CLI_FILENAME);
$app->register(new Silex\Extension\DoctrineExtension(), array('db.options' => $config->app['db'], 'db.dbal.class_path' => APPLICATION_BASE_URI . '/vendor/doctrine2-dbal/lib', 'db.common.class_path' => APPLICATION_BASE_URI . '/vendor/doctrine2-common/lib'));
// TODO verify if DB exist, else duplicate emptyDB
$app->register(new Asker\AskerExtension());
<?php

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
# Autoloader controllers
App::autoload(__DIR__ . '/controllers/');
//$controllers = array();
//foreach (App::autoload(__DIR__ . '/controllers/') as $controller) {
//  $classname=substr($controller,0,-4).'_Controller';
//  $controllers[strtolower(substr($controller,0,-4))] = new $classname();
//}
// TODO: use PHP5 autoloader
/**
 * ROUTES
 **/
$app->get('/', function () {
    $c = new Controller\Index();
    return $c->Index_Action();
})->bind('homepage');
$app->get('/log', function () {
    $c = new Controller\Index();
    return $c->Log_Action();
})->bind('log');
#$app->get('/dashboard', function () use($app) { return $app->redirect('/'); });
$app->get('/servers/{ip}', function () {
    $c = new Controller\Server();
    return $c->Index_Action();
})->bind('servers');