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