コード例 #1
0
ファイル: rest.php プロジェクト: jneubert/Skosmos
 $request->setUri($request->getQueryParam('uri'));
 $request->setLang($request->getQueryParam('lang'));
 if ($request->getQueryParam('vocab')) {
     $request->setVocab($request->getQueryParam('vocab'));
 }
 if (sizeof($parts) < 2 || $parts[1] == "") {
     header("HTTP/1.0 404 Not Found");
     echo "404 Not Found";
 } elseif ($parts[1] == 'vocabularies') {
     $controller->vocabularies($request);
 } elseif ($parts[1] == 'search') {
     $controller->search($request);
 } elseif ($parts[1] == 'types') {
     $controller->types($request);
 } elseif ($parts[1] == 'data') {
     $controller->data($request);
 } elseif (sizeof($parts) == 2) {
     header("Location: " . $parts[1] . "/");
 } else {
     $vocab = $parts[1];
     try {
         $request->setVocab($parts[1]);
     } catch (Exception $e) {
         header("HTTP/1.0 404 Not Found");
         header("Content-type: text/plain; charset=utf-8");
         echo "404 Not Found : Vocabulary id '{$parts['1']}' not found.";
         return;
     }
     $lang = $request->getQueryParam('lang') ? $request->getQueryParam('lang') : $request->getVocab()->getConfig()->getDefaultLanguage();
     $request->setLang($lang);
     if ($parts[2] == '') {