diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index f3b6dfcf5fb..2314007b8c9 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1158,7 +1158,7 @@ if ($mode == 'marketplace') { - global->API_RESTRICT_ON_IP)) { $allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP); $ipremote = getUserRemoteIP(); if (!in_array($ipremote, $allowedip)) { - dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP); + dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP')); print 'APIs are not allowed from the IP '.$ipremote; header('HTTP/1.1 503 API not allowed from your IP '.$ipremote); //session_destroy(); diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index e69de5f62fc..42b87a56caa 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -144,7 +144,7 @@ class Login // Renew the hash if (empty($tmpuser->api_key) || $reset) { $tmpuser->getrights(); - if (empty($tmpuser->rights->user->self->creer)) { + if (!$tmpuser->hasRight('user', 'self', 'creer')) { if (empty($tmpuser->api_key)) { throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token'); } else { diff --git a/htdocs/api/index.php b/htdocs/api/index.php index ebf6c7e8091..008af056681 100644 --- a/htdocs/api/index.php +++ b/htdocs/api/index.php @@ -201,7 +201,7 @@ if (!empty($conf->global->API_RESTRICT_ON_IP)) { $allowedip = explode(' ', $conf->global->API_RESTRICT_ON_IP); $ipremote = getUserRemoteIP(); if (!in_array($ipremote, $allowedip)) { - dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP); + dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP')); print 'APIs are not allowed from the IP '.$ipremote; header('HTTP/1.1 503 API not allowed from your IP '.$ipremote); //session_destroy(); diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 7f6c95e8d36..0fe877ae139 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1525,7 +1525,7 @@ class Asset extends CommonObject if (!empty($conf->global->ASSET_ASSET_ADDON)) { $mybool = false; - $file = $conf->global->ASSET_ASSET_ADDON.".php"; + $file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php"; $classname = $conf->global->ASSET_ASSET_ADDON; // Include file with class diff --git a/htdocs/asset/tpl/linkedobjectblock.tpl.php b/htdocs/asset/tpl/linkedobjectblock.tpl.php index 11d94714db8..2e5c85d4d5d 100644 --- a/htdocs/asset/tpl/linkedobjectblock.tpl.php +++ b/htdocs/asset/tpl/linkedobjectblock.tpl.php @@ -55,7 +55,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''.$objectlink->label.''; echo ''.dol_print_date($objectlink->date_start, 'day').''; echo ''; - if ($user->rights->asset->read) { + if ($user->hasRight('asset', 'read')) { $total = $total + $objectlink->acquisition_value_ht; echo price($objectlink->acquisition_value_ht); } diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 486e65544aa..f257c26196c 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -393,7 +393,7 @@ jQuery(document).ready(function() { print ''; print '
'; -if (!empty($user->rights->produit->lire) || $user->hasRight('service', 'lire')) { +if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) { print ''; print '
'; print '
'; diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 3ffb4d450e8..54737ff96af 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -127,7 +127,7 @@ if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) { print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; diff --git a/htdocs/blockedlog/ajax/check_signature.php b/htdocs/blockedlog/ajax/check_signature.php index ab2f6b0427f..5f7121db68c 100644 --- a/htdocs/blockedlog/ajax/check_signature.php +++ b/htdocs/blockedlog/ajax/check_signature.php @@ -73,7 +73,7 @@ if (is_array($bocks)) { $hash = $auth->getBlockchainHash(); // Call external authority -$url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.urlencode($auth->signature).'&h='.urlencode($hash); +$url = getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL') . '/blockedlog/ajax/authority.php?s='.urlencode($auth->signature).'&h='.urlencode($hash); $resarray = getURLContent($url, 'GET', '', 1, array(), array(), 2); $res = $resarray['content']; diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 9da736d30ec..496339ddf45 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -316,7 +316,7 @@ class BlockedLogAuthority if (is_array($blocks)) { foreach ($blocks as &$block) { - $url = $conf->global->BLOCKEDLOG_AUTHORITY_URL.'/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature; + $url = getDolGlobalString('BLOCKEDLOG_AUTHORITY_URL') . '/blockedlog/ajax/authority.php?s='.$signature.'&b='.$block->signature; $res = getURLContent($url); echo $block->signature.' '.$url.' '.$res['content'].'
'; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index c82548c743e..b8d7eca4b19 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -149,7 +149,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Add line - if ($action == 'addline' && $user->rights->bom->write) { + if ($action == 'addline' && $user->hasRight('bom', 'write')) { $langs->load('errors'); $error = 0; $predef = ''; @@ -235,7 +235,7 @@ if (empty($reshook)) { } // Update line - if ($action == 'updateline' && $user->rights->bom->write) { + if ($action == 'updateline' && $user->hasRight('bom', 'write')) { $langs->load('errors'); $error = 0; @@ -732,7 +732,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Create MO if (isModEnabled('mrp')) { - if ($object->status == $object::STATUS_VALIDATED && !empty($user->rights->mrp->write)) { + if ($object->status == $object::STATUS_VALIDATED && $user->hasRight('mrp', 'write')) { print ''.$langs->trans("CreateMO").''."\n"; } } diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 40983f8a22e..2826ed9b703 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -501,7 +501,7 @@ print ''; $newcardbutton = ''; $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); -$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write); +$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->hasRight('bom', 'write')); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 3cc3b6c6770..798da88add6 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -875,7 +875,7 @@ class BOM extends CommonObject if (!empty($conf->global->BOM_ADDON)) { $mybool = false; - $file = $conf->global->BOM_ADDON.".php"; + $file = getDolGlobalString('BOM_ADDON') . ".php"; $classname = $conf->global->BOM_ADDON; // Include file with class diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index 90dd80db888..11b2c2e99e3 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -951,7 +951,7 @@ class Availabilities extends CommonObject if (!empty($conf->global->BOOKCAL_AVAILABILITIES_ADDON)) { $mybool = false; - $file = $conf->global->BOOKCAL_AVAILABILITIES_ADDON.".php"; + $file = getDolGlobalString('BOOKCAL_AVAILABILITIES_ADDON') . ".php"; $classname = $conf->global->BOOKCAL_AVAILABILITIES_ADDON; // Include file with class diff --git a/htdocs/bookmarks/admin/bookmark.php b/htdocs/bookmarks/admin/bookmark.php index 74b44bd8f9b..2233544fd24 100644 --- a/htdocs/bookmarks/admin/bookmark.php +++ b/htdocs/bookmarks/admin/bookmark.php @@ -77,7 +77,7 @@ print "\n"; print ''; print $langs->trans("NbOfBoomarkToShow").''; -print ''; +print ''; print ''; print '
'; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 5d05c42622f..6b0d7fad6a2 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -88,7 +88,7 @@ function printDropdownBookmarksList() // Url to go on create new bookmark page $newbtn = ''; - if (!empty($user->rights->bookmark->creer)) { + if ($user->hasRight('bookmark', 'creer')) { if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) { //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); @@ -127,10 +127,10 @@ function printDropdownBookmarksList() //$searchForm .= ''; $searchForm .= ''; $searchForm .= ''; + $searchForm .= ' data-html="'.dol_escape_htmltag(img_picto('', 'bookmark').' '.($user->hasRight('bookmark', 'creer') ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...').'">'; + $searchForm .= dol_escape_htmltag($user->hasRight('bookmark', 'creer') ? $langs->trans('EditBookmarks') : $langs->trans('ListOfBookmarks')).'...'; // Url to go on create new bookmark page - if (!empty($user->rights->bookmark->creer)) { + if ($user->hasRight('bookmark', 'creer')) { if (!preg_match('/bookmarks\/card.php/', $_SERVER['PHP_SELF'])) { $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); $searchForm .= '