forked from jeedom/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
73 lines (71 loc) · 3.05 KB
/
index.php
File metadata and controls
73 lines (71 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/* This file is part of Jeedom.
*
* Jeedom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Jeedom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
*/
if (!isset($_GET['v'])) {
$useragent = (isset($_SERVER["HTTP_USER_AGENT"])) ? $_SERVER["HTTP_USER_AGENT"] : 'none';
if (stristr($useragent, "Android") || strpos($useragent, "iPod") || strpos($useragent, "iPhone") || strpos($useragent, "Mobile") || strpos($useragent, "WebOS") || strpos($useragent, "mobile") || strpos($useragent, "hp-tablet")) {
header("location: index.php?v=m");
} else {
header("location: index.php?v=d");
}
} else {
require_once dirname(__FILE__) . "/core/php/core.inc.php";
if ($_GET['v'] == "d") {
if (isset($_GET['modal'])) {
include_file('core', 'authentification', 'php');
try {
if (!isConnect()) {
throw new Exception('{{401 - Accès non autorisé}}');
}
include_file('desktop', init('modal'), 'modal', init('plugin'));
} catch (Exception $e) {
if ($e->getCode() == 35486 && strpos(init('modal'), 'help') !== false) {
echo '<div class="alert alert-warning div_alert">';
echo 'Il n\'y a encore aucune aide sur cette page pour le moment';
echo '</div>';
} else {
$_folder = 'desktop/modal';
if (init('plugin') != '') {
$_folder = 'plugins/' . init('plugin') . '/' . $_folder;
}
ob_end_clean(); //Clean pile after expetion (to prevent no-traduction)
echo '<div class="alert alert-danger div_alert">';
echo translate::exec(displayExeption($e), $_folder . '/' . init('modal') . '.php');
echo '</div>';
}
}
} else {
include_file('desktop', 'index', 'php');
}
} else if ($_GET['v'] == "m") {
if (isset($_GET['modal'])) {
include_file('mobile', init('modal'), 'modal', init('plugin'));
} else {
if (isset($_GET['p'])) {
if (isset($_GET['m'])) {
include_file('mobile', $_GET['p'], 'html', $_GET['m']);
} else {
include_file('mobile', $_GET['p'], 'html');
}
} else {
include_file('mobile', 'index', 'html');
}
}
} else {
echo "Erreur veuillez contacter l'administrateur";
}
}
?>