Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
!var/SymfonyRequirements.php
/vendor/
/web/bundles/
.idea/
913 changes: 913 additions & 0 deletions .idea/workspace.xml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function registerBundles()
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
];
Expand Down
28 changes: 28 additions & 0 deletions app/DoctrineMigrations/Version20181118125711.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20181118125711 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) DEFAULT NULL, full_name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255) DEFAULT \'ROLE_USER\', salt VARCHAR(255) DEFAULT NULL, registration_date DATETIME DEFAULT NULL, listings SMALLINT DEFAULT NULL, reviews SMALLINT DEFAULT NULL, seo_rank SMALLINT DEFAULT NULL, messages SMALLINT DEFAULT NULL, social_posts SMALLINT DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('DROP TABLE user');
}
}
28 changes: 28 additions & 0 deletions app/DoctrineMigrations/Version20181118183926.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20181118183926 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user ADD hash VARCHAR(255) DEFAULT NULL');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user DROP hash');
}
}
28 changes: 28 additions & 0 deletions app/DoctrineMigrations/Version20181128123421.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20181128123421 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user DROP listings, DROP reviews, DROP seo_rank, DROP messages, DROP social_posts, DROP hash');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('ALTER TABLE user ADD listings SMALLINT DEFAULT NULL, ADD reviews SMALLINT DEFAULT NULL, ADD seo_rank SMALLINT DEFAULT NULL, ADD messages SMALLINT DEFAULT NULL, ADD social_posts SMALLINT DEFAULT NULL, ADD hash VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci');
}
}
30 changes: 30 additions & 0 deletions app/DoctrineMigrations/Version20181222181607.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20181222181607 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) DEFAULT NULL, full_name VARCHAR(255) DEFAULT NULL, email VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, role VARCHAR(255) DEFAULT \'ROLE_USER\', salt VARCHAR(255) DEFAULT NULL, registration_date DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB');
$this->addSql('DROP TABLE visitor');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('CREATE TABLE visitor (id INT AUTO_INCREMENT NOT NULL, host VARCHAR(255) DEFAULT NULL COLLATE utf8_unicode_ci, pageviews INT DEFAULT NULL, comments INT NOT NULL, visit_date DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
$this->addSql('DROP TABLE user');
}
}
28 changes: 28 additions & 0 deletions app/DoctrineMigrations/Version20181222182045.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php declare(strict_types=1);

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20181222182045 extends AbstractMigration
{
public function up(Schema $schema) : void
{
// this up() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('CREATE TABLE visitor (id INT AUTO_INCREMENT NOT NULL, host VARCHAR(255) DEFAULT NULL, pageviews INT DEFAULT NULL, comments INT NOT NULL, visit_date DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8 COLLATE UTF8_unicode_ci ENGINE = InnoDB');
}

public function down(Schema $schema) : void
{
// this down() migration is auto-generated, please modify it to your needs
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');

$this->addSql('DROP TABLE visitor');
}
}
3 changes: 3 additions & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ framework:
twig:
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
form_themes:
- 'bootstrap_4_layout.html.twig'

# Doctrine Configuration
doctrine:
Expand All @@ -58,6 +60,7 @@ doctrine:
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true


# Swiftmailer Configuration
swiftmailer:
transport: '%mailer_transport%'
Expand Down
1 change: 1 addition & 0 deletions app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
app:
resource: '@AppBundle/Controller/'
type: annotation

34 changes: 26 additions & 8 deletions app/config/security.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html
security:

encoders:
AppBundle\Entity\User:
algorithm: bcrypt
# https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
providers:
in_memory:
memory: ~
db_provider:
entity:
class: AppBundle:User
# property: username

firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
Expand All @@ -14,11 +18,25 @@ security:
security: false

main:
logout_on_user_change: true
anonymous: ~
# activate different ways to authenticate
form_login:
login_path: login
check_path: login
username_parameter: log_in_form[username]
password_parameter: log_in_form[password]

logout:
path: /logout
target: /

access_control:
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY}
- { path: ^/registration, roles: IS_AUTHENTICATED_ANONYMOUSLY}
- { path: ^/, roles: IS_AUTHENTICATED_FULLY }

# https://symfony.com/doc/current/security.html#a-configuring-how-your-users-will-authenticate
#http_basic: ~

# https://symfony.com/doc/current/security/form_login_setup.html
#form_login: ~
role_hierarchy:
ROLE_USER: ROLE_USER
ROLE_MODERATOR: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_MODERATOR, ROLE_ALLOWED_TO_SWITCH]
5 changes: 5 additions & 0 deletions app/config/twig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
twig:
paths: ['%kernel.project_dir%/templates']
debug: '%kernel.debug%'
strict_variable: '%kernel.debug%'
form_themes: 'bootstrap_4_horizontal_layout.html.twig'
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-migrations-bundle": "^1.3",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
Expand All @@ -33,6 +34,7 @@
"twig/twig": "^1.0||^2.0"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^3.0"
},
Expand Down
Loading