Esempio n. 1
0
/*********** INITIALIZE ENVIRONMENT ***********/
// initialize environment
// - context id
// - module
// - function
// and context object
$cid_not_set = false;
if (isset($_GET['cid'])) {
    $current_context = $_GET['cid'];
} elseif (isset($_POST['cid'])) {
    $current_context = $_POST['cid'];
} else {
    $current_context = 99;
    $cid_not_set = true;
}
if (!isURLValid()) {
    $current_module = 'home';
    $current_function = 'index';
} else {
    if (!isset($_GET['mod']) or !isset($_GET['fct'])) {
        $current_module = 'home';
        $current_function = 'index';
    } else {
        if (isset($_GET['mod'])) {
            $current_module = $_GET['mod'];
        }
        if (isset($_GET['fct'])) {
            $current_function = $_GET['fct'];
        }
    }
}
    </head>
    <body>
        <?php 
include_once './functions/dbconnect.php';
include_once './functions/functions.php';
// includes the form to sesarch URL's
// include_once './includes/add.php';
include_once './functions/Add-Functions.php';
if (isPostRequest()) {
    $url = filter_input(INPUT_POST, 'link');
    $errors = array();
    if (!isURLValid($url)) {
        $errors[] = 'Not a Valid URL';
    }
    if (count($errors) == 0) {
        if (isURLValid($url)) {
            $results = 'URL Valid';
        } else {
            $results = 'URL Not Valid';
        }
    }
    // this creates the HTML Curl for the provided URL
    // include './includes/curl.php';
}
?>
        
      
        
        <?php 
include './includes/error.html.php';
?>
Esempio n. 3
0
function getVIVOPersonData($search)
{
    include_once "arc2/ARC2.php";
    $identifier = getURI($search);
    $personURI = $search;
    //What's the VIVO URI for this person?
    $site = getSite($search);
    $personRDF = "http://" . $site . "/individual/" . $identifier . "/" . $identifier . ".rdf";
    //Where is the raw RDF?
    $personSubject = "http://" . $site . "/individual/" . $identifier;
    $parser = ARC2::getRDFParser();
    $parser->parse($personRDF);
    $index = $parser->getSimpleIndex();
    //Get the person's name, this should be checking for foaf:firstName, but it doesn't exist anywhere I've seen.
    //First, let's try for an active directory name. This only exists on the UF VIVO ontology extension
    $personName = $index[$personSubject]["http://vivo.ufl.edu/ontology/vivo-ufl/activeDirName"][0];
    //If we don't find it..
    if (strlen($personName) < 1) {
        //Fallback to rdfs:label
        $personName = $index[$personSubject]["http://www.w3.org/2000/01/rdf-schema#label"][0];
    }
    //End getting person's name
    //Get person's title
    //Try the default location
    $position = $index[$personSubject]["http://vivoweb.org/ontology/core#preferredTitle"][0];
    //	echo "Preferred Title of: ".$position."<br>";
    //We're going to set the initial position URL here so we can use it later
    $positionURL = $index[$personSubject]["http://vivoweb.org/ontology/core#personInPosition"][0];
    $positionIdentifier = getURI($positionURL);
    $positionRDF = "http://" . $site . "/individual/" . $positionIdentifier . "/" . $positionIdentifier . ".rdf";
    $positionSubject = "http://" . $site . "/individual/" . $positionIdentifier;
    //If we don't find it there, try in the position
    //First, we need to find out which is their current position
    //To do that, we need to loop through all of their positions
    $round = 0;
    $startYear = 0;
    if (strlen($index[$personSubject]["http://vivoweb.org/ontology/core#personInPosition"]) > 0) {
        foreach ($index[$personSubject]["http://vivoweb.org/ontology/core#personInPosition"] as $value) {
            $positionURL = $index[$personSubject]["http://vivoweb.org/ontology/core#personInPosition"][$round];
            //		echo "Current highest year is ".$startYear." For position ".$positionURL."<br>";
            $positionIdentifier = getURI($positionURL);
            $positionRDF = "http://" . $site . "/individual/" . $positionIdentifier . "/" . $positionIdentifier . ".rdf";
            $positionSubject = "http://" . $site . "/individual/" . $positionIdentifier;
            $startParser = ARC2::getRDFParser();
            $startParser->parse($positionRDF);
            $startIndex = $startParser->getSimpleIndex();
            //		print_r($startIndex);
            $newYear = $startIndex[$positionSubject]["http://vivoweb.org/ontology/core#startYear"][0];
            //		echo "Start year for that position is:".$newYear."<br>";
            if ($newYear > $startYear) {
                $startYear = $newYear;
                $positionURLFinal = $positionURL;
            }
            //		echo "Current final URL is ".$positionURLFinal."<br>";
            $round = $round + 1;
        }
    }
    //	echo "Newest position is: ".$positionURLFinal.". With a start year of ".$startYear;
    //Then let the next bit of code run
    if (strlen($position) < 1) {
        //		echo "Trying to pull position data from ".$positionURLFinal."<br>";
        //		$positionURL = $index[$personSubject]["http://vivoweb.org/ontology/core#personInPosition"][0];
        if (isURLValid($positionURLFinal)) {
            //			echo "URL was Valid<br>";
            $positionParser = ARC2::getRDFParser();
            $positionIdentifier = getURI($positionURLFinal);
            $positionRDF = "http://" . $site . "/individual/" . $positionIdentifier . "/" . $positionIdentifier . ".rdf";
            $positionSubject = "http://" . $site . "/individual/" . $positionIdentifier;
            $positionParser->parse($positionRDF);
            $positionIndex = $positionParser->getSimpleIndex();
            //Let's check for an HR job title first
            $position = $positionIndex[$positionSubject]["http://vivoweb.org/ontology/core#hrJobTitle"][0];
            //If we don't find one
            if (strlen($position) < 1) {
                //Fallback to the label
                $position = $positionIndex[$positionSubject]["http://www.w3.org/2000/01/rdf-schema#label"][0];
            }
        } else {
            //If the first position link is bad, try the second one.
            $positionURL = $index[$personSubject]["http://vivoweb.org/ontology/core#personInPosition"][1];
            $positionIdentifier = getURI($positionURL);
            $positionRDF = "http://" . $site . "/individual/" . $positionIdentifier . "/" . $positionIdentifier . ".rdf";
            $positionSubject = "http://" . $site . "/individual/" . $positionIdentifier;
            $positionParser = ARC2::getRDFParser();
            $positionParser->parse($positionRDF);
            $positionIndex = $positionParser->getSimpleIndex();
            //Let's check for an HR job title first
            $position = $positionIndex[$positionSubject]["http://vivoweb.org/ontology/core#hrJobTitle"][0];
            //If we don't find one
            if (strlen($position) < 1) {
                //Fallback to the label
                $position = $positionIndex[$positionSubject]["http://www.w3.org/2000/01/rdf-schema#label"][0];
            }
        }
    }
    //End getting title
    //Begin getting Email
    $personEmail = $index[$personSubject]["http://vivoweb.org/ontology/core#workEmail"][0];
    //End getting email
    //Begin getting phone
    $personPhone = $index[$personSubject]["http://vivoweb.org/ontology/core#workPhone"][0];
    //End Getting phone
    //Begin getting Fax
    $personFax = $index[$personSubject]["http://vivoweb.org/ontology/core#workFax"][0];
    //End Getting Fax
    //Begin getting department
    $positionParser = ARC2::getRDFParser();
    $positionIdentifier = getURI($positionURLFinal);
    $positionRDF = "http://" . $site . "/individual/" . $positionIdentifier . "/" . $positionIdentifier . ".rdf";
    $positionParser->parse($positionRDF);
    $positionIndex = $positionParser->getSimpleIndex();
    $positionSubject = "http://" . $site . "/individual/" . $positionIdentifier;
    $departmentURL = $positionIndex[$positionSubject]["http://vivoweb.org/ontology/core#positionInOrganization"][0];
    $departmentIdentifier = getURI($departmentURL);
    $departmentRDF = "http://" . $site . "/individual/" . $departmentIdentifier . "/" . $departmentIdentifier . ".rdf";
    $departmentSubject = "http://" . $site . "/individual/" . $departmentIdentifier;
    $departmentParser = ARC2::getRDFParser();
    $departmentParser->parse($departmentRDF);
    $departmentIndex = $departmentParser->getSimpleIndex();
    $department = $departmentIndex[$departmentSubject]["http://www.w3.org/2000/01/rdf-schema#label"][0];
    //End getting department
    //Begin getting image
    //End getting image
    $imageURL = $index[$personSubject]["http://vitro.mannlib.cornell.edu/ns/vitro/public#mainImage"][0];
    $imageIdentifier = getURI($imageURL);
    $imageRDF = "http://" . $site . "/individual/" . $imageIdentifier . "/" . $imageIdentifier . ".rdf";
    $imageSubject = "http://" . $site . "/individual/" . $imageIdentifier;
    $imageParser = ARC2::getRDFParser();
    $imageParser->parse($imageRDF);
    $imageIndex = $imageParser->getSimpleIndex();
    $filename = $imageIndex[$imageSubject]["http://vitro.mannlib.cornell.edu/ns/vitro/public#filename"][0];
    $downloadLocation = $imageIndex[$imageSubject]["http://vitro.mannlib.cornell.edu/ns/vitro/public#downloadLocation"][0];
    $fullsizeURI = getURI($downloadLocation);
    $fullsizeURL = "http://" . $site . "/file/" . $fullsizeURI . "/" . $filename;
    //End getting image
    $vivoName = strip_tags($personName);
    $vivoTitle = strip_tags($position);
    $vivoEmail = strip_tags($personEmail);
    $vivoLink = strip_tags($personURI);
    $vivoPhone = strip_tags($personPhone);
    $vivoFax = strip_tags($personFax);
    $vivoDepartment = strip_tags($department);
    $vivoImage = strip_tags($fullsizeURL);
    //Now let's output the data.
    echo "<div id=\"vivoPerson\">\n";
    if (strlen($imageURL) > 0) {
        echoImageDiv("vivoImage", $vivoImage, $vivoName);
    } else {
        echoImageDiv("vivoImage", "noimage.jpg", $vivoName);
    }
    echoDiv("vivoName", $vivoName);
    //Done
    echoDiv("vivoTitle", $vivoTitle);
    //Done
    echoDiv("vivoDepartment", $vivoDepartment);
    echoDiv("vivoPhone", $vivoPhone);
    //Done
    echoDiv("vivoFax", $vivoFax);
    //Done
    echoEmailDiv("vivoEmail", $vivoEmail);
    //Done
    echoLinkDiv("vivoLink", $vivoLink);
    //Done
    echo "</div>";
    //TODO: Write a method to clear up some of that repetitive code
}