Clean code
This commit is contained in:
parent
762de973eb
commit
7c253c7e28
@ -236,6 +236,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
|||||||
global $db, $conf;
|
global $db, $conf;
|
||||||
global $hookmanager;
|
global $hookmanager;
|
||||||
|
|
||||||
|
$objectid = ((int) $objectid); // For the case value is coming from a non sanitized user input
|
||||||
|
|
||||||
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
|
//dol_syslog("functions.lib:restrictedArea $feature, $objectid, $dbtablename, $feature2, $dbt_socfield, $dbt_select, $isdraft");
|
||||||
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
|
//print "user_id=".$user->id.", features=".$features.", feature2=".$feature2.", objectid=".$objectid;
|
||||||
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
|
//print ", dbtablename=".$dbtablename.", dbt_socfield=".$dbt_keyfield.", dbt_select=".$dbt_select;
|
||||||
@ -270,7 +272,6 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
|||||||
$features = 'produit';
|
$features = 'produit';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get more permissions checks from hooks
|
// Get more permissions checks from hooks
|
||||||
$parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
|
$parameters = array('features'=>$features, 'originalfeatures'=>$originalfeatures, 'objectid'=>$objectid, 'dbt_select'=>$dbt_select, 'idtype'=>$dbt_select, 'isdraft'=>$isdraft);
|
||||||
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
|
$reshook = $hookmanager->executeHooks('restrictedArea', $parameters);
|
||||||
@ -288,10 +289,6 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($dbt_select != 'rowid' && $dbt_select != 'id') {
|
|
||||||
$objectid = "'".$db->escape($objectid)."'";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Features/modules to check
|
// Features/modules to check
|
||||||
$featuresarray = array($features);
|
$featuresarray = array($features);
|
||||||
if (preg_match('/&/', $features)) {
|
if (preg_match('/&/', $features)) {
|
||||||
|
|||||||
@ -46,11 +46,6 @@ $hookmanager->initHooks(array('workstationnote', 'globalcard')); // Note that co
|
|||||||
// Fetch optionals attributes and labels
|
// Fetch optionals attributes and labels
|
||||||
$extrafields->fetch_name_optionals_label($object->table_element);
|
$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
|
|
||||||
// Security check - Protection if external user
|
|
||||||
//if ($user->socid > 0) accessforbidden();
|
|
||||||
//if ($user->socid > 0) $socid = $user->socid;
|
|
||||||
//$result = restrictedArea($user, 'workstation', $id);
|
|
||||||
|
|
||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
if ($id > 0 || !empty($ref)) {
|
if ($id > 0 || !empty($ref)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user