sanitize.inc 651 B

1234567891011121314151617181920
  1. <?php
  2. if( !empty($pwd) ) {
  3. //Forbid anything starting with / and anything with .. in it; also protocol links (://)
  4. $forbidden = preg_match( "/|..|://", $pwd );
  5. if ( $forbidden ) {
  6. include 'sys/fileshare/include/forbidden.inc';
  7. die();
  8. }
  9. //Check the list of other forbidden directories
  10. $blacklist = json_decode( file_get_contents("sys/fileshare/include/blacklist.json"), true );
  11. if( !empty( $blacklist ) ) {
  12. foreach ( $blacklist as $blacklisted ) {
  13. if ( preg_match('^' . $blacklisted, $pwd) ) {
  14. include 'sys/fileshare/include/forbidden.inc';
  15. die();
  16. }
  17. }
  18. }
  19. ?>