|
@@ 464-473 (lines=10) @@
|
| 461 |
|
* @param string $folder |
| 462 |
|
* @return bool |
| 463 |
|
*/ |
| 464 |
|
public static function add_htaccess_deny_from_all( $folder = '' ) { |
| 465 |
|
$folder = EEH_File::standardise_and_end_with_directory_separator( $folder ); |
| 466 |
|
if ( ! EEH_File::exists( $folder . '.htaccess' ) ) { |
| 467 |
|
if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) { |
| 468 |
|
return FALSE; |
| 469 |
|
} |
| 470 |
|
} |
| 471 |
|
|
| 472 |
|
return TRUE; |
| 473 |
|
} |
| 474 |
|
|
| 475 |
|
/** |
| 476 |
|
* Adds an index file to this folder, so folks can't list all the file's contents |
|
@@ 480-488 (lines=9) @@
|
| 477 |
|
* @param string $folder |
| 478 |
|
* @return boolean |
| 479 |
|
*/ |
| 480 |
|
public static function add_index_file( $folder ) { |
| 481 |
|
$folder = EEH_File::standardise_and_end_with_directory_separator( $folder ); |
| 482 |
|
if ( ! EEH_File::exists( $folder . 'index.html' ) ) { |
| 483 |
|
if ( ! EEH_File::write_to_file( $folder . 'index.html', 'You are not permitted to read from this folder', '.html' )) { |
| 484 |
|
return false; |
| 485 |
|
} |
| 486 |
|
} |
| 487 |
|
return true; |
| 488 |
|
} |
| 489 |
|
|
| 490 |
|
|
| 491 |
|
|