From b87257b7348273b5dfb35d0f94a8b0a6b7e3ff6e Mon Sep 17 00:00:00 2001 From: Daniel Intrieri <119604034+Twindrillss@users.noreply.github.com> Date: Mon, 29 Jan 2024 10:45:34 +0100 Subject: [PATCH] Update funzioni.php url dinamico --- funzioni.php | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/funzioni.php b/funzioni.php index ce8611d..6ae99e8 100644 --- a/funzioni.php +++ b/funzioni.php @@ -14,13 +14,22 @@ $results = $wpdb->get_results($query); $controllo = false; +$selezionesenzafine = false; foreach ($results as $result) { + + + $dataconfrontoiniziounix = strtotime($result->data_partenza); $dataconfrontofineunix = strtotime($result->data_fine); +$hafine = $result->hafine; + +if ($hafine){ + + if (!$selezionesenzafine){ if ($datacorrenteunix <= $dataconfrontofineunix){ if ($datacorrenteunix >= $dataconfrontoiniziounix){ $controllo = true; @@ -28,14 +37,23 @@ if ($datacorrenteunix <= $dataconfrontofineunix){ $urlfileprescelto = $result->url_completo; } } - + } +} else { + $controllo = true; + $selezionesenzafine = true; + $nomefileprescelto = $result->nome_file; + $urlfileprescelto = $result->url_completo; + +} } if ($controllo){ - $urlcomp = get_home_url().'/wp-content/plugins/ieimenupdf/menu/'; + $cartelle = dirname(__FILE__); + $ultimacartella = basename($cartelle); + $urlcomp = get_home_url().'/wp-content/plugins/'.$ultimacartella.'/menu/'; $finalurl = $urlcomp.$urlfileprescelto; @@ -228,7 +246,10 @@ function generajsmodal() { function generahtmlmodal($filepdf){ - $urlcomp = get_home_url().'/wp-content/plugins/ieimenupdf/'; + $cartelle = dirname(__FILE__); + $ultimacartella = basename($cartelle); + + $urlcomp = get_home_url().'/wp-content/plugins/'.$ultimacartella.'/'; return '