New: task #8760 : Paramtrage UMask sur fichiers documents

This commit is contained in:
Laurent Destailleur 2008-10-13 18:10:26 +00:00
parent 8104948dce
commit 1cc2bf3190
8 changed files with 35 additions and 6 deletions

View File

@ -11,6 +11,7 @@ For users:
- Added average amount in invoices statistics reports.
- Can move a contract line to another contract of same third party.
- Add an export definition to export interventions.
- Can set umask file permissions on Unix/Linux/BSD systems.
For translators:
- The errors language file contains only error or warning messages with

View File

@ -69,6 +69,13 @@ if ($_GET["action"] == 'MAIN_SESSION_TIMEOUT')
exit;
}
if ($_GET["action"] == 'MAIN_UMASK')
{
dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"]);
Header("Location: security_other.php");
exit;
}
if ($_GET["action"] == 'activate_avscan')
{
dolibarr_set_const($db, "MAIN_USE_AVSCAN", '1');
@ -127,6 +134,20 @@ print '<input type="submit" class="button" name="button" value="'.$langs->trans(
print '</td>';
print '</tr></form>';
$var=!$var;
print '<form action="'.$_SERVER["PHP_SELF"].'?action=MAIN_UMASK" method="POST">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("UMask").'</td><td align="right">';
print $form->textwithhelp('',$langs->trans("UMaskExplanation"));
print '</td>';
print '<td nowrap="1">';
print '<input class="flat" name="MAIN_UMASK" type="text" size="6" value="'.$conf->global->MAIN_UMASK.'">';
print '</td>';
print '<td align="center">';
print '<input type="submit" class="button" name="button" value="'.$langs->trans("Modify").'">';
print '</td>';
print '</tr></form>';
$var=!$var;
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=ini_get("session.gc_maxlifetime");
print '<form action="'.$_SERVER["PHP_SELF"].'?action=MAIN_SESSION_TIMEOUT" method="POST">';

View File

@ -469,6 +469,8 @@ class Conf
if (! isset($this->global->MAIN_MAX_DECIMALS_TOT)) $this->global->MAIN_MAX_DECIMALS_TOT=2;
if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8;
// Define umask
if (empty($conf->global->MAIN_UMASK)) $conf->global->MAIN_UMASK='0664';
/* \todo Ajouter une option Gestion de la TVA dans le module compta qui permet de desactiver la fonction TVA
* (pour particuliers ou liberaux en franchise)

View File

@ -208,6 +208,8 @@ DoTestServerAvailability=Test server connectivity
DoTestSend=Test sending
DoTestSendHTML=Test sending HTML
ErrorCantUseRazInStartedYearIfNoYearMonthInMask=Error, can't user option @ if sequence {yy}{mm} or {yyyy}{mm} is not in mask.
UMask=UMask parameter for new files on Unix/Linux/BSD 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>Ce paramètre ne sert pas sous un serveur Windows.
# Modules
Module0Name=Users & groups

View File

@ -207,6 +207,8 @@ DoTestServerAvailability=Tester disponibilit
DoTestSend=Tester envoi
DoTestSendHTML=Tester envoi HTML
ErrorCantUseRazInStartedYearIfNoYearMonthInMask=Erreur, ne peut utiliser l'option @ si la séquence {yy}{mm} ou {yyyy}{mm} n'est pas dans le masque.
UMask=Paramètre UMask des nouveaux fichiers sous Unix/Linux/BSD.
UMaskExplanation=Ce paramètre permet de définir les droits des fichiers créés sur le serveur par Dolibarr (lors d'upload par exemple).<br>Ce doit être la valeur octal (par exemple 0666 signifie lecture/ecriture pour tous).<br>This parameter is useless on a Windows server.
# Modules
Module0Name=Utilisateurs & groupes

View File

@ -1672,8 +1672,9 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite)
// Move file
$return=move_uploaded_file($src_file, $file_name);
if ($return)
{
dolibarr_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name, LOG_DEBUG);
{
@chmod($file_name, $conf->global->MAIN_UMASK);
dolibarr_syslog("Functions.lib::dol_move_uploaded_file Success to move ".$src_file." to ".$file_name." - Umask=".$conf->global->MAIN_UMASK, LOG_DEBUG);
return 1;
}
else

View File

@ -599,8 +599,8 @@ class Ldap
fclose($fp);
// We change mod to allow file to be overwritten if dump is launched
// from command line or a web session.
// 0662 = rw-rw-rw-
@chmod($file, 0666);
// 0666 = rw-rw-rw-
@chmod($file, $conf->global->MAIN_UMASK);
return 1;
}
else

View File

@ -315,8 +315,8 @@ function build_rssfile($format='rss',$title,$desc,$events_array,$outputfile,$fil
// We change mod to allow file to be overwritten if dump is launched
// from command line or a web session.
// 0662 = rw-rw-rw-
@chmod($fichier, 0666);
// 0666 = rw-rw-rw-
@chmod($fichier, $conf->global->MAIN_UMASK);
}
}