mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-18 20:40:36 +01:00
Risoluzione del bug #83
Risoluzione del bug #83, causato da un problema di confronto tra percorsi.
This commit is contained in:
parent
c432209ea6
commit
a2c6a6984d
2
core.php
2
core.php
@ -127,7 +127,7 @@ $dbo = Database::getConnection();
|
|||||||
// Controllo sulla presenza dei permessi di accesso basilari
|
// Controllo sulla presenza dei permessi di accesso basilari
|
||||||
$continue = $dbo->isInstalled() && !Update::isUpdateAvailable() && (Auth::check() || API::isAPIRequest());
|
$continue = $dbo->isInstalled() && !Update::isUpdateAvailable() && (Auth::check() || API::isAPIRequest());
|
||||||
|
|
||||||
if (!$continue && slashes($_SERVER['SCRIPT_FILENAME']) != slashes(DOCROOT.'/index.php')) {
|
if (!$continue && getURLPath() != slashes(ROOTDIR.'/index.php')) {
|
||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
}
|
}
|
||||||
|
@ -879,3 +879,20 @@ function isMobile()
|
|||||||
{
|
{
|
||||||
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER['HTTP_USER_AGENT']);
|
return preg_match("/(android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|up\.browser|up\.link|webos|wos)/i", $_SERVER['HTTP_USER_AGENT']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Restituisce il percorso derivante dal file in esecuzione.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getURLPath()
|
||||||
|
{
|
||||||
|
$path = $_SERVER['SCRIPT_FILENAME'];
|
||||||
|
$prefix = $_SERVER['DOCUMENT_ROOT'];
|
||||||
|
|
||||||
|
if (substr($path, 0, strlen($prefix)) == $prefix) {
|
||||||
|
$path = substr($path, strlen($prefix));
|
||||||
|
}
|
||||||
|
|
||||||
|
return slashes($path);
|
||||||
|
}
|
||||||
|
@ -339,7 +339,7 @@ class API extends \Util\Singleton
|
|||||||
*/
|
*/
|
||||||
public static function isAPIRequest()
|
public static function isAPIRequest()
|
||||||
{
|
{
|
||||||
return slashes($_SERVER['SCRIPT_FILENAME']) == slashes(DOCROOT.'/api/index.php');
|
return getURLPath() == slashes(ROOTDIR.'/api/index.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,7 +67,7 @@ class Permissions
|
|||||||
$result = true;
|
$result = true;
|
||||||
|
|
||||||
if (!self::getSkip()) {
|
if (!self::getSkip()) {
|
||||||
if (!Auth::check() && slashes($_SERVER['SCRIPT_FILENAME']) == slashes(DOCROOT.'/index.php')) {
|
if (!Auth::check() && getURLPath() == slashes(ROOTDIR.'/index.php')) {
|
||||||
redirect(ROOTDIR.'/index.php');
|
redirect(ROOTDIR.'/index.php');
|
||||||
exit();
|
exit();
|
||||||
$result = false;
|
$result = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user