Re: Proposal: xarModSecURL

"Crisp" <crispcreations-gM/[email protected]>
Newsgroups gmane.comp.cms.xaraya.devel
Organization CrispCreations
Message-ID <[email protected]>
I haven't got any secure links to test on myself, but I don't see a problem 
with the proposed solution.

I don't see the harm in putting this in core, since it doesn't affect any 
existing functions and no other solution has been found.

Chris
"Marty Vance" <[email protected]> wrote in message 
news:[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;
>     }
> }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.