Project

General

Profile

Bug #16430 » bug_3977_v3.diff

Administrator Admin, 2010-04-17 23:21

View differences:

t3lib/class.t3lib_div.php (working copy)
}
/**
* Sets the file system mode and group ownership of file.
* Sets the file system mode and group ownership of a file or a folder.
*
* @param string $file
* the path of an existing file, must not be escaped
*
* @return void
* @param string Filepath of file or folder, must not be escaped
* @param boolean If set, also fixes permissions of files and folders in the folder (if $path is a folder)
* @return void
*/
public static function fixPermissions($file) {
if (@is_file($file) && TYPO3_OS!='WIN') {
@chmod($file, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'])); // "@" is there because file is not necessarily OWNED by the user
public static function fixPermissions($path, $recursively = FALSE) {
if (TYPO3_OS != 'WIN') {
if (@is_file($path)) {
@chmod($path, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'])); // "@" is there because file is not necessarily OWNED by the user
} elseif (@is_dir($path)) {
@chmod($path, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'])); // "@" is there because file is not necessarily OWNED by the user
}
if($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) { // skip this if createGroup is empty
@chgrp($file, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']); // "@" is there because file is not necessarily OWNED by the user
@chgrp($path, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']); // "@" is there because file is not necessarily OWNED by the user
}
}
if (@is_dir($path) && $recursively) {
$handle = opendir($path);
while (($file = readdir($handle)) !== false) {
if ($file != '.' && $file != '..') {
if (@is_file($path . $file)) {
t3lib_div::fixPermissions($path . $file);
} elseif (@is_dir($path . $file . '/')) {
t3lib_div::fixPermissions($path . $file . '/', TRUE);
}
}
}
}
}
/**
* Writes $content to a filename in the typo3temp/ folder (and possibly one or two subfolders...)
......
* @param string Absolute path to folder, see PHP mkdir() function. Removes trailing slash internally.
* @return boolean TRUE if @mkdir went well!
*/
public static function mkdir($theNewFolder) {
$theNewFolder = preg_replace('|/$|','',$theNewFolder);
if (@mkdir($theNewFolder, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask']))){
chmod($theNewFolder, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'])); //added this line, because the mode at 'mkdir' has a strange behaviour sometimes
if($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) { // skip this if createGroup is empty
@chgrp($theNewFolder, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']);
}
return true;
} else {
return false;
public static function mkdir($newFolder) {
$newFolder = preg_replace('|/$|','',$newFolder);
$success = @mkdir($newFolder, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask']));
if ($success) {
self::fixPermissions($newFolder);
}
return $success;
}
/**
typo3/mod/tools/em/class.em_index.php (working copy)
$GLOBALS['LANG']->getLL('translation_update_done') . '";
</script>
';
// Fix permissions on unzipped language xml files in the entire l10n folder and all subfolders...
t3lib_div::fixPermissions(PATH_typo3conf . 'l10n/', TRUE);
echo $contentParts[1] . $this->doc->endPage();
exit;
}
......
$path = 'l10n/'.$lang.'/';
if(!is_dir(PATH_typo3conf.$path)) t3lib_div::mkdir_deep(PATH_typo3conf,$path);
t3lib_div::writeFile($file, $l10n[0]);
if($this->unzip($file, PATH_typo3conf.$path)) {
if($this->unzip($file, PATH_typo3conf . $path)) {
return true;
} else {
return $GLOBALS['LANG']->getLL('translation_unpacking_failed');
......
function installTranslationsForExtension($extKey, $mirrorURL) {
$selectedLanguages = unserialize($this->MOD_SETTINGS['selectedLanguages']);
if(!is_array($selectedLanguages)) $selectedLanguages = array();
foreach($selectedLanguages as $lang) {
foreach ($selectedLanguages as $lang) {
$l10n = $this->terConnection->fetchTranslation($extKey, $lang, $mirrorURL);
if(is_array($l10n)) {
$file = PATH_typo3conf.'l10n/'.$extKey.'-l10n-'.$lang.'.zip';
$path = 'l10n/'.$lang.'/'.$extKey;
$file = PATH_typo3conf . 'l10n/' . $extKey . '-l10n-' . $lang . '.zip';
$path = 'l10n/' . $lang . '/' . $extKey;
t3lib_div::writeFile($file, $l10n[0]);
if(!is_dir(PATH_typo3conf.$path)) t3lib_div::mkdir_deep(PATH_typo3conf,$path);
if($this->unzip($file, PATH_typo3conf.$path)) {
(3-3/7)