diff --git a/core/core.php b/core/core.php index c97d46c8..4fd0fd3a 100644 --- a/core/core.php +++ b/core/core.php @@ -34,7 +34,7 @@ class common { const TEMP_DIR = 'site/tmp/'; // Numéro de version - const ZWII_VERSION = '10.0.020.dev'; + const ZWII_VERSION = '10.0.021.dev'; public static $actions = []; public static $coreModuleIds = [ diff --git a/core/module/config/config.php b/core/module/config/config.php index 1145d292..05684cf1 100755 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -473,46 +473,36 @@ class config extends common { */ public function updateBaseUrl () { // Récuperer les données - // Les contrôles ont été effectués sur la page de formulaire - $old = $this->getData(['core', 'baseUrl']); - $oldCheckRw = strpos($old,'/?') > 0 ? false : true; - $new = helper::baseUrl(true,false); - $newCheckRw = strpos($new,'/?') > 0 ? false : true; - var_dump($oldCheckRw); - echo "-"; - echo strpos($new,'?') ; - var_dump($newCheckRw); - die(); + // Supprimer l'information de redirection + //$old = str_replace('?','',$this->getData(['core', 'baseUrl'])); + $old = str_replace('?','',$this->getData(['core', 'baseUrl'])); + $new = helper::baseUrl(false,false); + $success = false ; // Boucler sur les pages foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) { - $content = $this->getData(['page',$parentId,'content']); - if ($oldCheckRw === helper::checkRewrite() || - ($oldCheckRw === false && helper::checkRewrite() === true) - ) { - $replace = str_replace( $old , $new , $content); + $content = $this->getData(['page',$parentId,'content']); + $replace = str_replace( $old , $new , stripslashes($content),$count) ; + if ($count > 0) { + $success = true; $this->setData(['page',$parentId,'content', $replace ]); - } elseif ($oldCheckRw === true && helper::checkRewrite() === false) { - die(); } - foreach($childIds as $childId) { $content = $this->getData(['page',$childId,'content']); - if ($oldCheckRw === helper::checkRewrite() || - $oldCheckRw === false && helper::checkRewrite() === true - ) { - $replace = str_replace( $old , $new , $content); + $replace = str_replace( $old , $new, stripslashes($content),$count) ; + if ($count > 0) { + $success = true; $this->setData(['page',$childId,'content', $replace ]); - } + } } - + } + if ($success === true) { + $this->setData(['core','baseUrl',helper::baseUrl(true,false)]); } - - $this->setData(['core','baseUrl',helper::baseUrl(true,false)]); // Valeurs en sortie $this->addOutput([ - 'notification' => 'Conversion effectuée', + 'notification' => $success ? 'Conversion effectuée' : 'Aucune conversion', 'redirect' => helper::baseUrl() . 'config/manage', - 'state' => true + 'state' => $success ? true : false ]); } }