Example #1
0
 public function _ShowPost()
 {
     global $page;
     $page->label = SimpleBlogCommon::Underscores($this->post['title']);
     $class = $id = '';
     if (common::LoggedIn()) {
         SimpleBlog::EditLinks($this->post_id, $class, $id);
     }
     echo '<div class="blog_post single_blog_item ' . $class . '" ' . $id . '>';
     //heading
     $header = '<h2 id="blog_post_' . $this->post_id . '">';
     if (SimpleBlogCommon::AStrGet('drafts', $this->post_id)) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Draft');
         $header .= '</span> ';
     } elseif ($this->post['time'] > time()) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Pending');
         $header .= '</span> ';
     }
     $header .= SimpleBlogCommon::PostLink($this->post_id, $page->label);
     $header .= '</h2>';
     SimpleBlogCommon::BlogHead($header, $this->post_id, $this->post);
     //content
     echo '<div class="twysiwygr">';
     echo $this->post['content'];
     echo '</div>';
     echo '</div>';
     echo '<br/>';
     echo '<div class="clear"></div>';
     $this->Categories();
     $this->PostLinks();
     $this->Comments();
 }
function b_waiting_simpleblog()
{
    $result = array();
    $result['adminlink'] = XOOPS_URL . '/modules/simpleblog/admin/index.php';
    $result['pendingnum'] = SimpleBlog::getApplicationNum();
    $result['lang_linkname'] = _PI_WAITING_BLOGS;
    return $result;
}
Example #3
0
 /**
  * Display the html for a single blog post
  *
  */
 public function ShowPostContent($post_index)
 {
     if (!common::LoggedIn() && SimpleBlogCommon::AStrGet('drafts', $post_index)) {
         return false;
     }
     $post = SimpleBlogCommon::GetPostContent($post_index);
     $class = $id = '';
     if (common::LoggedIn()) {
         SimpleBlog::EditLinks($post_index, $class, $id);
     }
     echo '<div class="blog_post post_list_item' . $class . '" ' . $id . '>';
     $header = '<h2 id="blog_post_' . $post_index . '">';
     if (SimpleBlogCommon::AStrGet('drafts', $post_index)) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Draft');
         $header .= '</span> ';
     } elseif ($post['time'] > time()) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Pending');
         $header .= '</span> ';
     }
     $label = SimpleBlogCommon::Underscores($post['title']);
     $header .= SimpleBlogCommon::PostLink($post_index, $label);
     $header .= '</h2>';
     SimpleBlogCommon::BlogHead($header, $post_index, $post);
     echo '<div class="twysiwygr">';
     if (!empty(SimpleBlogCommon::$data['post_abbrev']) && SimpleBlogCommon::$data['abbrev_image']) {
         $this->GetImageFromPost($post['content']);
     }
     echo $this->AbbrevContent($post['content'], $post_index, SimpleBlogCommon::$data['post_abbrev']);
     echo '</div>';
     echo '</div>';
     if (SimpleBlogCommon::$data['abbrev_cat'] && isset($post['categories']) && count($post['categories'])) {
         $temp = array();
         foreach ($post['categories'] as $catindex) {
             $title = SimpleBlogCommon::AStrGet('categories', $catindex);
             if (!$title) {
                 continue;
             }
             if (SimpleBlogCommon::AStrGet('categories_hidden', $catindex)) {
                 continue;
             }
             $temp[] = SimpleBlogCommon::CategoryLink($catindex, $title, $title);
         }
         if (count($temp)) {
             echo '<div class="category_container">';
             echo gpOutput::GetAddonText('Categories') . ' ';
             echo implode(', ', $temp);
             echo '</div>';
         }
     }
     echo '<div class="clear"></div>';
 }
Example #4
0
 /**
  * Output the html for a single blog post
  * Handle comment actions
  */
 function ShowPost($cmd)
 {
     global $langmessage, $page;
     $post = $this->GetPostContent($this->post_id);
     if ($post === false) {
         message($langmessage['OOPS']);
         return;
     }
     $commentSaved = false;
     switch ($cmd) {
         //redirect to correct url if needed
         case 'post':
             SimpleBlogCommon::UrlQuery($this->post_id, $expected_url, $query);
             $expected_url = str_replace('&amp;', '&', $expected_url);
             //because of htmlspecialchars($cattitle)
             if ($page->requested != $expected_url) {
                 $expected_url = common::GetUrl($expected_url, $query, false);
                 common::Redirect($expected_url, 301);
             }
             break;
             //close comments
         //close comments
         case 'closecomments':
             $this->CloseComments($this->post_id);
             break;
         case 'opencomments':
             $this->OpenComments($this->post_id);
             break;
             //commments
         //commments
         case 'Add Comment':
             if ($this->AddComment($this->post_id)) {
                 $commentSaved = true;
             } else {
                 echo '<div class="comment_container">';
                 $this->CommentForm($this->post_id, true);
                 echo '</div>';
                 return;
             }
             break;
         case 'delete_comment':
             $this->DeleteComment($this->post_id);
             break;
     }
     $post = $this->GetPostContent($this->post_id);
     if (!common::LoggedIn() && SimpleBlogCommon::AStrValue('drafts', $this->post_id)) {
         //How to make 404 page?
         message($langmessage['OOPS']);
         return;
     }
     $this->ShowPostContent($post, $this->post_id);
     $page->label = SimpleBlogCommon::Underscores($post['title']);
     //blog categories
     if (isset($post['categories']) && count($post['categories'])) {
         $temp = array();
         foreach ($post['categories'] as $catindex) {
             $title = SimpleBlogCommon::AStrValue('categories', $catindex);
             if (!$title) {
                 continue;
             }
             if (SimpleBlogCommon::AStrValue('categories_hidden', $catindex)) {
                 continue;
             }
             $temp[] = SimpleBlogCommon::CategoryLink($catindex, $title, $title);
         }
         if (count($temp)) {
             echo '<div class="category_container">';
             echo '<b>';
             echo gpOutput::GetAddonText('Categories');
             echo ':</b> ';
             echo implode(', ', $temp);
             echo '</div>';
         }
     }
     SimpleBlog::PostLinks($this->post_id);
     //comments
     if (SimpleBlogCommon::$data['allow_comments']) {
         echo '<div class="comment_container">';
         $this->ShowComments($this->post_id);
         if (!$commentSaved) {
             $this->CommentForm($this->post_id);
         }
         echo '</div>';
     }
 }