Docker compose #1

Merged
Nigel merged 2 commits from nigel_quick_fix into master 2020-11-21 14:06:41 +00:00
7 changed files with 36 additions and 15 deletions

View File

@ -1,5 +1,10 @@
.drone.yml
.drone-manifest.yml
.data
.gitignore
Dockerfile
docker-compose.yml
nginx.conf
onyx2/cache/*.cache.php
onyx2/cache/signatures/*.sign
onyx2/log/*.log

View File

@ -1,7 +1,8 @@
#!/bin/sh
[ -n "$MYSQL_DATABASE" ] && sed -i -r "/db/s/=\s*'([^']*)'/= '${MYSQL_DATABASE}'/" onyx2/db/default.profile.php
[ -n "$MYSQL_HOST" ] && sed -i -r "/host/s/=\s*'([^']*)'/= '${MYSQL_HOST}'/" onyx2/db/default.profile.php
# superseed in onyx2/db/default.profile.php
#[ -n "$MYSQL_HOST" ] && sed -i -r "/host/s/=\s*'([^']*)'/= '${MYSQL_HOST}'/" onyx2/db/default.profile.php
[ -n "$MYSQL_USER" ] && sed -i -r "/user/s/=\s*'([^']*)'/= '${MYSQL_USER}'/" onyx2/db/default.profile.php
[ -n "$MYSQL_PASSWORD" ] && sed -i -r "/pass/s/=\s*'([^']*)'/= '${MYSQL_PASSWORD}'/" onyx2/db/default.profile.php

View File

@ -3,7 +3,11 @@
if(!defined('ONYX')) exit;
$___profile['db'] = 'hb_game';
$___profile['host'] = 'localhost';
if (getenv("MYSQL_HOST") === False) {
$___profile['host'] = 'localhost';
} else {
$___profile['host'] = getenv("MYSQL_HOST");
}
$___profile['user'] = 'hb';
$___profile['pass'] = 'hb';

View File

@ -4,6 +4,9 @@ if(!defined('ONYX')) exit;
if (empty($sess->values["connected"]) && !defined("xCSRF"))
define("xCSRF", true);
//A passer a True pour dev tranquillou (pas d'envois de mail, pas de https,...)
define("DEV", getenv("DEV"));
require_once("function.php"); //Inclusion des fonctions principales
require_once("tables.php"); //Inclusion des noms des tables de base de données correspondant à l'architecture du serveur
@ -50,10 +53,11 @@ if (!empty($sess->values["connected"]))
unset($header);
//Evite les attaques CSRF
if (!empty($_SERVER["HTTP_REFERER"]) && !(preg_match('#^https://'.$_SERVER['HTTP_HOST'].'#', $_SERVER["HTTP_REFERER"]) && defined("xCSRF")))
if (DEV) { $protocole = "http"; } else { $protocole = "https"; }
if (!empty($_SERVER["HTTP_REFERER"]) && !(preg_match('#^'.$protocole.'://'.$_SERVER['HTTP_HOST'].'#', $_SERVER["HTTP_REFERER"]) && defined("xCSRF")))
{
elog("Possibilité d'attaque CSRF\n".var_export($_REQUEST, TRUE), 2);
unset($_POST, $_GET);
$_GET = $_POST = array();
}
?>
?>

View File

@ -147,7 +147,13 @@ if (isset($_POST['HB_pseudo']) && isset($_POST['HB_mdp']) && isset($_POST['HB_co
//$mail->Subject='Halo-Battle :: Pre-Inscription';
//$mail->Body='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Halo-Battle :: Pr&eacute;-Inscription</title></head><body><p>F&eacute;licitations '.$pseudo.' !<br />Votre compte vient d&#39;&ecirc;tre enregistr&eacute; sur notre serveur. Un mail de confirmation vous sera envoy&eacute; lors de la sortie du jeu en ligne Halo-Battle. Si vous ne recevez pas l\'email de confirmation, <a href="mailto:technique@halo-battle.s-fr.com">contactez un administrateur</a>.<br /><br />A tr&egrave;s bient&ocirc;t pour la sortie d&#39;Halo-Battle !</p></body></html>';
if(!$mail->Send()){
if (DEV) {
$ret = true;
} else {
$ret = $mail->Send();
}
if(!$ret){
$template->assign('message','Erreur lors de l\'envoie du courriel de confirmation !<br /><br /><small><i>'.$mail->ErrorInfo.'</i></small><br /><br />Si le problème perciste, <a href="mailto:technique@halo-battle.fr">contactez un administrateur</a>.');
$template->assign('couleur','red');
$template->display('cms/erreur.tpl');

View File

@ -16,7 +16,8 @@ if (!empty($_GET['i'])) {
case 1:
//$url = "http://battle.halo.fr/";
//$url = "http://hb.s-fr.com/beta.php";
$url = "https://beta.halo-battle.fr/";
//$url = "https://beta.halo-battle.fr/";
$url = 'http://'.$_SERVER['HTTP_HOST'].'/';
break;
default:
$url = "http://battle.halo.fr/";

View File

@ -24,7 +24,7 @@ function bithex($var)
}
function cxor($msg,$cle)
{
{
$xor = NULL;
for($i = 0; $i < strlen($msg);$i++) $xor .= substr($msg,$i,1) ^ substr($cle,$i % strlen($cle),1);
return $xor;
@ -45,19 +45,19 @@ function uniquehash($var,$length=128,$raw=FALSE)
{
$hashs = array('tiger192,4','haval256,5','md5','snefru','gost','ripemd160','whirlpool');
$r = hash('sha512',$var,TRUE);
foreach($hashs as $algo) $r = cxor(strrev($r),hash($algo,strrev($r),TRUE));
if($length % 8 == 0 && $length >=128 && $length <= 512) $r = substr($r,0,$length/8);
if(!$raw) $r = strhex($r);
return $r;
}
function temphash($var,$length=128,$raw=FALSE)
{
if(!$val = Cache::read('_temphash')) Cache::set('_temphash',$val = hexstr(random()));
return uniquehash(cxor($var,$val),$length,$raw);
}
@ -70,7 +70,7 @@ function decode_ip($int_ip)
function encode_ip($dotquad_ip=FALSE)
{
if(!$dotquad_ip) $dotquad_ip = $_SERVER['REMOTE_ADDR'];
$ip_sep = explode('.', $dotquad_ip);
if (empty($ip_sep[3])) $ip_sep = explode('.', "127.0.0.1");
return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
@ -79,9 +79,9 @@ function encode_ip($dotquad_ip=FALSE)
function url($string,$external=FALSE)
{
if($external) return htmlspecialchars($string);
global $VAR;
if(!empty($VAR['rewrite_url']))
{
$masque = $VAR['rewrite_url']['masque'];
@ -91,4 +91,4 @@ function url($string,$external=FALSE)
}
else return htmlspecialchars($string);
}
?>
?>