diff --git a/.github/workflows/phpstan.yaml b/.github/workflows/phpstan.yaml
index 8d90800544..8fa5da282f 100644
--- a/.github/workflows/phpstan.yaml
+++ b/.github/workflows/phpstan.yaml
@@ -2,28 +2,34 @@ name: PHPStan
on:
push:
- branches: [ alpha ]
+ branches: [ alpha, feat/object_config ]
pull_request:
branches: [ alpha ]
jobs:
phpstan:
runs-on: ubuntu-latest
+ # define every php version to test
+ strategy:
+ # do not stop at first fail
+ fail-fast: false
+ matrix:
+ php: [7.4, 8.2]
+
steps:
- uses: actions/checkout@v4
- - name: Setup PHP 7.4 for dependencies
+ - name: Setup PHP ${{ matrix.php }} for dependencies
uses: shivammathur/setup-php@v2
with:
- php-version: 7.4
+ php-version: ${{ matrix.php }}
- name: Install Dependencies
- run: composer update --ignore-platform-reqs
-
- - name: Setup PHP 8.2 for PHPStan
- uses: shivammathur/setup-php@v2
- with:
- php-version: 8.2
+ run: |
+ # copy common.config.php for composer autoloader
+ cp core/config/common.config.sample.php core/config/common.config.php
+ # install composer dependencies
+ composer update --ignore-platform-reqs
- name: Restore PHPStan cache
id: cache-phpstan
@@ -32,12 +38,8 @@ jobs:
path: phpstan.phar
key: phpstan-1
- - name: Download PHPStan
- if: steps.cache-phpstan.outputs.cache-hit != 'true'
- run: wget https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar
-
- name: Run PHPStan
- run: php phpstan.phar analyse --configuration phpstan.neon
+ run: vendor/bin/phpstan analyse --configuration phpstan.neon
update-baseline:
needs: phpstan
@@ -50,9 +52,7 @@ jobs:
- name: Delete existing branch if exists
run: |
- if git ls-remote --heads origin update-phpstan-baseline | grep update-phpstan-baseline; then
- git push origin --delete update-phpstan-baseline
- fi
+ git ls-remote --exit-code --heads origin update-phpstan-baseline && git push origin --delete update-phpstan-baseline
- name: Setup PHP 7.4 for dependencies
uses: shivammathur/setup-php@v2
@@ -62,19 +62,11 @@ jobs:
- name: Install Dependencies
run: composer update --ignore-platform-reqs
- - name: Setup PHP 8.2 for PHPStan
- uses: shivammathur/setup-php@v2
- with:
- php-version: 8.2
-
- - name: Download PHPStan
- run: wget https://github.com/phpstan/phpstan/releases/latest/download/phpstan.phar
-
- name: Generate new baseline
id: generate-baseline
run: |
cp phpstan-baseline.neon phpstan-baseline.neon.old
- php phpstan.phar analyse --configuration phpstan.neon --generate-baseline
+ vendor/bin/phpstan analyse --configuration phpstan.neon --generate-baseline
if ! diff -q phpstan-baseline.neon phpstan-baseline.neon.old > /dev/null; then
echo "baseline_changed=true" >> $GITHUB_OUTPUT
fi
diff --git a/composer.json b/composer.json
index 25d7fc3830..417b6619d6 100644
--- a/composer.json
+++ b/composer.json
@@ -15,5 +15,24 @@
"platform": {
"php": "7.4"
}
+ },
+ "require-dev": {
+ "phpstan/phpstan": "^2.1"
+ },
+ "autoload": {
+ "psr-4": {
+ "Jeedom\\plugins\\": "plugins/"
+ },
+ "files": [
+ "core/config/common.config.php",
+ "core/php/utils.inc.php",
+ "core/config/jeedom.config.php",
+ "core/config/compatibility.config.php"
+ ],
+ "classmap": [
+ "core/class/",
+ "core/com/",
+ "core/repo/"
+ ]
}
}
diff --git a/composer.lock b/composer.lock
index b78c8572c4..53b8a65e09 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "6d3817ee337cc5ed162b1e9463030e8a",
+ "content-hash": "d2faa51c0ec5175dc36b46b3356938d9",
"packages": [
{
"name": "bacon/bacon-qr-code",
@@ -243,16 +243,16 @@
},
{
"name": "influxdata/influxdb-client-php",
- "version": "3.6.0",
+ "version": "3.8.0",
"source": {
"type": "git",
"url": "https://github.com/influxdata/influxdb-client-php.git",
- "reference": "3606b12214508f22126b7ed0565d53380674312a"
+ "reference": "59ac11d63ce030973c79d5b05797813761a0d58e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/influxdata/influxdb-client-php/zipball/3606b12214508f22126b7ed0565d53380674312a",
- "reference": "3606b12214508f22126b7ed0565d53380674312a",
+ "url": "https://api.github.com/repos/influxdata/influxdb-client-php/zipball/59ac11d63ce030973c79d5b05797813761a0d58e",
+ "reference": "59ac11d63ce030973c79d5b05797813761a0d58e",
"shasum": ""
},
"require": {
@@ -287,9 +287,9 @@
],
"support": {
"issues": "https://github.com/influxdata/influxdb-client-php/issues",
- "source": "https://github.com/influxdata/influxdb-client-php/tree/3.6.0"
+ "source": "https://github.com/influxdata/influxdb-client-php/tree/3.8.0"
},
- "time": "2024-06-24T10:01:53+00:00"
+ "time": "2025-06-26T05:12:59+00:00"
},
{
"name": "paragonie/constant_time_encoding",
@@ -1487,7 +1487,7 @@
},
{
"name": "symfony/polyfill-php73",
- "version": "v1.31.0",
+ "version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php73.git",
@@ -1543,7 +1543,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-php73/tree/v1.31.0"
+ "source": "https://github.com/symfony/polyfill-php73/tree/v1.32.0"
},
"funding": [
{
@@ -1563,16 +1563,16 @@
},
{
"name": "symfony/polyfill-php80",
- "version": "v1.31.0",
+ "version": "v1.32.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
- "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
+ "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
- "reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
+ "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
+ "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"shasum": ""
},
"require": {
@@ -1623,7 +1623,7 @@
"shim"
],
"support": {
- "source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
+ "source": "https://github.com/symfony/polyfill-php80/tree/v1.32.0"
},
"funding": [
{
@@ -1639,7 +1639,7 @@
"type": "tidelift"
}
],
- "time": "2024-09-09T11:45:10+00:00"
+ "time": "2025-01-02T08:10:11+00:00"
},
{
"name": "symfony/service-contracts",
@@ -1856,7 +1856,66 @@
"time": "2022-06-03T18:03:27+00:00"
}
],
- "packages-dev": [],
+ "packages-dev": [
+ {
+ "name": "phpstan/phpstan",
+ "version": "2.1.21",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phpstan/phpstan.git",
+ "reference": "1ccf445757458c06a04eb3f803603cb118fe5fa6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1ccf445757458c06a04eb3f803603cb118fe5fa6",
+ "reference": "1ccf445757458c06a04eb3f803603cb118fe5fa6",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.4|^8.0"
+ },
+ "conflict": {
+ "phpstan/phpstan-shim": "*"
+ },
+ "bin": [
+ "phpstan",
+ "phpstan.phar"
+ ],
+ "type": "library",
+ "autoload": {
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "PHPStan - PHP Static Analysis Tool",
+ "keywords": [
+ "dev",
+ "static analysis"
+ ],
+ "support": {
+ "docs": "https://phpstan.org/user-guide/getting-started",
+ "forum": "https://github.com/phpstan/phpstan/discussions",
+ "issues": "https://github.com/phpstan/phpstan/issues",
+ "security": "https://github.com/phpstan/phpstan/security/policy",
+ "source": "https://github.com/phpstan/phpstan-src"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/ondrejmirtes",
+ "type": "github"
+ },
+ {
+ "url": "https://github.com/phpstan",
+ "type": "github"
+ }
+ ],
+ "time": "2025-07-28T19:35:08+00:00"
+ }
+ ],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
diff --git a/core/ajax/cache.ajax.php b/core/ajax/cache.ajax.php
index ee5b5baef7..e767ecdabc 100644
--- a/core/ajax/cache.ajax.php
+++ b/core/ajax/cache.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -54,7 +54,7 @@
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/cmd.ajax.php b/core/ajax/cmd.ajax.php
index 9b858a2dbc..bb20ed3246 100644
--- a/core/ajax/cmd.ajax.php
+++ b/core/ajax/cmd.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -29,7 +29,7 @@
if (init('action') == 'getWidgetHelp') {
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue - Vérifiez l\'id', __FILE__));
+ throw new Exception(new Trad('Commande inconnue - Vérifiez l\'id', __FILE__));
}
$info_cmd = array();
$info_cmd['id'] = $cmd->getId();
@@ -54,7 +54,7 @@
} else {
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue - Vérifiez l\'id', __FILE__));
+ throw new Exception(new Trad('Commande inconnue - Vérifiez l\'id', __FILE__));
}
$info_cmd = array();
$info_cmd['id'] = $cmd->getId();
@@ -69,7 +69,7 @@
foreach ($cmds as $id) {
$cmd = cmd::byId($id);
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue. Vérifiez l\'ID', __FILE__) . ' ' . $id);
+ throw new Exception(new Trad('Commande inconnue. Vérifiez l\'ID', __FILE__) . ' ' . $id);
}
$cmd->setIsVisible(init('isVisible'));
$cmd->save(true);
@@ -80,17 +80,17 @@
if (init('action') == 'execCmd') {
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('ID de commande inconnu :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('ID de commande inconnu :', __FILE__) . ' ' . init('id'));
}
$eqLogic = $cmd->getEqLogic();
if ($cmd->getType() == 'action' && !$eqLogic->hasRight('x')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
if (!$cmd->checkAccessCode(init('codeAccess'))) {
- throw new Exception(__('Cette action nécessite un code d\'accès', __FILE__), -32005);
+ throw new Exception(new Trad('Cette action nécessite un code d\'accès', __FILE__), -32005);
}
if ($cmd->getType() == 'action' && $cmd->getConfiguration('actionConfirm') == 1 && init('confirmAction') != 1) {
- throw new Exception(__('Cette action nécessite une confirmation', __FILE__), -32006);
+ throw new Exception(new Trad('Cette action nécessite une confirmation', __FILE__), -32006);
}
$options = is_json(init('value'), array());
if (init('user_login') != '') {
@@ -105,7 +105,7 @@
if (init('action') == 'getByObjectNameEqNameCmdName') {
$cmd = cmd::byObjectNameEqLogicNameCmdName(init('object_name'), init('eqLogic_name'), init('cmd_name'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('object_name') . '/' . init('eqLogic_name') . '/' . init('cmd_name'));
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('object_name') . '/' . init('eqLogic_name') . '/' . init('cmd_name'));
}
ajax::success($cmd->getId());
}
@@ -113,7 +113,7 @@
if (init('action') == 'getByObjectNameCmdName') {
$cmd = cmd::byObjectNameCmdName(init('object_name'), init('cmd_name'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('object_name') . '/' . init('cmd_name'), 9999);
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('object_name') . '/' . init('cmd_name'), 9999);
}
ajax::success(utils::o2a($cmd));
}
@@ -121,14 +121,14 @@
if (init('action') == 'byId') {
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
}
ajax::success(jeedom::toHumanReadable(utils::o2a($cmd)));
}
if (init('action') == 'copyHistoryToCmd') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
ajax::success(history::copyHistoryToCmd(init('source_id'), init('target_id')));
@@ -136,7 +136,7 @@
if (init('action') == 'replaceCmd') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
ajax::success(jeedom::replaceTag(array('#' . str_replace('#', '', init('source_id')) . '#' => '#' . str_replace('#', '', init('target_id')) . '#')));
@@ -146,18 +146,18 @@
$cmd_id = cmd::humanReadableToCmd(init('humanName'));
$cmd = cmd::byId(str_replace('#', '', $cmd_id));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('humanName'), 9999);
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('humanName'), 9999);
}
ajax::success(utils::o2a($cmd));
}
if (init('action') == 'usedBy') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
}
$result = $cmd->getUsedBy();
$return = array('cmd' => array(), 'eqLogic' => array(), 'scenario' => array(), 'plan' => array(), 'view' => array(), 'interactDef' => array());
@@ -207,36 +207,36 @@
if (init('action') == 'dropInflux') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$cmd = cmd::byId(init('cmd_id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
}
ajax::success($cmd->dropInflux());
}
if (init('action') == 'historyInflux') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$cmd = cmd::byId(init('cmd_id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('id'), 9999);
}
ajax::success($cmd->historyInflux());
}
if (init('action') == 'dropDatabaseInflux') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(cmd::dropInfluxDatabase());
}
if (init('action') == 'historyInfluxAll') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(cmd::historyInfluxAll());
}
@@ -256,7 +256,7 @@
if (init('action') == 'getCmd') {
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande inconnue :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Commande inconnue :', __FILE__) . ' ' . init('id'));
}
$return = jeedom::toHumanReadable(utils::o2a($cmd));
$eqLogic = $cmd->getEqLogic();
@@ -270,7 +270,7 @@
if (init('action') == 'save') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$cmd_ajax = jeedom::fromHumanReadable(json_decode(init('cmd'), true));
@@ -290,7 +290,7 @@
if (init('action') == 'multiSave') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$cmds = json_decode(init('cmd'), true);
@@ -307,7 +307,7 @@
if (init('action') == 'changeHistoryPoint') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$history = history::byCmdIdDatetime(init('cmd_id'), init('datetime'));
@@ -324,7 +324,7 @@
$history = history::byCmdIdDatetime(init('cmd_id'), init('datetime'), date('Y-m-d H:i:s', strtotime(init('datetime') . ' +1 month')), init('oldValue'));
}
if (!is_object($history)) {
- throw new Exception(__('Aucun point ne correspond pour l\'historique :', __FILE__) . ' ' . init('cmd_id') . ' - ' . init('datetime'), init('oldValue'));
+ throw new Exception(new Trad('Aucun point ne correspond pour l\'historique :', __FILE__) . ' ' . init('cmd_id') . ' - ' . init('datetime'), init('oldValue'));
}
$value = init('value', null);
if ($value === '') {
@@ -405,7 +405,7 @@
if (is_numeric(init('id'))) {
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('ID de commande inconnu :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('ID de commande inconnu :', __FILE__) . ' ' . init('id'));
}
$usage = $cmd->getCache('usage::history', 0);
$cmd->setCache('usage::history', $usage + 1);
@@ -414,7 +414,7 @@
$eqLogic = $cmd->getEqLogic();
if (!$eqLogic->hasRight('r')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
$derive = init('derive', $cmd->getDisplay('graphDerive'));
if (trim($derive) == '') {
@@ -500,18 +500,18 @@
if(is_object($cmd)){
ajax::success($cmd->getLastHistory($_time));
} else {
- throw new Exception(__('Nombre maximum de niveaux d’éléments affichés dans les graphiques de liens', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Nombre maximum de niveaux d’éléments affichés dans les graphiques de liens', __FILE__) . ' ' . init('id'));
}
}
if (init('action') == 'emptyHistory') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
unautorizedInDemo();
$cmd = cmd::byId(init('id'));
if (!is_object($cmd)) {
- throw new Exception(__('ID de commande inconnu :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('ID de commande inconnu :', __FILE__) . ' ' . init('id'));
}
$cmd->emptyHistory(init('date'));
ajax::success();
@@ -555,16 +555,16 @@
if (init('action') == 'getDeadCmd') {
$return = array(
- 'core' => array('cmd' => jeedom::deadCmd(), 'name' => __('Jeedom', __FILE__)),
- 'cmd' => array('cmd' => cmd::deadCmd(), 'name' => __('Commande', __FILE__)),
- 'jeeObject' => array('cmd' => jeeObject::deadCmd(), 'name' => __('Objet', __FILE__)),
- 'scenario' => array('cmd' => scenario::consystencyCheck(true), 'name' => __('Scénario', __FILE__)),
- 'interactDef' => array('cmd' => interactDef::deadCmd(), 'name' => __('Interaction', __FILE__)),
- 'user' => array('cmd' => user::deadCmd(), 'name' => __('Utilisateur', __FILE__)),
+ 'core' => array('cmd' => jeedom::deadCmd(), 'name' => new Trad('Jeedom', __FILE__)),
+ 'cmd' => array('cmd' => cmd::deadCmd(), 'name' => new Trad('Commande', __FILE__)),
+ 'jeeObject' => array('cmd' => jeeObject::deadCmd(), 'name' => new Trad('Objet', __FILE__)),
+ 'scenario' => array('cmd' => scenario::consystencyCheck(true), 'name' => new Trad('Scénario', __FILE__)),
+ 'interactDef' => array('cmd' => interactDef::deadCmd(), 'name' => new Trad('Interaction', __FILE__)),
+ 'user' => array('cmd' => user::deadCmd(), 'name' => new Trad('Utilisateur', __FILE__)),
);
foreach (plugin::listPlugin(true) as $plugin) {
$plugin_id = $plugin->getId();
- $return[$plugin_id] = array('cmd' => array(), 'name' => __('Plugin', __FILE__) . ' ' . $plugin->getName());
+ $return[$plugin_id] = array('cmd' => array(), 'name' => new Trad('Plugin', __FILE__) . ' ' . $plugin->getName());
if (method_exists($plugin_id, 'deadCmd')) {
$return[$plugin_id]['cmd'] = $plugin_id::deadCmd();
} else {
@@ -574,7 +574,7 @@
ajax::success($return);
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/config.ajax.php b/core/ajax/config.ajax.php
index 2cdb9a0fee..32d678f732 100644
--- a/core/ajax/config.ajax.php
+++ b/core/ajax/config.ajax.php
@@ -21,14 +21,14 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init(array('uploadImage'));
if (init('action') == 'genApiKey') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
if (init('plugin') == 'core') {
@@ -52,7 +52,7 @@
if (init('action') == 'getKey') {
$keys = init('key');
if ($keys == '') {
- throw new Exception(__('Aucune clef demandée', __FILE__));
+ throw new Exception(new Trad('Aucune clef demandée', __FILE__));
}
if (is_json($keys)) {
$keys = json_decode($keys, true);
@@ -68,7 +68,7 @@
if (init('action') == 'addKey') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$values = json_decode(init('value'), true);
@@ -82,7 +82,7 @@
unautorizedInDemo();
$keys = init('key');
if ($keys == '') {
- throw new Exception(__('Aucune clef demandée', __FILE__));
+ throw new Exception(new Trad('Aucune clef demandée', __FILE__));
}
if (is_json($keys)) {
$keys = json_decode($keys, true);
@@ -98,7 +98,7 @@
if (init('action') == 'uploadImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
@@ -107,14 +107,14 @@
config::save($key, config::getDefaultConfiguration()['core'][$key]);
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.jpg', '.png'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .jpg .png) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .jpg .png) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 5000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 5Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 5Mo)', __FILE__));
}
$uploaddir = realpath(__DIR__ . '/../../data/backgrounds');
@@ -127,7 +127,7 @@
@unlink($filepath);
file_put_contents($filepath, file_get_contents($_FILES['file']['tmp_name']));
if (!file_exists($filepath)) {
- throw new Exception(__('Impossible de sauvegarder l\'image', __FILE__));
+ throw new Exception(new Trad('Impossible de sauvegarder l\'image', __FILE__));
}
config::save($key, '/data/backgrounds/config_' . $page . $extension);
@@ -136,7 +136,7 @@
if (init('action') == 'removeImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
@@ -149,7 +149,7 @@
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/cron.ajax.php b/core/ajax/cron.ajax.php
index 654ca34b2d..a5313760a6 100644
--- a/core/ajax/cron.ajax.php
+++ b/core/ajax/cron.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -36,7 +36,7 @@
unautorizedInDemo();
$cron = cron::byId(init('id'));
if (!is_object($cron)) {
- throw new Exception(__('Cron id inconnu', __FILE__));
+ throw new Exception(new Trad('Cron id inconnu', __FILE__));
}
$cron->remove();
ajax::success();
@@ -53,7 +53,7 @@
if (init('action') == 'start') {
$cron = cron::byId(init('id'));
if (!is_object($cron)) {
- throw new Exception(__('Cron id inconnu', __FILE__));
+ throw new Exception(new Trad('Cron id inconnu', __FILE__));
}
$cron->run();
sleep(1);
@@ -63,14 +63,14 @@
if (init('action') == 'stop') {
$cron = cron::byId(init('id'));
if (!is_object($cron)) {
- throw new Exception(__('Cron id inconnu', __FILE__));
+ throw new Exception(new Trad('Cron id inconnu', __FILE__));
}
$cron->halt();
sleep(1);
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
diff --git a/core/ajax/dataStore.ajax.php b/core/ajax/dataStore.ajax.php
index 4a106e9416..a69ac1f7b7 100644
--- a/core/ajax/dataStore.ajax.php
+++ b/core/ajax/dataStore.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -29,7 +29,7 @@
if (init('action') == 'remove') {
$dataStore = dataStore::byId(init('id'));
if (!is_object($dataStore)) {
- throw new Exception(__('Dépôt de données inconnu. Vérifiez l\'ID :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Dépôt de données inconnu. Vérifiez l\'ID :', __FILE__) . ' ' . init('id'));
}
$dataStore->remove();
ajax::success();
@@ -45,7 +45,7 @@
$dataStore = dataStore::byId(init('id'));
}
if (!is_object($dataStore)) {
- throw new Exception(__('Dépôt de données inconnu. Vérifiez l\'ID :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Dépôt de données inconnu. Vérifiez l\'ID :', __FILE__) . ' ' . init('id'));
}
$dataStore->setValue(init('value'));
$dataStore->save();
@@ -88,7 +88,7 @@ function jeeAjax_datastoreReturn($_datastores=[], $_usedBy=0) {
$key = trim(init('key'));
$dataStore = dataStore::byTypeLinkIdKey(init('type'), init('linkId'), $key);
if (!is_object($dataStore)) {
- throw new Exception(__('Dépôt de données inconnu.', __FILE__) . $key);
+ throw new Exception(new Trad('Dépôt de données inconnu.', __FILE__) . $key);
}
$return = jeeAjax_datastoreReturn($dataStore, init('usedBy'));
ajax::success($return);
@@ -99,7 +99,7 @@ function jeeAjax_datastoreReturn($_datastores=[], $_usedBy=0) {
ajax::success($return);
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/eqLogic.ajax.php b/core/ajax/eqLogic.ajax.php
index 99f30677e3..38382ae6c0 100644
--- a/core/ajax/eqLogic.ajax.php
+++ b/core/ajax/eqLogic.ajax.php
@@ -21,30 +21,30 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init(array('uploadImage'));
if (init('action') == 'uploadImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
}
if (init('file') == '') {
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .jpg .png .gif .svg .webp) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .jpg .png .gif .svg .webp) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 5000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 5Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 5Mo)', __FILE__));
}
$upfilepath = $_FILES['file']['tmp_name'];
} else {
@@ -64,7 +64,7 @@
$filepath = __DIR__ . '/../../data/eqLogic/' . $filename;
file_put_contents($filepath, file_get_contents($upfilepath));
if (!file_exists($filepath)) {
- throw new \Exception(__('Impossible de sauvegarder l\'image', __FILE__));
+ throw new \Exception(new Trad('Impossible de sauvegarder l\'image', __FILE__));
}
$eqLogic->save(true);
ajax::success(array('filepath' => $eqLogic->getImage()));
@@ -72,12 +72,12 @@
if (init('action') == 'removeImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('Vue inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Vue inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
$eqLogic->getConfiguration('image::data', '');
$eqLogic->getConfiguration('image::sha512', '');
@@ -95,7 +95,7 @@
$object = jeeObject::byId(init('object_id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
$return = utils::o2a($object);
$return['eqLogic'] = array();
@@ -115,7 +115,7 @@
if (init('action') == 'byId') {
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
}
ajax::success(utils::o2a($eqLogic));
}
@@ -123,7 +123,7 @@
if (init('action') == 'byLogical') {
$eqLogic = eqLogic::byLogicalId(init('logical'), init('type'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez le logicalId ou le type', __FILE__));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez le logicalId ou le type', __FILE__));
}
ajax::success(utils::o2a($eqLogic));
}
@@ -149,7 +149,7 @@
} else {
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('Eqlogic inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Eqlogic inconnu. Vérifiez l\'ID', __FILE__));
}
$info_eqLogic = array();
$info_eqLogic['id'] = $eqLogic->getId();
@@ -260,14 +260,14 @@
if (init('action') == 'setIsEnable') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
}
if (!$eqLogic->hasRight('w')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
$eqLogic->setIsEnable(init('isEnable'));
$eqLogic->save(true);
@@ -299,7 +299,7 @@
continue;
}
if (!isset($eqLogic_json['generic_type'])) {
- throw new Exception(__('Pas de Type Generic fourni', __FILE__));
+ throw new Exception(new Trad('Pas de Type Generic fourni', __FILE__));
}
$eqLogic = eqLogic::byId($eqLogic_json['id']);
if (!is_object($eqLogic)) {
@@ -318,7 +318,7 @@
foreach ($eqLogics as $id) {
$eqLogic = eqLogic::byId($id);
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $id);
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $id);
}
if (!$eqLogic->hasRight('w')) {
continue;
@@ -334,7 +334,7 @@
foreach ($eqLogics as $id) {
$eqLogic = eqLogic::byId($id);
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $id);
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $id);
}
if (!$eqLogic->hasRight('w')) {
continue;
@@ -351,7 +351,7 @@
foreach ($eqLogics as $id) {
$eqLogic = eqLogic::byId($id);
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $id);
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $id);
}
if (!$eqLogic->hasRight('w')) {
continue;
@@ -365,16 +365,16 @@
if (init('action') == 'simpleSave') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$eqLogicSave = json_decode(init('eqLogic'), true);
$eqLogic = eqLogic::byId($eqLogicSave['id']);
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $eqLogicSave['id']);
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . $eqLogicSave['id']);
}
if (!$eqLogic->hasRight('w')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
utils::a2o($eqLogic, $eqLogicSave);
$eqLogic->save();
@@ -384,14 +384,14 @@
if (init('action') == 'copy') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
}
if (init('name') == '') {
- throw new Exception(__('Le nom de la copie de l\'équipement ne peut être vide', __FILE__));
+ throw new Exception(new Trad('Le nom de la copie de l\'équipement ne peut être vide', __FILE__));
}
ajax::success(utils::o2a($eqLogic->copy(init('name'))));
}
@@ -400,7 +400,7 @@
$used = array();
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__));
}
$data = array('node' => array(), 'link' => array());
$data = $eqLogic->getLinkData($data, 0, 2);
@@ -439,11 +439,11 @@
if (init('action') == 'usedBy') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('Equipement inconnu :', __FILE__) . ' ' . init('id'), 9999);
+ throw new Exception(new Trad('Equipement inconnu :', __FILE__) . ' ' . init('id'), 9999);
}
$result = $eqLogic->getUsedBy();
$return = array('cmd' => array(), 'eqLogic' => array(), 'scenario' => array(), 'plan' => array(), 'view' => array(), 'interactDef' => array());
@@ -494,14 +494,14 @@
if (init('action') == 'remove') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$eqLogic = eqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
if (!$eqLogic->hasRight('w')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
$eqLogic->remove();
ajax::success();
@@ -510,11 +510,11 @@
if (init('action') == 'get') {
$typeEqLogic = init('type');
if ($typeEqLogic == '' || !class_exists($typeEqLogic)) {
- throw new Exception(__('Type incorrect (classe équipement inexistante) :', __FILE__) . ' ' . $typeEqLogic);
+ throw new Exception(new Trad('Type incorrect (classe équipement inexistante) :', __FILE__) . ' ' . $typeEqLogic);
}
$eqLogic = $typeEqLogic::byId(init('id'));
if (!is_object($eqLogic)) {
- throw new Exception(__('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('EqLogic inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
$return = utils::o2a($eqLogic);
$return['cmd'] = array();
@@ -534,7 +534,7 @@
if (init('action') == 'save') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$eqLogicSaves = init('eqLogic');
@@ -545,12 +545,12 @@
foreach ($eqLogicsSave as $eqLogicSave) {
if (!is_array($eqLogicSave)) {
- throw new Exception(__('Informations reçues incorrectes', __FILE__));
+ throw new Exception(new Trad('Informations reçues incorrectes', __FILE__));
}
$typeEqLogic = init('type');
$typeCmd = $typeEqLogic . 'Cmd';
if ($typeEqLogic == '' || !class_exists($typeEqLogic) || !class_exists($typeCmd)) {
- throw new Exception(__('Type incorrect, (classe commande inexistante)', __FILE__) . $typeCmd);
+ throw new Exception(new Trad('Type incorrect, (classe commande inexistante)', __FILE__) . $typeCmd);
}
$eqLogic = null;
if (isset($eqLogicSave['id'])) {
@@ -561,7 +561,7 @@
$eqLogic->setEqType_name(init('type'));
} else {
if (!$eqLogic->hasRight('w')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
}
if (method_exists($eqLogic, 'preAjax')) {
@@ -621,7 +621,7 @@
ajax::success($alerts);
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/event.ajax.php b/core/ajax/event.ajax.php
index f47de462d6..ddf0be3513 100644
--- a/core/ajax/event.ajax.php
+++ b/core/ajax/event.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -30,7 +30,7 @@
ajax::success(event::changes(init('datetime', 0), 59));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/history.ajax.php b/core/ajax/history.ajax.php
index 5f1e0e9e58..86e1263b30 100644
--- a/core/ajax/history.ajax.php
+++ b/core/ajax/history.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -31,7 +31,7 @@
ajax::success(history::removeHistoryInFutur());
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/interact.ajax.php b/core/ajax/interact.ajax.php
index 31ad3f4008..a3d8db9037 100644
--- a/core/ajax/interact.ajax.php
+++ b/core/ajax/interact.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -69,7 +69,7 @@
if (init('action') == 'autoCompleteGroup') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$return = array();
foreach (interactDef::listGroup(init('term')) as $group) {
@@ -87,7 +87,7 @@
unautorizedInDemo();
$interact = interactDef::byId(init('id'));
if (!is_object($interact)) {
- throw new Exception(__('Interaction inconnue. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Interaction inconnue. Vérifiez l\'ID', __FILE__));
}
$interact->remove();
ajax::success();
@@ -97,7 +97,7 @@
unautorizedInDemo();
$interactQuery = interactQuery::byId(init('id'));
if (!is_object($interactQuery)) {
- throw new Exception(__('InteractQuery ID inconnu', __FILE__));
+ throw new Exception(new Trad('InteractQuery ID inconnu', __FILE__));
}
$interactQuery->setEnable(init('enable'));
$interactQuery->save();
@@ -120,7 +120,7 @@
ajax::success(interactQuery::tryToReply(init('query')));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/jeedom.ajax.php b/core/ajax/jeedom.ajax.php
index efa538d3fe..ba992288e7 100644
--- a/core/ajax/jeedom.ajax.php
+++ b/core/ajax/jeedom.ajax.php
@@ -38,14 +38,14 @@
$return['language'] = config::byKey('language', 'core', 'fr_FR');
$return['userProfils'] = $_SESSION['user']->getOptions();
- $return['userProfils']['defaultMobileViewName'] = __('Vue', __FILE__);
+ $return['userProfils']['defaultMobileViewName'] = new Trad('Vue', __FILE__);
if ($_SESSION['user']->getOptions('defaultDesktopView') != '') {
$view = view::byId($_SESSION['user']->getOptions('defaultDesktopView'));
if (is_object($view)) {
$return['userProfils']['defaultMobileViewName'] = $view->getName();
}
}
- $return['userProfils']['defaultMobileObjectName'] = __('Objet', __FILE__);
+ $return['userProfils']['defaultMobileObjectName'] = new Trad('Objet', __FILE__);
if ($_SESSION['user']->getOptions('defaultDashboardObject') != '') {
$object = jeeObject::byId($_SESSION['user']->getOptions('defaultDashboardObject'));
if (is_object($object)) {
@@ -71,7 +71,7 @@
}
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
if (init('action') == 'version') {
@@ -117,13 +117,13 @@
$version = substr(jeedom::version(), 0, 3);
ajax::success(config::byKey('doc::base_url', 'core') . '/' . config::byKey('language', 'core', 'fr_FR') . '/core/' . $version . '/' . secureXSS($page) . '?theme=' . $theme);
}
- throw new Exception(__('Aucune documentation trouvée', __FILE__), -1234);
+ throw new Exception(new Trad('Aucune documentation trouvée', __FILE__), -1234);
}
if (init('action') == 'addWarnme') {
$cmd = cmd::byId(init('cmd_id'));
if (!is_object($cmd)) {
- throw new Exception(__('Commande non trouvée :', __FILE__) . ' ' . init('cmd_id'));
+ throw new Exception(new Trad('Commande non trouvée :', __FILE__) . ' ' . init('cmd_id'));
}
$options = array(
'type' => 'cmd',
@@ -142,13 +142,13 @@
$listener->save(true);
ajax::success();
} else {
- throw new Exception(__('Aucune Commande de Notification :', __FILE__) . ' ' . init('cmd_id'));
+ throw new Exception(new Trad('Aucune Commande de Notification :', __FILE__) . ' ' . init('cmd_id'));
ajax::error();
}
}
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
if (init('action') == 'ssh') {
@@ -404,23 +404,23 @@
mkdir($uploaddir);
}
if (!file_exists($uploaddir)) {
- throw new Exception(__('Répertoire de téléversement non trouvé :', __FILE__) . ' ' . $uploaddir);
+ throw new Exception(new Trad('Répertoire de téléversement non trouvé :', __FILE__) . ' ' . $uploaddir);
}
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.gz'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .tar.gz) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .tar.gz) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 1000000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 1Go)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 1Go)', __FILE__));
}
if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir . '/' . $_FILES['file']['name'])) {
- throw new Exception(__('Impossible de déplacer le fichier temporaire', __FILE__));
+ throw new Exception(new Trad('Impossible de déplacer le fichier temporaire', __FILE__));
}
if (!file_exists($uploaddir . '/' . $_FILES['file']['name'])) {
- throw new Exception(__('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
+ throw new Exception(new Trad('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
}
ajax::success();
}
@@ -464,107 +464,107 @@
}
$object = $type::byId(init('filter_id'));
if (!is_object($object)) {
- throw new Exception(__('Type :', __FILE__) . init('filter_type') . ' ' . __('avec id :', __FILE__) . ' ' . init('filter_id') . ' ' . __('inconnu', __FILE__));
+ throw new Exception(new Trad('Type :', __FILE__) . init('filter_type') . ' ' . new Trad('avec id :', __FILE__) . ' ' . init('filter_id') . ' ' . new Trad('inconnu', __FILE__));
}
ajax::success($object->getLinkData());
}
if (init('action') == 'getFileFolder') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$pathfile = calculPath(init('path'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(ls($pathfile, '*', false, array(init('type'))));
}
if (init('action') == 'getFileContent') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$pathinfo = pathinfo(init('path'));
if (!in_array($pathinfo['extension'], array('php', 'js', 'json', 'sql', 'ini', 'css', 'py', 'css', 'html', 'yaml', 'config', 'conf'))) {
- throw new Exception(__('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
+ throw new Exception(new Trad('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
}
$pathfile = calculPath(init('path'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(file_get_contents($pathfile));
}
if (init('action') == 'setFileContent') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$pathinfo = pathinfo(init('path'));
if (!in_array($pathinfo['extension'], array('php', 'js', 'json', 'sql', 'ini', 'css', 'py', 'css', 'html', 'yaml', 'config', 'conf'))) {
- throw new Exception(__('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
+ throw new Exception(new Trad('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
}
$pathfile = calculPath(init('path'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(file_put_contents($pathfile, init('content')));
}
if (init('action') == 'deleteFile') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$pathinfo = pathinfo(init('path'));
if (!in_array($pathinfo['extension'], array('php', 'js', 'json', 'sql', 'ini', 'css', 'py', 'css', 'html', 'yaml', 'config', 'conf'))) {
- throw new Exception(__('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
+ throw new Exception(new Trad('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
}
$pathfile = calculPath(init('path'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(unlink($pathfile));
}
if (init('action') == 'createFile') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$pathinfo = pathinfo(init('name'));
if (!in_array($pathinfo['extension'], array('php', 'js', 'json', 'sql', 'ini', 'css', 'py', 'css', 'html', 'yaml', 'config', 'conf'))) {
- throw new Exception(__('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
+ throw new Exception(new Trad('Vous ne pouvez éditer ce type d\'extension :', __FILE__) . ' ' . $pathinfo['extension']);
}
$pathfile = calculPath(init('path'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
touch($pathfile . init('name'));
if (!file_exists($pathfile . init('name'))) {
- throw new Exception(__('Impossible de créer le fichier, vérifiez les droits', __FILE__));
+ throw new Exception(new Trad('Impossible de créer le fichier, vérifiez les droits', __FILE__));
}
ajax::success();
}
@@ -573,11 +573,11 @@
unautorizedInDemo();
$pathfile = calculPath(init('path'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
mkdir($pathfile . '/' . init('name'));
ajax::success();
@@ -587,11 +587,11 @@
unautorizedInDemo();
$pathfile = calculPath(init('src'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(rename($pathfile, init('dst')));
}
@@ -600,11 +600,11 @@
unautorizedInDemo();
$pathfile = calculPath(init('path'));
if ($pathfile === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$rootPath = realpath(__DIR__ . '/../../');
if (strpos($pathfile, $rootPath) === false) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(rrmdir($pathfile));
}
@@ -619,18 +619,18 @@
if (init('action') == 'uploadImageIcon') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .jpg .png .gif .jpeg .svg .webp) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .jpg .png .gif .jpeg .svg .webp) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 5000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 5Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 5Mo)', __FILE__));
}
$path = init('filepath');
if (!file_exists(__DIR__ . '/../../' . $path)) {
@@ -640,23 +640,23 @@
$filepath = __DIR__ . '/../../' . $path . $filename;
file_put_contents($filepath, file_get_contents($_FILES['file']['tmp_name']));
if (!file_exists($filepath)) {
- throw new \Exception(__('Impossible de sauvegarder l\'image', __FILE__));
+ throw new \Exception(new Trad('Impossible de sauvegarder l\'image', __FILE__));
}
ajax::success(array('filepath' => $filepath));
}
if (init('action') == 'removeImageIcon') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$filepath = __DIR__ . '/../../' . init('filepath');
if (!file_exists($filepath)) {
- throw new Exception(__('Fichier introuvable, impossible de le supprimer', __FILE__));
+ throw new Exception(new Trad('Fichier introuvable, impossible de le supprimer', __FILE__));
}
unlink($filepath);
if (file_exists($filepath)) {
- throw new Exception(__('Impossible de supprimer le fichier', __FILE__));
+ throw new Exception(new Trad('Impossible de supprimer le fichier', __FILE__));
}
ajax::success();
}
@@ -690,7 +690,7 @@
ajax::success(jeedom::massReplace(init('options', array()), init('eqlogics', array()), init('cmds', array())));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/listener.ajax.php b/core/ajax/listener.ajax.php
index e0abe1d9d1..15bd7a93b0 100644
--- a/core/ajax/listener.ajax.php
+++ b/core/ajax/listener.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -36,7 +36,7 @@
unautorizedInDemo();
$listener = listener::byId(init('id'));
if (!is_object($listener)) {
- throw new Exception(__('Listener id inconnu', __FILE__));
+ throw new Exception(new Trad('Listener id inconnu', __FILE__));
}
$listener->remove();
ajax::success();
@@ -54,7 +54,7 @@
ajax::success($listeners);
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
diff --git a/core/ajax/log.ajax.php b/core/ajax/log.ajax.php
index e3bd35cf25..42c06a5095 100644
--- a/core/ajax/log.ajax.php
+++ b/core/ajax/log.ajax.php
@@ -25,7 +25,7 @@
}
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -76,7 +76,7 @@
);
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/message.ajax.php b/core/ajax/message.ajax.php
index ada82cadfc..56c45ab199 100644
--- a/core/ajax/message.ajax.php
+++ b/core/ajax/message.ajax.php
@@ -21,14 +21,14 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
if (init('action') == 'clearMessage') {
if(!isConnect('admin')){
- throw new Exception(__('Vous n\'êtes pas autorisé à effectuer cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à effectuer cette action', __FILE__));
}
message::removeAll(init('plugin'));
ajax::success();
@@ -50,17 +50,17 @@
if (init('action') == 'removeMessage') {
if(!isConnect('admin')){
- throw new Exception(__('Vous n\'êtes pas autorisé à effectuer cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à effectuer cette action', __FILE__));
}
$message = message::byId(init('id'));
if (!is_object($message)) {
- throw new Exception(__('Message inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Message inconnu. Vérifiez l\'ID', __FILE__));
}
$message->remove();
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/network.ajax.php b/core/ajax/network.ajax.php
index 31c9335ded..a002b23f80 100644
--- a/core/ajax/network.ajax.php
+++ b/core/ajax/network.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -45,7 +45,7 @@
ajax::success(network::getInterfacesInfo());
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/note.ajax.php b/core/ajax/note.ajax.php
index 3548881baa..1381bed971 100644
--- a/core/ajax/note.ajax.php
+++ b/core/ajax/note.ajax.php
@@ -22,28 +22,28 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
if (init('action') == 'all') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(utils::o2a(note::all()));
}
if (init('action') == 'byId') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(utils::o2a(note::byId(init('id'))));
}
if (init('action') == 'save') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$note_json = json_decode(init('note'), true);
if (isset($note_json['id'])) {
@@ -59,11 +59,11 @@
if (init('action') == 'remove') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$note = note::byId(init('id'));
if (!is_object($note)) {
- throw new Exception(__('Note inconnue. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Note inconnue. Vérifiez l\'ID', __FILE__));
}
$note->remove();
ajax::success();
@@ -71,7 +71,7 @@
ajax::init();
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/object.ajax.php b/core/ajax/object.ajax.php
index 43eac0e1f9..3e8aa47e50 100644
--- a/core/ajax/object.ajax.php
+++ b/core/ajax/object.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init(array('uploadImage'));
@@ -29,11 +29,11 @@
if (init('action') == 'remove') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
$object->remove();
ajax::success();
@@ -42,7 +42,7 @@
if (init('action') == 'byId') {
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
ajax::success(jeedom::toHumanReadable(utils::o2a($object)));
}
@@ -70,7 +70,7 @@
if (init('action') == 'save') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$object_json = json_decode(init('object'), true);
if (isset($object_json['id'])) {
@@ -87,11 +87,11 @@
if (init('action') == 'orderEqLogicByUsage') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
$object->orderEqLogicByUsage();
ajax::success(utils::o2a($object));
@@ -100,7 +100,7 @@
if (init('action') == 'getChild') {
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
$return = utils::o2a($object->getChild());
ajax::success($return);
@@ -113,7 +113,7 @@
$virtual = eqLogic::byLogicalId('summary' . init('object_id'), 'virtual');
}
if (!is_object($virtual)) {
- throw new Exception(__('L\'objet n\'existe pas :', __FILE__) . ' ' . init('object_id'));
+ throw new Exception(new Trad('L\'objet n\'existe pas :', __FILE__) . ' ' . init('object_id'));
}
$removeCmd = array();
foreach ($virtual->getCmd() as $cmd) {
@@ -131,7 +131,7 @@
if (init('action') == 'getEqLogicsFromSummary') {
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
$return = $object->getEqLogicsFromSummary(init('summary'), init('onlyEnable'), init('onlyVisible'));
ajax::success($return);
@@ -213,7 +213,7 @@ function jeeAjax_objectToHtml($_id = -1, $_version = 'dashboard', $_category = '
if (init('action') == 'setOrder') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$position = 1;
foreach (json_decode(init('objects'), true) as $id) {
@@ -229,7 +229,7 @@ function jeeAjax_objectToHtml($_id = -1, $_version = 'dashboard', $_category = '
if (init('action') == 'getUISelectList') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(jeeObject::getUISelectList(init('none'), true));
}
@@ -258,7 +258,7 @@ function jeeAjax_objectToHtml($_id = -1, $_version = 'dashboard', $_category = '
} else {
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
$info_object = array();
$info_object['id'] = $object->getId();
@@ -269,12 +269,12 @@ function jeeAjax_objectToHtml($_id = -1, $_version = 'dashboard', $_category = '
if (init('action') == 'removeImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Vue inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Vue inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
$object->setImage('data', '');
$object->setImage('sha512', '');
@@ -292,23 +292,23 @@ function jeeAjax_objectToHtml($_id = -1, $_version = 'dashboard', $_category = '
if (init('action') == 'uploadImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$object = jeeObject::byId(init('id'));
if (!is_object($object)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
if (init('file') == '') {
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.jpg', '.jpeg', '.png', '.gif', '.svg', '.webp'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .jpg .png .gif .svg .webp) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .jpg .png .gif .svg .webp) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 5000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 5Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 5Mo)', __FILE__));
}
$upfilepath = $_FILES['file']['tmp_name'];
} else {
@@ -328,13 +328,13 @@ function jeeAjax_objectToHtml($_id = -1, $_version = 'dashboard', $_category = '
$filepath = __DIR__ . '/../../data/object/' . $filename;
file_put_contents($filepath, file_get_contents($upfilepath));
if (!file_exists($filepath)) {
- throw new \Exception(__('Impossible de sauvegarder l\'image', __FILE__));
+ throw new \Exception(new Trad('Impossible de sauvegarder l\'image', __FILE__));
}
$object->save();
ajax::success(array('filepath' => $filepath));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/plan.ajax.php b/core/ajax/plan.ajax.php
index b8337fd34e..6992744760 100644
--- a/core/ajax/plan.ajax.php
+++ b/core/ajax/plan.ajax.php
@@ -21,14 +21,14 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init(array('uploadImagePlan', 'uploadImage'));
if (init('action') == 'save') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plans = json_decode(init('plans'), true);
@@ -46,7 +46,7 @@
if (init('action') == 'execute') {
$plan = plan::byId(init('id'));
if (!is_object($plan)) {
- throw new Exception(__('Aucun plan correspondant', __FILE__));
+ throw new Exception(new Trad('Aucun plan correspondant', __FILE__));
}
ajax::success($plan->execute());
}
@@ -65,7 +65,7 @@
if (init('action') == 'create') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan = new plan();
@@ -76,12 +76,12 @@
if (init('action') == 'copy') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan = plan::byId(init('id'));
if (!is_object($plan)) {
- throw new Exception(__('Aucun plan correspondant', __FILE__));
+ throw new Exception(new Trad('Aucun plan correspondant', __FILE__));
}
ajax::success($plan->copy()->getHtml(init('version', 'dashboard')));
}
@@ -89,34 +89,34 @@
if (init('action') == 'get') {
$plan = plan::byId(init('id'));
if (!is_object($plan)) {
- throw new Exception(__('Aucun plan correspondant', __FILE__));
+ throw new Exception(new Trad('Aucun plan correspondant', __FILE__));
}
ajax::success($plan->getHtml('dashboard'));
}
if (init('action') == 'remove') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan = plan::byId(init('id'));
if (!is_object($plan)) {
- throw new Exception(__('Aucun plan correspondant', __FILE__));
+ throw new Exception(new Trad('Aucun plan correspondant', __FILE__));
}
ajax::success($plan->remove());
}
if (init('action') == 'removePlanHeader') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$planHeader = planHeader::byId(init('id'));
if (!is_object($planHeader)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
if (!$planHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design', __FILE__));
}
$planHeader->remove();
ajax::success();
@@ -139,13 +139,13 @@
if (init('action') == 'getPlanHeader') {
$planHeader = planHeader::byId(init('id'));
if (!is_object($planHeader)) {
- throw new Exception(__('Plan header inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Plan header inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
if (!$planHeader->hasRight('r')) {
- throw new Exception(__('Vous n\'avez pas le droit de voir ce design', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de voir ce design', __FILE__));
}
if (trim($planHeader->getConfiguration('accessCode', '')) != '' && $planHeader->getConfiguration('accessCode', '') != sha512(init('code'))) {
- throw new Exception(__('Code d\'accès invalide', __FILE__), -32005);
+ throw new Exception(new Trad('Code d\'accès invalide', __FILE__), -32005);
}
$return = utils::o2a($planHeader);
$return['image'] = $planHeader->displayImage();
@@ -154,7 +154,7 @@
if (init('action') == 'savePlanHeader') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$planHeader_ajax = json_decode(init('planHeader'), true);
@@ -166,7 +166,7 @@
$planHeader = new planHeader();
}
if (!$planHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design', __FILE__));
}
utils::a2o($planHeader, $planHeader_ajax);
$planHeader->save();
@@ -175,30 +175,30 @@
if (init('action') == 'copyPlanHeader') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$planHeader = planHeader::byId(init('id'));
if (!is_object($planHeader)) {
- throw new Exception(__('Plan header inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Plan header inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
if (!$planHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design', __FILE__));
}
ajax::success(utils::o2a($planHeader->copy(init('name'))));
}
if (init('action') == 'removeImageHeader') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$planHeader = planHeader::byId(init('id'));
if (!is_object($planHeader)) {
- throw new Exception(__('Plan header inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Plan header inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
if (!$planHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design', __FILE__));
}
$filename = 'planHeader' . $planHeader->getId() . '-' . $planHeader->getImage('sha512') . '.' . $planHeader->getImage('type');
$planHeader->setImage('sha512', '');
@@ -209,25 +209,25 @@
if (init('action') == 'uploadImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$planHeader = planHeader::byId(init('id'));
if (!is_object($planHeader)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
if (!$planHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design', __FILE__));
}
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.jpg', '.png', '.gif'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .jpg .png .gif) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .jpg .png .gif) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 5000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 5Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 5Mo)', __FILE__));
}
$files = ls(__DIR__ . '/../../data/plan/', 'planHeader' . $planHeader->getId() . '*');
if (count($files) > 0) {
@@ -243,7 +243,7 @@
$filepath = __DIR__ . '/../../data/plan/' . $filename;
file_put_contents($filepath, file_get_contents($_FILES['file']['tmp_name']));
if (!file_exists($filepath)) {
- throw new \Exception(__('Impossible de sauvegarder l\'image', __FILE__));
+ throw new \Exception(new Trad('Impossible de sauvegarder l\'image', __FILE__));
}
$planHeader->save();
ajax::success(array('filepath' => $filepath));
@@ -251,22 +251,22 @@
if (init('action') == 'uploadImagePlan') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan = plan::byId(init('id'));
if (!is_object($plan)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.jpg', '.png'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .jpg .png) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .jpg .png) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 5000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 5Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 5Mo)', __FILE__));
}
$uploaddir = __DIR__ . '/../../data/plan/plan_' . $plan->getId();
if (!file_exists($uploaddir)) {
@@ -277,7 +277,7 @@
$filePath = $uploaddir . '/' . $fileName;
$img_size = getimagesize($_FILES['file']['tmp_name']);
if (!move_uploaded_file($_FILES['file']['tmp_name'], $filePath)) {
- throw new Exception(__('Impossible de déplacer le fichier temporaire dans :', __FILE__) . ' ' . $uploaddir . '/' . $fileName);
+ throw new Exception(new Trad('Impossible de déplacer le fichier temporaire dans :', __FILE__) . ' ' . $uploaddir . '/' . $fileName);
}
$plan->setDisplay('width', $img_size[0]);
$plan->setDisplay('height', $img_size[1]);
@@ -286,7 +286,7 @@
ajax::success(array('filepath' => $filePath));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/plan3d.ajax.php b/core/ajax/plan3d.ajax.php
index 9d2bb0513b..3b5344c1df 100644
--- a/core/ajax/plan3d.ajax.php
+++ b/core/ajax/plan3d.ajax.php
@@ -21,14 +21,14 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init(array('uploadModel'));
if (init('action') == 'save') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan3ds = json_decode(init('plan3ds'), true);
@@ -55,7 +55,7 @@
if (init('action') == 'create') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan3d = new plan3d();
@@ -67,7 +67,7 @@
if (init('action') == 'get') {
$plan3d = plan3d::byId(init('id'));
if (!is_object($plan3d)) {
- throw new Exception(__('Aucun plan3d correspondant', __FILE__));
+ throw new Exception(new Trad('Aucun plan3d correspondant', __FILE__));
}
$return = jeedom::toHumanReadable(utils::o2a($plan3d));
$return['additionalData'] = $plan3d->additionalData();
@@ -84,27 +84,27 @@
if (init('action') == 'remove') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan3d = plan3d::byId(init('id'));
if (!is_object($plan3d)) {
- throw new Exception(__('Aucun plan3d correspondant', __FILE__));
+ throw new Exception(new Trad('Aucun plan3d correspondant', __FILE__));
}
ajax::success($plan3d->remove());
}
if (init('action') == 'removeplan3dHeader') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan3dHeader = plan3dHeader::byId(init('id'));
if (!is_object($plan3dHeader)) {
- throw new Exception(__('Objet inconnu vérifiez l\'id', __FILE__));
+ throw new Exception(new Trad('Objet inconnu vérifiez l\'id', __FILE__));
}
if (!$plan3dHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design 3d', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design 3d', __FILE__));
}
$plan3dHeader->remove();
ajax::success();
@@ -124,13 +124,13 @@
if (init('action') == 'getplan3dHeader') {
$plan3dHeader = plan3dHeader::byId(init('id'));
if (!is_object($plan3dHeader)) {
- throw new Exception(__('plan3d header inconnu vérifiez l\'id :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('plan3d header inconnu vérifiez l\'id :', __FILE__) . ' ' . init('id'));
}
if (!$plan3dHeader->hasRight('r')) {
- throw new Exception(__('Vous n\'avez pas le droit de voir ce design 3d', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de voir ce design 3d', __FILE__));
}
if (trim($plan3dHeader->getConfiguration('accessCode', '')) != '' && $plan3dHeader->getConfiguration('accessCode', '') != sha512(init('code'))) {
- throw new Exception(__('Code d\'accès invalide', __FILE__), -32005);
+ throw new Exception(new Trad('Code d\'accès invalide', __FILE__), -32005);
}
$return = utils::o2a($plan3dHeader);
ajax::success($return);
@@ -138,7 +138,7 @@
if (init('action') == 'saveplan3dHeader') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan3dHeader_ajax = json_decode(init('plan3dHeader'), true);
@@ -150,7 +150,7 @@
$plan3dHeader = new plan3dHeader();
}
if (!$plan3dHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design 3d', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design 3d', __FILE__));
}
utils::a2o($plan3dHeader, $plan3dHeader_ajax);
$plan3dHeader->save();
@@ -159,32 +159,32 @@
if (init('action') == 'uploadModel') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plan3dHeader = plan3dHeader::byId(init('id'));
if (!is_object($plan3dHeader)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
if (!$plan3dHeader->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier ce design 3d', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier ce design 3d', __FILE__));
}
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.zip'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .zip) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .zip) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 150000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 150Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 150Mo)', __FILE__));
}
$uploaddir = '/tmp';
if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir . '/' . $_FILES['file']['name'])) {
- throw new Exception(__('Impossible de déplacer le fichier temporaire', __FILE__));
+ throw new Exception(new Trad('Impossible de déplacer le fichier temporaire', __FILE__));
}
if (!file_exists($uploaddir . '/' . $_FILES['file']['name'])) {
- throw new Exception(__('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
+ throw new Exception(new Trad('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
}
if ($plan3dHeader->getConfiguration('path') == '') {
$plan3dHeader->setConfiguration('path', 'data/3d/' . config::genKey() . '/');
@@ -195,16 +195,16 @@
$res = $zip->open($file);
if ($res === TRUE) {
if (!$zip->extractTo($cibDir . '/')) {
- throw new Exception(__('Impossible de décompresser les fichiers :', __FILE__) . ' ');
+ throw new Exception(new Trad('Impossible de décompresser les fichiers :', __FILE__) . ' ');
}
$zip->close();
unlink($file);
} else {
- throw new Exception(__('Impossible de décompresser l\'archive zip :', __FILE__) . ' ' . $file . ' => ' . ZipErrorMessage($res));
+ throw new Exception(new Trad('Impossible de décompresser l\'archive zip :', __FILE__) . ' ' . $file . ' => ' . ZipErrorMessage($res));
}
$objfile = ls($cibDir, '*.obj', false, array('files'));
if (count($objfile) != 1) {
- throw new Exception(__('Il faut un seul et unique fichier .obj', __FILE__));
+ throw new Exception(new Trad('Il faut un seul et unique fichier .obj', __FILE__));
}
$plan3dHeader->setConfiguration('objfile', $objfile[0]);
$mtlfile = ls($cibDir, '*.mtl', false, array('files'));
@@ -215,7 +215,7 @@
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondant à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondant à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/plugin.ajax.php b/core/ajax/plugin.ajax.php
index a6face2566..4c04fe7e71 100644
--- a/core/ajax/plugin.ajax.php
+++ b/core/ajax/plugin.ajax.php
@@ -21,14 +21,14 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
if (init('action') == 'getConf') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$plugin = plugin::byId(init('id'),init('full',0));
$update = update::byLogicalId(init('id'));
@@ -45,11 +45,11 @@
if (init('action') == 'toggle') {
unautorizedInDemo();
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$plugin = plugin::byId(init('id'));
if (!is_object($plugin)) {
- throw new Exception(__('Plugin introuvable :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Plugin introuvable :', __FILE__) . ' ' . init('id'));
}
$plugin->setIsEnable(init('state'));
ajax::success();
@@ -57,14 +57,14 @@
if (init('action') == 'all') {
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::success(utils::o2a(plugin::listPlugin(init('activateOnly', false))));
}
if (init('action') == 'getDependancyInfo') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$return = array('state' => 'nok', 'log' => 'nok');
@@ -77,7 +77,7 @@
if (init('action') == 'dependancyInstall') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plugin = plugin::byId(init('id'));
@@ -89,7 +89,7 @@
if (init('action') == 'dependancyChangeAutoMode') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plugin = plugin::byId(init('id'));
@@ -101,7 +101,7 @@
if (init('action') == 'getDeamonInfo') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$plugin_id = init('id');
$return = array('launchable_message' => '', 'launchable' => 'nok', 'state' => 'nok', 'log' => 'nok', 'auto' => 0);
@@ -115,7 +115,7 @@
if (init('action') == 'deamonStart') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plugin_id = init('id');
@@ -128,7 +128,7 @@
if (init('action') == 'deamonStop') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plugin = plugin::byId(init('id'));
@@ -140,7 +140,7 @@
if (init('action') == 'deamonChangeAutoMode') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$plugin = plugin::byId(init('id'));
@@ -151,9 +151,9 @@
}
if (init('action') == 'createCommunityPost') {
- $header = __('Remplacez ce texte par votre demande en prenant soin de ne pas effacer les informations renseignées ci-dessous.', __FILE__) . '
';
+ $header = new Trad('Remplacez ce texte par votre demande en prenant soin de ne pas effacer les informations renseignées ci-dessous.', __FILE__) . '
';
$header .= '
---
';
- $header .= '**' . __('Informations', __FILE__) . ' ' . config::byKey('product_name') . '**';
+ $header .= '**' . new Trad('Informations', __FILE__) . ' ' . config::byKey('product_name') . '**';
$header .= '
```
';
$footer = '
```
';
@@ -172,17 +172,17 @@
$isBeta = ($version && $version != 'stable');
}
- $infoPost .= __('Version', __FILE__) . ' : ' . $update->getLocalVersion() . ' (' . ($isBeta ? 'beta' : 'stable') . ')';
+ $infoPost .= new Trad('Version', __FILE__) . ' : ' . $update->getLocalVersion() . ' (' . ($isBeta ? 'beta' : 'stable') . ')';
if ($plugin->getHasOwnDeamon()) {
$daemon_info = $plugin->deamon_info();
- $infoPost .= '
' . __('Statut Démon', __FILE__) . ' : ' . ($daemon_info['state'] == 'ok' ? __('Démarré', __FILE__) : __('Stoppé', __FILE__));
- $infoPost .= ' - (' . ($daemon_info['last_launch'] ?? __('Inconnue', __FILE__)) . ')';
+ $infoPost .= '
' . new Trad('Statut Démon', __FILE__) . ' : ' . ($daemon_info['state'] == 'ok' ? new Trad('Démarré', __FILE__) : new Trad('Stoppé', __FILE__));
+ $infoPost .= ' - (' . ($daemon_info['last_launch'] ?? new Trad('Inconnue', __FILE__)) . ')';
}
$infoPlugin = '';
if (method_exists($plugin_id, 'getConfigForCommunity')) {
- $infoPlugin .= '**' . __('Informations complémentaires', __FILE__) . '**
';
+ $infoPlugin .= '**' . new Trad('Informations complémentaires', __FILE__) . '**
';
$infoPlugin .= $plugin_id::getConfigForCommunity();
}
@@ -203,7 +203,7 @@
ajax::success(array('url' => $url, 'plugin' => $plugin->getName()));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/queue.ajax.php b/core/ajax/queue.ajax.php
index 3e094df417..bda429b27d 100644
--- a/core/ajax/queue.ajax.php
+++ b/core/ajax/queue.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -36,7 +36,7 @@
unautorizedInDemo();
$queue = queue::byId(init('id'));
if (!is_object($queue)) {
- throw new Exception(__('Queue id inconnu', __FILE__));
+ throw new Exception(new Trad('Queue id inconnu', __FILE__));
}
$queue->remove();
ajax::success();
@@ -53,7 +53,7 @@
if (init('action') == 'start') {
$queue = queue::byId(init('id'));
if (!is_object($queue)) {
- throw new Exception(__('Queue id inconnu', __FILE__));
+ throw new Exception(new Trad('Queue id inconnu', __FILE__));
}
$queue->run();
sleep(1);
@@ -63,14 +63,14 @@
if (init('action') == 'stop') {
$queue = queue::byId(init('id'));
if (!is_object($queue)) {
- throw new Exception(__('Queue id inconnu', __FILE__));
+ throw new Exception(new Trad('Queue id inconnu', __FILE__));
}
$queue->halt();
sleep(1);
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
diff --git a/core/ajax/recovery.ajax.php b/core/ajax/recovery.ajax.php
index c7dc2a0bfc..2906dfe428 100644
--- a/core/ajax/recovery.ajax.php
+++ b/core/ajax/recovery.ajax.php
@@ -22,7 +22,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -44,7 +44,7 @@
ajax::success(recovery::usbConnected(init('hardware')));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/repo.ajax.php b/core/ajax/repo.ajax.php
index cc6a8be32e..f39e6412c5 100644
--- a/core/ajax/repo.ajax.php
+++ b/core/ajax/repo.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init();
@@ -56,14 +56,14 @@
$class = 'repo_' . init('repo');
$repo = $class::byId(init('id'));
if (!is_object($repo)) {
- throw new Exception(__('Impossible de trouver l\'objet associé :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Impossible de trouver l\'objet associé :', __FILE__) . ' ' . init('id'));
}
$update = update::byTypeAndLogicalId($repo->getType(), $repo->getLogicalId());
if (!is_object($update)) {
$update = new update();
}
if ($update->getConfiguration('doNotUpdate') == 1) {
- throw new Exception(__('Mise à jour et réinstallation désactivées sur ', __FILE__) . ' ' . $repo->getLogicalId());
+ throw new Exception(new Trad('Mise à jour et réinstallation désactivées sur ', __FILE__) . ' ' . $repo->getLogicalId());
}
$update->setSource(init('repo'));
$update->setLogicalId($repo->getLogicalId());
@@ -86,7 +86,7 @@
$class = 'repo_' . init('repo');
$repo = $class::byId(init('id'));
if (!is_object($market)) {
- throw new Exception(__('Impossible de trouver l\'objet associé :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Impossible de trouver l\'objet associé :', __FILE__) . ' ' . init('id'));
}
$update = update::byTypeAndLogicalId($repo->getType(), $repo->getLogicalId());
try {
@@ -140,7 +140,7 @@
$class = 'repo_' . init('repo');
$repo = $class::byId(init('id'));
if (!is_object($repo)) {
- throw new Exception(__('Impossible de trouver l\'objet associé :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Impossible de trouver l\'objet associé :', __FILE__) . ' ' . init('id'));
}
$repo->setRating(init('rating'));
ajax::success();
@@ -151,7 +151,7 @@
ajax::success($class::backup_list());
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
diff --git a/core/ajax/report.ajax.php b/core/ajax/report.ajax.php
index 178b0dc16d..c875749a4d 100644
--- a/core/ajax/report.ajax.php
+++ b/core/ajax/report.ajax.php
@@ -22,7 +22,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -51,7 +51,7 @@
unlink($path);
}
if (file_exists($path)) {
- throw new Exception(__('Impossible de supprimer :', __FILE__) . ' ' . $path);
+ throw new Exception(new Trad('Impossible de supprimer :', __FILE__) . ' ' . $path);
}
ajax::success();
}
@@ -64,7 +64,7 @@
ajax::success($return);
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/scenario.ajax.php b/core/ajax/scenario.ajax.php
index 25b199c7cf..d6de10c753 100644
--- a/core/ajax/scenario.ajax.php
+++ b/core/ajax/scenario.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init(array('templateupload'));
@@ -29,15 +29,15 @@
if (init('action') == 'changeState') {
$scenario = scenario::byId(init('id'));
if (!is_object($scenario)) {
- throw new Exception(__('Scénario ID inconnu :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Scénario ID inconnu :', __FILE__) . ' ' . init('id'));
}
if (!$scenario->hasRight('x')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
switch (init('state')) {
case 'start':
if (!$scenario->getIsActive()) {
- throw new Exception(__('Impossible de lancer le scénario car il est désactivé. Veuillez l\'activer', __FILE__));
+ throw new Exception(new Trad('Impossible de lancer le scénario car il est désactivé. Veuillez l\'activer', __FILE__));
}
$scenario->addTag('trigger','user');
$scenario->addTag('trigger_value',$_SESSION['user']->getLogin());
@@ -106,19 +106,19 @@
if (init('action') == 'convertToTemplate') {
$scenario = scenario::byId(init('id'));
if (!is_object($scenario)) {
- throw new Exception(__('Scénario ID inconnu :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Scénario ID inconnu :', __FILE__) . ' ' . init('id'));
}
$path = __DIR__ . '/../../data/scenario';
if (!file_exists($path)) {
mkdir($path);
}
if (trim(init('template')) == '' || trim(init('template')) == '.json') {
- throw new Exception(__('Le nom du template ne peut être vide', __FILE__) . ' ');
+ throw new Exception(new Trad('Le nom du template ne peut être vide', __FILE__) . ' ');
}
$name = init('template');
file_put_contents($path . '/' . $name, json_encode($scenario->export('array'), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
if (!file_exists($path . '/' . $name)) {
- throw new Exception(__('Impossible de créer le template, vérifiez les droits :', __FILE__) . ' ' . $path . '/' . $name);
+ throw new Exception(new Trad('Impossible de créer le template, vérifiez les droits :', __FILE__) . ' ' . $path . '/' . $name);
}
ajax::success();
}
@@ -135,7 +135,7 @@
if (init('action') == 'loadTemplateDiff') {
$path = __DIR__ . '/../../data/scenario';
if (!file_exists($path . '/' . init('template'))) {
- throw new Exception(__('Fichier non trouvé :', __FILE__) . ' ' . $path . '/' . init('template'));
+ throw new Exception(new Trad('Fichier non trouvé :', __FILE__) . ' ' . $path . '/' . init('template'));
}
$return = array();
$fileContent = file_get_contents($path . '/' . init('template'));
@@ -161,7 +161,7 @@
$return[$match[0]] = '';
try {
$eqLogic = eqLogic::byString($match[0]);
- if (is_object($cmd)) {
+ if (is_object($eqLogic)) {
$return[$match[0]] = '#' . $eqLogic->getHumanName() . '#';
}
} catch (Exception $e) {
@@ -184,11 +184,11 @@
unautorizedInDemo();
$path = __DIR__ . '/../../data/scenario';
if (!file_exists($path . '/' . init('template'))) {
- throw new Exception(__('Fichier non trouvé :', __FILE__) . ' ' . $path . '/' . init('template'));
+ throw new Exception(new Trad('Fichier non trouvé :', __FILE__) . ' ' . $path . '/' . init('template'));
}
foreach (json_decode(init('convert'), true) as $value) {
if (trim($value['end']) == '') {
- throw new Exception(__('La conversion suivante ne peut être vide :', __FILE__) . ' ' . $value['begin']);
+ throw new Exception(new Trad('La conversion suivante ne peut être vide :', __FILE__) . ' ' . $value['begin']);
}
$converts[$value['begin']] = $value['end'];
}
@@ -203,10 +203,10 @@
}
$scenario_db = scenario::byId(init('id'));
if (!is_object($scenario_db)) {
- throw new Exception(__('Scénario ID inconnu :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Scénario ID inconnu :', __FILE__) . ' ' . init('id'));
}
if (!$scenario_db->hasRight('w')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
$scenario_db->setTrigger(array());
$scenario_db->setSchedule(array());
@@ -237,7 +237,7 @@
if (init('action') == 'byId') {
$scenario = scenario::byId(init('id'));
if (!is_object($scenario)) {
- throw new Exception(__('Scénario ID inconnu', __FILE__));
+ throw new Exception(new Trad('Scénario ID inconnu', __FILE__));
}
ajax::success(utils::o2a($scenario));
}
@@ -284,7 +284,7 @@
if (init('action') == 'autoCompleteGroup') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$return = array();
foreach (scenario::listGroup(init('term')) as $group) {
@@ -320,15 +320,15 @@
if (init('action') == 'remove') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$scenario = scenario::byId(init('id'));
if (!is_object($scenario)) {
- throw new Exception(__('Scénario ID inconnu', __FILE__));
+ throw new Exception(new Trad('Scénario ID inconnu', __FILE__));
}
if (!$scenario->hasRight('w')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
$scenario->remove();
ajax::success();
@@ -336,7 +336,7 @@
if (init('action') == 'clearAllLogs') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$scenarios = scenario::all();
foreach ($scenarios as $scenario) {
@@ -349,11 +349,11 @@
if (init('action') == 'emptyLog') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$scenario = scenario::byId(init('id'));
if (!is_object($scenario)) {
- throw new Exception(__('Scénario ID inconnu', __FILE__));
+ throw new Exception(new Trad('Scénario ID inconnu', __FILE__));
}
if (file_exists(__DIR__ . '/../../log/scenarioLog/scenario' . $scenario->getId() . '.log')) {
unlink(__DIR__ . '/../../log/scenarioLog/scenario' . $scenario->getId() . '.log');
@@ -363,12 +363,12 @@
if (init('action') == 'copy') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$scenario = scenario::byId(init('id'));
if (!is_object($scenario)) {
- throw new Exception(__('Scénario ID inconnu', __FILE__));
+ throw new Exception(new Trad('Scénario ID inconnu', __FILE__));
}
ajax::success(utils::o2a($scenario->copy(init('name'))));
}
@@ -376,7 +376,7 @@
if (init('action') == 'get') {
$scenario = scenario::byId(init('id'));
if (!is_object($scenario)) {
- throw new Exception(__('Scénario ID inconnu', __FILE__));
+ throw new Exception(new Trad('Scénario ID inconnu', __FILE__));
}
$return = utils::o2a($scenario);
$return['trigger'] = jeedom::toHumanReadable($return['trigger']);
@@ -456,10 +456,10 @@
if (init('action') == 'save') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
if (!is_json(init('scenario'))) {
- throw new Exception(__('Champs json invalide', __FILE__));
+ throw new Exception(new Trad('Champs json invalide', __FILE__));
}
unautorizedInDemo();
$time_dependance = 0;
@@ -485,7 +485,7 @@
if (!isset($scenario_db) || !is_object($scenario_db)) {
$scenario_db = new scenario();
} elseif (!$scenario_db->hasRight('w')) {
- throw new Exception(__('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
+ throw new Exception(new Trad('Vous n\'êtes pas autorisé à faire cette action', __FILE__));
}
if (isset($scenario_ajax['trigger'])) {
$scenario_db->setTrigger(array());
@@ -536,28 +536,28 @@
mkdir($uploaddir);
}
if (!file_exists($uploaddir)) {
- throw new Exception(__('Répertoire de téléversement non trouvé :', __FILE__) . ' ' . $uploaddir);
+ throw new Exception(new Trad('Répertoire de téléversement non trouvé :', __FILE__) . ' ' . $uploaddir);
}
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.json'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .json) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .json) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 10000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 10Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 10Mo)', __FILE__));
}
if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir . '/' . $_FILES['file']['name'])) {
- throw new Exception(__('Impossible de déplacer le fichier temporaire', __FILE__));
+ throw new Exception(new Trad('Impossible de déplacer le fichier temporaire', __FILE__));
}
if (!file_exists($uploaddir . '/' . $_FILES['file']['name'])) {
- throw new Exception(__('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
+ throw new Exception(new Trad('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
}
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/timeline.ajax.php b/core/ajax/timeline.ajax.php
index d6b31a783d..d2c7a25929 100644
--- a/core/ajax/timeline.ajax.php
+++ b/core/ajax/timeline.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -61,7 +61,7 @@
ajax::success(timeline::removeEventInFutur());
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/update.ajax.php b/core/ajax/update.ajax.php
index db8bfa10f7..bbaaf3051d 100644
--- a/core/ajax/update.ajax.php
+++ b/core/ajax/update.ajax.php
@@ -21,7 +21,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init(array('preUploadFile'));
@@ -31,7 +31,7 @@
}
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
if (init('action') == 'all') {
@@ -73,15 +73,15 @@
log::clear('update');
$update = update::byId(init('id'));
if (!is_object($update)) {
- throw new Exception(__('Aucune correspondance pour l\'ID :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Aucune correspondance pour l\'ID :', __FILE__) . ' ' . init('id'));
}
try {
if ($update->getType() != 'core') {
- log::add('update', 'alert', __("[START UPDATE]", __FILE__));
+ log::add('update', 'alert', new Trad("[START UPDATE]", __FILE__));
}
$update->doUpdate();
if ($update->getType() != 'core') {
- log::add('update', 'alert', __("Launch cron dependancy plugins", __FILE__));
+ log::add('update', 'alert', new Trad("Launch cron dependancy plugins", __FILE__));
try {
$cron = cron::byClassAndFunction('plugin', 'checkDeamon');
if (is_object($cron)) {
@@ -89,12 +89,12 @@
}
} catch (Exception $e) {
}
- log::add('update', 'alert', __("[END UPDATE SUCCESS]", __FILE__));
+ log::add('update', 'alert', new Trad("[END UPDATE SUCCESS]", __FILE__));
}
} catch (Exception $e) {
if ($update->getType() != 'core') {
log::add('update', 'alert', $e->getMessage());
- log::add('update', 'alert', __("[END UPDATE ERROR]", __FILE__));
+ log::add('update', 'alert', new Trad("[END UPDATE ERROR]", __FILE__));
}
}
ajax::success();
@@ -108,7 +108,7 @@
$update = update::byLogicalId(init('id'));
}
if (!is_object($update)) {
- throw new Exception(__('Aucune correspondance pour l\'ID :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Aucune correspondance pour l\'ID :', __FILE__) . ' ' . init('id'));
}
$update->deleteObjet();
ajax::success();
@@ -121,7 +121,7 @@
$update = update::byLogicalId(init('id'));
}
if (!is_object($update)) {
- throw new Exception(__('Aucune correspondance pour l\'ID :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Aucune correspondance pour l\'ID :', __FILE__) . ' ' . init('id'));
}
$update->checkUpdate();
ajax::success();
@@ -173,25 +173,25 @@
unautorizedInDemo();
$uploaddir = '/tmp';
if (!file_exists($uploaddir)) {
- throw new Exception(__('Répertoire de téléversement non trouvé :', __FILE__) . ' ' . $uploaddir);
+ throw new Exception(new Trad('Répertoire de téléversement non trouvé :', __FILE__) . ' ' . $uploaddir);
}
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
if (filesize($_FILES['file']['tmp_name']) > 100000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 100Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 100Mo)', __FILE__));
}
$filename = str_replace(array(' ', '(', ')'), '', $_FILES['file']['name']);
if (!move_uploaded_file($_FILES['file']['tmp_name'], $uploaddir . '/' . $filename)) {
- throw new Exception(__('Impossible de déplacer le fichier temporaire', __FILE__));
+ throw new Exception(new Trad('Impossible de déplacer le fichier temporaire', __FILE__));
}
if (!file_exists($uploaddir . '/' . $filename)) {
- throw new Exception(__('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
+ throw new Exception(new Trad('Impossible de téléverser le fichier (limite du serveur web ?)', __FILE__));
}
ajax::success($uploaddir . '/' . $filename);
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/user.ajax.php b/core/ajax/user.ajax.php
index 8cb6103efb..b75690bb66 100644
--- a/core/ajax/user.ajax.php
+++ b/core/ajax/user.ajax.php
@@ -44,15 +44,15 @@
@session_start();
$_SESSION['user'] = $user;
@session_write_close();
- log::add('connection', 'info', __('Connexion de l\'utilisateur par REMOTE_USER :', __FILE__) . ' ' . $_SESSION['user']->getLogin());
+ log::add('connection', 'info', new Trad('Connexion de l\'utilisateur par REMOTE_USER :', __FILE__) . ' ' . $_SESSION['user']->getLogin());
}
}
$user = user::connect(init('username'), init('password'));
if (is_object($user) && network::getUserLocation() != 'internal' && $user->getOptions('twoFactorAuthentification', 0) == 1 && $user->getOptions('twoFactorAuthentificationSecret') != '' && init('twoFactorCode') == '') {
- throw new Exception(__('Double authentification requise', __FILE__), -32012);
+ throw new Exception(new Trad('Double authentification requise', __FILE__), -32012);
}
if (!login(init('username'), init('password'), init('twoFactorCode'))) {
- throw new Exception(__('Mot de passe ou nom d\'utilisateur incorrect', __FILE__));
+ throw new Exception(new Trad('Mot de passe ou nom d\'utilisateur incorrect', __FILE__));
}
}
@@ -83,13 +83,13 @@
if (init('action') == 'getApikey') {
if (!login(init('username'), init('password'), init('twoFactorCode'))) {
- throw new Exception(__('Mot de passe ou nom d\'utilisateur incorrect', __FILE__));
+ throw new Exception(new Trad('Mot de passe ou nom d\'utilisateur incorrect', __FILE__));
}
ajax::success($_SESSION['user']->getHash());
}
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -109,7 +109,7 @@
if (init('action') == 'removeTwoFactorCode') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$user = user::byId(init('id'));
@@ -139,7 +139,7 @@
if (init('action') == 'all') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$users = array();
@@ -152,7 +152,7 @@
if (init('action') == 'save') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$users = jeedom::fromHumanReadable(json_decode(init('users'), true));
@@ -163,7 +163,7 @@
}
if (!is_object($user)) {
if (config::byKey('ldap::enable') == '1') {
- throw new Exception(__('Vous devez désactiver l\'authentification LDAP pour pouvoir ajouter un utilisateur', __FILE__));
+ throw new Exception(new Trad('Vous devez désactiver l\'authentification LDAP pour pouvoir ajouter un utilisateur', __FILE__));
}
$user = new user();
}
@@ -186,12 +186,12 @@
if (init('action') == 'copyRights') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$from = user::byId(init('from'));
$to = user::byId(init('to'));
if (!is_object($from) || !is_object($to)) {
- throw new Exception(__('Utilisateur invalide', __FILE__));
+ throw new Exception(new Trad('Utilisateur invalide', __FILE__));
}
$rights = $from->getRights();
foreach ($rights as $key => $value) {
@@ -203,18 +203,18 @@
if (init('action') == 'remove') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
if (config::byKey('ldap::enable') == '1') {
- throw new Exception(__('Vous devez désactiver l\'authentification LDAP pour pouvoir supprimer un utilisateur', __FILE__));
+ throw new Exception(new Trad('Vous devez désactiver l\'authentification LDAP pour pouvoir supprimer un utilisateur', __FILE__));
}
if (init('id') == $_SESSION['user']->getId()) {
- throw new Exception(__('Vous ne pouvez pas supprimer le compte avec lequel vous êtes connecté', __FILE__));
+ throw new Exception(new Trad('Vous ne pouvez pas supprimer le compte avec lequel vous êtes connecté', __FILE__));
}
$user = user::byId(init('id'));
if (!is_object($user)) {
- throw new Exception(__('User ID inconnu', __FILE__));
+ throw new Exception(new Trad('User ID inconnu', __FILE__));
}
$user->remove();
ajax::success();
@@ -224,7 +224,7 @@
unautorizedInDemo();
$user_json = jeedom::fromHumanReadable(json_decode(init('profils'), true));
if (isset($user_json['id']) && $user_json['id'] != $_SESSION['user']->getId()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
@session_start();
$_SESSION['user']->refresh();
@@ -243,11 +243,11 @@
if (init('action') == 'get') {
if (init('id') > 0) {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
$user = user::byId(init('id'));
if (!is_object($user)) {
- throw new Exception(__('Utilisateur non trouvé :', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Utilisateur non trouvé :', __FILE__) . ' ' . init('id'));
}
ajax::success(jeedom::toHumanReadable(utils::o2a($user)));
}
@@ -258,7 +258,7 @@
unautorizedInDemo();
if (init('key') == '' && init('user_id') == '') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
foreach ((user::all()) as $user) {
if ($user->getId() == $_SESSION['user']->getId()) {
@@ -276,11 +276,11 @@
}
if (init('user_id') != '') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
$user = user::byId(init('user_id'));
if (!is_object($user)) {
- throw new Exception(__('Utilisateur non trouvé :', __FILE__) . ' ' . init('user_id'));
+ throw new Exception(new Trad('Utilisateur non trouvé :', __FILE__) . ' ' . init('user_id'));
}
$registerDevice = $user->getOptions('registerDevice', array());
} else {
@@ -326,12 +326,12 @@
}
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
if (init('action') == 'testLdapConnection') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$connection = user::connectToLDAP();
@@ -351,7 +351,7 @@
ajax::success(user::supportAccess(init('enable')));
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/view.ajax.php b/core/ajax/view.ajax.php
index 033976e1de..f5358cedbc 100644
--- a/core/ajax/view.ajax.php
+++ b/core/ajax/view.ajax.php
@@ -21,37 +21,37 @@
include_file('core', 'authentification', 'php');
if (!isConnect()) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
ajax::init(array('uploadImage'));
if (init('action') == 'copy') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$view = view::byId(init('id'));
if (!is_object($view)) {
- throw new Exception(__('Vue non trouvée. Vérifiez l\'iD', __FILE__));
+ throw new Exception(new Trad('Vue non trouvée. Vérifiez l\'iD', __FILE__));
}
if (!$view->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier cette vue', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier cette vue', __FILE__));
}
ajax::success(utils::o2a($view->copy(init('name'))));
}
if (init('action') == 'remove') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$view = view::byId(init('id'));
if (!is_object($view)) {
- throw new Exception(__('Vue non trouvée. Vérifiez l\'iD', __FILE__));
+ throw new Exception(new Trad('Vue non trouvée. Vérifiez l\'iD', __FILE__));
}
if (!$view->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier cette vue', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier cette vue', __FILE__));
}
$view->remove();
ajax::success();
@@ -91,10 +91,10 @@
} else {
$view = view::byId(init('id'));
if (!is_object($view)) {
- throw new Exception(__('Vue non trouvée. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Vue non trouvée. Vérifiez l\'ID', __FILE__));
}
if (!$view->hasRight('r')) {
- throw new Exception(__('Vous n\'avez pas le droit de voir cette vue', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de voir cette vue', __FILE__));
}
ajax::success($view->toAjax(init('version', 'dashboard'), init('html')));
}
@@ -102,7 +102,7 @@
if (init('action') == 'save') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$view = view::byId(init('view_id'));
@@ -110,11 +110,11 @@
$view = new view();
}
if (!$view->hasRight('w')) {
- throw new Exception(__('Vous n\'avez pas le droit de modifier cette vue', __FILE__));
+ throw new Exception(new Trad('Vous n\'avez pas le droit de modifier cette vue', __FILE__));
}
$view_ajax = json_decode(init('view'), true);
if (!is_array($view_ajax) || count($view_ajax) == 0) {
- throw new Exception(__('Erreur dans le decodage json veuiller réessaye : ', __FILE__) . init('view'));
+ throw new Exception(new Trad('Erreur dans le decodage json veuiller réessaye : ', __FILE__) . init('view'));
}
utils::a2o($view, $view_ajax);
$view->save();
@@ -146,7 +146,7 @@
if (init('action') == 'getEqLogicviewZone') {
$viewZone = viewZone::byId(init('viewZone_id'));
if (!is_object($viewZone)) {
- throw new Exception(__('Vue non trouvée. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Vue non trouvée. Vérifiez l\'ID', __FILE__));
}
$return = utils::o2a($viewZone);
$return['eqLogic'] = array();
@@ -160,7 +160,7 @@
if (init('action') == 'setComponentOrder') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$components = json_decode(init('components'), true);
@@ -196,7 +196,7 @@
if (init('action') == 'setOrder') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$order = 1;
@@ -213,12 +213,12 @@
if (init('action') == 'removeImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$view = view::byId(init('id'));
if (!is_object($view)) {
- throw new Exception(__('Vue inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
+ throw new Exception(new Trad('Vue inconnu. Vérifiez l\'ID', __FILE__) . ' ' . init('id'));
}
$view->setImage('sha512', '');
$view->save();
@@ -228,22 +228,22 @@
if (init('action') == 'uploadImage') {
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__));
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__));
}
unautorizedInDemo();
$view = view::byId(init('id'));
if (!is_object($view)) {
- throw new Exception(__('Objet inconnu. Vérifiez l\'ID', __FILE__));
+ throw new Exception(new Trad('Objet inconnu. Vérifiez l\'ID', __FILE__));
}
if (!isset($_FILES['file'])) {
- throw new Exception(__('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
+ throw new Exception(new Trad('Aucun fichier trouvé. Vérifiez le paramètre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.jpg', '.png'))) {
- throw new Exception(__('Extension du fichier non valide (autorisé .jpg .png) :', __FILE__) . ' ' . $extension);
+ throw new Exception(new Trad('Extension du fichier non valide (autorisé .jpg .png) :', __FILE__) . ' ' . $extension);
}
if (filesize($_FILES['file']['tmp_name']) > 5000000) {
- throw new Exception(__('Le fichier est trop gros (maximum 5Mo)', __FILE__));
+ throw new Exception(new Trad('Le fichier est trop gros (maximum 5Mo)', __FILE__));
}
$files = ls(__DIR__ . '/../../data/view/', 'view' . $view->getId() . '*');
if (count($files) > 0) {
@@ -257,13 +257,13 @@
$filepath = __DIR__ . '/../../data/view/' . $filename;
file_put_contents($filepath, file_get_contents($_FILES['file']['tmp_name']));
if (!file_exists($filepath)) {
- throw new \Exception(__('Impossible de sauvegarder l\'image', __FILE__));
+ throw new \Exception(new Trad('Impossible de sauvegarder l\'image', __FILE__));
}
$view->save();
ajax::success();
}
- throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
+ throw new Exception(new Trad('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
diff --git a/core/ajax/widgets.ajax.php b/core/ajax/widgets.ajax.php
index 49c758bf17..154923c618 100644
--- a/core/ajax/widgets.ajax.php
+++ b/core/ajax/widgets.ajax.php
@@ -22,7 +22,7 @@
include_file('core', 'authentification', 'php');
if (!isConnect('admin')) {
- throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
+ throw new Exception(new Trad('401 - Accès non autorisé', __FILE__), -1234);
}
ajax::init();
@@ -47,7 +47,7 @@
if (init('action') == 'remove') {
$widgets = widgets::byId(init('id'));
if(!is_object($widgets)){
- throw new Exception(__('Widgets inconnus - Vérifiez l\'id', __FILE__).init('id'));
+ throw new Exception(new Trad('Widgets inconnus - Vérifiez l\'id', __FILE__).init('id'));
}
$widgets->remove();
ajax::success();
@@ -76,7 +76,7 @@
$widget = widgets::byId(init('id'));
$usedBy = $widget->getUsedBy();
if(!is_array($usedBy) || count($usedBy) == 0){
- ajax::success(array('html' => '