[racktables-users] Re: Addon Functionality and Dynamic function calls

  • From: "Tutton, James" <James.Tutton@xxxxxxxxxxxxxx>
  • To: "racktables-users@xxxxxxxxxxxxx" <racktables-users@xxxxxxxxxxxxx>
  • Date: Mon, 22 Mar 2010 17:26:23 +0000

Plugins and Permissions updates Warning.

Spent a morning dealing with a silly issue so wanted to warn everyone about it.

The current implementation of permissions uses an ajax post that looks for 
"ACK" as a response on line 1.  

When I built my plugins I inadvertently ended my code with

CODE ABOBE
?>
                <------- Blank Line
END OF PAGE

Tiny mistake but the knock on effect is that when pages are rendered the blank 
line is added.  The ajax script for permission expects the ACK response on line 
1 and doesn't look anywhere else. As such if you make this mistake you will 
break permission updates.

Sympton: No error on post back but get back a small pink/red bar when Verifying 
permissions.

Hope this saves others a big headache and Denis may be worth tweaking the ajax 
code to be a little more open to blank lines or bypass local.php perhaps.

Regards

James Tutton
Systems Development Engineer

We Connect, We Secure, We Manage.


-----Original Message-----
From: racktables-users-bounce@xxxxxxxxxxxxx 
[mailto:racktables-users-bounce@xxxxxxxxxxxxx] On Behalf Of Denis Ovsienko
Sent: 13 March 2010 11:23
To: racktables-users@xxxxxxxxxxxxx
Subject: [racktables-users] Re: Addon Functionality and Dynamic function calls

[...]
>  To allow the use of classes within our addons we need to change the way 
> racktables calls functions by reference.
>  
>  The main benefit here is we can build our addons as tight classes.  Without 
> this change we have to ensure all our addons have unique function names and 
> this proved to be very problematic very quickly for our needs.
>  
>  
>  ###### Amend index.php aprrox line 81
>  
>               showMessageOrError();
>               // Added call_user_func Method to allow Class Based Invocations
>             call_user_func($tabhandler[$pageno][$tabno], 
> $_REQUEST[$page[$pageno]['bypass']]);
>               //$tabhandler[$pageno][$tabno] 
> ($_REQUEST[$page[$pageno]['bypass']]);
>       }
>       else
>       {
>               showMessageOrError();
>               // Added call_user_func Method to allow Class Based Invocations 
>               call_user_func($tabhandler[$pageno][$tabno]);
>               //$tabhandler[$pageno][$tabno] ();
>  
>  
>  ###### End Amend index.php
[...]

Hello, James.

I have just committed the change necessary to use class methods as callbacks, 
it will be available in the next version.

-- 
    Denis Ovsienko


Other related posts: