Forums / General / Detect if url has https.

Detect if url has https.

Author Message

Guillaume R

Friday 02 March 2007 7:17:12 am

Hey, I was wondering if it was possible to detect http or https in an url address using an eZ Publish function.

The reason I'm looking for this kind of function is that in IE, when there is non-secured elements in a https page, we get a popup warning the user.. and with this function, I could make this non-secure content change when this is a secured page.

Thanks!

kracker (the)

Friday 02 March 2007 12:49:14 pm

I took a brief look for the related online ...
<i>http://ez.no/doc/content/advancedsearch?SearchText=SSL&PhraseSearchText=&SearchSectionID=10&SearchContentClassID=-1&isOnDocumentation=true&SubTreeArray%5B%5D=documentation&SearchPageLimit=4&SearchButton=Search</i>

I would comment that you would do well to learn the configuration settings (features) offered by the sslzonesettings block.

<i>http://ez.no/doc/ez_publish/technical_manual/3_8/reference/configuration_files/site_ini/sslzonesettings</i>

Ad while these settings are not as well documented (yet) in the latest eZ Publish 3.8 documentation manuals as you may like they are fairly simple in nature, I wager you could learn them by reviewing existing settings (global defaults in setting/site.ini).

There is also the new feature documentation txt file on this subject in svn,
<i>http://pubsvn.ez.no/nextgen/trunk/doc/features/3.8/ssl_zones.txt</i>

<i>//kracker

Home Movies : Hot Dog Music</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

kracker (the)

Friday 02 March 2007 1:14:11 pm

And from the 'stuff-you-see-but-always-forget-where-dept', there was a great article which covered this subject,
<i>http://ez.no/community/articles/new_features_in_ez_publish_3_8/applying_ssl_zones</i>

<i>//kracker

The Pink Panther Theme</i>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/

Guillaume R

Friday 02 March 2007 1:43:00 pm

Ok thank you very much, I will take a good look at it.

Karl Latiss

Saturday 03 March 2007 5:54:09 pm

I went another way and used the wrapper operator (http://ez.no/community/contribs/template_plugins/wrapper_operator) with a small user function getServerVariable.php:

<?php

    function getServerVariable($variable)
    {
        return $_SERVER[$variable];
    }

?>

Then in my template have

{def $https=wrap_user_func('getServerVariable', array('HTTPS'))}

and check with

{if eq($https, 'on')}

Atvert Systems
http://www.atvert.com.au

Saturday 03 March 2007 6:39:57 pm

Smart move Adjax ;D

A lot more of those lost, would do well to make the most from the wrap operator's simple ability to provide for simpler solutions, like tpl -> PHP -> (*anything*) -> PHP - > tpl -> user ...

<i>//darken
AntIcon - Music For The Advancement Of Hip Hop - Divine Disappointment- Alias</i>

kracker (the)

Sunday 04 March 2007 12:47:25 am

Added to example / available wrap_operator extension's stock function's available (not enabled by default). See the commit log message for more information, <i>http://pubsvn.ez.no/websvn/listing.php?repname=community&path=%2Ftrunk%2Fextension%2Fwrap_operator%2F&rev=1521&sc=1</i>

<i>//kracker</i>
<b>Sole : Bottle of Humans</b>

Member since: 2001.07.13 || http://ezpedia.se7enx.com/