| 1 | <?php |
||
| 4 | class SuperSakeChecker |
||
|
|
|||
| 5 | { |
||
| 6 | /** |
||
| 7 | * Checks if the supersake file in webroot is protected with htaccess or web.config. |
||
| 8 | * |
||
| 9 | * From the command line we don't know on what server software we are running, |
||
| 10 | * so we just checking if a .htaccess or web.config exists and has the protection lines in it. |
||
| 11 | * |
||
| 12 | * If one of the files has access to the file denied, we consider this protected |
||
| 13 | * |
||
| 14 | * @return bool|string |
||
| 15 | */ |
||
| 16 | public function superSakeIsNotProtected() |
||
| 17 | { |
||
| 18 | $htaccess = $this->hasHtAccessProtection(BASE_PATH.'/.htaccess'); |
||
| 19 | $webConfig = $this->hasWebConfigProtection(BASE_PATH.'/web.config'); |
||
| 20 | |||
| 21 | // nothing is done, add the instructions |
||
| 22 | return !$htaccess && !$webConfig; |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @param string $file |
||
| 27 | * |
||
| 28 | * @return bool|string |
||
| 29 | */ |
||
| 30 | protected function hasHtAccessProtection($file) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @param string $file |
||
| 38 | * |
||
| 39 | * @return bool|string |
||
| 40 | */ |
||
| 41 | protected function hasWebConfigProtection($file) |
||
| 46 | |||
| 47 | public function htaccessContent() |
||
| 61 | |||
| 62 | public function webconfigContent() |
||
| 70 | } |
||
| 71 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.