Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
82aecd2
fix PR #2864
zoic21 Aug 30, 2024
28bcda5
add changelog
zoic21 Aug 30, 2024
3a068e6
Trad Exit from full screen
Lacrymal3 Jan 17, 2025
7b82713
Update compatibility.config.php
Phpvarious Jan 24, 2025
76da871
Update de_DE.json
Lacrymal3 Jan 24, 2025
7a592f3
Update en_US.json
Lacrymal3 Jan 24, 2025
e59967c
Update es_ES.json
Lacrymal3 Jan 24, 2025
8241802
Update fr_FR.json
Lacrymal3 Jan 24, 2025
3c29171
Update id_ID.json
Lacrymal3 Jan 24, 2025
e72b862
Update it_IT.json
Lacrymal3 Jan 24, 2025
a2649fe
Update ja_JP.json
Lacrymal3 Jan 24, 2025
9a2749e
Update pt_PT.json
Lacrymal3 Jan 24, 2025
62e28f0
Update ru_RU.json
Lacrymal3 Jan 24, 2025
2ef77cd
Update tr.json
Lacrymal3 Jan 24, 2025
d70948d
Update jeedom.class.js
Lacrymal3 Jan 24, 2025
1911345
update(ajax): improve PHPDoc compliance with core documentation stand…
kwizer15 Jan 12, 2025
68575ca
Bug fix Average
SNatis Feb 19, 2025
4babd33
Add phpstan into workflow
kwizer15 Dec 23, 2024
0cfb2c2
Fix compareVersionsCore fonction name
Sekiro-kost Mar 8, 2025
dfd1136
Fix select on widget page on first display
zoic21 Mar 17, 2025
6d1f0f5
add check < or > for specific version pip3 package
Sekiro-kost Mar 21, 2025
64e1611
add check < or > for specific version of pip3 package
Sekiro-kost Mar 21, 2025
1957e81
Update system.class.php
Sekiro-kost Mar 21, 2025
88c6df8
Update system.class.php
Sekiro-kost Mar 21, 2025
384cea2
Update system.class.php
Sekiro-kost Mar 21, 2025
fc5575f
Fix issue https://community.jeedom.com/t/perte-du-type-broker-sur-mon…
zoic21 Mar 25, 2025
2032f31
Merge branch 'jeedom:alpha' into alpha
Sekiro-kost Mar 25, 2025
67ad459
not displaying Unknown error anymore
Sekiro-kost Mar 25, 2025
b58b3b9
Merge branch 'alpha' of https://github.com/jeedom/core into alpha
Sekiro-kost Mar 25, 2025
ed3cf50
Update jeedom.class.js
Sekiro-kost Mar 25, 2025
e202a1d
Update jeeObject.class.php
zoic21 Mar 26, 2025
0c2b6bc
test bugfix bruno
zoic21 Mar 31, 2025
ff81f1b
Fix warning in cmd.configure.php
BadWolf42 Apr 6, 2025
93c9945
remove debug
zoic21 Apr 10, 2025
862de29
Merge pull request #3047 from jeedom/not-displaying-Unknown-error-any…
Sekiro-kost Apr 11, 2025
078fad5
Merge pull request #3048 from BadWolf42/fix-warnings-modal-cmd-configure
Sekiro-kost Apr 11, 2025
5e21fcf
Merge pull request #3018 from Phpvarious/patch-5
Sekiro-kost Apr 13, 2025
0a27c4d
Fix issue with serialize and queue (alternative)
kwizer15 Apr 14, 2025
8070567
Merge pull request #3051 from kwizer15/patch-1-alt
Hotfirenet Apr 29, 2025
3fe80a2
Merge branch 'alpha' into patch-widget-string-badge
Hotfirenet Apr 29, 2025
e38fce4
Merge pull request #2865 from jeedom/patch-widget-string-badge
Hotfirenet Apr 29, 2025
8e9b4c5
Update changelog.md
Hotfirenet Apr 29, 2025
1b2e153
[Jenkins] Updated translation
Apr 29, 2025
1fd1519
[Jenkins] Updated translation
Apr 29, 2025
e58d414
Fix error Declaration of log::log on update
zoic21 Apr 30, 2025
788b87f
Update log.class.php
zoic21 Apr 30, 2025
ffdd822
Merge pull request #3055 from jeedom/zoic21-patch-3
Sekiro-kost May 7, 2025
f5a4fcb
jeecli install plugin by github source
pifou25 May 9, 2025
11ea947
Update log.class.php
zoic21 May 9, 2025
8b4f82a
Update log.class.php
zoic21 May 12, 2025
00f0d2a
Merge pull request #3058 from jeedom/zoic21-patch-4
Sekiro-kost May 12, 2025
551355c
Merge pull request #3036 from SNatis/patch-1
Sekiro-kost May 12, 2025
a455771
Merge pull request #3011 from kwizer15/feat/doc-ajax
Sekiro-kost May 15, 2025
beb6b3a
Merge pull request #3033 from kwizer15/feat/phpstan
Sekiro-kost May 15, 2025
00783d9
Fix PHPStan auto MR
kwizer15 May 15, 2025
1efae42
Merge pull request #3061 from kwizer15/fix/phpstan-mr
Sekiro-kost May 15, 2025
1b64ebb
Merge branch 'alpha' of https://github.com/Sekiro-kost/core into alpha
Sekiro-kost May 15, 2025
f651d3d
add > for specifc pip3 package
Sekiro-kost May 15, 2025
d41bc92
Update system.class.php
Sekiro-kost May 15, 2025
30ecae3
add missing $code variable
Sekiro-kost May 15, 2025
4c8c5fa
Update system.class.php
Sekiro-kost May 15, 2025
9c4b2f9
Merge pull request #3044 from jeedom/zoic21-patch-2
Sekiro-kost May 19, 2025
80b0b75
Update PHPStan baseline
Sekiro-kost May 19, 2025
d34cdf6
Merge pull request #3064 from jeedom/update-phpstan-baseline
Sekiro-kost May 19, 2025
a87add7
fix wrong parameters
Sekiro-kost May 20, 2025
4cac55d
fix configByKey string with integer addition
Sekiro-kost May 20, 2025
f67caab
Update scenario.class.php
Sekiro-kost May 20, 2025
1dc6d18
Update log.class.php
Sekiro-kost May 20, 2025
2bf7088
Update eqAnalyse.php
Sekiro-kost May 20, 2025
64388ae
Update eqAnalyse.php
Sekiro-kost May 20, 2025
f46fc28
Update jeecli.php
Sekiro-kost May 20, 2025
f55fe64
Update jeecli.php
Sekiro-kost May 20, 2025
e007eeb
Merge pull request #3063 from Sekiro-kost/alpha
Sekiro-kost May 20, 2025
11d49d8
Update PHPStan baseline
Sekiro-kost May 20, 2025
b7b1e03
Merge pull request #3066 from jeedom/update-phpstan-baseline
Sekiro-kost May 20, 2025
15e7929
Update jeecli.php
Sekiro-kost May 20, 2025
f9cc6de
Merge pull request #3057 from pifou25/feat/jeecli_install_github
Sekiro-kost May 20, 2025
2b4d1bb
[Jenkins] Updated translation
May 20, 2025
52a8602
remove sessions users when is desactivated
Sekiro-kost May 20, 2025
ff2fcc8
Update user.ajax.php
Sekiro-kost May 20, 2025
93f01e1
Update cron.class.php
Sekiro-kost May 20, 2025
5c6fa71
Update log.class.php
Sekiro-kost May 20, 2025
455a594
Merge pull request #3014 from Lacrymal3/alpha
Sekiro-kost May 20, 2025
a9ea767
[Jenkins] Updated translation
May 20, 2025
e811f0f
Merge pull request #3067 from jeedom/remove-sessions-users-when-is-de…
Sekiro-kost May 21, 2025
6b2f884
Merge pull request #3065 from jeedom/fix-multiples-mistakes
Sekiro-kost May 21, 2025
d3d9e03
Create label-bug.yml
Sekiro-kost May 23, 2025
61cd645
Update label-bug.yml
Sekiro-kost May 23, 2025
96e9ba0
Create auto-label.yml
Sekiro-kost May 23, 2025
c5841a8
Delete .github/workflows/label-bug.yml
Sekiro-kost May 23, 2025
87546e3
force 1 number
Sekiro-kost May 26, 2025
a9ed690
Merge pull request #3093 from jeedom/fix-set-historizeRound
Sekiro-kost May 26, 2025
aaf2ff7
Update jeeObject.class.php
zoic21 Aug 30, 2025
be06f7d
update boot script
Salvialf Sep 5, 2025
9674fd7
recovery class
Salvialf Sep 5, 2025
b86b04e
recovery interface
Salvialf Sep 5, 2025
0f0020f
menu entry to access recovery
Salvialf Sep 5, 2025
a926f6b
specify return types
Salvialf Sep 8, 2025
a955246
forgot getProgress return type
Salvialf Sep 8, 2025
70e2696
recovery cancel then ajax success
Salvialf Sep 8, 2025
31a2d36
revert a955246
Salvialf Sep 8, 2025
d36cfa8
Merge pull request #3113 from jeedom/arm64-recovery
Salvialf Sep 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto label issues

on:
issues:
types: [opened]

permissions:
issues: write

jobs:
auto-label:
runs-on: ubuntu-latest
steps:
- name: Add label based on title
uses: actions/github-script@v7
with:
script: |
const title = context.payload.issue.title;

if (title.includes('[BUG]')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: ['bug'],
});
}

if (title.includes('[FEAT]')) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue.number,
labels: ['enhancement'],
});
}
103 changes: 103 additions & 0 deletions .github/workflows/phpstan.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: PHPStan

on:
push:
branches: [ alpha ]
pull_request:
branches: [ alpha ]

jobs:
phpstan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP 7.4 for dependencies
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- 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: Restore PHPStan cache
id: cache-phpstan
uses: actions/cache/restore@v3
with:
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

update-baseline:
needs: phpstan
if: github.event_name == 'push' && github.ref == 'refs/heads/alpha'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- 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

- name: Setup PHP 7.4 for dependencies
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- 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
if ! diff -q phpstan-baseline.neon phpstan-baseline.neon.old > /dev/null; then
echo "baseline_changed=true" >> $GITHUB_OUTPUT
fi

- name: Create Pull Request
if: steps.generate-baseline.outputs.baseline_changed == 'true'
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update PHPStan baseline
title: '[CI] Update PHPStan baseline'
body: |
Mise à jour automatique du baseline PHPStan suite à la correction d'erreurs.

Cette PR a été générée automatiquement par le workflow CI/CD.
branch: update-phpstan-baseline
base: alpha
delete-branch: true
add-paths: |
phpstan-baseline.neon
reviewers: |
zoic21
Hotfirenet
tmartinez69009
Salvialf
Sekiro-kost
reineabs
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ tmp/*

!.htaccess
.env
.phpstan.cache
phpstan.phar
51 changes: 51 additions & 0 deletions core/ajax/recovery.ajax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

/* This file is part of Jeedom.
*
* Jeedom is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Jeedom is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
*/

try {

require_once __DIR__ . '/../php/core.inc.php';
include_file('core', 'authentification', 'php');

if (!isConnect('admin')) {
throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
}

ajax::init();

if (init('action') == 'start') {
ajax::success(recovery::start(init('hardware'), init('mode')));
}

if (init('action') == 'cancel') {
recovery::cancel();
ajax::success();
}

if (init('action') == 'getProgress') {
ajax::success(recovery::getProgress());
}

if (init('action') == 'usbConnected') {
ajax::success(recovery::usbConnected(init('hardware')));
}

throw new Exception(__('Aucune méthode correspondante à :', __FILE__) . ' ' . init('action'));
/* * *********Catch exeption*************** */
} catch (Exception $e) {
ajax::error(displayException($e), $e->getCode());
}
8 changes: 8 additions & 0 deletions core/ajax/user.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@
}
utils::a2o($user, $user_json);
$user->save();
if (isset($user_json['enable']) && $user_json['enable'] == 0) {
$sessions = listSession();
foreach ($sessions as $sessionId => $sessionData) {
if (isset($sessionData['user_id']) && $sessionData['user_id'] == $user->getId()) {
deleteSession($sessionId);
}
}
}
}
@session_start();
$_SESSION['user']->refresh();
Expand Down
2 changes: 2 additions & 0 deletions core/ajax/view.ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,15 @@
}
$sql .= 'UPDATE viewData SET `order`= ' . $component['viewOrder'] . ' WHERE link_id=' . $component['id'] . ' AND type="' . $component['type'] . '" AND viewZone_id=' . $component['viewZone_id'] . ';';
if ($component['type'] == 'eqLogic') {
unset($component['type']);
$eqLogic = eqLogic::byId($component['id']);
if (!is_object($eqLogic)) {
continue;
}
utils::a2o($eqLogic, $component);
$eqLogic->save(true);
} elseif ($component['type'] == 'scenario') {
unset($component['type']);
$scenario = scenario::byId($component['id']);
if (!is_object($scenario)) {
continue;
Expand Down
8 changes: 8 additions & 0 deletions core/class/DB.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ public static function &Prepare($_query, $_params, $_fetchType = self::FETCH_TYP
$obj->setChanged(false);
}
}

if (is_object($obj) && method_exists($obj, 'initialize')) {
$obj->initialize();
}
}
} else {
if (is_object($res) && method_exists($res, 'decrypt')) {
Expand All @@ -137,6 +141,10 @@ public static function &Prepare($_query, $_params, $_fetchType = self::FETCH_TYP
$res->setChanged(false);
}
}

if (is_object($res) && method_exists($res, 'initialize')) {
$res->initialize();
}
}
}
return $res;
Expand Down
90 changes: 21 additions & 69 deletions core/class/ajax.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,59 +20,26 @@
require_once __DIR__ . '/../../core/php/core.inc.php';

/**
* Gère les réponses AJAX de Jeedom
* Handles AJAX responses in Jeedom
*
* @note Évolutions possibles et compatibles
* Cette classe pourrait être enrichie progressivement avec :
* - Une interface ResponseFormatterInterface pour supporter différents formats (json, xml...)
* - Un système de middleware pour la validation des entrées
* - Des codes d'erreur HTTP standards via une énumération
* Ces changements peuvent être implémentés graduellement sans casser l'existant
* @example
* ajax::init(['getInfos']); // returns void
* ajax::success(['result' => 'ok']); // sends JSON response
*
* @example Utilisation actuelle
* ```php
* ajax::init(['getInfos']);
* ajax::success($data);
* ```
*
* @example Utilisation future possible
* ```php
* // Même API, plus de fonctionnalités
* ajax::init(['getInfos'])
* ->withValidator(new InputValidator())
* ->withFormat(new JsonFormatter());
* ajax::success($data);
* ```
*
* @see config::class Pour la gestion des configurations
* @see log::class Pour la gestion des logs
*
* @todo Version 4.6 ou 5.0
* - [OPTIONNEL] Ajouter un système de middleware pour valider les entrées
* - [OPTIONNEL] Support de différents formats via interfaces
* - [COMPATIBLE] Utiliser des codes HTTP standards
* @see config::class For configuration management
* @see log::class For logging management
*/
class ajax {
/* * *************************Attributs****************************** */

/* * *********************Methode static ************************* */

/**
* Initialise la réponse AJAX
* Configure les en-têtes HTTP et vérifie les actions autorisées en GET
* Initializes AJAX response with HTTP headers and GET action validation
*
* @param array $_allowGetAction Liste des actions autorisées en GET
* @param string[] $_allowGetAction List of allowed GET actions
* @return void
* @throws \Exception Si l'action demandée en GET n'est pas autorisée
*
* @note Évolution possible
* Cette méthode pourrait retourner $this pour permettre le chaînage :
* ```php
* ajax::init(['action'])
* ->withValidator()
* ->withFormat();
* ```
* Ce changement serait rétrocompatible
* @throws \Exception When requested GET action is not allowed
*/
public static function init($_allowGetAction = array()) {
if (!headers_sent()) {
Expand All @@ -84,38 +51,31 @@ public static function init($_allowGetAction = array()) {
}

/**
* Retourne un token (méthode non utilisée ?)
* Returns authentication token
*
* @return string Token vide
* @deprecated Since version 4.4, authentication is handled differently
* @return string Empty token
*/
public static function getToken(){
return '';
}

/**
* Envoie une réponse de succès et termine l'exécution
* Sends a success response and ends execution
*
* @param mixed $_data Données à renvoyer dans la réponse
* @param mixed $_data Data to send in response
* @return never
*
* @note Compatibilité et évolution
* Pour maintenir la compatibilité tout en permettant l'évolution :
* - Garder le comportement actuel par défaut
* - Permettre l'injection d'un formatter optionnel
* ```php
* ajax::success($data, new JsonFormatter()); // Optionnel
* ```
*/
public static function success($_data = '') {
echo self::getResponse($_data);
die();
}

/**
* Envoie une réponse d'erreur et termine l'exécution
* Sends an error response and ends execution
*
* @param mixed $_data Message d'erreur ou données à renvoyer
* @param int $_errorCode Code d'erreur
* @param mixed $_data Error message or data to send
* @param int $_errorCode Custom error code for client-side handling (default: 0)
* @return never
*/
public static function error($_data = '', $_errorCode = 0) {
Expand All @@ -124,19 +84,11 @@ public static function error($_data = '', $_errorCode = 0) {
}

/**
* Génère la réponse JSON formatée
*
* @param mixed $_data Données à inclure dans la réponse
* @param ?int $_errorCode Code d'erreur (null pour une réponse de succès)
* @return string Réponse JSON encodée
* Generates formatted JSON response
*
* @note Architecture future
* Cette méthode pourrait déléguer le formatage à des classes dédiées :
* - JsonFormatter (comportement actuel)
* - XmlFormatter
* - CsvFormatter
* etc.
* La transition peut se faire graduellement en gardant le comportement par défaut
* @param mixed $_data Data to include in response
* @param ?int $_errorCode Error code (null for success response)
* @return string|false Encoded JSON response
*/
public static function getResponse($_data = '', $_errorCode = null) {
$isError = !(null === $_errorCode);
Expand Down
Loading