diff --git a/CHANGES.md b/CHANGES.md index 0fa8448b..826701cb 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,10 @@ # Changelog +## version 9.2.28 +- Corrections : + - Mise à jour auto fonctionnelle + - Décalage du thème hors de l'écran + ## version 9.2.27 - Corrections : - Pages d'administration, thème spécifique diff --git a/core/core.php b/core/core.php old mode 100644 new mode 100755 index d82bf4f0..25bdda5f --- a/core/core.php +++ b/core/core.php @@ -1099,6 +1099,16 @@ class common { $this->setData(['core', 'dataVersion', 9227]); $this->saveData(); } + + // Version 9.2.28 + if($this->getData(['core', 'dataVersion']) < 9228) { + // Contrôle des options php.ini pour la mise à jour auto + if (helper::urlGetContents('http://zwiicms.com/update/' . common::ZWII_UPDATE_CHANNEL . '/version') === false) { + $this->setData(['config','autoUpdate',false]); + } + $this->setData(['core', 'dataVersion', 9228]); + $this->saveData(); + } } } @@ -1679,6 +1689,27 @@ class helper { const FILTER_TIMESTAMP = 10; const FILTER_URL = 11; + /** + * Fonction pour récupérer le numéro de version en ligne + * @param string $url à récupérer + * @return mixed données récupérées + */ + + public static function urlGetContents ($url) { + if(function_exists('file_get_contents') and + ini_get('allow_url_fopen') ){ + $url_get_contents_data = file_get_contents($url); + }elseif(function_exists('fopen') && + function_exists('stream_get_contents' && + ini_get('allow_url_fopen') )){ + $handle = fopen ($url, "r"); + $url_get_contents_data = stream_get_contents($handle); + }else{ + $url_get_contents_data = false; + } + return $url_get_contents_data; + } + /** * Retourne les valeurs d'une colonne du tableau de données * @param array $array Tableau cible @@ -2632,16 +2663,20 @@ class layout extends common { $rightItems .= '
  • ' . template::ico('brush') . '
  • '; $rightItems .= '
  • ' . template::ico('cog-alt') . '
  • '; // Mise à jour automatique - $lastAutoUpdate = mktime(0, 0, 0); + // Une mise à jour est disponible + recherche auto activée + 1 jour de délais + $lastAutoUpdate = mktime(0, 0, 0); if( $this->getData(['config','autoUpdate']) === true && - $lastAutoUpdate > $this->getData(['core','lastAutoUpdate']) + 86400 ) { - $this->setData(['core','lastAutoUpdate',$lastAutoUpdate]); - if ( helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL) ) { - $rightItems .= '
  • ' . template::ico('update colorRed') . '
  • '; - } - $this->saveData(); - } - } + $lastAutoUpdate > $this->getData(['core','lastAutoUpdate']) + 86400 && + helper::checkNewVersion(common::ZWII_UPDATE_CHANNEL)) { + $this->setData(['core','updateAvailable', true]); + $this->setData(['core','lastAutoUpdate',$lastAutoUpdate]); + } + // Afficher le bouton : Mise à jour détectée + activée + if ( $this->getData(['core','updateAvailable']) === true && + $this->getData(['config','autoUpdate']) === true ) { + $rightItems .= '
  • ' . template::ico('update colorRed') . '
  • '; + } + } $rightItems .= '
  • ' . template::ico('user', 'right') . '' . $this->getUser('firstname') . ' ' . $this->getUser('lastname') . '
  • '; $rightItems .= '
  • ' . template::ico('logout') . '
  • '; // Barre de membre