Jump to content



Issue Information

  • #000557

  • 0 - None Assigned

  • New

  • 2.3

  • -

Issue Confirmations

  • Yes (1)No (0)
Photo

SSL links in the admin fail if given 'SSL' connection

Posted by mattjt83 on 15 January 2013 - 02:45 PM

I recently discovered that if you designate an 'SSL' connection in the tep_href_link function in the admin the link will print out as:

https://www.mysite.com/admin/HTTPS_SERVER/admin/any-file.php

Sample link to repeat issue:

tep_href_link(FILENAME_ORDERS, '', 'SSL')

This is due to the fact that HTTPS_SERVER is not defined in the admin/includes/configure.php file.  Since HTTPS_CATALOG_SERVER is defined in the configure file I simply changed the function in my admin/includes/functions/html_output.php to use the HTTPS_CATALOG_SERVER constant instead.

New function:

////
// The HTML href link wrapper function
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL') {
$page = tep_output_string($page);
if ($page == '') {
	 die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine the page link!<br /><br />Function used:<br /><br />tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</strong>');
}
if ($connection == 'NONSSL') {
	 $link = HTTP_SERVER . DIR_WS_ADMIN;
} elseif ($connection == 'SSL') {
	 if (ENABLE_SSL_CATALOG == 'true') {
	 $link = HTTPS_CATALOG_SERVER . DIR_WS_ADMIN;
	 } else {
	 $link = HTTP_SERVER . DIR_WS_ADMIN;
	 }
} else {
	 die('</td></tr></table></td></tr></table><br /><br /><font color="#ff0000"><strong>Error!</strong></font><br /><br /><strong>Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL<br /><br />Function used:<br /><br />tep_href_link(\'' . $page . '\', \'' . $parameters . '\', \'' . $connection . '\')</strong>');
}
if ($parameters == '') {
	 $link = $link . $page . '?' . SID;
} else {
	 $link = $link . $page . '?' . tep_output_string($parameters) . '&' . SID;
}
while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
return $link;
}

Hope that helps!

Thanks! Good catch. The configuration would be better solution if using different subdomain for the shop.

Yes, I agree the configuration file is a better option depending on your needs.  Either way, simple fix :)