/**
  * Responds to requests to POST /applications/create
  */
 public function postCreate(Request $request)
 {
     $this->validate($request, ['name' => 'required|min:2', 'acronym' => 'required|min:2', 'description' => 'required|min:4']);
     # Insert a new application in the DB
     $app = new \App\Application();
     $app->name = $request->name;
     $app->acronym = $request->acronym;
     $app->description = $request->description;
     $app->save();
     \Session::flash('flash_message', 'Your application was added!');
     return redirect('/applications');
 }
 protected function getApp()
 {
     $structure = $this->getStructure();
     $this->root = vfsStream::setup('root', 777, $structure);
     //        print_r(vfsStream::inspect(new vfsStreamStructureVisitor())->getStructure());
     $config = new Config();
     $config->setProtectedFromArray(array('theme' => 'test', 'language' => 'en', 'languages' => array('en' => array('value' => 'english', 'code' => 'en')), 'basePath' => vfsStream::url('root'), 'skullyBasePath' => vfsStream::url('root/vendor/triodigital/skully/'), 'baseUrl' => 'http://localhost/skully/', 'urlRules' => array('' => 'home/index', 'admin' => 'admin/home/index')));
     $_SESSION['__language'] = 'id';
     $app = new \App\Application($config);
     unsetRealpath();
     $pluginsPath = realpath(__DIR__ . '/../../App/smarty/plugins');
     setRealpath();
     $app->getTemplateEngine()->addPluginsDir($pluginsPath);
     return $app;
 }
Exemple #3
0
<?php

require __DIR__ . '/../app/_bootstrap.php';
require __DIR__ . '/../app/Application.php';
$app = new \App\Application('devel', true);
$app->run(new \Micro\Web\Request())->send();
$app->terminate();
Exemple #4
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
$parser = new Symfony\Component\Yaml\Yaml();
$global = $parser->parse(dirname(__DIR__) . '/config/global.yml');
$config = $parser->parse(sprintf(dirname(__DIR__) . '/config/%s.yml', $global['environment']));
$security = $parser->parse(dirname(__DIR__) . '/config/security.yml');
$routes = $parser->parse(dirname(__DIR__) . '/config/routes.yml');
$app = new App\Application(array_merge($global, $config, $security, $routes));
/** Doctrine cli-config also uses this bootstrap for db etc, so don't run HTTP stuff if cli is being used **/
isset($cli) ?: $app->run();
Exemple #5
0
<?php

require __DIR__ . '/../app/_bootstrap.php';
require __DIR__ . '/../app/Application.php';
$app = new \App\Application('devel', true);
if (array_key_exists('r', $_GET) && 0 !== strpos($_GET['r'], '/rest') && false === strpos($_GET['r'], '/admin')) {
    $_GET['r'] = '/';
}
$response = $app->run(new \Micro\Web\Request());
$response->send();
$app->terminate();
Exemple #6
0
 public function test_application_model()
 {
     $application = App\Application::find(1);
     $runs = $application->runs;
     $this->assertNotNull($runs);
 }
Exemple #7
0
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';
$parser = new Symfony\Component\Yaml\Yaml();
$global = $parser->parse(dirname(__DIR__) . '/config/global.yml');
$config = $parser->parse(sprintf(dirname(__DIR__) . '/config/%s.yml', $global['environment']));
$security = $parser->parse(dirname(__DIR__) . '/config/security.yml');
$routes = $parser->parse(dirname(__DIR__) . '/config/routes.yml');
$app = new App\Application(array_merge($global, $config, $security, $routes));
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views', 'twig.form.templates' => array('template/layout.html.twig')));
$app->get("/admin", "App\\Controller\\AdminController::index");
/** Doctrine cli-config also uses this bootstrap for db etc, so don't run HTTP stuff if cli is being used **/
isset($cli) ?: $app->run();
Exemple #8
0
<?php

require 'bootstrap.php';
$app = new App\Application();
//Index
$app->get('/', function () use($app) {
    $action = $app->getAction('Index');
    return $action->run();
});
$app->get('/authenticate-twitter', function () use($app) {
    $action = $app->getAction('AuthenticateTwitter');
    return $action->run();
});
$app->get('/authorize-twitter', function () use($app) {
    $action = $app->getAction('AuthorizeTwitter');
    return $action->run();
});
$app->get('/process', function () use($app) {
    $action = $app->getAction('Process');
    return $action->run();
});
$app->get('/result', function () use($app) {
    $action = $app->getAction('Result');
    return $action->run();
});
$app->get('/updateschema', function () use($app) {
    $em = $app->getDoctrineEntityManager();
    $metadatas = $em->getMetadataFactory()->getAllMetadata();
    $tool = new \Doctrine\ORM\Tools\SchemaTool($em);
    $tool->updateSchema($metadatas, true);
});
Exemple #9
0
<?php

/**===================================================================================================================================================*/
Route::get('/', 'WelcomeController@index');
Route::get('about', 'WelcomeController@About');
/**=========================  Application  ==========================================================================================================================*/
Route::bind('app', function ($slug) {
    return App\Application::whereSlug($slug)->first();
});
Route::bind('user/app', function ($slug) {
    return App\Application::whereSlug($slug)->first();
});
Route::get('All-apps', ['as' => 'all.apps', 'uses' => 'ApplicationController@AllApps']);
Route::resource('user/app', 'userAppController');
Route::patch('download/{app}', ['as' => 'download.Counter', 'uses' => 'ApplicationController@download']);
Route::resource('app', 'applicationController');
/**==========================  User    =========================================================================================================================*/
Route::bind('user', function ($name) {
    return App\User::whereName($name)->first();
});
$router->resource('user', 'userController');
/**===========================  Profile  ========================================================================================================================*/
Route::get('account-setting', ['as' => 'account.setting', 'uses' => 'profileController@accountSetting']);
$router->resource('profile', 'profileController');
/**===========================  Profile  ========================================================================================================================*/
$router->resource('admin', 'adminController');
/**========================  Article ===========================================================================================================================*/
Route::bind('article', function ($slug) {
    return App\Article::whereSlug($slug)->first();
});
Route::bind('user/article', function ($slug) {
Exemple #10
0
<?php

//变换路径的测试
//---------------------------------------------------
include "../../Sham/Helper.php";
include "../../vendor/autoload.php";
//---------------------------------------------------
define('APPROOT', '../../App/');
App\Application::run();
//发现某些基于路径的错误
Exemple #11
0
<?php

// Create new app
$app = new App\Application();
// Add the config first
require __DIR__ . '/../app/config/config.php';
// Core silex providers
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
$app->register(new Silex\Provider\ValidatorServiceProvider());
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->register(new Silex\Provider\HttpFragmentServiceProvider());
// Twig
$app->register(new Silex\Provider\TwigServiceProvider(), ['twig.path' => __DIR__ . '/../app/views']);
// Spot2 provider
$app->register(new Ronanchilvers\Silex\Provider\Spot2ServiceProvider(), ['spot2.connections' => $app['spot2.connections']]);
return $app;
<?php

require __DIR__ . '/../vendor/autoload.php';
$app = new App\Application();
$app->runWithTry($argv);
Exemple #13
0
/*
|--------------------------------------------------------------------------
| Register The Auto Loader for composer.
|--------------------------------------------------------------------------
|
*/
require __DIR__ . '/../vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Framework core.
|--------------------------------------------------------------------------
|
*/
require_once __DIR__ . '/../bootstrap/app.php';
try {
    $app = new App\Application();
    $app->run();
} catch (Exception $e) {
    if ($app->getDi()->get('config')->debug === true) {
        echo '<pre>';
        echo 'Exception: ' . $e->getMessage();
        echo '<br><br>';
        echo 'File: ' . $e->getFile() . ' at line: ' . $e->getLine();
        echo '<br><br>';
        print_r($e->getTraceAsString());
        echo '</pre>';
    } else {
        echo 'Page Not Found.';
    }
}
function dd($var = null)
Exemple #14
0
function app()
{
    return App\Application::instance();
}
Exemple #15
0
<?php

$app = new App\Application('config_test.php');
$app->boot();
return $app;
try {
    (new Dotenv\Dotenv(__DIR__ . '/../'))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
    //
}
/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| Here we will load the environment and create the application instance
| that serves as the central piece of this framework. We'll use this
| application as an "IoC" container and router for this framework.
|
*/
$app = new \App\Application(realpath(__DIR__ . '/../'));
$app->withFacades();
// $app->withEloquent();
/*
|--------------------------------------------------------------------------
| Register Container Bindings
|--------------------------------------------------------------------------
|
| Now we will register a few bindings in the service container. We will
| register the exception handler and the console kernel. You may add
| your own bindings here if you like or you can make another file.
|
*/
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
/*
Exemple #17
0
<?php

/*
|--------------------------------------------------------------------------
| Create The Application
|--------------------------------------------------------------------------
|
| The first thing we will do is create a new Laravel application instance
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
*/
$app = new App\Application(realpath(__DIR__ . '/../'));
/*
|--------------------------------------------------------------------------
| Bind Important Interfaces
|--------------------------------------------------------------------------
|
| Next, we need to bind some important interfaces into the container so
| we will be able to resolve them when needed. The kernels serve the
| incoming requests to this application from both the web and CLI.
|
*/
$app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class);
$app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class);
$app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class);
/*
|--------------------------------------------------------------------------
| Return The Application
|--------------------------------------------------------------------------
|
<?php

require_once __DIR__ . '/../vendor/autoload.php';
Symfony\Component\Debug\Debug::enable();
$app = new App\Application('dev');
$app->run();
Exemple #19
0
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
$factory->define(App\User::class, function ($faker) {
    $firs_name = $faker->firstName;
    $last_name = $faker->lastName;
    return ['identification' => $faker->unique()->numberBetween(5000000, 39999999), 'first_name' => $firs_name, 'last_name' => $last_name, 'full_name' => "{$firs_name} {$last_name}", 'type' => 'user', 'email' => $faker->unique()->email, 'password' => '123456', 'remember_token' => str_random(10)];
});
$factory->define(App\Category::class, function ($faker) {
    return ['title' => $faker->sentences(5), 'description' => $faker->paragraph(1)];
});
$factory->define(App\Post::class, function ($faker) {
    return ['highlight' => rand(0, 1), 'title' => $faker->sentence(5), 'description' => $faker->paragraph(5), 'content' => $faker->paragraph(10), 'image' => $faker->imageUrl(1140, 400), 'user_id' => App\User::all()->random()->id, 'category_id' => App\Category::all()->random()->id];
});
$factory->define(App\Comment::class, function ($faker) {
    return ['content' => $faker->paragraph(1), 'user_id' => App\User::all()->random()->id, 'post_id' => App\Post::all()->random()->id];
});
$factory->define(App\Reply::class, function ($faker) {
    return ['content' => $faker->paragraph(1), 'user_id' => App\User::all()->random()->id, 'comment_id' => App\Comment::all()->random()->id];
});
$factory->define(App\Application::class, function ($faker) {
    return ['status' => $faker->randomElement(['process', 'accepted', 'rejected']), 'message' => $faker->paragraph(10), 'user_id' => App\User::all()->random()->id];
});
$factory->define(App\History::class, function ($faker) {
    return ['status' => $faker->randomElement(['process', 'accepted', 'rejected']), 'message' => $faker->paragraph(10), 'user_id' => App\User::all()->random()->id, 'application_id' => App\Application::all()->random()->id];
});