Notice

The forum is in read only mode.

Support Forum

Welcome! Support Forums have been reactivated

Infinite redirections on multilanguage sites

8 years 8 months ago
  • Igor's Avatar
    Topic Author
  • Igor
  • Offline
  • Fresh Boarder
  • Thank you received: 2
Licenses:
JomSocial Expired AdAgency Expired iSEO Expired Socialize Expired

ISSUE SUMMARY:
AdAgency tries to redirect to url without language suffix. System plugin "Language Filter" redirects from url without suffix to url with suffix based on browser preferences.

STEPS TO REPLICATE:
Turn on system language filter plugin, create two languages (ex. 'ru' and 'en') and try to display ad agency menu. An attempt to enter any ad agency menu item, requiring approved advertiser account, leads to infinite redirections:

RESULT
index.php?option=com_adagency&Itemid=148 (ad agency control panel item id)
=> 303 (see other) .../ru/index.php?option=com_adagency&Itemid=148
(this is redirection by system language plugin)
and AdAgency redirects again to url without language suffix:
303 (see other) ?option=com_adagency&Itemid=148
...

EXPECTED RESULT
Show page, like it works with language filter plugin off.

BROWSER
Firefox 39

8 years 8 months ago
Licenses:

Hi, Igor.

I assign developer to this thread.


- Instead of saying: 'it's not working', explain the problem in detail.
- Screenshots with the URL visible in them and the problem marked are more than welcome.
- Tell us how to replicate the problem, we can't fix it if we can't find it.
- Make sure that your site/server meets JomSocial System Requirements
- Make sure to setup JomSocial Cron Job
- Always provide us with access details to the backend and ftp. We need it to debug problems.
- If you have a similar problem, but a solution you found isn't working, open a new thread instead of 'merging' with an existing one.

- Use the "Thank You" feature on any post that helped you
The following user(s) said Thank You: Igor
8 years 8 months ago
Licenses:

Hi Igor,
This is not a bug is something that is not developed yet in adagency.
I will inform our project Manager about this and maybe we will add on the road map for next development.
Thank you,
Alin

8 years 8 months ago
  • Igor's Avatar
    Topic Author
  • Igor
  • Offline
  • Fresh Boarder
  • Thank you received: 2
Licenses:
JomSocial Expired AdAgency Expired iSEO Expired Socialize Expired

Hi, Alin!

You should write in all capital on product page description that AdAgency extension does not support built-in Joomla multilanguage mode and thus cannot be used on multilanguage sites. That's really a pity.

Can we get money back then?

8 years 8 months ago
Licenses:

Igor,
can you please edit your first post and add there website login? admin and FTP? I want to have a look over.
Please advise.
Alin

The following user(s) said Thank You: Igor
8 years 8 months ago
  • Igor's Avatar
    Topic Author
  • Igor
  • Offline
  • Fresh Boarder
  • Thank you received: 2
Licenses:
JomSocial Expired AdAgency Expired iSEO Expired Socialize Expired

Thank you for reply. We've prepared a test package for this case.

Part of the message is hidden for the guests. Please log in or register to see it.


We've found out that bug seems to appear when not approved advertiser (like test superuser account) tries to open Control Panel, My Orders etc. menu. When you press back, you'll see:

"Your advertiser account is currently pending, therefore you can't access all the advertiser pages, when you're approved, we will send you an Email to let you know."

Repeated 10 times

Also we've faced broken link once, could you check for it in code?
/components/com_adagency/includes/css/adag_tip.css - 404 not found

8 years 8 months ago
Licenses:

Hi Igor,
Please give me a link and access to your installation, for some reason installing that package locally have some issues.
Having direct access to site where the issue is will help me better to debug. Please advise.
Thanks,
Alin

8 years 8 months ago
  • Igor's Avatar
    Topic Author
  • Igor
  • Offline
  • Fresh Boarder
  • Thank you received: 2
Licenses:
JomSocial Expired AdAgency Expired iSEO Expired Socialize Expired

Good day!
I've sent the link in JomSocial friend invitation dialog (no private messages here).

8 years 8 months ago
  • Igor's Avatar
    Topic Author
  • Igor
  • Offline
  • Fresh Boarder
  • Thank you received: 2
Licenses:
JomSocial Expired AdAgency Expired iSEO Expired Socialize Expired

Updated first post with test server credentials.

8 years 8 months ago
  • Igor's Avatar
    Topic Author
  • Igor
  • Offline
  • Fresh Boarder
  • Thank you received: 2
Licenses:
JomSocial Expired AdAgency Expired iSEO Expired Socialize Expired

Notices for undefined variables are fixed using @ before variable names.
Notice: Undefined property: stdClass::$id in modules\mod_ijoomla_adagency_zone\helper.php on line 1655
Notice: Undefined property: stdClass::$type in modules\mod_ijoomla_adagency_zone\helper.php on line 1777

Redirection problem:

Search by: AD_FAILEDAPPROVE, find $link="..." without JRoute::_ wrapper.
\components\com_adagency\controllers\adagencyReports.php:42, :80
adAgencyCpanel.php:37
...[about 10-12 files]...

Example:
$link="index.php?option=com_adagency".$Itemid;

Programmer forgot to use JRoute on link. Also JRoute second parameter should be false to not escape link, used later for redirections.

=> $link=JRoute::_("index.php?option=com_adagency".$Itemid, false);

Solution is regular expression search and replace through components\com_adagency\controllers\:

Find: ^(\s*)\$link(\s*)=(\s*)("index[^;]+);
Replace with: $1$link$2=$3JRoute::_($4, false);

Next problem does not concerns language at all. Infinite redirections are caused by adagencyCPanel.php.
It redirects unapproved advertisers to:
$item_id = $this->model2->getItemid('adagencyadvertiser');

:37 => $link=JRoute::_("index.php?option=com_adagency".$Itemid, false);
:50 => } elseif($adv_id[1]!='Y'){
$this->setRedirect($link, JText::_('AD_FAILEDAPPROVE'), 'notice');
}

Here the issue goes:

docs.joomla.org/Potential_backward_compa...Joomla_Platform_12.2
>> JDatabase::getEscaped() has been removed. Use JDatabase::escape() instead

Now look at com_adagency\models\adagencyconfig.php

function getItemid($controller){var_dump($controller);
        $db = JFactory::getDBO();
        $controller = $db->getEscaped($controller); // <<< ERROR, null returned
        $sql =  "SELECT id FROM `#__menu` 
                    WHERE `menutype` = 'adagency' 
                    AND `link` LIKE '%index.php?option=com_adagency&view={$controller}%' ";
        //echo "** " . $sql . " **";die();
        $db->setQuery($sql);
        $res = (int)$db->loadResult();var_dump([$controller, $sql, $res]);
        return ($res == 0) ? JRequest::getInt('Itemid', '0', 'get') :  $res;       
    }

$controller = $db->getEscaped($controller); => null
SQL query LIKE finds first matching "&view=" menu item, in our case, control panel itself. Thus we got infinite redirection.
Solution: replace method name "getEscaped" with "escape".

Please, fix the above mentioned at your side, including notices silencing so that updates would not ruin our project.
Git diff with fixes is attached to post.

Attachment diff.txt not found

This message has an attachment file.
Please log in or register to see it.

8 years 7 months ago
Licenses:

Hi,

I added for next version all these changes and soon a new AdAgency version will be released.

The following user(s) said Thank You: Igor
8 years 7 months ago
  • Igor's Avatar
    Topic Author
  • Igor
  • Offline
  • Fresh Boarder
  • Thank you received: 2
Licenses:
JomSocial Expired AdAgency Expired iSEO Expired Socialize Expired

Thanks, Alin. We appreciate your help.

Moderators: Piotr Garasiński
Powered by Kunena Forum

Join 180,000 websites creating Amazing communities

JomSocial is the most complete, easy-to-use addon that turns Joomla CMS into a
full -fledged, social networking site

TRY NOW BUY NOW