/** * The component to display a single thread */ public function executeShowThread() { $this->thread = ThreadPeer::retrieveByPK($this->threadID); $this->post = PostPeer::getFirstForThreadId($this->threadID); //First are experts anserws ( firest best than other ) //Than are other users answers ( first best than other ) $this->expert_best_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), true, 1); $this->expert_others_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), true, 0); $this->other_best_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), false, 1); $this->other_others_posts = PostPeer::getForThreadIdAndFor($this->threadID, $this->post->getId(), false, 0); }
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()); } }
} </style> <div style="display: none;"> <div id="inline1" style="width:630px;height:650px;overflow:auto;padding:25px" align="left"> <div class="body-main"> <div class="qa"> <div class="ta"> <?php $_thread = explode("/", $_SERVER['REQUEST_URI']); $_thread_id = $_thread[3]; $thread = ThreadPeer::retrieveByPK($_thread_id); $c = new Criteria(); $c->add(PostPeer::THREAD_ID, $thread->getId()); $c->addAscendingOrderByColumn(PostPeer::ID); $post = PostPeer::doSelectOne($c); $logedUserId = $_SESSION['symfony/user/sfUser/attributes']['symfony/user/sfUser/attributes']['user_id']; if (!empty($logedUserId)) { $c = new Criteria(); $c->add(UserPeer::ID, $logedUserId); $actionCheck = UserPeer::doSelectOne($c); if ($actionCheck->getType() == '5') { echo form_tag('@expertreply_thread?forum_id=' . $thread->getCategoryId() . '&thread_id=' . $thread->getId()); } else { echo form_tag('@userreply_thread?forum_id=' . $thread->getCategoryId() . '&thread_id=' . $thread->getId()); } }
$i++; } if (count($_StickieId) > 0 && count($_Non_StickieId) > 0) { $threads = array_merge($_StickieId, $_Non_StickieId); } else { if (count($_StickieId) > 0 && count($_Non_StickieId) == 0) { $threads = $_StickieId; } else { if (count($_StickieId) == 0 && count($_Non_StickieId) > 0) { $threads = $_Non_StickieId; } } } foreach ($threads as $thread) { $_class = ''; $thread = ThreadPeer::retrieveByPK($thread); $post = PostPeer::getFirstForThreadId($thread->getId()); $user = UserPeer::retrieveByPK($thread->getPosterId()); if (!empty($_StickieId)) { if (in_array($thread->getId(), $_StickieId)) { $_class = "background-color:#E6F8FF"; } } ?> <div class="entry" style="<?php echo $_class; ?> "> <div class="information" > <?php echo link_to($thread, '@view_thread?thread_id=' . $thread->getId(), array('class' => 'threadttle'));
} } ////////end follow me ?> </div> <div class="cmmt"> <div class="info"> <?php $date = RaykuCommon::formatDateForPost($post->getUpdatedAt()); ?> <div class="postdate">Posted on <?php echo $date; ?> </div> <?php $thread = ThreadPeer::retrieveByPK($post->getThreadId()); if ($rowBest["poster_id"] != $user->getId()) { if ($sf_user->getRaykuUserId() == $thread->getPosterId()) { $best_resp_count = PostPeer::getCountOfBestResponseForThread($thread); if ($best_resp_count < 1) { echo link_to('Set as best', 'forum/bestresponse?post_id=' . $post->getId() . '&temp=' . $post->getUpdatedAt(), array('class' => 'setbest')); } } } ?> </div> <!-- <p class="message"><?php // echo nl2br(htmlentities($post)) ?> </p> -->