diff options
Diffstat (limited to 'includes')
| -rwxr-xr-x | includes/bit_setup_inc.php | 17 | ||||
| -rwxr-xr-x | includes/classes/BitBlog.php | 12 | ||||
| -rwxr-xr-x | includes/classes/BitBlogPost.php | 107 | ||||
| -rwxr-xr-x | includes/display_bitblog_inc.php | 3 | ||||
| -rwxr-xr-x | includes/display_bitblogpost_inc.php | 11 | ||||
| -rwxr-xr-x | includes/lookup_post_inc.php | 6 |
6 files changed, 74 insertions, 82 deletions
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php index 66dc8e0..b9c736f 100755 --- a/includes/bit_setup_inc.php +++ b/includes/bit_setup_inc.php @@ -3,6 +3,7 @@ * @package blogs */ namespace Bitweaver\Blogs; + use Bitweaver\KernelTools; global $gBitSystem, $gBitUser, $gBitSmarty; @@ -18,9 +19,9 @@ $pRegisterHash = [ define( 'BLOGS_PKG_NAME', $pRegisterHash['package_name'] ); define( 'BLOGS_PKG_URL', BIT_ROOT_URL . basename( $pRegisterHash['package_path'] ) . '/' ); define( 'BLOGS_PKG_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/' ); -define( 'BLOGS_PKG_INCLUDE_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/'); +define( 'BLOGS_PKG_INCLUDE_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/'); define( 'BLOGS_PKG_CLASS_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/includes/classes/'); -define( 'BLOGS_PKG_ADMIN_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/admin/'); +define( 'BLOGS_PKG_ADMIN_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['package_path'] ) . '/admin/'); $gBitSystem->registerPackage( $pRegisterHash ); @@ -35,14 +36,14 @@ if( $gBitSystem->isPackageActive( 'blogs' ) ) { ]; $gBitSystem->registerAppMenu( $menuHash ); - $gLibertySystem->registerService( - LIBERTY_SERVICE_BLOGS, - BLOGS_PKG_NAME, - [ 'module_display_function' => 'blogs_module_display', ], - [ + $gLibertySystem->registerService( + LIBERTY_SERVICE_BLOGS, + BLOGS_PKG_NAME, + [ 'module_display_function' => 'blogs_module_display', ], + [ 'description' => KernelTools::tra( 'A module display service which helps hook in javascript necessary when using the center module on other pages. This is a temporary fix to address a limitation of the rendering order in BitThemes and only applies to blog content.' ), 'required' => true, - ] + ], ); } diff --git a/includes/classes/BitBlog.php b/includes/classes/BitBlog.php index f3cc0be..9948257 100755 --- a/includes/classes/BitBlog.php +++ b/includes/classes/BitBlog.php @@ -9,10 +9,10 @@ * required setup */ namespace Bitweaver\Blogs; + use Bitweaver\BitBase; use Bitweaver\Liberty\LibertyContent; use Bitweaver\Liberty\LibertyMime; -use Bitweaver\Users\RolePermUser; define( 'BITBLOG_CONTENT_TYPE_GUID', 'bitblog' ); @@ -30,7 +30,7 @@ class BitBlog extends LibertyMime { } else { $this->mBlogId = $this->verifyId( $pBlogId ) ? $pBlogId : 0; } - + parent::__construct(); $this->registerContentType( BITBLOG_CONTENT_TYPE_GUID, [ 'content_type_guid' => BITBLOG_CONTENT_TYPE_GUID, @@ -38,7 +38,7 @@ class BitBlog extends LibertyMime { 'handler_class' => 'BitBlog', 'handler_package' => 'blogs', 'handler_file' => 'BitBlog.php', - 'maintainer_url' => 'https://www.bitweaver.org' + 'maintainer_url' => 'https://www.bitweaver.org', ] ); $this->mContentId = $pContentId; $this->mContentTypeGuid = BITBLOG_CONTENT_TYPE_GUID; @@ -103,7 +103,6 @@ class BitBlog extends LibertyMime { return true; } - /*shared*/ public function getBlog( $pBlogId, $pContentId = null ) { global $gBitSystem; @@ -176,7 +175,7 @@ class BitBlog extends LibertyMime { //$pParamHash['blog_store']['posts'] = 0; $pParamHash['blog_store']['content_id'] = $this->mContentId; // if pParamHash['blog_id'] is set, someone is requesting a particular blog_id. Use with caution! - $pParamHash['blog_store']['blog_id'] = isset( $pParamHash['blog_id'] ) && is_numeric( $pParamHash['blog_id'] ) + $pParamHash['blog_store']['blog_id'] = isset( $pParamHash['blog_id'] ) && is_numeric( $pParamHash['blog_id'] ) ? $pParamHash['blog_id'] : $this->mDb->GenID( 'blogs_blog_id_seq' ); $this->mBlogId = $pParamHash['blog_store']['blog_id']; @@ -277,7 +276,6 @@ class BitBlog extends LibertyMime { $whereSql = preg_replace( '/^[\s]*AND/', ' WHERE ', $whereSql ); } - $ret = []; // Return a data array, even if empty @@ -400,7 +398,7 @@ class BitBlog extends LibertyMime { public function getAvailableContentStatuses( $pUserMinimum=-100, $pUserMaximum=100 ) { global $gBitUser; $ret = null; - // return null for all but admins + // return null for all but admins if( $gBitUser->hasPermission( 'p_liberty_edit_all_status' )) { $ret = LibertyMime::getAvailableContentStatuses(); } diff --git a/includes/classes/BitBlogPost.php b/includes/classes/BitBlogPost.php index 7f19413..81f41c7 100755 --- a/includes/classes/BitBlogPost.php +++ b/includes/classes/BitBlogPost.php @@ -21,6 +21,7 @@ * required setup */ namespace Bitweaver\Blogs; + use Bitweaver\BitBase; use Bitweaver\KernelTools; use Bitweaver\BitDate; @@ -45,14 +46,14 @@ class BitBlogPost extends LibertyMime { public function __construct( $pPostId=null, $pContentId=null ) { parent::__construct(); - $this->registerContentType( BITBLOGPOST_CONTENT_TYPE_GUID, array( + $this->registerContentType( BITBLOGPOST_CONTENT_TYPE_GUID, [ 'content_type_guid' => BITBLOGPOST_CONTENT_TYPE_GUID, 'content_name' => 'Blog Post', 'handler_class' => 'BitBlogPost', 'handler_package' => 'blogs', 'handler_file' => 'BitBlogPost.php', - 'maintainer_url' => 'https://www.bitweaver.org' - ) ); + 'maintainer_url' => 'https://www.bitweaver.org', + ] ); $this->mPostId = (int)$pPostId; $this->mContentId = (int)$pContentId; $this->mContentTypeGuid = BITBLOGPOST_CONTENT_TYPE_GUID; @@ -103,11 +104,11 @@ class BitBlogPost extends LibertyMime { // we should remove this now that display_url is added $this->mInfo['url'] = BitBlogPost::getDisplayUrlFromHash( $this->mInfo ); $this->mInfo['display_url'] = BitBlogPost::getDisplayUrlFromHash( $this->mInfo ); - foreach( array( 'avatar', 'image' ) as $img ) { + foreach( [ 'avatar', 'image' ] as $img ) { if( !empty( $this->mInfo[$img.'_file_name'] ) ) { - $this->mInfo[$img] = \Bitweaver\Liberty\liberty_fetch_thumbnails( array( - 'source_file' => $this->getSourceFile( array( 'user_id'=>$this->getField( 'user_id' ), 'package'=>\Bitweaver\Liberty\liberty_mime_get_storage_sub_dir_name( array( 'mime_type' => $this->getField( $img.'_mime_type' ), 'name' => $this->getField( $img.'_file_name' ) ) ), 'file_name' => basename( $this->mInfo[$img.'_file_name'] ?? '' ), 'sub_dir' => $this->getField( $img.'_attachment_id' ) ) ) - )); + $this->mInfo[$img] = \Bitweaver\Liberty\liberty_fetch_thumbnails( [ + 'source_file' => $this->getSourceFile( [ 'user_id'=>$this->getField( 'user_id' ), 'package'=>\Bitweaver\Liberty\liberty_mime_get_storage_sub_dir_name( [ 'mime_type' => $this->getField( $img.'_mime_type' ), 'name' => $this->getField( $img.'_file_name' ) ] ), 'file_name' => basename( $this->mInfo[$img.'_file_name'] ?? '' ), 'sub_dir' => $this->getField( $img.'_attachment_id' ) ] ), + ]); } } @@ -117,12 +118,12 @@ class BitBlogPost extends LibertyMime { $format = $this->mInfo['format_guid']; $linebreak = $gLibertySystem->mPlugins[$format]['linebreak']; - $parts = preg_match( "/\.[3]split\.[3](".preg_quote( $linebreak, "/" ).")[2]/i", $this->mInfo['raw'] ) - ? preg_split( "/\.[3]split\.[3](".preg_quote( $linebreak, "/" ).")[2]/i", $this->mInfo['raw'] ) + $parts = preg_match( "/\.[3]split\.[3](".preg_quote( $linebreak, "/" ).")[2]/i", $this->mInfo['raw'] ) + ? preg_split( "/\.[3]split\.[3](".preg_quote( $linebreak, "/" ).")[2]/i", $this->mInfo['raw'] ) : preg_split( "/\.[3]split\.[3]/i", $this->mInfo['raw'] ); - - $this->mInfo['raw'] = isset( $parts[0] )? $parts[0] : $this->mInfo['raw']; - $this->mInfo['raw_more'] = isset( $parts[1] )? $parts[1] : null ; + + $this->mInfo['raw'] = $parts[0] ?? $this->mInfo['raw']; + $this->mInfo['raw_more'] = $parts[1] ?? null ; } $this->mInfo['data'] = preg_replace( LIBERTY_SPLIT_REGEX, "", $this->mInfo['data'] ); @@ -190,7 +191,7 @@ class BitBlogPost extends LibertyMime { global $gBitSystem; $ret = null; if( @$this->verifyId( $pPostContentId ) ) { - $bindVars = array( (int)$pPostContentId ); + $bindVars = [ (int)$pPostContentId ]; $query = "SELECT b.`content_id` AS hash_key, bpm.*, b.*, lc.* FROM `".BIT_DB_PREFIX."blogs_posts_map` bpm INNER JOIN `".BIT_DB_PREFIX."blogs` b ON b.`content_id` = bpm.`blog_content_id` @@ -218,10 +219,10 @@ class BitBlogPost extends LibertyMime { global $gBitSystem, $gThumbSizes; $ret = null; if( !empty( $pParamHash['image_file_name'] )) { - $thumbHash = array( + $thumbHash = [ 'mime_image' => false, - 'source_file' => $pParamHash['image_file_name'] - ); + 'source_file' => $pParamHash['image_file_name'], + ]; $ret = \Bitweaver\Liberty\liberty_fetch_thumbnails( $thumbHash ); $ret['original'] = BIT_ROOT_URL.$pParamHash['image_file_name']; } @@ -281,8 +282,6 @@ class BitBlogPost extends LibertyMime { return $data; } - - /** * Make sure the data is safe to store * @param array pParamHash be sure to pass by reference in case we need to make modifcations to the hash @@ -337,10 +336,10 @@ class BitBlogPost extends LibertyMime { $dateString = $this->mDate->gmmktime( $pParamHash['publish_Hour'], $pParamHash['publish_Minute'], - isset($pParamHash['publish_Second']) ? $pParamHash['publish_Second'] : 0, + $pParamHash['publish_Second'] ?? 0, $pParamHash['publish_Month'], $pParamHash['publish_Day'], - $pParamHash['publish_Year'] + $pParamHash['publish_Year'], ); $timestamp = $this->mDate->getUTCFromDisplayDate( $dateString ); @@ -363,10 +362,10 @@ class BitBlogPost extends LibertyMime { $dateString = $this->mDate->gmmktime( $pParamHash['expire_Hour'], $pParamHash['expire_Minute'], - isset($pParamHash['expire_Second']) ? $pParamHash['expire_Second'] : 0, + $pParamHash['expire_Second'] ?? 0, $pParamHash['expire_Month'], $pParamHash['expire_Day'], - $pParamHash['expire_Year'] + $pParamHash['expire_Year'], ); $timestamp = $this->mDate->getUTCFromDisplayDate( $dateString ); @@ -397,7 +396,7 @@ class BitBlogPost extends LibertyMime { /** * Check if the current user is the blog owner */ - public function isBlogOwner( $pUserId=null ) { + public function isBlogOwner( $pUserId=null ) { $ret = false; global $gBitUser; if( empty( $pUserId ) && $gBitUser->isValid() ) { @@ -409,7 +408,6 @@ class BitBlogPost extends LibertyMime { return $ret; } - /** * Check if the current post can have comments attached to it */ @@ -504,12 +502,11 @@ class BitBlogPost extends LibertyMime { return count( $this->mErrors ) == 0; } - public function loadPostMap( $pPostContentId, $pBlogContentId){ $ret = null; if( BitBase::verifyId( $pPostContentId ) ){ $this->StartTrans(); - $result = $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."blogs_posts_map` WHERE `post_content_id`=? AND `blog_content_id`=?", array( $pPostContentId, $pBlogContentId ) ); + $result = $this->mDb->getRow( "SELECT * FROM `".BIT_DB_PREFIX."blogs_posts_map` WHERE `post_content_id`=? AND `blog_content_id`=?", [ $pPostContentId, $pBlogContentId ] ); $this->CompleteTrans(); if ( !empty( $result ) ){ $ret = $result; @@ -542,11 +539,11 @@ class BitBlogPost extends LibertyMime { }elseif ( is_array( $pBlogMixed ) ) { $blogIds = $pBlogMixed; }elseif ( is_numeric( $pBlogMixed ) ) { - $blogIds = array( $pBlogMixed ); + $blogIds = [ $pBlogMixed ]; } } $currentMappings = []; - if( $allMappings = $this->mDb->getCol( "SELECT `blog_content_id` FROM `".BIT_DB_PREFIX."blogs_posts_map` WHERE `post_content_id`=?", array( $postContentId ) ) ) { + if( $allMappings = $this->mDb->getCol( "SELECT `blog_content_id` FROM `".BIT_DB_PREFIX."blogs_posts_map` WHERE `post_content_id`=?", [ $postContentId ] ) ) { // whiddle down all mappings to just those we have perm to foreach( $allMappings as $blogContentId ) { if( $this->checkContentPermission( [ 'user_id' => $gBitUser->mUserId, 'perm_name'=>'p_blogs_post', 'content_id'=>$blogContentId ] ) ) { @@ -558,13 +555,13 @@ class BitBlogPost extends LibertyMime { // Add new mappings for this post $newBlogIds = array_diff( $blogIds, $currentMappings ); foreach( $newBlogIds as $blogContentId ) { - if( $this->verifyId( $blogContentId ) && $this->checkContentPermission( array( 'user_id' => $gBitUser->mUserId, 'perm_name'=>'p_blogs_post', 'content_id'=>$blogContentId ) ) ) { - $result = $this->mDb->associateInsert( BIT_DB_PREFIX."blogs_posts_map", array( + if( $this->verifyId( $blogContentId ) && $this->checkContentPermission( [ 'user_id' => $gBitUser->mUserId, 'perm_name'=>'p_blogs_post', 'content_id'=>$blogContentId ] ) ) { + $result = $this->mDb->associateInsert( BIT_DB_PREFIX."blogs_posts_map", [ 'post_content_id' => $postContentId, 'blog_content_id' => (int)$blogContentId, 'date_added' => $timeStamp, 'crosspost_note' => $pCrosspostNote, - )); + ]); } } @@ -576,13 +573,13 @@ class BitBlogPost extends LibertyMime { // Update existing mappings $updateBlogIds = array_intersect( $blogIds, $currentMappings ); foreach( $updateBlogIds as $blogContentId ) { - if( $this->verifyId( $blogContentId ) && $this->checkContentPermission( array( 'user_id' => $gBitUser->mUserId, 'perm_name'=>'p_blogs_post', 'content_id'=>$blogContentId ) ) ) { - $result = $this->mDb->associateUpdate( BIT_DB_PREFIX."blogs_posts_map", array( + if( $this->verifyId( $blogContentId ) && $this->checkContentPermission( [ 'user_id' => $gBitUser->mUserId, 'perm_name'=>'p_blogs_post', 'content_id'=>$blogContentId ] ) ) { + $result = $this->mDb->associateUpdate( BIT_DB_PREFIX."blogs_posts_map", [ 'crosspost_note' => $pCrosspostNote, - ), array( + ], [ 'post_content_id' => $postContentId, 'blog_content_id' => (int)$blogContentId, - )); + ]); } } } @@ -607,7 +604,7 @@ class BitBlogPost extends LibertyMime { $this->StartTrans(); if ( !empty($pBlogContentIds) ){ foreach( $pBlogContentIds as $blogContentId ) { - $this->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."blogs_posts_map` WHERE `blog_content_id`=? AND `post_content_id`=?", array( $blogContentId, $pPostContentId ) ); + $this->mDb->query( "DELETE FROM `".BIT_DB_PREFIX."blogs_posts_map` WHERE `blog_content_id`=? AND `post_content_id`=?", [ $blogContentId, $pPostContentId ] ); } } $this->CompleteTrans(); @@ -651,7 +648,6 @@ class BitBlogPost extends LibertyMime { return $ret; } - /** * Generate a valid url for the Blog * @@ -698,10 +694,10 @@ class BitBlogPost extends LibertyMime { return $ret; } - /** - * Returns include file that will - * @return string the fully specified path to file to be included - */ + /** + * Returns include file that will + * @return string the fully specified path to file to be included + */ public function getRenderFile() { return BLOGS_PKG_INCLUDE_PATH.'display_bitblogpost_inc.php'; } @@ -715,7 +711,7 @@ class BitBlogPost extends LibertyMime { //Build uri for post $parts = parse_url($_SERVER['REQUEST_URI']); $uri = KernelTools::httpPrefix(). str_replace('post', - 'view_post', $parts['path']). '?post_id=' . $this->mPostId . '&blog_id=' . $this->mInfo['blog_id']; + 'view_post', $parts['path'], ). '?post_id=' . $this->mPostId . '&blog_id=' . $this->mInfo['blog_id']; include_once UTIL_PKG_INCLUDE_PATH.'Snoopy/Snoopy.class.php'; $snoopy = new \Snoopy; @@ -809,7 +805,7 @@ class BitBlogPost extends LibertyMime { if( $pListHash['find'] ) { $findesc = '%' . strtoupper( $pListHash['find'] ) . '%'; - $whereSql .= "AND (UPPER(lc.`data`) like ?) "; + $whereSql .= "AND (UPPER(lc.`data`) like ?) "; $bindVars[] =$findesc; } @@ -934,7 +930,6 @@ class BitBlogPost extends LibertyMime { $pListHash['offset'] = $pListHash['max_records'] * $lastPageNumber; } - $result = $this->mDb->query($query,$bindVars,$pListHash['max_records'],$pListHash['offset']); $ret = []; @@ -943,10 +938,10 @@ class BitBlogPost extends LibertyMime { $res['no_fatal'] = true; $accessError = $this->invokeServices( 'content_verify_access', $res ); if( empty( $accessError ) ) { - foreach( array( 'avatar', 'image' ) as $img ) { - $res[$img] = \Bitweaver\Liberty\liberty_fetch_thumbnails( array( - 'source_file' => \Bitweaver\Liberty\liberty_mime_get_source_file( array( 'user_id'=>$res['user_id'], 'package'=>\Bitweaver\Liberty\liberty_mime_get_storage_sub_dir_name( array( 'mime_type' => $res[$img.'_mime_type'], 'name'=>$res[$img.'_file_name'] ) ), 'file_name'=>basename( $res[$img.'_file_name'] ?? '' ), 'sub_dir'=>$res[$img.'_attachment_id'] ) ) - )); + foreach( [ 'avatar', 'image' ] as $img ) { + $res[$img] = \Bitweaver\Liberty\liberty_fetch_thumbnails( [ + 'source_file' => \Bitweaver\Liberty\liberty_mime_get_source_file( [ 'user_id'=>$res['user_id'], 'package'=>\Bitweaver\Liberty\liberty_mime_get_storage_sub_dir_name( [ 'mime_type' => $res[$img.'_mime_type'], 'name'=>$res[$img.'_file_name'] ] ), 'file_name'=>basename( $res[$img.'_file_name'] ?? '' ), 'sub_dir'=>$res[$img.'_attachment_id'] ] ), + ]); } $res['thumbnail_url'] = BitBlogPost::getImageThumbnails( $res ); $res['num_comments'] = $comment->getNumComments( $res['content_id'] ); @@ -1007,8 +1002,8 @@ class BitBlogPost extends LibertyMime { $res["parsed_data"] = $accessError['access_control']; $ret[] = $res; } - } else { } + } LibertyContent::postGetList( $pListHash ); @@ -1061,7 +1056,6 @@ class BitBlogPost extends LibertyMime { return $this->getList( $pParamHash ); } - /** * Get list of posts that have expired and are not displayed on the site anymore * @@ -1074,7 +1068,6 @@ class BitBlogPost extends LibertyMime { return $this->getList( $pParamHash ); } - /** * */ @@ -1084,13 +1077,13 @@ class BitBlogPost extends LibertyMime { $aux = [ 'title' => $title, 'excerpt' => $excerpt, - 'blog_name' => $blog_name + 'blog_name' => $blog_name, ]; $tbs[$url] = $aux; $st = serialize($tbs); $query = "update `".BIT_DB_PREFIX."blog_posts` set `trackbacks_from`=? where `post_id`=?"; - $this->mDb->query( $query, array( $st, $this->mPostId ) ); + $this->mDb->query( $query, [ $st, $this->mPostId ] ); return true; } } @@ -1122,7 +1115,7 @@ class BitBlogPost extends LibertyMime { if( $this->isValid() ) { $empty = serialize([]); $query = "update `".BIT_DB_PREFIX."blog_posts` set `trackbacks_from` = ? where `post_id`=?"; - $this->mDb->query( $query, array( $empty, $this->mPostId ) ); + $this->mDb->query( $query, [ $empty, $this->mPostId ] ); } } @@ -1130,10 +1123,10 @@ class BitBlogPost extends LibertyMime { * */ public function clearTrackbacksTo() { - if( $this->isValid() ) { - $empty = serialize([]); + if( $this->isValid() ) { + $empty = serialize([]); $query = "update `".BIT_DB_PREFIX."blog_posts` set `trackbacks_to` = ? where `post_id`=?"; - $this->mDb->query( $query, array( $empty, $this->mPostId ) ); + $this->mDb->query( $query, [ $empty, $this->mPostId ] ); } } diff --git a/includes/display_bitblog_inc.php b/includes/display_bitblog_inc.php index a806fc9..5f2b249 100755 --- a/includes/display_bitblog_inc.php +++ b/includes/display_bitblog_inc.php @@ -14,13 +14,14 @@ */ namespace Bitweaver\Liberty; + use Bitweaver\KernelTools; use Bitweaver\Blogs\BitBlogPost; require_once BLOGS_PKG_INCLUDE_PATH.'lookup_blog_inc.php'; $gBitSystem->verifyPackage( 'blogs' ); -$displayHash = array( 'perm_name' => $gContent->mViewContentPerm ); +$displayHash = [ 'perm_name' => $gContent->mViewContentPerm ]; $gContent->invokeServices( 'content_display_function', $displayHash ); if( isset($_REQUEST['user_id']) && !isset( $_REQUEST['blog_id'] ) ) { diff --git a/includes/display_bitblogpost_inc.php b/includes/display_bitblogpost_inc.php index 08bd0a6..4844b6e 100755 --- a/includes/display_bitblogpost_inc.php +++ b/includes/display_bitblogpost_inc.php @@ -7,7 +7,6 @@ /** * required setup */ -use Bitweaver\Blogs\BitBlog; use Bitweaver\KernelTools; use \Bitweaver\Liberty\LibertyContent; @@ -25,10 +24,10 @@ if (!isset($gContent->mPostId)) { if (isset($_REQUEST['url'])) { // Add a trackback ping to the list of trackback_from - $title = isset($_REQUEST['title']) ? $_REQUEST['title'] : ''; + $title = $_REQUEST['title'] ?? ''; - $excerpt = isset($_REQUEST['excerpt']) ? $_REQUEST['excerpt'] : ''; - $blog_name = isset($_REQUEST['blog_name']) ? $_REQUEST['blog_name'] : ''; + $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"?>'; @@ -78,14 +77,14 @@ if ( empty( $_REQUEST['format'] ) || $_REQUEST['format'] == "full" || $_REQUEST[ } 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 ); + $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"){ +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' ] ); diff --git a/includes/lookup_post_inc.php b/includes/lookup_post_inc.php index efa3f90..f5475b0 100755 --- a/includes/lookup_post_inc.php +++ b/includes/lookup_post_inc.php @@ -7,17 +7,17 @@ /** * Initial Setup */ -global $gContent; +global $gContent; use Bitweaver\Blogs\BitBlogPost; use Bitweaver\BitBase; require_once LIBERTY_PKG_INCLUDE_PATH.'lookup_content_inc.php'; if( empty( $gContent ) || !is_object( $gContent ) || !$gContent->isValid() ) { // if blog_id supplied, use that - if( BitBase::verifyId( $_REQUEST['post_id'] ?? 0 ) ) { + if( BitBase::verifyId( $_REQUEST['post_id'] ?? 0 ) ) { $gContent = new BitBlogPost( $_REQUEST['post_id'] ); $gContent->load(); - } elseif( BitBase::verifyId( $_REQUEST['content_id'] ?? 0 ) ) { + } elseif( BitBase::verifyId( $_REQUEST['content_id'] ?? 0 ) ) { $gContent = new BitBlogPost( null, $_REQUEST['content_id'] ); $gContent->load(); } else { |
