/** * Shows a page with nice information on the record * */ function show_g($db, $tableinfo, $id, $USER, $system_settings, $backbutton = true, $previousid = false, $nextid = false, $viewid = false) { if (!may_read($db, $tableinfo, $id, $USER)) { return false; } $Allfields = getvalues($db, $tableinfo, $tableinfo->fields, id, $id); display_record($db, $Allfields, $id, $tableinfo, $backbutton, $previousid, $nextid, $viewid); }
exit; } $r = $db->query("SELECT filename,tablesfk,ftableid,mime,size FROM files\n WHERE id={$id}"); if (!$r || $r->EOF) { echo "<html><h3>404. File not found.</h3></html>"; exit; } $tableid = $r->fields('tablesfk'); $tableitemid = $r->fields('ftableid'); $mime = $r->fields('mime'); // we keep a list with fileids that can be seen in the USER settings if (!@in_array($id, $USER['settings']['fileids'])) { $tablename = get_cell($db, 'tableoftables', 'tablename', 'id', $tableid); $_GET['tablename'] = $tablename; $tableinfo = new tableinfo($db); if (!may_read($db, $tableinfo, $tableitemid, $USER)) { echo "<html><h3>401. Forbidden.</h3></html>"; } } if ($type == 'small' || $type == 'big') { // this is an image if ($type == 'small') { $thumb = $system_settings['thumbnaildir'] . "/small/{$id}.jpg"; } if ($type == "big") { $thumb = $system_settings['thumbnaildir'] . "/big/{$id}.jpg"; } if (@is_readable($thumb)) { header('Accept-Ranges: bytes'); header('Connection: close'); header('Content-Type: image/jpeg');
function plugin_show($db, $tableinfo, $id, $USER, $system_settings, $backbutton = true) { global $PHP_SELF; $journaltable = get_cell($db, $tableinfo->desname, "associated_table", "columnname", "journal"); $categorytable = get_cell($db, $tableinfo->desname, "associated_table", "columnname", "category"); if (!may_read($db, $tableinfo, $id, $USER)) { return false; } // get values $r = $db->Execute("SELECT {$tableinfo->fields} FROM {$tableinfo->realname} WHERE id={$id}"); if ($r->EOF) { echo "<h3>Could not find this record in the database</h3>"; return false; } $column = strtok($tableinfo->fields, ","); while ($column) { ${$column} = $r->fields[$column]; $column = strtok(","); } echo " <br>\n"; echo "<table border=0 align='center'>\n"; echo "<tr>\n"; echo "<th>Article: </th>\n"; echo "<td>{$title}<br>\n{$author}<br>\n"; $text = get_cell($db, $journaltable, "type", "id", $journal); echo "{$text} ({$pubyear}), <b>{$volume}</b>:{$fpage}-{$lpage}\n"; echo "</td></tr>\n"; if ($abstract) { echo "<tr>\n<th>Abstract</th>\n"; echo "<td>{$abstract}</td>\n</tr>\n"; } // Category if ($category) { $type2 = get_cell($db, $categorytable, "type", "id", $category); echo "<tr>\n<th>Category</th>\n"; echo "<td>{$type2}</td>\n</tr>\n"; } echo "<tr>"; $query = "SELECT firstname,lastname,email FROM users WHERE id={$ownerid}"; $r = $db->Execute($query); if ($r->fields["email"]) { echo "<th>Submitted by: </th><td><a href='mailto:" . $r->fields["email"] . "'>"; echo $r->fields["firstname"] . " " . $r->fields["lastname"] . "</a> "; } else { echo "<th>Submitted by: </th><td>" . $r->fields["firstname"] . " "; echo $r->fields["lastname"] . " "; } $dateformat = get_cell($db, "dateformats", "dateformat", "id", $system_settings["dateformat"]); $date = date($dateformat, $date); echo "({$date})</td>\n"; echo "</tr>\n"; if ($lastmodby && $lastmoddate) { echo "<tr>"; $query = "SELECT firstname,lastname,email FROM users WHERE id={$lastmodby}"; $r = $db->Execute($query); if ($r->fields["email"]) { echo "<th>Last modified by: </th><td><a href='mailto:" . $r->fields["email"] . "'>"; echo $r->fields["firstname"] . " " . $r->fields["lastname"] . "</a>"; } else { echo "<th>Last modified by: </th><td>" . $r->fields["firstname"] . " "; echo $r->fields["lastname"]; } $dateformat = get_cell($db, "dateformats", "dateformat", "id", $system_settings["dateformat"]); $lastmoddate = date($dateformat, $lastmoddate); echo " ({$lastmoddate})</td>\n"; echo "</tr>\n"; } echo "<tr>"; $notes = nl2br(htmlentities($notes)); echo "<th>Notes: </th><td>{$notes}</td>\n"; echo "</tr>\n"; $columnid = get_cell($db, $tableinfo->desname, "id", "columnname", "file"); $files = get_files($db, $tableinfo->name, $id, $columnid, 1); if ($files) { echo "<tr><th>Files:</th>\n<td>"; for ($i = 0; $i < sizeof($files); $i++) { echo $files[$i]["link"] . " (" . $files[$i]["type"] . " file, " . $files[$i]["size"] . ")<br>\n"; } echo "</tr>\n"; } echo "<tr><th>Links:</th><td colspan=7><a href='{$PHP_SELF}?tablename=" . $tableinfo->name . "&showid={$id}&"; echo SID; echo "'>" . $system_settings["baseURL"] . getenv("SCRIPT_NAME") . "?tablename=" . $tableinfo->name . "&showid={$id}</a> (This page)<br>\n"; echo "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?"; if ($system_settings["pdfget"]) { $addget = "&" . $system_settings["pdfget"]; } echo "cmd=Retrieve&db=PubMed&list_uids={$pmid}&dopt=Abstract{$addget}'>This article at Pubmed</a><br>\n"; echo "<a href='http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?"; echo "cmd=Link&db=PubMed&dbFrom=PubMed&from_uid={$pmid}{$addget}'>Related articles at Pubmed</a><br>\n"; if ($supmat) { echo "<a href='{$supmat}'>Supplemental material</a><br>\n"; } echo "</td></tr>\n"; show_reports($db, $tableinfo, $id); ?> <form method='post' id='pdfview' action='<?php echo "{$PHP_SELF}?tablename=" . $tableinfo->name; ?> &<?php echo SID; ?> '> <?php if ($backbutton) { echo "<tr>"; echo "<td colspan=7 align='center'><input type='submit' name='submit' value='Back'></td>\n"; echo "</tr>\n"; } else { echo "<tr><td colspan=8 align='center'> <br><button onclick='self.close();window.opener.focus();' name='Close' value='close'>Close</button></td></tr>\n"; } echo "</table></form>\n"; }