diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index ab73207..0000000 --- a/.gitattributes +++ /dev/null @@ -1,6 +0,0 @@ -.gitattributes export-ignore -.gitignore export-ignore -.github export-ignore -.travis.yml export-ignore -tests/ export-ignore -*.sh eol=lf diff --git a/.github/funding.yml b/.github/funding.yml deleted file mode 100644 index 25adc95..0000000 --- a/.github/funding.yml +++ /dev/null @@ -1,2 +0,0 @@ -github: dg -custom: "https://nette.org/donate" diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 7579f74..0000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -vendor -composer.lock diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d0c66a7..0000000 --- a/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: php -php: - - 7.1 - -install: - # Install Nette Code Checker - - travis_retry composer create-project nette/code-checker temp/code-checker ^3 --no-progress - # Install Nette Coding Standard - - travis_retry composer create-project nette/coding-standard temp/coding-standard ^2 --no-progress - -script: - - php temp/code-checker/code-checker --strict-types - - php temp/coding-standard/ecs check . --config temp/coding-standard/coding-standard-php71.yml - -sudo: false - -cache: - directories: - - $HOME/.composer/cache diff --git a/Books/composer.json b/Books/composer.json deleted file mode 100644 index b5b4500..0000000 --- a/Books/composer.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "require": { - "php": ">=7.1", - "nette/database": "^3.0", - "nette/bootstrap": "^3.0", - "tracy/tracy": "^2.6" - }, - "minimum-stability": "dev" -} diff --git a/Books/demo/config/mysql.neon b/Books/demo/config/mysql.neon deleted file mode 100644 index 2ac672e..0000000 --- a/Books/demo/config/mysql.neon +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - dumpFile: %appDir%/dump/mysql.sql - -database: - dsn: 'mysql:host=127.0.0.1;dbname=nette_test' - user: root - password: diff --git a/Books/demo/config/postgresql.neon b/Books/demo/config/postgresql.neon deleted file mode 100644 index 15a87f5..0000000 --- a/Books/demo/config/postgresql.neon +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - dumpFile: %appDir%/dump/postgresql.sql - -database: - dsn: 'pgsql:host=127.0.0.1;dbname=nette_test' - user: postgres - password: diff --git a/Books/demo/config/sqlite.neon b/Books/demo/config/sqlite.neon deleted file mode 100644 index abb9cc8..0000000 --- a/Books/demo/config/sqlite.neon +++ /dev/null @@ -1,5 +0,0 @@ -parameters: - dumpFile: %appDir%/dump/sqlite.sql - -database: - dsn: 'sqlite::memory:' diff --git a/Books/demo/config/sqlsrv.neon b/Books/demo/config/sqlsrv.neon deleted file mode 100644 index 8ea9a22..0000000 --- a/Books/demo/config/sqlsrv.neon +++ /dev/null @@ -1,7 +0,0 @@ -parameters: - dumpFile: %appDir%/dump/sqlsrv.sql - -database: - dsn: 'sqlsrv:server=127.0.0.1;database=nette_test' - user: - password: diff --git a/Books/demo/demo.php b/Books/demo/demo.php deleted file mode 100644 index bd6ce65..0000000 --- a/Books/demo/demo.php +++ /dev/null @@ -1,48 +0,0 @@ -enableTracy(__DIR__ . '/log'); - -// create DI container -$configurator->setTempDirectory(__DIR__ . '/temp'); -$configurator->addConfig(__DIR__ . '/config/sqlite.neon'); // for SQLite -//$configurator->addConfig(__DIR__ . '/config/mysql.neon'); // for MySQL -//$configurator->addConfig(__DIR__ . '/config/postgresql.neon'); // for PostgreSQL -//$configurator->addConfig(__DIR__ . '/config/sqlsrv.neon'); // for MS SQL Server -$container = $configurator->createContainer(); - -// get database from DI container -// see https://doc.nette.org/en/di-configuration -/** @var Nette\Database\Context $database */ -$database = $container->getByType(Nette\Database\Context::class); - -// load database dump -Nette\Database\Helpers::loadFromFile( - $database->getConnection(), - $container->parameters['dumpFile'] // defined in config file -); - -// lists the author's name for each book and all its tags: -// see https://doc.nette.org/en/database-explorer -$books = $database->table('book'); - -echo PHP_SAPI === 'cli' ? '' : ''; - -foreach ($books as $book) { - echo "title: {$book->title} \n"; - echo "written by: {$book->author->name} \n"; // $book->author is row from table 'author' - - echo 'tags: '; - foreach ($book->related('book_tag') as $bookTag) { - echo $bookTag->tag->name . ', '; // $bookTag->tag is row from table 'tag' - } - echo "\n\n"; -} - -echo PHP_SAPI === 'cli' ? '' : ''; diff --git a/Books/demo/dump/mysql.sql b/Books/demo/dump/mysql.sql deleted file mode 100644 index b63befe..0000000 --- a/Books/demo/dump/mysql.sql +++ /dev/null @@ -1,93 +0,0 @@ -SET FOREIGN_KEY_CHECKS = 0; - -DROP TABLE IF EXISTS `author`, `book`, `book_tag`, `book_tag_alt`, `note`, `tag`; - - -CREATE TABLE author ( - id int NOT NULL AUTO_INCREMENT, - name varchar(30) NOT NULL, - web varchar(100) NOT NULL, - born date DEFAULT NULL, - PRIMARY KEY(id) -) ENGINE=InnoDB AUTO_INCREMENT=13; - -INSERT INTO author (id, name, web, born) VALUES (11, 'Jakub Vrana', 'http://www.vrana.cz/', NULL); -INSERT INTO author (id, name, web, born) VALUES (12, 'David Grudl', 'http://davidgrudl.com/', NULL); -INSERT INTO author (id, name, web, born) VALUES (13, 'Geek', 'http://example.com', NULL); - - - -CREATE TABLE tag ( - id int NOT NULL AUTO_INCREMENT, - name varchar(20) NOT NULL, - PRIMARY KEY (id) -) ENGINE=InnoDB AUTO_INCREMENT=25; - -INSERT INTO tag (id, name) VALUES (21, 'PHP'); -INSERT INTO tag (id, name) VALUES (22, 'MySQL'); -INSERT INTO tag (id, name) VALUES (23, 'JavaScript'); -INSERT INTO tag (id, name) VALUES (24, 'Neon'); - - - -CREATE TABLE book ( - id int NOT NULL AUTO_INCREMENT, - author_id int NOT NULL, - translator_id int, - title varchar(50) NOT NULL, - next_volume int, - PRIMARY KEY (id), - CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id), - CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id), - CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id) -) ENGINE=InnoDB AUTO_INCREMENT=5; - -CREATE INDEX book_title ON book (title); - -INSERT INTO book (id, author_id, translator_id, title) VALUES (1, 11, 11, '1001 tipu a triku pro PHP'); -INSERT INTO book (id, author_id, translator_id, title) VALUES (2, 11, NULL, 'JUSH'); -INSERT INTO book (id, author_id, translator_id, title) VALUES (3, 12, 12, 'Nette'); -INSERT INTO book (id, author_id, translator_id, title) VALUES (4, 12, 12, 'Dibi'); - - - -CREATE TABLE book_tag ( - book_id int NOT NULL, - tag_id int NOT NULL, - PRIMARY KEY (book_id, tag_id), - CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE -) ENGINE=InnoDB; - -INSERT INTO book_tag (book_id, tag_id) VALUES (1, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (3, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (4, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (1, 22); -INSERT INTO book_tag (book_id, tag_id) VALUES (4, 22); -INSERT INTO book_tag (book_id, tag_id) VALUES (2, 23); - - - -CREATE TABLE book_tag_alt ( - book_id int NOT NULL, - tag_id int NOT NULL, - state varchar(30), - PRIMARY KEY (book_id, tag_id), - CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE -) ENGINE=InnoDB; - -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 21, 'public'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 22, 'private'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 23, 'private'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 24, 'public'); - - - -CREATE TABLE note ( - book_id int NOT NULL, - note varchar(100), - CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id) -) ENGINE=InnoDB; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/Books/demo/dump/postgresql.sql b/Books/demo/dump/postgresql.sql deleted file mode 100644 index 33e4fb4..0000000 --- a/Books/demo/dump/postgresql.sql +++ /dev/null @@ -1,92 +0,0 @@ -DROP TABLE IF EXISTS `author`, `book`, `book_tag`, `book_tag_alt`, `note`, `tag`; - - -CREATE TABLE author ( - id serial NOT NULL, - name varchar(30) NOT NULL, - web varchar(100) NOT NULL, - born date DEFAULT NULL, - PRIMARY KEY(id) -); - -INSERT INTO author (id, name, web, born) VALUES (11, 'Jakub Vrana', 'http://www.vrana.cz/', NULL); -INSERT INTO author (id, name, web, born) VALUES (12, 'David Grudl', 'http://davidgrudl.com/', NULL); -INSERT INTO author (id, name, web, born) VALUES (13, 'Geek', 'http://example.com', NULL); -SELECT setval('author_id_seq', 13, TRUE); - - - -CREATE TABLE tag ( - id serial NOT NULL, - name varchar(20) NOT NULL, - PRIMARY KEY (id) -); - -INSERT INTO tag (id, name) VALUES (21, 'PHP'); -INSERT INTO tag (id, name) VALUES (22, 'MySQL'); -INSERT INTO tag (id, name) VALUES (23, 'JavaScript'); -INSERT INTO tag (id, name) VALUES (24, 'Neon'); -SELECT setval('tag_id_seq', 24, TRUE); - - - -CREATE TABLE book ( - id serial NOT NULL, - author_id int NOT NULL, - translator_id int, - title varchar(50) NOT NULL, - next_volume INT, - PRIMARY KEY (id), - CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id), - CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id), - CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id) -); - -CREATE INDEX book_title ON book (title); - - - -INSERT INTO book (id, author_id, translator_id, title) VALUES (1, 11, 11, '1001 tipu a triku pro PHP'); -INSERT INTO book (id, author_id, translator_id, title) VALUES (2, 11, NULL, 'JUSH'); -INSERT INTO book (id, author_id, translator_id, title) VALUES (3, 12, 12, 'Nette'); -INSERT INTO book (id, author_id, translator_id, title) VALUES (4, 12, 12, 'Dibi'); -SELECT setval('book_id_seq', 4, TRUE); - -CREATE TABLE book_tag ( - book_id int NOT NULL, - tag_id int NOT NULL, - PRIMARY KEY (book_id, tag_id), - CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE -); - -INSERT INTO book_tag (book_id, tag_id) VALUES (1, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (3, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (4, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (1, 22); -INSERT INTO book_tag (book_id, tag_id) VALUES (4, 22); -INSERT INTO book_tag (book_id, tag_id) VALUES (2, 23); - - - -CREATE TABLE book_tag_alt ( - book_id int NOT NULL, - tag_id int NOT NULL, - state varchar(30), - PRIMARY KEY (book_id, tag_id), - CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE -); - -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 21, 'public'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 22, 'private'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 23, 'private'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 24, 'public'); - - - -CREATE TABLE note ( - book_id int NOT NULL, - note varchar(100), - CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id) -); diff --git a/Books/demo/dump/sqlite.sql b/Books/demo/dump/sqlite.sql deleted file mode 100644 index a9331dd..0000000 --- a/Books/demo/dump/sqlite.sql +++ /dev/null @@ -1,93 +0,0 @@ -DROP TABLE IF EXISTS note; -DROP TABLE IF EXISTS book_tag_alt; -DROP TABLE IF EXISTS book_tag; -DROP TABLE IF EXISTS book; -DROP TABLE IF EXISTS tag; -DROP TABLE IF EXISTS author; - - - - -CREATE TABLE author ( - id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - name TEXT NOT NULL, - web TEXT NOT NULL, - born DATE -); - -INSERT INTO author (id, name, web, born) VALUES (11, 'Jakub Vrana', 'http://www.vrana.cz/', NULL); -INSERT INTO author (name, web, born) VALUES ('David Grudl', 'http://davidgrudl.com/', NULL); -INSERT INTO author (name, web, born) VALUES ('Geek', 'http://example.com', NULL); - - - -CREATE TABLE tag ( - id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - name TEXT NOT NULL -); - -INSERT INTO tag (id, name) VALUES (21, 'PHP'); -INSERT INTO tag (name) VALUES ('MySQL'); -INSERT INTO tag (name) VALUES ('JavaScript'); -INSERT INTO tag (name) VALUES ('Neon'); - - - -CREATE TABLE book ( - id INTEGER PRIMARY KEY AUTOINCREMENT, - author_id INTEGER NOT NULL, - translator_id INTEGER, - title TEXT NOT NULL, - next_volume INTEGER, - CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id), - CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id), - CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id) -); - -CREATE INDEX book_title ON book (title); - -INSERT INTO book (author_id, translator_id, title) VALUES (11, 11, '1001 tipu a triku pro PHP'); -INSERT INTO book (author_id, translator_id, title) VALUES (11, NULL, 'JUSH'); -INSERT INTO book (author_id, translator_id, title) VALUES (12, 12, 'Nette'); -INSERT INTO book (author_id, translator_id, title) VALUES (12, 12, 'Dibi'); - - - -CREATE TABLE book_tag ( - book_id INTEGER NOT NULL, - tag_id INTEGER NOT NULL, - CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE, - PRIMARY KEY (book_id, tag_id) -); - -INSERT INTO book_tag (book_id, tag_id) VALUES (1, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (3, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (4, 21); -INSERT INTO book_tag (book_id, tag_id) VALUES (1, 22); -INSERT INTO book_tag (book_id, tag_id) VALUES (4, 22); -INSERT INTO book_tag (book_id, tag_id) VALUES (2, 23); - - - -CREATE TABLE book_tag_alt ( - book_id INTEGER NOT NULL, - tag_id INTEGER NOT NULL, - state TEXT, - PRIMARY KEY (book_id, tag_id), - CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE -); - -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 21, 'public'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 22, 'private'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 23, 'private'); -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES (3, 24, 'public'); - - - -CREATE TABLE note ( - book_id int NOT NULL, - note varchar(100), - CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id) -); diff --git a/Books/demo/dump/sqlsrv.sql b/Books/demo/dump/sqlsrv.sql deleted file mode 100644 index 23911c2..0000000 --- a/Books/demo/dump/sqlsrv.sql +++ /dev/null @@ -1,101 +0,0 @@ -IF OBJECT_ID('note', 'U') IS NOT NULL DROP TABLE note; -IF OBJECT_ID('book_tag_alt', 'U') IS NOT NULL DROP TABLE book_tag_alt; -IF OBJECT_ID('book_tag', 'U') IS NOT NULL DROP TABLE book_tag; -IF OBJECT_ID('book', 'U') IS NOT NULL DROP TABLE book; -IF OBJECT_ID('tag', 'U') IS NOT NULL DROP TABLE tag; -IF OBJECT_ID('author', 'U') IS NOT NULL DROP TABLE author; - - - -CREATE TABLE author ( - id int NOT NULL IDENTITY(11,1), - name varchar(30) NOT NULL, - web varchar(100) NOT NULL, - born date, - PRIMARY KEY(id) -); - -INSERT INTO author (name, web, born) VALUES -('Jakub Vrana', 'http://www.vrana.cz/', NULL), -('David Grudl', 'http://davidgrudl.com/', NULL), -('Geek', 'http://example.com', NULL); - - - -CREATE TABLE tag ( - id int NOT NULL IDENTITY(21, 1), - name varchar(20) NOT NULL, - PRIMARY KEY (id) -); - -INSERT INTO tag (name) VALUES -('PHP'), -('MySQL'), -('JavaScript'), -('Neon'); - - - -CREATE TABLE book ( - id int NOT NULL IDENTITY(1,1), - author_id int NOT NULL, - translator_id int, - title varchar(50) NOT NULL, - next_volume int, - PRIMARY KEY (id), - CONSTRAINT book_author FOREIGN KEY (author_id) REFERENCES author (id), - CONSTRAINT book_translator FOREIGN KEY (translator_id) REFERENCES author (id), - CONSTRAINT book_volume FOREIGN KEY (next_volume) REFERENCES book (id) -); - -CREATE INDEX book_title ON book (title); - -INSERT INTO book (author_id, translator_id, title) VALUES -(11, 11, '1001 tipu a triku pro PHP'), -(11, NULL, 'JUSH'), -(12, 12, 'Nette'), -(12, 12, 'Dibi'); - - - --- Add primary key manually, it is tested to name -CREATE TABLE book_tag ( - book_id int NOT NULL, - tag_id int NOT NULL, - CONSTRAINT book_tag_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE -); -ALTER TABLE book_tag ADD CONSTRAINT PK_book_tag PRIMARY KEY CLUSTERED (book_id, tag_id); - -INSERT INTO book_tag (book_id, tag_id) VALUES -(1, 21), -(3, 21), -(4, 21), -(1, 22), -(4, 22), -(2, 23); - - - -CREATE TABLE book_tag_alt ( - book_id int NOT NULL, - tag_id int NOT NULL, - state varchar(30), - PRIMARY KEY (book_id, tag_id), - CONSTRAINT book_tag_alt_tag FOREIGN KEY (tag_id) REFERENCES tag (id), - CONSTRAINT book_tag_alt_book FOREIGN KEY (book_id) REFERENCES book (id) ON DELETE CASCADE -); - -INSERT INTO book_tag_alt (book_id, tag_id, state) VALUES -(3, 21, 'public'), -(3, 22, 'private'), -(3, 23, 'private'), -(3, 24, 'public'); - - - -CREATE TABLE note ( - book_id int NOT NULL, - note varchar(100), - CONSTRAINT note_book FOREIGN KEY (book_id) REFERENCES book (id) -); diff --git a/Books/demo/log/.gitignore b/Books/demo/log/.gitignore deleted file mode 100644 index 4a7528a..0000000 --- a/Books/demo/log/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.* -!*/.* \ No newline at end of file diff --git a/Books/demo/temp/.gitignore b/Books/demo/temp/.gitignore deleted file mode 100644 index 4a7528a..0000000 --- a/Books/demo/temp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.* -!*/.* \ No newline at end of file diff --git a/CD-collection/.htaccess b/CD-collection/.htaccess deleted file mode 100644 index b66e808..0000000 --- a/CD-collection/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Require all denied diff --git a/CD-collection/app/Bootstrap.php b/CD-collection/app/Bootstrap.php deleted file mode 100644 index aa757d3..0000000 --- a/CD-collection/app/Bootstrap.php +++ /dev/null @@ -1,31 +0,0 @@ -setDebugMode('secret@23.75.345.200'); // enable for your remote IP - $configurator->enableTracy(__DIR__ . '/../log'); - - // Enable RobotLoader - this will load all classes automatically - $configurator->setTempDirectory(__DIR__ . '/../temp'); - $configurator->createRobotLoader() - ->addDirectory(__DIR__) - ->register(); - - // Create Dependency Injection container from config.neon file - $configurator->addConfig(__DIR__ . '/config/common.neon'); - - return $configurator; - } -} diff --git a/CD-collection/app/Model/AlbumRepository.php b/CD-collection/app/Model/AlbumRepository.php deleted file mode 100644 index 6c48bb5..0000000 --- a/CD-collection/app/Model/AlbumRepository.php +++ /dev/null @@ -1,40 +0,0 @@ -database = $database; - } - - - public function findAll(): Nette\Database\Table\Selection - { - return $this->database->table('albums'); - } - - - public function findById(int $id): Nette\Database\Table\ActiveRow - { - return $this->findAll()->get($id); - } - - - public function insert(iterable $values): void - { - $this->findAll()->insert($values); - } -} diff --git a/CD-collection/app/Model/Authenticator.php b/CD-collection/app/Model/Authenticator.php deleted file mode 100644 index 7340d82..0000000 --- a/CD-collection/app/Model/Authenticator.php +++ /dev/null @@ -1,52 +0,0 @@ -database = $database; - $this->passwords = $passwords; - } - - - /** - * Performs an authentication. - * @throws Nette\Security\AuthenticationException - */ - public function authenticate(array $credentials): Security\IIdentity - { - [$username, $password] = $credentials; - $row = $this->database->table('users')->where('username', $username)->fetch(); - - if (!$row) { - throw new Security\AuthenticationException('The username is incorrect.', self::IDENTITY_NOT_FOUND); - - } elseif (!$this->passwords->verify($password, $row->password)) { - throw new Security\AuthenticationException('The password is incorrect.', self::INVALID_CREDENTIAL); - } - - $arr = $row->toArray(); - unset($arr['password']); - return new Security\Identity($row->id, null, $arr); - } -} diff --git a/CD-collection/app/Model/demo.db3 b/CD-collection/app/Model/demo.db3 deleted file mode 100644 index 713315e..0000000 Binary files a/CD-collection/app/Model/demo.db3 and /dev/null differ diff --git a/CD-collection/app/Presenters/DashboardPresenter.php b/CD-collection/app/Presenters/DashboardPresenter.php deleted file mode 100644 index b70d060..0000000 --- a/CD-collection/app/Presenters/DashboardPresenter.php +++ /dev/null @@ -1,151 +0,0 @@ -albums = $albums; - } - - - protected function startup(): void - { - parent::startup(); - - if (!$this->getUser()->isLoggedIn()) { - if ($this->getUser()->getLogoutReason() === Nette\Security\IUserStorage::INACTIVITY) { - $this->flashMessage('You have been signed out due to inactivity. Please sign in again.'); - } - $this->redirect('Sign:in', ['backlink' => $this->storeRequest()]); - } - } - - - /********************* view default *********************/ - - - public function renderDefault(): void - { - $this->template->albums = $this->albums->findAll()->order('artist')->order('title'); - } - - - /********************* views add & edit *********************/ - - - public function renderAdd(): void - { - $this['albumForm']['save']->caption = 'Add'; - } - - - public function renderEdit(int $id): void - { - $form = $this['albumForm']; - if (!$form->isSubmitted()) { - $album = $this->albums->findById($id); - if (!$album) { - $this->error('Record not found'); - } - $form->setDefaults($album); - } - } - - - /********************* view delete *********************/ - - - public function renderDelete(int $id): void - { - $this->template->album = $this->albums->findById($id); - if (!$this->template->album) { - $this->error('Record not found'); - } - } - - - /********************* component factories *********************/ - - - /** - * Edit form factory. - */ - protected function createComponentAlbumForm(): Form - { - $form = new Form; - $form->addText('artist', 'Artist:') - ->setRequired('Please enter an artist.'); - - $form->addText('title', 'Title:') - ->setRequired('Please enter a title.'); - - $form->addSubmit('save', 'Save') - ->setHtmlAttribute('class', 'default') - ->onClick[] = [$this, 'albumFormSucceeded']; - - $form->addSubmit('cancel', 'Cancel') - ->setValidationScope([]) - ->onClick[] = [$this, 'formCancelled']; - - return $form; - } - - - public function albumFormSucceeded(Nette\Forms\Controls\SubmitButton $button): void - { - $values = $button->getForm()->getValues(); - $id = (int) $this->getParameter('id'); - if ($id) { - $this->albums->findById($id)->update($values); - $this->flashMessage('The album has been updated.'); - } else { - $this->albums->insert($values); - $this->flashMessage('The album has been added.'); - } - $this->redirect('default'); - } - - - /** - * Delete form factory. - */ - protected function createComponentDeleteForm(): Form - { - $form = new Form; - $form->addSubmit('cancel', 'Cancel') - ->onClick[] = [$this, 'formCancelled']; - - $form->addSubmit('delete', 'Delete') - ->setHtmlAttribute('class', 'default') - ->onClick[] = [$this, 'deleteFormSucceeded']; - - return $form; - } - - - public function deleteFormSucceeded(): void - { - $this->albums->findById((int) $this->getParameter('id'))->delete(); - $this->flashMessage('Album has been deleted.'); - $this->redirect('default'); - } - - - public function formCancelled(): void - { - $this->redirect('default'); - } -} diff --git a/CD-collection/app/Presenters/SignPresenter.php b/CD-collection/app/Presenters/SignPresenter.php deleted file mode 100644 index 1d1760b..0000000 --- a/CD-collection/app/Presenters/SignPresenter.php +++ /dev/null @@ -1,57 +0,0 @@ -addText('username', 'Username:') - ->setRequired('Please enter your username.'); - - $form->addPassword('password', 'Password:') - ->setRequired('Please enter your password.'); - - $form->addSubmit('send', 'Sign in'); - - $form->onSuccess[] = [$this, 'signInFormSucceeded']; - return $form; - } - - - public function signInFormSucceeded(UI\Form $form, \stdClass $values): void - { - try { - $this->getUser()->login($values->username, $values->password); - - } catch (Nette\Security\AuthenticationException $e) { - $form->addError($e->getMessage()); - return; - } - - $this->restoreRequest($this->backlink); - $this->redirect('Dashboard:'); - } - - - public function actionOut(): void - { - $this->getUser()->logout(); - $this->flashMessage('You have been signed out.'); - $this->redirect('in'); - } -} diff --git a/CD-collection/app/Presenters/templates/@layout.latte b/CD-collection/app/Presenters/templates/@layout.latte deleted file mode 100644 index 73da215..0000000 --- a/CD-collection/app/Presenters/templates/@layout.latte +++ /dev/null @@ -1,32 +0,0 @@ -{** - * Layout of Nette Framework example CD collection - * - * @param string $robots tell robots how to index the content of a page (optional) - * @param string $basePath web base path - * @param array $flashes flash messages - * @param Nette\Web\User $user current user - *} - - - - - - - - {block title|stripHtml|trim}{/block} | Nette example - - - - -
-
{$flash->message}
- -
- {include content} -
- -

Signed in as {$user->identity->realname}. Sign out

- - -

AltStyle によって変換されたページ (->オリジナル) /

- diff --git a/CD-collection/app/Presenters/templates/Dashboard/add.latte b/CD-collection/app/Presenters/templates/Dashboard/add.latte deleted file mode 100644 index 01b760c..0000000 --- a/CD-collection/app/Presenters/templates/Dashboard/add.latte +++ /dev/null @@ -1,5 +0,0 @@ -{block content} - -

Add New Album

- -{control albumForm} diff --git a/CD-collection/app/Presenters/templates/Dashboard/default.latte b/CD-collection/app/Presenters/templates/Dashboard/default.latte deleted file mode 100644 index 8ab1149..0000000 --- a/CD-collection/app/Presenters/templates/Dashboard/default.latte +++ /dev/null @@ -1,24 +0,0 @@ -{block content} - -

My Albums

- -

Add new album

- - - - - - - - -{foreach $albums as $album} - - - - - -{/foreach} -
TitleArtist
{$album->title}{$album->artist} - Edit - Delete -
diff --git a/CD-collection/app/Presenters/templates/Dashboard/delete.latte b/CD-collection/app/Presenters/templates/Dashboard/delete.latte deleted file mode 100644 index a726579..0000000 --- a/CD-collection/app/Presenters/templates/Dashboard/delete.latte +++ /dev/null @@ -1,11 +0,0 @@ -{block content} - -

Delete Album

- -{if $album} -

Are you sure that you want to delete ‘{$album->title}’ by ‘{$album->artist}’?

- {control deleteForm} - -{else} -

Cannot find album.

-{/if} diff --git a/CD-collection/app/Presenters/templates/Dashboard/edit.latte b/CD-collection/app/Presenters/templates/Dashboard/edit.latte deleted file mode 100644 index 15a1f70..0000000 --- a/CD-collection/app/Presenters/templates/Dashboard/edit.latte +++ /dev/null @@ -1,5 +0,0 @@ -{block content} - -

Edit Album

- -{control albumForm} diff --git a/CD-collection/app/Presenters/templates/Sign/in.latte b/CD-collection/app/Presenters/templates/Sign/in.latte deleted file mode 100644 index a9c59d5..0000000 --- a/CD-collection/app/Presenters/templates/Sign/in.latte +++ /dev/null @@ -1,9 +0,0 @@ -{var $robots = noindex} - -{block content} - -

Sign in

- -{control signInForm} - -

Default username is demo, with password xxx

diff --git a/CD-collection/app/Router/RouterFactory.php b/CD-collection/app/Router/RouterFactory.php deleted file mode 100644 index 2d995d0..0000000 --- a/CD-collection/app/Router/RouterFactory.php +++ /dev/null @@ -1,30 +0,0 @@ -addRoute('index.php', 'Dashboard:default', Route::ONE_WAY); - $router->addRoute('/[/]', 'Dashboard:default'); - return $router; - } - - return new SimpleRouter('Dashboard:default'); - } -} diff --git a/CD-collection/app/config/common.neon b/CD-collection/app/config/common.neon deleted file mode 100644 index 86ce1fb..0000000 --- a/CD-collection/app/config/common.neon +++ /dev/null @@ -1,18 +0,0 @@ -# -# SECURITY WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser! -# https://nette.org/security-warning -# -php: - date.timezone: Europe/Prague - -application: - mapping: - *: App\*Module\Presenters\*Presenter - -database: - dsn: "sqlite:%appDir%/Model/demo.db3" - -services: - - App\Model\Authenticator - - App\Model\AlbumRepository - router: App\Router\RouterFactory::createRouter diff --git a/CD-collection/composer.json b/CD-collection/composer.json deleted file mode 100644 index 71edf61..0000000 --- a/CD-collection/composer.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "nette-examples/cd-collection", - "type": "project", - "description": "Classic Zend Framework Tutorial from Akrabat rewritten for Nette Framework.", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "require": { - "php": ">=7.1", - "nette/application": "^3.0", - "nette/bootstrap": "^3.0", - "nette/database": "^3.0", - "nette/forms": "^3.0", - "nette/robot-loader": "^3.0", - "nette/security": "^3.0", - "nette/utils": "^3.0", - "latte/latte": "^2.5", - "tracy/tracy": "^2.6" - }, - "autoload": { - "psr-4": { - "App\\": "app" - } - }, - "minimum-stability": "dev" -} diff --git a/CD-collection/log/.gitignore b/CD-collection/log/.gitignore deleted file mode 100644 index 816b594..0000000 --- a/CD-collection/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.* \ No newline at end of file diff --git a/CD-collection/readme.md b/CD-collection/readme.md deleted file mode 100644 index 517d836..0000000 --- a/CD-collection/readme.md +++ /dev/null @@ -1,34 +0,0 @@ -CD collection (Nette Framework example) ---------------------------------------- - -Classic Zend Framework [Tutorial](http://akrabat.com/zend-framework-tutorial) -rewritten for Nette Framework. - -The example shows an important feature of the Nette Framework: the URLs are -not used inside the application including the templates. The URLs are in -responsibility of the router and can be changed anytime. The target of a link -is always a combination "Presenter:action" or "Presenter:signal!". - - -What is [Nette Framework](https://nette.org)? --------------------------------------------- - -Nette Framework 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. - -Nette Framework speaks your language and helps you to easily build better websites. - - -Installing ----------- - -The best way to install Nette Framework is to download latest package -from https://nette.org/download or using [Composer](https://doc.nette.org/composer): - - curl -s http://getcomposer.org/installer | php - php composer.phar update - -Then navigate your browser to the `www` directory. PHP 5.4 allows -you run `php -S localhost:8888 -t www` to start the webserver and -then visit `http://localhost:8888` in your browser. diff --git a/CD-collection/temp/.gitignore b/CD-collection/temp/.gitignore deleted file mode 100644 index 4a7528a..0000000 --- a/CD-collection/temp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.* -!*/.* \ No newline at end of file diff --git a/CD-collection/www/.htaccess b/CD-collection/www/.htaccess deleted file mode 100644 index b35c4ec..0000000 --- a/CD-collection/www/.htaccess +++ /dev/null @@ -1,32 +0,0 @@ -# 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|mjs|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/CD-collection/www/css/site.css b/CD-collection/www/css/site.css deleted file mode 100644 index c0a22d3..0000000 --- a/CD-collection/www/css/site.css +++ /dev/null @@ -1,108 +0,0 @@ -body { - font: 16px/1.5 "Trebuchet MS", "Geneva CE", lucida, sans-serif; - color: #333; - background-color: #fff; - margin: 2em; -} - -h1 { - font-size: 1.9em; - color: #3484D2; -} - -h2 { - font-size: 1.2em; - color: #3484D2; -} - -#content { - width: 770px; - margin: 0 5px; -} - -a { - color: #000080; -} - -#logged-in { - margin-top: 3em; - font-size: 90%; -} - -div.flash { - color: black; - background: #FFFFDD; - border: 1px solid #FFD700; - padding: 1em; - margin: 1em 0; -} - - - -/*------------------------------------------------------------------*/ - - -table.grid { - padding: 0; - margin: 0; - border-collapse:collapse; -} - -table.grid td, table.grid th { - background: #fff; - border: 1px solid #add4fb; - padding: 6px 6px 6px 12px; -} - -table.grid th { - color: #7a7772; - background: #E4F1FC; - text-align: left; - font-weight: normal; - font-size: 80%; -} - -table.grid .alt td { - background: #f8f8f0; -} - - - -/*------------------------------------------------------------------*/ - - - -form { - max-width: 500px; - padding: .8em 1.6em; - background: #E4F1FC; - border: solid 2px #add4fb; -} - -form input { - margin: 2px 0; - font-size: 100%; -} - -form input.default { - font-weight: bold; - font-size: 105%; -} - -form input.text { - padding: 4px 2px; - border: solid 1px #add4fb; - min-width: 200px; -} - -form label { - width: 100px; - display: block; - text-align: right; - margin-right: 5px; - font-weight: normal; -} - -form .required label { - font-weight: bold; -} diff --git a/CD-collection/www/index.php b/CD-collection/www/index.php deleted file mode 100644 index 564deb0..0000000 --- a/CD-collection/www/index.php +++ /dev/null @@ -1,12 +0,0 @@ -createContainer() - ->getByType(Nette\Application\Application::class) - ->run(); diff --git a/CD-collection/www/web.config b/CD-collection/www/web.config deleted file mode 100644 index 11a7c4a..0000000 --- a/CD-collection/www/web.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Fifteen/.htaccess b/Fifteen/.htaccess deleted file mode 100644 index b66e808..0000000 --- a/Fifteen/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Require all denied diff --git a/Fifteen/app/Bootstrap.php b/Fifteen/app/Bootstrap.php deleted file mode 100644 index 4e65bd0..0000000 --- a/Fifteen/app/Bootstrap.php +++ /dev/null @@ -1,32 +0,0 @@ -setDebugMode('secret@23.75.345.200'); // enable for your remote IP - $configurator->enableTracy(__DIR__ . '/../log'); - - // Enable RobotLoader - this will load all classes automatically - $configurator->setTempDirectory(__DIR__ . '/../temp'); - $configurator->createRobotLoader() - ->addDirectory(__DIR__) - ->register(); - - // Setup router - $configurator->addServices(['router' => new SimpleRouter('Default:default')]); - - return $configurator; - } -} diff --git a/Fifteen/app/Components/FifteenControl.latte b/Fifteen/app/Components/FifteenControl.latte deleted file mode 100644 index d188a4b..0000000 --- a/Fifteen/app/Components/FifteenControl.latte +++ /dev/null @@ -1,21 +0,0 @@ -{** - * The Fifteen game control template - * - * @param int $width - * @param array $order - * @param Control $control - *} - -{snippet} - - -
= 0; $y--"> - = 0; $x--"> - - {$order[$x + $y * $width]+1} - - -
- - -{/snippet} diff --git a/Fifteen/app/Components/FifteenControl.php b/Fifteen/app/Components/FifteenControl.php deleted file mode 100644 index 527cc55..0000000 --- a/Fifteen/app/Components/FifteenControl.php +++ /dev/null @@ -1,152 +0,0 @@ -order = range(0, $this->width * $this->width - 1); - } - - - public function handleClick(int $x, int $y): void - { - if (!$this->isClickable($x, $y)) { - throw new UI\BadSignalException('Action not allowed.'); - } - - $this->move($x, $y); - $this->round++; - $this->onAfterClick($this); - - if ($this->order == range(0, $this->width * $this->width - 1)) { - $this->onGameOver($this, $this->round); - } - } - - - public function handleShuffle(): void - { - $i = 100; - while ($i) { - $x = rand(0, $this->width - 1); - $y = rand(0, $this->width - 1); - if ($this->isClickable($x, $y)) { - $this->move($x, $y); - $i--; - } - } - $this->round = 0; - } - - - public function getRound(): int - { - return $this->round; - } - - - public function isClickable(int $x, int $y, string &$rel = null): bool - { - $rel = null; - $pos = $x + $y * $this->width; - $empty = $this->searchEmpty(); - $y = (int) ($empty / $this->width); - $x = $empty % $this->width; - if ($x> 0 && $pos === $empty - 1) { - $rel = '-1,'; - return true; - } - if ($x < $this->width - 1 && $pos === $empty + 1) { - $rel = '+1,'; - return true; - } - if ($y> 0 && $pos === $empty - $this->width) { - $rel = ',-1'; - return true; - } - if ($y < $this->width - 1 && $pos === $empty + $this->width) { - $rel = ',+1'; - return true; - } - return false; - } - - - private function move(int $x, int $y): void - { - $pos = $x + $y * $this->width; - $emptyPos = $this->searchEmpty(); - $this->order[$emptyPos] = $this->order[$pos]; - $this->order[$pos] = 0; - } - - - private function searchEmpty(): int - { - return array_search(0, $this->order, true); - } - - - public function render(): void - { - $template = $this->template; - $template->width = $this->width; - $template->order = $this->order; - $template->render(__DIR__ . '/FifteenControl.latte'); - } - - - /** - * Loads params. - */ - public function loadState(array $params): void - { - if (isset($params['order'])) { - $params['order'] = array_map('intval', explode('.', (string) $params['order'])); - - // validate - $copy = $params['order']; - sort($copy); - if ($copy != range(0, $this->width * $this->width - 1)) { - unset($params['order']); - } - } - - parent::loadState($params); - } - - - /** - * Save params. - */ - public function saveState(array &$params): void - { - parent::saveState($params); - if (isset($params['order'])) { - $params['order'] = implode('.', $params['order']); - } - } -} diff --git a/Fifteen/app/Presenters/DefaultPresenter.php b/Fifteen/app/Presenters/DefaultPresenter.php deleted file mode 100644 index 6e9da3f..0000000 --- a/Fifteen/app/Presenters/DefaultPresenter.php +++ /dev/null @@ -1,31 +0,0 @@ -redrawControl('round'); - } - - - /** - * Fifteen game control factory. - */ - protected function createComponentFifteen(): FifteenControl - { - $fifteen = new FifteenControl; - $fifteen->onGameOver[] = [$this, 'gameOver']; - $fifteen->redrawControl(); - return $fifteen; - } - - - public function gameOver($sender, int $round): void - { - $this->template->flash = 'Congratulations!'; - $this->redrawControl('flash'); - } -} diff --git a/Fifteen/app/Presenters/templates/Default.default.latte b/Fifteen/app/Presenters/templates/Default.default.latte deleted file mode 100644 index 9ac228c..0000000 --- a/Fifteen/app/Presenters/templates/Default.default.latte +++ /dev/null @@ -1,22 +0,0 @@ - - - - - Fifteen - Nette Framework example - - - - -

Fifteen example – round #{$presenter[fifteen]->round + 1}

- - {snippet flash}

{$flash}

{/snippet} - -

Shuffle!

- - {control fifteen} - - - - - - diff --git a/Fifteen/composer.json b/Fifteen/composer.json deleted file mode 100644 index 0d538bf..0000000 --- a/Fifteen/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "nette-examples/fifteen", - "type": "project", - "description": "A simple example showing components as the reusable stand-alone units.", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "require": { - "php": ">=7.1", - "nette/application": "^3.0", - "nette/bootstrap": "^3.0", - "nette/robot-loader": "^3.0", - "latte/latte": "^2.5", - "tracy/tracy": "^2.6" - }, - "autoload": { - "psr-4": { - "App\\": "app" - } - }, - "minimum-stability": "dev" -} diff --git a/Fifteen/log/.gitignore b/Fifteen/log/.gitignore deleted file mode 100644 index 816b594..0000000 --- a/Fifteen/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.* \ No newline at end of file diff --git a/Fifteen/readme.md b/Fifteen/readme.md deleted file mode 100644 index aaccafc..0000000 --- a/Fifteen/readme.md +++ /dev/null @@ -1,31 +0,0 @@ -Game Fifteen (Nette Framework example) --------------------------------------- - -A simple example showing components as the reusable stand-alone units existing -inside the presenter. We can put two components alongside and each of them -will be working stand-alone. The communication between components and -presenter is arranged by events (event-driven model). - - -What is [Nette Framework](https://nette.org)? --------------------------------------------- - -Nette Framework 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. - -Nette Framework speaks your language and helps you to easily build better websites. - - -Installing ----------- - -The best way to install Nette Framework is to download latest package -from https://nette.org/download or using [Composer](https://doc.nette.org/composer): - - curl -s http://getcomposer.org/installer | php - php composer.phar update - -Then navigate your browser to the `www` directory. PHP 5.4 allows -you run `php -S localhost:8888 -t www` to start the webserver and -then visit `http://localhost:8888` in your browser. diff --git a/Fifteen/temp/.gitignore b/Fifteen/temp/.gitignore deleted file mode 100644 index 4a7528a..0000000 --- a/Fifteen/temp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.* -!*/.* \ No newline at end of file diff --git a/Fifteen/www/.htaccess b/Fifteen/www/.htaccess deleted file mode 100644 index d2aab23..0000000 --- a/Fifteen/www/.htaccess +++ /dev/null @@ -1,4 +0,0 @@ -Require all granted - -# disable directory listing -Options -Indexes diff --git a/Fifteen/www/css/style.css b/Fifteen/www/css/style.css deleted file mode 100644 index 4fc565f..0000000 --- a/Fifteen/www/css/style.css +++ /dev/null @@ -1,49 +0,0 @@ -html { - font: 16px/1.5 sans-serif; - border-top: 4.7em solid #F4EBDB; -} - -body { - max-width: 990px; - margin: -4.7em auto 0; - background: white; - color: #333; -} - -h1 { - font-size: 1.9em; - margin: .5em 0 1.5em; - background: url(https://files.nette.org/icons/logo-e1.png) right center no-repeat; - color: #7A7772; - text-shadow: 1px 1px 0 white; -} - -img { - border: none; -} - -.fifteen img { - display: block; - border-right: 1px solid white; - border-bottom: 1px solid white; - position: relative; -} - -.fifteen { - border-collapse: collapse; -} - -.fifteen td { - padding: 0; - background: url('../images/game0.jpg') 0 0 no-repeat; - position: relative; - =position: inherit; -} - -#ajax-spinner { - margin: 15px 0 0 15px; - padding: 13px; - background: white url('../images/spinner.gif') no-repeat 50% 50%; - font-size: 0; - z-index: 123456; -} diff --git a/Fifteen/www/images/game0.jpg b/Fifteen/www/images/game0.jpg deleted file mode 100644 index 513089b..0000000 Binary files a/Fifteen/www/images/game0.jpg and /dev/null differ diff --git a/Fifteen/www/images/game1.jpg b/Fifteen/www/images/game1.jpg deleted file mode 100644 index 4a068dc..0000000 Binary files a/Fifteen/www/images/game1.jpg and /dev/null differ diff --git a/Fifteen/www/images/game10.jpg b/Fifteen/www/images/game10.jpg deleted file mode 100644 index 00d7c06..0000000 Binary files a/Fifteen/www/images/game10.jpg and /dev/null differ diff --git a/Fifteen/www/images/game11.jpg b/Fifteen/www/images/game11.jpg deleted file mode 100644 index 70065c2..0000000 Binary files a/Fifteen/www/images/game11.jpg and /dev/null differ diff --git a/Fifteen/www/images/game12.jpg b/Fifteen/www/images/game12.jpg deleted file mode 100644 index fcf7c8b..0000000 Binary files a/Fifteen/www/images/game12.jpg and /dev/null differ diff --git a/Fifteen/www/images/game13.jpg b/Fifteen/www/images/game13.jpg deleted file mode 100644 index 0cf0a62..0000000 Binary files a/Fifteen/www/images/game13.jpg and /dev/null differ diff --git a/Fifteen/www/images/game14.jpg b/Fifteen/www/images/game14.jpg deleted file mode 100644 index e180e10..0000000 Binary files a/Fifteen/www/images/game14.jpg and /dev/null differ diff --git a/Fifteen/www/images/game15.jpg b/Fifteen/www/images/game15.jpg deleted file mode 100644 index 2d02789..0000000 Binary files a/Fifteen/www/images/game15.jpg and /dev/null differ diff --git a/Fifteen/www/images/game2.jpg b/Fifteen/www/images/game2.jpg deleted file mode 100644 index 8cb5893..0000000 Binary files a/Fifteen/www/images/game2.jpg and /dev/null differ diff --git a/Fifteen/www/images/game3.jpg b/Fifteen/www/images/game3.jpg deleted file mode 100644 index 4f21cf5..0000000 Binary files a/Fifteen/www/images/game3.jpg and /dev/null differ diff --git a/Fifteen/www/images/game4.jpg b/Fifteen/www/images/game4.jpg deleted file mode 100644 index 2c47cbb..0000000 Binary files a/Fifteen/www/images/game4.jpg and /dev/null differ diff --git a/Fifteen/www/images/game5.jpg b/Fifteen/www/images/game5.jpg deleted file mode 100644 index 787dd0c..0000000 Binary files a/Fifteen/www/images/game5.jpg and /dev/null differ diff --git a/Fifteen/www/images/game6.jpg b/Fifteen/www/images/game6.jpg deleted file mode 100644 index 964aae1..0000000 Binary files a/Fifteen/www/images/game6.jpg and /dev/null differ diff --git a/Fifteen/www/images/game7.jpg b/Fifteen/www/images/game7.jpg deleted file mode 100644 index a02c512..0000000 Binary files a/Fifteen/www/images/game7.jpg and /dev/null differ diff --git a/Fifteen/www/images/game8.jpg b/Fifteen/www/images/game8.jpg deleted file mode 100644 index f26102b..0000000 Binary files a/Fifteen/www/images/game8.jpg and /dev/null differ diff --git a/Fifteen/www/images/game9.jpg b/Fifteen/www/images/game9.jpg deleted file mode 100644 index 031e693..0000000 Binary files a/Fifteen/www/images/game9.jpg and /dev/null differ diff --git a/Fifteen/www/images/spinner.gif b/Fifteen/www/images/spinner.gif deleted file mode 100644 index 185a077..0000000 Binary files a/Fifteen/www/images/spinner.gif and /dev/null differ diff --git a/Fifteen/www/index.php b/Fifteen/www/index.php deleted file mode 100644 index 564deb0..0000000 --- a/Fifteen/www/index.php +++ /dev/null @@ -1,12 +0,0 @@ -createContainer() - ->getByType(Nette\Application\Application::class) - ->run(); diff --git a/Fifteen/www/js/fifteen.js b/Fifteen/www/js/fifteen.js deleted file mode 100644 index a6db665..0000000 --- a/Fifteen/www/js/fifteen.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * The Fifteen game control template - */ - -jQuery(function($) { - - var active = false; - - $('body').on('click', '.fifteen a.ajax', function(event) { - event.preventDefault(); - event.stopImmediatePropagation(); - if (active || $.active) { - return; - } - - active = true; - var payload; - var delta = $(this).attr('rel').split(','); - var img = $('img', this); - img.css('z-index', 1000); - img.animate({ - left: delta[0] * img.attr('width'), - top: delta[1] * img.attr('height') - }); - img.queue(function() { - active = false; - if (payload) { - $.nette.success(payload); - } - }); - - $.post($.nette.href = this.href, function(data) { - payload = data; - if (!active) { - $.nette.success(payload); - } - }); - - $.nette.spinner.css({ - position: 'absolute', - left: event.pageX, - top: event.pageY - }); - }); - -}); diff --git a/Fifteen/www/js/jquery.nette.js b/Fifteen/www/js/jquery.nette.js deleted file mode 100644 index 0962b52..0000000 --- a/Fifteen/www/js/jquery.nette.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * AJAX Nette Framwork plugin for jQuery - * - * @copyright Copyright (c) 2009, 2010 Jan Marek - * @copyright Copyright (c) 2009, 2010 David Grudl - * @license MIT - * @link https://addons.nette.org/honza-marek/jquery-ajax - */ - -/* -if (typeof jQuery != 'function') { - alert('jQuery was not loaded'); -} -*/ - -(function($) { - - $.nette = { - success: function(payload) { - if (payload.redirect) { - window.location.href = payload.redirect; - return; - } - - if (payload.snippets) { - for (var i in payload.snippets) { - $.nette.updateSnippet(i, payload.snippets[i]); - } - } - - // change URL (requires HTML5) - if (window.history && history.pushState && $.nette.href) { - history.pushState({href: $.nette.href}, '', $.nette.href); - } - }, - - updateSnippet: function(id, html) { - $('#' + id).html(html); - }, - - // create animated spinner - createSpinner: function(id) { - return this.spinner = $('').attr('id', id ? id : 'ajax-spinner').ajaxStart(function() { - $(this).show(); - - }).ajaxStop(function() { - $(this).hide().css({ - position: 'fixed', - left: '50%', - top: '50%' - }); - - }).appendTo('body').hide(); - }, - - // current page state - href: null, - - // spinner element - spinner: null - }; - - -})(jQuery); - - - -jQuery(function($) { - // HTML 5 popstate event - $(window).bind('popstate', function(event) { - $.nette.href = null; - $.post(event.originalEvent.state.href, $.nette.success); - }); - - $.ajaxSetup({ - success: $.nette.success, - dataType: 'json' - }); - - $.nette.createSpinner(); - - // apply AJAX unobtrusive way - $('body').on('click', 'a.ajax', function(event) { - event.preventDefault(); - if ($.active) return; - - $.post($.nette.href = this.href, $.nette.success); - - $.nette.spinner.css({ - position: 'absolute', - left: event.pageX, - top: event.pageY - }); - }); - -}); diff --git a/Fifteen/www/web.config b/Fifteen/www/web.config deleted file mode 100644 index 11a7c4a..0000000 --- a/Fifteen/www/web.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Micro-blog/composer.json b/Micro-blog/composer.json deleted file mode 100644 index 95769a4..0000000 --- a/Micro-blog/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "nette-examples/micro-blog", - "type": "project", - "description": "A simple example showing how to use Nette Framework as a micro-framework.", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "require": { - "php": ">=7.1", - "nette/application": "^3.0", - "nette/bootstrap": "^3.0", - "nette/database": "^3.0", - "nette/robot-loader": "^3.0", - "latte/latte": "^2.5", - "tracy/tracy": "^2.6" - }, - "minimum-stability": "dev", - "config": { - "vendor-dir": "www/data/vendor" - } -} diff --git a/Micro-blog/readme.md b/Micro-blog/readme.md deleted file mode 100644 index b787a14..0000000 --- a/Micro-blog/readme.md +++ /dev/null @@ -1,28 +0,0 @@ -Micro-blog (Nette Framework example) ------------------------------------- - -A simple example showing how to use [Nette Framework](https://nette.org) as a micro-framework. - - -What is [Nette Framework](https://nette.org)? --------------------------------------------- - -Nette Framework 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. - -Nette Framework speaks your language and helps you to easily build better websites. - - -Installing ----------- - -The best way to install Nette Framework is to download latest package -from https://nette.org/download or using [Composer](https://doc.nette.org/composer): - - curl -s http://getcomposer.org/installer | php - php composer.phar update - -Then navigate your browser to the `www` directory. PHP 5.4 allows -you run `php -S localhost:8888 -t www` to start the webserver and -then visit `http://localhost:8888` in your browser. diff --git a/Micro-blog/www/.htaccess b/Micro-blog/www/.htaccess deleted file mode 100644 index b35c4ec..0000000 --- a/Micro-blog/www/.htaccess +++ /dev/null @@ -1,32 +0,0 @@ -# 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|mjs|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/Micro-blog/www/data/.htaccess b/Micro-blog/www/data/.htaccess deleted file mode 100644 index b66e808..0000000 --- a/Micro-blog/www/data/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Require all denied diff --git a/Micro-blog/www/data/TemplateRouter.php b/Micro-blog/www/data/TemplateRouter.php deleted file mode 100644 index 221b0b1..0000000 --- a/Micro-blog/www/data/TemplateRouter.php +++ /dev/null @@ -1,49 +0,0 @@ -scanRoutes($path); - file_put_contents($cacheFile, ' $file) { - $this[] = new Routers\Route($mask, function (NetteModule\MicroPresenter $presenter) use ($file, $cachePath) { - return $presenter->createTemplate(null, function () use ($cachePath): Latte\Engine { - $latte = new Latte\Engine; - $latte->setTempDirectory($cachePath . '/cache'); - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); - $macroSet->addMacro('url', function () {}, null, null, $macroSet::ALLOWED_IN_HEAD); // ignore - return $latte; - })->setFile($file); - }); - } - } - - - public function scanRoutes(string $path): array - { - $routes = []; - $latte = new Latte\Engine; - $macroSet = new Latte\Macros\MacroSet($latte->getCompiler()); - $macroSet->addMacro('url', function ($node) use (&$routes, &$file) { - $routes[$node->args] = (string) $file; - }, null, null, $macroSet::ALLOWED_IN_HEAD); - foreach (Nette\Utils\Finder::findFiles('*.latte')->from($path) as $file) { - $latte->compile((string) $file); - } - return $routes; - } -} diff --git a/Micro-blog/www/data/blog.db3 b/Micro-blog/www/data/blog.db3 deleted file mode 100644 index 3eab39a..0000000 Binary files a/Micro-blog/www/data/blog.db3 and /dev/null differ diff --git a/Micro-blog/www/data/config.neon b/Micro-blog/www/data/config.neon deleted file mode 100644 index b9fa69b..0000000 --- a/Micro-blog/www/data/config.neon +++ /dev/null @@ -1,13 +0,0 @@ -# -# SECURITY WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser! -# https://nette.org/security-warning -# -php: - date.timezone: Europe/Prague - -application: - scanDirs: no - -database: - dsn: 'sqlite:%appDir%/data/blog.db3' - conventions: static diff --git a/Micro-blog/www/data/log/.gitignore b/Micro-blog/www/data/log/.gitignore deleted file mode 100644 index 816b594..0000000 --- a/Micro-blog/www/data/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.* \ No newline at end of file diff --git a/Micro-blog/www/data/temp/.gitignore b/Micro-blog/www/data/temp/.gitignore deleted file mode 100644 index 816b594..0000000 --- a/Micro-blog/www/data/temp/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.* \ No newline at end of file diff --git a/Micro-blog/www/data/templates/@layout.latte b/Micro-blog/www/data/templates/@layout.latte deleted file mode 100644 index 230d85f..0000000 --- a/Micro-blog/www/data/templates/@layout.latte +++ /dev/null @@ -1,16 +0,0 @@ - - - - - {block title|stripHtml|trim}Homepage{/block} | Nette Framework Micro-blog example - - - - -

My Blog

- - {include content} - -

This is a Nette Framework example.

- - diff --git a/Micro-blog/www/data/templates/article.latte b/Micro-blog/www/data/templates/article.latte deleted file mode 100644 index 298e577..0000000 --- a/Micro-blog/www/data/templates/article.latte +++ /dev/null @@ -1,24 +0,0 @@ -{url article/} -{layout "@layout.latte"} - -{var $article = $context->getByType('Nette\Database\Context')->table('article')->get($id) OR $presenter->error(404)} - -{block content} -

← back

- -
-
{$article->created|date:'F j, Y'}
- -

{$article->title}

- - {$article->content|noescape} -
- -

Comments

- -
-{foreach $article->related('comment')->order('created') as $comment} -

{$comment->name} said...

- {$comment->content|noescape} -{/foreach} -
diff --git a/Micro-blog/www/data/templates/index.latte b/Micro-blog/www/data/templates/index.latte deleted file mode 100644 index 40b9c46..0000000 --- a/Micro-blog/www/data/templates/index.latte +++ /dev/null @@ -1,20 +0,0 @@ -{url [index.php]} -{url [page-]} -{layout "@layout.latte"} - -{block content} -{default $page = 1} - -{foreach $context->getByType('Nette\Database\Context')->table('article')->order('created')->page($page, 5) as $article} -
-
{$article->created|date:'F j, Y'}
- -

{$article->title}

- - {$article->content|noescape} -
-{/foreach} - -

← back - -next →

diff --git a/Micro-blog/www/index.php b/Micro-blog/www/index.php deleted file mode 100644 index 4c21106..0000000 --- a/Micro-blog/www/index.php +++ /dev/null @@ -1,30 +0,0 @@ -enableTracy(__DIR__ . '/data/log'); - -// Create Dependency Injection container -$configurator->setTempDirectory(__DIR__ . '/data/temp'); -$configurator->addConfig(__DIR__ . '/data/config.neon'); -$container = $configurator->createContainer(); - -// Enable template router -$container->addService('router', new TemplateRouter('data/templates', __DIR__ . '/data/temp')); - -// Run the application! -$container->getByType(Nette\Application\Application::class) - ->run(); diff --git a/Micro-blog/www/style.css b/Micro-blog/www/style.css deleted file mode 100644 index 5791371..0000000 --- a/Micro-blog/www/style.css +++ /dev/null @@ -1,49 +0,0 @@ - -body { - font: 16px/1.5 Georgia, Verdana, Arial; - margin: 0 auto; - width: 600px; - color: #333; - background-color: #fff; -} - -h1, h2 { - color: #3484D2; - font-size: 1.9em; - text-align: center; - font-weight: normal; -} - -h1 a { - color: #3484D2; -} - -h2 { - font-size: 1.4em; -} - -.date { - color: #999; - text-align: center; - font-variant: small-caps; - font-size: .8em; - letter-spacing: 3px; - margin: 0 0 -1em; -} - -.article { - background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPEAAAAUCAMAAABrnCsKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQ5QTFRFr66tsK+usLCusbCvtLOytbSzubi2ubm3urm3urq4vLu6vb27v769wL+9wL++w8LAxMPBxcTCxcXDxsbEx8bEx8fFyMfFyMjGysnIzMvLzMzLzMzMzc3Lzs7Mz87Mz8/N0M/N0tHQ09PS1NPR1NTS1NTT1dTS1dXT1tXU1tbU19bU19bV19fV2NfV2NfW2djW2dnW2dnX2dnY2tnX2trX29rY29vY29vZ3NzZ3dza3t3b3t7c39/d4N/d4ODd4ODf4eDe4eHh4uLg4+Lg4+Lh4+Pg4+Ph5OPh5OTi5eXj5eXk5ubj5+bm6Ofl6enm6unn6+ro8vHx9fT09fX19vX19/f3+Pj3+vr6/f39////uLBi1QAAAM5JREFUWMNjiBxpgGHUx6M+HvXxqI/JAGKRIi6RgiPHx5qRIgpmGoKikSFhI8THwkIy/v5O3iq8PCMjjsO9IgUCnK1t3Fy5R0qqFuA38LS0MDd3V+NkjxgoH0vTFKDbKOhvY2FuYmBlI4sqLk0XQP84VuTR8rMyMzbQtXBSYA0fGSWXkbmdob6uvpO8o33wiPCxD4eyr62psYM6B/MIKbmUIvX49N08dNhCJaVGSpuLJYiLU06VQWLEtLkCwyMZI5m0I8VHexKjPh71MZUAAOANSHaOv55SAAAAAElFTkSuQmCC) no-repeat center bottom; - padding-bottom:2em; - margin-bottom:2em; -} - -.comments { - font-size: .9em; -} - -.footer { - border-top: 1px solid #CCC; - margin: 2em 0; - padding-top: 1em; - text-align: center; -} diff --git a/Modules-Usage/.htaccess b/Modules-Usage/.htaccess deleted file mode 100644 index b66e808..0000000 --- a/Modules-Usage/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Require all denied diff --git a/Modules-Usage/app/Bootstrap.php b/Modules-Usage/app/Bootstrap.php deleted file mode 100644 index aa757d3..0000000 --- a/Modules-Usage/app/Bootstrap.php +++ /dev/null @@ -1,31 +0,0 @@ -setDebugMode('secret@23.75.345.200'); // enable for your remote IP - $configurator->enableTracy(__DIR__ . '/../log'); - - // Enable RobotLoader - this will load all classes automatically - $configurator->setTempDirectory(__DIR__ . '/../temp'); - $configurator->createRobotLoader() - ->addDirectory(__DIR__) - ->register(); - - // Create Dependency Injection container from config.neon file - $configurator->addConfig(__DIR__ . '/config/common.neon'); - - return $configurator; - } -} diff --git a/Modules-Usage/app/Modules/Admin/DefaultPresenter.php b/Modules-Usage/app/Modules/Admin/DefaultPresenter.php deleted file mode 100644 index e70fc6f..0000000 --- a/Modules-Usage/app/Modules/Admin/DefaultPresenter.php +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Modules demo - - - - -

Modules demo

- -
- {$moduleName}{$presenterName}:{$viewName} -
- -
- This is layout template {$this->getParentName() |replace:$root} - -
- This is content block template {$this->getName() |replace:$root} - {include content} -
- - -

Absolute links

- -
- - diff --git a/Modules-Usage/app/Modules/Admin/templates/Default.default.latte b/Modules-Usage/app/Modules/Admin/templates/Default.default.latte deleted file mode 100644 index caa39f8..0000000 --- a/Modules-Usage/app/Modules/Admin/templates/Default.default.latte +++ /dev/null @@ -1,2 +0,0 @@ -{block content} -…empty file… diff --git a/Modules-Usage/app/Modules/Base/BasePresenter.php b/Modules-Usage/app/Modules/Base/BasePresenter.php deleted file mode 100644 index f98a69f..0000000 --- a/Modules-Usage/app/Modules/Base/BasePresenter.php +++ /dev/null @@ -1,26 +0,0 @@ -template->viewName = $this->getView(); - $this->template->root = isset($_SERVER['SCRIPT_FILENAME']) ? realpath(dirname(dirname($_SERVER['SCRIPT_FILENAME']))) : null; - - $a = strrpos($this->getName(), ':'); - if ($a === false) { - $this->template->moduleName = ''; - $this->template->presenterName = $this->getName(); - } else { - $this->template->moduleName = substr($this->getName(), 0, $a + 1); - $this->template->presenterName = substr($this->getName(), $a + 1); - } - } -} diff --git a/Modules-Usage/app/Modules/Front.Export/DefaultPresenter.php b/Modules-Usage/app/Modules/Front.Export/DefaultPresenter.php deleted file mode 100644 index 20012f1..0000000 --- a/Modules-Usage/app/Modules/Front.Export/DefaultPresenter.php +++ /dev/null @@ -1,9 +0,0 @@ - -<item> - <title>Product</title> - ... - ... -</item> - diff --git a/Modules-Usage/app/Modules/Front/CatalogListPresenter.php b/Modules-Usage/app/Modules/Front/CatalogListPresenter.php deleted file mode 100644 index c2d387e..0000000 --- a/Modules-Usage/app/Modules/Front/CatalogListPresenter.php +++ /dev/null @@ -1,9 +0,0 @@ - - - - - Modules demo - - - - -

Modules demo

- -
- {$moduleName}{$presenterName}:{$viewName} -
- -
- This is layout template {$this->getParentName() |replace:$root} - -
- This is content block template {$this->getName() |replace:$root} - {include content} -
- - -

Absolute links

- -
- - diff --git a/Modules-Usage/app/Modules/Front/templates/CatalogList/default.latte b/Modules-Usage/app/Modules/Front/templates/CatalogList/default.latte deleted file mode 100644 index caa39f8..0000000 --- a/Modules-Usage/app/Modules/Front/templates/CatalogList/default.latte +++ /dev/null @@ -1,2 +0,0 @@ -{block content} -…empty file… diff --git a/Modules-Usage/app/Modules/Front/templates/Default/addItem.latte b/Modules-Usage/app/Modules/Front/templates/Default/addItem.latte deleted file mode 100644 index aca5b03..0000000 --- a/Modules-Usage/app/Modules/Front/templates/Default/addItem.latte +++ /dev/null @@ -1,5 +0,0 @@ -{block content} -
    -
  • default - link to view default in current presenter
  • -
  • CatalogList: - link to presenter CatalogList in current module (view default)
  • -
diff --git a/Modules-Usage/app/Modules/Front/templates/Default/default.latte b/Modules-Usage/app/Modules/Front/templates/Default/default.latte deleted file mode 100644 index 907a0fb..0000000 --- a/Modules-Usage/app/Modules/Front/templates/Default/default.latte +++ /dev/null @@ -1,7 +0,0 @@ -{block content} -
    -
  • addItem - link to view addItem in current presenter
  • -
  • CatalogList: - link to presenter CatalogList in current module and view default
  • -
  • Export:Default:xml - link to presenter Default in Export submodule and view xml
  • -
  • :Admin:Default: - link to presenter Default in Admin module (view default)
  • -
diff --git a/Modules-Usage/app/Router/RouterFactory.php b/Modules-Usage/app/Router/RouterFactory.php deleted file mode 100644 index 31a5c67..0000000 --- a/Modules-Usage/app/Router/RouterFactory.php +++ /dev/null @@ -1,35 +0,0 @@ -addRoute('index.php', 'Front:Default:default', Route::ONE_WAY); - - $router->withModule('Admin') - ->addRoute('admin//', 'Default:default'); - - $router->withModule('Front') - ->addRoute('/[/]', 'Default:default'); - return $router; - } - - return new SimpleRouter('Front:Default:default'); - } -} diff --git a/Modules-Usage/app/config/common.neon b/Modules-Usage/app/config/common.neon deleted file mode 100644 index adb4990..0000000 --- a/Modules-Usage/app/config/common.neon +++ /dev/null @@ -1,13 +0,0 @@ -# -# SECURITY WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser! -# https://nette.org/security-warning -# -php: - date.timezone: Europe/Prague - -application: - mapping: - *: DemoApp\Module\*\Presenters\*Presenter - -services: - router: App\Router\RouterFactory::createRouter diff --git a/Modules-Usage/composer.json b/Modules-Usage/composer.json deleted file mode 100644 index 9f9621d..0000000 --- a/Modules-Usage/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "nette-examples/modules-usage", - "type": "project", - "description": "The example demonstrates the usage of modules and submodules.", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "require": { - "php": ">=7.1", - "nette/application": "^3.0", - "nette/bootstrap": "^3.0", - "nette/robot-loader": "^3.0", - "latte/latte": "^2.5", - "tracy/tracy": "^2.6" - }, - "autoload": { - "psr-4": { - "App\\": "app" - } - }, - "minimum-stability": "dev" -} diff --git a/Modules-Usage/log/.gitignore b/Modules-Usage/log/.gitignore deleted file mode 100644 index 816b594..0000000 --- a/Modules-Usage/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.* \ No newline at end of file diff --git a/Modules-Usage/readme.md b/Modules-Usage/readme.md deleted file mode 100644 index 1cd4230..0000000 --- a/Modules-Usage/readme.md +++ /dev/null @@ -1,30 +0,0 @@ -Modules (Nette Framework example) ---------------------------------- - -The example demonstrates the usage of modules and submodules in [Nette Framework](https://nette.org). -Presenters (and then templates) are separated on two main modules Front and Admin. -Furthermore, the Front module contains the Export submodule. - - -What is [Nette Framework](https://nette.org)? --------------------------------------------- - -Nette Framework 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. - -Nette Framework speaks your language and helps you to easily build better websites. - - -Installing ----------- - -The best way to install Nette Framework is to download latest package -from https://nette.org/download or using [Composer](https://doc.nette.org/composer): - - curl -s http://getcomposer.org/installer | php - php composer.phar update - -Then navigate your browser to the `www` directory. PHP 5.4 allows -you run `php -S localhost:8888 -t www` to start the webserver and -then visit `http://localhost:8888` in your browser. diff --git a/Modules-Usage/temp/.gitignore b/Modules-Usage/temp/.gitignore deleted file mode 100644 index 4a7528a..0000000 --- a/Modules-Usage/temp/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.* -!*/.* \ No newline at end of file diff --git a/Modules-Usage/www/.htaccess b/Modules-Usage/www/.htaccess deleted file mode 100644 index b35c4ec..0000000 --- a/Modules-Usage/www/.htaccess +++ /dev/null @@ -1,32 +0,0 @@ -# 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|mjs|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/Modules-Usage/www/css/site.css b/Modules-Usage/www/css/site.css deleted file mode 100644 index a167c1e..0000000 --- a/Modules-Usage/www/css/site.css +++ /dev/null @@ -1,59 +0,0 @@ -html { - font: 16px/1.5 "Trebuchet MS", "Geneva CE", lucida, sans-serif; - border-top: 4.7em solid #F4EBDB; -} - -body { - max-width: 990px; - margin: -4.7em auto 0; - background: white; - color: #333; -} - -h1 { - font: 1.9em/1.5 sans-serif; - margin: .5em 0 1.5em; - background: url(https://files.nette.org/icons/logo-e1.png) right center no-repeat; - color: #7A7772; - text-shadow: 1px 1px 0 white; -} - -h2 { - font-size: 120%; - color: #3484D2; -} - -#content { - width: 770px; - margin: 0 5px; - border: 1px dotted gray; -} - - -#path { - margin: 50px 0; -} - -#module { - background: #fee7bc; - padding: 30px 10px; - =padding: 10px; - font-weight: bold; -} - -#presenter { - background: #afcbe3; - padding: 20px 10px 20px 0; - =padding: 10px 10px 10px 0; -} - -#view { - background: #c4e8c4; - padding: 10px 10px 10px 0; - font-weight: normal; -} - -fieldset { - margin: 1em; - padding: 1em; -} diff --git a/Modules-Usage/www/index.php b/Modules-Usage/www/index.php deleted file mode 100644 index 564deb0..0000000 --- a/Modules-Usage/www/index.php +++ /dev/null @@ -1,12 +0,0 @@ -createContainer() - ->getByType(Nette\Application\Application::class) - ->run(); diff --git a/Modules-Usage/www/web.config b/Modules-Usage/www/web.config deleted file mode 100644 index 11a7c4a..0000000 --- a/Modules-Usage/www/web.config +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Webpack/.docs/phpserver.png b/Webpack/.docs/phpserver.png deleted file mode 100644 index f726c04..0000000 Binary files a/Webpack/.docs/phpserver.png and /dev/null differ diff --git a/Webpack/.docs/web.png b/Webpack/.docs/web.png deleted file mode 100644 index 7f63c39..0000000 Binary files a/Webpack/.docs/web.png and /dev/null differ diff --git a/Webpack/.docs/webpack.png b/Webpack/.docs/webpack.png deleted file mode 100644 index 855b8d6..0000000 Binary files a/Webpack/.docs/webpack.png and /dev/null differ diff --git a/Webpack/.gitignore b/Webpack/.gitignore deleted file mode 100644 index 0ff78b9..0000000 --- a/Webpack/.gitignore +++ /dev/null @@ -1,19 +0,0 @@ -# Nette -log/* -temp/* - -# Git -!.gitignore - -# Apache -!.htaccess - -# App -/app/config/config.local.neon -/www/dist - -# Composer -/vendor - -# Node -/node_modules diff --git a/Webpack/LICENSE b/Webpack/LICENSE deleted file mode 100644 index b3c19b3..0000000 --- a/Webpack/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Train+it - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Webpack/README.md b/Webpack/README.md deleted file mode 100644 index cad7bfa..0000000 --- a/Webpack/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# Nette Framework 3 + Webpack 4 - -This is just for education. - -There is a simple example of Nette Framework with jQuery 3, bootstrap 4 and [Naja](https://github.com/jiripudil/Naja). -Naja is modern ES6-like library for Nette snippets ajaxification. - -These assets are compiled and bundled together with Webpack. - -## Requirements - -- Nette 3.0+ -- PHP 7.3+ - -## Development - -- `git clone https://github.com/nette/examples.git` -- `cd Webpack/` -- `cp app/config/config.local.neon.dist app/config/config.local.neon` -- `composer install` -- `npm install` -- `npm run dev` -- `php -S 0.0.0.0:8000 -t www` - -## Deployment - -- `npm run build` - -## Features - -- :+1: Nette 3.0 -- :+1: Webpack configuration - - :tada: extracting JS to single bundle - - :tada: extracting CSS to single file - - :tada: more bundles (front/admin/vendor) -- :+1: Snippets - - :tada: few snippets -- :+1: Nette Form - - :tada: AJAX submitting - - :tada: form builder - - empty value on control (`@` in email) - - validation rules (filled + email) - - simple filter (transform email to lowercase) - - onValidate / onSubmit / onSuccess - - :tada: manual rendering - - success snippet / error snippet - - required class on form-group - - description on control - -## Roadmap - -- :question: pure sendPayload method -- :question: dynamic snippets ( + snippetArea ) -- :question: Vue.js component - -## Result - -### Webpack - -![Webpack](https://raw.githubusercontent.com/nette/examples/master/Webpack/.docs/webpack.png) - -### PHP Development Server - -![PHP](https://raw.githubusercontent.com/nette/examples/master/Webpack/.docs/phpserver.png) - -### Browser - -![Web](https://raw.githubusercontent.com/nette/examples/master/Webpack/.docs/web.png) diff --git a/Webpack/app/.htaccess b/Webpack/app/.htaccess deleted file mode 100644 index 0a9a047..0000000 --- a/Webpack/app/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -Order Allow,Deny -Deny from all diff --git a/Webpack/app/Bootstrap.php b/Webpack/app/Bootstrap.php deleted file mode 100644 index 15c4d06..0000000 --- a/Webpack/app/Bootstrap.php +++ /dev/null @@ -1,30 +0,0 @@ -setDebugMode('secret@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/common.neon'); - - return $configurator; - } -} diff --git a/Webpack/app/assets/admin.js b/Webpack/app/assets/admin.js deleted file mode 100644 index 1866a4a..0000000 --- a/Webpack/app/assets/admin.js +++ /dev/null @@ -1,11 +0,0 @@ -// Required dependencies -import 'jquery'; -import 'bootstrap'; - -// Assets -// These assets are extracted to [id].bundle.css using MiniCssExtractPlugin, see more on webpack.config.js -import 'bootstrap/dist/css/bootstrap.css'; -import './theme/style.css'; - -// UI tweaks -import './ui/naja'; diff --git a/Webpack/app/assets/front.js b/Webpack/app/assets/front.js deleted file mode 100644 index ef87a2c..0000000 --- a/Webpack/app/assets/front.js +++ /dev/null @@ -1,2 +0,0 @@ -import './shared'; -import './modules/front'; diff --git a/Webpack/app/assets/imgs/spinner.gif b/Webpack/app/assets/imgs/spinner.gif deleted file mode 100644 index 185a077..0000000 Binary files a/Webpack/app/assets/imgs/spinner.gif and /dev/null differ diff --git a/Webpack/app/assets/modules/admin/index.js b/Webpack/app/assets/modules/admin/index.js deleted file mode 100644 index 18a0692..0000000 --- a/Webpack/app/assets/modules/admin/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// UI for admin -console.log('Admin'); diff --git a/Webpack/app/assets/modules/front/index.js b/Webpack/app/assets/modules/front/index.js deleted file mode 100644 index d30be82..0000000 --- a/Webpack/app/assets/modules/front/index.js +++ /dev/null @@ -1,2 +0,0 @@ -// UI for front -console.log('Front'); diff --git a/Webpack/app/assets/shared.js b/Webpack/app/assets/shared.js deleted file mode 100644 index 1866a4a..0000000 --- a/Webpack/app/assets/shared.js +++ /dev/null @@ -1,11 +0,0 @@ -// Required dependencies -import 'jquery'; -import 'bootstrap'; - -// Assets -// These assets are extracted to [id].bundle.css using MiniCssExtractPlugin, see more on webpack.config.js -import 'bootstrap/dist/css/bootstrap.css'; -import './theme/style.css'; - -// UI tweaks -import './ui/naja'; diff --git a/Webpack/app/assets/theme/style.css b/Webpack/app/assets/theme/style.css deleted file mode 100644 index 4ccfd99..0000000 --- a/Webpack/app/assets/theme/style.css +++ /dev/null @@ -1,58 +0,0 @@ -body { - font-size: 15px; - line-height: 1.6; - color: #333; - background: white; -} - -h1 { - color: #3484D2; -} - -#ajax-spinner { - margin: 15px 0 0 15px; - padding: 13px; - background: white url('../imgs/spinner.gif') no-repeat 50% 50%; - font-size: 0; - z-index: 123456; - display: none; -} - -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; -} - -.jumbotron { - padding: 1rem; -} - -.tracy-box> .tracy-dump { - padding: 10px; -} diff --git a/Webpack/app/assets/ui/naja.js b/Webpack/app/assets/ui/naja.js deleted file mode 100644 index 0906024..0000000 --- a/Webpack/app/assets/ui/naja.js +++ /dev/null @@ -1,4 +0,0 @@ -import naja from "naja"; - -// We must attach Naja to window load event. -document.addEventListener('DOMContentLoaded', naja.initialize.bind(naja)); diff --git a/Webpack/app/config/common.neon b/Webpack/app/config/common.neon deleted file mode 100644 index d2e498a..0000000 --- a/Webpack/app/config/common.neon +++ /dev/null @@ -1,17 +0,0 @@ -# -# WARNING: it is CRITICAL that this file & directory are NOT accessible directly via a web browser! -# https://nette.org/security-warning -# -parameters: - - -application: - errorPresenter: Error - mapping: - *: App\*Module\Presenters\*Presenter - -session: - expiration: 14 days - -services: - router: App\RouterFactory::createRouter diff --git a/Webpack/app/presenters/AdminPresenter.php b/Webpack/app/presenters/AdminPresenter.php deleted file mode 100644 index 3162b84..0000000 --- a/Webpack/app/presenters/AdminPresenter.php +++ /dev/null @@ -1,9 +0,0 @@ -getRequest()->isMethod(Nette\Application\Request::FORWARD)) { - $this->error(); - } - } - - - public function renderDefault(Nette\Application\BadRequestException $exception) - { - // load template 403.latte or 404.latte or ... 4xx.latte - $file = __DIR__ . "/templates/Error/{$exception->getCode()}.latte"; - $file = is_file($file) ? $file : __DIR__ . '/templates/Error/4xx.latte'; - $this->template->setFile($file); - } -} diff --git a/Webpack/app/presenters/ErrorPresenter.php b/Webpack/app/presenters/ErrorPresenter.php deleted file mode 100644 index c7d92ad..0000000 --- a/Webpack/app/presenters/ErrorPresenter.php +++ /dev/null @@ -1,45 +0,0 @@ -logger = $logger; - } - - - public function run(Nette\Application\Request $request): Nette\Application\IResponse - { - $e = $request->getParameter('exception'); - - if ($e instanceof Nette\Application\BadRequestException) { - // $this->logger->log("HTTP code {$e->getCode()}: {$e->getMessage()} in {$e->getFile()}:{$e->getLine()}", 'access'); - [$module, , $sep] = Nette\Application\Helpers::splitName($request->getPresenterName()); - $errorPresenter = $module . $sep . 'Error4xx'; - return new Responses\ForwardResponse($request->setPresenterName($errorPresenter)); - } - - $this->logger->log($e, ILogger::EXCEPTION); - return new Responses\CallbackResponse(function (Http\IRequest $httpRequest, Http\IResponse $httpResponse) { - if (preg_match('#^text/html(?:;|$)#', $httpResponse->getHeader('Content-Type'))) { - require __DIR__ . '/templates/Error/500.phtml'; - } - }); - } -} diff --git a/Webpack/app/presenters/HomepagePresenter.php b/Webpack/app/presenters/HomepagePresenter.php deleted file mode 100644 index af32e24..0000000 --- a/Webpack/app/presenters/HomepagePresenter.php +++ /dev/null @@ -1,77 +0,0 @@ -template->datetime = new DateTime(); - } - - - public function handleReload(string $box): void - { - $this->redrawControl($box); - } - - - public function handleReloadAll(): void - { - $this->redrawControl('box1'); - $this->redrawControl('box2'); - $this->redrawControl('box3'); - } - - - protected function createComponentUserForm(): Form - { - $form = new Form(); - - $form->addText('username', 'Username') - ->setRequired('Username is mandatory') - ->setAttribute('placeholder', 'Type your name Mr.?'); - - $form->addText('email', 'Email') - ->setHtmlAttribute('placeholder', 'Type your e-mail') - ->setOption('description', Html::el('span')->setHtml('Try to type cool@nette.org to see validation.')) - ->setEmptyValue('@') - ->addFilter(function ($email) { - return Strings::lower($email); - }) - ->addRule($form::REQUIRED, 'E-mail is mandatory') - ->addRule($form::EMAIL, 'Given e-mail is not e-mail'); - - $form->addInteger('age', 'Your age?') - ->setHtmlAttribute('Are you young?') - ->setNullable(); - - $form->addSubmit('send', 'OK'); - - $form->onValidate[] = function (Form $form) { - // Validate e-mail duplicities (against DB?) - if (Strings::endsWith($form->values->email, '@nette.org')) { - $form->addError(sprintf('E-mail "%s" is already picked', $form->values->email)); - } - }; - - $form->onSubmit[] = function () { - // This method in invoked always - $this->redrawControl('userFormError'); - $this->redrawControl('userFormOk'); - }; - - $form->onSuccess[] = function () { - // Some handling on success... - }; - - return $form; - } -} diff --git a/Webpack/app/presenters/templates/@layout.latte b/Webpack/app/presenters/templates/@layout.latte deleted file mode 100644 index 78db9c2..0000000 --- a/Webpack/app/presenters/templates/@layout.latte +++ /dev/null @@ -1,31 +0,0 @@ -{** - * @param string $basePath web base path - * @param array $flashes flash messages - *} - - - - - - {ifset title}{include title|stripHtml} | {/ifset}Nette + Webpack 4 - - - {block #head} - {* This CSS bundle is generated via Webpack. See webpack.config.js *} - - {/block} - - - -
-
{$flash->message}
- - {include #content} -
- -{block #scripts} - {* This JS bundle is generated via Webpack. See webpack.config.js *} - -{/block} - - diff --git a/Webpack/app/presenters/templates/Admin/@layout.latte b/Webpack/app/presenters/templates/Admin/@layout.latte deleted file mode 100644 index 5b50e91..0000000 --- a/Webpack/app/presenters/templates/Admin/@layout.latte +++ /dev/null @@ -1,9 +0,0 @@ -{layout ../@layout.latte} - -{block #head} - -{/block} - -{block #scripts} - -{/block} diff --git a/Webpack/app/presenters/templates/Admin/default.latte b/Webpack/app/presenters/templates/Admin/default.latte deleted file mode 100644 index c384f2c..0000000 --- a/Webpack/app/presenters/templates/Admin/default.latte +++ /dev/null @@ -1,2 +0,0 @@ -{block #content} -

This is admin

diff --git a/Webpack/app/presenters/templates/Error/403.latte b/Webpack/app/presenters/templates/Error/403.latte deleted file mode 100644 index de00328..0000000 --- a/Webpack/app/presenters/templates/Error/403.latte +++ /dev/null @@ -1,7 +0,0 @@ -{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/Webpack/app/presenters/templates/Error/404.latte b/Webpack/app/presenters/templates/Error/404.latte deleted file mode 100644 index 022001c..0000000 --- a/Webpack/app/presenters/templates/Error/404.latte +++ /dev/null @@ -1,8 +0,0 @@ -{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/Webpack/app/presenters/templates/Error/405.latte b/Webpack/app/presenters/templates/Error/405.latte deleted file mode 100644 index d424892..0000000 --- a/Webpack/app/presenters/templates/Error/405.latte +++ /dev/null @@ -1,6 +0,0 @@ -{block content} -

Method Not Allowed

- -

The requested method is not allowed for the URL.

- -

error 405

diff --git a/Webpack/app/presenters/templates/Error/410.latte b/Webpack/app/presenters/templates/Error/410.latte deleted file mode 100644 index 99bde92..0000000 --- a/Webpack/app/presenters/templates/Error/410.latte +++ /dev/null @@ -1,6 +0,0 @@ -{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/Webpack/app/presenters/templates/Error/4xx.latte b/Webpack/app/presenters/templates/Error/4xx.latte deleted file mode 100644 index d5ce82f..0000000 --- a/Webpack/app/presenters/templates/Error/4xx.latte +++ /dev/null @@ -1,4 +0,0 @@ -{block content} -

Oops...

- -

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

diff --git a/Webpack/app/presenters/templates/Error/500.phtml b/Webpack/app/presenters/templates/Error/500.phtml deleted file mode 100644 index 619611e..0000000 --- a/Webpack/app/presenters/templates/Error/500.phtml +++ /dev/null @@ -1,20 +0,0 @@ - - - -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/Webpack/app/presenters/templates/Error/503.phtml b/Webpack/app/presenters/templates/Error/503.phtml deleted file mode 100644 index 1c2c427..0000000 --- a/Webpack/app/presenters/templates/Error/503.phtml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - -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/Webpack/app/presenters/templates/Homepage/default.latte b/Webpack/app/presenters/templates/Homepage/default.latte deleted file mode 100644 index 64b7e0f..0000000 --- a/Webpack/app/presenters/templates/Homepage/default.latte +++ /dev/null @@ -1,62 +0,0 @@ -{block #content} -

Nette + Webpack 4

-

Take a look at webpack.config.js.

- -
-

Snippets RELOAD ALL

-
-
-
-

Box 1 RELOAD

- Time is: {$datetime|date:'d.m.Y H:i:s'} -
-
-

Box 2 RELOAD

- Time is: {$datetime|date:'H:i:s'} -
-
-

Box 3 RELOAD

- Time is: {$datetime|date:'U'} -
-
-
- -
-

Form

-
-
- - {snippet #userFormOk} - {php $form = $presenter['userForm']} - {if $form->isSuccess()} -
Form OK!
-
{=Tracy\Debugger::dump($form->values, true)|noescape}
- {/if} - {/snippet} - - {snippet #userFormError} - {php $form = $presenter['userForm']} -
{$error}
- {/snippet} - -
required ? required, $form['username']->error ? has-error"> - {label username /} - - - {$form['username']->getOption('description')} -
-
required ? required, $form['email']->error ? has-error"> - {label email /} - - - {$form['email']->getOption('description')} -
-
required ? required, $form['age']->error ? has-error"> - {label age /} - {input age, class => 'form-control'} - - {$form['age']->getOption('description')} -
- -
-
diff --git a/Webpack/app/router/RouterFactory.php b/Webpack/app/router/RouterFactory.php deleted file mode 100644 index a6f7382..0000000 --- a/Webpack/app/router/RouterFactory.php +++ /dev/null @@ -1,24 +0,0 @@ -/', 'Homepage:default'); - - return $router; - } -} diff --git a/Webpack/composer.json b/Webpack/composer.json deleted file mode 100644 index 33f8490..0000000 --- a/Webpack/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "nette/examples", - "description": "Nette Framework 3 + Webpack 4", - "type": "project", - "license": "MIT", - "require": { - "php": "^7.3", - "nette/application": "^3.0", - "nette/bootstrap": "^3.0", - "nette/di": "^3.0", - "nette/forms": "^3.0", - "nette/http": "^3.0", - "nette/robot-loader": "^3.0", - "nette/utils": "^3.0", - "latte/latte": "^2.7", - "tracy/tracy": "^2.7" - }, - "autoload": { - "psr-4": { - "App\\": "app" - } - }, - "minimum-stability": "dev" -} diff --git a/Webpack/log/.htaccess b/Webpack/log/.htaccess deleted file mode 100644 index 22b9ed2..0000000 --- a/Webpack/log/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -Order Allow,Deny -Deny from all \ No newline at end of file diff --git a/Webpack/package.json b/Webpack/package.json deleted file mode 100644 index 4f6cdf6..0000000 --- a/Webpack/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "nette-examples", - "version": "1.0.0", - "description": "Nette Framework 3 + Webpack 4", - "keywords": [ - "nette", - "framework", - "webpack" - ], - "author": "Milan Felix Šulc", - "license": "MIT", - "bugs": { - "url": "https://github.com/nette/examples/issues" - }, - "homepage": "https://github.com/nette/examples#readme", - "dependencies": { - "@sentry/browser": "^5.0.5", - "axios": "^0.19.0", - "bootstrap": "^4.3.1", - "jquery": "^3.4.1", - "naja": "^1.6.0", - "nette-forms": "^3.0.2", - "popper.js": "^1.15.0", - "vue": "^2.6.9" - }, - "devDependencies": { - "@babel/core": "^7.4.3", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.3.4", - "@babel/preset-env": "^7.4.3", - "autoprefixer": "^9.5.0", - "awesome-typescript-loader": "^5.2.1", - "babel-loader": "^8.0.5", - "cache-loader": "^4.1.0", - "compression-webpack-plugin": "^3.0.0", - "cross-env": "^5.2.0", - "css-loader": "^3.2.0", - "eslint": "^6.3.0", - "file-loader": "^4.2.0", - "friendly-errors-webpack-plugin": "^1.7.0", - "mini-css-extract-plugin": "^0.8.0", - "node-sass": "^4.11.0", - "optimize-css-assets-webpack-plugin": "^5.0.1", - "postcss-loader": "^3.0.0", - "raw-loader": "^3.1.0", - "sass-loader": "^8.0.0", - "style-loader": "^1.0.0", - "terser-webpack-plugin": "^1.2.3", - "thread-loader": "^2.1.2", - "url-loader": "^2.1.0", - "vue-loader": "^15.7.0", - "vue-template-compiler": "^2.6.9", - "webpack": "^4.29.6", - "webpack-bundle-analyzer": "^3.1.0", - "webpack-cli": "^3.2.3", - "webpack-dev-server": "^3.2.1", - "webpack-merge": "^4.2.1", - "webpack-stats-plugin": "^0.3.0" - }, - "browserslist": [ - "last 2 versions", - "not dead" - ], - "main": "assets/src/main.js", - "scripts": { - "start": "cross-env NODE_ENV=development webpack --mode development --progress --colors", - "watch": "cross-env NODE_ENV=development webpack --mode development --watch --progress --colors", - "dev": "cross-env NODE_ENV=development webpack-dev-server --mode development --hot --progress --colors", - "build": "cross-env NODE_ENV=production webpack --mode production --progress --colors" - } -} diff --git a/Webpack/temp/.htaccess b/Webpack/temp/.htaccess deleted file mode 100644 index 22b9ed2..0000000 --- a/Webpack/temp/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -Order Allow,Deny -Deny from all \ No newline at end of file diff --git a/Webpack/webpack.config.js b/Webpack/webpack.config.js deleted file mode 100644 index f509173..0000000 --- a/Webpack/webpack.config.js +++ /dev/null @@ -1,368 +0,0 @@ -// Node -const path = require("path"); - -// Webpack -const webpack = require("webpack"); -const merge = require("webpack-merge"); - -// Webpack plugins -const TerserPlugin = require("terser-webpack-plugin"); -const MiniCssExtractPlugin = require("mini-css-extract-plugin"); -const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin"); -const {VueLoaderPlugin} = require("vue-loader"); -const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin; -const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin'); - -// Vue -const VUE_VERSION = require("vue/package.json").version; -const VUE_LOADER_VERSION = require("vue-loader/package.json").version; - -// Other -const devMode = process.env.NODE_ENV !== "production"; - -// Webpack abilities -const WEBPACK_DEV_SERVER_HOST = process.env.WEBPACK_DEV_SERVER_HOST || "localhost"; -const WEBPACK_DEV_SERVER_PORT = parseInt(process.env.WEBPACK_DEV_SERVER_PORT, 10) || 8080; -const WEBPACK_DEV_SERVER_PROXY_HOST = process.env.WEBPACK_DEV_SERVER_PROXY_HOST || "localhost"; -const WEBPACK_DEV_SERVER_PROXY_PORT = parseInt(process.env.WEBPACK_DEV_SERVER_PROXY_PORT, 10) || 8000; -const WEBPACK_REPORT = process.env.WEBPACK_REPORT || false; - -// Config -const ROOT_PATH = __dirname; -const CACHE_PATH = ROOT_PATH + "/temp/webpack"; - -module.exports = { - mode: devMode ? "development" : "production", - context: path.join(ROOT_PATH, "app/assets"), - entry: { - front: path.join(ROOT_PATH, "app/assets/front.js"), - admin: path.join(ROOT_PATH, "app/assets/admin.js"), - }, - output: { - path: path.join(ROOT_PATH, "www/dist"), - publicPath: "/dist/", - filename: '[name].bundle.js', - }, - devtool: 'cheap-module-eval-source-map', - node: { - setImmediate: false, - process: 'mock', - dgram: 'empty', - fs: 'empty', - net: 'empty', - tls: 'empty', - child_process: 'empty' - }, - module: { - noParse: /^(vue|vue-router|vuex|vuex-router-sync)$/, - rules: [ - { - test: /\.vue$/, - use: [ - ...!devMode ? [] : [ - { - loader: 'cache-loader', - options: { - cacheDirectory: path.join(CACHE_PATH, "vue-loader"), - cacheIdentifier: [ - process.env.NODE_ENV || 'development', - webpack.version, - VUE_VERSION, - VUE_LOADER_VERSION, - ].join('|'), - } - } - ], - ...[{ - loader: 'vue-loader', - options: { - compilerOptions: { - preserveWhitespace: false - }, - cacheDirectory: path.join(CACHE_PATH, "vue-loader"), - cacheIdentifier: [ - process.env.NODE_ENV || 'development', - webpack.version, - VUE_VERSION, - VUE_LOADER_VERSION, - ].join('|'), - } - }], - ] - }, - { - test: /\.js$/, - exclude: file => ( - /node_modules/.test(file) && - !/\.vue\.js/.test(file) - ), - use: [ - ...!devMode ? [] : [ - { - loader: 'cache-loader', - options: { - cacheDirectory: path.join(CACHE_PATH, "babel-loader"), - } - }, - { - loader: 'thread-loader', - options: { - workers: require('os').cpus().length - 1, - }, - }, - ], - ...[{ - loader: 'babel-loader', - }], - ] - }, - { - test: /\.tsx?$/, - exclude: /node_modules/, - use: [ - ...!devMode ? [] : [ - { - loader: 'cache-loader', - options: { - cacheDirectory: path.join(CACHE_PATH, "ts-loader"), - } - }, - ], - ...[{ - loader: 'awesome-typescript-loader', - }], - ] - }, - { - test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/i, - use: [ - { - loader: 'url-loader', - options: { - limit: 4096, - fallback: { - loader: 'file-loader', - options: { - name: 'fonts/[name].[hash:8].[ext]' - } - } - } - } - ] - }, - { - test: /\.(svg)(\?.*)?$/, - use: [ - { - loader: 'file-loader', - options: { - name: 'imgs/[name].[hash:8].[ext]' - } - } - ] - }, - { - test: /\.(png|jpe?g|gif|webp|ico)(\?.*)?$/, - use: [ - { - loader: 'url-loader', - options: { - limit: 4096, - fallback: { - loader: 'file-loader', - options: { - name: 'imgs/[name].[hash:8].[ext]' - } - } - } - } - ] - }, - { - test: /\.less$/, - use: [ - MiniCssExtractPlugin.loader, - { - loader: 'css-loader', - options: { - sourceMap: false, - importLoaders: 2, - modules: false - } - }, - { - loader: "postcss-loader", - options: { - ident: "postcss", - plugins: [require("autoprefixer")] - } - }, - "less-loader" - ], - }, - { - test: /\.(css|scss|sass)$/, - use: [ - MiniCssExtractPlugin.loader, - { - loader: 'css-loader', - options: { - sourceMap: false, - importLoaders: 2, - modules: false - } - }, - { - loader: "postcss-loader", - options: { - ident: "postcss", - plugins: [require("autoprefixer")] - } - }, - "sass-loader" - ], - }, - ] - }, - resolve: { - alias: { - "vue$": "vue/dist/vue.esm.js", - "@": path.resolve(__dirname, "app/assets"), - }, - extensions: [".js", ".vue", ".ts", ".tsx"], - modules: [ - 'node_modules', - ], - }, - plugins: [ - // enable vue-loader to use existing loader rules for other module types - new VueLoaderPlugin(), - - // fix legacy jQuery plugins which depend on globals - new webpack.ProvidePlugin({ - $: "jquery", - jQuery: "jquery", - "window.jQuery": "jquery", - "window.$": "jquery", - Popper: ["popper.js", "default"], - }), - - // prevent pikaday from including moment.js - new webpack.IgnorePlugin(/moment/, /pikaday/), - - // ignore locales from moment.js - new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), - - // extract css - new MiniCssExtractPlugin({ - filename: !devMode ? "[name].[chunkhash:8].bundle.css" : "[name].bundle.css", - }), - - // human webpack errors - new FriendlyErrorsWebpackPlugin(), - ], -}; - -if (WEBPACK_REPORT) { - module.exports.plugins.push( - new BundleAnalyzerPlugin({ - analyzerMode: "static", - generateStatsFile: true, - openAnalyzer: false, - reportFilename: path.join(CACHE_PATH, "webpack-report/index.html"), - statsFilename: path.join(CACHE_PATH, "webpack-report/stats.json"), - }) - ); -} - -if (process.env.NODE_ENV === "development") { - const development = { - output: { - globalObject: 'this' - }, - devServer: { - host: WEBPACK_DEV_SERVER_HOST, - port: WEBPACK_DEV_SERVER_PORT, - disableHostCheck: true, - contentBase: path.join(ROOT_PATH, "www"), - headers: { - "Access-Control-Allow-Origin": "*", - "Access-Control-Allow-Headers": "*", - }, - stats: "errors-only", - hot: true, - inline: true, - proxy: { - "/": `http://${WEBPACK_DEV_SERVER_PROXY_HOST}:${WEBPACK_DEV_SERVER_PROXY_PORT}` - } - }, - }; - - module.exports = merge(module.exports, development); -} - -if (process.env.NODE_ENV === "production") { - const production = { - output: { - filename: '[name].[contenthash:8].bundle.js', - chunkFilename: '[name].[contenthash:8].chunk.js' - }, - devtool: "none", - optimization: { - minimizer: [ - new TerserPlugin({ - test: /\.m?js(\?.*)?$/i, - chunkFilter: () => true, - warningsFilter: () => true, - extractComments: false, - sourceMap: true, - cache: true, - cacheKeys: defaultCacheKeys => defaultCacheKeys, - parallel: true, - include: undefined, - exclude: undefined, - minify: undefined, - terserOptions: { - output: { - comments: /^\**!|@preserve|@license|@cc_on/i - }, - compress: { - arrows: false, - collapse_vars: false, - comparisons: false, - computed_props: false, - hoist_funs: false, - hoist_props: false, - hoist_vars: false, - inline: false, - loops: false, - negate_iife: false, - properties: false, - reduce_funcs: false, - reduce_vars: false, - switches: false, - toplevel: false, - typeofs: false, - booleans: true, - if_return: true, - sequences: true, - unused: true, - conditionals: true, - dead_code: true, - evaluate: true - }, - mangle: { - safari10: true - } - } - }) - ], - }, - plugins: [ - // optimize CSS files - new OptimizeCSSAssetsPlugin(), - ], - }; - - module.exports = merge(module.exports, production); -} diff --git a/Webpack/www/.htaccess b/Webpack/www/.htaccess deleted file mode 100644 index b35c4ec..0000000 --- a/Webpack/www/.htaccess +++ /dev/null @@ -1,32 +0,0 @@ -# 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|mjs|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/Webpack/www/favicon.ico b/Webpack/www/favicon.ico deleted file mode 100644 index b20cfd0..0000000 Binary files a/Webpack/www/favicon.ico and /dev/null differ diff --git a/Webpack/www/index.php b/Webpack/www/index.php deleted file mode 100644 index 564deb0..0000000 --- a/Webpack/www/index.php +++ /dev/null @@ -1,12 +0,0 @@ -createContainer() - ->getByType(Nette\Application\Application::class) - ->run(); diff --git a/license.md b/license.md deleted file mode 100644 index 3fdd7c2..0000000 --- a/license.md +++ /dev/null @@ -1,62 +0,0 @@ -Licenses -======== - -Good news! You may use Nette Framework under the terms of either -the New BSD License or the GNU General Public License (GPL) version 2 or 3. - -The BSD License is recommended for most projects. It is easy to understand and it -places almost no restrictions on what you can do with the framework. If the GPL -fits better to your project, you can use the framework under this license. - -You don't have to notify anyone which license you are using. You can freely -use Nette Framework in commercial projects as long as the copyright header -remains intact. - -Please be advised that the name "Nette Framework" is a protected trademark and its -usage has some limitations. So please do not use word "Nette" in the name of your -project or top-level domain, and choose a name that stands on its own merits. -If your stuff is good, it will not take long to establish a reputation for yourselves. - - - -New BSD License ---------------- - -Copyright (c) 2004, 2013 David Grudl (https://davidgrudl.com) -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * Neither the name of "Nette Framework" nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -This software is provided by the copyright holders and contributors "as is" and -any express or implied warranties, including, but not limited to, the implied -warranties of merchantability and fitness for a particular purpose are -disclaimed. In no event shall the copyright owner or contributors be liable for -any direct, indirect, incidental, special, exemplary, or consequential damages -(including, but not limited to, procurement of substitute goods or services; -loss of use, data, or profits; or business interruption) however caused and on -any theory of liability, whether in contract, strict liability, or tort -(including negligence or otherwise) arising in any way out of the use of this -software, even if advised of the possibility of such damage. - - - -GNU General Public License --------------------------- - -GPL licenses are very very long, so instead of including them here we offer -you URLs with full text: - -- [GPL version 2](http://www.gnu.org/licenses/gpl-2.0.html) -- [GPL version 3](http://www.gnu.org/licenses/gpl-3.0.html) diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..facd29b --- /dev/null +++ b/readme.md @@ -0,0 +1,2 @@ +Moved to https://github.com/nette-examples +==========================================