Notifications
Clear all

[3.3] Problem with Panel Urls

5 Posts
2 Users
0 Reactions
2,345 Views
(@livia)
Posts: 30
Eminent Member
Topic starter
 

Admin. I have some admin panels where name and url don't match (ie, the name is "pink" and the url is "admin/yellow.php" - so I have to fill the 'panel_url' field to point to the right file). Before 3.3, in the admin menu those panels' links just looked like this:

<a href=""admin.php?action=pink">Pink</a>[/code"]

Now they looks like this:

<a href=""admin/yellow.php">Pink</a>[/code"]

And they don't work, since admin/yellow.php needs admin.php to work (um, I'm not sure how to say this, probably it's incorrect).

The same problem occurs in Account Info: I have got the 'challenges' module installed.

'challengesby' panel

Name: challengesby
Title: Le tue sfide (in English, "Your Challenges")
URL to panel: modules/challenges/challengesby.php
Level: 1
Hide: No
Type: U

I setup a test account (Username: Test; Password: test); if you go to "Info Account" and you look at "Le tue sfide" link, you can see that it points to: modules/challenges/challengesby.php
and not to: user.php?action=challengesby (the correct url to see the panel)

Instead if I set a new panel in Browse that points to an off-site url, i.e.

'linkss' panel

Name: linkss
Title: Linkss
URL: http://linkss.com
...

The link in Browse points to "browse.php?type=linkss" instead of " http://linkss.com", and it doesn't work.

I suppose the whole thing has to do with the difference between an off-site url (i.e. " http://...") and an url that points to a file that is part of efiction (like the modules), but for now I haven't been able to locate the file that generates the problem, since apart from the change of the name of the variables admin.php and user.php and browse.php look exactly the same they were in eFiction3.2.

Thank you for your attention :-) (and please excuse also my poor English)


URL to your eFiction: http://www.acciofanfiction.com/index.php
Your version of eFiction: 3.5.1 (Italian language)
Version of PHP: 4.4.8
Version of MySQL: 4.1.22

 
Posted : 30/06/2007 12:14 pm
(@livia)
Posts: 30
Eminent Member
Topic starter
 

I think I found the solution to this problem. Please let me know if something's wrong.

Admin.php, line 48:

if(!$panel['panel_url']) $panellist[$panel['panel_level']][]= "<a href=""admin.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a>";

After editing:

if(!$panel['panel_url'] || !preg_match('/^(http|https|ftp)://(([A-Z0-9][A-Z0-9_-]*)(.[A-Z0-9][A-Z0-9_-]*)+)(:(d+))?/?/i', $panel['panel_url'])) $panellist[$panel['panel_level']][]= "<a href=""admin.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a>";

This way the link points to "admin.php?action=(panel_name)" if:
a. the "panel_url" field is not filled;
b. the "panel_url" field doesn't look like " http://etc".

Else, the link points to "(panel_url)".

User.php, line 53:

if(!$panel['panel_url']) $output .=  "<a href=""user.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a><br />n";

After editing:

if(!$panel['panel_url'] || !preg_match('/^(http|https|ftp)://(([A-Z0-9][A-Z0-9_-]*)(.[A-Z0-9][A-Z0-9_-]*)+)(:(d+))?/?/i', $panel['panel_url'])) $output .=  "<a href=""user.php?action=".$panel['panel_name'"]."">".$panel['panel_title']."</a><br />n";

Just like in admin.php.

Browse.php, line 315:

$browsetypes[$panel['panel_title']] =  "<a href=""browse.php?type=".$panel['panel_name'"]."">".$panel['panel_title']."</a><br />n";

After editing:

if(!$panel['panel_url'] || !preg_match('/^(http|https|ftp)://(([A-Z0-9][A-Z0-9_-]*)(.[A-Z0-9][A-Z0-9_-]*)+)(:(d+))?/?/i', $panel['panel_url'])) $browsetypes[$panel['panel_title']] =  "<a href=""browse.php?type=".$panel['panel_name'"]."">".$panel['panel_title']."</a><br />n";
else $browsetypes[$panel['panel_title']] = "<a href=""".$panel['panel_url'"]."">".$panel['panel_title']."</a><br />n";

I suppose that the pattern for the " http://etc." kind of URL could be written in a simpler way, though.

Thank you for your attention.


URL to your eFiction: http://www.acciofanfiction.com/index.php
Your version of eFiction: 3.5.1 (Italian language)
Version of PHP: 4.4.8
Version of MySQL: 4.1.22

 
Posted : 30/06/2007 6:32 pm
(@tammy)
Posts: 2577
Member Moderator
 

Well if it works for you great, but no I wouldn't do this for everyone.  Tthere's never a reason for a panel to have an http:// url.  You're most likely going to find this causes more problems than it fixes.


 
Posted : 30/06/2007 8:09 pm
(@livia)
Posts: 30
Eminent Member
Topic starter
 

I noticed  πŸ™ But for now this is what eFiction does; the link points to 'panel_url' instead of '?action=panel_name'. This causes several problems also with modules. So, how can I fix this?

Thank you.


URL to your eFiction: http://www.acciofanfiction.com/index.php
Your version of eFiction: 3.5.1 (Italian language)
Version of PHP: 4.4.8
Version of MySQL: 4.1.22

 
Posted : 01/07/2007 5:12 am
(@tammy)
Posts: 2577
Member Moderator
 

I'm moving this to solved as it's not a bug. It's the way the script is set up.  It has to be set up this way to accommodate stories.php.  If you have a panel and put it in the users/ folder you can use the name of the file as the panel name and access it as an included file.  Otherwise if you supply a file name the script assumes you're pointing to an outside page and creates a link to that page.  It's not going to change anytime in the near or not so near future. 


 
Posted : 13/07/2007 7:14 pm
Share: