Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjapanzer authored Aug 13, 2017
2 parents 73c9d83 + 628f785 commit 307c0eb
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
</IfModule>
RewriteRule ((?s).*) public/$1 [L]
</IfModule>
29 changes: 29 additions & 0 deletions .htrouter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/*
+------------------------------------------------------------------------+
| Phalcon Developer Tools |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2017 Phalcon Team (https://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to [email protected] so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <[email protected]> |
| Eduar Carvajal <[email protected]> |
| Serghei Iakovlev <[email protected]> |
+------------------------------------------------------------------------+
*/

define('PUBLIC_PATH', __DIR__ . '/public');

$uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
if ($uri !== '/' && file_exists(PUBLIC_PATH . $uri)) {
return false;
}
$_GET['_url'] = $_SERVER['REQUEST_URI'];

require_once PUBLIC_PATH . '/index.php';
Empty file added .phalcon/.gitkeep
Empty file.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,20 @@ Check out a [explanation article][1].
To run this application on your machine, you need at least:

* PHP >= 5.4
* [Apache][2] Web Server with [mod_rewrite][3] enabled or [Nginx][4] Web Server
* Server Any of the following
* [Phalcon Devtools][7] using provided **.htrouter** and `phalcon serve` command
* [Apache][2] Web Server with [mod_rewrite][3] enabled
* [Nginx][4] Web Server
* Latest stable [Phalcon Framework release][5] extension enabled

## License

Phalcon Tutorial is open-sourced software licensed under the [New BSD License][6]. © Phalcon Framework Team and contributors

[1]: http://docs.phalconphp.com/en/latest/reference/tutorial.html
[1]: https://docs.phalconphp.com/en/latest/tutorial-base
[2]: http://httpd.apache.org/
[3]: http://httpd.apache.org/docs/current/mod/mod_rewrite.html
[4]: http://nginx.org/
[5]: https://github.com/phalcon/cphalcon/releases
[6]: https://github.com/phalcon/tutorial/blob/master/docs/LICENSE.md
[7]: https://github.com/phalcon/phalcon-devtools
2 changes: 0 additions & 2 deletions app/models/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ class Users extends Model
{

public $id;

public $name;

public $email;

}
1 change: 0 additions & 1 deletion app/views/index/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
echo "<h1>Hello!</h1>";

echo $this->tag->linkTo("signup", "Sign Up Here!");

2 changes: 1 addition & 1 deletion docs/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
New BSD License
===============

Copyright (c) 2013-2015, Phalcon Framework Team and contributors
Copyright (c) 2013-2017, Phalcon Framework Team and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion docs/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
New BSD License

Copyright (c) 2013-2015, Phalcon Framework Team and contributors
Copyright (c) 2013-2017, Phalcon Framework Team and contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion public/.htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ AddDefaultCharset UTF-8
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
RewriteRule ^((?s).*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
77 changes: 34 additions & 43 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,49 @@
use Phalcon\Mvc\Url as UrlProvider;
use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter;


define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');

// Register an autoloader
$loader = new Loader();

$loader->registerDirs(
[
"../app/controllers/",
"../app/models/",
]
);

$loader->register();


array(
APP_PATH . '/controllers/',
APP_PATH . '/models/'
)
)->register();

// Create a DI
$di = new FactoryDefault();

// Setup the view component
$di->set(
"view",
function () {
$view = new View();

$view->setViewsDir("../app/views/");

return $view;
}
);
// Setting up the view component
$di['view'] = function() {
$view = new View();
$view->setViewsDir(APP_PATH . '/views/');
return $view;
};

// Setup a base URI so that all generated URIs include the "tutorial" folder
$di->set(
"url",
function () {
$url = new UrlProvider();

$url->setBaseUri("/tutorial/");

return $url;
}
);



$application = new Application($di);

$di['url'] = function() {
$url = new Url();
$url->setBaseUri('/');
return $url;
};

// Set the database service
$di['db'] = function() {
return new DbAdapter(array(
"host" => "127.0.0.1",
"username" => "root",
"password" => "secret",
"dbname" => "tutorial1"
));
};

// Handle the request
try {
// Handle the request
$response = $application->handle();

$response->send();
} catch (\Exception $e) {
echo "Exception: ", $e->getMessage();
$application = new Application($di);
echo $application->handle()->getContent();
} catch (Exception $e) {
echo "Exception: ", $e->getMessage();
}
11 changes: 6 additions & 5 deletions schemas/tutorial.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- MySQL dump 10.13 Distrib 5.5.36, for osx10.9 (i386)
--
-- Host: localhost Database: tutorial
-- Host: localhost Database: tutorial1
-- ------------------------------------------------------
-- Server version 5.5.36

Expand All @@ -23,10 +23,11 @@ DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(70) NOT NULL,
`email` varchar(70) NOT NULL,
PRIMARY KEY (`id`)
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(70) NOT NULL,
`email` varchar(70) NOT NULL,

PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

Expand Down

0 comments on commit 307c0eb

Please sign in to comment.