commit
a086eeb286
|
@ -12,7 +12,6 @@ class AppKernel extends Kernel
|
||||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||||
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
new Symfony\Bundle\TwigBundle\TwigBundle(),
|
||||||
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
||||||
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
|
|
||||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||||
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
|
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
|
||||||
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
|
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
|
||||||
|
@ -24,8 +23,8 @@ class AppKernel extends Kernel
|
||||||
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
|
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
|
||||||
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
|
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
|
||||||
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
|
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
|
||||||
|
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
|
||||||
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
|
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
|
||||||
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $bundles;
|
return $bundles;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Application\Migrations;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\Schema;
|
||||||
*/
|
*/
|
||||||
class Version20150302205121 extends AbstractMigration
|
class Version20150302205121 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class Version20150302205121 extends AbstractMigration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Application\Migrations;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\Schema;
|
||||||
*/
|
*/
|
||||||
class Version20150302213116 extends AbstractMigration
|
class Version20150302213116 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class Version20150302213116 extends AbstractMigration
|
||||||
$this->addSql('RENAME TABLE paste TO copypastes');
|
$this->addSql('RENAME TABLE paste TO copypastes');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Application\Migrations;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\Schema;
|
||||||
*/
|
*/
|
||||||
class Version20150302223210 extends AbstractMigration
|
class Version20150302223210 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class Version20150302223210 extends AbstractMigration
|
||||||
$this->addSql('CREATE INDEX IDX_DBA4BEBE82F1BAF4 ON copypastes (language_id)');
|
$this->addSql('CREATE INDEX IDX_DBA4BEBE82F1BAF4 ON copypastes (language_id)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Application\Migrations;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,12 +10,12 @@ use Doctrine\DBAL\Schema\Schema;
|
||||||
*/
|
*/
|
||||||
class Version20150303224825 extends AbstractMigration
|
class Version20150303224825 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->addSql('UPDATE copypastes SET secret=NULL WHERE secret=\'\'');
|
$this->addSql('UPDATE copypastes SET secret=NULL WHERE secret=\'\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->addSql('UPDATE copypastes SET secret=\'\' WHERE secret=NULL');
|
$this->addSql('UPDATE copypastes SET secret=\'\' WHERE secret=NULL');
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Application\Migrations;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,13 +10,13 @@ use Doctrine\DBAL\Schema\Schema;
|
||||||
*/
|
*/
|
||||||
class Version20150305184842 extends AbstractMigration
|
class Version20150305184842 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->addSql('UPDATE copypastes SET date_expire=NULL WHERE date_expire=\'0000-00-00 00:00:00\'');
|
$this->addSql('UPDATE copypastes SET date_expire=NULL WHERE date_expire=\'0000-00-00 00:00:00\'');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->addSql('UPDATE copypastes SET date_expire=\'0000-00-00 00:00:00\' WHERE date_expire=NULL');
|
$this->addSql('UPDATE copypastes SET date_expire=\'0000-00-00 00:00:00\' WHERE date_expire=NULL');
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Application\Migrations;
|
namespace Application\Migrations;
|
||||||
|
|
||||||
use Doctrine\DBAL\Migrations\AbstractMigration;
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -12,7 +12,7 @@ use Doctrine\DBAL\Schema\Schema;
|
||||||
*/
|
*/
|
||||||
class Version20150316014139 extends AbstractMigration
|
class Version20150316014139 extends AbstractMigration
|
||||||
{
|
{
|
||||||
public function up(Schema $schema)
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class Version20150316014139 extends AbstractMigration
|
||||||
$this->addSql('CREATE INDEX idx_preferred ON languages (is_preferred)');
|
$this->addSql('CREATE INDEX idx_preferred ON languages (is_preferred)');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(Schema $schema)
|
public function down(Schema $schema): void
|
||||||
{
|
{
|
||||||
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
|
6
app/Resources/views/Paste/new.html.twig
Normal file
6
app/Resources/views/Paste/new.html.twig
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{# This form recieves form_create object from current context #}
|
||||||
|
{% include 'Form/form_paste_create.html.twig' %}
|
||||||
|
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends '::base.html.twig' %}
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="paste container-fluid">
|
<div class="paste container-fluid">
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div role="tabpanel" class="tab-pane" id="tab-paste-edit">
|
<div role="tabpanel" class="tab-pane" id="tab-paste-edit">
|
||||||
{# This form recieves form_create object from current context #}
|
{# This form recieves form_create object from current context #}
|
||||||
{% include 'SkobkinCopyPasteBundle:Form:form_paste_create.html.twig' %}
|
{% include 'Form/form_paste_create.html.twig' %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,4 +1,4 @@
|
||||||
{% extends '::layout.html.twig' -%}
|
{% extends 'layout.html.twig' -%}
|
||||||
|
|
||||||
{%- block css -%}
|
{%- block css -%}
|
||||||
{{- parent() -}}
|
{{- parent() -}}
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="{{ path('copypaste_new') }}">{{ 'header_title' | trans }}</a>
|
<a class="navbar-brand" href="{{ path('paste_new') }}">{{ 'header_title' | trans }}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
{% block header_menu_left_items %}
|
{% block header_menu_left_items %}
|
||||||
<li{% if app.request.attributes.get('_route') == 'copypaste_new' %} class="active"{% endif %}>
|
<li{% if app.request.attributes.get('_route') == 'copypaste_new' %} class="active"{% endif %}>
|
||||||
<a href="{{ path('copypaste_new') }}"><span class="glyphicon glyphicon-plus-sign"></span> {{ 'header_menu_add' | trans }}</a>
|
<a href="{{ path('paste_new') }}"><span class="glyphicon glyphicon-plus-sign"></span> {{ 'header_menu_add' | trans }}</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{#{{ path('about') }}#}"><span class="glyphicon glyphicon-info-sign"></span> {{ 'header_menu_about' | trans }}</a>
|
<a href="{#{{ path('about') }}#}"><span class="glyphicon glyphicon-info-sign"></span> {{ 'header_menu_about' | trans }}</a>
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
{%- endblock -%}
|
{%- endblock -%}
|
||||||
|
|
||||||
{%- block sidebar -%}
|
{%- block sidebar -%}
|
||||||
{{ render(controller('SkobkinCopyPasteBundle:CopyPaste:sidebar')) }}
|
{{ render(controller('Skobkin\\Bundle\\CopyPasteBundle\\Controller\\PasteController::sidebarAction')) }}
|
||||||
{%- endblock -%}
|
{%- endblock -%}
|
||||||
|
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="panel-heading">{{ 'sidebar_title' | trans() }}</div>
|
<div class="panel-heading">{{ 'sidebar_title' | trans() }}</div>
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{% for paste in pastes %}
|
{% for paste in pastes %}
|
||||||
<a href="{{ path('copypaste_show_public', {'id': paste.id}) }}" class="list-group-item">
|
<a href="{{ path('paste_show_public', {'id': paste.id}) }}" class="list-group-item">
|
||||||
#{{ paste.id }} - {% if paste.author %}{{ paste.author }}{% else %}anonymous{% endif %}
|
#{{ paste.id }} - {% if paste.author %}{{ paste.author }}{% else %}anonymous{% endif %}
|
||||||
</a>
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -389,7 +389,7 @@ class SymfonyRequirements extends RequirementCollection
|
||||||
{
|
{
|
||||||
/* mandatory requirements follow */
|
/* mandatory requirements follow */
|
||||||
|
|
||||||
$installedPhpVersion = phpversion();
|
$installedPhpVersion = PHP_VERSION;
|
||||||
$requiredPhpVersion = $this->getPhpRequiredVersion();
|
$requiredPhpVersion = $this->getPhpRequiredVersion();
|
||||||
|
|
||||||
$this->addRecommendation(
|
$this->addRecommendation(
|
||||||
|
@ -448,15 +448,8 @@ class SymfonyRequirements extends RequirementCollection
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
|
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
|
||||||
$timezones = array();
|
|
||||||
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
|
|
||||||
foreach ($abbreviations as $abbreviation) {
|
|
||||||
$timezones[$abbreviation['timezone_id']] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->addRequirement(
|
$this->addRequirement(
|
||||||
isset($timezones[@date_default_timezone_get()]),
|
in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
|
||||||
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
|
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
|
||||||
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
|
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
|
||||||
);
|
);
|
||||||
|
@ -633,12 +626,6 @@ class SymfonyRequirements extends RequirementCollection
|
||||||
'Install and enable the <strong>mbstring</strong> extension.'
|
'Install and enable the <strong>mbstring</strong> extension.'
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addRecommendation(
|
|
||||||
function_exists('iconv'),
|
|
||||||
'iconv() should be available',
|
|
||||||
'Install and enable the <strong>iconv</strong> extension.'
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->addRecommendation(
|
$this->addRecommendation(
|
||||||
function_exists('utf8_decode'),
|
function_exists('utf8_decode'),
|
||||||
'utf8_decode() should be available',
|
'utf8_decode() should be available',
|
||||||
|
@ -737,7 +724,7 @@ class SymfonyRequirements extends RequirementCollection
|
||||||
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
|
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
|
||||||
$this->addRecommendation(
|
$this->addRecommendation(
|
||||||
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
|
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
|
||||||
'realpath_cache_size should be at least 5M in php.ini',
|
'realpath_cache_size should be at least 5M in php.ini',
|
||||||
|
@ -780,7 +767,11 @@ class SymfonyRequirements extends RequirementCollection
|
||||||
{
|
{
|
||||||
$size = ini_get('realpath_cache_size');
|
$size = ini_get('realpath_cache_size');
|
||||||
$size = trim($size);
|
$size = trim($size);
|
||||||
|
$unit = '';
|
||||||
|
if (!ctype_digit($size)) {
|
||||||
$unit = strtolower(substr($size, -1, 1));
|
$unit = strtolower(substr($size, -1, 1));
|
||||||
|
$size = (int) substr($size, 0, -1);
|
||||||
|
}
|
||||||
switch ($unit) {
|
switch ($unit) {
|
||||||
case 'g':
|
case 'g':
|
||||||
return $size * 1024 * 1024 * 1024;
|
return $size * 1024 * 1024 * 1024;
|
||||||
|
|
|
@ -13,17 +13,21 @@ framework:
|
||||||
form: ~
|
form: ~
|
||||||
csrf_protection: ~
|
csrf_protection: ~
|
||||||
validation: { enable_annotations: true }
|
validation: { enable_annotations: true }
|
||||||
templating:
|
#serializer: { enable_annotations: true }
|
||||||
engines: ['twig']
|
default_locale: '%locale%'
|
||||||
#assets_version: SomeVersionScheme
|
|
||||||
default_locale: "%locale%"
|
|
||||||
trusted_hosts: ~
|
trusted_hosts: ~
|
||||||
trusted_proxies: ~
|
|
||||||
session:
|
session:
|
||||||
# handler_id set to null will use default session handler from php.ini
|
# handler_id set to null will use default session handler from php.ini
|
||||||
handler_id: ~
|
handler_id: ~
|
||||||
fragments: ~
|
fragments: ~
|
||||||
http_method_override: true
|
http_method_override: true
|
||||||
|
assets: ~
|
||||||
|
php_errors:
|
||||||
|
log: true
|
||||||
|
|
||||||
|
sensio_framework_extra:
|
||||||
|
router:
|
||||||
|
annotations: false
|
||||||
|
|
||||||
# Twig Configuration
|
# Twig Configuration
|
||||||
twig:
|
twig:
|
||||||
|
@ -31,7 +35,7 @@ twig:
|
||||||
strict_variables: "%kernel.debug%"
|
strict_variables: "%kernel.debug%"
|
||||||
form_themes:
|
form_themes:
|
||||||
- 'bootstrap_3_layout.html.twig'
|
- 'bootstrap_3_layout.html.twig'
|
||||||
- 'SkobkinCopyPasteBundle:Form:fields.html.twig'
|
- 'Form/fields.html.twig'
|
||||||
|
|
||||||
# Doctrine Configuration
|
# Doctrine Configuration
|
||||||
doctrine:
|
doctrine:
|
||||||
|
@ -60,10 +64,3 @@ doctrine_migrations:
|
||||||
table_name: migration_versions
|
table_name: migration_versions
|
||||||
name: Application Migrations
|
name: Application Migrations
|
||||||
|
|
||||||
# Swiftmailer Configuration
|
|
||||||
swiftmailer:
|
|
||||||
transport: "%mailer_transport%"
|
|
||||||
host: "%mailer_host%"
|
|
||||||
username: "%mailer_user%"
|
|
||||||
password: "%mailer_password%"
|
|
||||||
spool: { type: memory }
|
|
||||||
|
|
|
@ -40,6 +40,3 @@ monolog:
|
||||||
#chromephp:
|
#chromephp:
|
||||||
# type: chromephp
|
# type: chromephp
|
||||||
# level: info
|
# level: info
|
||||||
|
|
||||||
#swiftmailer:
|
|
||||||
# delivery_address: me@example.com
|
|
||||||
|
|
|
@ -18,6 +18,3 @@ framework:
|
||||||
web_profiler:
|
web_profiler:
|
||||||
toolbar: false
|
toolbar: false
|
||||||
intercept_redirects: false
|
intercept_redirects: false
|
||||||
|
|
||||||
swiftmailer:
|
|
||||||
disable_delivery: true
|
|
||||||
|
|
|
@ -9,11 +9,6 @@ parameters:
|
||||||
# You should uncomment this if you want use pdo_sqlite
|
# You should uncomment this if you want use pdo_sqlite
|
||||||
# database_path: "%kernel.root_dir%/data.db3"
|
# database_path: "%kernel.root_dir%/data.db3"
|
||||||
|
|
||||||
mailer_transport: smtp
|
|
||||||
mailer_host: 127.0.0.1
|
|
||||||
mailer_user: ~
|
|
||||||
mailer_password: ~
|
|
||||||
|
|
||||||
locale: en
|
locale: en
|
||||||
|
|
||||||
# A secret key that's used to generate certain security-related tokens
|
# A secret key that's used to generate certain security-related tokens
|
||||||
|
|
|
@ -1,4 +1,21 @@
|
||||||
skobkin_copy_paste:
|
paste_show_public:
|
||||||
resource: "@SkobkinCopyPasteBundle/Resources/config/routing.yml"
|
path: /{id}
|
||||||
prefix: /
|
defaults: { _controller: 'Skobkin\Bundle\CopyPasteBundle\Controller\PasteController::showAction', secret: null }
|
||||||
|
requirements:
|
||||||
|
id: \d+
|
||||||
|
|
||||||
|
paste_show_private:
|
||||||
|
path: /{id}/{secret}
|
||||||
|
defaults: { _controller: 'Skobkin\Bundle\CopyPasteBundle\Controller\PasteController::showAction' }
|
||||||
|
requirements:
|
||||||
|
id: \d+
|
||||||
|
secret: \w{16}
|
||||||
|
|
||||||
|
paste_new:
|
||||||
|
path: /
|
||||||
|
defaults: { _controller: 'Skobkin\Bundle\CopyPasteBundle\Controller\PasteController::newAction' }
|
||||||
|
|
||||||
|
paste_create:
|
||||||
|
path: /create
|
||||||
|
defaults: { _controller: 'Skobkin\Bundle\CopyPasteBundle\Controller\PasteController::createAction' }
|
||||||
|
methods: POST
|
|
@ -4,6 +4,27 @@ parameters:
|
||||||
# parameter_name: value
|
# parameter_name: value
|
||||||
|
|
||||||
services:
|
services:
|
||||||
# service_name:
|
# default configuration for services in *this* file
|
||||||
# class: AppBundle\Directory\ClassName
|
_defaults:
|
||||||
# arguments: ["@another_service_name", "plain_value", "%parameter_name%"]
|
# automatically injects dependencies in your services
|
||||||
|
autowire: true
|
||||||
|
# automatically registers your services as commands, event subscribers, etc.
|
||||||
|
autoconfigure: true
|
||||||
|
# this means you cannot fetch services directly from the container via $container->get()
|
||||||
|
# if you need to do this, you can override this setting on individual services
|
||||||
|
public: false
|
||||||
|
|
||||||
|
# makes classes in src/AppBundle available to be used as services
|
||||||
|
# this creates a service per class whose id is the fully-qualified class name
|
||||||
|
Skobkin\Bundle\CopyPasteBundle\:
|
||||||
|
resource: '../../src/Skobkin/Bundle/CopyPasteBundle/*'
|
||||||
|
# you can exclude directories or files
|
||||||
|
# but if a service is unused, it's removed anyway
|
||||||
|
exclude: '../../src/Skobkin/Bundle/CopyPasteBundle/{DataFixtures,DependencyInjection,Entity,Repository,Tests}'
|
||||||
|
|
||||||
|
# controllers are imported separately to make sure they're public
|
||||||
|
# and have a tag that allows actions to type-hint services
|
||||||
|
Skobkin\Bundle\CopyPasteBundle\Controller\:
|
||||||
|
resource: '../../src/Skobkin/Bundle/CopyPasteBundle/Controller'
|
||||||
|
public: true
|
||||||
|
tags: ['controller.service_arguments']
|
||||||
|
|
|
@ -4,15 +4,14 @@ use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||||
use Symfony\Component\Console\Input\ArgvInput;
|
use Symfony\Component\Console\Input\ArgvInput;
|
||||||
use Symfony\Component\Debug\Debug;
|
use Symfony\Component\Debug\Debug;
|
||||||
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
|
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
|
||||||
// read http://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
|
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
|
||||||
// for more information
|
// for more information
|
||||||
umask(0002);
|
umask(0002);
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
/** @var Composer\Autoload\ClassLoader $loader */
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
$loader = require __DIR__.'/../app/autoload.php';
|
|
||||||
$input = new ArgvInput();
|
$input = new ArgvInput();
|
||||||
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
|
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev', true);
|
||||||
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
|
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption('--no-debug', true) && $env !== 'prod';
|
||||||
if ($debug) {
|
if ($debug) {
|
||||||
Debug::enable();
|
Debug::enable();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,28 +7,23 @@
|
||||||
"psr-4": { "": "src/" },
|
"psr-4": { "": "src/" },
|
||||||
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
|
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
|
||||||
},
|
},
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "stable",
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.5.9",
|
"php": ">=7.1.0",
|
||||||
"symfony/symfony": "3.2.*",
|
"symfony/symfony": "^3.4",
|
||||||
"doctrine/orm": "^2.5",
|
"doctrine/orm": "^2.5",
|
||||||
"doctrine/doctrine-bundle": "^1.4",
|
"doctrine/doctrine-bundle": "^1.4",
|
||||||
"symfony/swiftmailer-bundle": "^2.3",
|
"symfony/monolog-bundle": "^3.1",
|
||||||
"symfony/monolog-bundle": "~2.11.3",
|
|
||||||
"symfony/polyfill-apcu": "^1.0",
|
|
||||||
"sensio/distribution-bundle": "^5.0",
|
"sensio/distribution-bundle": "^5.0",
|
||||||
"sensio/framework-extra-bundle": "^3.0.2",
|
"sensio/framework-extra-bundle": "^3.0.2",
|
||||||
"incenteev/composer-parameter-handler": "~2.0",
|
"incenteev/composer-parameter-handler": "^2.0",
|
||||||
"doctrine/doctrine-fixtures-bundle": "^2.2",
|
"doctrine/doctrine-fixtures-bundle": "^2.2",
|
||||||
"theodordiaconu/geshi": "dev-master",
|
"theodordiaconu/geshi": "dev-master",
|
||||||
"theodordiaconu/geshi-bundle" : "dev-master",
|
"theodordiaconu/geshi-bundle" : "dev-master",
|
||||||
"doctrine/doctrine-migrations-bundle": "^1.0",
|
"doctrine/doctrine-migrations-bundle": "^2.0",
|
||||||
"doctrine/annotations": "^1.3"
|
"doctrine/annotations": "^1.3"
|
||||||
},
|
},"require-dev": {
|
||||||
"require-dev": {
|
"symfony/web-server-bundle": "^3.4"
|
||||||
"sensio/generator-bundle": "^3.0",
|
|
||||||
"symfony/phpunit-bridge": "^3.0",
|
|
||||||
"phpunit/phpunit": "^5.7"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"symfony-scripts": [
|
"symfony-scripts": [
|
||||||
|
@ -47,7 +42,8 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"bin-dir": "bin"
|
"bin-dir": "bin",
|
||||||
|
"sort-packages": true
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"symfony-app-dir": "app",
|
"symfony-app-dir": "app",
|
||||||
|
|
2896
composer.lock
generated
2896
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace Skobkin\Bundle\CopyPasteBundle\Controller;
|
namespace Skobkin\Bundle\CopyPasteBundle\Controller;
|
||||||
|
|
||||||
|
use DT\Bundle\GeshiBundle\Highlighter\HighlighterInterface;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
@ -9,14 +10,9 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use \Symfony\Component\Form\Form;
|
use \Symfony\Component\Form\Form;
|
||||||
use Skobkin\Bundle\CopyPasteBundle\Entity\Copypaste;
|
use Skobkin\Bundle\CopyPasteBundle\Entity\Copypaste;
|
||||||
use Skobkin\Bundle\CopyPasteBundle\Form\CopypasteType;
|
use Skobkin\Bundle\CopyPasteBundle\Form\CopypasteType;
|
||||||
use DT\Bundle\GeshiBundle\Highlighter\GeshiHighlighter;
|
|
||||||
use \GeSHi\GeSHi;
|
use \GeSHi\GeSHi;
|
||||||
|
|
||||||
/**
|
class PasteController extends Controller
|
||||||
* Copypaste controller.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class CopypasteController extends Controller
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,9 +54,9 @@ class CopypasteController extends Controller
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
if ($paste->isPrivate()) {
|
if ($paste->isPrivate()) {
|
||||||
return $this->redirect($this->generateUrl('copypaste_show_private', ['id' => $paste->getId(), 'secret' => $paste->getSecret()]));
|
return $this->redirect($this->generateUrl('paste_show_private', ['id' => $paste->getId(), 'secret' => $paste->getSecret()]));
|
||||||
} else {
|
} else {
|
||||||
return $this->redirect($this->generateUrl('copypaste_show_public', ['id' => $paste->getId()]));
|
return $this->redirect($this->generateUrl('paste_show_public', ['id' => $paste->getId()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +73,7 @@ class CopypasteController extends Controller
|
||||||
private function createCreateForm(Copypaste $entity)
|
private function createCreateForm(Copypaste $entity)
|
||||||
{
|
{
|
||||||
$form = $this->createForm(CopypasteType::class, $entity, [
|
$form = $this->createForm(CopypasteType::class, $entity, [
|
||||||
'action' => $this->generateUrl('copypaste_create'),
|
'action' => $this->generateUrl('paste_create'),
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -96,7 +92,7 @@ class CopypasteController extends Controller
|
||||||
$paste = new Copypaste();
|
$paste = new Copypaste();
|
||||||
$createForm = $this->createCreateForm($paste);
|
$createForm = $this->createCreateForm($paste);
|
||||||
|
|
||||||
return $this->render('SkobkinCopyPasteBundle:Copypaste:new.html.twig', [
|
return $this->render('Paste/new.html.twig', [
|
||||||
'entity' => $paste,
|
'entity' => $paste,
|
||||||
'form_create' => $createForm->createView(),
|
'form_create' => $createForm->createView(),
|
||||||
]);
|
]);
|
||||||
|
@ -107,12 +103,12 @@ class CopypasteController extends Controller
|
||||||
*
|
*
|
||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function showAction($id, $secret)
|
public function showAction(int $id, ?string $secret, HighlighterInterface $highlighter)
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
/* @var $paste Copypaste */
|
/* @var $paste Copypaste */
|
||||||
$paste = $em->getRepository('SkobkinCopyPasteBundle:Copypaste')->findOneBy([
|
$paste = $em->getRepository(Copypaste::class)->findOneBy([
|
||||||
'id' =>$id,
|
'id' =>$id,
|
||||||
'secret' => $secret
|
'secret' => $secret
|
||||||
]);
|
]);
|
||||||
|
@ -123,15 +119,12 @@ class CopypasteController extends Controller
|
||||||
|
|
||||||
$editForm = $this->createCreateForm($paste);
|
$editForm = $this->createCreateForm($paste);
|
||||||
|
|
||||||
/* @var $highlighter GeshiHighlighter */
|
|
||||||
$highlighter = $this->get('dt_geshi.highlighter');
|
|
||||||
|
|
||||||
$highlightedCode = $highlighter->highlight($paste->getText(), $paste->getLanguage()->getCode(), function(GeSHi $geshi) {
|
$highlightedCode = $highlighter->highlight($paste->getText(), $paste->getLanguage()->getCode(), function(GeSHi $geshi) {
|
||||||
$geshi->set_header_type(GESHI_HEADER_PRE);
|
$geshi->set_header_type(GESHI_HEADER_PRE);
|
||||||
$geshi->enable_line_numbers(GESHI_NO_LINE_NUMBERS);
|
$geshi->enable_line_numbers(GESHI_NO_LINE_NUMBERS);
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->render('SkobkinCopyPasteBundle:Copypaste:show.html.twig', [
|
return $this->render('Paste/show.html.twig', [
|
||||||
'paste' => $paste,
|
'paste' => $paste,
|
||||||
'highlighted_text' => $highlightedCode,
|
'highlighted_text' => $highlightedCode,
|
||||||
'form_create' => $editForm->createView(),
|
'form_create' => $editForm->createView(),
|
||||||
|
@ -147,15 +140,13 @@ class CopypasteController extends Controller
|
||||||
{
|
{
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
$pastes = $em->getRepository('SkobkinCopyPasteBundle:Copypaste')->findBy(
|
$pastes = $em->getRepository(Copypaste::class)->findBy(
|
||||||
['secret' => null],
|
['secret' => null],
|
||||||
['id' => 'DESC'],
|
['id' => 'DESC'],
|
||||||
// @todo move to the config
|
// @todo move to the config
|
||||||
15
|
15
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this->render('::sidebar.html.twig', ['pastes' => $pastes]);
|
return $this->render('sidebar.html.twig', ['pastes' => $pastes]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -78,13 +78,13 @@ class LoadLanguages implements FixtureInterface, ContainerAwareInterface
|
||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
$output->writeln($file->getRelativePathname() . ' found. Parsing...');
|
$output->writeln($file->getRelativePathname() . ' found. Parsing...');
|
||||||
|
|
||||||
include $geshiPath . DIRECTORY_SEPARATOR .$file->getRelativePathname();
|
include $geshiPath.DIRECTORY_SEPARATOR.$file->getRelativePathname();
|
||||||
|
|
||||||
$language = new Language();
|
$language = new Language();
|
||||||
$language
|
$language
|
||||||
->setName($language_data['LANG_NAME'])
|
->setName($language_data['LANG_NAME'])
|
||||||
->setCode(basename($file->getRelativePathname(), '.php'))
|
->setCode(basename($file->getRelativePathname(), '.php'))
|
||||||
->setEnabled(true)
|
->setIsEnabled(true)
|
||||||
;
|
;
|
||||||
|
|
||||||
$output->write('---> "' . $language->getName() . '"');
|
$output->write('---> "' . $language->getName() . '"');
|
||||||
|
|
|
@ -23,6 +23,5 @@ class SkobkinCopyPasteExtension extends Extension
|
||||||
$config = $this->processConfiguration($configuration, $configs);
|
$config = $this->processConfiguration($configuration, $configs);
|
||||||
|
|
||||||
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||||
$loader->load('services.yml');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@ namespace Skobkin\Bundle\CopyPasteBundle\Entity;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language
|
|
||||||
*
|
|
||||||
* @ORM\Table(name="languages", indexes={
|
* @ORM\Table(name="languages", indexes={
|
||||||
* @ORM\Index(name="idx_enabled", columns={"is_enabled"}),
|
* @ORM\Index(name="idx_enabled", columns={"is_enabled"}),
|
||||||
* @ORM\Index(name="idx_preferred", columns={"is_preferred"}),
|
* @ORM\Index(name="idx_preferred", columns={"is_preferred"}),
|
||||||
|
@ -53,14 +51,7 @@ class Language
|
||||||
*/
|
*/
|
||||||
private $isEnabled;
|
private $isEnabled;
|
||||||
|
|
||||||
|
public function getId(): int
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id
|
|
||||||
*
|
|
||||||
* @return integer
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
{
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
@ -70,91 +61,48 @@ class Language
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setName(string $name): self
|
||||||
* Set name
|
|
||||||
*
|
|
||||||
* @param string $name
|
|
||||||
* @return Lang
|
|
||||||
*/
|
|
||||||
public function setName($name)
|
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getName(): string
|
||||||
* Get name
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName()
|
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setCode($code): self
|
||||||
* Set code
|
|
||||||
*
|
|
||||||
* @param string $code
|
|
||||||
* @return Lang
|
|
||||||
*/
|
|
||||||
public function setCode($code)
|
|
||||||
{
|
{
|
||||||
$this->code = $code;
|
$this->code = $code;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getCode(): string
|
||||||
* Get code
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCode()
|
|
||||||
{
|
{
|
||||||
return $this->code;
|
return $this->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function setIsEnabled($isEnabled): self
|
||||||
* Set isEnabled
|
|
||||||
*
|
|
||||||
* @param boolean $isEnabled
|
|
||||||
* @return Lang
|
|
||||||
*/
|
|
||||||
public function setIsEnabled($isEnabled)
|
|
||||||
{
|
{
|
||||||
$this->isEnabled = $isEnabled;
|
$this->isEnabled = $isEnabled;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getIsEnabled(): bool
|
||||||
* Get isEnabled
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function getIsEnabled()
|
|
||||||
{
|
{
|
||||||
return $this->isEnabled;
|
return $this->isEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function getIsPreferred(): bool
|
||||||
* Get isPreferred
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
function getIsPreferred()
|
|
||||||
{
|
{
|
||||||
return $this->isPreferred;
|
return $this->isPreferred;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
function setIsPreferred(bool $isPreferred): self
|
||||||
* Set isPreferred
|
|
||||||
*
|
|
||||||
* @param boolean $isPreferred
|
|
||||||
*/
|
|
||||||
function setIsPreferred($isPreferred)
|
|
||||||
{
|
{
|
||||||
$this->isPreferred = $isPreferred;
|
$this->isPreferred = $isPreferred;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
skobkin_copy_paste:
|
|
||||||
resource: "@SkobkinCopyPasteBundle/Resources/config/routing/copypaste.yml"
|
|
||||||
prefix: /
|
|
|
@ -1,21 +0,0 @@
|
||||||
copypaste_show_public:
|
|
||||||
path: /{id}
|
|
||||||
defaults: { _controller: "SkobkinCopyPasteBundle:Copypaste:show", secret: null }
|
|
||||||
requirements:
|
|
||||||
id: \d+
|
|
||||||
|
|
||||||
copypaste_show_private:
|
|
||||||
path: /{id}/{secret}
|
|
||||||
defaults: { _controller: "SkobkinCopyPasteBundle:Copypaste:show" }
|
|
||||||
requirements:
|
|
||||||
id: \d+
|
|
||||||
secret: \w{16}
|
|
||||||
|
|
||||||
copypaste_new:
|
|
||||||
path: /
|
|
||||||
defaults: { _controller: "SkobkinCopyPasteBundle:Copypaste:new" }
|
|
||||||
|
|
||||||
copypaste_create:
|
|
||||||
path: /create
|
|
||||||
defaults: { _controller: "SkobkinCopyPasteBundle:Copypaste:create" }
|
|
||||||
methods: POST
|
|
|
@ -1 +0,0 @@
|
||||||
services:
|
|
|
@ -1,6 +0,0 @@
|
||||||
{% extends '::base.html.twig' %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{# This form recieves form_create object from current context #}
|
|
||||||
{% include 'SkobkinCopyPasteBundle:Form:form_paste_create.html.twig' %}
|
|
||||||
{% endblock %}
|
|
|
@ -1,9 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
/** @var \Composer\Autoload\ClassLoader $loader */
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
$loader = require __DIR__.'/../app/autoload.php';
|
|
||||||
if (PHP_VERSION_ID < 70000) {
|
if (PHP_VERSION_ID < 70000) {
|
||||||
include_once __DIR__.'/../var/bootstrap.php.cache';
|
include_once __DIR__.'/../app/bootstrap.php.cache';
|
||||||
}
|
}
|
||||||
$kernel = new AppKernel('prod', false);
|
$kernel = new AppKernel('prod', false);
|
||||||
if (PHP_VERSION_ID < 70000) {
|
if (PHP_VERSION_ID < 70000) {
|
||||||
|
|
|
@ -1,28 +1,25 @@
|
||||||
<?php
|
<?php
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\Debug\Debug;
|
use Symfony\Component\Debug\Debug;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
|
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
|
||||||
// read http://symfony.com/doc/current/book/installation.html#checking-symfony-application-configuration-and-setup
|
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
|
||||||
// for more information
|
// for more information
|
||||||
umask(0002);
|
umask(0002);
|
||||||
// This check prevents access to debug front controllers that are deployed by accident to production servers.
|
// This check prevents access to debug front controllers that are deployed by accident to production servers.
|
||||||
// Feel free to remove this, extend it, or make something more sophisticated.
|
// Feel free to remove this, extend it, or make something more sophisticated.
|
||||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||||
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', 'fe80::1', '::1']) || php_sapi_name() === 'cli-server')
|
|| !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1'], true) || PHP_SAPI === 'cli-server')
|
||||||
) {
|
) {
|
||||||
header('HTTP/1.0 403 Forbidden');
|
header('HTTP/1.0 403 Forbidden');
|
||||||
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
||||||
}
|
}
|
||||||
/**
|
require __DIR__.'/../vendor/autoload.php';
|
||||||
* @var Composer\Autoload\ClassLoader $loader
|
|
||||||
*/
|
|
||||||
//$loader = require __DIR__.'/../app/autoload.php';
|
|
||||||
$loader = require_once __DIR__.'/../app/autoload.php';
|
|
||||||
require_once __DIR__.'/../app/AppKernel.php';
|
|
||||||
Debug::enable();
|
Debug::enable();
|
||||||
$kernel = new AppKernel('dev', true);
|
$kernel = new AppKernel('dev', true);
|
||||||
//$kernel->loadClassCache();
|
if (PHP_VERSION_ID < 70000) {
|
||||||
|
$kernel->loadClassCache();
|
||||||
|
}
|
||||||
$request = Request::createFromGlobals();
|
$request = Request::createFromGlobals();
|
||||||
$response = $kernel->handle($request);
|
$response = $kernel->handle($request);
|
||||||
$response->send();
|
$response->send();
|
||||||
|
|
Loading…
Reference in a new issue