Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Plugin Question

Quote Reply
Plugin Question
Hi,

in the flat file version (and i think in DBman sql 1.x as well), if you want to hook a complete new function into the main loop you just add in db.cgi

Code:
sub main {
...
# Main Menu. Check to see what the user requested, then, if he has permission for that
# request, do it. Otherwise send the user off to an unauthorized request page.
if ($in{'add_form'}) { if ($per_add) { &html_add_form; } else { &html_unauth; } }

# added for new_func
elsif ($in{'new_func'}) { if ($per_view) { &new_func; } else { &html_unauth; } }
...
}

What would mimic this in a plugin? (including the authorisation part)

In the XML sample an existing function (search_results) is altered. I think I understand this concept.

In the "static pages" plugin the hook is put in front (PRE) of "home" and gets triggerd using a do=home in the query string (db.cgi?do=home&page=page.html). Is this the way to do it? How ist authorisation handled?


Thanks,

Henning

Quote Reply
Re: [ktt] Plugin Question In reply to
Hi Henning,
Code:
In the "static pages" plugin the hook is put in front (PRE) of "home" and gets triggerd using a do=home in the query string (db.cgi?do=home&page=page.html). Is this the
way to do it?

Yes, that's a trick way to add a new function in your plugins with current version as all functions have been checked if they exist or not.
Regards,
jean
Quote Reply
Re: [jean] Plugin Question In reply to
Hi jean,

but how do i get permissions checked? This plugin work only, when user is logged in. What if i want todo something in any condition, or only in certain.

Thanks
Quote Reply
Re: [jean] Plugin Question In reply to
Well, i think i got it figured out.
The only action allowed without being logged in is the login_form. So instead of using home i need to use this hook and put the new functions in front (PRE) of that action.
The function itself can check for any authorisation conditions. I.e. fail if not logged in or not having certain permisions.
Quote Reply
Re: [ktt] Plugin Question In reply to
Good luck, Henning WinkCool