Conditions | 4 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | function editFileAction($templateName) |
||
1 ignored issue
–
show
|
|||
23 | { |
||
24 | $template = \View\Template::get($templateName, \App::$primary); |
||
25 | if (!empty($_GET['path']) && file_exists($template->path . '/' . Tools::parsePath($_GET['path']))) { |
||
26 | $code = file_get_contents("php://input"); |
||
27 | if (!empty($code)) { |
||
28 | $result = new Server\Result(); |
||
29 | $result->successMsg = 'Файл сохранен'; |
||
30 | $content = file_put_contents($template->path . '/' . Tools::parsePath($_GET['path']), $code); |
||
31 | $result->send(); |
||
32 | } |
||
33 | $content = file_get_contents($template->path . '/' . Tools::parsePath($_GET['path'])); |
||
34 | $this->libs->loadLib('Ace'); |
||
35 | $this->view->page(['content' => 'template/edit', 'data' => compact('template', 'content')]); |
||
36 | } else { |
||
37 | $this->view->page(['content' => 'chooseFile', 'data' => compact('template')]); |
||
38 | } |
||
39 | } |
||
40 | |||
42 |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.