Exemplo n.º 1
0
     die;
 }
 $u = str_replace('http:/', 'http://', $u);
 // Remove a follower
 if ($t == 'follower') {
     // @TODO: has it sense that the user remove a follower?. Then the follower should also be notified to remove the current user as following
     // Instead, when the request comes from another user removing a following, the action will not be run as there is not authentication
     $remote_user = $u;
     $local_user = SMOBTools::user_uri();
     $follow = "<{$remote_user}> sioc:follows <{$local_user}> . ";
     $local = "DELETE FROM <" . SMOB_ROOT . "data/followers> { {$follow} }";
     SMOBStore::query($local);
     error_log("DEBUG: Removed follower {$remote_user} with the query: {$local}", 0);
 } elseif ($t == 'following') {
     $remote_user = $u;
     $local_user = SMOBTools::user_uri();
     $follow = "<{$local_user}> sioc:follows <{$remote_user}> . ";
     $local = "DELETE FROM <" . SMOB_ROOT . "data/followings> { {$follow} }";
     SMOBStore::query($local);
     error_log("DEBUG: Removed following {$remote_user} with the query: {$local}", 0);
     // And ping to update the followers list remotely
     //$ping = str_replace("me","remove", $u)."/follower/$local_user";
     $ping = SMOBTools::host($u) . "/remove/follower/{$local_user}";
     error_log("DEBUG: Sent {$ping}", 0);
     $result = SMOBTools::do_curl($ping);
     error_log("DEBUG: Server answer: " . join(' ', $result), 0);
     // Unsubscribe to the Hub
     //@TODO: following Hub should be stored?,
     $remote_user_feed = $remote_user . FEED_URL_PATH;
     $xml = simplexml_load_file($remote_user_feed);
     if (count($xml) == 0) {
Exemplo n.º 2
0
 function followings()
 {
     $pattern = '<' . SMOBTools::user_uri() . '> sioc:follows ?uri';
     return SMOBTools::people('followings', $pattern);
 }
Exemplo n.º 3
0
 public function set_data($ts, $content, $reply_of, $location, $location_uri, $mappings)
 {
     $user_uri = SMOBTools::user_uri();
     $this->ts = $ts;
     $this->content = $content;
     $this->uri($ts);
     $triples[] = array(SMOBTools::uri($this->uri), "a", "sioct:MicroblogPost");
     $triples[] = array("sioc:has_container", SMOBTools::uri(SMOB_ROOT));
     $triples[] = array("sioc:has_creator", SMOBTools::uri($user_uri));
     $triples[] = array("foaf:maker", SMOBTools::uri(FOAF_URI));
     $triples[] = array("dct:created", SMOBTools::date($this->ts));
     $triples[] = array("dct:title", SMOBTools::literal("Update - " . $this->ts));
     $triples[] = array("sioc:content", SMOBTools::literal($content));
     if ($reply_of) {
         $triples[] = array("sioc:reply_of", SMOBTools::uri($reply_of));
     }
     $triples[] = array(SMOBTools::uri(SMOB_ROOT), "a", "smob:Hub");
     $opo_uri = $this->uri . '#presence';
     $triples[] = array(SMOBTools::uri($opo_uri), "a", "opo:OnlinePresence");
     $triples[] = array("opo:declaredOn", SMOBTools::uri($user_uri));
     $triples[] = array("opo:declaredBy", SMOBTools::uri(FOAF_URI));
     $triples[] = array("opo:StartTime", SMOBTools::date($this->ts));
     $triples[] = array("opo:customMessage", SMOBTools::uri($this->uri));
     if ($location_uri) {
         $triples[] = array("opo:currentLocation", SMOBTools::uri($location_uri));
         $triples[] = array(SMOBTools::uri($location_uri), "rdfs:label", SMOBTools::literal($location));
         SMOBStore::query("LOAD <{$location_uri}>");
     }
     if ($mappings) {
         $mp = explode(' ', $mappings);
         foreach ($mp as $m) {
             $mapping = explode('--', $m);
             if ($mapping[0] == 'user') {
                 $user = $mapping[1];
                 $uri = $mapping[2];
                 $triples[] = array(SMOBTools::uri($this->uri), "sioc:addressed_to", SMOBTools::uri($uri));
                 $triples[] = array(SMOBTools::uri($uri), "sioc:name", SMOBTools::literal($user));
             } elseif ($mapping[0] == 'tag' || $mapping[0] == 'location') {
                 $tag = $mapping[1];
                 $uri = $mapping[2];
                 $tagging = SMOB_ROOT . 'tagging/' . uniqid();
                 $triples[] = array(SMOBTools::uri($tagging), "a", "tags:RestrictedTagging");
                 $triples[] = array(SMOBTools::uri($tagging), "tags:taggedResource", SMOBTools::uri($this->uri));
                 $triples[] = array(SMOBTools::uri($tagging), "tags:associatedTag", SMOBTools::literal($tag));
                 $triples[] = array(SMOBTools::uri($tagging), "moat:tagMeaning", SMOBTools::uri($uri));
                 $triples[] = array(SMOBTools::uri($this->uri), "moat:taggedWith", SMOBTools::uri($uri));
             }
         }
     }
     $this->triples = $this->triples + $triples;
 }