Skip to Content Skip to Menu

Uddeim API Access Using Cron

  • drdehart
  • drdehart
  • OFFLINE
  • Posts: 253
  • Thanks: 2
  • Karma: 1
12 years 7 months ago #196473 by drdehart
Replied by drdehart on topic Re: Uddeim API Access Using Cron
OK - we are also trying to formulate a question for our hosting company, hoping that they may know some reason why the http behavior is different than the cron behavior. But we have some gaps in our understanding of how the api works. Here is what we are intending to ask:

We are running a php script in a cron job and the results are different than when we run it in http mode (through a browser window). The script calls two variables %msglink% and %_site_% each of these variables are supposed to call the domain uri of the site ( www.domain.com ). The %site% variable is only supposed to call the domain part ( www.domain.com ), while the %msglink% variable is supposed to contain both the domain and additional path parameters, like www.domain.com/index.php?option=com_uddeim&task=show&Itemid=100050&messageid=48557 .

Unfortunately, when we run the script from the cron job, %msglink% fails to bring the www.domain.com part of the url; it only brings the index.php?option=com_uddeim&task=show&Itemid=100050&messageid=48557 part of the url. When run from http, it brings the complete url.

The %_site_% variable brings the domain information in both cron and http modes (the way it is supposed to do).

The script that creates these links is as follows:

%_site_% script:

[here is what we don't know]

%msglink% script:

[here is what we don't know]

Can you think of any reason or problem with the script that is creating this %msglink% url links?

Slabbi - can you provide the missing information on the scripts?

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
12 years 7 months ago #196482 by slabbi
Replied by slabbi on topic Re: Uddeim API Access Using Cron
The code can be found in includes.php function uddeIMdispatchEMN():
Code:
$msglink = ""; if ($cryptmode==2 || $cryptmode==4) { // Message is encrypted, so go to enter password page if ($config->dontsefmsglink) $msglink = $pathtosite."/index.php?option=com_uddeim&task=showpass&Itemid=".$item_id."&messageid=".$var_msgid; else $msglink = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showpass&Itemid=".$item_id."&messageid=".$var_msgid); } else { // normal message if ($config->dontsefmsglink) $msglink = $pathtosite."/index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$var_msgid; else $msglink = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=show&Itemid=".$item_id."&messageid=".$var_msgid); }

Maybe you can try to use "No SEF for %msglink%" (in email tab).

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

  • drdehart
  • drdehart
  • OFFLINE
  • Posts: 253
  • Thanks: 2
  • Karma: 1
12 years 7 months ago #196512 by drdehart
Replied by drdehart on topic Re: Uddeim API Access Using Cron
We checked the referenced file - includes.php - and found the following:

function uddeIMdispatchEMN has three different variables:

$var_body = str_replace("%livesite%", $pathtosite, $var_body);
$var_body = str_replace("%site%", $mosConfig_sitename, $var_body);
$var_body = str_replace("%msglink%", $msglink, $var_body);

Only one of them works properly in a cron job - %site% since it gets value from config.sitename
%msglink% does not work since it could be part of the variable $pathtosite = uddeIMgetPath('live_site'); and at the same time "%livesite% - does not work since it uses JURI::root. JURI:root gets JURI:base. JURI:base uses $_SERVER array which is created by the web server or live_site. Live site variable is empty in our case based on the recommendation of the CB team ( www.joomlapolis.com/forum/153-professional-member-support/177543-livesite-variable#177543 ).

We think that's why we keep getting empty domain name when cron job runs the script.

We did not debug each step. But seems logical why domain name is empty.
please verify and suggest a solution if possible.

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
12 years 7 months ago #196520 by slabbi
Replied by slabbi on topic Re: Uddeim API Access Using Cron
In Joomla 1.0 it was possible to use
$mainframe->getCfg('live_site');
in order to get the value from the configuration file.

Maybe this works:

$config =& JFactory::getConfig();
return $config->getValue('live_site');

instead of

return substr_replace(JURI::root(), '', -1, 1)

in uddeIMgetPath().

While writing this I have no access to my dev system to check the code but maybe you can try it.

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

  • drdehart
  • drdehart
  • OFFLINE
  • Posts: 253
  • Thanks: 2
  • Karma: 1
12 years 7 months ago #196530 by drdehart
Replied by drdehart on topic Re: Uddeim API Access Using Cron
You think this would work if the variable live_site is empty? Still looks like it calls live_site, so even if we get the value, it is still empty.

Please Log in or Create an account to join the conversation.

  • slabbi
  • slabbi
  • OFFLINE
  • Posts: 3709
  • Thanks: 250
  • Karma: 153
12 years 7 months ago #196559 by slabbi
Replied by slabbi on topic Re: Uddeim API Access Using Cron
This value is taken from the configuration, not from the _SERVER variables, so it might work.

uddeIM & uddePF Development
CB Language Workgroup
CB 3rd Party Developer

Please Log in or Create an account to join the conversation.

Moderators: beatnantslabbikrileon
Powered by Kunena Forum