forked from Wavyzz/dolibarr
Fix external links ko when substitution key are inside domain
This commit is contained in:
@@ -5650,8 +5650,8 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newval).
|
* Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newval),
|
||||||
* Texts like __(TranslationKey|langfile)__ and __[ConstantKey]__ are also replaced.
|
* and texts like __(TranslationKey|langfile)__ and __[ConstantKey]__ are also replaced.
|
||||||
* Example of usage:
|
* Example of usage:
|
||||||
* $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $thirdparty);
|
* $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $thirdparty);
|
||||||
* complete_substitutions_array($substitutionarray, $langs, $thirdparty);
|
* complete_substitutions_array($substitutionarray, $langs, $thirdparty);
|
||||||
|
|||||||
@@ -237,9 +237,16 @@ class MenuManager
|
|||||||
{
|
{
|
||||||
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
$val2['url'] = make_substitutions($val2['url'], $substitarray);
|
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
|
||||||
|
|
||||||
$relurl2=dol_buildpath($val2['url'],1);
|
if (! preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url']))
|
||||||
|
{
|
||||||
|
$relurl2=dol_buildpath($val2['url'],1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$relurl2=$val2['url'];
|
||||||
|
}
|
||||||
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
|
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
|
||||||
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
|
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
|
||||||
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
|
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ class MenuManager
|
|||||||
$tmpleftmenu='all';
|
$tmpleftmenu='all';
|
||||||
$submenu=new Menu();
|
$submenu=new Menu();
|
||||||
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
|
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
|
||||||
|
// Note: $submenu contains menu entry with substitution not yet done
|
||||||
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
|
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
|
||||||
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
|
//if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
|
||||||
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
|
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
|
||||||
@@ -247,9 +248,16 @@ class MenuManager
|
|||||||
{
|
{
|
||||||
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
$val2['url'] = make_substitutions($val2['url'], $substitarray);
|
$val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
|
||||||
|
|
||||||
$relurl2=dol_buildpath($val2['url'],1);
|
if (! preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url']))
|
||||||
|
{
|
||||||
|
$relurl2=dol_buildpath($val2['url'],1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$relurl2=$val2['url'];
|
||||||
|
}
|
||||||
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
|
$canonurl2=preg_replace('/\?.*$/','',$val2['url']);
|
||||||
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
|
//var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
|
||||||
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
|
if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
|
||||||
|
|||||||
Reference in New Issue
Block a user