Attention ! Gitlab fournissant maintenant nativement des certificats Let’s Encrypt aux domaines personnalisés des Gitlab Pages, nous avons coupé notre service qui le faisait automatiquement pour vous.

Il est impératif, pour que votre domaine personnalisé continue à avoir un certificat Let’s Encrypt à jour, d’activer la fonctionnalité native dans les paramètres de votre projet. Cette activation remplacera votre certificat actuel par un nouveau certificat Let’s Encrypt géré par Gitlab.

Voir les détails sur https://docs.framasoft.org/fr/gitlab/gitlab-pages-le.html

Commit 3f93766c authored by Vincent Dubois's avatar Vincent Dubois Committed by Vincent Dubois

Commentaire dans le php + Suppression de code inutilisé

parent 9fde0047
......@@ -187,7 +187,6 @@ class Geocropping {
$osm.on('connected', () => {
$(this).trigger('userConnected');
//console.trace('myGeocropping', 'connected');
this.notify.ConnectionOK();
this.updateUserDetails();
});
......
This diff is collapsed.
<?php
require_once('geocropping.php');
$useSession = true;
require_once ('geocropping.php');
if ($useSession) {
// d * h * min * s
$timeoutSession = 30 * 24 * 60 * 60; // ~1 mois
ini_set("session.gc_maxlifetime", $timeoutSession);
session_set_cookie_params($timeoutSession);
session_name('OSM');
$timeoutSession = 30 * 24 * 60 * 60; // ~1 mois
ini_set("session.gc_maxlifetime", $timeoutSession);
session_set_cookie_params($timeoutSession);
session_name('OSM');
session_start();
}
session_start();
if ($_REQUEST['devMode']) {
$_SESSION['devMode'] = $_REQUEST['devMode'];
}
// gère les differentes requetes utilisant OAuth
$geocropping = new Geocropping( $_SESSION['devMode'] === 'true' ? 'DEV' : 'PROD');
$geocropping = new Geocropping($_SESSION['devMode'] === 'true' ? 'DEV' : 'PROD');
switch ($_REQUEST['action']) {
case null:
case '':
case null :
case '' :
// REQUEST TOKEN
if (($err = $geocropping->requestToken()) === true) { // 1
if ( ($err = $geocropping->requestToken()) === true) { // 1
// garder le token pour le réustiliser dans le access token
$_SESSION['request_token'] = $geocropping->oauthRequestToken;
$location = $geocropping->getAuthorizeUrl();
header('Location: '.$location); // 2
} else {
header('Location: ' . $location); // 2
}
else {
// afficher tout en cas d'erreur
header('Content-Type: application/json');
die(json_encode($err));
}
break;
case 'access_token':
case 'access_token' :
// ACCESS TOKEN
if (!empty($_REQUEST['oauth_token']) && !empty($_REQUEST['request_secret'])) {
$geocropping->oauthRequestToken = new OAuthToken($_REQUEST['oauth_token'], $geocropping->decrypteTokenValue($_REQUEST['request_secret']));
if (!empty($_REQUEST['oauth_token']) && !empty($_SESSION['request_token'])) {
//TODO: vérifier si le token de la requete et le même que celui de la session ?
$geocropping->oauthRequestToken = $_SESSION['request_token'];
unset($_SESSION['request_token']);
$tokenAccess = $geocropping->getAccessToken(); // 3
$callback;
if (!empty($tokenAccess->key) && !empty($tokenAccess->secret)) {
if ($useSession) {
$_SESSION['access_token'] = $tokenAccess;
$callback = '../';
} else {
// aller sur la page de callback avec le token ecrypté
$callback = 'callback.html?'.http_build_query([oauth_token=>$tokenAccess->key,access_secret=>$geocropping->encrypteTokenValue($tokenAccess->secret),callback=>'../'], '', '&');
}
header('Location: '.$callback);
//sauvegarde le token de l'utilisateur et retourner sur la carte
$_SESSION['access_token'] = $tokenAccess;
$callback = '../';
header('Location: ' . $callback);
}
} else {
}
else {
http_response_code(400);
}
break;
case 'request_api':
case 'request_api' :
// API
$data;
if ($useSession /*&& !empty($_SESSION['access_token'])*/) {
// with session
$geocropping->oauthAccessToken = $_SESSION['access_token'];
$data = $geocropping->handleRequestAPI($_REQUEST['command'], $_REQUEST['options']); // 4
} elseif (!empty($_REQUEST['oauth_token'] && !empty($_REQUEST['access_secret']))) {
// without session
$geocropping->oauthAccessToken->key = $_REQUEST['oauth_token'];
$geocropping->oauthAccessToken->secret = $geocropping->decrypteTokenValue($_REQUEST['access_secret']);
$data = $geocropping->handleRequestAPI($_REQUEST['command'], $_REQUEST['options']); // 4
}/* else {
//error
// Not connected
http_response_code(401);
die();
}*/
// faire la requete avec les paramètres associer
$geocropping->oauthAccessToken = $_SESSION['access_token'];
$data = $geocropping->handleRequestAPI($_REQUEST['command'], $_REQUEST['options']); // 4
/*if ($_SESSION['devMode'] && $data['res']['headers']['response_code'] == 401) {
$data['res']['headers']['response_code'] = 400;
}*/
// définir le status de retour comme celui de la requete OSM
http_response_code($data['res']['headers']['response_code']);
// réponse ok
if ($data['res']['headers']['response_code'] >= 200 && $data['res']['headers']['response_code'] <= 299) {
// afficher les donné du retour si pas d'erreur
header('Content-Type: '.$data['res']['headers']['Content-Type']);
//définir le content-type de retour comme celui de la requete OSM
header('Content-Type: ' . $data['res']['headers']['Content-Type']);
if (strpos($data['res']['headers']['Content-Type'], 'application/json') !== false) {
// le contenu est du json, l'encoder
die(json_encode($data['res']['body']));
} elseif (!empty($data['res']['body'])) {
}
elseif (!empty($data['res']['body'])) {
die($data['res']['body']);
} else {
}
else {
// si aucun contenu, afficher tout les données ?
header('Content-Type: application/json');
die(json_encode($data));
}
} else {
}
else {
// afficher tout en cas d'erreur
header('Content-Type: application/json');
die(json_encode($data));
}
break;
case 'is_connected':
$connected = empty($_SESSION['access_token'])?'false':'true';
case 'is_connected' :
// vérifier si un token est présent
$connected = empty($_SESSION['access_token']) ? 'false' : 'true';
header('Content-Type: application/json');
die(json_encode([connected=>$connected]));
die(json_encode([connected => $connected]));
break;
case 'logout':
case 'logout' :
// supprimer la session
if (!empty($_SESSION['access_token'])) {
session_destroy();
$params = session_get_cookie_params();
......@@ -107,6 +108,6 @@ switch ($_REQUEST['action']) {
}
http_response_code(204);
break;
default:
default :
http_response_code(400);
}
{
// The tab key will cycle through the settings when first created
// Visit http://wbond.net/sublime_packages/sftp/settings for help
// sftp, ftp or ftps
"type": "sftp",
"save_before_upload": true,
"upload_on_save": false,
"sync_down_on_open": false,
"sync_skip_deletes": false,
"sync_same_age": true,
"confirm_downloads": false,
"confirm_sync": true,
"confirm_overwrite_newer": false,
"host": "web01",
"user": "devvdubois",
"password": "ohmudohDo6",
//"port": "22",
"remote_path": "/var/www/restricted/ssh/devvdubois/www/OSM/geocropping-dev/",
"ignore_regexes": [
"\\.sublime-(project|workspace)", "sftp-config(-alt\\d?)?\\.json",
"sftp-settings\\.json", "/venv/", "\\.svn/", "\\.hg/", "\\.git/",
"\\.bzr", "_darcs", "CVS", "\\.DS_Store", "Thumbs\\.db", "desktop\\.ini"
],
//"file_permissions": "664",
//"dir_permissions": "775",
//"extra_list_connections": 0,
"connect_timeout": 30,
//"keepalive": 120,
//"ftp_passive_mode": true,
//"ftp_obey_passive_host": false,
//"ssh_key_file": "~/.ssh/id_rsa",
//"sftp_flags": ["-F", "/path/to/ssh_config"],
//"preserve_modification_times": false,
//"remote_time_offset_in_hours": 0,
//"remote_encoding": "utf-8",
//"remote_locale": "C",
//"allow_config_upload": false,
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment