Project

General

Profile

Actions

Bug #2761

closed

Widget detection function can cause duplicate widgets in the Web GUI

Added by John Bayly almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
High
Category:
Web Interface
Target version:
Start date:
01/17/2013
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
Release Notes:
Affected Version:
2.0.x
Affected Architecture:
All

Description

The widget detection function in index.php doesn't filter out invalid files. This means that if you patch a widget file, the original file (for example traffic_graphs.widget.php.orig) will also be detected, resulting in the Traffic Graphs being listed twice in "Available Widgets". The function also picks up dot files (eg VIM swap files), and whilst they're not added to the list of available widgets, they are added as hidden widgets to the page "<div id="-container" class="widgetdiv"

To repeat:
Copy or patch an existing widget, but with an altered extension (eg. .old, .orig), and then click the "Add Widget" button on the index page of the Web GUI - you will see that the patched widget has been duplicated. An inspection of the HTML will also verify this.

Fix:
I've created a patch that add two checks:
  1. Ignore dot files - by checking that the position of the dot is zero
  2. Ignore files that don't end in PHP. This may be more controversial as there's a slight possibility that people are going around creating widgets that aren't .php files.

Files

index.php.diff (519 Bytes) index.php.diff Patch to fix widget detection behaviour John Bayly, 01/17/2013 05:31 AM
Actions #1

Updated by Renato Botelho almost 12 years ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #2

Updated by Renato Botelho almost 12 years ago

  • Status changed from Feedback to Closed
  • Assignee set to Renato Botelho
  • Affected Version set to 2.0.x
  • Affected Architecture All added
  • Affected Architecture deleted ()
Actions

Also available in: Atom PDF