case 'path': $path = $param[1]; $link = $ACTIONS['get']->getLink(array('id' => $id)); $args['fileinfo'][$key][1] = "<a href=\"{$link}\">{$path}</a>"; break; default: } } include "views/show.view.php"; } } else { if ($action == 'get') { $id = $params['id']; $name = File::GetAttrib($id, 'name'); $path = File::GetAttrib($id, 'path'); $ext = File::GetAttrib($id, 'type'); Error::generate('debug', "id={$id}, name={$name}, path={$path}, ext={$ext}"); if (!$path) { //Error::generate('notice', 'File not found.', Error::$FLAGS['single']); //header('Location: '.getLastVisited()); } else { $content_type = ""; $content_disposition = "inline"; switch (strtolower($ext)) { case 'jpg': $content_type = 'image/jpeg'; break; case 'png': case 'gif': case 'jpeg': $content_type = "image/{$ext}";
if (!($args['userinfo'] = User::GetAttribs($id))) { Error::generate('notice', 'Invalid user ID.'); User::leaveStatusMode(); if (isset($_SESSION) && $_SESSION['last_rendered_page']) { redirect_raw($_SESSION['last_rendered_page']); } else { redirect(); } } else { foreach ($args['userinfo'] as $key => $param) { switch (strtolower($param[0])) { case 'file': $id = $param[1]; $fname = File::GetAttrib($id, 'name'); $frole = File::GetAttrib($id, 'roles'); $fowner = File::GetAttrib($id, 'owner'); if (!User::HasPermissions($frole)) { // if you can see it, you're the owner $prefix = '(Pending approval) '; } else { $prefix = ''; } if (User::HasPermissions($frole) || User::GetAuthenticatedID() == $fowner) { $args['userinfo'][$key] = array($prefix . $param[0], "<a href=\"{$HTMLROOT}/file/show?id={$id}\">{$fname}</a>"); } else { unset($args['userinfo'][$key]); } break; default: } }