1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

Compare commits

..

3 Commits

Author SHA1 Message Date
60207dc361 check field add poll 2021-04-30 23:49:02 +02:00
ff0da0cf49 dev conf nginx 2021-04-30 22:32:58 +02:00
9f57894d2a add config for apache 2021-04-30 22:23:34 +02:00
5 changed files with 125 additions and 2 deletions

View File

@ -1,6 +1,6 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html # see https://symfony.com/doc/current/reference/configuration/framework.html
framework: framework:
trusted_hosts: ['localhost:4200', 'localhost', 'framadate-api.cipherbliss.com'] trusted_hosts: ['localhost:4200', 'localhost', 'tktest.lan', 'framadate-api.cipherbliss.com']
secret: '%env(APP_SECRET)%' secret: '%env(APP_SECRET)%'
#csrf_protection: true #csrf_protection: true
#http_method_override: true #http_method_override: true

41
doc/apache2/dev.conf Normal file
View File

@ -0,0 +1,41 @@
<VirtualHost *:80>
ServerName www.tktest.lan
ServerAlias www.tktest.lan
# Uncomment the following line to force Apache to pass the Authorization
# header to PHP: required for "basic_auth" under PHP-FPM and FastCGI
#
# SetEnvIfNoCase ^Authorization$ "(.+)" HTTP_AUTHORIZATION=$1
# For Apache 2.4.9 or higher
# Using SetHandler avoids issues with using ProxyPassMatch in combination
# with mod_rewrite or mod_autoindex
<FilesMatch \.php$>
SetHandler proxy:fcgi://127.0.0.1:9000
# for Unix sockets, Apache 2..10 or higher
# SetHandler proxy:unix:/path/to/fpm.sock|fcgi://dummy
</FilesMatch>
# If you use Apache version below 2.4.9 you must consider update or use this instead
# ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/project/public/$1
# If you run your Symfony application on a subpath of your document root, the
# regular expression must be changed accordingly:
# ProxyPassMatch ^/path-to-app/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/project/public/$1
DocumentRoot /var/www/html/date-poll-api/public
<Directory /var/www/html/date-poll-api/public>
# enable the .htaccess rewrites
AllowOverride All
Require all granted
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
ErrorLog /var/log/apache2/tktest_error.log
CustomLog /var/log/apache2/tktest_access.log combined
</VirtualHost>

View File

@ -0,0 +1,26 @@
<VirtualHost *:80>
ServerName tktest.lan
ServerAlias www.tktest.lan
AddHandler php7-fcgi .php
Action php7-fcgi /php7-fcgi
Alias /php7-fcgi /usr/lib/cgi-bin/php7-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi -host 127.0.0.1:9000 -pass-header Authorization
DocumentRoot /var/www/html/date-poll-api/public
<Directory /var/www/html/date-poll-api/public>
# enable the .htaccess rewrites
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/project>
# Options FollowSymlinks
# </Directory>
ErrorLog /var/log/apache2/tktest_error.log
CustomLog /var/log/apache2/tktest_access.log combined
</VirtualHost>

53
doc/nginx/dev.conf Executable file
View File

@ -0,0 +1,53 @@
server {
server_name tktest.lan www.tktest.lan;
root /var/www/html/date-poll-api/public;
location / {
# try to serve file directly, fallback to index.php
try_files $uri /index.php$is_args$args;
}
# optionally disable falling back to PHP script for the asset directories;
# nginx will return a 404 error when files are not found instead of passing the
# request to Symfony (improves performance but Symfony's 404 page is not displayed)
# location /bundles {
# try_files $uri =404;
# }
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# optionally set the value of the environment variables used in the application
# fastcgi_param APP_ENV prod;
# fastcgi_param APP_SECRET <app-secret-id>;
# fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";
# When you are using symlinks to link the document root to the
# current version of your application, you should pass the real
# application path instead of the path to the symlink to PHP
# FPM.
# Otherwise, PHP's OPcache may not properly detect changes to
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
# for more information).
# Caveat: When PHP-FPM is hosted on a different machine from nginx
# $realpath_root may not resolve as you expect! In this case try using
# $document_root instead.
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
# Prevents URIs that include the front controller. This will 404:
# http://tktest.lan/index.php/some-path
# Remove the internal directive to allow URIs like this
internal;
}
# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}
error_log /var/log/nginx/tktest_error.log;
access_log /var/log/nginx/tktest_access.log;
}

View File

@ -250,7 +250,10 @@ class PollController extends EmailsController {
// emails // emails
$newpoll->setMailOnComment( true ); $newpoll->setMailOnComment( true );
if(isset($data['isOwnerNotifiedByEmailOnNewVote'])){
$newpoll->setMailOnVote( $data['isOwnerNotifiedByEmailOnNewVote'] ); $newpoll->setMailOnVote( $data['isOwnerNotifiedByEmailOnNewVote'] );
}
$newpoll->setDescription( $data['description'] ); $newpoll->setDescription( $data['description'] );
$newpoll->setHideResults( false ); $newpoll->setHideResults( false );
// possible answers // possible answers
@ -278,7 +281,7 @@ class PollController extends EmailsController {
elseif ( $data[ 'kind' ] == 'date' ) { elseif ( $data[ 'kind' ] == 'date' ) {
$choices = $data[ 'dateChoices' ]; $choices = $data[ 'dateChoices' ];
if ( $data[ 'hasSeveralHours' ] == true ) { if ( isset($data[ 'hasSeveralHours' ]) && $data[ 'hasSeveralHours' ] == true ) {
// different hours spans make more choices // different hours spans make more choices
foreach ( $choices as $c ) { foreach ( $choices as $c ) {