Exemple #1
0
 function query($query, $ask = false)
 {
     global $arc_config;
     if (!$arc_config) {
         include_once dirname(__FILE__) . '/../arc/ARC2.php';
         include_once dirname(__FILE__) . '/../../config/config.php';
     }
     $store = ARC2::getStore(SMOBTools::arc_config());
     if (!$store->isSetUp()) {
         $store->setUp();
     }
     $query = "\n\tPREFIX sioc: <http://rdfs.org/sioc/ns#>\n\tPREFIX sioct: <http://rdfs.org/sioc/types#>\n\tPREFIX foaf: <http://xmlns.com/foaf/0.1/>\n\tPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n\tPREFIX dct: <http://purl.org/dc/terms/>\n\tPREFIX tags: <http://www.holygoat.co.uk/owl/redwood/0.1/tags/>\n\tPREFIX moat: <http://moat-project.org/ns#>\n\tPREFIX opo: <http://online-presence.net/opo/ns#>\n\tPREFIX opo-actions: <http://online-presence.net/opo-actions/ns#>\n\tPREFIX ctag: <http://commontag.org/ns#>\n\tPREFIX smob: <http://smob.me/ns#>\n\tPREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n\tPREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\tPREFIX rev: <http://purl.org/stuff/rev#>\n\tPREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\n\tPREFIX rel: <http://purl.org/vocab/relationship/>\n\n\t\t{$query}";
     $rs = $store->query($query);
     if ($errors = $store->getErrors()) {
         error_log("SMOB SPARQL Error:\n" . join("\n", $errors));
         return array();
     }
     if ($ask) {
         return $rs['result'];
     } else {
         return $rs['result']['rows'];
     }
 }
Exemple #2
0
         error_log("DEBUG: initial RSS file does not exists", 0);
         SMOBTools::initial_rss_file();
     }
     $rssfile = fopen(FEED_FILE_PATH, 'r');
     $rss = fread($rssfile, filesize(FEED_FILE_PATH));
     fclose($rssfile);
     echo $rss;
 } elseif ($t == 'rssrdf_owner') {
     header("Content-type: text/xml");
     $tweet = new SMOBFeed();
     $tweet->rssrdf();
 } elseif ($t == 'sparql') {
     if ($_POST) {
         SMOBTools::checkAccess($_POST);
     }
     $ep = ARC2::getStoreEndpoint(SMOBTools::arc_config());
     $ep->go();
     // callback script to process the incoming hub POSTs
 } elseif ($t == 'callback') {
     if (array_key_exists('REMOTE_HOST', $_SERVER)) {
         //&& ($_SERVER['REMOTE_HOST'] == HUB_URL_SUBSCRIBE)) {
         error_log("DEBUG: request from host: " . $_SERVER['REMOTE_HOST']);
     }
     if (array_key_exists('HTTP_USER_AGENT', $_SERVER)) {
         error_log("DEBUG: request from user_agent: " . $_SERVER['REMOTE_HOST']);
     }
     // Getting hub_challenge from hub after sending it post subscription
     if (isset($_GET["hub_challenge"])) {
         // send confirmation to the hub
         echo $_GET["hub_challenge"];
         error_log("DEBUG: received and sent back hub challenge:" . $_GET["hub_challenge"], 0);