mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 03:51:25 +01:00
Fix substition for menus title and urls
This commit is contained in:
@@ -520,8 +520,8 @@ class Menubase
|
|||||||
$sql.= " ORDER BY m.position, m.rowid";
|
$sql.= " ORDER BY m.position, m.rowid";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
//$tmp1=microtime(true);
|
//$tmp1=microtime(true);
|
||||||
//print '>>> 1 0<br>';
|
//print '>>> 1 0<br>';
|
||||||
dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
|
dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
@@ -558,7 +558,8 @@ class Menubase
|
|||||||
// Define $title
|
// Define $title
|
||||||
if ($enabled)
|
if ($enabled)
|
||||||
{
|
{
|
||||||
$title = $langs->trans($menu['titre']);
|
$title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
|
||||||
|
//var_dump($title.'-'.$menu['titre']);
|
||||||
if ($title == $menu['titre']) // Translation not found
|
if ($title == $menu['titre']) // Translation not found
|
||||||
{
|
{
|
||||||
if (! empty($menu['langs'])) // If there is a dedicated translation file
|
if (! empty($menu['langs'])) // If there is a dedicated translation file
|
||||||
@@ -567,6 +568,9 @@ class Menubase
|
|||||||
$langs->load($menu['langs']);
|
$langs->load($menu['langs']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$menu['titre'] = make_substitutions($menu['titre'], $substitarray);
|
||||||
|
|
||||||
if (preg_match("/\//",$menu['titre'])) // To manage translation when title is string1/string2
|
if (preg_match("/\//",$menu['titre'])) // To manage translation when title is string1/string2
|
||||||
{
|
{
|
||||||
$tab_titre = explode("/",$menu['titre']);
|
$tab_titre = explode("/",$menu['titre']);
|
||||||
@@ -584,8 +588,8 @@ class Menubase
|
|||||||
$title = $langs->trans($menu['titre']);
|
$title = $langs->trans($menu['titre']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//$tmp4=microtime(true);
|
//$tmp4=microtime(true);
|
||||||
//print '>>> 3 '.($tmp4 - $tmp3).'<br>';
|
//print '>>> 3 '.($tmp4 - $tmp3).'<br>';
|
||||||
|
|
||||||
// We complete tabMenu
|
// We complete tabMenu
|
||||||
$tabMenu[$b]['rowid'] = $menu['rowid'];
|
$tabMenu[$b]['rowid'] = $menu['rowid'];
|
||||||
|
|||||||
@@ -635,7 +635,7 @@ class Translate
|
|||||||
}
|
}
|
||||||
else // Translation is not available
|
else // Translation is not available
|
||||||
{
|
{
|
||||||
if ($key[0] == '$') { return dol_eval($key,1); }
|
//if ($key[0] == '$') { return dol_eval($key,1); }
|
||||||
return $this->getTradFromKey($key);
|
return $this->getTradFromKey($key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
|
// Substitution variables for GETPOST (used to get final url with variable parameters or final default value with variable paramaters)
|
||||||
// Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOUNTRYID__, __USERID__, __ENTITYID__, ...
|
// Example of variables: __DAY__, __MONTH__, __YEAR__, __MYCOMPANY_COUNTRY_ID__, __USER_ID__, ...
|
||||||
// We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
|
// We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text.
|
||||||
if (! is_array($out) && empty($_POST[$paramname]) && empty($noreplace))
|
if (! is_array($out) && empty($_POST[$paramname]) && empty($noreplace))
|
||||||
{
|
{
|
||||||
@@ -485,7 +485,7 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
|
|||||||
elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
elseif ($reg[1] == 'NEXT_DAY') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_day($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['day']; }
|
||||||
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
elseif ($reg[1] == 'NEXT_MONTH') { $tmp=dol_getdate(dol_now(), true); $tmp2=dol_get_next_month($tmp['mday'], $tmp['mon'], $tmp['year']); $newout = $tmp2['month']; }
|
||||||
elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); }
|
elseif ($reg[1] == 'NEXT_YEAR') { $tmp=dol_getdate(dol_now(), true); $newout = ($tmp['year'] + 1); }
|
||||||
elseif ($reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID')
|
elseif ($reg[1] == 'MYCOMPANY_COUNTRY_ID' || $reg[1] == 'MYCOUNTRY_ID' || $reg[1] == 'MYCOUNTRYID')
|
||||||
{
|
{
|
||||||
$newout = $mysoc->country_id;
|
$newout = $mysoc->country_id;
|
||||||
}
|
}
|
||||||
@@ -493,11 +493,11 @@ function GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NU
|
|||||||
{
|
{
|
||||||
$newout = $user->id;
|
$newout = $user->id;
|
||||||
}
|
}
|
||||||
elseif ($reg[1] == 'SUPERVISOR_ID' || $reg[1] == 'SUPERVISORID')
|
elseif ($reg[1] == 'USER_SUPERVISOR_ID' || $reg[1] == 'SUPERVISOR_ID' || $reg[1] == 'SUPERVISORID')
|
||||||
{
|
{
|
||||||
$newout = $user->fk_user;
|
$newout = $user->fk_user;
|
||||||
}
|
}
|
||||||
elseif ($reg[1] == 'ENTITYID')
|
elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID')
|
||||||
{
|
{
|
||||||
$newout = $conf->entity;
|
$newout = $conf->entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,12 +73,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
|
|||||||
$showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
$showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
||||||
if ($showmode == 1)
|
if ($showmode == 1)
|
||||||
{
|
{
|
||||||
// $menu_array[$i]['url'] can be a relative url, a full external url or a dynamic value like '$conf->global->APARAM)
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
if (preg_match('/^\$conf->global->([^\?]+)/', $newTabMenu[$i]['url'], $reg))
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
{
|
$newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray);
|
||||||
$keyforsconst=$reg[1];
|
|
||||||
$newTabMenu[$i]['url'] = $conf->global->$keyforsconst;
|
|
||||||
}
|
|
||||||
|
|
||||||
$url = $shorturl = $newTabMenu[$i]['url'];
|
$url = $shorturl = $newTabMenu[$i]['url'];
|
||||||
|
|
||||||
@@ -105,11 +102,6 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$m
|
|||||||
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
|
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
|
||||||
}
|
}
|
||||||
|
|
||||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
|
||||||
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
|
|
||||||
$url=preg_replace('/__USERID__/',$user->id,$url);
|
|
||||||
$shorturl=preg_replace('/__USERID__/',$user->id,$shorturl);
|
|
||||||
|
|
||||||
// TODO Find a generic solution
|
// TODO Find a generic solution
|
||||||
if (preg_match('/search_project_user=__search_project_user__/', $shorturl))
|
if (preg_match('/search_project_user=__search_project_user__/', $shorturl))
|
||||||
{
|
{
|
||||||
@@ -511,10 +503,13 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
|
||||||
|
|
||||||
// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
|
// Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
|
||||||
$url=dol_buildpath($menu_array[$i]['url'],1);
|
$url=dol_buildpath($menu_array[$i]['url'],1);
|
||||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
|
||||||
$url=preg_replace('/__USERID__/',$user->id,$url);
|
|
||||||
|
|
||||||
if (! preg_match('/mainmenu=/i',$menu_array[$i]['url']))
|
if (! preg_match('/mainmenu=/i',$menu_array[$i]['url']))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,9 +157,11 @@ class MenuManager
|
|||||||
print '<li class="lilevel0">';
|
print '<li class="lilevel0">';
|
||||||
if ($val['enabled'] == 1)
|
if ($val['enabled'] == 1)
|
||||||
{
|
{
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||||
|
|
||||||
$relurl=dol_buildpath($val['url'],1);
|
$relurl=dol_buildpath($val['url'],1);
|
||||||
$relurl=preg_replace('/__LOGIN__/',$user->login,$relurl);
|
|
||||||
$relurl=preg_replace('/__USERID__/',$user->id,$relurl);
|
|
||||||
$canonurl=preg_replace('/\?.*$/','',$val['url']);
|
$canonurl=preg_replace('/\?.*$/','',$val['url']);
|
||||||
|
|
||||||
print '<a class="alilevel0" href="#">';
|
print '<a class="alilevel0" href="#">';
|
||||||
@@ -233,9 +235,11 @@ class MenuManager
|
|||||||
|
|
||||||
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
|
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
|
||||||
{
|
{
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val2['url'] = make_substitutions($val2['url'], $substitarray);
|
||||||
|
|
||||||
$relurl2=dol_buildpath($val2['url'],1);
|
$relurl2=dol_buildpath($val2['url'],1);
|
||||||
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
|
|
||||||
$relurl2=preg_replace('/__USERID__/',$user->id,$relurl2);
|
|
||||||
$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='';
|
||||||
|
|||||||
@@ -273,7 +273,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
|||||||
$menu->add('/adherents/index.php?mainmenu=members&leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 100, $id, $idsel, $classname);
|
$menu->add('/adherents/index.php?mainmenu=members&leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 100, $id, $idsel, $classname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Show personalized menus
|
// Show personalized menus
|
||||||
$menuArbo = new Menubase($db,'eldy');
|
$menuArbo = new Menubase($db,'eldy');
|
||||||
$newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu); // Return tabMenu with only top entries
|
$newTabMenu = $menuArbo->menuTopCharger('','',$type_user,'eldy',$tabMenu); // Return tabMenu with only top entries
|
||||||
@@ -286,6 +285,10 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
|||||||
$showmode=isVisibleToUserType($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
$showmode=isVisibleToUserType($type_user,$newTabMenu[$i],$listofmodulesforexternal);
|
||||||
if ($showmode == 1)
|
if ($showmode == 1)
|
||||||
{
|
{
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray);
|
||||||
|
|
||||||
// url = url from host, shorturl = relative path into dolibarr sources
|
// url = url from host, shorturl = relative path into dolibarr sources
|
||||||
$url = $shorturl = $newTabMenu[$i]['url'];
|
$url = $shorturl = $newTabMenu[$i]['url'];
|
||||||
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) // Do not change url content for external links
|
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url'])) // Do not change url content for external links
|
||||||
@@ -301,10 +304,6 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
|||||||
$shorturl = $url;
|
$shorturl = $url;
|
||||||
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
|
if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
|
||||||
}
|
}
|
||||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
|
||||||
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
|
|
||||||
$url=preg_replace('/__USERID__/',$user->id,$url);
|
|
||||||
$shorturl=preg_replace('/__USERID__/',$user->id,$shorturl);
|
|
||||||
|
|
||||||
// Define the class (top menu selected or not)
|
// Define the class (top menu selected or not)
|
||||||
if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"';
|
if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"';
|
||||||
@@ -1598,12 +1597,10 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $menu_array[$i]['url'] can be a relative url, a full external url or a dynamic value like '$conf->global->APARAM)
|
// $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution
|
||||||
if (preg_match('/^\$conf->global->([^\?]+)/', $menu_array[$i]['url'], $reg))
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
{
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
$keyforsconst=$reg[1];
|
$menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
|
||||||
$menu_array[$i]['url'] = $conf->global->$keyforsconst;
|
|
||||||
}
|
|
||||||
|
|
||||||
$url = $shorturl = $menu_array[$i]['url'];
|
$url = $shorturl = $menu_array[$i]['url'];
|
||||||
|
|
||||||
@@ -1626,11 +1623,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
$url = dol_buildpath($url,1).($param?'?'.$param:'');
|
||||||
$shorturl = $shorturl.($param?'?'.$param:'');
|
$shorturl = $shorturl.($param?'?'.$param:'');
|
||||||
}
|
}
|
||||||
|
//var_dump($url);
|
||||||
|
|
||||||
$url=preg_replace('/__LOGIN__/',$user->login,$url);
|
|
||||||
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
|
|
||||||
$url=preg_replace('/__USERID__/',$user->id,$url);
|
|
||||||
$shorturl=preg_replace('/__USERID__/',$user->id,$shorturl);
|
|
||||||
|
|
||||||
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
|
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
|
||||||
|
|
||||||
@@ -1656,6 +1650,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
print '<div class="menu_top"></div>'."\n";
|
print '<div class="menu_top"></div>'."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menu level > 0
|
// Menu level > 0
|
||||||
if ($menu_array[$i]['level'] > 0)
|
if ($menu_array[$i]['level'] > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -165,9 +165,11 @@ class MenuManager
|
|||||||
|
|
||||||
if ($val['enabled'] == 1)
|
if ($val['enabled'] == 1)
|
||||||
{
|
{
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||||
|
|
||||||
$relurl=dol_buildpath($val['url'],1);
|
$relurl=dol_buildpath($val['url'],1);
|
||||||
$relurl=preg_replace('/__LOGIN__/',$user->login,$relurl);
|
|
||||||
$relurl=preg_replace('/__USERID__/',$user->id,$relurl);
|
|
||||||
$canonurl=preg_replace('/\?.*$/','',$val['url']);
|
$canonurl=preg_replace('/\?.*$/','',$val['url']);
|
||||||
|
|
||||||
print '<a class="alilevel0" href="#">';
|
print '<a class="alilevel0" href="#">';
|
||||||
@@ -243,9 +245,11 @@ class MenuManager
|
|||||||
|
|
||||||
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
|
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
|
||||||
{
|
{
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val2['url'] = make_substitutions($val2['url'], $substitarray);
|
||||||
|
|
||||||
$relurl2=dol_buildpath($val2['url'],1);
|
$relurl2=dol_buildpath($val2['url'],1);
|
||||||
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
|
|
||||||
$relurl2=preg_replace('/__USERID__/',$user->id,$relurl2);
|
|
||||||
$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='';
|
||||||
|
|||||||
@@ -150,11 +150,13 @@ class MenuManager
|
|||||||
print '<ul class="ulmenu" data-inset="true">';
|
print '<ul class="ulmenu" data-inset="true">';
|
||||||
print '<li class="lilevel0">';
|
print '<li class="lilevel0">';
|
||||||
|
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||||
|
|
||||||
if ($val['enabled'] == 1)
|
if ($val['enabled'] == 1)
|
||||||
{
|
{
|
||||||
$relurl=dol_buildpath($val['url'],1);
|
$relurl=dol_buildpath($val['url'],1);
|
||||||
$relurl=preg_replace('/__LOGIN__/',$user->login,$relurl);
|
|
||||||
$relurl=preg_replace('/__USERID__/',$user->id,$relurl);
|
|
||||||
$canonurl=preg_replace('/\?.*$/','',$val['url']);
|
$canonurl=preg_replace('/\?.*$/','',$val['url']);
|
||||||
|
|
||||||
print '<a class="alilevel0" href="#">';
|
print '<a class="alilevel0" href="#">';
|
||||||
@@ -249,9 +251,11 @@ class MenuManager
|
|||||||
|
|
||||||
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
|
if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
|
||||||
{
|
{
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val2['url'] = make_substitutions($val2['url'], $substitarray);
|
||||||
|
|
||||||
$relurl2=dol_buildpath($val2['url'],1);
|
$relurl2=dol_buildpath($val2['url'],1);
|
||||||
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
|
|
||||||
$relurl2=preg_replace('/__USERID__/',$user->id,$relurl2);
|
|
||||||
$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='';
|
||||||
@@ -447,11 +451,14 @@ class MenuManager
|
|||||||
{
|
{
|
||||||
print '<ul class="ulmenu" data-inset="true">';
|
print '<ul class="ulmenu" data-inset="true">';
|
||||||
print '<li class="lilevel0">';
|
print '<li class="lilevel0">';
|
||||||
|
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val['url'] = make_substitutions($val['url'], $substitarray);
|
||||||
|
|
||||||
if ($val['enabled'] == 1)
|
if ($val['enabled'] == 1)
|
||||||
{
|
{
|
||||||
$relurl=dol_buildpath($val['url'],1);
|
$relurl=dol_buildpath($val['url'],1);
|
||||||
$relurl=preg_replace('/__LOGIN__/',$user->login,$relurl);
|
|
||||||
$relurl=preg_replace('/__USERID__/',$user->id,$relurl);
|
|
||||||
|
|
||||||
print '<a href="#">'.$val['titre'].'</a>'."\n";
|
print '<a href="#">'.$val['titre'].'</a>'."\n";
|
||||||
// Search submenu fot this entry
|
// Search submenu fot this entry
|
||||||
@@ -474,9 +481,11 @@ class MenuManager
|
|||||||
}
|
}
|
||||||
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
|
||||||
{
|
{
|
||||||
|
$substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
|
||||||
|
$substitarray['__USERID__'] = $user->id; // For backward compatibility
|
||||||
|
$val2['url'] = make_substitutions($val2['url'], $substitarray);
|
||||||
|
|
||||||
$relurl2=dol_buildpath($val2['url'],1);
|
$relurl2=dol_buildpath($val2['url'],1);
|
||||||
$relurl2=preg_replace('/__LOGIN__/',$user->login,$relurl2);
|
|
||||||
$relurl2=preg_replace('/__USERID__/',$user->id,$relurl2);
|
|
||||||
//var_dump($val2);
|
//var_dump($val2);
|
||||||
print '<li><a href="'.$relurl2.'">'.$val2['titre'].'</a></li>'."\n";
|
print '<li><a href="'.$relurl2.'">'.$val2['titre'].'</a></li>'."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class modExternalSite extends DolibarrModules
|
|||||||
$this->menu[$r]=array(
|
$this->menu[$r]=array(
|
||||||
'fk_menu'=>0,
|
'fk_menu'=>0,
|
||||||
'type'=>'top',
|
'type'=>'top',
|
||||||
'titre'=>'$conf->global->EXTERNALSITE_LABEL',
|
'titre'=>'__[EXTERNALSITE_LABEL]__',
|
||||||
'mainmenu'=>'externalsite',
|
'mainmenu'=>'externalsite',
|
||||||
'url'=>'/externalsite/frames.php',
|
'url'=>'/externalsite/frames.php',
|
||||||
'langs'=>'other',
|
'langs'=>'other',
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ if ($action == 'update')
|
|||||||
|
|
||||||
$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity);
|
$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity);
|
||||||
$i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
|
$i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
|
||||||
//$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($_POST["EXTERNALSITE_LABEL"]),'chaine',0,'',$conf->entity);
|
|
||||||
|
|
||||||
if ($i >= 2)
|
if ($i >= 2)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -452,7 +452,6 @@ input[type=file ] { background-color: transparent; border-top: none; border-l
|
|||||||
input[type=checkbox] { background-color: transparent; border: none; box-shadow: none; }
|
input[type=checkbox] { background-color: transparent; border: none; box-shadow: none; }
|
||||||
input[type=radio] { background-color: transparent; border: none; box-shadow: none; }
|
input[type=radio] { background-color: transparent; border: none; box-shadow: none; }
|
||||||
input[type=image] { background-color: transparent; border: none; box-shadow: none; }
|
input[type=image] { background-color: transparent; border: none; box-shadow: none; }
|
||||||
input[type=text] { min-width: 20px; }
|
|
||||||
input:-webkit-autofill {
|
input:-webkit-autofill {
|
||||||
background-color: #FBFFEA !important;
|
background-color: #FBFFEA !important;
|
||||||
background-image:none !important;
|
background-image:none !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user