diff --git a/.gitignore b/.gitignore index e69de29..61ead86 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/vendor diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..b66e808 --- /dev/null +++ b/.htaccess @@ -0,0 +1 @@ +Require all denied diff --git a/app/bootstrap.php b/app/bootstrap.php new file mode 100644 index 0000000..d660151 --- /dev/null +++ b/app/bootstrap.php @@ -0,0 +1,24 @@ +setDebugMode('23.75.345.200'); // enable for your remote IP +$configurator->enableTracy(__DIR__ . '/../log'); + +$configurator->setTimeZone('Europe/Prague'); +$configurator->setTempDirectory(__DIR__ . '/../temp'); + +$configurator->createRobotLoader() + ->addDirectory(__DIR__) + ->register(); + +$configurator->addConfig(__DIR__ . '/config/config.neon'); +$configurator->addConfig(__DIR__ . '/config/config.local.neon'); + +$container = $configurator->createContainer(); + +return $container; diff --git a/app/config/config.local.neon b/app/config/config.local.neon new file mode 100644 index 0000000..44393b4 --- /dev/null +++ b/app/config/config.local.neon @@ -0,0 +1,7 @@ +parameters: + + +database: + dsn: 'mysql:host=127.0.0.1;dbname=test' + user: + password: diff --git a/app/config/config.neon b/app/config/config.neon new file mode 100644 index 0000000..1cd974f --- /dev/null +++ b/app/config/config.neon @@ -0,0 +1,20 @@ +parameters: + + +application: + errorPresenter: Error + mapping: + *: App\*Module\Presenters\*Presenter + + +session: + expiration: 14 days + + +security: + users: + admin: secret # user 'admin', password 'secret' + + +services: + router: App\RouterFactory::createRouter diff --git a/app/presenters/Error4xxPresenter.php b/app/presenters/Error4xxPresenter.php new file mode 100644 index 0000000..ee2e1b3 --- /dev/null +++ b/app/presenters/Error4xxPresenter.php @@ -0,0 +1,27 @@ +getRequest()->isMethod(Nette\Application\Request::FORWARD)) { + $this->error(); + } + } + + + public function renderDefault(Nette\Application\BadRequestException $exception): void + { + // load template 403.latte or 404.latte or ... 4xx.latte + $file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte"; + $this->template->setFile(is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte'); + } +} diff --git a/app/presenters/ErrorPresenter.php b/app/presenters/ErrorPresenter.php new file mode 100644 index 0000000..7554069 --- /dev/null +++ b/app/presenters/ErrorPresenter.php @@ -0,0 +1,43 @@ +logger = $logger; + } + + + public function run(Nette\Application\Request $request): Nette\Application\IResponse + { + $exception = $request->getParameter('exception'); + + if ($exception instanceof Nette\Application\BadRequestException) { + [$module, , $sep] = Nette\Application\Helpers::splitName($request->getPresenterName()); + return new Responses\ForwardResponse($request->setPresenterName($module . $sep . 'Error4xx')); + } + + $this->logger->log($exception, ILogger::EXCEPTION); + return new Responses\CallbackResponse(function (Http\IRequest $httpRequest, Http\IResponse $httpResponse): void { + if (preg_match('#^text/html(?:;|$)#', $httpResponse->getHeader('Content-Type'))) { + require __DIR__ . '/templates/Error/500.phtml'; + } + }); + } +} diff --git a/app/presenters/HomepagePresenter.php b/app/presenters/HomepagePresenter.php new file mode 100644 index 0000000..f86081c --- /dev/null +++ b/app/presenters/HomepagePresenter.php @@ -0,0 +1,29 @@ +database = $database; + } + + + public function renderDefault(int $page = 1): void + { + $this->template->page = $page; + $this->template->posts = $this->database->table('posts') + ->order('created_at DESC') + ->page($page, 5); + } +} diff --git a/app/presenters/PostPresenter.php b/app/presenters/PostPresenter.php new file mode 100644 index 0000000..59154e6 --- /dev/null +++ b/app/presenters/PostPresenter.php @@ -0,0 +1,122 @@ +database = $database; + } + + + public function renderShow(int $postId): void + { + $post = $this->database->table('posts')->get($postId); + if (!$post) { + $this->error('Post not found'); + } + + $this->template->post = $post; + $this->template->comments = $post->related('comment')->order('created_at'); + } + + + protected function createComponentCommentForm(): Form + { + $form = new Form; + $form->addText('name', 'Your name:') + ->setRequired(); + + $form->addEmail('email', 'Email:'); + + $form->addTextArea('content', 'Comment:') + ->setRequired(); + + $form->addSubmit('send', 'Publish comment'); + $form->onSuccess[] = [$this, 'commentFormSucceeded']; + + return $form; + } + + + public function commentFormSucceeded(Form $form, \stdClass $values): void + { + $this->database->table('comments')->insert([ + 'post_id' => $this->getParameter('postId'), + 'name' => $values->name, + 'email' => $values->email, + 'content' => $values->content, + ]); + + $this->flashMessage('Thank you for your comment', 'success'); + $this->redirect('this'); + } + + + public function actionCreate(): void + { + if (!$this->getUser()->isLoggedIn()) { + $this->redirect('Sign:in'); + } + } + + + public function actionEdit(int $postId): void + { + if (!$this->getUser()->isLoggedIn()) { + $this->redirect('Sign:in'); + } + + $post = $this->database->table('posts')->get($postId); + if (!$post) { + $this->error('Post not found'); + } + $this['postForm']->setDefaults($post->toArray()); + } + + + protected function createComponentPostForm(): Form + { + if (!$this->getUser()->isLoggedIn()) { + $this->error('You need to log in to create or edit posts'); + } + + $form = new Form; + $form->addText('title', 'Title:') + ->setRequired(); + $form->addTextArea('content', 'Content:') + ->setRequired(); + + $form->addSubmit('send', 'Save and publish'); + $form->onSuccess[] = [$this, 'postFormSucceeded']; + + return $form; + } + + + public function postFormSucceeded(Form $form, \stdClass $values): void + { + $postId = $this->getParameter('postId'); + + if ($postId) { + $post = $this->database->table('posts')->get($postId); + $post->update($values); + } else { + $post = $this->database->table('posts')->insert($values); + } + + $this->flashMessage('Post was published', 'success'); + $this->redirect('show', $post->id); + } +} diff --git a/app/presenters/SignPresenter.php b/app/presenters/SignPresenter.php new file mode 100644 index 0000000..93d6181 --- /dev/null +++ b/app/presenters/SignPresenter.php @@ -0,0 +1,51 @@ +addText('username', 'Username:') + ->setRequired('Please enter your username.'); + + $form->addPassword('password', 'Password:') + ->setRequired('Please enter your password.'); + + $form->addSubmit('send', 'Sign in'); + + // call method signInFormSucceeded() on success + $form->onSuccess[] = [$this, 'signInFormSucceeded']; + return $form; + } + + + public function signInFormSucceeded(Form $form, \stdClass $values): void + { + try { + $this->getUser()->login($values->username, $values->password); + $this->redirect('Homepage:'); + + } catch (Nette\Security\AuthenticationException $e) { + $form->addError('Incorrect username or password.'); + } + } + + + public function actionOut(): void + { + $this->getUser()->logout(); + $this->flashMessage('You have been signed out.'); + $this->redirect('Homepage:'); + } +} diff --git a/app/presenters/templates/@layout.latte b/app/presenters/templates/@layout.latte new file mode 100644 index 0000000..6743ca2 --- /dev/null +++ b/app/presenters/templates/@layout.latte @@ -0,0 +1,33 @@ + + + + + + + {ifset title}{include title|stripHtml} | {/ifset}Nette Framework Micro-blog + + + + + + + +
{$flash->message}
+ + {include content} + + + + {block scripts} + + {/block} + + diff --git a/app/presenters/templates/Error/403.latte b/app/presenters/templates/Error/403.latte new file mode 100644 index 0000000..de00328 --- /dev/null +++ b/app/presenters/templates/Error/403.latte @@ -0,0 +1,7 @@ +{block content} +

Access Denied

+ +

You do not have permission to view this page. Please try contact the web +site administrator if you believe you should be able to view this page.

+ +

error 403

diff --git a/app/presenters/templates/Error/404.latte b/app/presenters/templates/Error/404.latte new file mode 100644 index 0000000..022001c --- /dev/null +++ b/app/presenters/templates/Error/404.latte @@ -0,0 +1,8 @@ +{block content} +

Page Not Found

+ +

The page you requested could not be found. It is possible that the address is +incorrect, or that the page no longer exists. Please use a search engine to find +what you are looking for.

+ +

error 404

diff --git a/app/presenters/templates/Error/405.latte b/app/presenters/templates/Error/405.latte new file mode 100644 index 0000000..d424892 --- /dev/null +++ b/app/presenters/templates/Error/405.latte @@ -0,0 +1,6 @@ +{block content} +

Method Not Allowed

+ +

The requested method is not allowed for the URL.

+ +

error 405

diff --git a/app/presenters/templates/Error/410.latte b/app/presenters/templates/Error/410.latte new file mode 100644 index 0000000..99bde92 --- /dev/null +++ b/app/presenters/templates/Error/410.latte @@ -0,0 +1,6 @@ +{block content} +

Page Not Found

+ +

The page you requested has been taken off the site. We apologize for the inconvenience.

+ +

error 410

diff --git a/app/presenters/templates/Error/4xx.latte b/app/presenters/templates/Error/4xx.latte new file mode 100644 index 0000000..d5ce82f --- /dev/null +++ b/app/presenters/templates/Error/4xx.latte @@ -0,0 +1,4 @@ +{block content} +

Oops...

+ +

Your browser sent a request that this server could not understand or process.

diff --git a/app/presenters/templates/Error/500.phtml b/app/presenters/templates/Error/500.phtml new file mode 100644 index 0000000..a2b900c --- /dev/null +++ b/app/presenters/templates/Error/500.phtml @@ -0,0 +1,27 @@ + + + +Server Error + + + +
+
+

Server Error

+ +

We're sorry! The server encountered an internal error and + was unable to complete your request. Please try again later.

+ +

error 500

+
+
+ + diff --git a/app/presenters/templates/Error/503.phtml b/app/presenters/templates/Error/503.phtml new file mode 100644 index 0000000..f123919 --- /dev/null +++ b/app/presenters/templates/Error/503.phtml @@ -0,0 +1,24 @@ + + + + + + + + +Site is temporarily down for maintenance + +

We're Sorry

+ +

The site is temporarily down for maintenance. Please try again in a few minutes.

diff --git a/app/presenters/templates/Homepage/default.latte b/app/presenters/templates/Homepage/default.latte new file mode 100644 index 0000000..13679e3 --- /dev/null +++ b/app/presenters/templates/Homepage/default.latte @@ -0,0 +1,19 @@ +{block navig} +
  • Write new post
  • +{/block} + +{block content} +

    My awesome blog

    + +
    +
    {$post->created_at|date:'F j, Y'}
    + +

    {$post->title}

    + +
    {$post->content}
    +
    + +

    ‹ back +   + next ›

    +{/block} diff --git a/app/presenters/templates/Post/create.latte b/app/presenters/templates/Post/create.latte new file mode 100644 index 0000000..d570ef2 --- /dev/null +++ b/app/presenters/templates/Post/create.latte @@ -0,0 +1,4 @@ +{block content} +

    New post

    + +{control postForm} diff --git a/app/presenters/templates/Post/edit.latte b/app/presenters/templates/Post/edit.latte new file mode 100644 index 0000000..50d4b0e --- /dev/null +++ b/app/presenters/templates/Post/edit.latte @@ -0,0 +1,4 @@ +{block content} +

    Edit post

    + +{control postForm} diff --git a/app/presenters/templates/Post/show.latte b/app/presenters/templates/Post/show.latte new file mode 100644 index 0000000..53701a3 --- /dev/null +++ b/app/presenters/templates/Post/show.latte @@ -0,0 +1,23 @@ +{block navig} +
  • Edit this post
  • +{/block} + +{block content} +
    {$post->created_at|date:'F j, Y'}
    + +

    {$post->title}

    + +
    {$post->content}
    + +

    Comments

    + +
    + {foreach $comments as $comment} +

    {$comment->name} said:

    +
    {$comment->content}
    + {/foreach} +
    + +

    Post new comment

    + +{control commentForm} diff --git a/app/presenters/templates/Sign/in.latte b/app/presenters/templates/Sign/in.latte new file mode 100644 index 0000000..f27bf42 --- /dev/null +++ b/app/presenters/templates/Sign/in.latte @@ -0,0 +1,4 @@ +{block content} +

    Sign in

    + +{control signInForm} diff --git a/app/router/RouterFactory.php b/app/router/RouterFactory.php new file mode 100644 index 0000000..fe36a09 --- /dev/null +++ b/app/router/RouterFactory.php @@ -0,0 +1,22 @@ +/[/]', 'Homepage:default'); + return $router; + } +} diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..f35b528 --- /dev/null +++ b/composer.json @@ -0,0 +1,33 @@ +{ + "name": "nette/web-project", + "description": "Nette: Standard Web Project", + "keywords": ["nette"], + "type": "project", + "license": ["MIT", "BSD-3-Clause", "GPL-2.0", "GPL-3.0"], + "require": { + "php": ">= 7.1", + "nette/application": "^3.0", + "nette/bootstrap": "^3.0", + "nette/caching": "^3.0", + "nette/database": "^3.0", + "nette/di": "^3.0", + "nette/finder": "^3.0", + "nette/forms": "^3.0", + "nette/http": "^3.0", + "nette/mail": "^3.0", + "nette/robot-loader": "^3.0", + "nette/security": "^3.0", + "nette/utils": "^3.0", + "latte/latte": "^3.0", + "tracy/tracy": "^3.0" + }, + "require-dev": { + "nette/tester": "^2.0" + }, + "minimum-stability": "dev", + "config": { + "platform": { + "php": "7.1" + } + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 0000000..0da7e72 --- /dev/null +++ b/composer.lock @@ -0,0 +1,1219 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "d7ce5b8ada7fbd40cc3bbbcca85e35e2", + "content-hash": "6d7e60fc78bfe51c217878efb05e628d", + "packages": [ + { + "name": "latte/latte", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/latte.git", + "reference": "88153143d670ff57168e9ef4798a377a38452c33" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/latte/zipball/88153143d670ff57168e9ef4798a377a38452c33", + "reference": "88153143d670ff57168e9ef4798a377a38452c33", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.4.4" + }, + "conflict": { + "nette/application": "<2.4" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-fileinfo": "to use filter |datastream", + "ext-mbstring": "to use filters like lower, upper, capitalize, ..." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Latte: the amazing template engine for PHP", + "homepage": "https://latte.nette.org", + "keywords": [ + "templating", + "twig" + ], + "time": "2016-07-05 15:39:30" + }, + { + "name": "nette/application", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/application.git", + "reference": "b9b8166c424db14428c1cf1447dbdca673aae697" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/application/zipball/b9b8166c424db14428c1cf1447dbdca673aae697", + "reference": "b9b8166c424db14428c1cf1447dbdca673aae697", + "shasum": "" + }, + "require": { + "nette/component-model": "~2.3", + "nette/http": "~2.2", + "nette/reflection": "~2.2", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/di": "<2.4", + "nette/forms": "<2.4", + "nette/latte": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.4", + "nette/di": "~2.4", + "nette/forms": "~2.4", + "nette/robot-loader": "~2.4", + "nette/security": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "latte/latte": "Allows using Latte in templates", + "nette/forms": "Allows to use Nette\\Application\\UI\\Form" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ], + "files": [ + "src/compatibility.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Application MVC Component", + "homepage": "https://nette.org", + "time": "2016-06-25 20:01:08" + }, + { + "name": "nette/bootstrap", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/bootstrap.git", + "reference": "322f41597c935110e3611ca7cdf9b2f855841cda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/322f41597c935110e3611ca7cdf9b2f855841cda", + "reference": "322f41597c935110e3611ca7cdf9b2f855841cda", + "shasum": "" + }, + "require": { + "nette/di": "~2.4.0", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.2", + "nette/application": "~2.3", + "nette/caching": "~2.3", + "nette/database": "~2.3", + "nette/forms": "~2.3", + "nette/http": "~2.4.0", + "nette/mail": "~2.3", + "nette/robot-loader": "~2.2", + "nette/safe-stream": "~2.2", + "nette/security": "~2.3", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4.1" + }, + "suggest": { + "nette/robot-loader": "to use Configurator::createRobotLoader()", + "tracy/tracy": "to use Configurator::enableDebugger()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Bootstrap", + "homepage": "https://nette.org", + "time": "2016-06-25 11:54:52" + }, + { + "name": "nette/caching", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/caching.git", + "reference": "9a41df412418eebea718a75f67b869f3dfa2baa0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/caching/zipball/9a41df412418eebea718a75f67b869f3dfa2baa0", + "reference": "9a41df412418eebea718a75f67b869f3dfa2baa0", + "shasum": "" + }, + "require": { + "nette/finder": "~2.2", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.4", + "nette/di": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Caching Component", + "homepage": "https://nette.org", + "time": "2016-06-27 19:13:25" + }, + { + "name": "nette/component-model", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/component-model.git", + "reference": "9b5817b246bf409b8f0f8309c23e599dd8729d28" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/component-model/zipball/9b5817b246bf409b8f0f8309c23e599dd8729d28", + "reference": "9b5817b246bf409b8f0f8309c23e599dd8729d28", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/application": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Component Model", + "homepage": "https://nette.org", + "time": "2016-06-17 17:36:56" + }, + { + "name": "nette/database", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/database.git", + "reference": "05aa9112f3da7cf0ef799ad6b0fe223485deb827" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/database/zipball/05aa9112f3da7cf0ef799ad6b0fe223485deb827", + "reference": "05aa9112f3da7cf0ef799ad6b0fe223485deb827", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "nette/caching": "~2.2", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "mockery/mockery": "~1.0.0", + "nette/di": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Database Component", + "homepage": "https://nette.org", + "time": "2016-06-28 11:37:57" + }, + { + "name": "nette/di", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/di.git", + "reference": "beff1de5c216757fee64a93511408361d9b6365e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/di/zipball/beff1de5c216757fee64a93511408361d9b6365e", + "reference": "beff1de5c216757fee64a93511408361d9b6365e", + "shasum": "" + }, + "require": { + "nette/neon": "^2.3.3", + "nette/php-generator": "^2.4", + "nette/utils": "^2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/bootstrap": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Dependency Injection Component", + "homepage": "https://nette.org", + "time": "2016-07-07 14:26:22" + }, + { + "name": "nette/finder", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/finder.git", + "reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/finder/zipball/5cabd5fe89f9903715359a403b820c7f94f9bb5e", + "reference": "5cabd5fe89f9903715359a403b820c7f94f9bb5e", + "shasum": "" + }, + "require": { + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Finder: Files Searching", + "homepage": "https://nette.org", + "time": "2016-05-17 15:49:06" + }, + { + "name": "nette/forms", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/forms.git", + "reference": "57295d16f8e90173465735eb6be49a1e3ce614bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/forms/zipball/57295d16f8e90173465735eb6be49a1e3ce614bd", + "reference": "57295d16f8e90173465735eb6be49a1e3ce614bd", + "shasum": "" + }, + "require": { + "nette/component-model": "~2.3", + "nette/http": "~2.2", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.4", + "nette/di": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Forms: greatly facilitates web forms", + "homepage": "https://nette.org", + "time": "2016-07-09 12:02:06" + }, + { + "name": "nette/http", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/http.git", + "reference": "36148c1975900419d4f8f7b72c00b83c50e66e21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/http/zipball/36148c1975900419d4f8f7b72c00b83c50e66e21", + "reference": "36148c1975900419d4f8f7b72c00b83c50e66e21", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/di": "^2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "ext-fileinfo": "to detect type of uploaded files" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette HTTP Component", + "homepage": "https://nette.org", + "time": "2016-06-27 18:25:48" + }, + { + "name": "nette/mail", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/mail.git", + "reference": "7be27342aec5921e777ee461b1a77ee217fbc08d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/mail/zipball/7be27342aec5921e777ee461b1a77ee217fbc08d", + "reference": "7be27342aec5921e777ee461b1a77ee217fbc08d", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/di": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "ext-fileinfo": "to detect type of attached files" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Mail: Sending E-mails", + "homepage": "https://nette.org", + "time": "2016-06-27 18:27:07" + }, + { + "name": "nette/neon", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "c40c63f2afa4196844ac40d9d2a2cfb313f76906" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/c40c63f2afa4196844ac40d9d2a2cfb313f76906", + "reference": "c40c63f2afa4196844ac40d9d2a2cfb313f76906", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette NEON: parser & generator for Nette Object Notation", + "homepage": "http://ne-on.org", + "time": "2016-06-25 13:59:48" + }, + { + "name": "nette/php-generator", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/php-generator.git", + "reference": "bd62c292f472674d6022d131e6520d1af1543280" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/php-generator/zipball/bd62c292f472674d6022d131e6520d1af1543280", + "reference": "bd62c292f472674d6022d131e6520d1af1543280", + "shasum": "" + }, + "require": { + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette PHP Generator", + "homepage": "https://nette.org", + "time": "2016-06-22 19:02:17" + }, + { + "name": "nette/reflection", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/reflection.git", + "reference": "cbc6f2d9a1ecda099ad1ebe3c1f38b8bfc16be4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/reflection/zipball/cbc6f2d9a1ecda099ad1ebe3c1f38b8bfc16be4d", + "reference": "cbc6f2d9a1ecda099ad1ebe3c1f38b8bfc16be4d", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/caching": "~2.2", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/di": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette PHP Reflection Component", + "homepage": "https://nette.org", + "time": "2016-06-27 18:26:16" + }, + { + "name": "nette/robot-loader", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/robot-loader.git", + "reference": "e5c86ce8b53c7d4be84244624c67485ee4c92dbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/e5c86ce8b53c7d4be84244624c67485ee4c92dbc", + "reference": "e5c86ce8b53c7d4be84244624c67485ee4c92dbc", + "shasum": "" + }, + "require": { + "nette/caching": "~2.2", + "nette/finder": "~2.3", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette RobotLoader: comfortable autoloading", + "homepage": "https://nette.org", + "time": "2016-05-17 15:49:40" + }, + { + "name": "nette/safe-stream", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/safe-stream.git", + "reference": "3ba85ef4a4cf15e2f96b6a0beafe6333f6502fcd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/safe-stream/zipball/3ba85ef4a4cf15e2f96b6a0beafe6333f6502fcd", + "reference": "3ba85ef4a4cf15e2f96b6a0beafe6333f6502fcd", + "shasum": "" + }, + "require": { + "php": ">=5.3.1" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~1.7", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "files": [ + "src/loader.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette SafeStream: Atomic Operations", + "homepage": "https://nette.org", + "time": "2016-04-21 13:06:19" + }, + { + "name": "nette/security", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/security.git", + "reference": "cc14195f23f08a15dbbcb686ce478291e1915e3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/security/zipball/cc14195f23f08a15dbbcb686ce478291e1915e3c", + "reference": "cc14195f23f08a15dbbcb686ce478291e1915e3c", + "shasum": "" + }, + "require": { + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/di": "~2.4", + "nette/http": "~2.4", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Security: Access Control Component", + "homepage": "https://nette.org", + "time": "2016-06-27 19:13:01" + }, + { + "name": "nette/utils", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "06f54b7671f96826eb181353695483b600ae188d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/06f54b7671f96826eb181353695483b600ae188d", + "reference": "06f54b7671f96826eb181353695483b600ae188d", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", + "ext-mbstring": "to use Strings::lower() etc..." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Utility Classes", + "homepage": "https://nette.org", + "time": "2016-06-27 13:47:19" + }, + { + "name": "tracy/tracy", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/nette/tracy.git", + "reference": "89cd0c8cfd7e246a39a504f860cf2fbb5a5095f1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/tracy/zipball/89cd0c8cfd7e246a39a504f860cf2fbb5a5095f1", + "reference": "89cd0c8cfd7e246a39a504f860cf2fbb5a5095f1", + "shasum": "" + }, + "require": { + "php": ">=5.4.4" + }, + "require-dev": { + "nette/di": "~2.3", + "nette/tester": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src" + ], + "files": [ + "src/shortcuts.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Tracy: useful PHP debugger", + "homepage": "https://tracy.nette.org", + "keywords": [ + "debug", + "debugger", + "nette" + ], + "time": "2016-06-30 19:57:01" + } + ], + "packages-dev": [ + { + "name": "nette/tester", + "version": "v1.7.1", + "source": { + "type": "git", + "url": "https://github.com/nette/tester.git", + "reference": "d97534578e8cf66eabe081e7d5eaa4dd527ab0c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/tester/zipball/d97534578e8cf66eabe081e7d5eaa4dd527ab0c8", + "reference": "d97534578e8cf66eabe081e7d5eaa4dd527ab0c8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "bin": [ + "src/tester" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "An easy-to-use PHP unit testing framework.", + "homepage": "https://tester.nette.org", + "keywords": [ + "nette", + "testing", + "unit" + ], + "time": "2016-03-19 14:34:02" + } + ], + "aliases": [], + "minimum-stability": "dev", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">= 5.6" + }, + "platform-dev": [] +} diff --git a/database.sql b/database.sql new file mode 100644 index 0000000..ee19ba9 --- /dev/null +++ b/database.sql @@ -0,0 +1,54 @@ + +SET NAMES utf8; +SET foreign_key_checks = 0; + +CREATE TABLE `comments` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `post_id` int(11) NOT NULL, + `name` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `content` text NOT NULL, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`), + KEY `post_id` (`post_id`), + CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`post_id`) REFERENCES `posts` (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +CREATE TABLE `posts` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(255) NOT NULL, + `content` text NOT NULL, + `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + + +-- sample data + +INSERT INTO `comments` (`id`, `post_id`, `name`, `email`, `content`, `created_at`) VALUES +(1, 1, 'Jakub', NULL, 'Wort Dressed Sentinent Being water quite a moment and show thirty speck by the floor. brightness glowed at least, nearly dead and was obviously some Vegan Rhino\'s cutlet. It\'s unpleasantly like hitch hiking slang, as anything. - said Zaphod. - Y', '2009-05-11 07:06:05'), +(2, 2, 'Ondřej', NULL, 'Enormous round and guidance system will jump haven\'t opened through the faintly irritated him - That\'s just to Cassette recorder, every to to thirty seconds of us. Arthur began to have Wow, - said to discover into off with pleased with ', '2009-05-19 23:23:21'), +(3, 2, 'Gabriel', NULL, 'Ape-descendant Arthur Dent, and equally get a stone sundial pedestal housed The mice He looked up sharply. He threw Ford handed the Earth passed an answer. - You know, not even finished Permeated - He adjusted it. Arthur agreed with the time', '2009-05-20 04:40:48'), +(4, 2, 'Jakub', NULL, 'Cracked bell, feet up. - Are you will finally managed to see very strong desire just happens. Yeah, I bother please, the not be, - Missiles? Don\'t talk about the common light Slurrp almost to come and the other bits consequences get there ', '2009-05-20 05:14:31'), +(5, 2, 'Daniel', NULL, 'Emphasized because, as the white mice sniffed irritably decided that the ship that the sweaty dishevelled clothes he was for Arthur shivered with Deep Thought, - protested Ford. - said by your brain was almost, miles is each other. Fook ', '2009-05-20 08:31:40'), +(6, 2, 'Emily', NULL, 'Desk. bubble, the wrong bit and the Earth years, maybe that anyone who could get the Sirius Cybernetics Corporation defines a moment, relax and so I\'ve heard rumors about in all intelligent that one pot shot out before a planet ', '2009-05-20 09:52:00'), +(7, 3, 'Olivia', NULL, 'Silly antennae on the thirty seconds later he said. - Yes, - I\'m President always used to give it then? - Well? - Oh into the cold mud. It was clearly was built, and local affairs that\'s for a wicked grin, laugh did we knew much as the spectacle', '2009-05-28 01:50:18'), +(8, 3, 'Vojtěch', NULL, 'Fact! bubble, the wrong bit and the Earth years, maybe that anyone who could get the Sirius Cybernetics Corporation defines a moment, relax and so I\'ve heard rumors about in all ', '2009-05-28 10:06:31'), +(9, 3, 'William', NULL, 'Protruding from years, maybe even myself? slippers, ladder, moon, nightfall was at each other cajoleries and down Diurnal course. - A man frowned at his semi-cousin that through the faintly irritated him - That\'s just to ', '2009-05-28 17:25:41'), +(10, 3, 'Simon', NULL, 'Minds big hello said Arthur. - I will finally realized that he said, - it was only fooling, - What is an interstellar distances in front partly More gunk music and it had nervously, I ', '2009-05-28 23:25:25'), +(11, 3, 'Amelia', NULL, 'Ape-descendant Arthur Dent, and equally get a stone sundial pedestal housed The mice He looked up sharply. He threw Ford handed the Earth passed an answer. - You know, not even finished Permeated - He adjusted it. Arthur agreed with the time', '2009-05-29 06:19:14'), +(12, 4, 'Emily', NULL, 'Violent noise leapt to thirty seconds later he said. - Yes, - I\'m President always used to give it then? - Well? - Oh into the cold mud. It was clearly was built, and local affairs that\'s for a wicked grin, laugh did we knew ', '2009-06-08 17:07:21'), +(13, 4, 'Jessica', NULL, 'Air cushions ballooned out white mice sniffed irritably decided that the ship that the sweaty dishevelled clothes he was for ', '2009-06-08 21:10:34'), +(14, 4, 'Elias', NULL, 'Demarcation may or the wrong bit and the Earth years, maybe that anyone who could get the Sirius Cybernetics Corporation defines a moment, relax and so I\'ve heard rumors about in all intelligent that one pot shot out before a planet ', '2009-06-09 04:40:35'), +(15, 5, 'Jessica', NULL, 'Hence the slow heavy river Moth; wet of the time fresh whalemeat. At lunchtime? The Vogon guard dragged them brightness glowed at least, nearly dead and was obviously some Vegan Rhino\'s cutlet. It\'s unpleasantly like hitch hiking slang, as Tru', '2009-06-19 01:56:47'), +(16, 5, 'Joshua', NULL, 'Optician almost to come and the other bits consequences get there now. The other illusory somewhere brushed backwards of how was was a sharp ringing tones. - he said Slartibartfast coughed politely. - moment in Stone. It saved a white', '2009-06-19 03:44:05'), +(17, 5, 'Lukas', NULL, 'Desk. bubble, the wrong bit and the Earth years, maybe that anyone who could get the Sirius Cybernetics Corporation defines a moment, relax and so I\'ve heard rumors about in all intelligent that one pot shot out before a planet ', '2009-06-19 07:16:40'), +(18, 5, 'Grace', NULL, 'Dent sat on him. - Yeah, OK, - Oh those doors. There must have something else. Come on, to help him, small really thrash it space that ', '2009-06-19 07:28:33'); + +INSERT INTO `posts` (`id`, `title`, `content`, `created_at`) VALUES +(1, 'Thronged with making you doing', 'Out! looked like it. At an anachronism. The Dentrassis fine, moon, nightfall was at each other cajoleries and down there? - said Arthur turned himself up. - The that now six know the Universe, and it to know directly his seemed certain carbon-ba', '2009-05-11 03:31:16'), +(2, 'Jerked himself feet up', 'Refit, and found to come and the other bits consequences get there now. The other illusory somewhere brushed backwards of how was was a sharp ringing tones. - he said Slartibartfast coughed. Otherwise me. - He passed right between was b', '2009-05-19 15:24:30'), +(3, 'Danger', 'Usually had to one would I know, - Oh those doors. There must have something else. Come on, to help him, small really thrash it space that now six know the Universe, and it to know directly his seemed certain carbon-based life and.', '2009-05-28 01:18:15'), +(4, 'Tossed looked like it', 'Busy? - Just shut up, that spaceship and spewed up in emergencies as such, but... - yelled Ford, - said Arthur Dent with me? - said about to a rather into his neck. The President of the planet Bethselamin soft and said, very fast. Very good. For wha', '2009-06-08 13:17:21'), +(5, 'Eddie your eyes...', 'Airlock hatchway into your house down! Ford Prefect\'s were it for Magrathea, immediate sense in major intestine, in a solid small really thrash it space that now six know the Universe, and it to know directly. House Down Once you talked to', '2009-06-18 23:55:45'); diff --git a/log/.gitignore b/log/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/log/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..f87c5d1 --- /dev/null +++ b/readme.md @@ -0,0 +1,62 @@ +Nette Web Project +================= + +This is a simple, skeleton application using the [Nette](https://nette.org). This is meant to +be used as a starting point for your new projects. + +[Nette](https://nette.org) is a popular tool for PHP web development. +It is designed to be the most usable and friendliest as possible. It focuses +on security and performance and is definitely one of the safest PHP frameworks. + +If you like Nette, **[please make a donation now](https://nette.org/donate)**. Thank you! + + +Requirements +------------ + +- Web Project for Nette 3.0 requires PHP 7.1 +- The master version of Web Project requires PHP 7.1 + + +Installation +------------ + +The best way to install Web Project is using Composer. If you don't have Composer yet, +download it following [the instructions](https://doc.nette.org/composer). Then use command: + + composer create-project nette/web-project path/to/install + cd path/to/install + + +Make directories `temp/` and `log/` writable. + + +Web Server Setup +---------------- + +The simplest way to get started is to start the built-in PHP server in the root directory of your project: + + php -S localhost:8000 -t www + +Then visit `http://localhost:8000` in your browser to see the welcome page. + +For Apache or Nginx, setup a virtual host to point to the `www/` directory of the project and you +should be ready to go. + +**It is CRITICAL that whole `app/`, `log/` and `temp/` directories are not accessible directly +via a web browser. See [security warning](https://nette.org/security-warning).** + + +Notice: Composer PHP version +---------------------------- + +This project forces PHP 7.1 (eventually 7.2) as your PHP version for Composer packages. If you have newer +version on production server you should change it in `composer.json`: + +```json +"config": { + "platform": { + "php": "7.2" + } +} +``` diff --git a/temp/.gitignore b/temp/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/temp/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/www/.htaccess b/www/.htaccess new file mode 100644 index 0000000..0996638 --- /dev/null +++ b/www/.htaccess @@ -0,0 +1,32 @@ +# Apache configuration file (see https://httpd.apache.org/docs/current/mod/quickreference.html) +Require all granted + +# disable directory listing + + Options -Indexes + + +# enable cool URL + + RewriteEngine On + # RewriteBase / + + # use HTTPS + # RewriteCond %{HTTPS} !on + # RewriteRule .? https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] + + # prevents files starting with dot to be viewed by browser + RewriteRule /\.|^\.(?!well-known/) - [F] + + # front controller + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule !\.(pdf|js|ico|gif|jpg|jpeg|png|webp|svg|css|rar|zip|7z|tar\.gz|map|eot|ttf|otf|woff|woff2)$ index.php [L] + + +# enable gzip compression + + + AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript application/json application/xml image/svg+xml + + diff --git a/www/css/style.css b/www/css/style.css new file mode 100644 index 0000000..d18ff8b --- /dev/null +++ b/www/css/style.css @@ -0,0 +1,38 @@ +body { + font: 16px/1.5 Georgia, Verdana, Arial; + margin: 0 auto; + width: 600px; + color: #333; + background-color: #fff; +} + +div.flash { + color: black; + background: #FFF9D7; + border: 1px solid #E2C822; + padding: 1em; + margin: 1em 0; +} + +a[href^="#error:"] { + background: red; + color: white; +} + +form th, form td { + vertical-align: top; + font-weight: normal; +} + +form th { + text-align: right; +} + +form .required label { + font-weight: bold; +} + +form .error { + color: #D00; + font-weight: bold; +} diff --git a/www/favicon.ico b/www/favicon.ico new file mode 100644 index 0000000..b20cfd0 Binary files /dev/null and b/www/favicon.ico differ diff --git a/www/index.php b/www/index.php new file mode 100644 index 0000000..9e6c993 --- /dev/null +++ b/www/index.php @@ -0,0 +1,8 @@ +getByType(Nette\Application\Application::class) + ->run(); diff --git a/www/robots.txt b/www/robots.txt new file mode 100644 index 0000000..e69de29