|
30 | 30 | */ |
31 | 31 | ajax::init(); |
32 | 32 |
|
| 33 | + $camera = reolink::byId(init('id')); |
| 34 | + if (!is_object($camera)) { |
| 35 | + throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__)); |
| 36 | + } |
| 37 | + |
| 38 | + |
33 | 39 | if (init('action') == 'CreateCMD') { |
34 | | - $camera = reolink::byId(init('id')); |
35 | | - if (!is_object($camera)) { |
36 | | - throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__)); |
37 | | - } |
38 | 40 | $camera->GetCamNFO(init('id')); |
39 | 41 | $res = $camera->loadCmdFromConf(init('id')); |
40 | 42 |
|
|
46 | 48 | } |
47 | 49 |
|
48 | 50 | if (init('action') == 'CheckConnexion') { |
49 | | - $camera = reolink::byId(init('id')); |
50 | | - if (!is_object($camera)) { |
51 | | - throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__)); |
52 | | - } |
53 | 51 | $res = $camera->TryConnect(init('id')); |
54 | 52 | if ($res === true) { |
55 | 53 | ajax::success(); |
|
59 | 57 | } |
60 | 58 |
|
61 | 59 | if (init('action') == 'CheckDeviceInfo') { |
62 | | - $camera = reolink::byId(init('id')); |
63 | | - if (!is_object($camera)) { |
64 | | - throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__)); |
65 | | - } |
66 | 60 | $res = $camera->GetCamNFO(init('id')); |
67 | 61 | if ($res === true) { |
68 | 62 | ajax::success(); |
69 | 63 | } else { |
70 | | - throw new Exception(__('Impossible de se connecter à la caméra ('.$res.')', __FILE__)); |
| 64 | + throw new Exception(__('Impossible d\'obtenir les informations de la caméra ('.$res.')', __FILE__)); |
71 | 65 | } |
72 | 66 | } |
73 | 67 |
|
74 | | - if (init('action') == 'SetCAMConfig') { |
75 | | - $camera = reolink::byId(init('id')); |
76 | | - if (!is_object($camera)) { |
77 | | - throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__)); |
78 | | - } |
79 | | - $cfgGroup = init('group'); |
80 | | - if ($cfgGroup == 'EMAIL'){ |
81 | | - $res = reolink::setEmail(init('id')); |
82 | | - } |
83 | | - if ($cfgGroup == 'FTP'){ |
84 | | - $res = reolink::setFTP(init('id')); |
85 | | - } |
86 | | - |
87 | | - if ($res == 200) { |
88 | | - ajax::success(); |
89 | | - } else { |
90 | | - throw new Exception(__('Echec du paramétrage de la caméra (consultez le log pour plus de détails)', __FILE__)); |
91 | | - } |
92 | | - } |
93 | | - |
94 | 68 | if (init('action') == 'GetCAMConfig') { |
95 | | - $camera = reolink::byId(init('id')); |
96 | | - if (!is_object($camera)) { |
97 | | - throw new Exception(__('Impossible de trouver la caméra : ' . init('id'), __FILE__)); |
98 | | - } |
99 | 69 | $res = reolink::refreshNFO(init('id')); |
100 | 70 | ajax::success(); |
101 | 71 | } |
|
0 commit comments