Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\blog\modules\front\blogs;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -72,42 +72,47 @@ class _entry extends \IPS\Content\Controller
|
||||
protected function manage()
|
||||
{
|
||||
parent::manage();
|
||||
|
||||
$this->entry->container()->clubCheckRules();
|
||||
|
||||
$previous = NULL;
|
||||
$next = NULL;
|
||||
|
||||
|
||||
/* Prev */
|
||||
try
|
||||
{
|
||||
$previous = \IPS\Db::i()->select(
|
||||
'*',
|
||||
'blog_entries',
|
||||
array( 'entry_blog_id=? AND entry_date<? AND entry_status=? AND entry_is_future_entry=0', $this->entry->blog_id, $this->entry->date, "published" ),
|
||||
'entry_date DESC'
|
||||
,1
|
||||
)->first();
|
||||
|
||||
$previous = \IPS\Db::i()->select(
|
||||
'*',
|
||||
'blog_entries',
|
||||
array( 'entry_blog_id=? AND entry_date<? AND entry_status=? AND entry_is_future_entry=0 AND entry_hidden=?', $this->entry->blog_id, $this->entry->date, "published", 1 ),
|
||||
'entry_date DESC'
|
||||
,1
|
||||
)->first();
|
||||
|
||||
$previous = \IPS\blog\Entry::constructFromData( $previous );
|
||||
}
|
||||
catch ( \UnderflowException $e ) {}
|
||||
|
||||
|
||||
/* Next */
|
||||
try
|
||||
{
|
||||
$next = \IPS\Db::i()->select(
|
||||
'*',
|
||||
'blog_entries',
|
||||
array( 'entry_blog_id=? AND entry_date>? AND entry_status=? AND entry_is_future_entry=0', $this->entry->blog_id, $this->entry->date, "published" ),
|
||||
'entry_date ASC'
|
||||
,1
|
||||
)->first();
|
||||
|
||||
$next = \IPS\Db::i()->select(
|
||||
'*',
|
||||
'blog_entries',
|
||||
array( 'entry_blog_id=? AND entry_date>? AND entry_status=? AND entry_is_future_entry=0 AND entry_hidden=?', $this->entry->blog_id, $this->entry->date, "published", 1 ),
|
||||
'entry_date ASC'
|
||||
,1
|
||||
)->first();
|
||||
|
||||
$next = \IPS\blog\Entry::constructFromData( $next );
|
||||
}
|
||||
catch ( \UnderflowException $e ) {}
|
||||
|
||||
/* Online User Location */
|
||||
\IPS\Session::i()->setLocation( $this->entry->url(), $this->entry->onlineListPermissions(), 'loc_blog_viewing_entry', array( $this->entry->name => FALSE ) );
|
||||
if( !$this->entry->container()->social_group )
|
||||
{
|
||||
\IPS\Session::i()->setLocation( $this->entry->url(), $this->entry->onlineListPermissions(), 'loc_blog_viewing_entry', array( $this->entry->name => FALSE ) );
|
||||
}
|
||||
|
||||
/* Add JSON-ld output */
|
||||
\IPS\Output::i()->jsonLd['blog'] = array(
|
||||
@@ -146,7 +151,7 @@ class _entry extends \IPS\Content\Controller
|
||||
'mainEntityOfPage' => (string) $this->entry->url(),
|
||||
'name' => $this->entry->mapped('title'),
|
||||
'headline' => $this->entry->mapped('title'),
|
||||
'articleBody' => strip_tags( $this->entry->truncated() ),
|
||||
'articleBody' => $this->entry->truncated( TRUE, NULL ),
|
||||
'commentCount' => $this->entry->mapped('num_comments'),
|
||||
'dateCreated' => \IPS\DateTime::ts( $this->entry->date )->format( \IPS\DateTime::ISO8601 ),
|
||||
'datePublished' => \IPS\DateTime::ts( $this->entry->publish_date )->format( \IPS\DateTime::ISO8601 ),
|
||||
@@ -157,13 +162,12 @@ class _entry extends \IPS\Content\Controller
|
||||
'image' => \IPS\Member::load( $this->entry->mapped('author') )->get_photo()
|
||||
),
|
||||
'publisher' => array(
|
||||
'@type' => 'Organization',
|
||||
'name' => \IPS\Member::load( $this->entry->mapped('author') )->name,
|
||||
'url' => (string) \IPS\Member::load( $this->entry->mapped('author') )->url(),
|
||||
'image' => \IPS\Member::load( $this->entry->mapped('author') )->get_photo(),
|
||||
'logo' => array(
|
||||
'@type' => 'ImageObject',
|
||||
'url' => \IPS\Member::load( $this->entry->mapped('author') )->get_photo(),
|
||||
'@id' => \IPS\Settings::i()->base_url . '#organization',
|
||||
'member' => array(
|
||||
'@type' => 'Person',
|
||||
'name' => \IPS\Member::load( $this->entry->mapped('author') )->name,
|
||||
'url' => (string) \IPS\Member::load( $this->entry->mapped('author') )->url(),
|
||||
'image' => \IPS\Member::load( $this->entry->mapped('author') )->get_photo()
|
||||
)
|
||||
),
|
||||
'interactionStatistic' => array(
|
||||
@@ -257,6 +261,35 @@ class _entry extends \IPS\Content\Controller
|
||||
{
|
||||
\IPS\Output::i()->sidebar['contextual'] = \IPS\Theme::i()->getTemplate('view')->blogSidebar( $this->entry->container()->sidebar );
|
||||
}
|
||||
|
||||
/* Breadcrumb */
|
||||
\IPS\Output::i()->breadcrumb = array();
|
||||
\IPS\Output::i()->breadcrumb['module'] = array( \IPS\Http\Url::internal( 'app=blog', 'front' ), \IPS\Member::loggedIn()->language()->addToStack( '__app_blog' ) );
|
||||
|
||||
try
|
||||
{
|
||||
foreach( $this->entry->container()->category()->parents() as $parent )
|
||||
{
|
||||
\IPS\Output::i()->breadcrumb[] = array( $parent->url(), $parent->_title );
|
||||
}
|
||||
\IPS\Output::i()->breadcrumb[] = array( $this->entry->container()->category()->url(), $this->entry->container()->category()->_title );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) {}
|
||||
|
||||
\IPS\Output::i()->breadcrumb[] = array( $this->entry->container()->url(), $this->entry->container()->_title );
|
||||
\IPS\Output::i()->breadcrumb[] = array( NULL, $this->entry->name );
|
||||
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'view' )->entry( $this->entry, $previous, $next );
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the form for editing. Abstracted so controllers can define a custom template if desired.
|
||||
*
|
||||
* @param \IPS\Helpers\Form $form The form
|
||||
* @return string
|
||||
*/
|
||||
protected function getEditForm( $form )
|
||||
{
|
||||
return $form->customTemplate( array( \IPS\Theme::i()->getTemplate( 'submit', 'blog' ), 'submitFormTemplate' ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user