Skip to content

Commit

Permalink
fix widget_donation_bar_goal
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMartineau committed Aug 23, 2024
1 parent ad12803 commit 9de2754
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
16 changes: 8 additions & 8 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
$encryption_key = $_ENV['ENCRYPTION_KEY'];

// Initialiser les variables de session
// Mettre à jour la variable de session pour l'environnement
$_SESSION['environment'] = $environment;
$_SESSION['client_id'] = $_ENV['CLIENT_ID_' . $environment];
$_SESSION['client_secret'] = $_ENV['CLIENT_SECRET_' . $environment];
$_SESSION['blob_url'] = $_ENV['BLOB_URL_' . $environment];
$_SESSION['api_url'] = $_ENV['API_URL_' . $environment];
$_SESSION['api_auth_url'] = $_ENV['API_AUTH_URL_' . $environment];
$_SESSION['website_domain'] = $isLocal == true ? $_ENV['WEBSITE_LOCAL_DOMAIN'] : $_ENV['WEBSITE_DOMAIN'];
// Mettre à jour la variable de session pour l'environnement
$_SESSION['environment'] = $environment;
$_SESSION['client_id'] = $_ENV['CLIENT_ID_' . $environment];
$_SESSION['client_secret'] = $_ENV['CLIENT_SECRET_' . $environment];
$_SESSION['blob_url'] = $_ENV['BLOB_URL_' . $environment];
$_SESSION['api_url'] = $_ENV['API_URL_' . $environment];
$_SESSION['api_auth_url'] = $_ENV['API_AUTH_URL_' . $environment];
$_SESSION['website_domain'] = $isLocal == true ? $_ENV['WEBSITE_LOCAL_DOMAIN'] : $_ENV['WEBSITE_DOMAIN'];

// Options de connexion
$options = [
Expand Down
10 changes: 2 additions & 8 deletions widget_donation_bar_goal.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@
die("Aucun widget trouvé pour le Charity Stream ID fourni.");
}

// Récupérer les données du charity stream en fonction du GUID
$charityStream = GetCharityStreamByGuidDB($db, $environment, $guidBinary);
if (!$charityStream) {
die("Aucun charity stream trouvé pour le Charity Stream ID fourni.");
}

// Initialisation des valeurs de départ
$goalAmount = (int)$donationGoalWidget['goal'];
$currentAmount = 0;
Expand Down Expand Up @@ -73,7 +67,7 @@ function updateDonationBar(currentAmount) {

async function fetchDonationAmount() {
try {
// Appel AJAX vers un script PHP pour récupérer les données de l'API côté serveur
// Appel AJAX vers un script PHP pour récupérer les données de l'API côté serveur
const response = await fetch('fetch_donations.php?charityStreamId=<?php echo $charityStreamId; ?>');
const data = await response.json();

Expand All @@ -87,7 +81,7 @@ function updateDonationBar(currentAmount) {
}

// Appel API toutes les 15 secondes
setInterval(fetchDonationAmount, 2000);
setInterval(fetchDonationAmount, 10000);
</script>
</body>
</html>

0 comments on commit 9de2754

Please sign in to comment.