Proposal: xarModSecURL
Marty Vance <[email protected]>
| Newsgroups | gmane.comp.cms.xaraya.devel |
|---|---|
| Organization | Xaraya |
| Message-ID | <[email protected]> |
The biggest barrier to using Xaraya for ecommerce (and other purposes)
is our inability to generate secure URL's for links and form actions.
This has been discussed before, but no ideal solution has been agreed to
for implementation.
I think I just came up with a solution for 1x, even though it not may
end up being carried over to 2x, where some type of request mapper has
been called for.
Rather than modifying the function definition for xarModURL, we add a
wrapper for it, as follows:
/**
* Generates an SSL URL that reference to a module function.
*
* @access public
* @global xarMod_generateShortURLs bool
* @global xarMod_generateXMLURLs bool
* @param modName string registered name of module
* @param modType string type of function
* @param funcName string module function
* @param args array of arguments to put on the URL
* @param generateXMLURL bool generate in XML format, defaults to
global setting
* @param fragment string document fragment target (e.g.
somesite.com/index.php?foo=bar#target)
* @param entrypoint array of arguments for different entrypoint than
index.php
* @return mixed absolute URL for call, or false on failure
* @todo allow for an alternative entry point (e.g. stream.php) without
affecting the other parameters
*/
function xarModSecURL($modName = NULL, $modType = 'user', $funcName =
'main', $args = array(), $generateXMLURL = NULL, $fragment = NULL,
$entrypoint = array())
{
$url = xarModURL($modName, $modType, $funcName, $args,
$generateXMLURL, $fragment, $entrypoint);
// don't set ssl if already enabled site-wide
if (xarConfigGetVar('Site.Core.EnableSecureServer') == true) {
return $url;
} else {
$securl = preg_replace('/^(\w+)/', '\1s', $url);
return $securl;
}
}