Skip to content
Front and back end code of our main website.
CSS PHP Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
content
css
errors
files
img
js
lib
pages
vendor
.gitattributes
.gitignore
.htaccess
CHANGELOG.md
README.md
router.php

README.md

Filmmakers4Future - Website

Front and back end code of our main website.

Core code

A simplified version of this site containing only the core code necessary for signing can be found here.

Install the software

sudo apt-get install nginx php-fpm php-curl php-mysqli mariadb-server

sudo git clone https://github.com/Filmmakers4Future/Website /var/www/html

Configure the webserver

Open the configuration file

sudo vi /etc/nginx/sites-enabled/default 

Insert the configuration:

server {
	listen 80 default_server;
	listen [::]:80 default_server;

	root /var/www/html;

	index index.php index.html index.htm;

	server_name _;

	# prevent access to certain locations
	location ~ ^\/\.git(\/.*)?$            { return 404; }
	location ~ ^\/\.gitattributes$         { return 404; }
	location ~ ^\/\.gitignore$             { return 404; }
	location ~ ^\/\.htaccess$              { return 404; }
	location ~ ^\/CHANGELOG\.md$           { return 404; }
	location ~ ^\/config(\/.*)?$           { return 404; }
	location ~ ^\/errors(\/.*)?$           { return 404; }
	location ~ ^\/lib(\/.*)?$              { return 404; }
	location ~ ^\/pages(\/)?$              { return 404; }
	location ~ ^\/pages\/templates(\/.*)?$ { return 404; }
	location ~ ^\/README\.md$              { return 404; }
        location ~ ^\/router\.php$             { return 404; }

	# migrate URLs
	rewrite ^\/beta(\/.*)?$                    /                permanent;
	rewrite ^\/contact(\.html|\.php)$          /contact         permanent;
	rewrite ^\/demands(\.html|\.php)$          /demands         permanent;
	rewrite ^\/greenfilmmaking(\.html|\.php)$  /greenfilmmaking permanent;
	rewrite ^\/greenproduction(\.html|\.php)?$ /greenfilmmaking permanent;
	rewrite ^\/index(\.html|\.php)$            /                permanent;
	rewrite ^\/legal(\.html|\.php)$            /legal           permanent;
	rewrite ^\/newsletter(\.html|\.php)$       /newsletter      permanent;
	rewrite ^\/participate(\.html|\.php)$      /participate     permanent;
	rewrite ^\/privacy(\.html|\.php)$          /privacy         permanent;
	rewrite ^\/signatures(\.html|\.php)$       /signatures      permanent;
	rewrite ^\/verify(\.html|\.php)$           /verify          permanent;
	rewrite ^\/videos(\.html|\.php)$           /videos          permanent;

	# pretty URLs
	rewrite ^\/$                /pages/index.php           last;
	rewrite ^\/contact$         /pages/contact.php         last;
	rewrite ^\/demands$         /pages/demands.php         last;
	rewrite ^\/greenfilmmaking$ /pages/greenfilmmaking.php last;
	rewrite ^\/legal$           /pages/legal.php           last;
	rewrite ^\/newsletter$      /pages/newsletter.php      last;
	rewrite ^\/participate$     /pages/participate.php     last;
	rewrite ^\/privacy$         /pages/privacy.php         last;
	rewrite ^\/robots\.txt$     /pages/robots.php          last;
	rewrite ^\/signatures$      /pages/signatures.php      last;
	rewrite ^\/sitemap\.xml$    /pages/sitemap.php         last;
	rewrite ^\/verify$          /pages/verify.php          last;
	rewrite ^\/videos$          /pages/videos.php          last;

	location / {
		try_files $uri $uri/ =404;
	}

	location ~ \.php$ {
		include snippets/fastcgi-php.conf;
		fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
	}
}

Restart the webserver

sudo systemctl restart nginx.service

Setup the database

Log into the MariaDB database

sudo mysql

Execute the SQL statements

CREATE DATABASE fff CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

USE fff;

CREATE TABLE data (
	uid                   VARCHAR(40)  NOT NULL PRIMARY KEY,
	name                  VARCHAR(256) NOT NULL,
	mail                  VARCHAR(256) NOT NULL,
	job                   VARCHAR(256) NOT NULL,
	country               VARCHAR(256) NOT NULL,
	city                  VARCHAR(256),
	website               VARCHAR(256),
	iscompany             BOOLEAN      NOT NULL DEFAULT FALSE,
	newsletter            BOOLEAN      NOT NULL DEFAULT FALSE,
	disabled              BOOLEAN      NOT NULL DEFAULT FALSE,
	admin_verify_token    VARCHAR(40),
	user_newsletter_token VARCHAR(40),
	user_verify_token     VARCHAR(40),
	mailhash              VARCHAR(64)  AS (SHA2(mail, 256)) PERSISTENT UNIQUE KEY,
	subscribed            BOOLEAN      AS (disabled IS FALSE AND admin_verify_token IS NULL AND user_verify_token IS NULL AND newsletter IS TRUE),
	verified              BOOLEAN      AS (disabled IS FALSE AND admin_verify_token IS NULL AND user_verify_token IS NULL)
);

GRANT ALL ON fff.* TO 'fff'@'%' IDENTIFIED BY 'fff';
GRANT ALL ON fff.* TO 'fff'@'localhost' IDENTIFIED BY 'fff';
GRANT ALL ON fff.* TO 'fff'@'127.0.0.1' IDENTIFIED BY 'fff';

FLUSH PRIVILEGES;

EXIT;

Configure the software

Set the configuration values

sudo cp /var/www/html/config/config.php.example /var/www/html/config/config.php
sudo vi /var/www/html/config/config.php

Modify the e-mail templates

sudo vi /var/www/html/conf/templates/admin_verify.txt
sudo vi /var/www/html/conf/templates/contact.txt
sudo vi /var/www/html/conf/templates/user_newsletter.txt
sudo vi /var/www/html/conf/templates/user_verified.txt
sudo vi /var/www/html/conf/templates/user_verify.txt
You can’t perform that action at this time.