| @@ 588-597 (lines=10) @@ | ||
| 585 | * @param string $folder |
|
| 586 | * @return bool |
|
| 587 | */ |
|
| 588 | public static function add_htaccess_deny_from_all(string $folder = ''): bool |
|
| 589 | { |
|
| 590 | $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
| 591 | if (! EEH_File::exists($folder . '.htaccess')) { |
|
| 592 | if (! EEH_File::write_to_file($folder . '.htaccess', 'deny from all', '.htaccess')) { |
|
| 593 | return false; |
|
| 594 | } |
|
| 595 | } |
|
| 596 | ||
| 597 | return true; |
|
| 598 | } |
|
| 599 | ||
| 600 | ||
| @@ 607-615 (lines=9) @@ | ||
| 604 | * @param string $folder |
|
| 605 | * @return boolean |
|
| 606 | */ |
|
| 607 | public static function add_index_file(string $folder): bool |
|
| 608 | { |
|
| 609 | $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
| 610 | if (! EEH_File::exists($folder . 'index.php')) { |
|
| 611 | if (! EEH_File::write_to_file( |
|
| 612 | $folder . 'index.php', |
|
| 613 | 'You are not permitted to read from this folder', |
|
| 614 | '.php' |
|
| 615 | ) |
|
| 616 | ) { |
|
| 617 | return false; |
|
| 618 | } |
|