Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -193,22 +193,26 @@ class _Feed extends \IPS\Node\Model
|
||||
|
||||
if ( $response->httpResponseCode == 401 )
|
||||
{
|
||||
throw new \DomainException('rss_import_auth');
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_auth' ) );
|
||||
}
|
||||
|
||||
$response = $response->decodeXml();
|
||||
if ( !( $response instanceof \IPS\Xml\Rss ) and !( $response instanceof \IPS\Xml\Atom ) )
|
||||
{
|
||||
throw new \DomainException('rss_import_invalid');
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_invalid' ) );
|
||||
}
|
||||
}
|
||||
catch ( \IPS\Http\Request\Exception $e )
|
||||
{
|
||||
throw new \DomainException( 'form_url_bad' );
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'form_url_bad' ) );
|
||||
}
|
||||
catch( \RuntimeException $e )
|
||||
{
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_invalid' ) );
|
||||
}
|
||||
catch ( \ErrorException $e )
|
||||
{
|
||||
throw new \DomainException( 'rss_import_invalid' );
|
||||
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'rss_import_invalid' ) );
|
||||
}
|
||||
|
||||
$values['title'] = (string) $request->get()->decodeXml()->channel->title;
|
||||
@@ -274,15 +278,22 @@ class _Feed extends \IPS\Node\Model
|
||||
$inserts = array();
|
||||
$request = $request->decodeXml();
|
||||
|
||||
if( !( $request instanceof \IPS\Xml\RssOne ) AND !( $request instanceof \IPS\Xml\Rss ) AND !( $request instanceof \IPS\Xml\Atom ) )
|
||||
if( !( $request instanceof \IPS\Xml\Rss1 ) AND !( $request instanceof \IPS\Xml\Rss ) AND !( $request instanceof \IPS\Xml\Atom ) )
|
||||
{
|
||||
throw new \RuntimeException( 'rss_import_invalid' );
|
||||
}
|
||||
|
||||
|
||||
$post = NULL;
|
||||
foreach ( $request->articles( $this->id ) as $guid => $article )
|
||||
{
|
||||
if ( !in_array( $guid, $previouslyImportedGuids ) )
|
||||
{
|
||||
/* Don't post future date content - this breaks things like marking as read */
|
||||
if( $article['date']->getTimestamp() > time() )
|
||||
{
|
||||
$artice['date'] = \IPS\DateTime::create();
|
||||
}
|
||||
|
||||
$topic = \IPS\forums\Topic::createItem( \IPS\Member::load( $this->mid ), NULL, $article['date'], $container, $this->topic_hide );
|
||||
$topic->title = $this->topic_pre . $article['title'];
|
||||
if ( !$this->topic_open )
|
||||
@@ -290,6 +301,13 @@ class _Feed extends \IPS\Node\Model
|
||||
$topic->state = 'closed';
|
||||
}
|
||||
$topic->save();
|
||||
|
||||
/* Send notifications */
|
||||
if ( !$this->topic_hide )
|
||||
{
|
||||
$topic->sendNotifications();
|
||||
}
|
||||
|
||||
|
||||
/* Add to search index */
|
||||
\IPS\Content\Search\Index::i()->index( $topic );
|
||||
@@ -347,9 +365,12 @@ class _Feed extends \IPS\Node\Model
|
||||
|
||||
$this->last_import = time();
|
||||
$this->save();
|
||||
|
||||
$container->setLastComment();
|
||||
$container->save();
|
||||
|
||||
if ( $post !== NULL )
|
||||
{
|
||||
$container->setLastComment( $post );
|
||||
$container->save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user