Skip to content

Commit

Permalink
Sanatize InChI input
Browse files Browse the repository at this point in the history
  • Loading branch information
Egon Willighagen authored and egonw committed Nov 14, 2010
1 parent be6430a commit e72a363
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.php
Expand Up @@ -11,6 +11,11 @@
if (strlen($inchi) === 0) {
$inchi = "InChI=1/CH4/h1H4";
}
if (strlen($inchi) < 8 ||
(substr($inchi, 0,8) != "InChI=1/" &&
substr($inchi, 0,9) != "InChI=1S/")) {
$inchi = "InChI=1/CH4/h1H4";
}
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
Expand All @@ -29,7 +34,7 @@

<?php include 'rdf_module_cb.php'?>
<?php include 'rdf_module_chebi.php'?>
<?php include 'rdf_module_connotea.php'?>
<?php // include 'rdf_module_connotea.php'?>
<?php include 'rdf_module_dbpedia.php'?>
<?php include 'rdf_module_nmrshiftdb.php'?>
<?php //include 'rdf_module_chemspider.php'?>
Expand Down
5 changes: 5 additions & 0 deletions rdf_module_chebi.php
Expand Up @@ -13,6 +13,11 @@
if (strlen($inchi) === 0) {
$inchi = "InChI=1/CH4/h1H4";
}
if (strlen($inchi) < 8 ||
(substr($inchi, 0,8) != "InChI=1/" &&
substr($inchi, 0,9) != "InChI=1S/")) {
$inchi = "InChI=1/CH4/h1H4";
}
?>

<rdf:Description
Expand Down
5 changes: 5 additions & 0 deletions rdf_module_dbpedia.php
Expand Up @@ -13,6 +13,11 @@
if (strlen($inchi) === 0) {
$inchi = "InChI=1/CH4/h1H4";
}
if (strlen($inchi) < 8 ||
(substr($inchi, 0,8) != "InChI=1/" &&
substr($inchi, 0,9) != "InChI=1S/")) {
$inchi = "InChI=1/CH4/h1H4";
}
?>

<rdf:Description
Expand Down
5 changes: 5 additions & 0 deletions rdf_module_nmrshiftdb.php
Expand Up @@ -13,6 +13,11 @@
if (strlen($inchi) === 0) {
$inchi = "InChI=1/CH4/h1H4";
}
if (strlen($inchi) < 8 ||
(substr($inchi, 0,8) != "InChI=1/" &&
substr($inchi, 0,9) != "InChI=1S/")) {
$inchi = "InChI=1/CH4/h1H4";
}
?>

<rdf:Description
Expand Down

0 comments on commit e72a363

Please sign in to comment.