Add error handling for getSource()

This commit is contained in:
Michael Gapczynski 2011-06-24 19:38:39 -04:00
parent e91f42d249
commit c8781b1caf
1 changed files with 9 additions and 5 deletions

View File

@ -85,12 +85,16 @@ class OC_SHARE {
$parts = explode("/", $target);
$query = OC_DB::prepare("SELECT source FROM *PREFIX*sharing WHERE target = ? AND uid_shared_with = ?");
$result = $query->execute(array($parts[0], $_SESSION['user_id']))->fetchAll();
$source = $result[0]['source'];
// Add the $parts back in
foreach (array_slice($parts, 1) as $part) {
$source .= $part;
if (count($result) > 0) {
$source = $result[0]['source'];
// Add the $parts back in
foreach (array_slice($parts, 1) as $part) {
$source .= $part;
}
return $source;
} else {
return false;
}
return $source;
}
/**