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

Source for file display_bitblogpost_inc.php

Documentation is available at display_bitblogpost_inc.php

  1. <?php
  2. /**
  3.  * @package blogs
  4.  * @subpackage functions
  5.  */
  6.  
  7. /**
  8.  * required setup
  9.  */
  10. include_once( BLOGS_PKG_PATH.'BitBlog.php' );
  11.  
  12. if (!isset($gContent->mPostId)) {
  13.     $parts = parse_url($_SERVER['REQUEST_URI']);
  14.  
  15.     $paths = explode('/', $parts['path']);
  16.     $blog_id = $paths[count($paths) - 2];
  17.     $post_id = $paths[count($paths) - 1];
  18.     // So this is to process a trackback ping
  19.     if (isset($_REQUEST['__mode'])) {
  20.         // Build RSS listing trackback_from
  21.         $pings = $gContent->getTrackbacksFrom();
  22.     }
  23.  
  24.     if (isset($_REQUEST['url'])) {
  25.         // Add a trackback ping to the list of trackback_from
  26.         $title = isset($_REQUEST['title']) ? $_REQUEST['title'] : '';
  27.  
  28.         $excerpt = isset($_REQUEST['excerpt']) ? $_REQUEST['excerpt'] : '';
  29.         $blog_name = isset($_REQUEST['blog_name']) ? $_REQUEST['blog_name'] : '';
  30.  
  31.         if ($gContent->addTrackbackFrom( $_REQUEST['url'], $title, $excerpt, $blog_name ) ) {
  32.             print ('<?xml version="1.0" encoding="iso-8859-1"?>');
  33.  
  34.             print ('<response>');
  35.             print ('<error>0</error>');
  36.             print ('</response>');
  37.         } else {
  38.             print ('<?xml version="1.0" encoding="iso-8859-1"?>');
  39.  
  40.             print ('<response>');
  41.             print ('<error>1</error>');
  42.             print ('<message>Error trying to add ping for post</message>');
  43.             print ('</response>');
  44.         }
  45.  
  46.         die;
  47.     }
  48. }
  49.  
  50. $gBitSystem->verifyPackage( 'blogs' );
  51.  
  52. $gBitSystem->verifyPermission( 'p_blogs_view' );
  53.  
  54. // Check permissions to access this page
  55. if( !$gContent->isValid() ) {
  56.     $gBitSystem->setHttpStatus( 404 );
  57.     $gBitSystem->fatalError( tra( 'Post cannot be found' ));
  58. }
  59.  
  60. $displayHash = array( 'perm_name' => 'p_blogs_view' );
  61. $gContent->invokeServices( 'content_display_function', $displayHash );
  62. $gBitSmarty->assign('post_id', $gContent->mPostId);
  63.  
  64. //Build absolute URI for this
  65. if ( empty( $_REQUEST['format'] ) || $_REQUEST['format'] == "full" || $_REQUEST['format'] == "data" ){
  66.     $parsed_data = $gContent->parseData();
  67.     if ($gBitSystem->isFeatureActive( 'blog_posts_comments' ) ) {
  68.         $comments_return_url = $_SERVER['SCRIPT_NAME']."?post_id=".$gContent->mPostId;
  69.         $commentsParentId = $gContent->mContentId;
  70.         include_once ( LIBERTY_PKG_PATH.'comments_inc.php' );
  71.     }
  72.     $extendedTitle = isset($gContent->mInfo['blogtitle']) ? ' - '.$gContent->mInfo['blogtitle'] : NULL;
  73.     $gBitSystem->setBrowserTitle($gContent->mInfo['title'].$extendedTitle);
  74. }else{
  75.     // if the format requested is not the full post or the readmore data we default to just the first half of the post
  76.     $data = ( $_REQUEST['format'] != "more" )?$gContent->mInfo['raw']:$gContent->mInfo['raw_more'];
  77.     $data = preg_replace( LIBERTY_SPLIT_REGEX, "", $data);
  78.     $parsed_data = $gContent->parseData( $data, ($gContent->getField('format_guid') ? $gContent->getField('format_guid') : 'tikiwiki') );    
  79. }
  80.  
  81. $gBitSmarty->assign('parsed_data', $parsed_data);
  82. $gBitSmarty->assign('post_info', $gContent->mInfo );
  83.  
  84. // Display the template
  85. if ( isset( $_REQUEST['output'] ) && $_REQUEST['output']="ajax"){    
  86.     $gBitSystem->display( 'bitpackage:blogs/view_blog_post_xml.tpl', NULL, array( 'format' => 'center_only', 'display_mode' => 'display' ));
  87. }else{
  88.     $gBitSystem->display( 'bitpackage:blogs/view_blog_post.tpl' , NULL, array( 'display_mode' => 'display' ));
  89. }
  90. ?>

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