63function dol_dir_list($utf8_path, $types =
"all", $recursive = 0, $filter =
"", $excludefilter =
null, $sortcriteria =
"name", $sortorder = SORT_ASC, $mode = 0, $nohook = 0, $relativename =
"", $donotfollowsymlinks = 0, $nbsecondsold = 0)
65 global $db, $hookmanager;
68 if ($recursive <= 1) {
73 $exclude_array = ($excludefilter ===
null || $excludefilter ===
'') ? array() : (is_array($excludefilter) ? $excludefilter : array($excludefilter));
74 foreach ((array($filter) + $exclude_array) as $f) {
76 if ((
int) preg_match(
'/(?:^|[^\\\\])\//', $f) > 0) {
78 $error_info .=
" error='$f unescaped_slash'";
82 dol_syslog(
"files.lib.php::dol_dir_list path=".$utf8_path.
" types=".$types.
" recursive=".$recursive.
" filter=".$filter.
" excludefilter=".json_encode($excludefilter).$error_info);
90 $exclude_array = ($excludefilter ===
null || $excludefilter ===
'') ? array() : (is_array($excludefilter) ? $excludefilter : array($excludefilter));
94 $excludefilterarray = array_merge(array(
'^\.'), $exclude_array);
96 $loaddate = ($mode == 1 || $mode == 2 || $nbsecondsold != 0 || $sortcriteria ==
'date');
97 $loadsize = ($mode == 1 || $mode == 3 || $sortcriteria ==
'size');
98 $loadperm = ($mode == 1 || $mode == 4 || $sortcriteria ==
'perm');
101 $utf8_path = preg_replace(
'/([\\/]+)$/',
'', $utf8_path);
106 $file_list = array();
108 if (!$nohook && $hookmanager instanceof
HookManager) {
109 $hookmanager->resArray = array();
111 $hookmanager->initHooks(array(
'fileslib'));
116 'recursive' => $recursive,
118 'excludefilter' => $exclude_array,
119 'sortcriteria' => $sortcriteria,
120 'sortorder' => $sortorder,
121 'loaddate' => $loaddate,
122 'loadsize' => $loadsize,
125 $reshook = $hookmanager->executeHooks(
'getDirList', $parameters,
$object);
129 if (empty($reshook)) {
130 if (!is_dir($os_path)) {
134 if (($dir = opendir($os_path)) ===
false) {
141 while (
false !== ($os_file = readdir($dir))) {
142 $os_fullpathfile = ($os_path ? $os_path.
'/' :
'').$os_file;
145 $utf8_file = mb_convert_encoding($os_file,
'UTF-8',
'ISO-8859-1');
147 $utf8_file = $os_file;
152 $utf8_fullpathfile =
"$utf8_path/$utf8_file";
155 foreach ($excludefilterarray as $filt) {
156 if (preg_match(
'/'.$filt.
'/i', $utf8_file) || preg_match(
'/'.$filt.
'/i', $utf8_fullpathfile)) {
164 $isdir = is_dir($os_fullpathfile);
168 if (($types ==
"directories") || ($types ==
"all")) {
169 if ($loaddate || $sortcriteria ==
'date') {
172 if ($loadsize || $sortcriteria ==
'size') {
175 if ($loadperm || $sortcriteria ==
'perm') {
179 if (!$filter || preg_match(
'/'.$filter.
'/i', $utf8_file)) {
181 preg_match(
'/([^\/]+)\/[^\/]+$/', $utf8_fullpathfile, $reg);
182 $level1name = (isset($reg[1]) ? $reg[1] :
'');
183 $file_list[] = array(
184 "name" => $utf8_file,
185 "path" => $utf8_path,
186 "level1name" => $level1name,
187 "relativename" => ($relativename ? $relativename.
'/' :
'').$utf8_file,
188 "fullname" => $utf8_fullpathfile,
198 if ($recursive > 0) {
199 if (empty($donotfollowsymlinks) || !is_link($os_fullpathfile)) {
201 $file_list = array_merge($file_list,
dol_dir_list($utf8_fullpathfile, $types, $recursive + 1, $filter, $exclude_array, $sortcriteria, $sortorder, $mode, $nohook, ($relativename !=
'' ? $relativename.
'/' :
'').$utf8_file, $donotfollowsymlinks, $nbsecondsold));
204 } elseif (in_array($types, array(
"files",
"all"))) {
206 if ($loaddate || $sortcriteria ==
'date') {
209 if ($loadsize || $sortcriteria ==
'size') {
213 if (!$filter || preg_match(
'/'.$filter.
'/i', $utf8_file)) {
214 if (empty($nbsecondsold) || $filedate <= ($now - $nbsecondsold)) {
215 preg_match(
'/([^\/]+)\/[^\/]+$/', $utf8_fullpathfile, $reg);
216 $level1name = (isset($reg[1]) ? $reg[1] :
'');
217 $file_list[] = array(
218 "name" => $utf8_file,
219 "path" => $utf8_path,
220 "level1name" => $level1name,
221 "relativename" => ($relativename ? $relativename.
'/' :
'').$utf8_file,
222 "fullname" => $utf8_fullpathfile,
235 if (!empty($sortcriteria) && $sortorder) {
236 $file_list =
dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ?
'asc' :
'desc'));
241 if ($hookmanager instanceof
HookManager && is_array($hookmanager->resArray)) {
242 $file_list = array_merge($file_list, $hookmanager->resArray);
1012function dol_move($srcfile, $destfile, $newmask =
'0', $overwriteifexists = 1, $testvirus = 0, $indexdatabase = 1, $moreinfo = array())
1017 dol_syslog(
"files.lib.php::dol_move srcfile=".$srcfile.
" destfile=".$destfile.
" newmask=".$newmask.
" overwritifexists=".$overwriteifexists);
1022 dol_syslog(
"files.lib.php::dol_move srcfile does not exists. we ignore the move request.");
1026 if ($overwriteifexists || !$destexists) {
1031 $testvirusarray = array();
1034 $testvirusarray =
dolCheckVirus($newpathofsrcfile, $newpathofdestfile);
1035 if (count($testvirusarray)) {
1036 dol_syslog(
"files.lib.php::dol_move canceled because a virus was found into source file. We ignore the move request.", LOG_WARNING);
1042 if (count($testvirusarray)) {
1043 dol_syslog(
"files.lib.php::dol_move canceled because a virus was found into source file. We ignore the move request.", LOG_WARNING);
1048 global $dolibarr_main_restrict_os_commands;
1049 if (!empty($dolibarr_main_restrict_os_commands)) {
1050 $arrayofallowedcommand = explode(
',', $dolibarr_main_restrict_os_commands);
1051 $arrayofallowedcommand = array_map(
'trim', $arrayofallowedcommand);
1052 if (in_array(basename($destfile), $arrayofallowedcommand)) {
1055 dol_syslog(
"files.lib.php::dol_move canceled because target filename ".basename($destfile).
" is using a reserved command name. we ignore the move request.", LOG_WARNING);
1060 $result = @rename($newpathofsrcfile, $newpathofdestfile);
1063 dol_syslog(
"files.lib.php::dol_move Failed. We try to delete target first and move after.", LOG_WARNING);
1066 $result = @rename($newpathofsrcfile, $newpathofdestfile);
1068 dol_syslog(
"files.lib.php::dol_move Failed.", LOG_WARNING);
1073 if ($result && $indexdatabase) {
1075 $rel_filetorenamebefore = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $srcfile);
1076 $rel_filetorenameafter = preg_replace(
'/^'.preg_quote(DOL_DATA_ROOT,
'/').
'/',
'', $destfile);
1077 if (!preg_match(
'/([\\/]temp[\\/]|[\\/]thumbs|\.meta$)/', $rel_filetorenameafter)) {
1078 $rel_filetorenamebefore = preg_replace(
'/^[\\/]/',
'', $rel_filetorenamebefore);
1079 $rel_filetorenameafter = preg_replace(
'/^[\\/]/',
'', $rel_filetorenameafter);
1082 dol_syslog(
"Try to rename also entries in database for full relative path before = ".$rel_filetorenamebefore.
" after = ".$rel_filetorenameafter, LOG_DEBUG);
1083 include_once DOL_DOCUMENT_ROOT.
'/ecm/class/ecmfiles.class.php';
1085 $ecmfiletarget =
new EcmFiles($db);
1086 $resultecmtarget = $ecmfiletarget->fetch(0,
'', $rel_filetorenameafter);
1087 if ($resultecmtarget > 0) {
1088 $ecmfiletarget->delete($user);
1092 $resultecm = $ecmfile->fetch(0,
'', $rel_filetorenamebefore);
1093 if ($resultecm > 0) {
1094 $filename = basename($rel_filetorenameafter);
1095 $rel_dir = dirname($rel_filetorenameafter);
1096 $rel_dir = preg_replace(
'/[\\/]$/',
'', $rel_dir);
1097 $rel_dir = preg_replace(
'/^[\\/]/',
'', $rel_dir);
1099 $ecmfile->filepath = $rel_dir;
1100 $ecmfile->filename = $filename;
1102 $resultecm = $ecmfile->update($user);
1103 } elseif ($resultecm == 0) {
1104 $filename = basename($rel_filetorenameafter);
1105 $rel_dir = dirname($rel_filetorenameafter);
1106 $rel_dir = preg_replace(
'/[\\/]$/',
'', $rel_dir);
1107 $rel_dir = preg_replace(
'/^[\\/]/',
'', $rel_dir);
1109 $ecmfile->filepath = $rel_dir;
1110 $ecmfile->filename = $filename;
1112 $ecmfile->fullpath_orig = basename($srcfile);
1113 if (!empty($moreinfo) && !empty($moreinfo[
'gen_or_uploaded'])) {
1114 $ecmfile->gen_or_uploaded = $moreinfo[
'gen_or_uploaded'];
1116 $ecmfile->gen_or_uploaded =
'uploaded';
1118 if (!empty($moreinfo) && !empty($moreinfo[
'description'])) {
1119 $ecmfile->description = $moreinfo[
'description'];
1121 $ecmfile->description =
'';
1123 if (!empty($moreinfo) && !empty($moreinfo[
'keywords'])) {
1124 $ecmfile->keywords = $moreinfo[
'keywords'];
1126 $ecmfile->keywords =
'';
1128 if (!empty($moreinfo) && !empty($moreinfo[
'note_private'])) {
1129 $ecmfile->note_private = $moreinfo[
'note_private'];
1131 if (!empty($moreinfo) && !empty($moreinfo[
'note_public'])) {
1132 $ecmfile->note_public = $moreinfo[
'note_public'];
1134 if (!empty($moreinfo) && !empty($moreinfo[
'src_object_type'])) {
1135 $ecmfile->src_object_type = $moreinfo[
'src_object_type'];
1137 if (!empty($moreinfo) && !empty($moreinfo[
'src_object_id'])) {
1138 $ecmfile->src_object_id = $moreinfo[
'src_object_id'];
1140 if (!empty($moreinfo) && !empty($moreinfo[
'position'])) {
1141 $ecmfile->position = $moreinfo[
'position'];
1143 if (!empty($moreinfo) && !empty($moreinfo[
'cover'])) {
1144 $ecmfile->cover = $moreinfo[
'cover'];
1147 $resultecm = $ecmfile->create($user);
1148 if ($resultecm < 0) {
1151 if (!empty($moreinfo) && !empty($moreinfo[
'array_options']) && is_array($moreinfo[
'array_options'])) {
1152 $ecmfile->array_options = $moreinfo[
'array_options'];
1153 $resultecm = $ecmfile->insertExtraFields();
1154 if ($resultecm < 0) {
1159 } elseif ($resultecm < 0) {
1163 if ($resultecm > 0) {
1171 if (empty($newmask)) {
1178 dolChmod($newpathofdestfile, $newmask);
2761 global $conf, $db, $user, $hookmanager;
2762 global $dolibarr_main_data_root, $dolibarr_main_document_root_alt;
2765 if (!is_object($fuser)) {
2769 if (empty($modulepart)) {
2770 return 'ErrorBadParameter';
2772 if (empty($entity)) {
2773 if (!isModEnabled(
'multicompany')) {
2780 if ($modulepart ==
'facture') {
2781 $modulepart =
'invoice';
2782 } elseif ($modulepart ==
'users') {
2783 $modulepart =
'user';
2784 } elseif ($modulepart ==
'tva') {
2785 $modulepart =
'tax-vat';
2786 } elseif ($modulepart ==
'expedition' && strpos($original_file,
'receipt/') === 0) {
2788 $modulepart =
'delivery';
2792 dol_syslog(
'dol_check_secure_access_document modulepart='.$modulepart.
' original_file='.$original_file.
' entity='.$entity);
2796 $sqlprotectagainstexternals =
'';
2800 if (empty($refname)) {
2801 $refname = basename(dirname($original_file).
"/");
2802 if ($refname ==
'thumbs' || $refname ==
'temp') {
2804 $refname = basename(dirname(dirname($original_file)).
"/");
2811 $download =
'download';
2812 if ($mode ==
'write') {
2815 $download =
'upload';
2819 if ($modulepart ==
'common') {
2822 $original_file = DOL_DOCUMENT_ROOT.
'/public/theme/common/'.$original_file;
2823 } elseif ($modulepart ==
'medias' && !empty($dolibarr_main_data_root)) {
2828 if (empty($entity)) {
2832 $original_file = (empty($conf->medias->multidir_output[$entity]) ? $conf->medias->dir_output : $conf->medias->multidir_output[$entity]).
'/'.$original_file;
2833 } elseif ($modulepart ==
'logs' && !empty($dolibarr_main_data_root)) {
2835 $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match(
'/^dolibarr.*\.(log|json)$/', basename($original_file)));
2836 $original_file = $dolibarr_main_data_root.
'/'.$original_file;
2837 } elseif ($modulepart ==
'doctemplates' && !empty($dolibarr_main_data_root)) {
2839 $accessallowed = $user->admin;
2840 $original_file = $dolibarr_main_data_root.
'/doctemplates/'.$original_file;
2841 } elseif ($modulepart ==
'doctemplateswebsite' && !empty($dolibarr_main_data_root)) {
2843 $accessallowed = ($fuser->hasRight(
'website',
'write') && preg_match(
'/\.jpg$/i', basename($original_file)));
2844 $original_file = $dolibarr_main_data_root.
'/doctemplates/websites/'.$original_file;
2845 } elseif ($modulepart ==
'packages' && !empty($dolibarr_main_data_root)) {
2848 $tmp = explode(
',', $dolibarr_main_document_root_alt);
2851 $accessallowed = ($user->admin && preg_match(
'/^module_.*\.zip$/', basename($original_file)));
2852 $original_file = $dirins.
'/'.$original_file;
2853 } elseif ($modulepart ==
'mycompany' && !empty($conf->mycompany->dir_output)) {
2856 $original_file = $conf->mycompany->dir_output.
'/'.$original_file;
2857 } elseif ($modulepart ==
'userphoto' && !empty($conf->user->dir_output)) {
2860 if (preg_match(
'/^\d+\/photos\//', $original_file)) {
2863 $original_file = $conf->user->dir_output.
'/'.$original_file;
2864 } elseif ($modulepart ==
'userphotopublic' && !empty($conf->user->dir_output)) {
2869 if (preg_match(
'/^(\d+)\/photos\//', $original_file, $reg)) {
2871 $tmpobject =
new User($db);
2872 $tmpobject->fetch($reg[1],
'',
'', 1);
2874 $securekey =
GETPOST(
'securekey',
'alpha', 1);
2876 global $dolibarr_main_cookie_cryptkey, $dolibarr_main_instance_unique_id;
2877 $valuetouse = $dolibarr_main_instance_unique_id ? $dolibarr_main_instance_unique_id : $dolibarr_main_cookie_cryptkey;
2878 $encodedsecurekey =
dol_hash($valuetouse.
'uservirtualcard'.$tmpobject->id.
'-'.$tmpobject->login,
'md5');
2879 if ($encodedsecurekey == $securekey) {
2888 $original_file = $conf->user->dir_output.
'/'.$original_file;
2889 } elseif (($modulepart ==
'companylogo') && !empty($conf->mycompany->dir_output)) {
2892 $original_file = $conf->mycompany->dir_output.
'/logos/'.$original_file;
2893 } elseif ($modulepart ==
'memberphoto' && !empty($conf->member->dir_output)) {
2896 if (preg_match(
'/^\d+\/photos\//', $original_file)) {
2899 $original_file = $conf->member->dir_output.
'/'.$original_file;
2900 } elseif ($modulepart ==
'apercufacture' && !empty($conf->invoice->multidir_output[$entity])) {
2902 if ($fuser->hasRight(
'facture', $lire)) {
2905 $original_file = $conf->invoice->multidir_output[$entity].
'/'.$original_file;
2906 } elseif ($modulepart ==
'apercupropal' && !empty($conf->propal->multidir_output[$entity])) {
2908 if ($fuser->hasRight(
'propal', $lire)) {
2911 $original_file = $conf->propal->multidir_output[$entity].
'/'.$original_file;
2912 } elseif ($modulepart ==
'apercucommande' && !empty($conf->order->multidir_output[$entity])) {
2914 if ($fuser->hasRight(
'commande', $lire)) {
2917 $original_file = $conf->order->multidir_output[$entity].
'/'.$original_file;
2918 } elseif (($modulepart ==
'apercufichinter' || $modulepart ==
'apercuficheinter') && !empty($conf->ficheinter->dir_output)) {
2920 if ($fuser->hasRight(
'ficheinter', $lire)) {
2923 $original_file = $conf->ficheinter->dir_output.
'/'.$original_file;
2924 } elseif (($modulepart ==
'apercucontract') && !empty($conf->contract->multidir_output[$entity])) {
2926 if ($fuser->hasRight(
'contrat', $lire)) {
2929 $original_file = $conf->contract->multidir_output[$entity].
'/'.$original_file;
2930 } elseif (($modulepart ==
'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) {
2932 if ($fuser->hasRight(
'supplier_proposal', $lire)) {
2935 $original_file = $conf->supplier_proposal->dir_output.
'/'.$original_file;
2936 } elseif (($modulepart ==
'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) {
2938 if ($fuser->hasRight(
'fournisseur',
'commande', $lire)) {
2941 $original_file = $conf->fournisseur->commande->dir_output.
'/'.$original_file;
2942 } elseif (($modulepart ==
'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) {
2944 if ($fuser->hasRight(
'fournisseur', $lire)) {
2947 $original_file = $conf->fournisseur->facture->dir_output.
'/'.$original_file;
2948 } elseif (($modulepart ==
'holiday') && !empty($conf->holiday->dir_output)) {
2949 if ($fuser->hasRight(
'holiday', $read) || $fuser->hasRight(
'holiday',
'readall') || preg_match(
'/^specimen/i', $original_file)) {
2952 if ($refname && !$fuser->hasRight(
'holiday',
'readall') && !preg_match(
'/^specimen/i', $original_file)) {
2953 include_once DOL_DOCUMENT_ROOT.
'/holiday/class/holiday.class.php';
2954 $tmpholiday =
new Holiday($db);
2955 $tmpholiday->fetch(0, $refname);
2956 $accessallowed =
checkUserAccessToObject($user, array(
'holiday'), $tmpholiday,
'holiday',
'',
'',
'rowid',
'');
2959 $original_file = $conf->holiday->dir_output.
'/'.$original_file;
2960 } elseif (($modulepart ==
'expensereport') && !empty($conf->expensereport->dir_output)) {
2961 if ($fuser->hasRight(
'expensereport', $lire) || $fuser->hasRight(
'expensereport',
'readall') || preg_match(
'/^specimen/i', $original_file)) {
2964 if ($refname && !$fuser->hasRight(
'expensereport',
'readall') && !preg_match(
'/^specimen/i', $original_file)) {
2965 include_once DOL_DOCUMENT_ROOT.
'/expensereport/class/expensereport.class.php';
2967 $tmpexpensereport->fetch(0, $refname);
2968 $accessallowed =
checkUserAccessToObject($user, array(
'expensereport'), $tmpexpensereport,
'expensereport',
'',
'',
'rowid',
'');
2971 $original_file = $conf->expensereport->dir_output.
'/'.$original_file;
2972 } elseif (($modulepart ==
'apercuexpensereport') && !empty($conf->expensereport->dir_output)) {
2974 if ($fuser->hasRight(
'expensereport', $lire)) {
2977 $original_file = $conf->expensereport->dir_output.
'/'.$original_file;
2978 } elseif ($modulepart ==
'propalstats' && !empty($conf->propal->multidir_temp[$entity])) {
2980 if ($fuser->hasRight(
'propal', $lire)) {
2983 $original_file = $conf->propal->multidir_temp[$entity].
'/'.$original_file;
2984 } elseif ($modulepart ==
'orderstats' && !empty($conf->order->dir_temp)) {
2986 if ($fuser->hasRight(
'commande', $lire)) {
2989 $original_file = $conf->order->dir_temp.
'/'.$original_file;
2990 } elseif ($modulepart ==
'orderstatssupplier' && !empty($conf->fournisseur->dir_output)) {
2991 if ($fuser->hasRight(
'fournisseur',
'commande', $lire)) {
2994 $original_file = $conf->fournisseur->commande->dir_temp.
'/'.$original_file;
2995 } elseif ($modulepart ==
'billstats' && !empty($conf->invoice->dir_temp)) {
2997 if ($fuser->hasRight(
'facture', $lire)) {
3000 $original_file = $conf->invoice->dir_temp.
'/'.$original_file;
3001 } elseif ($modulepart ==
'billstatssupplier' && !empty($conf->fournisseur->dir_output)) {
3002 if ($fuser->hasRight(
'fournisseur',
'facture', $lire)) {
3005 $original_file = $conf->fournisseur->facture->dir_temp.
'/'.$original_file;
3006 } elseif ($modulepart ==
'expeditionstats' && !empty($conf->expedition->dir_temp)) {
3008 if ($fuser->hasRight(
'expedition', $lire)) {
3011 $original_file = $conf->expedition->dir_temp.
'/'.$original_file;
3012 } elseif ($modulepart ==
'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) {
3014 if ($fuser->hasRight(
'deplacement', $lire)) {
3017 $original_file = $conf->deplacement->dir_temp.
'/'.$original_file;
3018 } elseif ($modulepart ==
'memberstats' && !empty($conf->member->dir_temp)) {
3020 if ($fuser->hasRight(
'adherent', $lire)) {
3023 $original_file = $conf->member->dir_temp.
'/'.$original_file;
3024 } elseif (preg_match(
'/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp)) {
3026 if ($fuser->hasRight(
'produit', $lire) || $fuser->hasRight(
'service', $lire)) {
3029 $original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).
'/'.$original_file;
3030 } elseif (in_array($modulepart, array(
'tax',
'tax-vat',
'tva')) && !empty($conf->tax->dir_output)) {
3032 if ($fuser->hasRight(
'tax',
'charges', $lire)) {
3035 $modulepartsuffix = str_replace(
'tax-',
'', $modulepart);
3036 $original_file = $conf->tax->dir_output.
'/'.($modulepartsuffix !=
'tax' ? $modulepartsuffix.
'/' :
'').$original_file;
3037 } elseif ($modulepart ==
'actions' && !empty($conf->agenda->dir_output)) {
3039 if ($fuser->hasRight(
'agenda',
'myactions', $read)) {
3042 if ($refname && !preg_match(
'/^specimen/i', $original_file)) {
3043 include_once DOL_DOCUMENT_ROOT.
'/comm/action/class/actioncomm.class.php';
3045 $tmpobject->fetch((
int) $refname);
3046 $accessallowed =
checkUserAccessToObject($user, array(
'agenda'), $tmpobject->id,
'actioncomm&societe',
'myactions|allactions',
'fk_soc',
'id',
'');
3047 if ($user->socid && $tmpobject->socid) {
3052 $original_file = $conf->agenda->dir_output.
'/'.$original_file;
3053 } elseif ($modulepart ==
'category' && !empty($conf->categorie->multidir_output[$entity])) {
3055 if (empty($entity) || empty($conf->categorie->multidir_output[$entity])) {
3056 return array(
'accessallowed' => 0,
'error' =>
'Value entity must be provided');
3058 if ($fuser->hasRight(
"categorie", $lire) || $fuser->hasRight(
"takepos",
"run")) {
3061 $original_file = $conf->categorie->multidir_output[$entity].
'/'.$original_file;
3062 } elseif ($modulepart ==
'prelevement' && !empty($conf->prelevement->dir_output)) {
3064 if ($fuser->hasRight(
'prelevement',
'bons', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3067 $original_file = $conf->prelevement->dir_output.
'/'.$original_file;
3068 } elseif ($modulepart ==
'graph_stock' && !empty($conf->stock->dir_temp)) {
3071 $original_file = $conf->stock->dir_temp.
'/'.$original_file;
3072 } elseif ($modulepart ==
'graph_fourn' && !empty($conf->fournisseur->dir_temp)) {
3075 $original_file = $conf->fournisseur->dir_temp.
'/'.$original_file;
3076 } elseif ($modulepart ==
'graph_product' && !empty($conf->product->dir_temp)) {
3079 $original_file = $conf->product->multidir_temp[$entity].
'/'.$original_file;
3080 } elseif ($modulepart ==
'barcode') {
3085 $original_file =
'';
3086 } elseif ($modulepart ==
'iconmailing' && !empty($conf->mailing->dir_temp)) {
3089 $original_file = $conf->mailing->dir_temp.
'/'.$original_file;
3090 } elseif ($modulepart ==
'scanner_user_temp' && !empty($conf->scanner->dir_temp)) {
3093 $original_file = $conf->scanner->dir_temp.
'/'.$fuser->id.
'/'.$original_file;
3094 } elseif ($modulepart ==
'fckeditor' && !empty($conf->fckeditor->dir_output)) {
3097 $original_file = $conf->fckeditor->dir_output.
'/'.$original_file;
3098 } elseif ($modulepart ==
'user' && !empty($conf->user->dir_output)) {
3100 $canreaduser = (!empty($fuser->admin) || $fuser->rights->user->user->{$lire});
3101 if ($fuser->id == (
int) $refname) {
3104 if ($canreaduser || preg_match(
'/^specimen/i', $original_file)) {
3107 $original_file = $conf->user->dir_output.
'/'.$original_file;
3108 } elseif (($modulepart ==
'company' || $modulepart ==
'societe' || $modulepart ==
'thirdparty') && !empty($conf->societe->multidir_output[$entity])) {
3110 if (empty($entity) || empty($conf->societe->multidir_output[$entity])) {
3111 return array(
'accessallowed' => 0,
'error' =>
'Value entity must be provided');
3113 if ($fuser->hasRight(
'societe', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3116 $original_file = $conf->societe->multidir_output[$entity].
'/'.$original_file;
3117 $sqlprotectagainstexternals =
"SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX.
"societe WHERE rowid='".$db->escape($refname).
"' AND entity IN (".
getEntity(
'societe').
")";
3118 } elseif ($modulepart ==
'contact' && !empty($conf->societe->multidir_output[$entity])) {
3120 if (empty($entity) || empty($conf->societe->multidir_output[$entity])) {
3121 return array(
'accessallowed' => 0,
'error' =>
'Value entity must be provided');
3123 if ($fuser->hasRight(
'societe', $lire)) {
3126 $original_file = $conf->societe->multidir_output[$entity].
'/contact/'.$original_file;
3127 } elseif (($modulepart ==
'facture' || $modulepart ==
'invoice') && !empty($conf->invoice->multidir_output[$entity])) {
3129 if ($fuser->hasRight(
'facture', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3132 $original_file = $conf->invoice->multidir_output[$entity].
'/'.$original_file;
3133 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"facture WHERE ref='".$db->escape($refname).
"' AND entity IN (".
getEntity(
'invoice').
")";
3134 } elseif ($modulepart ==
'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) {
3136 if ($fuser->hasRight(
'propal', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3139 $original_file = $conf->propal->multidir_output[$entity].
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3140 } elseif ($modulepart ==
'massfilesarea_orders') {
3141 if ($fuser->hasRight(
'commande', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3144 $original_file = $conf->order->multidir_output[$entity].
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3145 } elseif ($modulepart ==
'massfilesarea_sendings') {
3146 if ($fuser->hasRight(
'expedition', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3149 $original_file = $conf->expedition->dir_output.
'/sending/temp/massgeneration/'.$user->id.
'/'.$original_file;
3150 } elseif ($modulepart ==
'massfilesarea_receipts') {
3151 if ($fuser->hasRight(
'reception', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3154 $original_file = $conf->reception->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3155 } elseif ($modulepart ==
'massfilesarea_invoices') {
3156 if ($fuser->hasRight(
'facture', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3159 $original_file = $conf->invoice->multidir_output[$entity].
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3160 } elseif ($modulepart ==
'massfilesarea_expensereport') {
3161 if ($fuser->hasRight(
'facture', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3164 $original_file = $conf->expensereport->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3165 } elseif ($modulepart ==
'massfilesarea_interventions') {
3166 if ($fuser->hasRight(
'ficheinter', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3169 $original_file = $conf->ficheinter->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3170 } elseif ($modulepart ==
'massfilesarea_supplier_proposal' && !empty($conf->supplier_proposal->dir_output)) {
3171 if ($fuser->hasRight(
'supplier_proposal', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3174 $original_file = $conf->supplier_proposal->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3175 } elseif ($modulepart ==
'massfilesarea_supplier_order') {
3176 if ($fuser->hasRight(
'fournisseur',
'commande', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3179 $original_file = $conf->fournisseur->commande->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3180 } elseif ($modulepart ==
'massfilesarea_supplier_invoice') {
3181 if ($fuser->hasRight(
'fournisseur',
'facture', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3184 $original_file = $conf->fournisseur->facture->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3185 } elseif ($modulepart ==
'massfilesarea_contract' && !empty($conf->contract->dir_output)) {
3186 if ($fuser->hasRight(
'contrat', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3189 $original_file = $conf->contract->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3190 } elseif (($modulepart ==
'fichinter' || $modulepart ==
'ficheinter') && !empty($conf->ficheinter->dir_output)) {
3192 if ($fuser->hasRight(
'ficheinter', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3195 $original_file = $conf->ficheinter->dir_output.
'/'.$original_file;
3196 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"fichinter WHERE ref='".$db->escape($refname).
"' AND entity=".$conf->entity;
3197 } elseif ($modulepart ==
'deplacement' && !empty($conf->deplacement->dir_output)) {
3199 if ($fuser->hasRight(
'deplacement', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3202 $original_file = $conf->deplacement->dir_output.
'/'.$original_file;
3204 } elseif (($modulepart ==
'propal' || $modulepart ==
'propale') && isset($conf->propal->multidir_output[$entity])) {
3206 if ($fuser->hasRight(
'propal', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3209 $original_file = $conf->propal->multidir_output[$entity].
'/'.$original_file;
3210 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"propal WHERE ref='".$db->escape($refname).
"' AND entity IN (".
getEntity(
'propal').
")";
3211 } elseif (($modulepart ==
'commande' || $modulepart ==
'order') && !empty($conf->order->multidir_output[$entity])) {
3213 if ($fuser->hasRight(
'commande', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3216 $original_file = $conf->order->multidir_output[$entity].
'/'.$original_file;
3217 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"commande WHERE ref='".$db->escape($refname).
"' AND entity IN (".
getEntity(
'order').
")";
3218 } elseif ($modulepart ==
'project' && !empty($conf->project->multidir_output[$entity])) {
3220 if ($fuser->hasRight(
'projet', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3223 if ($refname && !preg_match(
'/^specimen/i', $original_file)) {
3224 include_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
3225 $tmpproject =
new Project($db);
3226 $tmpproject->fetch(0, $refname);
3227 $accessallowed =
checkUserAccessToObject($user, array(
'projet'), $tmpproject->id,
'projet&project',
'',
'',
'rowid',
'');
3230 $original_file = $conf->project->multidir_output[$entity].
'/'.$original_file;
3231 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"projet WHERE ref='".$db->escape($refname).
"' AND entity IN (".
getEntity(
'project').
")";
3232 } elseif ($modulepart ==
'project_task' && !empty($conf->project->multidir_output[$entity])) {
3233 if ($fuser->hasRight(
'projet', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3236 if ($refname && !preg_match(
'/^specimen/i', $original_file)) {
3237 include_once DOL_DOCUMENT_ROOT.
'/projet/class/task.class.php';
3238 $tmptask =
new Task($db);
3239 $tmptask->fetch(0, $refname);
3240 $accessallowed =
checkUserAccessToObject($user, array(
'projet_task'), $tmptask->id,
'projet_task&project',
'',
'',
'rowid',
'');
3243 $original_file = $conf->project->multidir_output[$entity].
'/'.$original_file;
3244 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"projet WHERE ref='".$db->escape($refname).
"' AND entity IN (".
getEntity(
'project').
")";
3245 } elseif (($modulepart ==
'commande_fournisseur' || $modulepart ==
'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) {
3247 if ($fuser->hasRight(
'fournisseur',
'commande', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3250 $original_file = $conf->fournisseur->commande->dir_output.
'/'.$original_file;
3251 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"commande_fournisseur WHERE ref='".$db->escape($refname).
"' AND entity=".$conf->entity;
3252 } elseif (($modulepart ==
'facture_fournisseur' || $modulepart ==
'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) {
3254 if ($fuser->hasRight(
'fournisseur',
'facture', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3257 $original_file = $conf->fournisseur->facture->dir_output.
'/'.$original_file;
3258 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"facture_fourn WHERE ref='".$db->escape($refname).
"' AND entity=".$conf->entity;
3259 } elseif ($modulepart ==
'supplier_payment') {
3261 if ($fuser->hasRight(
'fournisseur',
'facture', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3264 $original_file = $conf->fournisseur->payment->dir_output.
'/'.$original_file;
3265 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"paiementfournisseur WHERE ref='".$db->escape($refname).
"' AND entity=".$conf->entity;
3266 } elseif ($modulepart ==
'payment') {
3268 if ($fuser->rights->facture->{$lire} || preg_match(
'/^specimen/i', $original_file)) {
3271 $original_file = $conf->compta->payment->dir_output.
'/'.$original_file;
3272 } elseif ($modulepart ==
'facture_paiement' && !empty($conf->invoice->dir_output)) {
3274 if ($fuser->hasRight(
'facture', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3277 if ($fuser->socid > 0) {
3278 $original_file = $conf->invoice->dir_output.
'/payments/private/'.$fuser->id.
'/'.$original_file;
3280 $original_file = $conf->invoice->dir_output.
'/payments/'.$original_file;
3282 } elseif ($modulepart ==
'export_compta' && !empty($conf->accounting->dir_output)) {
3284 if ($fuser->hasRight(
'accounting',
'bind',
'write') || preg_match(
'/^specimen/i', $original_file)) {
3287 $original_file = $conf->accounting->dir_output.
'/'.$original_file;
3288 } elseif (($modulepart ==
'expedition' || $modulepart ==
'shipment') && !empty($conf->expedition->dir_output)) {
3290 if ($fuser->hasRight(
'expedition', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3293 $original_file = $conf->expedition->dir_output.
"/".(strpos($original_file,
'sending/') === 0 ?
'' :
'sending/').$original_file;
3295 } elseif (($modulepart ==
'livraison' || $modulepart ==
'delivery') && !empty($conf->expedition->dir_output)) {
3297 if ($fuser->hasRight(
'expedition',
'delivery', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3300 $original_file = $conf->expedition->dir_output.
"/".(strpos($original_file,
'receipt/') === 0 ?
'' :
'receipt/').$original_file;
3301 } elseif ($modulepart ==
'actionsreport' && !empty($conf->agenda->dir_temp)) {
3303 if ($fuser->hasRight(
'agenda',
'allactions', $read) || preg_match(
'/^specimen/i', $original_file)) {
3306 $original_file = $conf->agenda->dir_temp.
"/".$original_file;
3307 } elseif ($modulepart ==
'product' || $modulepart ==
'produit' || $modulepart ==
'service' || $modulepart ==
'produit|service') {
3309 if (empty($entity) || (empty($conf->product->multidir_output[$entity]) && empty($conf->service->multidir_output[$entity]))) {
3310 return array(
'accessallowed' => 0,
'error' =>
'Value entity must be provided');
3312 if (($fuser->hasRight(
'produit', $lire) || $fuser->hasRight(
'service', $lire)) || preg_match(
'/^specimen/i', $original_file)) {
3315 if (isModEnabled(
"product")) {
3316 $original_file = $conf->product->multidir_output[$entity].
'/'.$original_file;
3317 } elseif (isModEnabled(
"service")) {
3318 $original_file = $conf->service->multidir_output[$entity].
'/'.$original_file;
3320 } elseif ($modulepart ==
'product_batch' || $modulepart ==
'produitlot') {
3322 if (empty($entity) || (empty($conf->productbatch->multidir_output[$entity]))) {
3323 return array(
'accessallowed' => 0,
'error' =>
'Value entity must be provided');
3325 if (($fuser->hasRight(
'produit', $lire)) || preg_match(
'/^specimen/i', $original_file)) {
3328 if (isModEnabled(
'productbatch')) {
3329 $original_file = $conf->productbatch->multidir_output[$entity].
'/'.$original_file;
3331 } elseif ($modulepart ==
'movement' || $modulepart ==
'mouvement') {
3333 if (empty($entity) || empty($conf->stock->multidir_output[$entity])) {
3334 return array(
'accessallowed' => 0,
'error' =>
'Value entity must be provided');
3336 if (($fuser->hasRight(
'stock', $lire) || $fuser->hasRight(
'stock',
'movement', $lire) || $fuser->hasRight(
'stock',
'mouvement', $lire)) || preg_match(
'/^specimen/i', $original_file)) {
3339 if (isModEnabled(
'stock')) {
3340 $original_file = $conf->stock->multidir_output[$entity].
'/movement/'.$original_file;
3342 } elseif ($modulepart ==
'contract' && !empty($conf->contract->multidir_output[$entity])) {
3344 if ($fuser->hasRight(
'contrat', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3347 $original_file = $conf->contract->multidir_output[$entity].
'/'.$original_file;
3348 $sqlprotectagainstexternals =
"SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX.
"contrat WHERE ref='".$db->escape($refname).
"' AND entity IN (".
getEntity(
'contract').
")";
3349 } elseif ($modulepart ==
'donation' && !empty($conf->don->dir_output)) {
3351 if ($fuser->hasRight(
'don', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3354 $original_file = $conf->don->dir_output.
'/'.$original_file;
3355 } elseif ($modulepart ==
'dolresource' && !empty($conf->resource->dir_output)) {
3357 if ($fuser->hasRight(
'resource', $read) || preg_match(
'/^specimen/i', $original_file)) {
3360 $original_file = $conf->resource->dir_output.
'/'.$original_file;
3361 } elseif (($modulepart ==
'remisecheque' || $modulepart ==
'chequereceipt') && !empty($conf->bank->dir_output)) {
3363 if ($fuser->hasRight(
'banque', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3366 $original_file = $conf->bank->dir_output.
'/checkdeposits/'.$original_file;
3367 } elseif (($modulepart ==
'banque' || $modulepart ==
'bank') && !empty($conf->bank->dir_output)) {
3369 if ($fuser->hasRight(
'banque', $lire)) {
3372 $original_file = $conf->bank->dir_output.
'/'.$original_file;
3373 } elseif ($modulepart ==
'export' && !empty($conf->export->dir_temp)) {
3376 $accessallowed = $user->hasRight(
'export',
'lire');
3377 $original_file = $conf->export->dir_temp.
'/'.$fuser->id.
'/'.$original_file;
3378 } elseif ($modulepart ==
'import' && !empty($conf->import->dir_temp)) {
3380 $accessallowed = $user->hasRight(
'import',
'run');
3381 $original_file = $conf->import->dir_temp.
'/'.$original_file;
3382 } elseif ($modulepart ==
'recruitment' && !empty($conf->recruitment->dir_output)) {
3384 $accessallowed = $user->hasRight(
'recruitment',
'recruitmentjobposition',
'read');
3385 $original_file = $conf->recruitment->dir_output.
'/'.$original_file;
3386 } elseif ($modulepart ==
'editor' && !empty($conf->fckeditor->dir_output)) {
3389 $original_file = $conf->fckeditor->dir_output.
'/'.$original_file;
3390 } elseif ($modulepart ==
'systemtools' && !empty($conf->admin->dir_output)) {
3392 if ($fuser->admin) {
3395 $original_file = $conf->admin->dir_output.
'/'.$original_file;
3396 } elseif ($modulepart ==
'admin_temp' && !empty($conf->admin->dir_temp)) {
3398 if ($fuser->admin) {
3401 $original_file = $conf->admin->dir_temp.
'/'.$original_file;
3402 } elseif ($modulepart ==
'bittorrent' && !empty($conf->bittorrent->dir_output)) {
3406 if (
dol_mimetype($original_file) ==
'application/x-bittorrent') {
3409 $original_file = $conf->bittorrent->dir_output.
'/'.$dir.
'/'.$original_file;
3410 } elseif ($modulepart ==
'member' && !empty($conf->member->dir_output)) {
3412 if ($fuser->hasRight(
'adherent', $lire) || preg_match(
'/^specimen/i', $original_file)) {
3415 $original_file = $conf->member->dir_output.
'/'.$original_file;
3425 if (preg_match(
'/^specimen/i', $original_file)) {
3428 if ($fuser->admin) {
3432 $tmpmodulepart = explode(
'-', $modulepart);
3433 if (!empty($tmpmodulepart[1])) {
3434 $modulepart = $tmpmodulepart[0];
3435 $original_file = $tmpmodulepart[1].
'/'.$original_file;
3440 if (preg_match(
'/^([a-z]+)_user_temp$/i', $modulepart, $reg)) {
3441 $tmpmodule = $reg[1];
3442 if (empty($conf->$tmpmodule->dir_temp)) {
3443 dol_print_error(
null,
'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.
')');
3446 if ($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read) || $fuser->hasRight($tmpmodule, $download)) {
3449 $original_file = $conf->{$reg[1]}->dir_temp.
'/'.$fuser->id.
'/'.$original_file;
3450 } elseif (preg_match(
'/^([a-z]+)_temp$/i', $modulepart, $reg)) {
3451 $tmpmodule = $reg[1];
3452 if (empty($conf->$tmpmodule->dir_temp)) {
3453 dol_print_error(
null,
'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.
')');
3456 if ($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read) || $fuser->hasRight($tmpmodule, $download)) {
3459 $original_file = $conf->$tmpmodule->dir_temp.
'/'.$original_file;
3460 } elseif (preg_match(
'/^([a-z]+)_user$/i', $modulepart, $reg)) {
3461 $tmpmodule = $reg[1];
3462 if (empty($conf->$tmpmodule->dir_output)) {
3463 dol_print_error(
null,
'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.
')');
3466 if ($fuser->hasRight($tmpmodule, $lire) || $fuser->hasRight($tmpmodule, $read) || $fuser->hasRight($tmpmodule, $download)) {
3469 $original_file = $conf->$tmpmodule->dir_output.
'/'.$fuser->id.
'/'.$original_file;
3470 } elseif (preg_match(
'/^massfilesarea_([a-z]+)$/i', $modulepart, $reg)) {
3471 $tmpmodule = $reg[1];
3472 if (empty($conf->$tmpmodule->dir_output)) {
3473 dol_print_error(
null,
'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.
')');
3476 if ($fuser->hasRight($tmpmodule, $lire) || preg_match(
'/^specimen/i', $original_file)) {
3479 $original_file = $conf->$tmpmodule->dir_output.
'/temp/massgeneration/'.$user->id.
'/'.$original_file;
3481 if (empty($conf->$modulepart->dir_output)) {
3482 dol_print_error(
null,
'Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.
'). The module for this modulepart value may not be activated.');
3487 $partsofdirinoriginalfile = explode(
'/', $original_file);
3488 if (!empty($partsofdirinoriginalfile[1])) {
3489 $partofdirinoriginalfile = $partsofdirinoriginalfile[0];
3490 if ($partofdirinoriginalfile && ($fuser->hasRight($modulepart, $partofdirinoriginalfile,
'lire') || $fuser->hasRight($modulepart, $partofdirinoriginalfile,
'read'))) {
3494 if ($fuser->hasRight($modulepart, $lire) || $fuser->hasRight($modulepart, $read)) {
3498 if (is_array($conf->$modulepart->multidir_output) && !empty($conf->$modulepart->multidir_output[$entity])) {
3499 $original_file = $conf->$modulepart->multidir_output[$entity].
'/'.$original_file;
3501 $original_file = $conf->$modulepart->dir_output.
'/'.$original_file;
3505 $parameters = array(
3506 'modulepart' => $modulepart,
3507 'original_file' => $original_file,
3508 'entity' => $entity,
3513 $reshook = $hookmanager->executeHooks(
'checkSecureAccess', $parameters,
$object);
3515 if (!empty($hookmanager->resArray[
'original_file'])) {
3516 $original_file = $hookmanager->resArray[
'original_file'];
3518 if (!empty($hookmanager->resArray[
'accessallowed'])) {
3519 $accessallowed = $hookmanager->resArray[
'accessallowed'];
3521 if (!empty($hookmanager->resArray[
'sqlprotectagainstexternals'])) {
3522 $sqlprotectagainstexternals = $hookmanager->resArray[
'sqlprotectagainstexternals'];
3528 'accessallowed' => ($accessallowed ? 1 : 0),
3529 'sqlprotectagainstexternals' => $sqlprotectagainstexternals,
3530 'original_file' => $original_file