<?php if (!$this->network->id) { echo 'ERROR'; return; } if (!$this->user->is_logged) { echo 'ERROR'; return; } if (isset($_POST['postid'], $_POST['commentid']) && preg_match('/^(public|private)_([0-9]+)$/', $_POST['postid'], $m)) { $c = new postcomment(new post($m[1], $m[2]), $_POST['commentid']); if ($c->error) { echo 'ERROR'; return; } if (!$c->if_can_delete()) { echo 'ERROR'; return; } $c->delete_this_comment(); echo 'OK'; return; } echo 'ERROR'; return;
$D->he_follows_me = TRUE; $D->post_is_protected = FALSE; } if (!$D->post_is_mine && $D->post_is_protected && !$D->he_follows_me && !$D->i_am_network_admin) { $this->redirect('dashboard'); } if (isset($_POST['message'])) { $c = new newpostcomment($D->post); $c->set_api_id($C->API_ID); $c->set_message($_POST['message']); $c->save(); $this->redirect($D->post->permalink . '#comments_last'); } elseif ($this->param('delcomment')) { $tmp = new postcomment($D->post, $this->param('delcomment')); if ($tmp && !$tmp->error && $tmp->if_can_delete()) { $tmp->delete_this_comment(); } $D->post = new post($post_type, $post_id); } $D->page_title = ($D->post->post_user->id == 0 && $D->post->post_group ? $D->post->post_group->title : $D->post->post_user->username) . ': ' . $D->post->post_message; $D->post->reset_new_comments(); $D->p =& $D->post; $D->cnm = $D->post->post_commentsnum; $D->comments = $D->post->get_comments(); if ($this->param('at') == 'videoembed' && isset($D->p->post_attached['videoembed'])) { $D->video = $D->p->post_attached['videoembed']; $D->video_w = $D->video->embed_w; $D->video_h = $D->video->embed_h; $c = $D->video->embed_code; $c = preg_replace('/width\\=(\\"|\\\')?' . $D->video->embed_w . '(\\"|\\\')?/ius', 'width=${1}100%${2}', $c); $c = preg_replace('/height\\=(\\"|\\\')?' . $D->video->embed_h . '(\\"|\\\')?/ius', 'height=${1}100%${2}', $c);