codelinered/file-sharing

File Sharing - CodelineRed

4.1.0 2023-09-01 19:11 UTC

README

This git is for fs.codelinered.net. Take a look at screenshots.

This application based on Slim Skeleton and Gulp Skeleton.

Table of contents

Included

Install Production Build (Recommended)

Required

  • PHP 8.0
  • MySQL 5.7 (pdo_mysql)

Download zip if you don't have git or composer on your OS. Open console on your OS and navigate to your project folder.

+++++ COMPOSER VERSION +++++
$ php composer create-project codelinered/file-sharing file-sharing "dev-production" --no-dev
$ cd file-sharing
$ php doctrine dbal:run-sql "CREATE DATABASE file_sharing"
$ php doctrine orm:schema-tool:update --force
$ php doctrine dbal:import sql/all-records.sql
+++++ GIT VERSION +++++
$ git clone https://github.com/CodelineRed/file-sharing.git
$ cd file-sharing
$ git checkout production
$ (optional on unix)  rm -rf .git
$ (optional on win10) rmdir .git /s
$ (optional) cp config\additional-settings.dist.php config\additional-settings.php
$ ---- Open "config\additional-settings.php" and change everything you have to change ----
$ php composer insall --no-dev
$ php doctrine dbal:run-sql "CREATE DATABASE file_sharing"
$ php doctrine orm:schema-tool:update --force
$ php doctrine dbal:import sql/all-records.sql
+++++ ZIP VERSION +++++
$ (unix) wget -O fs-prod.zip https://github.com/CodelineRed/file-sharing/archive/production.zip
$ (unix) unzip fs-prod.zip
$ (win10) curl -L -o fs-prod.zip https://github.com/CodelineRed/file-sharing/archive/production.zip
$ (win10) tar -xf fs-prod.zip
$ cd file-sharing-production
$ (optional) cp config\additional-settings.dist.php config\additional-settings.php
$ ---- Open "config\additional-settings.php" and change everything you have to change ----
$ php composer insall --no-dev
$ php doctrine dbal:run-sql "CREATE DATABASE file_sharing"
$ php doctrine orm:schema-tool:update --force
$ php doctrine dbal:import sql/all-records.sql

If you want to use Docker: click here

Install Main/ Develop Build

Required

  • Node.js
  • npm $ npm i npm@latest -g
  • gulp-cli $ npm i gulp-cli@latest -g
  • PHP 8.0
  • MySQL 5.7 (pdo_mysql)

Download zip if you don't have git on your OS. Open console on your OS and navigate to your project folder.

+++++ COMPOSER VERSION +++++
$ php composer create-project codelinered/file-sharing file-sharing
$ cd file-sharing
$ npm i
$ gulp build
$ php doctrine dbal:run-sql "CREATE DATABASE file_sharing"
$ php doctrine orm:schema-tool:update --force
$ php doctrine dbal:import sql/all-records.sql
+++++ GIT VERSION +++++
$ git clone https://github.com/CodelineRed/file-sharing.git
$ cd file-sharing
$ npm i
$ gulp build
$ (optional on unix)  rm -rf .git
$ (optional on win10) rmdir .git /s
$ (optional) cp config\additional-settings.dist.php config\additional-settings.php
$ ---- Open "config\additional-settings.php" and change everything you have to change ----
$ php composer insall
$ php doctrine dbal:run-sql "CREATE DATABASE file_sharing"
$ php doctrine orm:schema-tool:update --force
$ php doctrine dbal:import sql/all-records.sql
+++++ ZIP VERSION +++++
$ (unix) wget -O fs-main.zip https://github.com/CodelineRed/file-sharing/archive/main.zip
$ (unix) unzip fs-main.zip
$ (win10) curl -L -o fs-main.zip https://github.com/CodelineRed/file-sharing/archive/main.zip
$ (win10) tar -xf fs-main.zip
$ cd file-sharing-main
$ npm i
$ gulp build
$ (optional) cp config\additional-settings.dist.php config\additional-settings.php
$ ---- Open "config\additional-settings.php" and change everything you have to change ----
$ php composer insall
$ php doctrine dbal:run-sql "CREATE DATABASE file_sharing"
$ php doctrine orm:schema-tool:update --force
$ php doctrine dbal:import sql/all-records.sql

Install with Docker (optional)

Required

Open console on your OS and navigate to the place where you want to install the project.

$ ---- Unix ----
$ systemctl docker start
$ docker run --rm --interactive --tty --volume $PWD:/app composer create-project --ignore-platform-reqs --no-dev codelinered/file-sharing file-sharing "dev-production"
$ cd file-sharing
$ cp -n config/additional-settings.dist.php config/additional-settings.php
$ docker run --rm --interactive --tty --volume $PWD:/app composer update --no-dev
$ ---- Windows ----
$ "c:\path\to\Docker Desktop.exe"
$ docker run --rm --interactive --tty --volume %cd%:/app composer create-project --ignore-platform-reqs --no-dev codelinered/file-sharing file-sharing "dev-production"
$ cd file-sharing
$ echo n | copy /-y config\additional-settings.dist.php config\additional-settings.php
$ docker run --rm --interactive --tty --volume %cd%:/app composer update --no-dev
$ --- All OS ----
$ docker-compose build
$ docker-compose up -d

Project Commands

gulpfile.json

Path generation with Locale code and Generic locale code

  • Mode 1 - example.com/de/ = 'process' => \App\Utility\LanguageUtility::LOCALE_URL | \App\Utility\LanguageUtility::DOMAIN_DISABLED,
  • Mode 2 - example.de = 'process' => \App\Utility\LanguageUtility::LOCALE_URL | \App\Utility\LanguageUtility::DOMAIN_ENABLED,
  • Mode 3 - example.com (de-DE session) = 'process' => \App\Utility\LanguageUtility::LOCALE_SESSION | \App\Utility\LanguageUtility::DOMAIN_DISABLED, (default)

It depends on your configuration what will be returned.

How to create further localisations

  • Duplicate one existing file in folder locale/ (e.g. copy de-DE.php to fr-FR.php)
  • (if you use Mode 1 or 2) Duplicate one existing file in folder config/routes/ (e.g. copy de-DE.php to fr-FR.php)
  • (if you use Mode 1 or 2) Change route prefix from /de/ to /fr/ in config/routes/fr-FR.php
  • You can also define paths like /fr-be/ (locale/fr-BE.php/ config/routes/fr-BE.php) for example
  • If you want to show language in langswitch, add fr-FR and domain in locale => active (config/additional-settings.php)
  • (if you use Mode 1 or 2) Add case for fr/ in src/localisation.php

How to switch between different url modes

Mode 1

Example: example.com/de/

Mode 2

Example: de.example.com or example.de

Mode 3 (default)

Example: example.com

ACL settings

With Geggleto ACL, routes are protected by role the current user has. By default every new route is not accessable until you give the route roles. Routes are defined in the route files (e.g. config/routes/de-DE.php). Any other resource is defined in config/settings.php. Inside the Twig templates you can use ACL functions has_role and is_allowed. Inside controllers you can also use this ACL functions and many more (e.g. isAllowed()).

Troubleshooting

In some cases you'll get the error message "Internal Server Error".

If this happened, go to public/.htaccess and enable RewriteBase /.

If project is in sub directory then RewriteBase /project/public/.

Links