I thought that $_SERVER['HTTPS'] is true or false. We should use your
code in Aiki, I don't see the reason why to use $config['url'].


On Mon, 6 Feb 2012 18:37:25 +0100
Roger Martín <[email protected]> wrote:

> 2012/2/6 Jakub Jankiewicz <[email protected]>
> 
> > I'm wonder why Aiki how url can't we just pull that info from
> > $_SERVER like that (It should work)
> >
> 
> i don't know. Wordpress has this disadvantage. Drupal and joomla no.
> In Drupal base url is calculated by
> ...
> $base_root = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ?
> 'https' : 'http';
> 
>     // As $_SERVER['HTTP_HOST'] is user input, ensure it only contains
>     // characters allowed in hostnames.
>     $base_url = $base_root .= '://'. preg_replace('/[^a-z0-9-:._]/i',
> '', $_SERVER['HTTP_HOST']);
> 
>     // $_SERVER['SCRIPT_NAME'] can, in contrast to
> $_SERVER['PHP_SELF'], not // be modified by a visitor.
>     if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
>       $base_path = "/$dir";
>       $base_url .= $base_path;
>       $base_path .= '/';
>     }
>     else {
>       $base_path = '/';
>     }
> .....
> So in aiki, perhaps it can be:
> $config["url"] =
>     'http' . ( isset($_SERVER['HTTPS']) &&  $_SERVER['HTTPS']=="on" ?
> 's' : '') . '://' .
>     $_SERVER['HTTP_HOST'] . ($_SERVER['SERVER_PORT'] != 80 ? ':' .
> $_SERVER['SERVER_PORT'] : '') .
>     preg_replace("/" . basename($_SERVER['SCRIPT_NAME']) . "$/", "",
> $_SERVER['SCRIPT_NAME']);

--
Jakub Jankiewicz
twitter: @jcubic
www: http://jcubic.pl

-- 
You received this bug notification because you are a member of Aiki
Framework Admins, which is subscribed to aikiframework.
https://bugs.launchpad.net/bugs/927527

Title:
  there is not an easy way to change aiki_config options from config.php

Status in Aiki Framework:
  Confirmed

Bug description:
  It is totally silly and laborious that the path to moving an aiki site
  involved dumping the database and then hand editing the aiki_config
  table that is serialized data, or doing this from mysql client.

  We need a simple way like in wordpress to do:

  set_config('url', 'http://somesite.com/');

  and be able to run this from a config.php file once, so we can update
  a site rather than the alternative.

  Could we get this done for this 0.9.0 release? I can't stand doing
  this anymore and some way to set all the aiki_config options from the
  config.php would be supervaluable override. Wordpress can do this, and
  we should be able to do it to!

  rg1024, what do you think? Is there a good simple way to get this done
  now and then be compatible with your config class work coming up?

To manage notifications about this bug go to:
https://bugs.launchpad.net/aikiframework/+bug/927527/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework.admins
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework.admins
More help   : https://help.launchpad.net/ListHelp

Reply via email to