Exemplo n.º 1
0
function xmlset($setSpecs, $name, $desc)
{
    global $output;
    $output .= "   <set>\n";
    for ($i = 0; $i < count($setSpecs); ++$i) {
        $output .= xmlformat($setSpecs[$i], 'setSpec', '', 4);
    }
    $output .= xmlformat($name, 'setName', '', 4);
    if (isset($val['setDescription']) && $val['setDescription'] != '') {
        $output .= "    <setDescription>\n";
        $prefix = 'oai_dc';
        $output .= metadataHeader($prefix);
        $output .= xmlrecord($desc, 'dc:description', '', 7);
        $output .= '     </' . $prefix;
        if (isset($METADATAFORMATS[$prefix]['record_prefix'])) {
            $output .= ':' . $METADATAFORMATS[$prefix]['record_prefix'];
        }
        $output .= ">\n";
        $output .= "    </setDescription>\n";
    }
    $output .= "   </set>\n";
}
Exemplo n.º 2
0
    // the second condition is due to a bug in PEAR
    if ($countrec == 1 && $deliveredrecords) {
        $record = $res->fetchRow(DB_FETCHMODE_ASSOC, $deliveredrecords);
    } else {
        $record = $res->fetchRow();
    }
    $identifier = $oaiprefix . $record[$SQL['identifier']];
    $datestamp = formatDatestamp($record[$SQL['datestamp']]);
    if (isset($record[$SQL['deleted']]) && $record[$SQL['deleted']] == 'true' && ($deletedRecord == 'transient' || $deletedRecord == 'persistent')) {
        $status_deleted = TRUE;
    } else {
        $status_deleted = FALSE;
    }
    $output .= '  <header';
    if ($status_deleted) {
        $output .= ' status="deleted"';
    }
    $output .= '>' . "\n";
    // use xmlrecord since we use stuff from database
    $output .= xmlrecord($identifier, 'identifier', '', 3);
    $output .= xmlformat($datestamp, 'datestamp', '', 3);
    if (!$status_deleted) {
        $output .= xmlrecord($record[$SQL['set']], 'setSpec', '', 3);
    }
    $output .= '  </header>' . "\n";
}
// ResumptionToken
if (isset($restoken)) {
    $output .= $restoken;
}
$output .= " </ListIdentifiers>\n";
Exemplo n.º 3
0
    require_once BASE_PATH . '/core/controllers/components/UuidComponent.php';
    $uuiComponent = new UuidComponent();
    // remove the OAI part to get the identifier
    $uuid = str_replace($oaiprefix, '', $identifier);
    $element = $uuiComponent->getByUid($uuid);
    if ($element == false || !$element instanceof ItemDao) {
        $errors .= oai_error('idDoesNotExist', 'identifier', $identifier);
    } elseif (!$itemModel->policyCheck($element, null, MIDAS_POLICY_READ)) {
        $errors .= oai_error('idDoesNotExist', 'identifier', $identifier);
    }
}
//break and clean up on error
if ($errors != '') {
    oai_exit();
}
// currently it is assumed that an existing identifier
// can be served in all available metadataformats...
if (is_array($METADATAFORMATS)) {
    $output .= " <ListMetadataFormats>\n";
    foreach ($METADATAFORMATS as $key => $val) {
        $output .= "  <metadataFormat>\n";
        $output .= xmlformat($key, 'metadataPrefix', '', 3);
        $output .= xmlformat($val['schema'], 'schema', '', 3);
        $output .= xmlformat($val['metadataNamespace'], 'metadataNamespace', '', 3);
        $output .= "  </metadataFormat>\n";
    }
    $output .= " </ListMetadataFormats>\n";
} else {
    $errors .= oai_error('noMetadataFormats');
    oai_exit();
}
Exemplo n.º 4
0
            exit;
        }
    }
    if (isset($genre) && !empty($genre)) {
        $query = $query . " AND Genre Like '%{$genre}%'";
    }
}
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
print "<Data>\n";
while ($obj = mysql_fetch_object($result)) {
    print "<Game>\n";
    // Base Info
    $subquery = "SELECT games.id, games.GameTitle, games.ReleaseDate, platforms.name FROM games, platforms WHERE games.id={$obj->id} AND platforms.id = games.Platform";
    $baseResult = mysql_query($subquery) or die('Query failed: ' . mysql_error());
    $baseObj = mysql_fetch_object($baseResult);
    foreach ($baseObj as $key => $value) {
        ## Prepare the string for output
        if (!empty($value)) {
            $value = xmlformat($value, $key);
            if ($key == "name") {
                $key = "Platform";
            }
            print "<{$key}>{$value}</{$key}>\n";
        }
    }
    ## End XML item
    print "</Game>\n";
}
?>
</Data>
Exemplo n.º 5
0
$count = 20;
$DOCS = $POD->getContents($params);
$description = "{$scope} {$type} " . implode(" and ", $conditions) . " from " . $POD->siteName(false);
$year = date("Y");
$rss = new rss('utf-8');
$rss->channel(xmlformat($description), $POD->siteRoot(false), xmlformat($description));
$rss->language('en-us');
$rss->copyright('Copyright ' . $year . ' ' . $POD->siteName(false));
$rss->startRSS();
while ($doc = $DOCS->getNext()) {
    $rss->itemTitle(xmlformat($doc->get('headline')));
    if ($doc->get('link')) {
        $rss->itemLink($doc->get('link'));
    } else {
        $rss->itemLink($doc->get('permalink'));
    }
    $nTimestamp = strtotime($doc->get('date'));
    $sISO8601 = date('Y-m-d\\Th:i:s', $nTimestamp) . substr_replace(date('O', $nTimestamp), ':', 3, 0);
    $rss->itemPubDate($sISO8601);
    if ($doc->get('img')) {
        $rss->itemDescription(xmlformat('<img src="' . $doc->get('img') . '" /><br />' . $doc->get('body')));
    } else {
        $rss->itemDescription(xmlformat($doc->get('body')));
    }
    $rss->itemAuthor(xmlformat($doc->author('nick') . "<" . $doc->author('permalink') . ">"));
    $rss->itemGuid($doc->get('permalink'));
    $rss->itemSource($POD->siteName(false), $POD->siteRoot(false));
    $rss->addItem();
}
header("Content-type: text/xml");
echo $rss->RSSdone();
Exemplo n.º 6
0
// break and clean up on error
if ($errors != '') {
    oai_exit();
}
// see http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm
// for details
$indent = 2;
$output .= " <Identify>\n";
$output .= xmlformat($repositoryName, 'repositoryName', '', $indent);
$output .= xmlformat($baseURL, 'baseURL', '', $indent);
$output .= xmlformat($protocolVersion, 'protocolVersion', '', $indent);
$output .= xmlformat($adminEmail, 'adminEmail', '', $indent);
$output .= xmlformat($earliestDatestamp, 'earliestDatestamp', '', $indent);
$output .= xmlformat($deletedRecord, 'deletedRecord', '', $indent);
$output .= xmlformat($granularity, 'granularity', '', $indent);
$output .= xmlformat($compression, 'compression', '', $indent);
// A description MAY be included.
// Use this if you choose to comply with a specific format of unique identifiers
// for items.
// See http://www.openarchives.org/OAI/2.0/guidelines-oai-identifier.htm
// for details
if ($show_identifier && $repositoryIdentifier && $delimiter && $sampleIdentifier) {
    $output .= '  <description>
   <oai-identifier xmlns="http://www.openarchives.org/OAI/2.0/oai-identifier"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai-identifier
                   http://www.openarchives.org/OAI/2.0/oai-identifier.xsd">
    <scheme>oai</scheme>
    <repositoryIdentifier>' . $repositoryIdentifier . '</repositoryIdentifier>
    <delimiter>' . $delimiter . '</delimiter>
    <sampleIdentifier>' . $sampleIdentifier . '</sampleIdentifier>
Exemplo n.º 7
0
            break;
        default:
            $errors .= oai_error('badArgument', $key, $val);
    }
}
// break and clean up on error
if ($errors != '') {
    oai_exit();
}
$SETS = getOaiSetArray($db);
if (is_array($SETS)) {
    $output .= "  <ListSets>\n";
    foreach ($SETS as $key => $val) {
        $output .= "   <set>\n";
        $output .= xmlformat($val['setSpec'], 'setSpec', '', 4);
        $output .= xmlformat($val['setName'], 'setName', '', 4);
        if (isset($val['setDescription']) && $val['setDescription'] != '') {
            $output .= "    <setDescription>\n";
            $prefix = 'oai_dc';
            $output .= metadataHeader($prefix);
            $output .= xmlrecord($val['setDescription'], 'dc:description', '', 7);
            $output .= '     </' . $prefix;
            if (isset($METADATAFORMATS[$prefix]['record_prefix'])) {
                $output .= ':' . $METADATAFORMATS[$prefix]['record_prefix'];
            }
            $output .= ">\n";
            $output .= "    </setDescription>\n";
        }
        $output .= "   </set>\n";
    }
    $output .= "  </ListSets>\n";