2
0
stany.ferer 3 сар өмнө
parent
commit
210fe711c7

+ 1 - 0
core/class/access.class.php

@@ -334,6 +334,7 @@ class access
     public static function recordAccess(){
         $post = core::getPost();
         $data = [];
+        
         foreach ($post as $keyPost => $valuePost) {
             if($valuePost == 1 OR $valuePost == 2){
                 $tmp = explode("-", $keyPost);

+ 2 - 1
core/class/blacklist.class.php

@@ -12,7 +12,8 @@ class blacklist {
     }
 
     public static function isValidIPv4() {
-        return (ENVIRONNEMENT == "DEV") ? TRUE : filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== FALSE;
+        $isDev = (strpos($_SERVER['HTTP_HOST'], 'local.') === 0); // Vérifie c'est une URL local de développement
+        return $isDev ? TRUE : filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== FALSE;
     }
 
     private static function getFullUrl() { $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https://' : 'http://';

+ 6 - 0
core/class/debug.class.php

@@ -6,6 +6,12 @@ class debug
     private static $startTime;
     private static $closeTime;
 
+    public static function display_errors(){
+        ini_set('display_errors', 1);
+        ini_set('display_startup_errors', 1);
+        error_reporting(E_ALL);
+    }
+    
     private static function typeFile(string $_string){
         switch ($_string) {
             case 'maintenance':

+ 2 - 3
public-cms/404.php

@@ -2,8 +2,7 @@
 require_once "../core/class/blacklist.class.php";
 new blacklist;
 
-
-if(!blacklist::isValidIPv4()){
+if(blacklist::isValidIPv4()){
     $result = blacklist::execute();
 } else {
     $result = ["error" => 404, "text" => "La page que vous cherchez n'existe pas."];
@@ -55,4 +54,4 @@ http_response_code($result["error"]);
         <h1><?= $result["error"] ?></h1>
         <p><?= $result["text"] ?></p>
 </body>
-</html>
+</html>