Skip to content

Commit 3358b82

Browse files
authored
Merge pull request #83 from jeedom/beta
Merge
2 parents e059204 + 97bb39d commit 3358b82

32 files changed

Lines changed: 2337 additions & 2033 deletions

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ nbproject/
22
test.php
33
core/config/common.config.php
44
plugins
5-
sftp-config.json
5+
deployment-config.json
66
.project
7-
.vscode/settings.json
7+
.remote-sync.json
8+
.vscode

core/ajax/script.ajax.php

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -24,70 +24,7 @@
2424
throw new Exception(__('401 - Accès non autorisé', __FILE__));
2525
}
2626

27-
if (init('action') == 'getScriptContent') {
28-
$path = init('path');
29-
if (!file_exists($path)) {
30-
throw new Exception(__('Aucun fichier trouvé : ', __FILE__) . $path);
31-
}
32-
if (!is_readable($path)) {
33-
throw new Exception(__('Impossible de lire : ', __FILE__) . $path);
34-
}
35-
if (is_dir($path)) {
36-
throw new Exception(__('Impossible de lire un dossier : ', __FILE__) . $path);
37-
}
38-
$pathinfo = pathinfo($path);
39-
$return = array(
40-
'content' => file_get_contents($path),
41-
'extension' => $pathinfo['extension']
42-
);
43-
ajax::success($return);
44-
}
45-
46-
if (init('action') == 'saveScriptContent') {
47-
$path = init('path');
48-
if (!file_exists($path)) {
49-
throw new Exception(__('Aucun fichier trouvé : ', __FILE__) . $path);
50-
}
51-
if (!is_writable($path)) {
52-
throw new Exception(__('Impossible d\'écrire dans : ', __FILE__) . $path);
53-
}
54-
if (is_dir($path)) {
55-
throw new Exception(__('Impossible d\'écrire un dossier : ', __FILE__) . $path);
56-
}
57-
file_put_contents($path, init('content'));
58-
chmod($path, 0770);
59-
ajax::success();
60-
}
61-
62-
if (init('action') == 'removeScript') {
63-
$path = init('path');
64-
if (!file_exists($path)) {
65-
throw new Exception(__('Aucun fichier trouvé : ', __FILE__) . $path);
66-
}
67-
if (!is_writable($path)) {
68-
throw new Exception(__('Impossible d\'écrire dans : ', __FILE__) . $path);
69-
}
70-
if (is_dir($path)) {
71-
throw new Exception(__('Impossible de supprimer un dossier : ', __FILE__) . $path);
72-
}
73-
if(!unlink($path)){
74-
throw new Exception(__('Impossible de supprimer le fichier : ', __FILE__) . $path);
75-
}
76-
ajax::success();
77-
}
78-
79-
80-
if (init('action') == 'addUserScript') {
81-
$path = realpath(calculPath(config::byKey('userScriptDir', 'script')));
82-
$path .= '/' . init('name');
83-
if (!touch($path)) {
84-
throw new Exception(__('Impossible d\'écrire dans : ', __FILE__) . $path);
85-
}
86-
ajax::success($path);
87-
}
88-
8927
throw new Exception(__('Aucune méthode correspondante à : ', __FILE__) . init('action'));
9028
} catch (Exception $e) {
91-
ajax::error(displayExeption($e), $e->getCode());
29+
ajax::error(displayException($e), $e->getCode());
9230
}
93-
?>

0 commit comments

Comments
 (0)