Exemple #1
0
     require "journal/detail.inc.php";
     return;
 } else {
     if ($path[4] == "entries" && $path[6] == "comment") {
         $journal = Journal::GetByIDOrName($path[3]);
         if ($journal == null) {
             return;
         }
         $entry = JournalEntry::GetByIDOrName($path[5]);
         $entryUrl = System::ExpandRelativePath("~/community/members/" . $thisuser->ShortName . "/journals/" . $journal->Name . "/entries/" . $entry->Name);
         switch ($path[6]) {
             case "comment":
                 if ($_SERVER["REQUEST_METHOD"] == "POST") {
                     $reply_to = null;
                     if ($_POST["reply_comment_id"] != null) {
                         $reply_to = JournalEntryComment::GetByID($_POST["reply_comment_id"]);
                     }
                     $title = $_POST["comment_title"];
                     $content = $_POST["comment_content"];
                     if (!$entry->AddComment($title, $content, $reply_to)) {
                         $page = new ErrorPage();
                         $page->ErrorCode = mysql_errno();
                         $page->ErrorDescription = mysql_error();
                         $page->Render();
                         return;
                     }
                     System::Redirect($entryUrl);
                     return;
                 }
         }
     }
Exemple #2
0
 public static function GetByAssoc($values)
 {
     $comment = new JournalEntryComment();
     $comment->ID = $values["comment_id"];
     $comment->ParentComment = JournalEntryComment::GetByID($values["comment_parent_id"]);
     $comment->Author = User::GetByID($values["author_id"]);
     $comment->ParentJournalEntry = JournalEntry::GetByID($values["journal_entry_id"]);
     $comment->Title = $values["comment_title"];
     $comment->Content = $values["comment_content"];
     $comment->TimestampCreated = $values["comment_timestamp_created"];
     return $comment;
 }