Project

General

Profile

Bug #5683

print_info_box() does not work with pkg_edit.php

Added by BBcan177 . over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
12/21/2015
Due date:
% Done:

0%

Estimated time:
Affected Version:
Affected Architecture:

Description

In the pfBlockerNG IPv4 tab, I added a print_info_box() call on user "save", but it does not print the info box to the screen?

History

#1 Updated by Steve Beaver over 4 years ago

Sounds risky :) Is that in the currently published version? i.e.: If I install the package now will I see the print_info_block() in the php?

#2 Updated by BBcan177 . over 4 years ago

No I am trying to add a new informational message to the code but its not allowing that..

You can add this line to pfblockerng.inc at line 1765.
https://github.com/pfsense/FreeBSD-ports/blob/devel/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc#L1765

print_info_box("test");

Then hit "save" in IPv4 Tab when editing an Alias to call that function.

#3 Updated by Steve Beaver over 4 years ago

  • Status changed from New to Feedback
  • Assignee set to BBcan177 .

I think this is because the print_infox_box() call takes place before the include("head.inc") line, so the HTML environment is not yet set up and there is nothing to print to. In other words the box is being printed long before the html/head/body tags.

#4 Updated by BBcan177 . over 4 years ago

So what alternatives/workaround do we have to print a pop-up message?

#5 Updated by Steve Beaver over 4 years ago

Well the "usual" way to do it is something like:

if ($_POST['sync']) {
    do_clever_stuff();

    $savemsg = "pfBlockerNG has successfully synced with the server");
}

pkg.php will automatically print an info_box with that messages when the time comes.

#6 Updated by BBcan177 . over 4 years ago

I tried that already ... See post #2 above... Add:

pfblockerng.inc Line: 1765
$savemsg = "Test";

Also tried to set $savemsg as a global variable.

#7 Updated by Steve Beaver over 4 years ago

It looks like on clicking the save button you are saving the page via jQuery/AJAX and then the function exits without re-drawing the screen, hence you don't see the info_box. THe only thing I see that might be useful is this:

if ($_GET['savemsg'] != "") {
    $savemsg = htmlspecialchars($_GET['savemsg']);
}

So presumably if you do a get to the page with savemsg="The file has been saved", it will generate the pop-up message.

#8 Updated by Steve Beaver over 4 years ago

This seems to work as expected and might be of use to you:

pkg.php?xml=/pfblockerng/pfblockerng_v4lists.xml&savemsg=This%20is%20a%20test

Added to my browser address bar this produced the print_info_box

#9 Updated by Steve Beaver over 4 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF