1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Created by PhpStorm. |
4
|
|
|
* User: User |
5
|
|
|
* Date: 4/25/2019 |
6
|
|
|
* Time: 9:28 PM |
7
|
|
|
*/ |
8
|
|
|
|
9
|
|
|
namespace crocodicstudio\crudbooster\controllers; |
10
|
|
|
|
11
|
|
|
|
12
|
|
|
use crocodicstudio\crudbooster\exceptions\CBValidationException; |
13
|
|
|
use Doctrine\DBAL\Query\QueryException; |
14
|
|
|
use Illuminate\Support\Facades\DB; |
15
|
|
|
|
16
|
|
|
class DeveloperSecurityController extends Controller |
17
|
|
|
{ |
18
|
|
|
private $view = "crudbooster::dev_layouts.modules.security"; |
19
|
|
|
|
20
|
|
|
public function __construct() |
21
|
|
|
{ |
22
|
|
|
view()->share(['page_title'=>'Security']); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
public function getIndex() { |
26
|
|
|
$data = []; |
27
|
|
|
return view($this->view.".index",$data); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function postSave() |
31
|
|
|
{ |
32
|
|
|
setEnvironmentValue([ |
33
|
|
|
"APP_DEBUG"=>request("APP_DEBUG"), |
34
|
|
|
"CB_ADMIN_PATH"=>request("CB_ADMIN_PATH"), |
35
|
|
|
"CB_DISABLE_LOGIN"=>request("CB_DISABLE_LOGIN"), |
36
|
|
|
"CB_AUTO_SUSPEND_LOGIN"=>request("CB_AUTO_SUSPEND_LOGIN"), |
37
|
|
|
"CB_MAINTENANCE_MODE"=>request("CB_MAINTENANCE_MODE"), |
38
|
|
|
"CB_AUTO_REDIRECT_TO_LOGIN"=>request("CB_AUTO_REDIRECT_TO_LOGIN") |
39
|
|
|
]); |
40
|
|
|
|
41
|
|
|
if(request("htaccess_ServerSignature")) { |
42
|
|
|
putHtaccess("ServerSignature Off"); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
if(request("htaccess_IndexIgnore")) { |
46
|
|
|
putHtaccess("IndexIgnore *"); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
if(request("htaccess_dotAccess")) { |
50
|
|
|
putHtaccess(" |
51
|
|
|
<FilesMatch \"^\.\"> |
52
|
|
|
Order allow,deny |
53
|
|
|
Deny from all |
54
|
|
|
</FilesMatch>"); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
if(request("htaccess_preventVendor")) { |
58
|
|
|
putHtaccess("RewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]"); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
|
62
|
|
|
return cb()->redirectBack("Security has been updated!","success"); |
63
|
|
|
} |
64
|
|
|
} |