diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ea26ec2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.data
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9b5071a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,14 @@
+# Halo-Battle
+
+## Développer
+HB peut petre lancé localement via un docker. Pour cela, vous devez avoir installé Docker et docker-compose.
+une fois installé, lancez un `docker-compouse up` à la racine du repo. Une fois que tout à boot, vous devez
+injecter le code SQL avec `docker exec -i game_mariadb_1 mysql --user=hb --password=hb hb_game < schema.sql`
+
+HB est alors disponible sur http://localhost:8080.
+
+À la création du compte, aucun email n'est envoyé. Pour récupérer votre code de confirmation, vous devez
+vous connecter au serveur MySQL via `docker exec -it game_mariadb_1 mysql --user=hb --password=hb hb_game`
+et récupérer votre jeton d'activation via `select id_activ from user_inscriptions WHERE pseudo LIKE 'VOTRE_PSEUDO_A_REMPLACER';`
+une fois l'ID récupérer, rendez-vous à l'adresse http://localhost:8080/?p=validation&i=VOTRE_ID (pensez
+bien à modifier l'id dans l'URL).
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..1f8e5f5
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,53 @@
+version: '3.2'
+
+networks:
+ halonet:
+ driver: bridge
+
+services:
+ mariadb:
+ restart: always
+ image: mariadb:10-focal
+ networks:
+ - halonet
+ volumes:
+ - .data:/var/lib/mysql
+ environment:
+ - MYSQL_USER=hb
+ - MYSQL_PASSWORD=hb
+ - MYSQL_ROOT_PASSWORD=hb
+ - MYSQL_DATABASE=hb_game
+
+ hb:
+ image: hb
+ container_name: hb
+ depends_on:
+ - mariadb
+ networks:
+ - halonet
+ volumes:
+ - ./htdocs:/usr/src/hb-main/htdocs:rw
+ - ./onyx2:/usr/src/hb-main/onyx2:rw
+ # make cache and compile writable + don't add file to local host
+ - /usr/src/hb-main/onyx2/cache
+ - /usr/src/hb-main/onyx2/log
+ - /usr/src/hb-main/onyx2/modules/templates/compile
+ environment:
+ - MYSQL_DATABASE=hb_game
+ - MYSQL_HOST=mariadb
+ - MYSQL_USER=hb
+ - MYSQL_PASSWORD=hb
+ - DISABLE_TLS=true
+ - DEV=true
+
+ nginx:
+ image: nginx:1-alpine
+ depends_on:
+ - hb
+ networks:
+ - halonet
+ volumes:
+ - ./nginx.conf:/etc/nginx/conf.d/default.conf
+ - ./htdocs:/usr/src/hb-main/htdocs:ro
+ ports:
+ - "8080:80"
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..5df62c8
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,21 @@
+server {
+ listen 80;
+ server_name localhost;
+ root /usr/src/hb-main/htdocs;
+
+ location / {
+ index index.php;
+ try_files $uri $uri/ /index.php;
+ }
+
+ location ~* \.php$ {
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+ fastcgi_param HTTP_HOST $server_name;
+ fastcgi_param REMOTE_ADDR $remote_addr;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ fastcgi_index index.php;
+ fastcgi_pass hb:9000;
+ }
+}
diff --git a/onyx2/modules/templates/smarty/plugins/modifier.nl2br.php b/onyx2/modules/templates/smarty/plugins/modifier.nl2br.php
index d9ae192..d5c2bd9 100644
--- a/onyx2/modules/templates/smarty/plugins/modifier.nl2br.php
+++ b/onyx2/modules/templates/smarty/plugins/modifier.nl2br.php
@@ -27,7 +27,7 @@
*/
function smarty_modifier_nl2br($string)
{
- return nl2br($string);
+ return str_replace(array('\r\n', '\r', '\n'), "
", $string);
}
/* vim: set expandtab: */
diff --git a/onyx2/modules/templates/smarty/plugins/modifier.ucfirst.php b/onyx2/modules/templates/smarty/plugins/modifier.ucfirst.php
index bb8ff9e..c625363 100644
--- a/onyx2/modules/templates/smarty/plugins/modifier.ucfirst.php
+++ b/onyx2/modules/templates/smarty/plugins/modifier.ucfirst.php
@@ -20,10 +20,5 @@
*/
function smarty_modifier_ucfirst($chaine)
{
- $chaineS = strtr($chaine, "áà âäãéèêëẽÃìîïĩóòôöõúùûüũýỳŷÿỹ", "ÃÃÃÃÃÃÃÃÃẼÃÃÃÃĨÃÃÃÃÃÃÃÃÃŨÃỲŶŸỸ");
- if ($chaineS[0].$chaineS[1] != $chaine[0].$chaine[1]) {
- return $chaineS[0].$chaineS[1].substr($chaine, 2);
- } else {
- return ucfirst($chaine);
- }
+ return mb_convert_case($chaine, MB_CASE_TITLE, 'UTF-8');
}
diff --git a/onyx2/modules/templates/smarty/plugins/modifier.ucfirst.php3 b/onyx2/modules/templates/smarty/plugins/modifier.ucfirst.php3
deleted file mode 100644
index ea01fe6..0000000
--- a/onyx2/modules/templates/smarty/plugins/modifier.ucfirst.php3
+++ /dev/null
@@ -1,31 +0,0 @@
-
- * Name: capitalize
- * Purpose: capitalize words in the string
- * @link http://smarty.php.net/manual/en/language.modifiers.php#LANGUAGE.MODIFIER.CAPITALIZE
- * capitalize (Smarty online manual)
- * @author Monte Ohrt
- * @param string
- * @return string
- */
-function smarty_modifier_ucfirst($chaine)
-{
- $chaineS = strtr($chaine, "áàâäãéèêëẽíìîïĩóòôöõúùûüũýỳŷÿỹ", "ÁÀÂÄÃÉÈÊËẼÍÌÎÏĨÓÒÔÖÕÚÙÛÜŨÝỲŶŸỸ");
- if ($chaineS[0].$chaineS[1] != $chaine[0].$chaine[1])
- return $chaineS[0].$chaineS[1].substr($chaine, 2);
- else
- return ucfirst($chaine);
-}
-
-
-?>