Skip to content

Commit d0239a3

Browse files
committed
Fixes
* Language loading fix with "ajax" requests * Devices object prefix fix for co2 sensors * Settings UI reset fix
1 parent 553a29e commit d0239a3

4 files changed

Lines changed: 18 additions & 6 deletions

File tree

‎modules/application.class.php‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,13 @@ function sortFiles($a, $b)
364364
$ajax = 1;
365365
if (file_exists(DIR_MODULES . $this->action)) {
366366
ignore_user_abort(1);
367+
368+
if (defined('SETTINGS_SITE_LANGUAGE') && file_exists(ROOT . 'languages/' . $this->action . '_' . SETTINGS_SITE_LANGUAGE . '.php'))
369+
include_once(ROOT . 'languages/' . $this->action . '_' . SETTINGS_SITE_LANGUAGE . '.php');
370+
371+
if (file_exists(ROOT . 'languages/' . $this->action . '_default.php'))
372+
include_once(ROOT . 'languages/' . $this->action . '_default.php');
373+
367374
include_once(DIR_MODULES . $this->action . '/' . $this->action . '.class.php');
368375
$obj = "\$object$i";
369376
$code = "";
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?php
2+

‎modules/devices/devices.class.php‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ function getNewObjectIndex($class, $prefix = '')
267267
$index = 0;
268268
$total = count($objects);
269269
for ($i = 0; $i < $total; $i++) {
270-
if (preg_match('/(\d+)/', $objects[$i]['TITLE'], $m)) {
270+
$object_title = $objects[$i]['TITLE'];
271+
$object_title = preg_replace("/" . preg_quote($prefix) . "/is", '', $object_title);
272+
if (preg_match('/(\d+)/', $object_title, $m)) {
271273
$current_index = (int)$m[1];
272274
if ($current_index > $index) {
273275
$index = $current_index;
@@ -575,10 +577,9 @@ function homebridgeSync($device_id = 0, $force_refresh = 0)
575577
{
576578
if ($this->isHomeBridgeAvailable()) {
577579
include_once(dirname(__FILE__) . '/homebridgeSync.inc.php');
580+
} else if (isModuleInstalled('homekit')) {
581+
include_once(DIR_MODULES . 'homekit/homebridgeSync.inc.php');
578582
}
579-
else if(isModuleInstalled('homekit')){
580-
include_once(DIR_MODULES . 'homekit/homebridgeSync.inc.php');
581-
}
582583
}
583584

584585
/**
@@ -1461,7 +1462,7 @@ function addDeviceToScene($device_id, $add_scene_id = 0)
14611462
}
14621463

14631464

1464-
function checkLinkedDevicesAction($object_title, $params=array())
1465+
function checkLinkedDevicesAction($object_title, $params = array())
14651466
{
14661467
startMeasure('checkLinkedDevicesAction');
14671468
$device1 = SQLSelectOne("SELECT * FROM devices WHERE LINKED_OBJECT LIKE '" . $object_title . "'");

‎templates/settings/settings_search_admin.html‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,9 @@
139139

140140
<div class="form-actions">
141141
<button class="btn btn-default btn-primary" type="submit" name="submit"><i class="icon-ok"></i> <#LANG_SUBMIT#></button>
142-
<a class="btn btn-default" href="?mode=reset" onClick="return confirm('<#LANG_ARE_YOU_SURE#>')"><#LANG_RESET_TO_DEFAULT#></a>
142+
[#if ACTION!=""#]
143+
<a class="btn btn-default" href="?mode=reset&filter_name=<#FILTER_NAME#>" onClick="return confirm('<#LANG_ARE_YOU_SURE#>')"><#LANG_RESET_TO_DEFAULT#></a>
144+
[#endif ACTION#]
143145
<input type="hidden" name="mode" value="update">
144146
<input type="hidden" name="filter_name" value="<#FILTER_NAME#>">
145147
</div>

0 commit comments

Comments
 (0)