Perf: Another speed enhancement to win 6 ms.
This commit is contained in:
parent
252c8eefd5
commit
582d4d21b7
@ -3594,26 +3594,22 @@ function dol_getIdFromCode($db,$key,$tablename,$fieldkey='code',$fieldid='id')
|
|||||||
*/
|
*/
|
||||||
function verifCond($strRights)
|
function verifCond($strRights)
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$leftmenu;
|
global $user,$conf,$langs;
|
||||||
global $rights; // To export to dol_eval function
|
global $leftmenu;
|
||||||
|
global $rights; // To export to dol_eval function
|
||||||
|
|
||||||
//print $strRights."<br>\n";
|
//print $strRights."<br>\n";
|
||||||
if ($strRights != "")
|
$rights = true;
|
||||||
|
if ($strRights != '')
|
||||||
{
|
{
|
||||||
$rights = true;
|
//$tab_rights = explode('&&', $strRights);
|
||||||
$tab_rights = explode("||", $strRights);
|
//$i = 0;
|
||||||
$i = 0;
|
//while (($i < count($tab_rights)) && ($rights == true)) {
|
||||||
while (($i < count($tab_rights)) && ($rights == true)) {
|
|
||||||
$str = 'if(!(' . $strRights . ')) { $rights = false; }';
|
$str = 'if(!(' . $strRights . ')) { $rights = false; }';
|
||||||
dol_eval($str);
|
dol_eval($str);
|
||||||
$i++;
|
// $i++;
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$rights = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $rights;
|
return $rights;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3621,22 +3617,16 @@ function verifCond($strRights)
|
|||||||
* Replace eval function to add more security.
|
* Replace eval function to add more security.
|
||||||
* This function is called by verifCond().
|
* This function is called by verifCond().
|
||||||
* @param string $s
|
* @param string $s
|
||||||
* @return int 1
|
|
||||||
*/
|
*/
|
||||||
function dol_eval($s)
|
function dol_eval($s)
|
||||||
{
|
{
|
||||||
// Only global variables can be changed by eval function and returned to caller
|
// Only global variables can be changed by eval function and returned to caller
|
||||||
global $langs, $user, $conf;
|
global $langs, $user, $conf;
|
||||||
|
global $leftmenu;
|
||||||
global $rights;
|
global $rights;
|
||||||
global $leftmenu;
|
|
||||||
|
|
||||||
// \todo
|
|
||||||
// Warning. We must add code to exclude test if it contains = (affectation) that is not == (compare)
|
|
||||||
|
|
||||||
//print $s."<br>\n";
|
//print $s."<br>\n";
|
||||||
eval($s);
|
eval($s);
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user