Skip to content

Commit

Permalink
moved from local vendor libraries to vendor git submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
Tieno committed Apr 28, 2012
1 parent 8d5a45f commit d1e445f
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 59 deletions.
12 changes: 12 additions & 0 deletions .gitmodules
@@ -0,0 +1,12 @@
[submodule "vendor/Slim"]
path = vendor/Slim
url = https://Tieno@github.com/codeguy/Slim.git
[submodule "vendor/Twig"]
path = vendor/Twig
url = https://Tieno@github.com/fabpot/Twig.git
[submodule "vendor/php-activerecord"]
path = vendor/php-activerecord
url = https://Tieno@github.com/Tieno/php-activerecord.git
[submodule "vendor/Slim-Extras"]
path = vendor/Slim-Extras
url = https://Tieno@github.com/Tieno/Slim-Extras.git
42 changes: 22 additions & 20 deletions app/config/appconfig.php
Expand Up @@ -2,31 +2,31 @@
/**
* ACTIVERECORD SETTINGS
*/
ActiveRecord\Config::initialize(function($cfg)
{
$models = ROOT.'/app/models';
$cfg->set_model_directory($models);
try {
$cfg->set_connections(array(
'development' => 'mysql://user:password@localhost/database?charset=utf8'

));

} catch (ActiveRecord\DatabaseException $e) {
echo "Database error";
} catch (ActiveRecord\ConfigException $e) {
echo "Config error";
}

});
ActiveRecord\Config::initialize(function($cfg)
{
$models = ROOT.'/app/models';
$cfg->set_model_directory($models);
try {
$cfg->set_connections(array(
'development' => 'mysql://root:durnez10@localhost/comm_sen?charset=utf8'

));

} catch (ActiveRecord\DatabaseException $e) {
echo "Database error";
} catch (ActiveRecord\ConfigException $e) {
echo "Config error";
}

});
ActiveRecord\DateTime::$DEFAULT_FORMAT = 'd-M-Y';


/**
* TWIG SETTINGS
*/

TwigView::$twigDirectory = ROOT.'/vendor/Twig';
TwigView::$twigDirectory = ROOT.'/vendor/Twig/lib/Twig';
TwigView::$twigOptions = array(
"debug" => true
);
Expand All @@ -36,9 +36,11 @@


TwigView::$twigExtensions = array(
'Extension_Twig_Slim',
'Twig_Extension_Debug'
'Twig_Extensions_Slim',
'Twig_Extension_Debug',
'Twig_Extensions_Markdown'
);

TwigView::$twigFunctions = array(

);
7 changes: 4 additions & 3 deletions app/config/registry.php
@@ -1,4 +1,5 @@
<?php
require_once ROOT.'/vendor/php-activerecord/ActiveRecord.php';
require_once ROOT.'/vendor/Slim/View.php';
require_once ROOT.'/vendor/Slim-Extras/TwigView.php';
require ROOT.'/vendor/Slim/Slim/Slim.php';
require ROOT.'/vendor/php-activerecord/ActiveRecord.php';
require ROOT.'/vendor/Slim/Slim/View.php';
require ROOT.'/vendor/Slim-Extras/Views/TwigView.php';
21 changes: 18 additions & 3 deletions app/controllers/general.controller.php
@@ -1,6 +1,21 @@
<?php
<?php
/*
$app->get('/route', $auth, function() use($app, $currentUser) {
//GET route
$app->get('/', function () use ($app) {
echo 'This is a GET route';
});
//POST route
$app->post('/post', function () {
echo 'This is a POST route';
});
})->name('');
//PUT route
$app->put('/put', function () {
echo 'This is a PUT route';
});
//DELETE route
$app->delete('/delete', function () {
echo 'This is a DELETE route';
});
*/
41 changes: 8 additions & 33 deletions app/index.php
@@ -1,5 +1,4 @@
<?php
require ROOT.'/vendor/Slim/Slim.php';
require ROOT.'/app/config/registry.php';
require ROOT.'/app/config/appconfig.php';

Expand Down Expand Up @@ -29,6 +28,7 @@
$currentUser = null;
}


/**
* authentication middleware for is in routes you want protected
*
Expand All @@ -53,47 +53,22 @@
*/
$resourceUri = $_SERVER['REQUEST_URI'];
$rootUri = $app->request()->getRootUri();
$assetUri = $rootUri;
$app->view()->appendData(
array('currentUser' => $currentUser,
'app' => $app,
'rootUri' => $rootUri,
'assetUri' => $assetUri,
'resourceUri' => $resourceUri
$assetUri = $rootUri;
$app->view()->appendData(
array('currentUser' => $currentUser,
'app' => $app,
'rootUri' => $rootUri,
'assetUri' => $assetUri,
'resourceUri' => $resourceUri
));

foreach(glob(ROOT.'/app/controllers/*.php') as $router) {
include $router;
}


//GET route
$app->get('/', function () use ($app) {

$app->render('slim.html.twig');
});



//POST route
$app->post('/post', function () {
echo 'This is a POST route';
});

//PUT route
$app->put('/put', function () {
echo 'This is a PUT route';
});

//DELETE route
$app->delete('/delete', function () {
echo 'This is a DELETE route';
});

/**
* Step 4: Run the Slim application
*
* This method should be called last. This is responsible for executing
* the Slim application using the settings and routes defined above.
*/
$app->run();
1 change: 1 addition & 0 deletions vendor/Slim
Submodule Slim added at aa7e91
1 change: 1 addition & 0 deletions vendor/Slim-Extras
Submodule Slim-Extras added at 543ec2
1 change: 1 addition & 0 deletions vendor/Twig
Submodule Twig added at f3491b
1 change: 1 addition & 0 deletions vendor/php-activerecord
Submodule php-activerecord added at 66dcbf

0 comments on commit d1e445f

Please sign in to comment.