Compare commits
1 Commits
1c89b6cb4f
...
19b51b382b
Author | SHA1 | Date | |
---|---|---|---|
|
19b51b382b |
30
App.php
30
App.php
@ -172,7 +172,10 @@ class App
|
|||||||
$config['rewrite_url'] = true;
|
$config['rewrite_url'] = true;
|
||||||
$nbLevels = count(explode('/',$configDir.$requestUrl));
|
$nbLevels = count(explode('/',$configDir.$requestUrl));
|
||||||
} elseif (!empty($_SERVER['SCRIPT_NAME']) && substr($_SERVER['SCRIPT_NAME'],-strlen($supposedEndUrlForNotRewrite)) == $supposedEndUrlForNotRewrite) {
|
} elseif (!empty($_SERVER['SCRIPT_NAME']) && substr($_SERVER['SCRIPT_NAME'],-strlen($supposedEndUrlForNotRewrite)) == $supposedEndUrlForNotRewrite) {
|
||||||
|
$config['rewrite_url'] = true;
|
||||||
$nbLevels = count(explode('/',$configDir)) -1;
|
$nbLevels = count(explode('/',$configDir)) -1;
|
||||||
|
} else {
|
||||||
|
$this->appendContentToServerfNeeded($nbLevels,$config);
|
||||||
}
|
}
|
||||||
} elseif (!empty($_SERVER['SCRIPT_NAME']) && is_string($_SERVER['SCRIPT_NAME'])) {
|
} elseif (!empty($_SERVER['SCRIPT_NAME']) && is_string($_SERVER['SCRIPT_NAME'])) {
|
||||||
$matches = [];
|
$matches = [];
|
||||||
@ -192,6 +195,8 @@ class App
|
|||||||
}
|
}
|
||||||
$nbLevels = count(explode('/',$configDir)) -1;
|
$nbLevels = count(explode('/',$configDir)) -1;
|
||||||
$config['rewrite_url'] = true;
|
$config['rewrite_url'] = true;
|
||||||
|
} else {
|
||||||
|
$this->appendContentToServerfNeeded($nbLevels,$config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,4 +205,29 @@ class App
|
|||||||
$config['plugins_url'] = $previous.$config['plugins_url'];
|
$config['plugins_url'] = $previous.$config['plugins_url'];
|
||||||
$pico->setConfig($config);
|
$pico->setConfig($config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* append 'content' to $_SERVER var
|
||||||
|
* @param int &$nbLevels
|
||||||
|
* @param array &$config
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function appendContentToServerfNeeded(int &$nbLevels, array &$config): bool
|
||||||
|
{
|
||||||
|
if (!empty($_SERVER['SCRIPT_NAME']) && substr($_SERVER['SCRIPT_NAME'],-strlen('index.php')) == 'index.php' &&
|
||||||
|
!empty($_SERVER['SCRIPT_FILENAME']) &&
|
||||||
|
is_file(dirname($_SERVER['SCRIPT_FILENAME']).'/content/index.php')) {
|
||||||
|
if (!empty($_SERVER['SCRIPT_FILENAME'])){
|
||||||
|
$_SERVER['SCRIPT_FILENAME'] = str_replace('index.php','content/index.php',$_SERVER['SCRIPT_FILENAME']);
|
||||||
|
}
|
||||||
|
if (!empty($_SERVER['REQUEST_URI'])){
|
||||||
|
$_SERVER['REQUEST_URI'] = str_replace(['?','//content/'],['/content/?','/content/'],$_SERVER['REQUEST_URI']);
|
||||||
|
}
|
||||||
|
$_SERVER['SCRIPT_NAME'] = dirname($_SERVER['SCRIPT_NAME']).'/content/index.php';
|
||||||
|
$nbLevels = 1;
|
||||||
|
$config['rewrite_url'] = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user