function viewComments($dvd = 0) { $dbh = new Database(); $sth = $dbh->prepare("SELECT id FROM " . DB_PREFIX . "comments WHERE dvd = ? ORDER BY id DESC"); $sth->execute(array($dvd)); $commentCount = 0; while ($id = $sth->fetchColumn()) { $commentCount++; $comment = new Comment(); $comment->load($id); include '../views/showDVD/singleComment.php'; } }
/** * addOrUpdateComment. * * Updates or creates a Comment * * @param array $comment * * @return Comment $obj with User relationship loaded */ public function addOrUpdateComment(array $comment) { $obj = new Comment(); $obj->text = $comment['text']; $obj->user_id = $comment['user']['id']; $obj->doc_id = $this->doc_id; if (isset($comment['id'])) { $obj->id = $comment['id']; } $obj->parent_id = $this->id; $obj->save(); $obj->load('user'); return $obj; }
public function load($iCommentID) { $connection = new Connection(); $sSQL = "SELECT CommentID, Comment, UserID, RecipeID, CreatedAt, OriginalID\n FROM tbcomment\n WHERE CommentID=" . $iCommentID; $resultSet = $connection->query($sSQL); $row = $connection->fetch_array($resultSet); //store data into attributes: $this->iCommentID = $row["CommentID"]; $this->sComment = $row["Comment"]; $this->iUserID = $row["UserID"]; $this->iRecipeID = $row["RecipeID"]; $this->tCreatedAt = $row["CreatedAt"]; $this->iOriginalID = $row["OriginalID"]; $sSQL = "SELECT CommentID \n FROM tbcomment\n WHERE OriginalID=" . $iCommentID; $resultSet = $connection->query($sSQL); while ($row = $connection->fetch_array($resultSet)) { $iCommentID = $row["CommentID"]; $oComment = new Comment(); $oComment->load($iCommentID); $this->aReplies[] = $oComment; } $connection->close_connection(); }
public function load($iRecipeID) { $connection = new Connection(); $sSQL = "SELECT RecipeID, Title, AuthorNotes, Ingredients, Directions, ImagePath, CreatedAt, UserID, RecipeTypeID\n FROM tbrecipe\n WHERE RecipeID = " . $iRecipeID; $resultSet = $connection->query($sSQL); $row = $connection->fetch_array($resultSet); //store into attributes: $this->iRecipeID = $row["RecipeID"]; $this->sTitle = $row["Title"]; $this->sAuthorNotes = $row["AuthorNotes"]; $this->sIngredients = $row["Ingredients"]; $this->sDirections = $row["Directions"]; $this->sImagePath = $row["ImagePath"]; $this->tCreatedAt = $row["CreatedAt"]; $this->iUserID = $row["UserID"]; $this->iRecipeTypeID = $row["RecipeTypeID"]; // get all likes from recipe: $sSQL = "SELECT LikeID\n FROM tblike\n WHERE RecipeID = " . $iRecipeID; $resultSet = $connection->query($sSQL); while ($row = $connection->fetch_array($resultSet)) { $iLikeID = $row["LikeID"]; $oLike = new Like(); $oLike->load($iLikeID); $this->aLikes[] = $iLikeID; } // get all comments on a recipe: $sSQL = "SELECT CommentID\n FROM tbcomment\n WHERE RecipeID = " . $iRecipeID . " ORDER BY CreatedAt DESC"; $resultSet = $connection->query($sSQL); while ($row = $connection->fetch_array($resultSet)) { $iCommentID = $row["CommentID"]; $oComment = new Comment(); $oComment->load($iCommentID); $this->aComments[] = $oComment; } $connection->close_connection(); }
<?php #1. LOGIC Auth::kickout('/pokecart/'); $comment = new Comment(); $comment->load(Route::param('id')); if ($comment->user_id == Auth::user_id()) { if (Input::posted()) { $comment->content = Input::get('message'); $comment->save(); URL::restore(); } } Sticky::set('message', $comment->content); #2. LOAD VIEWS include VIEWS . 'header.php'; include VIEWS . 'edit_comment.php'; include VIEWS . 'footer.php';
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @author [creator, or "Original Author"] * @license http://bit.ly/aVWqRV PayAsYouGo License * @copyright Copyright (c) 2010 Broadband Mechanics * @package PeopleAggregator */ $login_required = TRUE; $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. include_once "web/includes/page.php"; require_once "api/Comment/Comment.php"; require_once "api/Permissions/PermissionsHandler.class.php"; if ($_GET['comment_id']) { $comment_id = trim($_GET['comment_id']); $comment = new Comment(); $comment->load($comment_id); if ($comment->parent_type == TYPE_USER) { $recipient_id = $comment->parent_id; $redirect_url = PA::$url . PA_ROUTE_USER_PUBLIC . "/" . $comment->parent_id; } else { if ($comment->parent_type == TYPE_CONTENT) { $redirect_url = PA::$url . PA_ROUTE_CONTENT . "/cid=" . $comment->content_id; } else { if (!empty($_REQUEST['back_page'])) { $redirect_url = $_REQUEST['back_page']; } } } $cid = $comment->content_id; //Content id for which comment has been posted. $params = array('comment_info' => array('user_id' => $comment->user_id, 'content_id' => $comment->content_id, 'recipient_id' => $recipient_id), 'permissions' => 'delete_comment');
function render_main_page_area($user) { global $admin_password; $page_url = PA::$url . "/comment_management.php"; $paging_url = "{$page_url}?"; // url to pass to the pager object $msg = ""; $path_info = @$_SERVER['PATH_INFO']; // see if the user is logged in as an admin if ($path_info == "/login") { if (@$_REQUEST['admin_password'] == $admin_password) { $_SESSION['comment_management_is_admin'] = TRUE; } else { $msg = "Incorrect password! Try again..."; } } else { if ($path_info == "/logout") { $_SESSION['comment_management_is_admin'] = FALSE; $msg = "You are now logged out (of admin mode)."; } } $is_admin = @$_SESSION['comment_management_is_admin']; $limit_set = NULL; // set this to an array with keys 'comment_id' to limit display to those keys $current_search_terms = NULL; // current search terms switch ($path_info) { case '/analyze_comment': $comment_id = (int) @$_REQUEST['comment']; if (!$is_admin) { $msg = "Sorry, only administrators can analyze comments at the moment :("; } elseif ($comment_id) { $cmt = new Comment(); $cmt->load($comment_id); $cmt->index_spam_domains(); $msg = "<p>Analysis of comment {$comment_id}:</p><hr/><p>" . nl2br(htmlspecialchars($cmt->comment)) . "</p><hr/><ul>"; $hosts = $cmt->get_link_hosts(); foreach ($hosts as $domain => $links) { $msg .= "<li><b>" . htmlspecialchars($domain) . "</b> (<a href=\"{$page_url}/analyze_domain?domain=" . htmlspecialchars($domain) . "\">analyze</a>): "; $dom = new SpamDomain($domain); if ($dom->blacklisted) { $msg .= " BLACKLISTED"; } $msg .= "<ul>"; foreach ($links as $link) { list($url, $linktexts) = $link; $msg .= "<li>" . htmlspecialchars($url) . " -> " . implode(" | ", array_map("htmlspecialchars", $linktexts)) . "</li>"; } $msg .= "</ul></li>"; } $msg .= "</ul><hr/>"; } break; case '/search': $current_search_terms = @$_REQUEST['q']; if (!$is_admin) { $msg = "Sorry, only administrators can search comments at the moment :("; } elseif ($current_search_terms) { $paging_url = "{$page_url}/search?q=" . urlencode($current_search_terms) . "&"; $limit_set = Comment::search($current_search_terms); } break; case '/stats': $msg = "<p>Stats:</p>"; list($n) = Dal::query_one("SELECT COUNT(*) FROM {comments}"); list($n_deleted) = Dal::query_one("SELECT COUNT(*) FROM {comments} WHERE is_active=0"); $n_active = $n - $n_deleted; $msg .= "<li>{$n} comments ({$n_active} active / {$n_deleted} deleted)</li>"; list($n_ham) = Dal::query_one("SELECT COUNT(*) FROM {comments} WHERE is_active=1 AND spam_state=0"); $n_spam = $n_active - $n_ham; $msg .= "<li>{$n_spam} active+spam / {$n_ham} active+not spam</li>"; list($n_no_class) = Dal::query_one("SELECT COUNT(*) FROM {comments} WHERE is_active=1 AND akismet_spam IS NULL"); $msg .= "<li>{$n_no_class} active comments not (yet?) classified by Akismet</li>"; list($n_akismet_del) = Dal::query_one("SELECT COUNT(*) FROM {comments} WHERE is_active=0 AND akismet_spam=1"); $msg .= "<li>{$n_akismet_del} comments flagged as spam by akismet and deleted</li>"; break; case '/add_spam_term': $spam_term = @$_REQUEST['term']; if (!$is_admin) { $msg = "Sorry, only administrators can add spam terms at the moment."; } elseif ($spam_term) { // find the comments $matches = Comment::search($spam_term); $n_deleted = count($matches); // add the term Comment::add_spam_term($spam_term); // and delete the comments $blk_size = 1000; $F_fetch_ids = create_function('$item', 'return $item["comment_id"];'); for ($i = 0; $i < count($matches); $i += $blk_size) { Comment::set_spam_state(array_map($F_fetch_ids, array_slice($matches, $i, $blk_size)), SPAM_STATE_SPAM_WORDS); } $msg = "Added <b>" . htmlspecialchars($spam_term) . '</b> to the spam term database, and deleted ' . $n_deleted . ' comments containing it.'; } break; case '/analyze_domain': $domain = @$_REQUEST['domain']; if (!$is_admin) { $msg = "Sorry, only administrators can analyze domains."; } else { $msg .= "<p>analysis of domain " . htmlspecialchars($domain) . ":</p><ul>"; $domain = new SpamDomain($domain); foreach ($domain->find_associated_domains() as $r) { $msg .= "<li>" . $r['domain'] . " (" . $r['domain_id'] . "): " . $r['match_count'] . " matches</li>"; } $msg .= "</ul>"; } break; case '/blacklist_domain': $domain = @$_REQUEST['domain']; if (!$is_admin) { $msg = "Sorry, only administrators can blacklist domains."; } elseif (!trim($domain)) { $msg = "Invalid domain"; } else { $dom = new SpamDomain($domain); $dom->set_blacklisted(DOMAIN_BLACKLISTED_MANUALLY); foreach ($dom->find_associated_domains() as $assoc_domain) { SpamDomain::recalculate_link_counts_for_domain_id($assoc_domain['domain_id']); } } // FALL THROUGH TO /common_domains // FALL THROUGH TO /common_domains case '/common_domains': if (!$is_admin) { $msg = "Sorry, only administrators can do this."; } else { list($total_domains, $total_blacklisted_domains) = SpamDomain::count_domains(); $msg .= "<p>Most common domains (out of total {$total_domains}, {$total_blacklisted_domains} blacklisted) in comments:</p><ul>"; foreach (SpamDomain::get_most_common_domains() as $dom) { $msg .= "<li>" . $dom['active_count'] . " times: " . $dom['domain'] . ' ' . ($dom['blacklisted'] ? 'BLACKLISTED' : '') . ' (<a href="' . $page_url . '/blacklist_domain?domain=' . $dom['domain'] . '">blacklist domain</a> | <a href="' . $page_url . '/analyze_domain?domain=' . $dom['domain'] . '">analyze domain</a>)</li>'; } $msg .= "</ul>"; } break; case '/akismet_verify_key': global $akismet_key; if (!$is_admin) { $msg = "Sorry, only administrators can access Akismet at the moment."; } elseif (!$akismet_key) { $msg .= '<p>No Akismet key has been configured - Akismet is not active.</p>'; } else { // global var $_base_url has been removed - please, use PA::$url static variable $msg .= "<p>verifying akismet key: {$akismet_key}</p>"; $ak = new Akismet($akismet_key); $msg .= "<p>result: " . var_export($ak->verify_key(PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $user->user_id), TRUE) . "</p>"; } break; case '/akismet_check_spam': if (!$is_admin) { $msg = "Sorry, only administrators can access Akismet at the moment."; } else { global $akismet_key; $msg .= "<p>checking comment for spam</p>"; $cmt = new Comment(); try { $cmt->load((int) $_REQUEST['comment']); } catch (PAException $e) { if ($e->getCode() != COMMENT_NOT_EXIST) { throw $e; } $msg .= "<p>Comment already deleted.</p>"; break; } $cmt->akismet_check(); $msg .= "<p>result: " . var_export($cmt->akismet_spam, TRUE) . "</p>"; } break; default: if (preg_match("~^/delete/(\\d+)\$~", $path_info, $m)) { list(, $cid) = $m; if (!$is_admin) { $msg = "Sorry, only administrators can delete comments at the moment :("; } else { try { $c = new Comment(); $c->load((int) $cid); $c->delete(); $msg = "Comment deleted."; } catch (PAException $e) { if ($e->code == COMMENT_NOT_EXIST) { $msg = "Comment already deleted."; } else { throw $e; } } } } } $per_page = 20; // how many comments to show on a page // paging if ($limit_set !== NULL) { $total_comments = count($limit_set); } else { $total_comments = Comment::count_all_comments($is_admin ? 0 : $user->user_id); } $pager = new pager($total_comments, $per_page, $paging_url); $paging = $pager->getButList(8) . " (total {$total_comments} comments)"; // main comment list if ($limit_set !== NULL) { $show_start = max(0, min(($pager->page - 1) * $per_page, $total_comments)); $show_count = min($per_page, $total_comments - $show_start); $limit_set_ids = array_map(create_function('$item', 'return $item["comment_id"];'), array_slice($limit_set, $show_start, $show_count)); $cmts = Comment::get_selected($limit_set_ids); } else { $cmts = Comment::get_all_comments($is_admin ? 0 : $user->user_id, $per_page, $pager->page); } $comments = ""; foreach ($cmts as $cmt) { // $comments .= "<li>".htmlspecialchars(var_export($cmt, TRUE))."</li>"; $akismet_result = $cmt['akismet_spam'] ? "spam" : "?"; $comments .= "<tr><td>" . $cmt['comment_id'] . "</td><td>" . $cmt['content_id'] . "</td><td>" . esc_wbr($cmt['name']) . "</td><td>" . esc_wbr($cmt['email']) . "</td><td>" . esc_wbr($cmt['homepage']) . "</td><td>" . esc_wbr($cmt['subject']) . "</td><td>" . esc_wbr($cmt['comment']) . " {$akismet_result} <a href=\"{$page_url}/analyze_comment?comment=" . $cmt['comment_id'] . "\">analyze</a></td><td>" . esc_wbr($cmt['ip_addr']) . "</td><td>" . '<form method="POST" action="' . PA::$url . '/comment_management.php/delete/' . $cmt['comment_id'] . '?page=' . $pager->page . '"><input type="submit" value="X"></form> <a href="' . $page_url . '/akismet_check_spam?comment=' . $cmt['comment_id'] . '">ak</a></td></tr>'; } if ($is_admin) { if ($current_search_terms) { $current_search = '<form method="POST" action="' . $page_url . '/add_spam_term"><p>Currently displaying results for: <b>' . htmlspecialchars($current_search_terms) . '</b>. <a href="' . $page_url . '">Show all comments</a>. <input type="hidden" name="term" value="' . htmlspecialchars($current_search_terms) . '"><input type="submit" value="Blacklist this term"></p></form>'; } else { $current_search = ""; } $your_permissions = <<<EOS \t<form method="POST" action="{$page_url}/logout"><p>You are an administrator, so all comments in the site will be displayed. <input type="submit" value="Log out"></p></form> \t<p><a href="{$page_url}/akismet_verify_key">Verify Akismet key</a> | <a href="{$page_url}/common_domains">Show most common domains</a> | <a href="{$page_url}/stats">Spam statistics</a></p> \t<form method="GET" action="{$page_url}/search"><p>Search comment content: <input type="text" id="search_q" name="q" size="20"><input type="submit" value="Search"/></p></form> \t<script language="javascript"><!-- \t document.getElementById("search_q").focus(); // --></script> {$current_search} EOS; } else { $your_permissions = <<<EOS <p>Showing comments on your blog and groups for which you are moderator.</p> <form method="POST" action="{$page_url}/login"><p>Or enter the admin password here to adminster the whole site: <input type="password" name="admin_password" size="20"/><input type="submit" value="Log in"/></p></form> EOS; } $page_title = "Manage comments"; global $akismet_key; if ($akismet_key) { $page_title .= " (Akismet active)"; } else { $page_title .= " (Akismet not configured)"; } $page_html = <<<EOS <div class="pane comment_manage_pane"> <h1>{$page_title}</h1> <div id="msg" class="fade">{$msg}</div> {$your_permissions} <p>{$paging}</p> <table class="bulk_comment_summary"><tr> <td>ID</td> <td>Post</td> <td>Name</td> <td>Email</td> <td>Website</td> <td>Subject</td> <td>Comment</td> <td>IP</td> <td>X</td> </tr> {$comments} </table> </div><!-- comment_manage_pane --> EOS; return $page_html; }
/** * test #9. * Loading a valid, existing key overrides all the attributes with the * loaded values. The load() function returns true, indicating that * data was found. * @depends testSaveEmptyObject * @depends testSetAttributes */ public function testLoadExistent() { global $testTripId1, $testCommentId1, $testUserId1; global $testTripId2, $testCommentId2, $testUserId2; // create a first instance $object = new Comment($testTripId1, $testCommentId1); $object->setUserId($testUserId1); $object->setReferenceId('-test-reference-id-1'); $object->setCommentText('comment text'); $object->setDeleted('Y'); $object->save(); $this->assertEquals(1, $this->countTestRows()); // Get the automatically created attributes for this instance $created1 = $object->getCreated(); $updated1 = $object->getUpdated(); $hash1 = $object->getHash(); // create a second instance $object = new Comment($testTripId2, $testCommentId2); $object->setUserId($testUserId2); $object->setReferenceId('-test-reference-id-2'); $object->setCommentText('comment text 2'); $object->setDeleted('N'); $object->save(); $this->assertEquals(2, $this->countTestRows()); // Get the automatically created attributes for this instance, and // make sure they are different from those of the first instance. $created2 = $object->getCreated(); $updated2 = $object->getUpdated(); $hash2 = $object->getHash(); $this->assertNotEquals($created1, $created2); $this->assertNotEquals($updated1, $updated2); $this->assertNotEquals($hash1, $hash2); // Load the first object, which overrides all the attributes $this->assertTrue($object->load($testTripId1, $testCommentId1)); $this->assertEquals($testTripId1, $object->getTripId()); $this->assertEquals($testCommentId1, $object->getCommentId()); $this->assertEquals($created1, $object->getCreated()); $this->assertEquals($updated1, $object->getUpdated()); $this->assertEquals($testUserId1, $object->getUserId()); $this->assertEquals('-test-reference-id-1', $object->getReferenceId()); $this->assertEquals('comment text', $object->getCommentText()); $this->assertEquals('Y', $object->getDeleted()); $this->assertEquals($hash1, $object->getHash()); // Load the second object, which overrides all the attributes $this->assertTrue($object->load($testTripId2, $testCommentId2)); $this->assertEquals($testTripId2, $object->getTripId()); $this->assertEquals($testCommentId2, $object->getCommentId()); $this->assertEquals($created2, $object->getCreated()); $this->assertEquals($updated2, $object->getUpdated()); $this->assertEquals($testUserId2, $object->getUserId()); $this->assertEquals('-test-reference-id-2', $object->getReferenceId()); $this->assertEquals('comment text 2', $object->getCommentText()); $this->assertEquals('N', $object->getDeleted()); $this->assertEquals($hash2, $object->getHash()); }
{ list($remaining) = Dal::query_one("SELECT COUNT(*) FROM comments WHERE is_active=1 AND akismet_spam IS NULL"); return (int) $remaining; } echo "Looking for comments which have not been checked for spam yet.\n"; $ct = get_remaining(); echo "... {$ct} comments to check. Checking them...\n"; $checked = 0; while ($checked < $ct) { $remaining = get_remaining(); echo "Progress: {$checked} checked out of total {$ct} (remaining: {$remaining})\n"; if (!$remaining) { echo "No comments left to classify!\n"; break; } $sth = Dal::query("SELECT comment_id FROM comments WHERE is_active=1 AND akismet_spam IS NULL LIMIT 10"); while ($r = Dal::row($sth)) { list($comment_id) = $r; echo "- checking comment {$comment_id}... "; flush(); $c = new Comment(); $c->load((int) $comment_id); if (!$c->homepage) { $c->homepage = ""; } $c->akismet_check(); echo var_export($c->akismet_spam, TRUE) . "\n"; ++$checked; sleep(1); } }
function testAddDeleteContentComments() { // Dal::register_query_callback("explain_query"); echo "getting a user\n"; $user = Test::get_test_user(); echo "test user = {$user->first_name} {$user->last_name}\n"; echo "adding some content\n"; $post = new BlogPost(); $post->author_id = $user->user_id; $post->parent_collection_id = -1; $post->title = "Test blog post (from testAddDeleteContentComments)"; $post->body = "<p>This is the post body!</p><p>Foo <b>foo</b> foo</p>"; $post->allow_comments = 1; $post->is_active = 1; $post->display_on = DISPLAY_ON_HOMEPAGE; $post->save(); echo "... saved as content_id={$post->content_id}\n"; echo "testing that it is retrievable\n"; $post_retr = Content::load_content($post->content_id, $user->user_id); $this->assertEquals($post_retr->content_id, $post->content_id); $this->assertEquals($post_retr->title, $post->title); $this->assertEquals($post_retr->body, $post->body); $this->assertEquals($post_retr->author_id, $user->user_id); $this->assertEquals($post_retr->is_active, 1); echo "posting a comment\n"; $cmt = new Comment(); $cmt->content_id = $post->content_id; $cmt_comment = "This is an automatic comment - on an autogenerated post"; $cmt->comment = $cmt_comment; $cmt->user_id = $user->user_id; $cmt->name = $cmt->email = $cmt->homepage = ''; $cmt->ip_addr = '127.0.0.1'; $cmt->referrer = 'http://example.com/'; $cmt->user_agent = 'phpunit auto-test'; $cmt->save(); echo "... saved as comment_id={$cmt->comment_id}\n"; echo "testing that the comment is retrievable\n"; $cmt_retr = new Comment(); $cmt_retr->load($cmt->comment_id); $this->assertEquals($cmt_retr->comment_id, $cmt->comment_id); $this->assertEquals($cmt_retr->content_id, $post->content_id); $this->assertEquals($cmt_retr->comment, $cmt_comment); $this->assertEquals($cmt_retr->is_active, 1); echo "testing that we see one comment on the post\n"; $comments = Comment::get_comment_for_content($post->content_id); echo count($comments) . " comments\n"; //var_dump($comments); $this->assertEquals(count($comments), 1); echo "testing that we have no trackbacks on the post\n"; $trackbacks = Content::get_trackbacks_for_content($post->content_id); echo count($trackbacks) . " trackbacks\n"; //var_dump($trackbacks); $this->assertEquals(count($trackbacks), 0); echo "posting ANOTHER comment\n"; $cmt2 = new Comment(); $cmt2->content_id = $post->content_id; $cmt2_comment = "This is ANOTHER automatic comment - on the same autogenerated post"; $cmt2->comment = $cmt_comment; $cmt2->user_id = $user->user_id; $cmt2->name = $cmt2->email = $cmt2->homepage = ''; $cmt2->ip_addr = '127.0.0.1'; $cmt2->referrer = 'http://example.com/'; $cmt2->user_agent = 'phpunit auto-test'; $cmt2->save(); echo "... saved as comment_id={$cmt2->comment_id}\n"; echo "testing that we see two comments on the post\n"; $comments = Comment::get_comment_for_content($post->content_id); $this->assertEquals(count($comments), 2); echo "deleting the first comment\n"; $cmt_retr->delete(); echo "testing that we see one comment on the post again (not seeing the deleted one)\n"; $comments = Comment::get_comment_for_content($post->content_id); $this->assertEquals(count($comments), 1); echo "testing that the first comment (now deleted) is not retrievable\n"; $cmt_retr_fail = new Comment(); try { $cmt_retr_fail->load($cmt->comment_id); $this->assertTrue(FALSE); // shouldn't get here } catch (PAException $e) { $this->assertEquals($e->getCode(), COMMENT_NOT_EXIST); } echo "deleting the post\n"; Content::delete_by_id($post->content_id); echo "testing that the post is not retrievable\n"; try { $post_retr_fail = Content::load_content($post->content_id, $user->user_id); $this->assertTrue(FALSE); // shouldn't get here } catch (PAException $e) { $this->assertEquals($e->getCode(), CONTENT_NOT_FOUND); } echo "testing that the last comment is not retrievable\n"; $cmt_retr_fail = new Comment(); try { $cmt_retr_fail->load($cmt->comment_id); $this->assertTrue(FALSE); // shouldn't get here } catch (PAException $e) { $this->assertEquals($e->getCode(), COMMENT_NOT_EXIST); } // summarize_timed_queries(); }
function show() { $comment = Comment::load('Comment', $this->parameters['id']); $this->redirect('/posts/' . $comment->post_id . '#' . $comment->id); }