aMule Forum

English => en_Bugs => Topic started by: wuischke on May 14, 2008, 12:30:53 PM

Title: amuleweb problems with files in multiple folders
Post by: wuischke on May 14, 2008, 12:30:53 PM
I'm currently working on a skin (made by GeVauDan) which uses filenames similar to the following:
Code: [Select]
themes/backfromspace/css/style.css
themes/base/images/amule/ico_amule_128.png

It will not load the first one at all (<html><title> Error - requested page not found </title></html>) although it exists on the local file system with the same relativ path and I get a curious error in amuleweb log when requesting the second one:
Quote
11:23:21: Error: can't open file '/home/johkra/.aMule/webserver/webs/ico_amule_128.png' (error 2: No such file or directory)
CFileImage: failed to open /home/johkra/.aMule/webserver/webs/ico_amule_128.png
It stripped the path for some reason and of course it can't find it then. In this case, it will also hang and not react at all on new requests for the login page and only a restart of amuleweb solves the problem. It didn't hang after login in, although it still would strip the path of the pictures.

Even after successfully login in, the problem persists. Is this expected behaviour and if yes, can this be changed? I use r8500, btw.

So, now back to gettext...
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 14, 2008, 05:33:21 PM
I will check both issues. No, this is not the way it's supposed to work.
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 14, 2008, 09:03:28 PM
OK, correction, this IS expected behavior. Apparently this was done to prevent access to files beyond template directory (think about .. in path).

Code: [Select]
// To prevent access to non-template images, we disallow use of paths in filenames.
wxString imgName = wxFileName::GetPathSeparator() + wxFileName(Data.parsedURL.File()).GetFullName();
CAnyImage *img = m_ImageLib.GetImage(imgName);

Now, back to gettext...crash fixed.
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 14, 2008, 09:50:44 PM
Thanks gonosztopi
Title: Re: amuleweb problems with files in multiple folders
Post by: GonoszTopi on May 15, 2008, 04:13:29 AM
You're welcome.
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 15, 2008, 10:03:51 AM
I don't know whether it's possible to change language of application without restart, but if it is - interface in php is needed to do it from within webpage.
Title: Re: amuleweb problems with files in multiple folders
Post by: GonoszTopi on May 15, 2008, 05:31:15 PM
Very true. I did think about it, all you need to do it is to call CaMuleWebInterface::SetLocale() with the desired language code (e.g. "de"). I did not add it to PHP, since I would have needed more time to figure it out where to put it (maybe into php_amule_lib).

One another thing I was thinking of is making amuleweb multisession-safe, but that's another story.
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 15, 2008, 08:44:22 PM
php_amule_lib is place for amule_set_language(). Now, what makes you think that amuleweb is not multisession-safe? It's using session ID coming from client cookie, so it's perfectly possible to have multiple clients.
However, from now on, ALL clients will have interface in same language, but I think it's reasonable limitation.
Title: Re: amuleweb problems with files in multiple folders
Post by: GonoszTopi on May 19, 2008, 12:22:52 AM
However, from now on, ALL clients will have interface in same language.
That's exacly what I meant by multisession-safe, although I choose the wrong expression to express myself.
Ideally all clients could select different language and maybe also template, too.
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 19, 2008, 02:36:58 PM
Well, since gettext-style translation done on application level, the only solution would be fork() for each connected client.
Title: Re: amuleweb problems with files in multiple folders
Post by: GonoszTopi on May 19, 2008, 10:00:22 PM
Or to write the necessary functions for accessing GNU message catalogs.
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 20, 2008, 08:31:26 AM
This approach is:
1. Way too complicated
2. Creates unneeded link between webservser session management and language library
Title: Re: amuleweb problems with files in multiple folders
Post by: wuischke on May 20, 2008, 11:37:38 AM
We don't really need gettext itself, but I would like to use the po/mo format. If you want me to, I'll write a parser for mo files (http://www.gnu.org/software/gettext/manual/html_node/MO-Files.html) which we can integrate into amuleweb. This will solve multi-threading problem and I get to have some fun with C++ again...
Title: Re: amuleweb problems with files in multiple folders
Post by: GonoszTopi on May 20, 2008, 02:59:03 PM
wuischke: I would have done it already if there weren't ngettext and plural forms. But don't let this disencourage you - have lots of fun with C++ while writing it.
Title: Re: amuleweb problems with files in multiple folders
Post by: lfroen on May 20, 2008, 09:43:50 PM
NIH syndrome, ah?
Title: Re: amuleweb problems with files in multiple folders
Post by: wuischke on May 20, 2008, 10:27:10 PM
Good point, I'll save myself some fun and revert to copy, paste and adjust...just like in the eMule modding days...
Title: Re: amuleweb problems with files in multiple folders
Post by: wuischke on June 08, 2008, 01:37:32 PM
I just stumbled upon this link and need a place to save it... http://number-none.com/blow/code/mo_file/index.html