diff --git a/htdocs/api/index.php b/htdocs/api/index.php index 0e54d0cb8af..21d60bdab73 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -131,9 +131,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' | { 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'; } @@ -159,9 +159,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' | 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)) { @@ -173,9 +173,9 @@ if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/resources.json' | 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))