Skip to content

Commit

Permalink
Add missing files to pub/default/ and allow errors skin to be overrid…
Browse files Browse the repository at this point in the history
…den in pub/*/index.php file.
  • Loading branch information
colinmollenhour committed May 24, 2023
1 parent 2d953ba commit b060eb3
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
6 changes: 3 additions & 3 deletions errors/processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public function __construct()
$this->_root = is_dir($this->_indexDir.'app');

$this->_prepareConfig();
if (isset($_GET['skin'])) {
$this->_setSkin($_GET['skin']);
if (isset($_SERVER['MAGE_ERRORS_SKIN']) || isset($_GET['skin'])) {
$this->_setSkin($_SERVER['MAGE_ERRORS_SKIN'] ?? $_GET['skin']);
}
}

Expand Down Expand Up @@ -208,7 +208,7 @@ public function getBaseUrl(bool $param = false): string
*/
protected function _getClientIp(): string
{
return $_SERVER['REMOTE_ADDR'] ?? 'undefined';
return $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? 'undefined';
}

protected function _getIndexDir(): string
Expand Down
10 changes: 10 additions & 0 deletions pub/default/api.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
//
// This file is the entrypoint for the default OpenMage store.
// Create a separate subdirectory of pub/ to add more virtual hosts for different stores
// with different root directories and assign the run code and run type variables below as appropriate.
//

chdir(dirname(__DIR__, 2));

require 'api.php';
Binary file added pub/default/favicon.ico
Binary file not shown.
5 changes: 5 additions & 0 deletions pub/default/get.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

chdir(dirname(__DIR__, 2));

require 'get.php';
7 changes: 6 additions & 1 deletion pub/default/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// with different root directories and assign the run code and run type variables below as appropriate.
//

chdir(dirname(dirname(__DIR__)));
chdir(dirname(__DIR__, 2));

/* Store or website code */
if (empty($_SERVER['MAGE_RUN_CODE'])) {
Expand All @@ -17,4 +17,9 @@
$_SERVER['MAGE_RUN_TYPE'] = 'store';
}

/* Errors pages skin */
if (empty($_SERVER['MAGE_ERRORS_SKIN'])) {
$_SERVER['MAGE_ERRORS_SKIN'] = 'default';
}

require 'index.php';
9 changes: 9 additions & 0 deletions pub/default/install.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

chdir(dirname(__DIR__, 2));

if (file_exists('app/etc/local.xml')) {
require 'errors/404.php';
} else {
require 'install.php';
}

0 comments on commit b060eb3

Please sign in to comment.