Phocadownload token and sh404sef

Phoca Download - download manager
parsifaltheking
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 16 Jul 2013, 12:30

Phocadownload token and sh404sef

Post by parsifaltheking »

Hi, i've installed phocadownload 3.0.6 on joomla 3.4.1 and sh404sef.
So the component work but i've a problem when i wanto to use Token to download a file. I've enabled it in the option and create the token in the file.
The link that the system create is in this form:

http://www.xxx.it/component/phocadownlo ... 6c8d991c41

but if i insert it in a new browser page the link is changed in:

http://www.xxx.it/it/component/phocadow ... 6c8d991c41

where xxx is my site.

So i think that the sh404sef component changed it, so i've setting in the option that phocadownload skyp the rewrite but anything change.. so what i can do to use token with this component?

Thanks..
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phocadownload token and sh404sef

Post by Jan »

Hi, when you disable the SEF component and enable the standard core Joomla! SEF, do you get the same problem?
If you find Phoca extensions useful, please support the project
parsifaltheking
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 16 Jul 2013, 12:30

Re: Phocadownload token and sh404sef

Post by parsifaltheking »

I've disable url rewrite on joomla and sh404sef component and the link generated works.. so i think it's a sh404sef component problem. i've open a support ticket.



Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phocadownload token and sh404sef

Post by Jan »

Ok
If you find Phoca extensions useful, please support the project
parsifaltheking
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 16 Jul 2013, 12:30

Re: Phocadownload token and sh404sef

Post by parsifaltheking »

Hi, we have investigated with sh404sef team the problem for the token link and there is a problem.
In the site with sh404sef enabled and global configuration -> URl Sef enabled YES and Rewrite Url Sef - Yes phoca generate a wrong link in backend with token:

http://www.xxx.it/component/phocadownlo ... 64019a3b73
but goes mi a 404 error.

But if i use a non sef url with 404sef enable i obtain this link and it works:

http://www.xxx.it/it/?option=com_phocad ... 36c359f4b9

So there is a way to creati working link at file with sh404sef enabled?

Thanks
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phocadownload token and sh404sef

Post by Jan »

Hi, unfortunately I don't know sh404sef, the link is created the following way:

- if there is no menu link to Phoca Download, the SEF link will not work
- if there is one, Phoca Download asks Joomla! to create SEF link (by JRoute method)

So now the question is if sh404sef uses the standard SEF methods or not, if not then the creation of the link needs to be customized directly in the code :idea:

Jan
If you find Phoca extensions useful, please support the project
parsifaltheking
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 16 Jul 2013, 12:30

Re: Phocadownload token and sh404sef

Post by parsifaltheking »

Hi, this is the reply from sh404sef team:

The root of the problem is that Joomla API doesn't provide any way of getting the front-end SEF URL of a page while you are in the backend. So developers have to find tricks to do it, and sometimes those tricks while OK with Joomla SEF only may not be ok Joomla+sh404SEF.

sh404SEF does provide an API to get the frontend SEF URL from the backend, which works for components that uses sh404SEF routing.
The code to use is:

$nonSef = ''index.php?option=com_content&Itemid=272&format=feed&id=14&lang=en&type=rss&view=category'';
if (!defined('SH404SEF_IS_RUNNING'))
{
$sef = Sh404sefHelperGeneral::getSefFromNonSef( $nonSef);
}
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phocadownload token and sh404sef

Post by Jan »

Ok, so does it work for you, when you customize it?

Jan
If you find Phoca extensions useful, please support the project
parsifaltheking
Phoca Newbie
Phoca Newbie
Posts: 9
Joined: 16 Jul 2013, 12:30

Re: Phocadownload token and sh404sef

Post by parsifaltheking »

Hi, this is The code that The team send to me But i dont have idea where or how insert it in The component
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48566
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phocadownload token and sh404sef

Post by Jan »

Hi, see:

administrator\components\com_phocadownload\views\phocadownloadfile\tmpl\edit.php

cca line 81
if (isset($this->item->id) && isset($this->item->catid) && isset($this->item->token)
...
}
If you find Phoca extensions useful, please support the project
Post Reply