Welcome Guest, Not a member yet? Register   Sign In
index.php - Defined Constants not Absolute [with fix]
#3

[eluser]Pygon[/eluser]
The only thing you correctly identified that I have screwed up is the use of dirname(). You're absolutely right that this is a correct use and I did make a mistake.

Otherwise, "dirname is available, because some hosts disable it". I must be under a misconception from the PHP documentation that this PHP core function, as well as "realpath". In fact, this isn't even possible to disable according to any php configuration I could find. Also, "./" is in no way an absolute path without using realpath, and I'm not even sure where your quote came from since it's not in any of my post.

Look, I'm not trying to be an ass ([redacted]), I'm trying to improve the framework. A simple "realpath would actually include the filename" would have been useful.

Fixed:
Code:
/*
|---------------------------------------------------------------
| SET THE SERVER PATH
|---------------------------------------------------------------
|
| Let's attempt to determine the full server path to the "system"
| folder in order to reduce the possibility of path problems.
|
*/
$system_folder = str_replace('\\','/',realpath($system_folder));
if(!$system_folder)
{
    //Try the default
    $system_folder = str_replace('\\','/',realpath(dirname(__FILE__)).'/system');
}
if(!is_dir($system_folder))
{
    die('Invalid system folder specified. Please check your $system_folder setting.');
}

/*
|---------------------------------------------------------------
| SET THE APPLICATION PATH
|---------------------------------------------------------------
|
| Let's attempt to determine the full system path to the "application"
| folder in order to reduce the possibility of path problems.
|
*/
$application_folder = str_replace('\\','/',realpath($application_folder));
if(!$application_folder)
{
    //Try the default
    $application_folder = str_replace('\\','/',realpath(BASEPATH.'application'));
}
if(!is_dir($application_folder))
{
    die('Invalid system folder specified. Please check your $system_folder setting.');
}


/*
|---------------------------------------------------------------
| DEFINE APPLICATION CONSTANTS
|---------------------------------------------------------------
|
| EXT        - The file extension.  Typically ".php"
| FCPATH    - The full server path to THIS file
| SELF        - The name of THIS file (typically "index.php)
| BASEPATH    - The full server path to the "system" folder
| APPPATH    - The full server path to the "application" folder
|
*/
define('EXT', '.'.pathinfo(__FILE__, PATHINFO_EXTENSION));
define('FCPATH', __FILE__);
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('BASEPATH', $system_folder.'/');
define('APPPATH',$application_folder.'/');


Messages In This Thread
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-18-2008, 05:35 PM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-18-2008, 07:16 PM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-18-2008, 09:04 PM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 06:50 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 07:15 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 09:48 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 10:55 AM
index.php - Defined Constants not Absolute [with fix] - by El Forum - 07-19-2008, 12:11 PM



Theme © iAndrew 2016 - Forum software by © MyBB