<?php 
session_start();
/*
 * BibRefs/updateBibref.php
 * 
 * Copyright 2009, 2018 Pedro Quaresma <pedro@mat.uc.pt>
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

require_once("../servidor.php");

$pUtilizador = $_SESSION['utilizador'];
$pSenha = $_SESSION['senha'];
$pTipoUtilizador = $_SESSION['tipoUtilizador'];
if ($pTipoUtilizador=="anonymous" || $pTipoUtilizador=="regular") {// separa por tipo de utilizador
  require($entradaFILE.'headerUsers.php');
  require($entradaFILE.'menuUsers.php');
  echo "<meta http-equiv='refresh' content='0; url=".$entradaURL."users.php' />";
  exit;  // os anonimos não têem acesso a esta página
}
else {
  require($entradaFILE.'headerAdmins.php');
  require($entradaFILE.'menuAdmins.php');
}
?>


<hr/>



<?php
require($entradaFILE.'dbLogin.php');
?>


<center>
<h3 class="maketitle">Geometric Drawer Bib. Ref.</h3>
</center>

<hr/>

<?php
$argumento = $_GET['argumento'];

// cria uma pesquisa
$sql = "SELECT bibrefId,bibtexEntry
          FROM bibrefs
         WHERE bibrefId='$argumento'";

$resultado = mysqli_query($ligacao,$sql);


$linha = mysqli_fetch_assoc($resultado);

$pBibRefId = $linha['bibrefId'];
$pBibtexEntry  = $linha['bibtexEntry'];



echo "<form enctype='multipart/form-data' action='uUpdateBibref.php' method='post'>";
echo "<!-- ficha -->";
echo "<table width='100%' bgcolor='white' cellpadding='4' cellspacing='4'>";
echo "<tr>";
echo "<td width='100%' colspan='4' align='center'>Geometric Drawer Info</td>";
// O valor de BibRefId tem de ser passado para o processador do
// formulário, embora como hidden.
echo "<input type='hidden' name='BibRefId' value='$pBibRefId'>";
echo "</tr>";
echo "<tr>";
echo "<td width='25%'><span class='ficha'>Key</span></td>";
echo "<td width='25%'>$pBibRefId</td>";
echo "<td width='50%' colspan='2'>&nbsp;</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='left' width='25%'><span class='ficha'>BiBTeX Entry</span></td>";
echo "<td width='75%' colspan='3'><TEXTAREA NAME='BibtexEntry' ROWS='10' COLS='120'>$pBibtexEntry</TEXTAREA></td>";
echo "</tr>";
echo "<tr>";
echo "<td width='100%' colspan='8' align='center'><input type='submit' value='&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;update info &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'></td>";
echo "</tr>  ";
echo "</table>";
echo "</form>";
?>

<hr/>

<?php
require($entradaFILE.'footer.php');
?>