Changeset 1328

Show
Ignore:
Timestamp:
06/30/09 16:07:45 (8 months ago)
Author:
bermi
Message:

Adding another possible IP address location for AK_REMOTE_IP

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/constants.php

    r1252 r1328  
    22 
    33/** 
    4  * This file and the lib/constants.php file perform most part of Akelos  
     4 * This file and the lib/constants.php file perform most part of Akelos 
    55 * environment guessing. 
    6  *  
     6 * 
    77 * You can retrieve a list of current settings by running Ak::get_constants(); 
    88 * 
    9  * If you're running a high load site you might want to fine tune this options  
    10  * according to your environment. If you set the options implicitly you might  
    11  * gain in performance but loose in flexibility when moving to a different  
     9 * If you're running a high load site you might want to fine tune this options 
     10 * according to your environment. If you set the options implicitly you might 
     11 * gain in performance but loose in flexibility when moving to a different 
    1212 * environment. 
    13  *  
    14  * If you need to customize the framework default settings or specify  
     13 * 
     14 * If you need to customize the framework default settings or specify 
    1515 * internationalization options, edit the files at config/environments/* 
    1616 */ 
     
    2727// If you need to customize the framework default settings or specify internationalization options, 
    2828// edit the files config/testing.php, config/development.php, config/production.php 
    29 if(AK_ENVIRONMENT != 'setup'){         
     29if(AK_ENVIRONMENT != 'setup'){ 
    3030    require_once(AK_CONFIG_DIR.DS.'environments'.DS.AK_ENVIRONMENT.'.php'); 
    3131} 
     
    153153/** 
    154154 * This function sets a constant and returns it's value. If constant has been already defined it 
    155  * will reutrn its original value.  
    156  *  
     155 * will reutrn its original value. 
     156 * 
    157157 * Returns null in case the constant does not exist 
    158158 * 
     
    218218    ($_SERVER['SERVER_ADDR'] == '::1' ? '127.0.0.1' : $_SERVER['SERVER_ADDR']) : 
    219219    $_SERVER['SERVER_NAME']); 
    220     defined('AK_REMOTE_IP') ? null : define('AK_REMOTE_IP',(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']); 
     220    defined('AK_REMOTE_IP') ? null : define('AK_REMOTE_IP',(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : (!empty($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : (!empty($_ENV['HTTP_X_FORWARDED_FOR']) ? $_ENV['HTTP_X_FORWARDED_FOR'] : (empty($_ENV['REMOTE_ADDR']) ? false : $_ENV['REMOTE_ADDR'])))); 
    221221 
    222222    defined('AK_SERVER_STANDARD_PORT') ? null : define('AK_SERVER_STANDARD_PORT', AK_PROTOCOL == 'https://' ? '443' : '80');