Example #1
0
function printPostRSS($post)
{
    echo "        <item>\n";
    echo '            <title>' . $post['post_title'] . "</title>\n";
    echo '            <link>http://fisherevans.com/blog/post/' . $post['post_id'] . "/</link>\n";
    echo '            <pubDate>' . date("D, d M Y H:i:s O", strtotime($post['post_time'])) . "</pubDate>\n";
    echo "            <content:encoded>\n";
    echo "                <![CDATA[\n";
    echo getPostContent($post['post_id']);
    echo "                ]]>\n";
    echo "            </content:encoded>\n";
    echo "        </item>\n";
}
 public function show_post_content()
 {
     $result = "";
     if (isset($_SESSION['user_id'])) {
         $user_id = $_SESSION['user_id'];
     } else {
         $user_id = 0;
     }
     $timezone = $_POST['timezone'];
     $friends = getFriendsList($user_id);
     $user_details = getUserNameById($user_id);
     $post_ids = "";
     if ($friends != null) {
         foreach ($friends as $value) {
             $post_ids .= $value[0];
             $post_ids .= ",";
         }
     }
     $post_ids .= $user_id;
     $post_content = getPostContent($post_ids);
     if ($post_content != null) {
         foreach ($post_content as $post) {
             $result .= '<div  class="post_wrap"><a id="' . $post[0] . '" >';
             $result .= '<div class="post_wrap_author_profile_picture">';
             if ($post[6] != null) {
                 $result .= '<img src="' . $post[6] . '" style="width: 100%;max-height: 30px;" />';
             } else {
                 $result .= '<img src="images/profile_pic.jpg" />';
             }
             $result .= '</div>';
             $tz = $_POST['timezone'];
             $tz = new DateTimeZone($tz);
             $date = new DateTime($post[3]);
             $date->setTimezone($tz);
             $result .= '<div class="post_details"> ';
             $result .= '<div class="post_author"> ' . $post[1] . '<span class="post_timestamp" id="comment_date"> ' . $this->date_format($date->format('Y-m-d H:i:s'), $tz) . ' ago</span>  </div>';
             if ($post[7] == 'text') {
                 if (strlen($post[2]) > 25) {
                     $result .= '<div class="post_text"> ' . substr($post[2], 0, 20) . '...<a id="' . $post[0] . '" style="font-size: 11px; color: #197700 !important;  margin: -17px 6px -2px 5px;" name="' . $post[0] . '_readmore" onclick="show_post_detail(this) ">Read More </a></div>';
                 } else {
                     $result .= '<div class="post_text"> ' . $post[2] . ' </div>';
                 }
             } else {
                 if ($post[7] == 'audio') {
                     $result .= '<audio controls>';
                     //$result.= '<source src="horse.ogg" type="audio/ogg">';
                     $result .= '<source src="http://creatustent.com/camfox/process/uploads/audios/' . $post[2] . '" type="audio/mpeg">';
                     $result .= '</audio> ';
                 } else {
                     if ($post[7] == 'video') {
                         $result .= '<video width="250" height="240" controls>';
                         $result .= '<source src="http://creatustent.com/camfox/process/uploads/videos/' . $post[2] . '" type="video/mp4">';
                         //$result.= '<source src="movie.ogg" type="video/ogg">';
                         $result .= '</video> ';
                     } else {
                         if ($post[7] == 'image') {
                             $result .= '<div class="post_image" ><img src="http://creatustent.com/camfox/process/uploads/images/' . $post[2] . '" /> </div>';
                         } else {
                         }
                     }
                 }
             }
             $result .= '</div>';
             $result .= '</a></div> ';
             $result .= ' <div class="comments_wrap">';
             $result .= '<span> <span><img src="images/like.png" /></span>';
             $result .= '<span class="post_feedback_like_unlike" id="' . $post[0] . '_like_' . $post[5] . '"  onclick="post_like(this,' . $user_id . ')">' . getLikeorUnlike($post[0], 0, $user_id) . '</span>';
             $result .= ' <span class="post_feedback_count" id="' . $post[0] . '_like_count"> ' . $post[5] . '</span></span>';
             $result .= '<span><span class="post_feedback_comment" onclick="show_comments(' . $post[0] . ',' . $user_id . ')"> <img src="images/comment.png" /> Comment</span>';
             $result .= '<span class="post_feedback_count" id="' . $post[0] . '_comment_count"> ' . $post[4] . '</span></span>';
             $result .= '<div class="comment" id="' . $post[0] . '_comment" >';
             $result .= '</div>';
             $result .= ' <div class="comment" id="' . $post[0] . '_self_comment">';
             if ($user_details[1] != null) {
                 $result .= '<div class="comment_author_profile_picture"> <img src="' . $user_details[1] . '" /></div>';
             } else {
                 $result .= '<div class="comment_author_profile_picture"> <img src="images/profile_pic.jpg" /></div>';
             }
             $result .= '<div class="comment_text">';
             $result .= '<textarea placeholder="Write a comment..." id="' . $post[0] . '_comment_text_box" onKeyPress="return new_comment(this,event,' . $user_id . ')" ></textarea>';
             $result .= '</div></div></div>';
         }
     }
     $this->http_response($result, 200);
 }