Introduce yourself here! In order to avoid spam, new users must first comment on the discussion in the 'Introductions' before they become 'full members'
Support https
  • Originally from  http://flatpress.org/vanilla2/discussion/1311/blog_baseurl-doesnt-work-with-https/p1

    Please merge.


    Index: flatpress/defaults.php
    ===================================================================
    --- flatpress/defaults.php      (revision 415)
    +++ flatpress/defaults.php      (working copy)
    @@ -112,7 +112,7 @@
            define('BLOG_ROOT', ('/'==($v=dirname($_SERVER['SCRIPT_NAME']))? $v : $v.'/') );


    -       define('BLOG_BASEURL', 'http://'.$_SERVER['HTTP_HOST']. BLOG_ROOT);
    +       define('BLOG_BASEURL', '//'.$_SERVER['HTTP_HOST']. BLOG_ROOT);

     #function _dummy() {}
     #set_error_handler('_dummy');
    Index: flatpress/setup/tpls/step2.tpl.php
    ===================================================================
    --- flatpress/setup/tpls/step2.tpl.php  (revision 415)
    +++ flatpress/setup/tpls/step2.tpl.php  (working copy)
    @@ -55,7 +55,7 @@
                            <label for="www">       <?php echo $l['www']; ?>       </label>
                    </dt>
                    <dd>
    -                       <input type="text" id="www" name="www" value="<?php echo BLOG_BASEURL ; ?>" />
    +                       <input type="text" id="www" name="www" value="<?php echo ( (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https:' : 'http:' ) . BLOG_BASEURL ; ?>" />
                    </dd>

                    <dt>
    @@ -72,4 +72,4 @@
            value="<?php echo $lang['buttonbar']['next']; ?>" />
     </div>

    -</div>
    \ No newline at end of file
    +</div>
    Index: flatpress/fp-includes/core/core.cookie.php
    ===================================================================
    --- flatpress/fp-includes/core/core.cookie.php  (revision 415)
    +++ flatpress/fp-includes/core/core.cookie.php  (working copy)
    @@ -17,9 +17,9 @@
             define('SESS_COOKIE', 'fpsess_'. COOKIEHASH);

     if ( !defined('COOKIEPATH') )
    -        define('COOKIEPATH', preg_replace('|https?://[^/]+|i', '', BLOG_BASEURL ) );
    +        define('COOKIEPATH', preg_replace('|(https?:)?//[^/]+|i', '', BLOG_BASEURL ) );
     if ( !defined('SITECOOKIEPATH') )
    -        define('SITECOOKIEPATH', preg_replace('|https?://[^/]+|i', '', BLOG_BASEURL ) );
    +        define('SITECOOKIEPATH', preg_replace('|(https?:)?//[^/]+|i', '', BLOG_BASEURL ) );
     if ( !defined('COOKIE_DOMAIN') )
             define('COOKIE_DOMAIN', false);

    @@ -135,4 +135,4 @@
     endif;


    -?>
    \ No newline at end of file
    +?>

  • I don't understand the change in core.cookie.php; parentheses don't seem to affect the regexp since you aren't using backreferences anywhere.

    as for the change in step2.tpl.php, is it really needed, once BLOG_BASEURL drops the http: or https: part? shouldn't that just read "echo BLOG_BASEURL" ? 
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion