Use dolChmod

This commit is contained in:
Laurent Destailleur 2023-02-17 19:30:50 +01:00
parent d976372d87
commit 0b4cacd291
101 changed files with 247 additions and 428 deletions

View File

@ -80,8 +80,18 @@ if ($action == 'updateform') {
}
if (!$error) {
$tmpumask = GETPOST('MAIN_UMASK', 'alpha');
$tmpumask = (octdec($tmpumask) & 0666);
$tmpumask = decoct($tmpumask);
if (!preg_match('/^0/', $tmpumask)) {
$tmpumask = '0'.$tmpumask;
}
if (empty($tmpumask) || $tmpumask === '0') {
$tmpumask = '0664';
}
$res3 = dolibarr_set_const($db, 'MAIN_UPLOAD_DOC', GETPOST('MAIN_UPLOAD_DOC', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, "MAIN_UMASK", GETPOST('MAIN_UMASK', 'alpha'), 'chaine', 0, '', $conf->entity);
$res4 = dolibarr_set_const($db, "MAIN_UMASK", $tmpumask, 'chaine', 0, '', $conf->entity);
$res5 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", trim($antivircommand), 'chaine', 0, '', $conf->entity);
$res6 = dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", trim($antivirparam), 'chaine', 0, '', $conf->entity);
if ($res3 && $res4 && $res5 && $res6) {

View File

@ -746,7 +746,7 @@ class Documents extends DolibarrApi
if ($fhandle) {
$nbofbyteswrote = fwrite($fhandle, $newfilecontent);
fclose($fhandle);
@chmod($destfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($destfiletmp);
} else {
throw new RestException(500, "Failed to open file '".$destfiletmp."' for write");
}

View File

@ -2278,7 +2278,7 @@ class ActionComm extends CommonObject
// Create temp file
$outputfiletmp = tempnam($conf->agenda->dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfiletmp);
// Write file
if ($format == 'vcal') {

View File

@ -1700,9 +1700,7 @@ class BonPrelevement extends CommonObject
}
fclose($this->file);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($this->filename, octdec($conf->global->MAIN_UMASK));
}
dolChmod($this->filename);
return $result;
}

View File

@ -820,9 +820,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
// check if pdftk is installed
if (file_exists($file)) {
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs');
@ -888,9 +886,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto
$now = dol_now();
$file = $diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf';
$pdf->Output($file, 'F');
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$langs->load("exports");
setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs');

View File

@ -1213,9 +1213,7 @@ class CMailFile
}
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
}
}
@ -1797,7 +1795,7 @@ class CMailFile
if ($fhandle) {
$nbofbyteswrote = fwrite($fhandle, base64_decode($filecontent));
fclose($fhandle);
@chmod($destfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($destfiletmp);
} else {
$this->errors[] = "Failed to open file '".$destfiletmp."' for write";
return -1;

View File

@ -231,9 +231,7 @@ class CSMSFile
fputs($fp, "Message:\n".$this->message);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
}
}
@ -257,9 +255,7 @@ class CSMSFile
fputs($fp, "\nResult id=".$result);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
}
}
}

View File

@ -743,9 +743,7 @@ class Ldap
if ($fp) {
fputs($fp, $content);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
return 1;
} else {
return -1;

View File

@ -295,10 +295,7 @@ class RssParser
if ($fp) {
fwrite($fp, $str);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
$newmask = $conf->global->MAIN_UMASK;
}
@chmod($newpathofdestfile, octdec($newmask));
dolChmod($newpathofdestfile);
$this->_lastfetchdate = $nowgmt;
} else {

View File

@ -119,10 +119,7 @@ abstract class Stats
$fp = fopen($newpathofdestfile, 'w');
fwrite($fp, json_encode($data));
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
$newmask = $conf->global->MAIN_UMASK;
}
@chmod($newpathofdestfile, octdec($newmask));
dolChmod($newpathofdestfile);
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
}
@ -222,10 +219,7 @@ abstract class Stats
if ($fp) {
fwrite($fp, json_encode($data));
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
$newmask = $conf->global->MAIN_UMASK;
}
@chmod($newpathofdestfile, octdec($newmask));
dolChmod($newpathofdestfile);
} else {
dol_syslog("Failed to write cache file", LOG_ERR);
}
@ -332,10 +326,7 @@ abstract class Stats
if ($fp) {
fwrite($fp, json_encode($data));
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
$newmask = $conf->global->MAIN_UMASK;
}
@chmod($newpathofdestfile, octdec($newmask));
dolChmod($newpathofdestfile);
}
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
}

View File

@ -494,9 +494,7 @@ class Utils
}
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
} else {
$langs->load("errors");
dol_syslog("Failed to open file ".$outputfile, LOG_ERR);
@ -739,9 +737,7 @@ class Utils
pclose($handlein);
fclose($handle);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
}
// Update with result
@ -1051,7 +1047,7 @@ class Utils
fclose($sourcehandle);
gzclose($gzfilehandle);
@chmod($logpath.'/'.$logname.'.1.gz', octdec(empty($conf->global->MAIN_UMASK) ? '0664' : $conf->global->MAIN_UMASK));
dolChmod($logpath.'/'.$logname.'.1.gz');
}
dol_delete_file($logpath.'/'.$logname, 0, 0, 0, null, false, 0);
@ -1061,7 +1057,7 @@ class Utils
fclose($newlog);
//var_dump($logpath.'/'.$logname." - ".octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));
@chmod($logpath.'/'.$logname, octdec(empty($conf->global->MAIN_UMASK) ? '0664' : $conf->global->MAIN_UMASK));
dolChmod($logpath.'/'.$logname);
}
}

View File

@ -678,7 +678,7 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask
}
file_put_contents($newpathoftmpdestfile, $content);
@chmod($newpathoftmpdestfile, octdec($newmask));
dolChmod($newpathoftmpdestfile, $newmask);
// Rename
$result = dol_move($newpathoftmpdestfile, $newpathofdestfile, $newmask, (($destfile == $srcfile) ? 1 : 0), 0, $indexdatabase);
@ -694,7 +694,7 @@ function dolReplaceInFile($srcfile, $arrayreplacement, $destfile = '', $newmask
$newmask = '0664';
}
@chmod($newpathofdestfile, octdec($newmask));
dolChmod($newpathofdestfile, $newmask);
return 1;
}
@ -752,7 +752,7 @@ function dol_copy($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1)
$newmask = '0664';
}
@chmod($newpathofdestfile, octdec($newmask));
dolChmod($newpathofdestfile, $newmask);
return 1;
}
@ -900,6 +900,18 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
}
}
global $dolibarr_main_restrict_os_commands;
if (!empty($dolibarr_main_restrict_os_commands)) {
$arrayofallowedcommand = explode(',', $dolibarr_main_restrict_os_commands);
$arrayofallowedcommand = array_map('trim', $arrayofallowedcommand);
if (in_array(basename($destfile), $arrayofallowedcommand)) {
//$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
//setEventMessages($langs->trans("ErrorFilenameReserved", basename($destfile)), null, 'errors');
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);
return false;
}
}
$result = @rename($newpathofsrcfile, $newpathofdestfile); // To see errors, remove @
if (!$result) {
if ($destexists) {
@ -975,11 +987,11 @@ function dol_move($srcfile, $destfile, $newmask = 0, $overwriteifexists = 1, $te
if (empty($newmask)) {
$newmask = empty($conf->global->MAIN_UMASK) ? '0755' : $conf->global->MAIN_UMASK;
}
$newmaskdec = octdec($newmask);
// Currently method is restricted to files (dol_delete_files previously used is for files, and mask usage if for files too)
// to allow mask usage for dir, we shoul introduce a new param "isdir" to 1 to complete newmask like this
// if ($isdir) $newmaskdec |= octdec('0111'); // Set x bit required for directories
@chmod($newpathofdestfile, $newmaskdec);
dolChmod($newpathofdestfile, $newmask);
}
return $result;
@ -1219,9 +1231,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable
// Move file
$return = move_uploaded_file($src_file_osencoded, $file_name_osencoded);
if ($return) {
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file_name_osencoded, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file_name_osencoded);
dol_syslog("Files.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG);
return $successcode; // Success
} else {
@ -1303,7 +1313,7 @@ function dol_delete_file($file, $disableglob = 0, $nophperrors = 0, $nohook = 0,
// If it fails and it is because of the missing write permission on parent dir
if (!$ok && file_exists(dirname($filename)) && !(fileperms(dirname($filename)) & 0200)) {
dol_syslog("Error in deletion, but parent directory exists with no permission to write, we try to change permission on parent directory and retry...", LOG_DEBUG);
@chmod(dirname($filename), fileperms(dirname($filename)) | 0200);
dolChmod(dirname($filename), decoct(fileperms(dirname($filename)) | 0200));
// Now we retry deletion
if ($nophperrors) {
$ok = @unlink($filename);
@ -1592,11 +1602,10 @@ function dol_meta_create($object)
$fp = fopen($file, "w");
fputs($fp, $meta);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
return 1;
dolChmod($file);
return 1;
} else {
dol_syslog('FailedToDetectDirInDolMetaCreateFor'.$object->element, LOG_WARNING);
}
@ -1713,6 +1722,17 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
$destfile = dol_string_nohtmltag($destfile);
$destfull = dol_string_nohtmltag($destfull);
global $dolibarr_main_restrict_os_commands;
if (!empty($dolibarr_main_restrict_os_commands)) {
$arrayofallowedcommand = explode(',', $dolibarr_main_restrict_os_commands);
$arrayofallowedcommand = array_map('trim', $arrayofallowedcommand);
if (in_array(basename($destfull), $arrayofallowedcommand)) {
$langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now.
setEventMessages($langs->trans("ErrorFilenameReserved", basename($destfull)), null, 'errors');
return -1;
}
}
// Move file from temp directory to final directory. A .noexe may also be appended on file name.
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles, $upload_dir);
@ -2388,7 +2408,7 @@ function dol_compress_dir($inputdir, $outputfile, $mode = "zip", $excludefiles =
$newmask = '0664';
}
@chmod($outputfile, octdec($newmask));
dolChmod($outputfile, $newmask);
return 1;
}
@ -3215,7 +3235,7 @@ function dol_filecache($directory, $filename, $object)
}
$cachefile = $directory.$filename;
file_put_contents($cachefile, serialize($object), LOCK_EX);
@chmod($cachefile, 0644);
dolChmod($cachefile, '0644');
}
/**

View File

@ -6864,13 +6864,16 @@ function dol_mkdir($dir, $dataroot = '', $newmask = '')
* Change mod of a file
*
* @param string $filepath Full file path
* @param string $newmask Force new mask. For example '0644'
* @return void
*/
function dolChmod($filepath)
function dolChmod($filepath, $newmask = '')
{
global $conf;
if (!empty($conf->global->MAIN_UMASK)) {
if (!empty($newmask)) {
@chmod($filepath, octdec($newmask));
} elseif (!empty($conf->global->MAIN_UMASK)) {
@chmod($filepath, octdec($conf->global->MAIN_UMASK));
}
}

View File

@ -362,9 +362,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0,
}
// Set permissions on file
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($imgTargetName, octdec($conf->global->MAIN_UMASK));
}
dolChmod($imgTargetName);
// Free memory. This does not delete image.
imagedestroy($img);
@ -761,9 +759,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
}
// Set permissions on file
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($imgThumbName, octdec($conf->global->MAIN_UMASK));
}
dolChmod($imgThumbName);
// Free memory. This does not delete image.
imagedestroy($img);

View File

@ -277,9 +277,7 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
if (!$error && $pagecount) {
$pdf->Output($file, 'F');
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
}
if ($usestdout) {

View File

@ -227,7 +227,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir =
$result = file_put_contents(dol_osencode($pathoffiletoedittarget), $contentclass);
if ($result) {
@chmod($pathoffiletoedittarget, octdec($newmask));
dolChmod($pathoffiletoedittarget, $newmask);
} else {
$error++;
}
@ -369,7 +369,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
$result = file_put_contents($pathoffiletoedittarget, $contentsql);
if ($result) {
@chmod($pathoffiletoedittarget, octdec($newmask));
dolChmod($pathoffiletoedittarget, $newmask);
} else {
$error++;
setEventMessages($langs->trans("ErrorFailToCreateFile", $pathoffiletoedittarget), null, 'errors');
@ -408,7 +408,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = '
$result2 = file_put_contents($pathoffiletoedittarget, $contentsql);
if ($result2) {
@chmod($pathoffiletoedittarget, octdec($newmask));
dolChmod($pathoffiletoedittarget, $newmask);
} else {
$error++;
setEventMessages($langs->trans("ErrorFailToCreateFile", $pathoffiletoedittarget), null, 'errors');

View File

@ -457,7 +457,7 @@ function encodedecode_dbpassconf($level = 0)
// It's config file, so we set read permission for creator only.
// Should set permission to web user and groups for users used by batch
//@chmod($file, octdec('0600'));
//dolChmod($file, '0600');
return 1;
} else {

View File

@ -1210,9 +1210,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
$fp = fopen($filetosave, "w");
fputs($fp, $tmpgeturl['content']);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filetosave, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filetosave);
}
}
}
@ -1281,9 +1279,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify
$fp = fopen($filetosave, "w");
fputs($fp, $tmpgeturl['content']);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filetosave, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filetosave);
}
}
}

View File

@ -45,9 +45,7 @@ function dolSaveMasterFile($filemaster)
$mastercontent .= "}\n";
$mastercontent .= '?>'."\n";
$result = file_put_contents($filemaster, $mastercontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filemaster, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filemaster);
return $result;
}
@ -79,9 +77,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
if ($result === false) {
dol_syslog("Failed to write file ".$filealias, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealias, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filealias);
// Save also alias into language subdirectory if it is not a main language
if ($objectpage->lang && in_array($objectpage->lang, explode(',', $object->otherlang))) {
@ -99,9 +95,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
if ($result === false) {
dol_syslog("Failed to write file ".$filealiassub, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filealiassub);
} elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) {
// Save also alias into all language subdirectories if it is a main language
if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR) && !empty($object->otherlang)) {
@ -122,9 +116,7 @@ function dolSavePageAlias($filealias, $object, $objectpage)
if ($result === false) {
dol_syslog("Failed to write file ".$filealiassub, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filealiassub, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filealiassub);
}
}
}
@ -276,9 +268,8 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage,
//var_dump($filetpl);exit;
$result = file_put_contents($filetpl, $tplcontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filetpl);
return $result;
}
@ -318,9 +309,8 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper, $o
$indexcontent .= '// END PHP ?>'."\n";
$result1 = file_put_contents($fileindex, $indexcontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($fileindex, octdec($conf->global->MAIN_UMASK));
}
dolChmod($fileindex);
if (is_object($object) && $object->fk_default_home > 0) {
$objectpage = new WebsitePage($db);
@ -352,9 +342,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper, $o
if ($result === false) {
dol_syslog("Failed to write file ".$fileindexsub, LOG_WARNING);
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($fileindexsub, octdec($conf->global->MAIN_UMASK));
}
dolChmod($fileindexsub);
}
}
}
@ -368,9 +356,7 @@ function dolSaveIndexPage($pathofwebsite, $fileindex, $filetpl, $filewrapper, $o
$wrappercontent = file_get_contents(DOL_DOCUMENT_ROOT.'/website/samples/wrapper.php');
$result2 = file_put_contents($filewrapper, $wrappercontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filewrapper, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filewrapper);
} else {
$result2 = true;
}
@ -394,9 +380,7 @@ function dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent)
dol_mkdir($pathofwebsite);
$result = file_put_contents($filehtmlheader, $htmlheadercontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filehtmlheader, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filehtmlheader);
return $result;
}
@ -416,9 +400,7 @@ function dolSaveCssFile($filecss, $csscontent)
dol_mkdir($pathofwebsite);
$result = file_put_contents($filecss, $csscontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filecss, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filecss);
return $result;
}
@ -438,9 +420,7 @@ function dolSaveJsFile($filejs, $jscontent)
dol_mkdir($pathofwebsite);
$result = file_put_contents($filejs, $jscontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filejs, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filejs);
return $result;
}
@ -460,9 +440,7 @@ function dolSaveRobotFile($filerobot, $robotcontent)
dol_mkdir($pathofwebsite);
$result = file_put_contents($filerobot, $robotcontent);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filerobot, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filerobot);
return $result;
}
@ -482,9 +460,7 @@ function dolSaveHtaccessFile($filehtaccess, $htaccess)
dol_mkdir($pathofwebsite);
$result = file_put_contents($filehtaccess, $htaccess);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filehtaccess, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filehtaccess);
return $result;
}
@ -504,9 +480,7 @@ function dolSaveManifestJson($file, $content)
dol_mkdir($pathofwebsite);
$result = file_put_contents($file, $content);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
return $result;
}
@ -526,9 +500,7 @@ function dolSaveReadme($file, $content)
dol_mkdir($pathofwebsite);
$result = file_put_contents($file, $content);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
return $result;
}
@ -548,9 +520,7 @@ function dolSaveLicense($file, $content)
dol_mkdir($pathofwebsite);
$result = file_put_contents($file, $content);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
return $result;
}

View File

@ -284,10 +284,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile)
fwrite($calfileh, "END:VCALENDAR");
fclose($calfileh);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
} else {
dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing");
return -2;
@ -429,10 +426,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt
fwrite($fichier, "</rss>");
fclose($fichier);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($outputfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($outputfile);
}
}

View File

@ -209,9 +209,7 @@ class CommActionRapport
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -480,9 +480,7 @@ class doc_generic_asset_odt extends ModelePDFAsset
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -815,13 +815,11 @@ class pdf_standard_asset extends ModelePDFAsset
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);
$this->result = array('fullpath'=>$file);
return 1; // No error
return 1; // No error
} else {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;

View File

@ -250,9 +250,7 @@ class pdf_ban extends ModeleBankAccountDoc
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -429,9 +429,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -498,9 +498,7 @@ class doc_generic_bom_odt extends ModelePDFBom
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -203,9 +203,7 @@ class BordereauChequeBlochet extends ModeleChequeReceipts
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -496,9 +496,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -676,9 +676,7 @@ class pdf_einstein extends ModelePDFCommandes
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -900,9 +900,7 @@ class pdf_eratosthene extends ModelePDFCommandes
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -492,9 +492,7 @@ class doc_generic_contract_odt extends ModelePDFContract
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -496,9 +496,7 @@ class pdf_strato extends ModelePDFContract
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -634,9 +634,7 @@ class pdf_storm extends ModelePDFDeliveryOrder
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -619,9 +619,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -240,9 +240,7 @@ class html_cerfafr extends ModeleDon
$handle = fopen($file, "w");
fwrite($handle, $form);
fclose($handle);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -559,9 +559,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -763,9 +763,7 @@ class pdf_espadon extends ModelePdfExpedition
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -425,9 +425,7 @@ class pdf_merou extends ModelePdfExpedition
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -669,9 +669,7 @@ class pdf_rouget extends ModelePdfExpedition
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -539,9 +539,7 @@ class pdf_standard extends ModeleExpenseReport
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -520,9 +520,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -908,9 +908,7 @@ class pdf_crabe extends ModelePDFFactures
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -1058,9 +1058,7 @@ class pdf_sponge extends ModelePDFFactures
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -469,9 +469,7 @@ class pdf_soleil extends ModelePDFFicheinter
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -412,9 +412,7 @@ class doc_generic_member_odt extends ModelePDFMember
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -455,10 +455,7 @@ class pdf_standard extends CommonStickerGenerator
// Output to file
$pdf->Output($file, 'F');
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -791,9 +791,7 @@ class pdf_standard extends ModelePDFMovement
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -484,9 +484,7 @@ class doc_generic_mo_odt extends ModelePDFMo
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -684,9 +684,7 @@ class pdf_vinci extends ModelePDFMo
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -337,9 +337,7 @@ class pdf_standardlabel extends CommonStickerGenerator
// Output to file
$pdf->Output($file, 'F');
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -360,10 +360,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator
// Output to file
$pdf->Output($file, 'F');
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -481,9 +481,7 @@ class doc_generic_product_odt extends ModelePDFProduct
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -581,9 +581,7 @@ class pdf_standard extends ModelePDFProduct
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -1167,9 +1167,7 @@ class doc_generic_project_odt extends ModelePDFProjects
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -521,9 +521,7 @@ class pdf_baleine extends ModelePDFProjects
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -769,9 +769,7 @@ class pdf_beluga extends ModelePDFProjects
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -524,9 +524,7 @@ class pdf_timespent extends ModelePDFProjects
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -845,9 +845,7 @@ class doc_generic_task_odt extends ModelePDFTask
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -523,9 +523,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -873,9 +873,7 @@ class pdf_azur extends ModelePDFPropales
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -990,9 +990,7 @@ class pdf_cyan extends ModelePDFPropales
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -343,9 +343,7 @@ class pdf_paiement
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -485,9 +485,7 @@ class doc_generic_reception_odt extends ModelePdfReception
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -599,9 +599,7 @@ class pdf_squille extends ModelePdfReception
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
return 1; // No error
} else {

View File

@ -433,9 +433,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -484,9 +484,7 @@ class doc_generic_stock_odt extends ModelePDFStock
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -595,9 +595,7 @@ class pdf_standard extends ModelePDFStock
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -659,8 +659,7 @@ class pdf_eagle extends ModelePdfStockTransfer
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -796,8 +796,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -483,9 +483,7 @@ class doc_generic_supplier_invoice_odt extends ModelePDFSuppliersInvoices
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -622,9 +622,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -478,9 +478,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -840,9 +840,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -722,9 +722,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -478,9 +478,7 @@ class pdf_standard extends ModelePDFSuppliersPayments
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -510,9 +510,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -702,9 +702,7 @@ class pdf_aurore extends ModelePDFSupplierProposal
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);

View File

@ -180,7 +180,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
$message = dol_print_date(dol_now('gmt'), 'standard', 'gmt').$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident > 0 ?str_pad('', $this->ident, ' ') : '').$content['message'];
fwrite($filefd, $message."\n");
fclose($filefd);
@chmod($logfile, octdec(empty($conf->global->MAIN_UMASK) ? '0664' : $conf->global->MAIN_UMASK));
dolChmod($logfile);
}
}
}

View File

@ -405,9 +405,7 @@ class doc_generic_ticket_odt extends ModelePDFTicket
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -433,9 +433,7 @@ class doc_generic_user_odt extends ModelePDFUser
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -491,9 +491,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -287,9 +287,7 @@ if ($action == 'download') {
if ($result) {
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($localfile, octdec($conf->global->MAIN_UMASK));
}
dolChmod($localfile);
// Define mime type
$type = 'application/octet-stream';

View File

@ -880,7 +880,7 @@ IMG;
pclose($handlein);
fclose($handle);
}
if (! empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfile);
}
if ($retval == 0) {

View File

@ -156,7 +156,7 @@ if ($rss) {
// Create temp file
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfiletmp);
// Write file
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);

View File

@ -156,7 +156,7 @@ if ($rss) {
// Create temp file
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfiletmp);
// Write file
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);

View File

@ -156,7 +156,7 @@ if ($rss) {
// Create temp file
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfiletmp);
// Write file
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);

View File

@ -156,7 +156,7 @@ if ($rss) {
// Create temp file
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfiletmp);
// Write file
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);

View File

@ -156,7 +156,7 @@ if ($rss) {
// Create temp file
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfiletmp);
// Write file
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);

View File

@ -137,7 +137,7 @@ if ($rss) {
// Create temp file
$outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads
@chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK));
dolChmod($outputfiletmp);
// Write file
$result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'.($l ? '&l='.$l : ''), $l);

View File

@ -443,11 +443,12 @@ if ($action == "set") {
$fp = @fopen($lockfile, "w");
if ($fp) {
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
$force_install_lockinstall = 444; // For backward compatibility
$force_install_lockinstall = '444'; // For backward compatibility
}
fwrite($fp, "This is a lock file to prevent use of install or upgrade pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
dolChmod($lockfile, $force_install_lockinstall);
$createlock = 1;
}
}
@ -490,11 +491,12 @@ if ($action == "set") {
$fp = @fopen($lockfile, "w");
if ($fp) {
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
$force_install_lockinstall = 444; // For backward compatibility
$force_install_lockinstall = '444'; // For backward compatibility
}
fwrite($fp, "This is a lock file to prevent use of install or upgrade pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
dolChmod($lockfile, $force_install_lockinstall);
$createlock = 1;
}
}

View File

@ -374,7 +374,7 @@ DoTestSendHTML=Test sending HTML
ErrorCantUseRazIfNoYearInMask=Error, can't use option @ to reset counter each year if sequence {yy} or {yyyy} is not in mask.
ErrorCantUseRazInStartedYearIfNoYearMonthInMask=Error, can't use option @ if sequence {yy}{mm} or {yyyy}{mm} is not in mask.
UMask=UMask parameter for new files on Unix/Linux/BSD/Mac file system.
UMaskExplanation=This parameter allow you to define permissions set by default on files created by Dolibarr on server (during upload for example).<br>It must be the octal value (for example, 0666 means read and write for everyone).<br>This parameter is useless on a Windows server.
UMaskExplanation=This parameter allow you to define permissions set by default on files created by Dolibarr on server (during upload for example).<br>It must be the octal value (for example, 0666 means read and write for everyone.). Recommended value is 0660<br>This parameter is useless on a Windows server.
SeeWikiForAllTeam=Take a look at the Wiki page for a list of contributors and their organization
UseACacheDelay= Delay for caching export response in seconds (0 or empty for no cache)
DisableLinkToHelpCenter=Hide the link "<b>Need help or support</b>" on the login page

View File

@ -262,6 +262,7 @@ ErrorParameterMustBeEnabledToAllwoThisFeature=Error, parameter <b>%s</b> must be
ErrorLoginDateValidity=Error, this login is outside the validity date range
ErrorValueLength=Length of field '<b>%s</b>' must be higher than '<b>%s</b>'
ErrorReservedKeyword=The word '<b>%s</b>' is a reserved keyword
ErrorFilenameReserved=The filename <b>%s</b> can't be used as it is a reserved and protected command.
ErrorNotAvailableWithThisDistribution=Not available with this distribution
ErrorPublicInterfaceNotEnabled=Public interface was not enabled
ErrorLanguageRequiredIfPageIsTranslationOfAnother=The language of new page must be defined if it is set as a translation of another page

View File

@ -1246,20 +1246,20 @@ if ($dirins && $action == 'initobject' && $module && $objectname) {
}
if ($objectname != $firstobjectname) {
$rightToadd = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Read objects of ".$module."';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Read objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'read';
\$this->rights[\$r][5] = 'read';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Create/Update objects of ".$module."';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Create/Update objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'write';
\$this->rights[\$r][5] = 'write';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Delete objects of ".$module."';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Delete objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'delete';
\$this->rights[\$r][5] = 'delete';
\$r++;
";
dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER PERMISSIONS */' => '/*'.strtoupper($objectname).'*/'.$rightToadd."/*END ".strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER PERMISSIONS */'));
@ -1835,20 +1835,20 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) {
// regenerate permissions and delete them
$rights = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Read objects of ".$module."';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Read objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'read';
\$this->rights[\$r][5] = 'read';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Create/Update objects of ".$module."';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Create/Update objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'write';
\$this->rights[\$r][5] = 'write';
\$r++;
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Delete objects of ".$module."';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = 'Delete objects of ".$module."';
\$this->rights[\$r][4] = '".strtolower($objectname)."';
\$this->rights[\$r][5] = 'delete';
\$this->rights[\$r][5] = 'delete';
\$r++;
";
@ -2050,10 +2050,10 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) {
}
//prepare stirng to add
$rightToAdd = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$label';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$label';
\$this->rights[\$r][4] = '$objectForPerms';
\$this->rights[\$r][5] = '$crud';
\$this->rights[\$r][5] = '$crud';
\$r++;
";
$moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php';
@ -2152,18 +2152,18 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e
//prepare right want to delete
$right = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$x1';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$x1';
\$this->rights[\$r][4] = '$x2';
\$this->rights[\$r][5] = '$x3';
\$this->rights[\$r][5] = '$x3';
\$r++;
";
// right after editing
$rightUpdated = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$label';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$label';
\$this->rights[\$r][4] = '$objectForPerms';
\$this->rights[\$r][5] = '$crud';
\$this->rights[\$r][5] = '$crud';
\$r++;
";
if (!$error) {
@ -2209,10 +2209,10 @@ if ($dirins && $action == 'confirm_deleteright' && !empty($module) && GETPOST('p
$x3 = $permissions[$key][5];
//prepare right want to delete
$rightTodelete = "
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$x1';
\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1);
\$this->rights[\$r][1] = '$x1';
\$this->rights[\$r][4] = '$x2';
\$this->rights[\$r][5] = '$x3';
\$this->rights[\$r][5] = '$x3';
\$r++;
";
@ -2286,7 +2286,7 @@ if ($action == 'savefile' && empty($cancel)) {
dol_delete_file($pathoffile);
$result = file_put_contents($pathoffile, $content);
if ($result) {
@chmod($pathoffile, octdec($newmask));
dolChmod($pathoffile, $newmask);
setEventMessages($langs->trans("FileSaved"), null);
} else {
@ -2394,19 +2394,19 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) {
if ($menus[$key]['type'] == 'top') {
$menuTop = "
\$this->menu[\$r++] = array(
'fk_menu'=>'".$menus[$key]['fk_menu']."',
'type'=>'".$menus[$key]['type']."',
'fk_menu'=>'".$menus[$key]['fk_menu']."',
'type'=>'".$menus[$key]['type']."',
'titre'=>'".$menus[$key]['titre']."',
'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'),
'mainmenu'=>'".$menus[$key]['mainmenu']."',
'leftmenu'=> '',
'url'=>'".$menus[$key]['url']."',
'langs'=>'".$menus[$key]['langs']."',
'langs'=>'".$menus[$key]['langs']."',
'position'=>1000 + \$r,
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'perms' =>'".$menus[$key]['perms']."',
'target'=>'".$menus[$key]['target']."',
'user'=>".$menus[$key]['user'].",
'user'=>".$menus[$key]['user'].",
);";
$check = dolReplaceInFile($moduledescriptorfile, array($menuTop => '',"\t\t".'/*TOPMENU '.strtolower($menus[$key]['titre']).'*/'."\n" => '', '/*END TOPMENU '.strtolower($menus[$key]['titre']).'*/'."\n\t\t" => ''));
}
@ -2579,19 +2579,19 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
if ($type == 'top') {
$menuTop = "
\$this->menu[\$r++] = array(
'fk_menu'=>'".$fk_menu."',
'type'=>'".strtolower($type)."',
'fk_menu'=>'".$fk_menu."',
'type'=>'".strtolower($type)."',
'titre'=>'".ucfirst($titre)."',
'prefix' => img_picto('', \$this->picto, 'class=\"paddingright pictofixedwidth valignmiddle\"'),
'mainmenu'=>'".$mainmenu."',
'leftmenu'=> '".$leftmenu."',
'url'=>'".$url."',
'langs'=>'".strtolower($module)."@".strtolower($module)."',
'langs'=>'".strtolower($module)."@".strtolower($module)."',
'position'=>1000 + \$r,
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'perms' =>'".$perms."',
'target'=>'".$target."',
'user'=>".$user.",
'user'=>".$user.",
);";
$addTopMenu = dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER TOPMENU */' => '/*TOPMENU '.strtolower($titre).'*/'.$menuTop."\n\t\t".'/*END TOPMENU '.strtolower($titre).'*/'."\n\t\t/* END MODULEBUILDER TOPMENU */"));
}
@ -2605,7 +2605,7 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) {
'mainmenu'=>'".strtolower($module)."',
'leftmenu'=>'".strtolower($leftmenu)."',
'url'=>'".$url."',
'langs'=>'".strtolower($module)."@".strtolower($module)."',
'langs'=>'".strtolower($module)."@".strtolower($module)."',
'position'=>1100+\$r,
'enabled'=>'\$conf->".strtolower($module)."->enabled',
'perms'=>'".$perms."',
@ -2662,12 +2662,12 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && empty(GE
'mainmenu'=>'".$menus[$key]['mainmenu']."',
'leftmenu' =>'".$menus[$key]['leftmenu']."',
'url' =>'".$menus[$key]['url']."',
'langs'=>'".$menus[$key]['langs']."',
'langs'=>'".$menus[$key]['langs']."',
'position'=>1000 + \$r,
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'perms' =>'".$menus[$key]['perms']."',
'target'=>'".$menus[$key]['target']."',
'user'=>".$menus[$key]['user'].",
'user'=>".$menus[$key]['user'].",
);";
$fk_menu = GETPOST('fk_type', 'alpha');
@ -2691,12 +2691,12 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && empty(GE
'mainmenu'=>'".$menus[$key]['mainmenu']."',
'leftmenu' =>'".$menus[$key]['leftmenu']."',
'url' =>'".$url."',
'langs'=>'".$menus[$key]['langs']."',
'langs'=>'".$menus[$key]['langs']."',
'position'=>1000 + \$r,
'enabled'=>'".$menus[$key]['enabled']."',
'enabled'=>'".$menus[$key]['enabled']."',
'perms' =>'".$perms."',
'target'=>'".$target."',
'user'=>".$user.",
'user'=>".$user.",
);";
@ -2716,12 +2716,12 @@ if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && empty(GE
'mainmenu'=>'".$menus[$key]['mainmenu']."',
'leftmenu' =>'".$menus[$key]['leftmenu']."',
'url' =>'".$url."',
'langs'=>'".$menus[$key]['langs']."',
'langs'=>'".$menus[$key]['langs']."',
'position'=>1000 + \$r,
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'enabled'=>'isModEnabled(\"".strtolower($module)."\")',
'perms' =>'".$perms."',
'target'=>'".$target."',
'user'=>'".$user."',
'user'=>'".$user."',
);";
dolReplaceInFile($moduledescriptorfile, array($menuTomodify => $modifiedMenu));

View File

@ -498,9 +498,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -783,13 +783,11 @@ class pdf_standard_myobject extends ModelePDFMyObject
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);
$this->result = array('fullpath'=>$file);
return 1; // No error
return 1; // No error
} else {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;

View File

@ -366,10 +366,7 @@ class ProjectStats extends Stats
if ($fp) {
fwrite($fp, json_encode($data));
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
$newmask = $conf->global->MAIN_UMASK;
}
@chmod($newpathofdestfile, octdec($newmask));
dolChmod($newpathofdestfile);
} else {
dol_syslog("Failed to write cache file", LOG_ERR);
}
@ -479,12 +476,11 @@ class ProjectStats extends Stats
dol_mkdir($conf->user->dir_temp);
}
$fp = fopen($newpathofdestfile, 'w');
fwrite($fp, json_encode($data));
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
$newmask = $conf->global->MAIN_UMASK;
if ($fp) {
fwrite($fp, json_encode($data));
fclose($fp);
dolChmod($newpathofdestfile);
}
@chmod($newpathofdestfile, octdec($newmask));
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
}

View File

@ -482,9 +482,7 @@ class doc_generic_recruitmentjobposition_odt extends ModelePDFRecruitmentJobPosi
$parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray);
$reshook = $hookmanager->executeHooks('afterODTCreation', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$odfHandler = null; // Destroy object

View File

@ -710,13 +710,11 @@ class pdf_standard_recruitmentjobposition extends ModelePDFRecruitmentJobPositio
$this->errors = $hookmanager->errors;
}
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
dolChmod($file);
$this->result = array('fullpath'=>$file);
$this->result = array('fullpath'=>$file);
return 1; // No error
return 1; // No error
} else {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;

View File

@ -1132,9 +1132,7 @@ class Website extends CommonObject
fputs($fp, $line);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($filesql, octdec($conf->global->MAIN_UMASK));
}
dolChmod($filesql);
// Build zip file
$filedir = $conf->website->dir_temp.'/'.$website->ref.'/.';

View File

@ -939,8 +939,7 @@ if ($action == 'addcontainer' && $usercanedit) {
$fp = fopen($filetosave, "w");
fputs($fp, $tmpgeturl['content']);
fclose($fp);
if (!empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
dolChmod($file);
}
*/
@ -1008,8 +1007,7 @@ if ($action == 'addcontainer' && $usercanedit) {
//$fp = fopen($filetosave, "w");
//fputs($fp, $tmpgeturl['content']);
//fclose($fp);
//if (!empty($conf->global->MAIN_UMASK))
// @chmod($file, octdec($conf->global->MAIN_UMASK));
//dolChmod($file);
// $filename = 'image/'.$object->ref.'/'.$objectpage->pageurl.(preg_match('/^\//', $linkwithoutdomain)?'':'/').$linkwithoutdomain;
$pagecsscontent .= '/* Content of file '.$urltograbbis.' */'."\n";
@ -2659,9 +2657,7 @@ if ($action == 'generatesitemaps' && $usercanedit) {
}
$domtree->appendChild($root);
if ($domtree->save($tempdir.$xmlname)) {
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($tempdir.$xmlname, octdec($conf->global->MAIN_UMASK));
}
dolChmod($tempdir.$xmlname);
setEventMessages($langs->trans("SitemapGenerated", $xmlname), null, 'mesgs');
} else {
setEventMessages($object->error, $object->errors, 'errors');
@ -5022,8 +5018,7 @@ if ((empty($action) || $action == 'preview' || $action == 'createfromclone' || $
print $out;
/*file_put_contents($filetpl, $out);
if (!empty($conf->global->MAIN_UMASK))
@chmod($filetpl, octdec($conf->global->MAIN_UMASK));
dolChmod($filetpl);
// Output file on browser
dol_syslog("index.php include $filetpl $filename content-type=$type");

Some files were not shown because too many files have changed in this diff Show More