Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+37 -6
View File
@@ -2,9 +2,9 @@
/**
* @brief Blog RSS/Atom feed active record
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Blog
* @since 02 Apr 2014
* @version SVN_VERSION_NUMBER
@@ -43,10 +43,16 @@ class _Feed extends \IPS\Patterns\ActiveRecord
* Run
*
* @return void
* @throws \UnexpectedValueException
* @throws \IPS\Http\Url\Exception|\RuntimeException
*/
public function run()
{
/* Skip this if the member is restricted from posting */
if( \IPS\Member::load( $this->member )->restrict_post or \IPS\Member::load( $this->member )->members_bitoptions['unacknowledged_warnings'] )
{
return;
}
$previouslyImportedGuids = iterator_to_array( \IPS\Db::i()->select( 'rss_imported_guid', 'blog_rss_imported', array( 'rss_imported_impid=?', $this->id ) ) );
$request = \IPS\Http\Url::external( $this->url )->request();
@@ -60,18 +66,43 @@ class _Feed extends \IPS\Patterns\ActiveRecord
$inserts=array();
$i = 0;
foreach ( $request->decodeXml()->articles( $this->id ) as $guid => $article )
$request = $request->decodeXml();
if( !( $request instanceof \IPS\Xml\RssOne ) AND !( $request instanceof \IPS\Xml\Rss ) AND !( $request instanceof \IPS\Xml\Atom ) )
{
throw new \RuntimeException( 'rss_import_invalid' );
}
foreach ( $request->articles( $this->id ) as $guid => $article )
{
if ( !in_array( $guid, $previouslyImportedGuids ) )
{
$entry = \IPS\blog\Entry::createItem( \IPS\Member::load( $this->member ), NULL, $article['date'], $container );
$entry->name = $article['title'];
$entry->content = \IPS\Text\Parser::parseStatic( $article['content'] );
$entry->content = \IPS\Text\Parser::parseStatic( $article['content'], TRUE );
if ( $article['link'] )
{
$rel = array();
if( \IPS\Settings::i()->posts_add_nofollow )
{
$rel['nofollow'] = 'nofollow';
}
if( \IPS\Settings::i()->links_external )
{
$rel['external'] = 'external';
}
$linkRelPart = '';
if ( count ( $rel ) )
{
$linkRelPart = 'rel="' . implode($rel, ' ') . '"';
}
$link = htmlspecialchars( $this->import_show_link, ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE );
$entry->content .= "<br><p><a href='{$article['link']}'>{$link}</a></p>";
$entry->content .= "<br><p><a href='{$article['link']}' {$linkRelPart}>{$link}</a></p>";
}
$entry->status = 'published';