blogs
[ class tree: blogs ] [ index: blogs ] [ all elements ]

Source for file display_bitblog_inc.php

Documentation is available at display_bitblog_inc.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package blogs
  5.  * @subpackage functions
  6.  *
  7.  * @copyright Copyright (c) 2004-2006, bitweaver.org
  8.  *  All Rights Reserved. See below for details and a complete list of authors.
  9.  *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  10.  */
  11.  
  12. /**
  13.  * required setup
  14.  */
  15. $gBitSystem->verifyPackage( 'blogs' );
  16.  
  17. require_once( BLOGS_PKG_PATH.'BitBlog.php' );
  18. require_once( BLOGS_PKG_PATH.'lookup_blog_inc.php');
  19.  
  20. $displayHash = array( 'perm_name' => $gContent->mViewContentPerm );
  21. $gContent->invokeServices( 'content_display_function', $displayHash );
  22.  
  23. if( isset($_REQUEST['user_id']) && !isset( $_REQUEST['blog_id'] ) ) {
  24.     // We will try and grab the first blog owned by the user id given
  25.     $blogsList = $gContent->getList( $_REQUEST );
  26.     if (!empty($blogsList[0]['blog_id'])) {
  27.         $_REQUEST['blog_id'] = $blogsList[0]['blog_id'];
  28.     }
  29. }
  30.  
  31. if( !$gContent->isValid() ) {
  32.     $gBitSystem->setHttpStatus( 404 );
  33.     $gBitSystem->fatalError( tra( 'No blog indicated' ));
  34. }
  35.  
  36. $gContent->verifyViewPermission();
  37.  
  38. /**
  39.  * i don't think this is in use anymore - xing - Thursday Nov 08, 2007   21:49:22 CET
  40. if( $gContent->getField( 'blog_style' ) && $gBitSystem->getConfig('users_themes') == 'h' ) {
  41.     $gBitThemes->setStyle( $gContent->getField( 'blog_style' ) );
  42.     $gBitThemes->mStyles['styleSheet'] = $gBitSystem->getStyleCss( $gContent->getField( 'blog_style' ), $gContent->getField( 'user_id' ) );
  43.     $gBitSmarty->assign( 'userStyle', $gContent->getField( 'blog_style' ) );
  44. }
  45.  */
  46.  
  47. if( !$gContent->hasUpdatePermission() ) {
  48.     $gContent->addHit();
  49. }
  50.  
  51. $now = $gBitSystem->getUTCTime();
  52.  
  53. $blogPost = new BitBlogPost();
  54. $listHash = array();
  55. $listHash['blog_id'] = $gContent->getField( 'blog_id' );
  56. $listHash['parse_data'] = TRUE;
  57. $listHash['max_records'] = $gContent->getField( 'max_posts' );
  58. $listHash['load_num_comments'] = TRUE;
  59. $blogPosts = $blogPost->getList( $listHash );
  60. if( count( $blogPosts['data'] ) ) {
  61.     // If there're more records then assign next_offset
  62.     $gBitSmarty->assign_by_ref('blogPosts', $blogPosts["data"]);
  63.     $gBitSmarty->assign( 'listInfo', $blogPosts['listInfo'] );
  64. } elseif( $gContent->hasPostPermission() ) {
  65.     bit_redirect( BLOGS_PKG_URL.'post.php?blog_id='.$gContent->getField( 'blog_id' ) );
  66. }
  67.  
  68. if( $gBitSystem->isFeatureActive( 'users_watches' ) ) {
  69.     if( $gBitUser->isValid() && isset( $_REQUEST['watch_event'] ) ) {
  70.         if ($_REQUEST['watch_action'] == 'add') {
  71.             $blogPost = new BitBlogPost( $_REQUEST['watch_object'] );
  72.             if( $blogPost->load() ) {
  73.                 $gBitUser->storeWatch( $_REQUEST['watch_event'], $_REQUEST['watch_object'], tra('blog'), $blogPost->getTitle(), $blogPost->getDisplayUrl() );
  74.             }
  75.         } else {
  76.             $gBitUser->expungeWatch( $_REQUEST['watch_event'], $_REQUEST['watch_object'] );
  77.         }
  78.     }
  79.  
  80.     $gBitSmarty->assign('user_watching_blog', 'n');
  81.  
  82.     if ( $watch = $gBitUser->getEventWatches( 'blog_post', $listHash['blog_id'] ) ) {
  83.         $gBitSmarty->assign('user_watching_blog', 'y');
  84.     }
  85. }
  86.  
  87. $gBitSmarty->assign('descriptionLength', $gBitSystem->getConfig( 'blog_posts_description_length', 500 ) );
  88. $gBitSmarty->assign('showDescriptionsOnly', TRUE);
  89.  
  90. if ( $gBitSystem->isFeatureActive( 'blog_ajax_more' ) && $gBitThemes->isJavascriptEnabled() ){
  91.     $gBitSmarty->assign('ajax_more', TRUE);
  92.     $gBitThemes->loadAjax( 'mochikit', array( 'Iter.js', 'DOM.js', 'Style.js', 'Color.js', 'Position.js', 'Visual.js' ) );
  93. }
  94. // Display the template
  95. $gBitSystem->display( 'bitpackage:blogs/view_blog.tpl', $gContent->getTitle() , array( 'display_mode' => 'display' ));
  96. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:22 +0000 by phpDocumentor 1.5.0-lsces