Update of /cvsroot/refdb/refdb/phpweb
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28942
Added Files:
Tag: Release_0_9_5_stable
refdbadd.php.in
Log Message:
replaces refdbadd.php
--- NEW FILE ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>RefDB add form</title>
<link href="refdbq.css" type="text/css" rel="stylesheet">
</head>
<body>
<table width="100%" cellspacing="0" border>
<tbody valign="top">
<tr>
<td class="navbar" width="25%"><h1>RefDB</h1></td>
<td class="main"><h1>Add Reference Form</h1></td>
</tr>
<tr>
<td class="navbar"> </td>
<td class="main"> </td>
</tr>
<tr>
<td class="navbar">
<p><a href="refdbquery.html">Search references</p>
<p><a href="refdbkajquery.html">Search keywords, authors, journals</a></p>
<p>Add new references</p>
<p><a href="refdbdbquery.php">Change database</a></p>
<p><a href="refdblogout.php">Logout</a></p>
</td>
<td class="main">
<?
if( $submit == "Add" )
{
//if nothing was entered into the add reference text box
if( empty($addref) )
{
print "Error: No Reference data was entered.";
}
//Data was entered
else
{
//This set of elseifs was written based on the simple check
//in the original access.js file included in the old RefDB
//interface. It checks to make sure necessary text for the
//particular reference type is there
$correct = false;
if( $addformat == "ris" ) //RIS format
{
if( ereg("TY - ",$addref) )
$correct = true;
else
print "This does not look like RIS data.<br>\n";
}
else if( $addformat == "bib2ris" ) //BibTeX format
{
if( ereg("@", $addref) )
$correct = true;
else
print "This does not look like BibTeX data.<br>\n";
}
else if( $addformat == "med2ris.pl" ) //PubMed
{
if( ereg("PMID", $addref) )
$correct = true;
else
print "This does not look like PubMed data.<br>\n";
}
//If the reference passes the checks
if( $correct )
{
//create a temporary file with the reference(s) in it
$addref = ereg_replace("\r\n","\n",$addref);
$handle = fopen("tempref","wb");
fwrite($handle, $addref);
fclose($handle);
$name = $_SESSION["name"];
$passwd = $_SESSION["passwd"];
$database = $_SESSION["database"];
$refdbc = $_SESSION["refdbc"];
//refdbc command to add a reference
$cmd = "$refdbc -c stdout -u $name -w $passwd -C addref -d $database < tempref";
exec($cmd, $lines);
unlink("tempref"); //delete the temp file
//print the output
foreach($lines as $line)
{
print $line."<br>\n";
}
}
print "<br><a href='refdbadd.html'>Add another Reference</a>\n";
}
}
elseif( $submit == "Add File" )
{
if ($referencefile == "none")
{
echo "Problem: no File Selected";
exit;
}
if ($referencefile_size==0)
{
echo "Problem: File is of size zero";
exit;
}
if (!is_uploaded_file($referencefile))
{
echo "File not uploaded successfully";
exit;
}
if( !move_uploaded_file($referencefile, $referencefile_name) )
{
echo "Problem: Could not upload file onto Server";
exit;
}
$refdbc = $_SESSION["refdbc"];
$cmd = "$refdbc -u $name -w $passwd -d $database -c stdout -C addref $referencefile_name";
exec($cmd, $lines);
foreach($lines as $line)
{
print "$line<br>";
}
if( isset($deletefile) )
{
unlink($referencefile_name);
}
}
?>
</td>
</tr>
<tr>
<td class="navbar"><p><a href="refdbadmin.php">Admin Interface</a></p></td>
<td class="footer"><p><a href="http://refdb.sourceforge.net">RefDB</a> reference manager and bibliography tool V. <!--VERSION-->Version<!--/VERSION--></p></td>
</tr>
</tbody>
</table>
</body>
</html>
|