private function delete() { if (!SMOBAuth::check()) { die; } $post = new SMOBPost(SMOBTools::get_post_uri($this->uri, 'post')); $post->delete(); header("Location: " . SMOB_ROOT); }
error_log("DEBUG: received and sent back hub challenge:" . $_GET["hub_challenge"], 0); } elseif (isset($_POST)) { $post_data = file_get_contents("php://input"); error_log("DEBUG: received POST with content: {$post_data}", 0); SMOBTools::get_rdf_from_rss($post_data); } elseif (isset($_DELETE)) { $post_data = file_get_contents("php://input"); error_log("DEBUG: received DELETE with content: {$post_data}", 0); } elseif (isset($_PUT)) { $post_data = file_get_contents("php://input"); error_log("DEBUG: received PUT with content: {$post_data}", 0); } } elseif ($t == 'private') { // TODO: The private profile graph is the same as the profile graph, privacy preferences will decide what is visible // TODO: Authorize depending on the WebID URI if (!SMOBAuth::check()) { error_log("not authenticated"); //if($a && $a == 'edit'){ // header( 'Location: '.SMOB_ROOT.'auth?redirect=private/edit' ) ; //} else { // header( 'Location: '.SMOB_ROOT.'auth?redirect=private' ) ; //}; header('Location: ' . SMOB_ROOT . 'auth'); } else { error_log("authenticated"); if ($a && $a == 'edit') { echo PrivateProfile::view_private_profile_form(); } else { echo PrivateProfile::view_private_profile(); exit; }
public function render() { global $sioc_nick, $count; $uri = $this->uri; $content = $this->data['content']; $ocontent = strip_tags($content); $author = $this->data['author']; $creator = $this->data['creator']; $date = $this->data['date']; $name = $this->data['name']; $reply_of = $this->data['reply_of']; $reply_of_of = $this->data['reply_of_of']; $presence = $this->data['presence']; $location = $this->data['location']; $locname = $this->data['locname']; $star = $this->get_star(); $pic = SMOBTools::either($this->data['depiction'], SMOB_ROOT . 'img/avatar-blank.jpg'); $class = strpos($uri, SMOB_ROOT) !== FALSE ? "post internal" : "post external"; $ht .= "<div about=\"{$presence}\" rel=\"opo:customMessage\">\n"; $ht .= "<div class=\"{$class}\" typeof=\"sioct:MicroblogPost\" about=\"{$uri}\">\n"; $ht .= "<span style=\"display:none;\" rel=\"sioc:has_container\" href=\"" . SMOB_ROOT . "\"></span>\n"; $ht .= "<img about=\"{$author}\" rel=\"foaf:depiction\" href=\"{$pic}\" src=\"{$pic}\" class=\"depiction\" alt=\"Depiction for {$name}\"/>"; $ht .= " <span class=\"content\" property=\"content:encoded\">{$content}</span>\n"; $ht .= " <span style=\"display:none;\" property=\"sioc:content\">{$ocontent}</span>\n"; $ht .= ' <div class="infos">'; $ht .= " by <a class=\"author\" rel=\"foaf:maker\" href=\"{$author}\"><span property=\"foaf:name\">{$name}</span></a> - \n"; if ($location) { $ht .= " location: <span about=\"{$presence}\"><a rel=\"opo:currentLocation\" href=\"{$location}\"><span property=\"rdfs:label\">{$locname}</span></a></span><br/>\n"; } else { $ht .= " location: <span about=\"{$presence}\">unspecified</span><br/>\n"; } $ht .= " <div style=\"margin: 2px;\"></div> "; $ht .= " <div id=\"star{$count}\" class=\"rating\"> </div>"; $ht .= " <span style=\"display:none;\" rel=\"sioc:has_creator\" href=\"{$creator}\"></span>\n"; $ht .= " <a href=\"{$uri}\" class=\"date\" property=\"dcterms:created\">{$date}</a>\n"; if (strpos($uri, 'http://twitter.com/') !== FALSE) { $ex = explode('/', $uri); $data = SMOB_ROOT . 'data/twitter/' . $ex[5]; } else { $data = str_replace('post', 'data', $uri); } $ht .= " [<a href=\"{$data}\">RDF</a>]\n"; if (SMOBAuth::check()) { if (strpos($uri, SMOB_ROOT) !== FALSE) { $ex = explode('/', $uri); error_log("DEBUG: post delete path: " . join(' ', $ex), 0); error_log("DEBUG: post uri: " . $uri, 0); $action = SMOB_ROOT . 'delete/' . $ex[5]; // the previous line doesn't work as the post is in the position 4 $action = str_replace('post', 'delete', $uri); error_log("DEBUG: is going to be run the action: " . $action, 0); $ht .= " [<a href=\"{$action}\" onclick=\"javascript:return confirm('Are you sure ? This cannot be undone.')\">Delete post</a>]"; } $action = $this->get_publish_uri(); $ht .= " [<a href=\"{$action}\">Post a reply</a>]\n"; } if ($reply_of) { $action = SMOBTools::get_uri($reply_of, 'post'); $ht .= " [<a href=\"{$action}\">Replied message</a>]\n"; } if ($reply_of_of) { $action = SMOBTools::get_uri($reply_of_of, 'post'); $ht .= " [<a href=\"{$action}\">Replies</a>]\n"; } $ht .= ' </div>'; $ht .= '</div>'; $ht .= "</div>\n\n"; $ht .= "<script type=\"text/javascript\">\n\$(document).ready(function(){\n\t\$('#star{$count}').rating('ajax/star.php?u={$uri}', {maxvalue: 1, curvalue: {$star}});\n\t});\n</script>"; return $ht; }
public function users($type, $users) { $ht = '<h2>' . ucfirst($type) . '</h2>'; if ($users) { $ht .= '<ul>'; foreach ($users as $u) { $user = $u['uri']; $ht .= "<li><a href='{$user}'>{$user}</a>"; if (SMOBAuth::check()) { $t = substr($type, 0, -1); $remove = SMOB_ROOT . "remove/{$t}/{$user}"; $ht .= " [<a href=\"{$remove}\" onclick=\"javascript:return confirm('Are you sure ? This cannot be undone.')\">remove</a>]"; } $ht .= "</li>"; } $ht .= '</ul>'; } else { $ht .= 'No one at the moment'; } if ($type == 'followings' && SMOBAuth::check()) { $ht .= "<p>If you want to follow new people, use the <a href=\"javascript:window.location='" . SMOB_ROOT . "add/following/'+window.location\">Follow in my SMOB!</a> bookmarklet.</p>"; } return $ht; }