Skip to content

Commit

Permalink
Use constant for document root value if defined
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasWeinert committed Jul 13, 2018
1 parent a5546c8 commit 8983ed3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/system/Papaya/Util/File/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,15 @@ public static function getBasePath($includeDocumentRoot = TRUE) {
* @return string
*/
public static function getDocumentRoot($options = NULL) {
if (defined('PAPAYA_DOCUMENT_ROOT')) {
return self::cleanup(PAPAYA_DOCUMENT_ROOT);
}
if (!empty($_SERVER['DOCUMENT_ROOT'])) {
return self::cleanup($_SERVER['DOCUMENT_ROOT']);
} elseif (isset($_SERVER['SCRIPT_FILENAME'])) {
}
if (isset($_SERVER['SCRIPT_FILENAME'])) {
$path = dirname($_SERVER['SCRIPT_FILENAME']);
if (isset($options)) {
if (NULL !== $options) {
if ($options->get('PAPAYA_ADMIN_PAGE', FALSE)) {
$path = dirname($path);
}
Expand Down

0 comments on commit 8983ed3

Please sign in to comment.