Skip to content

Commit bb0198b

Browse files
committed
Minor updates
1 parent 7e0b225 commit bb0198b

File tree

3 files changed

+17
-23
lines changed

3 files changed

+17
-23
lines changed

modules/linkedobject/linkedobject.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ function run()
140140
if ($op == 'redirect') {
141141
$device_id = gr('device_id', 'int');
142142
if ($device_id) {
143-
redirect(ROOTHTML . 'panel/devices/' . $device_id . '.html?tab=settings');
143+
redirect(ROOTHTML . 'panel/devices/' . $device_id . '.html?tab=settings','',1);
144144
}
145145

146146
$object = gr('object');

modules/objects/objects.class.php

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -297,28 +297,22 @@ function delete_objects($id)
297297
$rec = SQLSelectOne("SELECT * FROM objects WHERE ID='$id'");
298298

299299
// DELETE LINKED OBJECT FROM ALL TABLES
300-
if (function_exists('array_key_first')) {
301-
$tables = SQLSelect("SHOW TABLES;");
302-
$total = count($tables);
303-
for ($i = 0; $i < $total; $i++) {
304-
$table_name = $tables[$i][array_key_first($tables[$i])];
305-
$row = SQLSelectOne("SELECT * FROM " . $table_name);
306-
if (!isset($row['LINKED_OBJECT'])) continue;
307-
$rows = SQLSelect("SELECT * FROM $table_name WHERE LINKED_OBJECT = '" . DBSafe($rec['TITLE']) . "'");
308-
if (isset($rows[0]['ID'])) {
309-
$total_rows = count($rows);
310-
for ($ir = 0; $ir < $total_rows; $ir++) {
311-
$rows[$ir]['LINKED_OBJECT'] = '';
312-
if (isset($rows[$ir]['LINKED_PROPERTY'])) {
313-
$rows[$ir]['LINKED_PROPERTY'] = '';
314-
}
315-
if (isset($rows[$ir]['LINKED_METHOD'])) {
316-
$rows[$ir]['LINKED_METHOD'] = '';
317-
}
318-
if (isset($rows[$ir]['ID'])) {
319-
SQLUpdate($table_name, $rows[$ir]);
320-
}
300+
$tables = SQLSelect("SELECT DISTINCT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME IN ('LINKED_OBJECT') AND TABLE_SCHEMA='" . DB_NAME . "';");
301+
$total = count($tables);
302+
for ($i = 0; $i < $total; $i++) {
303+
$table_name = $tables[$i]['TABLE_NAME'];
304+
$rows = SQLSelect("SELECT * FROM $table_name WHERE LINKED_OBJECT = '" . DBSafe($rec['TITLE']) . "'");
305+
if (isset($rows[0]['ID'])) {
306+
$total_rows = count($rows);
307+
for ($ir = 0; $ir < $total_rows; $ir++) {
308+
$rows[$ir]['LINKED_OBJECT'] = '';
309+
if (isset($rows[$ir]['LINKED_PROPERTY'])) {
310+
$rows[$ir]['LINKED_PROPERTY'] = '';
311+
}
312+
if (isset($rows[$ir]['LINKED_METHOD'])) {
313+
$rows[$ir]['LINKED_METHOD'] = '';
321314
}
315+
SQLUpdate($table_name, $rows[$ir]);
322316
}
323317
}
324318
}

templates/panel.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
<li><a href="<#ROOTHTML#>pages.html" target="_blank"><i class="glyphicon glyphicon-th-list"></i> <#LANG_MODULE_LAYOUTS#></a></li>
9898
<li><a href="<#ROOTHTML#>apps.html" target="_blank"><i class="glyphicon glyphicon-th-list"></i> <#LANG_SECTION_APPLICATIONS#></a></li>
9999
<li><a href="<#ROOTHTML#>menu.html" target="_blank"><i class="glyphicon glyphicon-th-list"></i> <#LANG_CONTROL_MENU#></a></li>
100-
<li><a href="<#ROOTHTML#>devices.html" target="_blank"><i class="glyphicon glyphicon-th-list"></i> <#LANG_DEVICES#></a></li>
100+
<li><a href="<#ROOTHTML#>apps/devices.html" target="_blank"><i class="glyphicon glyphicon-th-list"></i> <#LANG_DEVICES#></a></li>
101101
</ul>
102102
</li>
103103
[#if HIDE_LEFT_PANEL="1"#]

0 commit comments

Comments
 (0)