@@ -493,13 +493,47 @@ public function license() {
493493  }
494494
495495  public  function  isLocal () {
496-     $ localhostsarray ('::1 ' , '127.0.0.1 ' , '0.0.0.0 ' );
497-     return  (
498-       in_array (server::get ('SERVER_ADDR ' ), $ localhosts
499-       server::get ('SERVER_NAME ' ) == 'localhost '  ||
500-       str::endsWith (server::get ('SERVER_NAME ' ), '.localhost ' ) ||
501-       str::endsWith (server::get ('SERVER_NAME ' ), '.test ' )
502-     );
496+ 
497+     $ hostget ('SERVER_NAME ' );
498+     $ ipget ('SERVER_ADDR ' );
499+ 
500+     if  ($ host'localhost ' ) {
501+       return  true ;
502+     }
503+ 
504+     if  (str::endsWith ($ host'.localhost ' ) === true ) {
505+       return  true ;
506+     }
507+ 
508+     if  (str::endsWith ($ host'.local ' ) === true ) {
509+       return  true ;
510+     }
511+ 
512+     if  (str::endsWith ($ host'.test ' ) === true ) {
513+       return  true ;
514+     }
515+ 
516+     if  (in_array ($ ip'::1 ' , '127.0.0.1 ' ]) === true ) {
517+ 
518+       if  (
519+         isset ($ _SERVER 'HTTP_X_FORWARDED_FOR ' ]) === true  &&
520+         in_array ($ _SERVER 'HTTP_X_FORWARDED_FOR ' ], ['::1 ' , '127.0.0.1 ' ]) === false 
521+       ) {
522+         return  false ;
523+       }
524+ 
525+       if  (
526+         isset ($ _SERVER 'HTTP_CLIENT_IP ' ]) === true  &&
527+         in_array ($ _SERVER 'HTTP_CLIENT_IP ' ], ['::1 ' , '127.0.0.1 ' ]) === false 
528+       ) {
529+         return  false ;
530+       }
531+ 
532+       // no reverse proxy or the real client also comes from localhost 
533+       return  true ;
534+     }
535+ 
536+     return  false ;
503537  }
504538
505539  public  function  notify ($ text
0 commit comments