forked from Wavyzz/dolibarr
Debug v19
This commit is contained in:
@@ -1598,18 +1598,26 @@ function dol_escape_json($stringtoescape)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns text escaped for inclusion into a php string, build with double quotes "
|
* Returns text escaped for inclusion into a php string, build with double quotes " or '
|
||||||
*
|
*
|
||||||
* @param string $stringtoescape String to escape
|
* @param string $stringtoescape String to escape
|
||||||
|
* @param string $stringforquotes 2=String for doublequotes, 1=String for simple quotes
|
||||||
* @return string Escaped string for json content.
|
* @return string Escaped string for json content.
|
||||||
*/
|
*/
|
||||||
function dol_escape_php($stringtoescape)
|
function dol_escape_php($stringtoescape, $stringforquotes = 2)
|
||||||
{
|
{
|
||||||
if (is_null($stringtoescape)) {
|
if (is_null($stringtoescape)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_replace('"', "'", $stringtoescape);
|
if ($stringforquotes == 2) {
|
||||||
|
return str_replace('"', "'", $stringtoescape);
|
||||||
|
}
|
||||||
|
if ($stringforquotes == 1) {
|
||||||
|
return str_replace("'", "\'", str_replace('"', "'", $stringtoescape));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'Bad parameter for stringforquotes in dol_escape_php';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1110,21 +1110,22 @@ function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action)
|
|||||||
|
|
||||||
$val_actuel = $menu;
|
$val_actuel = $menu;
|
||||||
$next_val = empty($menus[$index + 1]) ? null : $menus[$index + 1];
|
$next_val = empty($menus[$index + 1]) ? null : $menus[$index + 1];
|
||||||
|
//var_dump(dol_escape_php($menu['perms'], 1)); exit;
|
||||||
|
|
||||||
$str_menu .= $start."\n";
|
$str_menu .= $start."\n";
|
||||||
$str_menu.= "\t\t\$this->menu[\$r++]=array(\n";
|
$str_menu.= "\t\t\$this->menu[\$r++]=array(\n";
|
||||||
$str_menu.= "\t\t\t 'fk_menu' =>'".$menu['fk_menu']."',\n";
|
$str_menu.= "\t\t\t 'fk_menu' => '".dol_escape_php($menu['fk_menu'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'type' =>'".$menu['type']."',\n";
|
$str_menu.= "\t\t\t 'type' => '".dol_escape_php($menu['type'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'titre' =>'".$menu['titre']."',\n";
|
$str_menu.= "\t\t\t 'titre' => '".dol_escape_php($menu['titre'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'mainmenu' =>'".$menu['mainmenu']."',\n";
|
$str_menu.= "\t\t\t 'mainmenu' => '".dol_escape_php($menu['mainmenu'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'leftmenu' =>'".$menu['leftmenu']."',\n";
|
$str_menu.= "\t\t\t 'leftmenu' => '".dol_escape_php($menu['leftmenu'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'url' =>'".$menu['url']."',\n";
|
$str_menu.= "\t\t\t 'url' => '".dol_escape_php($menu['url'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'langs' =>'".$menu['langs']."',\n";
|
$str_menu.= "\t\t\t 'langs' => '".dol_escape_php($menu['langs'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'position' =>".$menu['position'].",\n";
|
$str_menu.= "\t\t\t 'position' => ".((int) $menu['position']).",\n";
|
||||||
$str_menu.= "\t\t\t 'enabled' =>'".$menu['enabled']."',\n";
|
$str_menu.= "\t\t\t 'enabled' => '".dol_escape_php($menu['enabled'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'perms' =>'".$menu['perms']."',\n";
|
$str_menu.= "\t\t\t 'perms' => '".dol_escape_php($menu['perms'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'target' =>'".$menu['target']."',\n";
|
$str_menu.= "\t\t\t 'target' => '".dol_escape_php($menu['target'], 1)."',\n";
|
||||||
$str_menu.= "\t\t\t 'user' =>".$menu['user'].",\n";
|
$str_menu.= "\t\t\t 'user' => ".((int) $menu['user']).",\n";
|
||||||
$str_menu.= "\t\t);\n";
|
$str_menu.= "\t\t);\n";
|
||||||
|
|
||||||
if (is_null($next_val) || $val_actuel['leftmenu'] !== $next_val['leftmenu']) {
|
if (is_null($next_val) || $val_actuel['leftmenu'] !== $next_val['leftmenu']) {
|
||||||
|
|||||||
@@ -1765,7 +1765,6 @@ if ($dirins && $action == 'addproperty' && empty($cancel) && !empty($module) &&
|
|||||||
|
|
||||||
// Make a redirect to reload all data
|
// Make a redirect to reload all data
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname.'&nocache='.time());
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname.'&nocache='.time());
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1808,7 +1807,6 @@ if ($dirins && $action == 'confirm_deleteproperty' && $propertykey) {
|
|||||||
|
|
||||||
// Make a redirect to reload all data
|
// Make a redirect to reload all data
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname);
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=objects&module='.$module.($forceddirread ? '@'.$dirread : '').'&tabobj='.$objectname);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2577,8 +2575,9 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) {
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
setEventMessages($result, null, 'errors');
|
setEventMessages($result, null, 'errors');
|
||||||
}
|
}
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
|
||||||
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
// load class and check if menu exist
|
// load class and check if menu exist
|
||||||
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
||||||
@@ -2636,8 +2635,9 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
setEventMessages($result, null, 'errors');
|
setEventMessages($result, null, 'errors');
|
||||||
}
|
}
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
|
||||||
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@@ -2736,6 +2736,7 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
|
|||||||
'target' => GETPOST('target', 'alpha'),
|
'target' => GETPOST('target', 'alpha'),
|
||||||
'user' => GETPOST('user', 'alpha'),
|
'user' => GETPOST('user', 'alpha'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (GETPOST('type') == 'left') {
|
if (GETPOST('type') == 'left') {
|
||||||
unset($menuToAdd['prefix']);
|
unset($menuToAdd['prefix']);
|
||||||
if (empty(GETPOST('fk_menu'))) {
|
if (empty(GETPOST('fk_menu'))) {
|
||||||
@@ -2757,11 +2758,19 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
|
|||||||
if ($checkcomment < 0) {
|
if ($checkcomment < 0) {
|
||||||
setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings');
|
setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings');
|
||||||
} else {
|
} else {
|
||||||
reWriteAllMenus($moduledescriptorfile, $menus, $menuToAdd, null, 1);
|
// Write all menus
|
||||||
|
$result = reWriteAllMenus($moduledescriptorfile, $menus, $menuToAdd, null, 1);
|
||||||
|
|
||||||
clearstatcache(true);
|
clearstatcache(true);
|
||||||
if (function_exists('opcache_invalidate')) {
|
if (function_exists('opcache_invalidate')) {
|
||||||
opcache_reset();
|
opcache_reset();
|
||||||
}
|
}
|
||||||
|
/*if ($result < 0) {
|
||||||
|
setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors');
|
||||||
|
header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1));
|
||||||
|
exit;
|
||||||
|
}*/
|
||||||
|
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
||||||
setEventMessages($langs->trans('MenuAddedSuccesfuly'), null);
|
setEventMessages($langs->trans('MenuAddedSuccesfuly'), null);
|
||||||
exit;
|
exit;
|
||||||
@@ -2769,14 +2778,13 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// modify a menu
|
// Modify a menu entry
|
||||||
if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST('tabobj')) {
|
if ($dirins && $action == "update_menu" && GETPOST('menukey', 'int') && GETPOST('tabobj')) {
|
||||||
$objectname = GETPOST('tabobj');
|
$objectname = GETPOST('tabobj');
|
||||||
$dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
|
$dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath'];
|
||||||
$destdir = $dirins.'/'.strtolower($module);
|
$destdir = $dirins.'/'.strtolower($module);
|
||||||
$objects = dolGetListOfObjectClasses($destdir);
|
$objects = dolGetListOfObjectClasses($destdir);
|
||||||
|
|
||||||
|
|
||||||
if (empty($cancel)) {
|
if (empty($cancel)) {
|
||||||
if (isModEnabled(strtolower($module))) {
|
if (isModEnabled(strtolower($module))) {
|
||||||
$result = unActivateModule(strtolower($module));
|
$result = unActivateModule(strtolower($module));
|
||||||
@@ -2784,8 +2792,9 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST(
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
setEventMessages($result, null, 'errors');
|
setEventMessages($result, null, 'errors');
|
||||||
}
|
}
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
|
||||||
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$error = 0;
|
$error = 0;
|
||||||
// for loading class and the menu wants to modify
|
// for loading class and the menu wants to modify
|
||||||
@@ -2815,7 +2824,7 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST(
|
|||||||
'langs' => strtolower($module)."@".strtolower($module),
|
'langs' => strtolower($module)."@".strtolower($module),
|
||||||
'position' => '',
|
'position' => '',
|
||||||
'enabled' => GETPOST('enabled', 'alpha'),
|
'enabled' => GETPOST('enabled', 'alpha'),
|
||||||
'perms' => '',
|
'perms' => GETPOST('perms', 'alpha'),
|
||||||
'target' => GETPOST('target', 'alpha'),
|
'target' => GETPOST('target', 'alpha'),
|
||||||
'user' => GETPOST('user', 'alpha'),
|
'user' => GETPOST('user', 'alpha'),
|
||||||
);
|
);
|
||||||
@@ -2826,15 +2835,10 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST(
|
|||||||
} else {
|
} else {
|
||||||
$menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu');
|
$menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu');
|
||||||
}
|
}
|
||||||
if (GETPOST('enabled') != '0') {
|
if ($menuModify['enabled'] === '') {
|
||||||
$menuModify['enabled'] = 'isModEnabled("'.strtolower($module).'")';
|
$menuModify['enabled'] = '1';
|
||||||
} else {
|
|
||||||
$menuModify['enabled'] = '0';
|
|
||||||
}
|
}
|
||||||
if (!empty(GETPOST('perms')) && !empty(GETPOST('objects'))) {
|
if ($menuModify['perms'] === '') {
|
||||||
$menuModify['perms'] = '$user->hasRight("'.strtolower($module).'", "'.GETPOST('objects', 'alpha').'", "'.GETPOST('perms', 'alpha').'")';
|
|
||||||
}
|
|
||||||
if (empty(GETPOST('objects'))) {
|
|
||||||
$menuModify['perms'] = '1';
|
$menuModify['perms'] = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2842,23 +2846,29 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST(
|
|||||||
$error++;
|
$error++;
|
||||||
setEventMessages($langs->trans("ErrorTypeMenu", $langs->transnoentities("type")), null, 'errors');
|
setEventMessages($langs->trans("ErrorTypeMenu", $langs->transnoentities("type")), null, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
//update menu
|
//update menu
|
||||||
$checkComment = checkExistComment($moduledescriptorfile, 0);
|
$checkComment = checkExistComment($moduledescriptorfile, 0);
|
||||||
|
|
||||||
if ($checkComment < 0) {
|
if ($checkComment < 0) {
|
||||||
setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings');
|
setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings');
|
||||||
} else {
|
} else {
|
||||||
|
// Write all menus
|
||||||
$result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2);
|
$result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2);
|
||||||
|
|
||||||
clearstatcache(true);
|
clearstatcache(true);
|
||||||
if (function_exists('opcache_invalidate')) {
|
if (function_exists('opcache_invalidate')) {
|
||||||
opcache_reset();
|
opcache_reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors');
|
setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors');
|
||||||
|
//var_dump($_SESSION);exit;
|
||||||
header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1));
|
header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null);
|
setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null);
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
||||||
exit;
|
exit;
|
||||||
@@ -2881,8 +2891,9 @@ if ($dirins && $action == "update_props_module" && !empty(GETPOST('keydescriptio
|
|||||||
if ($result) {
|
if ($result) {
|
||||||
setEventMessages($result, null, 'errors');
|
setEventMessages($result, null, 'errors');
|
||||||
}
|
}
|
||||||
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
|
||||||
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings');
|
||||||
|
header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module);
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath'];
|
||||||
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
|
||||||
@@ -5023,7 +5034,7 @@ if ($module == 'initmodule') {
|
|||||||
print '<table class="noborder small">';
|
print '<table class="noborder small">';
|
||||||
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ');
|
print_liste_field_titre("#", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center tdsticky tdstickygray ');
|
||||||
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("Position", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center');
|
print_liste_field_titre("Title", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center');
|
||||||
print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
print_liste_field_titre("LinkToParentMenu", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder);
|
||||||
@@ -5039,10 +5050,11 @@ if ($module == 'initmodule') {
|
|||||||
print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans(''));
|
print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans(''));
|
||||||
|
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
$r = count($menus)+1;
|
$r = count($menus)+1;
|
||||||
// for adding menu on module
|
// for adding menu on module
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td class="center"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>';
|
print '<td class="center tdsticky tdstickygray"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>';
|
||||||
print '<td class="center">';
|
print '<td class="center">';
|
||||||
print '<select class="maxwidth50" name="type">';
|
print '<select class="maxwidth50" name="type">';
|
||||||
print '<option value="">'.$langs->trans("........").'</option><option value="'.dol_escape_htmltag("left").'">left</option><option value="'.dol_escape_htmltag("top").'">top</option>';
|
print '<option value="">'.$langs->trans("........").'</option><option value="'.dol_escape_htmltag("left").'">left</option><option value="'.dol_escape_htmltag("top").'">top</option>';
|
||||||
@@ -5103,6 +5115,7 @@ if ($module == 'initmodule') {
|
|||||||
|
|
||||||
//var_dump($menus);
|
//var_dump($menus);
|
||||||
|
|
||||||
|
// Loop on each menu entry
|
||||||
if (count($menus)) {
|
if (count($menus)) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($menus as $menu) {
|
foreach ($menus as $menu) {
|
||||||
@@ -5121,10 +5134,6 @@ if ($module == 'initmodule') {
|
|||||||
$propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target');
|
$propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target');
|
||||||
$propEnabled = !empty($menu['enabled']) ? $menu['enabled'] : GETPOST('enabled');
|
$propEnabled = !empty($menu['enabled']) ? $menu['enabled'] : GETPOST('enabled');
|
||||||
|
|
||||||
// Perms
|
|
||||||
$propPerms = str_replace(array('$user->hasRight(', ')'), '', $propPerms);
|
|
||||||
$arguments = explode(",", $propPerms);
|
|
||||||
|
|
||||||
$objPerms = (empty($arguments[1]) ? '' : trim($arguments[1]));
|
$objPerms = (empty($arguments[1]) ? '' : trim($arguments[1]));
|
||||||
$valPerms = (empty($arguments[2]) ? '' : trim($arguments[2]));
|
$valPerms = (empty($arguments[2]) ? '' : trim($arguments[2]));
|
||||||
|
|
||||||
@@ -5135,7 +5144,7 @@ if ($module == 'initmodule') {
|
|||||||
print '<tr class="oddeven">';
|
print '<tr class="oddeven">';
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||||
print '<input type="hidden" name="action" value="modify_menu">';
|
print '<input type="hidden" name="action" value="update_menu">';
|
||||||
print '<input type="hidden" name="tab" value="menus">';
|
print '<input type="hidden" name="tab" value="menus">';
|
||||||
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
|
print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">';
|
||||||
//print '<input type="hidden" name="tabobject" value="'.dol_escape_htmltag($tabobject).'">';
|
//print '<input type="hidden" name="tabobject" value="'.dol_escape_htmltag($tabobject).'">';
|
||||||
@@ -5174,7 +5183,7 @@ if ($module == 'initmodule') {
|
|||||||
print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.($menu['position']).'" readonly></td>';
|
print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.($menu['position']).'" readonly></td>';
|
||||||
// Enabled
|
// Enabled
|
||||||
print '<td class="nowraponall">';
|
print '<td class="nowraponall">';
|
||||||
print '<input type="text" class="maxwidth125" named="enabled" value="'.dol_escape_htmltag($propEnabled != '' ? $propEnabled : "isModEnabled('".dol_escape_htmltag($module)."')").'">';
|
print '<input type="text" class="maxwidth125" name="enabled" value="'.dol_escape_htmltag($propEnabled != '' ? $propEnabled : "isModEnabled('".dol_escape_htmltag($module)."')").'">';
|
||||||
$htmltext = '<u>'.$langs->trans("Examples").':</u><br>';
|
$htmltext = '<u>'.$langs->trans("Examples").':</u><br>';
|
||||||
$htmltext .= '1 <span class="opacitymedium">(always enabled)</span><br>';
|
$htmltext .= '1 <span class="opacitymedium">(always enabled)</span><br>';
|
||||||
$htmltext .= '0 <span class="opacitymedium">(always disabled)</span><br>';
|
$htmltext .= '0 <span class="opacitymedium">(always disabled)</span><br>';
|
||||||
@@ -5218,6 +5227,7 @@ if ($module == 'initmodule') {
|
|||||||
print '</select>';
|
print '</select>';
|
||||||
}*/
|
}*/
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
// Target
|
||||||
print '<td class="center"><input type="text" class="center maxwidth50" name="target" value="'.dol_escape_htmltag($propTarget).'"></td>';
|
print '<td class="center"><input type="text" class="center maxwidth50" name="target" value="'.dol_escape_htmltag($propTarget).'"></td>';
|
||||||
print '<td class="center"><select class="center maxwidth10" name="user"><option value="2">'.$langs->trans("AllMenus").'</option><option value="0">'.$langs->trans("Internal").'</option><option value="1">'.$langs->trans("External").'</option></select></td>';
|
print '<td class="center"><select class="center maxwidth10" name="user"><option value="2">'.$langs->trans("AllMenus").'</option><option value="0">'.$langs->trans("Internal").'</option><option value="1">'.$langs->trans("External").'</option></select></td>';
|
||||||
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite maxwidth75">';
|
print '<td class="center minwidth75 tdstickyright tdstickyghostwhite maxwidth75">';
|
||||||
@@ -5267,19 +5277,16 @@ if ($module == 'initmodule') {
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Enabled
|
// Enabled
|
||||||
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['enabled']).'">';
|
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($menu['enabled']).'">';
|
||||||
print dol_escape_htmltag($menu['enabled']);
|
print dol_escape_htmltag($menu['enabled']);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
// Perms
|
// Perms
|
||||||
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['perms']).'">';
|
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($menu['perms']).'">';
|
||||||
if (strpos($menu['perms'], "\$user->hasRight") !== 0) {
|
print dol_escape_htmltag($langs->trans($menu['perms']));
|
||||||
print '';
|
|
||||||
} else {
|
|
||||||
print (dol_escape_htmltag($langs->trans($crud[$valPerms])) );
|
|
||||||
}
|
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
// Target
|
||||||
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['target']).'">';
|
print '<td class="center tdoverflowmax200" title="'.dol_escape_htmltag($menu['target']).'">';
|
||||||
print dol_escape_htmltag($menu['target']);
|
print dol_escape_htmltag($menu['target']);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
@@ -5311,13 +5318,15 @@ if ($module == 'initmodule') {
|
|||||||
print '</table>';
|
print '</table>';
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
|
|
||||||
print '<script>
|
print '<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
//for fill in auto url
|
//for fill in auto url
|
||||||
$("#leftmenu").on("input", function() {
|
$("#leftmenu").on("input", function() {
|
||||||
var inputLeftMenu = $("#leftmenu").val();
|
var inputLeftMenu = $("#leftmenu").val();
|
||||||
if (inputLeftMenu !== "") {
|
if (inputLeftMenu !== \'\') {
|
||||||
var url = "/'.strtolower($module).'/"+ inputLeftMenu+".php";
|
var url = \''.dol_escape_js(strtolower($module)).'\' + inputLeftMenu + \'.php\';
|
||||||
$("#url").val(url);
|
$("#url").val(url);
|
||||||
}else {
|
}else {
|
||||||
$("#url").val("");
|
$("#url").val("");
|
||||||
@@ -5356,7 +5365,7 @@ if ($module == 'initmodule') {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</scrip>';
|
</script>';
|
||||||
|
|
||||||
// display permissions for each object
|
// display permissions for each object
|
||||||
} else {
|
} else {
|
||||||
@@ -6453,6 +6462,7 @@ if ($module == 'initmodule') {
|
|||||||
|
|
||||||
print dol_get_fiche_end(); // End modules
|
print dol_get_fiche_end(); // End modules
|
||||||
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
Reference in New Issue
Block a user