Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
Open sidebar
Zvonimir
ISPConfig 3
Commits
3898c948
Commit
3898c948
authored
Sep 13, 2012
by
tbrehm
Browse files
Fixed: FS#2418 - PHP: Timezone ID 'CEST' is invalid
parent
f601d97d
Changes
2
Hide whitespace changes
Inline
Side-by-side
install/install.php
View file @
3898c948
...
...
@@ -104,16 +104,7 @@ $inst->find_installed_apps();
//** Select the language and set default timezone
$conf
[
'language'
]
=
$inst
->
simple_query
(
'Select language'
,
array
(
'en'
,
'de'
),
'en'
);
exec
(
'date +%z'
,
$tmp_out
);
$tmp_zone
=
intval
(
$tmp_out
[
0
]);
if
(
substr
(
$tmp_out
[
0
],
0
,
1
)
==
'+'
)
{
$conf
[
'timezone'
]
=
'Etc/GMT+'
.
$tmp_zone
;
}
else
{
$conf
[
'timezone'
]
=
'Etc/GMT-'
.
$tmp_zone
;
}
unset
(
$tmp_out
);
unset
(
$tmp_zone
);
$conf
[
'timezone'
]
=
get_system_timezone
();
//* Set defaukt theme
$conf
[
'theme'
]
=
'default'
;
...
...
install/lib/install.lib.php
View file @
3898c948
...
...
@@ -750,6 +750,55 @@ function is_ispconfig_ssl_enabled() {
}
}
/**
Function to find the hash file for timezone detection
(c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
*/
function
find_hash_file
(
$hash
,
$dir
,
$basedir
=
''
)
{
$res
=
opendir
(
$dir
);
if
(
!
$res
)
return
false
;
if
(
substr
(
$dir
,
-
1
)
===
'/'
)
$dir
=
substr
(
$dir
,
0
,
strlen
(
$dir
)
-
1
);
if
(
$basedir
===
''
)
$basedir
=
$dir
;
while
(
$cur
=
readdir
(
$res
))
{
if
(
$cur
==
'.'
||
$cur
==
'..'
)
continue
;
$entry
=
$dir
.
'/'
.
$cur
;
if
(
is_dir
(
$entry
))
{
$result
=
find_hash_file
(
$hash
,
$entry
,
$basedir
);
if
(
$result
!==
false
)
return
$result
;
}
elseif
(
md5_file
(
$entry
)
===
$hash
)
{
$entry
=
substr
(
$entry
,
strlen
(
$basedir
));
if
(
substr
(
$entry
,
0
,
7
)
===
'/posix/'
)
$entry
=
substr
(
$entry
,
7
);
return
$entry
;
}
}
closedir
(
$res
);
return
false
;
}
/**
Function to get the timezone of the Linux system
(c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
*/
function
get_system_timezone
()
{
if
(
is_link
(
'/etc/localtime'
))
{
$timezone
=
readlink
(
'/etc/localtime'
);
$timezone
=
str_replace
(
'/usr/share/zoneinfo/'
,
''
,
$timezone
);
if
(
substr
(
$timezone
,
0
,
6
)
===
'posix/'
)
$timezone
=
substr
(
$timezone
,
6
);
}
else
{
$hash
=
md5_file
(
'/etc/localtime'
);
$timezone
=
find_hash_file
(
$hash
,
'/usr/share/zoneinfo'
);
}
if
(
!
$timezone
)
{
exec
(
'date +%Z'
,
$tzinfo
);
$timezone
=
$tzinfo
[
0
];
}
return
$timezone
;
}
?>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment