public function getDataForHistory() { $c = new Criteria(); $c->add(ThreadPeer::ID, $this->getThreadId()); $thread = ThreadPeer::doSelectOne($c); return new HistoricalObjectEntry($this->getPosterId(), array('thread_id' => $this->getThreadId(), 'thread_title' => $thread->getTitle())); }
public function executeExpertReplyThread() { $connection = RaykuCommon::getDatabaseConnection(); $c = new Criteria(); $c->add(ForumPeer::TYPE, 0); $this->publicforums = ForumPeer::doSelect($c); $this->allcategories = CategoryPeer::doSelect($c = new Criteria()); $this->forum = $this->getRequestParameter('forum_id'); $this->thread = ThreadPeer::retrieveByPK($this->getRequestParameter('thread_id')); $c = new Criteria(); $c->add(PostPeer::THREAD_ID, $this->thread->getId()); $this->post = PostPeer::doSelectOne($c); $user = $this->getUser()->getRaykuUser(); if ($this->getRequestParameter('post_edit_content') != '') { $threadId = $this->getRequestParameter('thread_id'); $_thread = ThreadPeer::retrieveByPK($threadId); $_thread->setTitle($this->getRequestParameter('post_edit_title')); $_thread->save(); $v = new Criteria(); $v->add(PostPeer::THREAD_ID, $threadId); $v->addAscendingOrderByColumn(PostPeer::ID); $post = PostPeer::doSelectOne($v); $post->setContent($this->getRequestParameter('post_edit_content')); $post->save(); return $this->redirect('@view_thread?thread_id=' . $threadId); } if ($this->getRequestParameter('post_body') != '') { if ($this->getRequestParameter('final_id') != '') { $_quick_reply = ''; $_post_id = $this->getRequestParameter('final_id'); $_Post = PostPeer::retrieveByPK($_post_id); $_User = UserPeer::retrieveByPK($_Post->getPosterId()); $_quick_reply .= "<div style='margin-left:20px'><em><strong>Quote from " . $_User->getUsername() . "</strong></em><br><br>"; $_explode_post = explode("*^-", $_Post->getContent()); if (count($_explode_post) > 1) { $_quick_reply .= $_explode_post[1]; } else { $_quick_reply .= $_Post->getContent(); } $_quick_reply .= "</div>"; $_post_body_msg = $this->getRequestParameter('post_body'); $_quick_reply .= $_post_body_msg; $user->makeNewPost($this->getRequestParameter('thread_id'), $_quick_reply); ///////////////////updating the ip of the user $post_id = mysql_fetch_row(mysql_query("SELECT max(id) from post limit 0,1", $connection)); mysql_query("update post set \tuser_ip='" . $_SERVER['REMOTE_ADDR'] . "' where id=" . $post_id[0] . "", $connection); ///////////////////updating the ip of the user } else { $user->makeNewPost($this->getRequestParameter('thread_id'), $this->getRequestParameter('post_body')); ///////////////////updating the ip of the user $post_id = mysql_fetch_row(mysql_query("SELECT max(id) from post limit 0,1", $connection)); mysql_query("update post set \tuser_ip='" . $_SERVER['REMOTE_ADDR'] . "' where id=" . $post_id[0] . "", $connection); ///////////////////updating the ip of the user } if ($this->getUser()->getRaykuUser()->getType() == '5') { $c = new Criteria(); $c->add(ThreadPeer::ID, $this->getRequestParameter('thread_id')); $thread = ThreadPeer::doSelectOne($c); $c = new Criteria(); $c->add(UserPeer::ID, $thread->getPosterId()); $user = UserPeer::doSelectOne($c); if ($thread->getNotifyPm() == '1') { $subject = 'Expert Response for your Question'; $body = 'Hi there, <br><br> A Rayku expert, "' . $this->getUser()->getRaykuUser()->getName() . '" has just responsed to your question, "' . $thread->getTitle() . '" on the question boards. Take a look!<br><br> Rayku Administration'; //Grab the user object $currentuser = UserPeer::retrieveByPK($this->getUser()->getRaykuUserId()); //Send the message $currentuser->sendMessage($user->getId(), $subject, $body); } if ($thread->getNotifyEmail() == '1') { $this->mail = new sfMail(); //Set the to, from, and subject headers $this->mail->addAddress($user->getEmail()); $this->mail->setFrom('Expert <' . $this->getUser()->getRaykuUser()->getEmail() . '>'); $this->mail->setSubject('Expert Response to your Question'); $this->mail->setBody('Hi there,<br> A Rayku expert, "' . $this->getUser()->getRaykuUser()->getName() . '", has just responded to your question (below) on the question boards. Take a look!<br><br> ' . $thread->getTitle() . ''); $this->mail->send(); } } return $this->redirect('@view_thread?thread_id=' . $this->thread->getId()); } }
</script> <div style="display: none;"> <div id="inline_moreposts" style="width:650px;height:500px;overflow:auto;padding:25px" align="left"> <h4 style="font-size:20px;color:#069;font-weight:bold;line-height:30px;">More recent posts</h4> <br/> <br/> <table width="650" border='2px' align='center' style = "'border-bottom-width : 4px';"> <tr > <th width="130px">Post</th> <th width="130px">Created</th> <th width="130px">Last post</th> </tr> <?php if ($bestResponses != NULL) { foreach ($bestResponses as $response) { $a = new Criteria(); $a->add(ThreadPeer::ID, $best_response->getThreadId()); $threads = ThreadPeer::doSelectOne($a); if ($threads != NULL) { echo '<tr align="center">'; echo '<td>' . link_to($threads->getTitle(), '@view_thread?thread_id=' . $threads->getId(), array('class' => 'threadttle')) . '</td>'; echo '<td>' . $threads->getCreatedAt() . '</td>'; echo '<td>' . $threads->getLastpostAt() . '</td>'; echo '</tr>'; } } } ?> </table> </div> </div>