Gossamer Forum
Home : Products : Gossamer Links : Discussions :

browser.cgi - what info is available?

Quote Reply
browser.cgi - what info is available?
Hey all,

wondering if anyone knows what variables know the "User" information of a particular user login'd through the Editor function in browser.cgi (ie. Username, Status, Email etc...) as well as the sessionid and other CFG->information? Those with "Administrator" or editor status seem NOT to carry any of this info with them (ie. <%Status%> <%build_root_url%>, <%build_cgi_url%> etc.... and everything else;) as IS available through the add.cgi, modify.cgi scripts. For example, how would an editor or Adminsistrator return to the dynamic site without having to re-login in?

Is this information available or do I need to somehow code it into the scripts? Tried looking for this in the forum, but doesn't seem discussed. Seems like we SHOULD be able to access the User information such as Status, SessionID, Email, etc... of any and everybody when they login and make changes. Simply allowing them to make changes because they are an Editor without knowing who they are at some level opens the system up to abuse - or am I not understanding this properly (if so, please point me to the explanation). I'll keep looking, as I'm trying to setup different levels of "Editorship"

Here's hoping someone can clue me in to the information I'm missing.

Peace.

Quote Reply
Re: browser.cgi - what info is available? In reply to
Alex touched upon this today in one of his messages.

All the User record for a logged in user is available. I'm not sure if the session/cookie info is, since that is a cookie thing.

If a user is not logged in, then obviously that information is not available.

Data from the LinkOwner record is variably available and it's changed a bit in the past releases. It might be time to update all the tag lists.



PUGDOGŪ Enterprises, Inc.
FAQ:http://LinkSQL.com/FAQ
Forum:http://LinkSQL.com/forum
Quote Reply
Re: browser.cgi - what info is available? In reply to
Hi Kyle,

The category browser is a little different, and you don't have direct access in the templates to the user variable. You can easily access it in a function though:

sub {
my $tags = shift;
my $status = $USER->{Status};
my $name = $USER->{Name}
..
}

as they are all in the $USER variable. The config options are not loaded by default, but you can put them in by adding:

<%Links::Config::load_vars%>

and then access any config option with <%cfg_CONFIG_VAR%> (they are all prefixed with cfg_).

That said, you won't be allowed into the browser unless you are an editor, so the abuse isn't an issue (unless I'm not quite catching what you are asking).

Let me know if that helps,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: browser.cgi - what info is available? In reply to
HI Alex,

Thanks for the info on the config variables got that working.

I've run into a big problem though and that has to do with user_sessions and cookies vs. url.

Using URL seems to be incompatible with the user_sessions variable found under setup->user options. The browser.cgi script does not carry the information set in dynamic_preserve (ie. t,s,d). Essentially it renders the URL option useless as it must be set to cookies in order to use browser.cgi. If the setting is set to URL then each time you try to do something in browser.cgi, one has to login in again.

Is there a workaround for this, or is this a scheduled bug fix.

Thanks, look forward to hearing from,

Peace.


Quote Reply
Re: browser.cgi - what info is available? In reply to
Hi,

This is a bug. Edit Links/Browser.pm line 48 and change:

return $TPL->parse ($tpl, $opts, { print => $print });

to:

my $output = $TPL->parse ($tpl, $opts, { print => 0 });
$IN->param('d') and Links::clean_output(\$output);
print $output;

and it should work. However, I will come up with something different most likely.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: browser.cgi - what info is available? In reply to
Hi Alex,

It sort of works.
Here are the problems

1. The table of links now contains "1" for every link as opposed to the data itself.
The links data for some reason now prints at the top of the page with no surround table formatting

2. All the browser.cgi links in all the browser templates have to be renamed <%cfg_db_cgi_url%>/browser.cgi or the output won't add the t,s,d variables.


3. You must have <%Links::Config::load_vars%> on any page where you need <%cfg_db_cgi_url%>/browser.cgi

any other quick ideas?

Peace.

Quote Reply
Re: browser.cgi - user session s= not available? In reply to
HI alex,

Has any progress been made on this? I'm using 2.05. Carrying the user session via the URL is vital when moving back and forth between a https://mysecureserver and http://myunsecurserver (the cookies don't work because the servers use different urls)

I can get into the editor(browser.cgi) but whenever I try to edit a link, the session is not available in the url and I have to relogin then click on editor and the same things happens all over again. Each upgrade requires a massive amount of work in changing the browser templates. Can this be integrated into the templates? I've tried implementing the codes you previously mentioned, but they don't seem to work any longer.

thanks and peace.

kyle

Quote Reply
Re: browser.cgi - user session s= not available? In reply to
Hi Kyle,

This is indeed a bug. To fix, you need to:

1. Edit Links/Browser.pm and replace sub print_template with:

Code:
sub print_template {
# -------------------------------------------------------------------
# Prints out a template.
#
if ($IN->param('d')) {
print $_[0]->_template($_[1], $_[2], { print => 0, dynamic => 1 });
}
else {
$_[0]->_template($_[1], $_[2], { print => 1 });
}
}
2. Edit the browser templates and change links from browser.cgi to <%db_cgi_url%>/browser.cgi.

Once that's done, the session id will be passed through properly.

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: browser.cgi - user session s= not available? In reply to
Oh thank you Alex,

worked like a charm.

peace.

Kyle