Hey all,
Seems that the use of / as the delimiter in the preg_replace function causes a bug when searching using patterns that also contain a forward-slash. When I search for things like: Gi9/1 (cisco router interace) the search seems to work, but the "highlighting" function (which changes the background color of the searched-for part of the trunkgroup name yellow), causes the graph name to not display (broken HTML) . See my screenshot. The workaround I've come up with is to change the preg delimiter to something less common like `.
For example on line 1330 of graphs.php:
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("graphs.php?action=graph_edit&id=" . $graph["local_graph_id"]) . "' title='" . htmlspecialchars($graph["title_cache"]) . "'>" . ((get_request_var_request("filter") != "") ? preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlspecialchars($graph["title_cache"]), read_config_option("max_title_graph"))) : title_trim(htmlspecialchars($graph["title_cache"]), read_config_option("max_title_graph"))) . "</a>", $graph["local_graph_id"]);
Changing preg_replace("/(" . preg_quote(get_request_var_request("filter")) . ")/i"
to preg_replace("`(" . preg_quote(get_request_var_request("filter")) . ")/`"
fixed the problem for me. Though there are other places this should probably be changed too.
Ross Kusler
Cant search for patterns containing a forward-slash
Moderators: Developers, Moderators
Cant search for patterns containing a forward-slash
- Attachments
-
- missing graph names.PNG (42.54 KiB) Viewed 2000 times
Re: Cant search for patterns containing a forward-slash
please create a bug and reference this post - http://www.cacti.net/bugs.php
| Scripts: Monitor processes | RFC1213 MIB | DOCSIS Stats | Dell PowerEdge | Speedfan | APC UPS | DOCSIS CMTS | 3ware | Motorola Canopy |
| Guides: Windows Install | [HOWTO] Debug Windows NTFS permission problems |
| Tools: Windows All-in-one Installer |
Re: Cant search for patterns containing a forward-slash
Hello,
On Cacti 0.8.7i from Ubuntu repository, i have this problem when i configure an user with in this password a slash.
I see the bug is fixed but it fixed too this problem when you have a slash in your password ?
Thanks for reply
On Cacti 0.8.7i from Ubuntu repository, i have this problem when i configure an user with in this password a slash.
I see the bug is fixed but it fixed too this problem when you have a slash in your password ?
Thanks for reply
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
- gandalf
- Developer
- Posts: 22383
- Joined: Thu Dec 02, 2004 2:46 am
- Location: Muenster, Germany
- Contact:
Re: Cant search for patterns containing a forward-slash
088a code looks like this:
This should fix your problem. Better is to upgrade to 088a
R.
Code: Select all
if (sizeof($graph_list) > 0) {
foreach ($graph_list as $graph) {
/* we're escaping strings here, so no need to escape them on form_selectable_cell */
$template_name = ((empty($graph["name"])) ? "<em>None</em>" : htmlspecialchars($graph["name"]));
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $graph["local_graph_id"]); $i++;
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("graphs.php?action=graph_edit&id=" . $graph["local_graph_id"]) . "' title='" . htmlspecialchars($graph["title_cache"]) . "'>" . ((get_request_var_request("filter") != "") ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlspecialchars($graph["title_cache"]), read_config_option("max_title_graph"))) : title_trim(htmlspecialchars($graph["title_cache"]), read_config_option("max_title_graph"))) . "</a>", $graph["local_graph_id"]);
form_selectable_cell($graph["local_graph_id"], $graph["local_graph_id"]);
form_selectable_cell(((get_request_var_request("filter") != "") ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", $template_name) : $template_name), $graph["local_graph_id"]);
form_selectable_cell($graph["height"] . "x" . $graph["width"], $graph["local_graph_id"]);
form_checkbox_cell($graph["title_cache"], $graph["local_graph_id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
}else{
print "<tr><td><em>No Graphs Found</em></td></tr>";
}
R.
Re: Cant search for patterns containing a forward-slash
I would like upgrade to the latest version but it's not available in the ubuntu 12.04 repository :/
Thanks gandalf for your answer !
Thanks gandalf for your answer !
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
Re: Cant search for patterns containing a forward-slash
Gandaf, for your information, this problem also exist in the 0.8.8a version
I open a bug in your bugzilla !
I open a bug in your bugzilla !
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
-
- Posts: 4
- Joined: Fri Apr 10, 2015 1:17 pm
Re: Cant search for patterns containing a forward-slash
I am still having this problem with 0.8.8c. Is there a workaround?
05/07/2015 09:15:09 AM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'foo.bar.com', and OID:'.1.3.6.1.4.1.3375.2.2.5.2.3.1.7.ltmPoolStatName."/Common/agent2_test_ldap_aaa_pool"'
05/07/2015 09:15:09 AM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'foo.bar.com', and OID:'.1.3.6.1.4.1.3375.2.2.5.2.3.1.7.ltmPoolStatName."/Common/agent2_test_ldap_aaa_pool"'
Please help!
Thanks,
Peter
05/07/2015 09:15:09 AM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'foo.bar.com', and OID:'.1.3.6.1.4.1.3375.2.2.5.2.3.1.7.ltmPoolStatName."/Common/agent2_test_ldap_aaa_pool"'
05/07/2015 09:15:09 AM - CMDPHP: Poller[0] WARNING: SNMP Get Timeout for Host:'foo.bar.com', and OID:'.1.3.6.1.4.1.3375.2.2.5.2.3.1.7.ltmPoolStatName."/Common/agent2_test_ldap_aaa_pool"'
Please help!
Thanks,
Peter
Who is online
Users browsing this forum: No registered users and 1 guest