X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/ebadc5e4019929d4e1686516160ee01a114d9b8a..434a81099f4456d0679755335e31aaf74ad29ecd:/WEB-INF/lib/ttFileHelper.class.php diff --git a/WEB-INF/lib/ttFileHelper.class.php b/WEB-INF/lib/ttFileHelper.class.php index f74e77a3..80c9fd31 100644 --- a/WEB-INF/lib/ttFileHelper.class.php +++ b/WEB-INF/lib/ttFileHelper.class.php @@ -237,4 +237,23 @@ class ttFileHelper { } return $result; } + + // get - obtains file details from local database. + static function get($id) { + global $user; + $mdb2 = getConnection(); + + $group_id = $user->getGroup(); + $org_id = $user->org_id; + + $sql = "select id, remote_id, file_key, entity_type, entity_id, file_name, description, status from tt_files". + " where id = $id and group_id = $group_id and org_id = $org_id and (status = 0 or status = 1)"; + $res = $mdb2->query($sql); + if (!is_a($res, 'PEAR_Error')) { + $val = $res->fetchRow(); + if ($val && $val['id']) + return $val; + } + return false; + } }