check for correct array in ApsInstaller, fixes #1098

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-03-10 09:11:05 +01:00
parent a76b064a56
commit 4b872399ac

View File

@@ -393,36 +393,28 @@ class ApsInstaller extends ApsParser
//check for special PHP permissions //check for special PHP permissions
//must be done with xpath otherwise check not possible (XML parser problem with attributes) //must be done with xpath otherwise check not possible (XML parser problem with attributes)
if($ParentMapping && $ParentMapping !== null) if ($ParentMapping && $ParentMapping !== null) {
{
$ParentMapping->registerXPathNamespace('p', 'http://apstandard.com/ns/1/php'); $ParentMapping->registerXPathNamespace('p', 'http://apstandard.com/ns/1/php');
$Result = $ParentMapping->xpath('p:permissions'); $Result = $ParentMapping->xpath('p:permissions');
if($Result[0]['writable'] == 'true') if (is_array($Result) && isset($Result[0]) && is_array($Result[0])) {
{ if (isset($Result[0]['writable']) && $Result[0]['writable'] == 'true') {
//fixing file permissions to writeable // fixing file permissions to writeable
if (is_dir($Path)) {
if(is_dir($Path)) chmod($Path, 0775);
{ } else {
chmod($Path, 0775); chmod($Path, 0664);
}
} }
else
{ if (isset($Result[0]['readable']) && $Result[0]['readable'] == 'false') {
chmod($Path, 0664); //fixing file permissions to non readable
} if (is_dir($Path)) {
} chmod($Path, 0333);
} else {
if($Result[0]['readable'] == 'false') chmod($Path, 0222);
{ }
//fixing file permissions to non readable
if(is_dir($Path))
{
chmod($Path, 0333);
}
else
{
chmod($Path, 0222);
} }
} }
} }