Skip to content

Commit

Permalink
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into d…
Browse files Browse the repository at this point in the history
…evelop
  • Loading branch information
eldy committed Jul 7, 2017
2 parents 2be9f40 + 09e9255 commit 024c6d2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions htdocs/api/index.php
Expand Up @@ -131,9 +131,9 @@
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$reg))
if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i",$file,$regmod))
{
$module = strtolower($reg[1]);
$module = strtolower($regmod[1]);
$moduledirforclass = getModuleDirForApiClass($module);
$moduleforperm = $module;
if ($module == 'propale') { $moduleforperm='propal'; }
Expand All @@ -159,9 +159,9 @@
if ($file_searched == 'api_access.class.php') continue;

// Support of the deprecated API.
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$regapi))
{
$classname = ucwords($reg[1]).'Api';
$classname = ucwords($regapi[1]).'Api';
require_once $dir_part.$file_searched;
if (class_exists($classname))
{
Expand All @@ -173,9 +173,9 @@
dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
}
}
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
elseif (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$regapi))
{
$classname = ucwords($reg[1]);
$classname = ucwords($regapi[1]);
$classname = str_replace('_', '', $classname);
require_once $dir_part.$file_searched;
if (class_exists($classname))
Expand Down Expand Up @@ -206,7 +206,7 @@
}

// Call one APIs or one definition of an API
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis))))
if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/resources.json' && preg_match('/^\/resources.json\/(.+)$/', $reg[2], $regbis) && $regbis[1] != 'root')))
{
$module = $reg[1];
if ($module == 'explorer') // If we call page to explore details of a service
Expand Down

0 comments on commit 024c6d2

Please sign in to comment.