Version 2.2.0 RC-1
This commit is contained in:
1 parent
f73f8bff6d
commit
22f1b963ee
1034 files changed
+178610
-70897
No files matched your search
@@ -2,26 +2,17 @@
|
||||
|
||||
/*
|
||||
+--------------------------------------------------------------------------
|
||||
| Invision Power Board 2.1.7
|
||||
| Invision Power Board
|
||||
| =============================================
|
||||
| by Matthew Mecham
|
||||
| (c) 2001 - 2005 Invision Power Services, Inc.
|
||||
| (c) 2001 - 2006 Invision Power Services, Inc.
|
||||
| http://www.invisionpower.com
|
||||
| =============================================
|
||||
| Web: http://www.invisionboard.com
|
||||
| http://www.ibresource.ru/products/invisionpowerboard/
|
||||
| Time: Tuesday 18th of July 2006 05:56:00 PM
|
||||
| Release: 52f408a29988b02f45b5e6f4ba5af0ae
|
||||
| Licence Info: http://www.invisionboard.com/?license
|
||||
| http://www.ibresource.ru/license
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD IS NOT FREE / OPEN SOURCE!
|
||||
+---------------------------------------------------------------------------
|
||||
| INVISION POWER BOARD ÍÅ ßÂËßÅÒÑß ÁÅÑÏËÀÒÍÛÌ ÏÐÎÃÐÀÌÌÍÛÌ ÎÁÅÑÏÅ×ÅÍÈÅÌ!
|
||||
| Ïðàâà íà ÏÎ ïðèíàäëåæàò Invision Power Services
|
||||
+---------------------------------------------------------------------------
|
||||
| > $Date: 2006-01-31 22:47:20 +0000 (Tue, 31 Jan 2006) $
|
||||
| > $Revision: 131 $
|
||||
| > $Date: 2006-10-11 19:01:38 +0100 (Wed, 11 Oct 2006) $
|
||||
| > $Revision: 628 $
|
||||
| > $Author: bfarber $
|
||||
+---------------------------------------------------------------------------
|
||||
|
|
||||
@@ -33,7 +24,7 @@
|
||||
|
||||
if ( ! defined( 'IN_ACP' ) )
|
||||
{
|
||||
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
|
||||
print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded 'admin.php'.";
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -41,16 +32,19 @@ class ad_rssimport
|
||||
{
|
||||
# Globals
|
||||
var $ipsclass;
|
||||
var $class_rss;
|
||||
|
||||
var $perm_main = 'content';
|
||||
var $perm_child = 'rssimport';
|
||||
var $perm_main = 'content';
|
||||
var $perm_child = 'rssimport';
|
||||
|
||||
var $use_sockets = 1;
|
||||
var $use_sockets = 1;
|
||||
var $func_mod;
|
||||
var $classes_loaded = 0;
|
||||
|
||||
var $import_count = 0;
|
||||
|
||||
var $validate_msg = array();
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// Main handler
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -58,6 +52,7 @@ class ad_rssimport
|
||||
function auto_run()
|
||||
{
|
||||
$this->html = $this->ipsclass->acp_load_template('cp_skin_rss');
|
||||
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code, 'RSS Import Manager' );
|
||||
|
||||
//--------------------------------------------
|
||||
// Load classes
|
||||
@@ -77,6 +72,11 @@ class ad_rssimport
|
||||
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
|
||||
$this->rssimport_overview();
|
||||
break;
|
||||
|
||||
case 'rssimport_validate':
|
||||
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
|
||||
$this->rssimport_validate( 1 );
|
||||
break;
|
||||
|
||||
case 'rssimport_add':
|
||||
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
|
||||
@@ -144,7 +144,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! $rssstream['rss_import_id'] )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íåâîçìîæíî çàãðóçèòü ñòðîêó RSS èç áàçû äàííûõ. Âîçìîæíî, åå ïðîñòî íåò.";
|
||||
$this->ipsclass->main_msg = "Could not load the RSS stream from the database. It maybe missing.";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class ad_rssimport
|
||||
|
||||
$this->ipsclass->DB->build_and_exec_query( array( 'delete' => 'rss_import', 'where' => 'rss_import_id='.$rss_import_id ) );
|
||||
|
||||
$this->ipsclass->main_msg = "Èñïîðò RSS ñòðîêè óäàëåí";
|
||||
$this->ipsclass->main_msg = "RSS Import stream removed.";
|
||||
$this->rssimport_overview();
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! $rssstream['rss_import_id'] )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íåâîçìîæíî çàãðóçèòü ñòðîêó RSS èç áàçû äàííûõ. Âîçìîæíî, åå ïðîñòî íåò.";
|
||||
$this->ipsclass->main_msg = "Could not load the RSS stream from the database. It maybe missing.";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ class ad_rssimport
|
||||
{
|
||||
if ( $return )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íåëüçÿ îïðåäåëèòü ìåñòî ðàñïîëîæåíèå òåì äëÿ óäàëåíèÿ";
|
||||
$this->ipsclass->main_msg = "Could not locate any topics to delete";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ class ad_rssimport
|
||||
|
||||
$this->ipsclass->DB->build_and_exec_query( array( 'delete' => 'rss_imported', 'where' => 'rss_imported_tid IN('.implode(',',$remove_tids).')' ) );
|
||||
|
||||
$this->ipsclass->main_msg = intval(count($remove_tids))." òåì óäàëåíî.";
|
||||
$this->ipsclass->main_msg = intval(count($remove_tids))." topics removed.";
|
||||
$this->rssimport_overview();
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! $rss_import_id )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
|
||||
$this->ipsclass->main_msg = "No ID was passed, please try again";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -269,7 +269,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! $rssstream['rss_import_id'] )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íåâîçìîæíî çàãðóçèòü ñòðîêó RSS èç áàçû äàííûõ. Âîçìîæíî, åå ïðîñòî íåò.";
|
||||
$this->ipsclass->main_msg = "Could not load the RSS stream from the database. It maybe missing.";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ class ad_rssimport
|
||||
|
||||
if ( $article_count['cnt'] < 1 )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Èìïîðò RSS ñòðîêè '{$rssstream['rss_import_title']}' íå áûë ïðîèçâåäåí.";
|
||||
$this->ipsclass->main_msg = "The RSS Import Stream '{$rssstream['rss_import_title']}' has no imported articles to remove.";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -297,13 +297,11 @@ class ad_rssimport
|
||||
|
||||
$this->ipsclass->html .= $this->html->rss_import_remove_articles_form( $rssstream, intval($article_count['cnt']) );
|
||||
|
||||
$this->ipsclass->admin->page_title = "Óïðàâëåíèå èìïîðòîì RSS";
|
||||
$this->ipsclass->admin->page_detail = "Â ýòîé ñåêöèè âû ìîæåòå óäàëÿòü óæå ñîçäàííûå ñòàòüè.";
|
||||
$this->ipsclass->admin->page_title = "RSS Import Manager";
|
||||
$this->ipsclass->admin->page_detail = "This section will allow you to remove already posted articles.";
|
||||
|
||||
$this->ipsclass->admin->nav[] = array( "{$this->ipsclass->form_code}", "Óïðàâëåíèå èìïîðòîì RSS" );
|
||||
$this->ipsclass->admin->nav[] = array( '', "Remove RSS Articles" );
|
||||
$this->ipsclass->admin->output();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@@ -334,7 +332,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! $rss_import_id )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
|
||||
$this->ipsclass->main_msg = "No ID was passed, please try again";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -382,7 +380,7 @@ class ad_rssimport
|
||||
//-----------------------------------------
|
||||
|
||||
require_once( ROOT_PATH."sources/classes/class_email.php" );
|
||||
$this->email = new emailer();
|
||||
$this->email = new emailer( ROOT_PATH );
|
||||
$this->email->ipsclass =& $this->ipsclass;
|
||||
$this->email->email_init();
|
||||
|
||||
@@ -397,8 +395,6 @@ class ad_rssimport
|
||||
$this->parser->ipsclass =& $this->ipsclass;
|
||||
$this->parser->allow_update_caches = 0;
|
||||
|
||||
$this->parser->bypass_badwords = intval($this->ipsclass->member['g_bypass_badwords']);
|
||||
|
||||
//--------------------------------------------
|
||||
// Not loaded the func?
|
||||
//--------------------------------------------
|
||||
@@ -417,7 +413,7 @@ class ad_rssimport
|
||||
// Init forums if not already done so
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! is_array( $this->ipsclass->forum_by_id ) )
|
||||
if ( ! is_array( $this->ipsclass->forums->forum_by_id ) OR !count( $this->ipsclass->forums->forum_by_id ) )
|
||||
{
|
||||
$this->ipsclass->forums->forums_init();
|
||||
}
|
||||
@@ -431,35 +427,31 @@ class ad_rssimport
|
||||
|
||||
while( $row = $this->ipsclass->DB->fetch_row( $outer ) )
|
||||
{
|
||||
if ( $rss_import_id == 'all' OR $row['rss_import_id'] == $rss_import_id OR ( $id_is_array ==1 AND in_array( $row['rss_import_id'], $rss_import_ids ) ) )
|
||||
if ( $rss_import_id == 'all' OR $row['rss_import_id'] == $rss_import_id OR ( $id_is_array == 1 AND in_array( $row['rss_import_id'], $rss_import_ids ) ) )
|
||||
{
|
||||
// Skip non-existent forums - bad stuff happens
|
||||
|
||||
if( !array_key_exists( $row['rss_import_forum_id'], $this->ipsclass->cache['forum_cache'] ) )
|
||||
if ( !array_key_exists( $row['rss_import_forum_id'], $this->ipsclass->cache['forum_cache'] ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//-----------------------------------------
|
||||
// Allowing badwords?
|
||||
//-----------------------------------------
|
||||
|
||||
$this->parser->bypass_badwords = $row['rss_import_allow_html'];
|
||||
|
||||
//--------------------------------------------
|
||||
// Set this import's doctype
|
||||
//--------------------------------------------
|
||||
|
||||
$supported_encodings = array( 'utf-8', 'iso-8859-1', 'us-ascii' );
|
||||
$this->class_rss->doc_type = $this->ipsclass->vars['gb_char_set'];
|
||||
$this->class_rss->feed_charset = $row['rss_import_charset'];
|
||||
|
||||
if( in_array( strtolower($this->ipsclass->vars['gb_char_set']), $supported_encodings ) )
|
||||
{
|
||||
$this->class_rss->doc_type = $this->ipsclass->vars['gb_char_set'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->class_rss->doc_type = 'UTF-8';
|
||||
}
|
||||
|
||||
if( strtolower($row['rss_import_charset']) != $this->class_rss->doc_type )
|
||||
if( strtolower($row['rss_import_charset']) != $this->ipsclass->vars['gb_char_set'] )
|
||||
{
|
||||
$this->class_rss->convert_charset = 1;
|
||||
$this->class_rss->feed_charset = $row['rss_import_charset'];
|
||||
$this->class_rss->destination_charset = $this->class_rss->doc_type;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -468,14 +460,16 @@ class ad_rssimport
|
||||
|
||||
//--------------------------------------------
|
||||
// Set this import's authentication
|
||||
//--------------------------------------------
|
||||
$this->class_rss->auth_req = $row['rss_import_auth'];
|
||||
//--------------------------------------------
|
||||
|
||||
$this->class_rss->auth_req = $row['rss_import_auth'];
|
||||
$this->class_rss->auth_user = $row['rss_import_auth_user'];
|
||||
$this->class_rss->auth_pass = $row['rss_import_auth_pass'];
|
||||
|
||||
//--------------------------------------------
|
||||
// Clear RSS object's error cache first
|
||||
//--------------------------------------------
|
||||
|
||||
$this->class_rss->errors = array();
|
||||
$this->class_rss->rss_items = array();
|
||||
|
||||
@@ -507,7 +501,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! is_array( $this->class_rss->rss_channels ) or ! count( $this->class_rss->rss_channels ) )
|
||||
{
|
||||
$rss_error[] = "Íåëüçÿ îòêðûòü {$row['rss_import_url']} äëÿ ëîêàëüíûõ êàíàëîâ.";
|
||||
$rss_error[] = "Could not open {$row['rss_import_url']} to locate channels.";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -530,7 +524,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! is_array( $this->class_rss->rss_items ) or ! count( $this->class_rss->rss_items ) )
|
||||
{
|
||||
$rss_error[] = "{$row['rss_import_url']} – íåò ïðåäìåòîâ äëÿ èìïîðòà";
|
||||
$rss_error[] = "{$row['rss_import_url']} has no items to import";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -538,7 +532,7 @@ class ad_rssimport
|
||||
{
|
||||
if ( is_array( $this->class_rss->rss_items[ $channel_id ] ) and count ($this->class_rss->rss_items[ $channel_id ] ) )
|
||||
{
|
||||
foreach( $this->class_rss->rss_items[ $channel_id ] as $item_id => $item_data )
|
||||
foreach( $this->class_rss->rss_items[ $channel_id ] as $item_data )
|
||||
{
|
||||
$item_data['content'] = $item_data['content'] ? $item_data['content'] : $item_data['description'];
|
||||
$item_data['guid'] = md5( $item_data['guid'] ? $item_data['guid'] : preg_replace( "#\s|\r|\n#is", "", $item_data['title'].$item_data['link'].$item_data['description'] ) );
|
||||
@@ -550,17 +544,8 @@ class ad_rssimport
|
||||
|
||||
if ( $row['rss_import_charset'] AND ( strtolower($row['rss_import_charset']) != strtolower($this->class_rss->doc_type) ) )
|
||||
{
|
||||
if ( ! is_object( $this->class_convert_charset ) )
|
||||
{
|
||||
require_once( IPS_CLASSES_PATH.'/class_convert_charset.php' );
|
||||
$this->class_convert_charset = new class_convert_charset();
|
||||
}
|
||||
|
||||
$item_data['title'] = $this->class_convert_charset->convert_charset( $item_data['title'], $this->class_rss->doc_type, $row['rss_import_charset'] );
|
||||
$item_data['content'] = $this->class_convert_charset->convert_charset( $item_data['content'], $this->class_rss->doc_type, $row['rss_import_charset'] );
|
||||
|
||||
//$item_data['title'] = $this->ipsclass->txt_convert_charsets( $item_data['title'], strtolower($row['rss_import_charset']) );
|
||||
//$item_data['content'] = $this->ipsclass->txt_convert_charsets( $item_data['content'], strtolower($row['rss_import_charset']) );
|
||||
$item_data['title'] = $this->ipsclass->txt_convert_charsets( $item_data['title'], $this->class_rss->doc_type );
|
||||
$item_data['content'] = $this->ipsclass->txt_convert_charsets( $item_data['content'], $this->class_rss->doc_type );
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
@@ -579,7 +564,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! $item_data['title'] OR ! $item_data['content'] )
|
||||
{
|
||||
$rss_error[] = "Ïðîïóùåíî: '{$item_data['title']}' - íåò íàçâàíèÿ èëè ñîäåðæàíèÿ";
|
||||
$rss_error[] = "Skipping '{$item_data['title']}' no title or content";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -596,7 +581,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! count( $check_guids ) )
|
||||
{
|
||||
$rss_error[] = "Íåò RSS çàïèñåé äëÿ èìïîðòèðîâàíèÿ!";
|
||||
$rss_error[] = "No RSS items to import";
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -668,7 +653,7 @@ class ad_rssimport
|
||||
// Figure out MID
|
||||
//--------------------------------------------
|
||||
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'id, name, members_display_name', 'from' => 'members', 'where' => "id={$row['rss_import_mid']}" ) );
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'id, name, members_display_name, ip_address', 'from' => 'members', 'where' => "id={$row['rss_import_mid']}" ) );
|
||||
|
||||
if ( ! $member['id'] )
|
||||
{
|
||||
@@ -681,17 +666,18 @@ class ad_rssimport
|
||||
|
||||
$affected_forum_ids[] = $row['rss_import_forum_id'];
|
||||
|
||||
foreach( $final_items as $date => $topic_item )
|
||||
foreach( $final_items as $topic_item )
|
||||
{
|
||||
# Fix &
|
||||
$topic_item['title'] = str_replace( '&', '&', $topic_item['title'] );
|
||||
$topic_item['title'] = strip_tags( $topic_item['title'] );
|
||||
$topic_item['title'] = $this->ipsclass->parse_clean_value( $topic_item['title'] );
|
||||
|
||||
# Fix up &reg;
|
||||
$topic_item['title'] = str_replace( '&reg;', '®', $topic_item['title'] );
|
||||
|
||||
$topic = array(
|
||||
'title' => str_replace( ' ', ' ', str_replace( '&nbsp;', ' ', $row['rss_import_topic_pre'] ) ) . $topic_item['title'],
|
||||
'title' => str_replace( ' ', ' ', str_replace( '&nbsp;', ' ', $row['rss_import_topic_pre'] ) ) .' '. $topic_item['title'],
|
||||
'description' => '' ,
|
||||
'state' => $row['rss_import_topic_open'] ? 'open' : 'closed',
|
||||
'posts' => 0,
|
||||
@@ -757,7 +743,7 @@ class ad_rssimport
|
||||
'author_id' => $member['id'],
|
||||
'use_sig' => 1,
|
||||
'use_emo' => 1,
|
||||
'ip_address' => $this->ipsclass->ip_address,
|
||||
'ip_address' => $member['ip_address'],
|
||||
'post_date' => $topic_item['unixdate'],
|
||||
'icon_id' => 0,
|
||||
'post' => $post_content,
|
||||
@@ -816,7 +802,7 @@ class ad_rssimport
|
||||
// Are we tracking this forum? If so generate some mailies - yay!
|
||||
//-----------------------------------------
|
||||
|
||||
$this->post->forum_tracker( $row['rss_import_forum_id'], $topic['tid'], $topic['title'], $this->ipsclass->forum->forum_by_id[ $row['rss_import_forum_id'] ], $post['post'] );
|
||||
$this->post->forum_tracker( $row['rss_import_forum_id'], $topic['tid'], $topic['title'], $this->ipsclass->cache['forum_cache'][ $row['rss_import_forum_id'] ], $post['post'] );
|
||||
|
||||
$this->import_count++;
|
||||
|
||||
@@ -824,7 +810,7 @@ class ad_rssimport
|
||||
// Increment user?
|
||||
//--------------------------------------------
|
||||
|
||||
if ( $row['rss_import_inc_pcount'] AND $this->ipsclass->forums->forum_by_id[ $row['rss_import_forum_id'] ]['inc_postcount'] )
|
||||
if ( $row['rss_import_inc_pcount'] AND $this->ipsclass->cache['forum_cache'][ $row['rss_import_forum_id'] ]['inc_postcount'] )
|
||||
{
|
||||
if ( ! $affected_members[ $member['id'] ] OR $affected_members[ $member['id'] ] < 0 )
|
||||
{
|
||||
@@ -859,7 +845,7 @@ class ad_rssimport
|
||||
|
||||
if ( is_array( $affected_forum_ids ) and count( $affected_forum_ids ) )
|
||||
{
|
||||
foreach( $affected_forum_ids as $i => $fid )
|
||||
foreach( $affected_forum_ids as $fid )
|
||||
{
|
||||
$this->func_mod->forum_recount( $fid );
|
||||
}
|
||||
@@ -873,7 +859,7 @@ class ad_rssimport
|
||||
|
||||
if ( $return )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Èìïîðò RSS, êåø ïåðåñ÷èòàí";
|
||||
$this->ipsclass->main_msg = "RSS Import(s) Re-cached";
|
||||
|
||||
if ( count( $rss_error ) )
|
||||
{
|
||||
@@ -895,6 +881,22 @@ class ad_rssimport
|
||||
|
||||
function rssimport_save($type='add')
|
||||
{
|
||||
//--------------------------------------------
|
||||
// Do we want to validate?
|
||||
//--------------------------------------------
|
||||
|
||||
if( isset($this->ipsclass->input['rssimport_validate']) AND $this->ipsclass->input['rssimport_validate'] )
|
||||
{
|
||||
$this->rssimport_validate();
|
||||
|
||||
if( count($this->validate_msg) )
|
||||
{
|
||||
$this->ipsclass->main_msg = "<b>Validation Results for <span class='rss-feed-url'>".$this->ipsclass->txt_stripslashes( trim( $_POST['rss_import_url'] ) )."</span></b><br /> ·".implode( "<br /> ·", $this->validate_msg );
|
||||
$this->rssimport_form( $type );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// INIT
|
||||
//--------------------------------------------
|
||||
@@ -915,8 +917,8 @@ class ad_rssimport
|
||||
$rss_import_charset = $this->ipsclass->input['rss_import_charset'];
|
||||
$rss_import_allow_html = intval($this->ipsclass->input['rss_import_allow_html']);
|
||||
$rss_import_auth = intval($this->ipsclass->input['rss_import_auth']);
|
||||
$rss_import_auth_user = trim($this->ipsclass->input['rss_import_auth_user']) ? trim($this->ipsclass->input['rss_import_auth_user']) : 'Íå òðåáóåòñÿ';
|
||||
$rss_import_auth_pass = trim($this->ipsclass->input['rss_import_auth_pass']) ? trim($this->ipsclass->input['rss_import_auth_pass']) : 'Íå òðåáóåòñÿ';
|
||||
$rss_import_auth_user = trim($this->ipsclass->input['rss_import_auth_user']) ? trim($this->ipsclass->input['rss_import_auth_user']) : 'Not Needed';
|
||||
$rss_import_auth_pass = trim($this->ipsclass->input['rss_import_auth_pass']) ? trim($this->ipsclass->input['rss_import_auth_pass']) : 'Not Needed';
|
||||
|
||||
$rss_error = array();
|
||||
|
||||
@@ -928,7 +930,7 @@ class ad_rssimport
|
||||
{
|
||||
if ( ! $rss_import_id )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
|
||||
$this->ipsclass->main_msg = "No ID was passed, please try again";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -936,20 +938,11 @@ class ad_rssimport
|
||||
|
||||
if ( ! $rss_import_title OR ! $rss_import_url OR ! $rss_import_pergo OR ! $rss_import_forum_id OR ! $rss_import_mid )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Âû äîëæíû çàïîëíèòü âñå ïîëÿ.";
|
||||
$this->ipsclass->main_msg = "You must complete the entire form.";
|
||||
$this->rssimport_form( $type );
|
||||
return;
|
||||
}
|
||||
|
||||
/* - No longer needed due to the advanced charset support now
|
||||
if( strtolower($rss_import_charset) != 'utf-8' && strtolower($rss_import_charset) != 'iso-8859-1' && strtolower($rss_import_charset) != 'us-ascii' )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Òîëüêî êîäèðîâêè UTF-8, ISO-8859-1 è US-ASCII ïîääåðæèâàþòñÿ RSS ëåíòàìè.";
|
||||
$this->rssimport_form( $type );
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
//--------------------------------------------
|
||||
// Load classes
|
||||
//--------------------------------------------
|
||||
@@ -988,8 +981,9 @@ class ad_rssimport
|
||||
|
||||
//--------------------------------------------
|
||||
// Set this import's authentication
|
||||
//--------------------------------------------
|
||||
$this->class_rss->auth_req = $rss_import_auth;
|
||||
//--------------------------------------------
|
||||
|
||||
$this->class_rss->auth_req = $rss_import_auth;
|
||||
$this->class_rss->auth_user = $rss_import_auth_user;
|
||||
$this->class_rss->auth_pass = $rss_import_auth_pass;
|
||||
|
||||
@@ -1014,7 +1008,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! is_array( $this->class_rss->rss_channels ) or ! count( $this->class_rss->rss_channels ) )
|
||||
{
|
||||
$rss_error[] = "Íåëüçÿ îòêðûòü $rss_import_url äëÿ ëîêàëüíûõ êàíàëîâ.";
|
||||
$rss_error[] = "Could not open $rss_import_url to locate channels.";
|
||||
}
|
||||
|
||||
if ( is_array( $rss_error ) AND count( $rss_error ) )
|
||||
@@ -1028,11 +1022,11 @@ class ad_rssimport
|
||||
// Figure out MID
|
||||
//--------------------------------------------
|
||||
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'id, name', 'from' => 'members', 'where' => "LOWER(members_display_name)='{$rss_import_mid}'" ) );
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'id, name', 'from' => 'members', 'where' => "members_l_display_name='{$rss_import_mid}'" ) );
|
||||
|
||||
if ( ! $member['id'] )
|
||||
if ( !isset($member['id']) OR !$member['id'] )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íåëüçÿ íàéòè ïîëüçîâàòåëÿ: '{$rss_import_mid}'";
|
||||
$this->ipsclass->main_msg = "We could not find a member called '{$rss_import_mid}'";
|
||||
$this->rssimport_form( $type );
|
||||
return;
|
||||
}
|
||||
@@ -1047,16 +1041,16 @@ class ad_rssimport
|
||||
|
||||
$this->ipsclass->forums->forums_init();
|
||||
|
||||
if ( ! $this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ] )
|
||||
if ( !isset($this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ]) OR !$this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ] )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Âûáðàííûé ôîðóì äëÿ èìïîðòà íå ñóùåñòâóåò";
|
||||
$this->ipsclass->main_msg = "The selected forum to import into doesn't exist";
|
||||
$this->rssimport_form( $type );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ]['sub_can_post'] != 1 OR $this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ]['redirect_on'] == 1 )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Âûáðàííûé ôîðóì äëÿ èìïîðòà íå ìîæåò ïðèíÿòü òåìû.";
|
||||
$this->ipsclass->main_msg = "The selected forum to import into isn't capable of receiving topics.";
|
||||
$this->rssimport_form( $type );
|
||||
return;
|
||||
}
|
||||
@@ -1089,13 +1083,13 @@ class ad_rssimport
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
$this->ipsclass->DB->do_insert( 'rss_import', $array );
|
||||
$this->ipsclass->main_msg = 'Ñîçäàíà ñòðîêà RSS èìïîðòà';
|
||||
$this->ipsclass->main_msg = 'RSS Import Stream Created';
|
||||
$rss_import_id = $this->ipsclass->DB->get_insert_id();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->ipsclass->DB->do_update( 'rss_import', $array, 'rss_import_id='.$rss_import_id );
|
||||
$this->ipsclass->main_msg = 'Ñòðîêà RSS èìïîðòà îòðåäàêòèðîâàíà';
|
||||
$this->ipsclass->main_msg = 'RSS Import Stream Edited';
|
||||
}
|
||||
|
||||
if( $rss_import_enabled )
|
||||
@@ -1116,7 +1110,7 @@ class ad_rssimport
|
||||
// Init Vars
|
||||
//-----------------------------------------
|
||||
|
||||
$rss_import_id = intval($this->ipsclass->input['rss_import_id']);
|
||||
$rss_import_id = isset($this->ipsclass->input['rss_import_id']) ? intval($this->ipsclass->input['rss_import_id']) : 0;
|
||||
|
||||
//-------------------------------
|
||||
// Build forums drop down
|
||||
@@ -1136,9 +1130,26 @@ class ad_rssimport
|
||||
if ( $type == 'add' )
|
||||
{
|
||||
$formcode = 'rssimport_add_save';
|
||||
$title = "Ñîçäàòü ñòðîêó RSS èìïîðòà";
|
||||
$button = "Ñîçäàòü";
|
||||
$rsstream = array( 'rss_import_topic_open' => 1, 'rss_import_enabled' => 1, 'rss_import_showlink' => '[url={url}]Ïðîñìîòðåòü ïîëíóþ âåðñèþ[/url]' );
|
||||
$title = "Create New RSS Import Stream";
|
||||
$button = "Create New RSS Import Stream";
|
||||
$rssstream = array( 'rss_import_topic_open' => 1,
|
||||
'rss_import_enabled' => 1,
|
||||
'rss_import_showlink' => '[url={url}]View the full article[/url]',
|
||||
'rss_import_title' => '',
|
||||
'rss_import_url' => '',
|
||||
'rss_import_forum_id' => 0,
|
||||
'rss_import_mid' => '',
|
||||
'rss_import_pergo' => 10,
|
||||
'rss_import_time' => '200',
|
||||
'rss_import_topic_hide' => 0,
|
||||
'rss_import_inc_pcount' => 1,
|
||||
'rss_import_topic_pre' => '',
|
||||
'rss_import_charset' => '',
|
||||
'rss_import_allow_html' => 0,
|
||||
'rss_import_auth' => NULL,
|
||||
'rss_import_auth_user' => NULL,
|
||||
'rss_import_auth_pass' => NULL,
|
||||
'rss_import_id' => 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1146,7 +1157,7 @@ class ad_rssimport
|
||||
|
||||
if ( ! $rssstream['rss_import_id'] )
|
||||
{
|
||||
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî.";
|
||||
$this->ipsclass->main_msg = "No ID was passed, please try again.";
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
@@ -1163,8 +1174,8 @@ class ad_rssimport
|
||||
}
|
||||
|
||||
$formcode = 'rssimport_edit_save';
|
||||
$title = "Ðåäàêòèðîâàíèå: ".$rssstream['rss_import_title'];
|
||||
$button = "Ñîõðàíèòü èçìåíåíèÿ";
|
||||
$title = "Edit RSS Import Stream ".$rssstream['rss_import_title'];
|
||||
$button = "Save Changes";
|
||||
}
|
||||
|
||||
//-------------------------------
|
||||
@@ -1173,26 +1184,26 @@ class ad_rssimport
|
||||
|
||||
$form = array();
|
||||
|
||||
$form['rss_import_title'] = $this->ipsclass->adskin->form_input( 'rss_import_title' , $_POST['rss_import_title'] ? stripslashes($_POST['rss_import_title']) : $rssstream['rss_import_title'] );
|
||||
$form['rss_import_enabled'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_enabled' , $_POST['rss_import_enabled'] ? $_POST['rss_import_enabled'] : $rssstream['rss_import_enabled'] );
|
||||
$form['rss_import_url'] = $this->ipsclass->adskin->form_input( 'rss_import_url' , $_POST['rss_import_url'] ? $_POST['rss_import_url'] : $rssstream['rss_import_url'] );
|
||||
$form['rss_import_forum_id'] = $this->ipsclass->adskin->form_dropdown( 'rss_import_forum_id' , $forum_dropdown, $_POST['rss_import_forum_id'] ? $_POST['rss_import_forum_id'] : $rssstream['rss_import_forum_id'] );
|
||||
$form['rss_import_mid'] = $this->ipsclass->adskin->form_input( 'rss_import_mid' , $_POST['rss_import_mid'] ? $_POST['rss_import_mid'] : $rssstream['rss_import_mid'] );
|
||||
$form['rss_import_pergo'] = $this->ipsclass->adskin->form_simple_input( 'rss_import_pergo' , $_POST['rss_import_pergo'] ? $_POST['rss_import_pergo'] : $rssstream['rss_import_pergo'], 5 );
|
||||
$form['rss_import_time'] = $this->ipsclass->adskin->form_simple_input( 'rss_import_time' , $_POST['rss_import_time'] ? $_POST['rss_import_time'] : $rssstream['rss_import_time'], 5 );
|
||||
$form['rss_import_showlink'] = $this->ipsclass->adskin->form_input( 'rss_import_showlink' , $_POST['rss_import_showlink'] ? htmlspecialchars($_POST['rss_import_showlink']) : htmlspecialchars($rssstream['rss_import_showlink']) );
|
||||
$form['rss_import_topic_open'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_topic_open' , $_POST['rss_import_topic_open'] ? $_POST['rss_import_topic_open'] : $rssstream['rss_import_topic_open'] );
|
||||
$form['rss_import_topic_hide'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_topic_hide' , $_POST['rss_import_topic_hide'] ? $_POST['rss_import_topic_hide'] : $rssstream['rss_import_topic_hide'] );
|
||||
$form['rss_import_inc_pcount'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_inc_pcount' , $_POST['rss_import_inc_pcount'] ? $_POST['rss_import_inc_pcount'] : $rssstream['rss_import_inc_pcount'] );
|
||||
$form['rss_import_topic_pre'] = $this->ipsclass->adskin->form_input( 'rss_import_topic_pre' , $_POST['rss_import_topic_pre'] ? $_POST['rss_import_topic_pre'] : $rssstream['rss_import_topic_pre'] );
|
||||
$form['rss_import_charset'] = $this->ipsclass->adskin->form_input( 'rss_import_charset' , $_POST['rss_import_charset'] ? $_POST['rss_import_charset'] : $rssstream['rss_import_charset'] );
|
||||
$form['rss_import_allow_html'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_allow_html' , $_POST['rss_import_allow_html'] ? $_POST['rss_import_allow_html'] : $rssstream['rss_import_allow_html'] );
|
||||
$form['rss_import_title'] = $this->ipsclass->adskin->form_input( 'rss_import_title' , ( isset($_POST['rss_import_title']) AND $_POST['rss_import_title'] ) ? stripslashes($_POST['rss_import_title']) : $rssstream['rss_import_title'] );
|
||||
$form['rss_import_enabled'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_enabled' , ( isset($_POST['rss_import_enabled']) AND $_POST['rss_import_enabled'] ) ? $_POST['rss_import_enabled'] : $rssstream['rss_import_enabled'] );
|
||||
$form['rss_import_url'] = $this->ipsclass->adskin->form_input( 'rss_import_url' , ( isset($_POST['rss_import_url']) AND $_POST['rss_import_url'] ) ? $_POST['rss_import_url'] : $rssstream['rss_import_url'] );
|
||||
$form['rss_import_forum_id'] = $this->ipsclass->adskin->form_dropdown( 'rss_import_forum_id' , $forum_dropdown, ( isset($_POST['rss_import_forum_id']) AND $_POST['rss_import_forum_id'] ) ? $_POST['rss_import_forum_id'] : $rssstream['rss_import_forum_id'] );
|
||||
$form['rss_import_mid'] = $this->ipsclass->adskin->form_input( 'rss_import_mid' , ( isset($_POST['rss_import_mid']) AND $_POST['rss_import_mid'] ) ? $_POST['rss_import_mid'] : $rssstream['rss_import_mid'], 'text', "id='rss_import_mid'" );
|
||||
$form['rss_import_pergo'] = $this->ipsclass->adskin->form_simple_input( 'rss_import_pergo' , ( isset($_POST['rss_import_pergo']) AND $_POST['rss_import_pergo'] ) ? $_POST['rss_import_pergo'] : $rssstream['rss_import_pergo'], 5 );
|
||||
$form['rss_import_time'] = $this->ipsclass->adskin->form_simple_input( 'rss_import_time' , ( isset($_POST['rss_import_time']) AND $_POST['rss_import_time'] ) ? $_POST['rss_import_time'] : $rssstream['rss_import_time'], 5 );
|
||||
$form['rss_import_showlink'] = $this->ipsclass->adskin->form_input( 'rss_import_showlink' , ( isset($_POST['rss_import_showlink']) AND $_POST['rss_import_showlink'] ) ? htmlspecialchars($_POST['rss_import_showlink']) : htmlspecialchars($rssstream['rss_import_showlink']) );
|
||||
$form['rss_import_topic_open'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_topic_open' , ( isset($_POST['rss_import_topic_open']) AND $_POST['rss_import_topic_open'] ) ? $_POST['rss_import_topic_open'] : $rssstream['rss_import_topic_open'] );
|
||||
$form['rss_import_topic_hide'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_topic_hide' , ( isset($_POST['rss_import_topic_hide']) AND $_POST['rss_import_topic_hide'] ) ? $_POST['rss_import_topic_hide'] : $rssstream['rss_import_topic_hide'] );
|
||||
$form['rss_import_inc_pcount'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_inc_pcount' , ( isset($_POST['rss_import_inc_pcount']) AND $_POST['rss_import_inc_pcount'] ) ? $_POST['rss_import_inc_pcount'] : $rssstream['rss_import_inc_pcount'] );
|
||||
$form['rss_import_topic_pre'] = $this->ipsclass->adskin->form_input( 'rss_import_topic_pre' , ( isset($_POST['rss_import_topic_pre']) AND $_POST['rss_import_topic_pre'] ) ? $_POST['rss_import_topic_pre'] : $rssstream['rss_import_topic_pre'] );
|
||||
$form['rss_import_charset'] = $this->ipsclass->adskin->form_input( 'rss_import_charset' , ( isset($_POST['rss_import_charset']) AND $_POST['rss_import_charset'] ) ? $_POST['rss_import_charset'] : $rssstream['rss_import_charset'] );
|
||||
$form['rss_import_allow_html'] = $this->ipsclass->adskin->form_yes_no( 'rss_import_allow_html' , ( isset($_POST['rss_import_allow_html']) AND $_POST['rss_import_allow_html'] ) ? $_POST['rss_import_allow_html'] : $rssstream['rss_import_allow_html'] );
|
||||
$form['rss_import_auth'] = $this->ipsclass->adskin->form_checkbox( 'rss_import_auth' ,
|
||||
$_POST['rss_import_auth'] ? $_POST['rss_import_auth'] : $rssstream['rss_import_auth'],
|
||||
( isset($_POST['rss_import_auth']) AND $_POST['rss_import_auth'] ) ? $_POST['rss_import_auth'] : $rssstream['rss_import_auth'],
|
||||
'1',
|
||||
array( 0 => 'onclick="enable_auth_boxes()"', 1 => 'id="rss_import_auth"' )
|
||||
);
|
||||
$auth_checked = $_POST['rss_import_auth'] ? $_POST['rss_import_auth'] : $rssstream['rss_import_auth'];
|
||||
$auth_checked = ( isset($_POST['rss_import_auth']) AND $_POST['rss_import_auth'] ) ? $_POST['rss_import_auth'] : $rssstream['rss_import_auth'];
|
||||
if( !$auth_checked )
|
||||
{
|
||||
$form['rss_div_show'] = "style='display:none;'";
|
||||
@@ -1202,15 +1213,15 @@ class ad_rssimport
|
||||
$form['rss_div_show'] = "style='display:;'";
|
||||
}
|
||||
|
||||
$form['rss_import_auth_user'] = $this->ipsclass->adskin->form_input( 'rss_import_auth_user' , $_POST['rss_import_auth_user'] ? $_POST['rss_import_auth_user'] : $rssstream['rss_import_auth_user'] );
|
||||
$form['rss_import_auth_pass'] = $this->ipsclass->adskin->form_input( 'rss_import_auth_pass' , $_POST['rss_import_auth_pass'] ? $_POST['rss_import_auth_pass'] : $rssstream['rss_import_auth_pass'] );
|
||||
$form['rss_import_auth_user'] = $this->ipsclass->adskin->form_input( 'rss_import_auth_user' , ( isset($_POST['rss_import_auth_user']) AND $_POST['rss_import_auth_user'] ) ? $_POST['rss_import_auth_user'] : $rssstream['rss_import_auth_user'] );
|
||||
$form['rss_import_auth_pass'] = $this->ipsclass->adskin->form_input( 'rss_import_auth_pass' , ( isset($_POST['rss_import_auth_pass']) AND $_POST['rss_import_auth_pass'] ) ? $_POST['rss_import_auth_pass'] : $rssstream['rss_import_auth_pass'] );
|
||||
|
||||
$this->ipsclass->html .= $this->html->rss_import_form( $form, $title, $formcode, $button, $rssstream );
|
||||
|
||||
$this->ipsclass->admin->page_title = "Óïðàâëåíèå èìïîðòà RSS";
|
||||
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëèò âàì óïðàâëÿòü ïîëÿìè èìïîðòà RSS.";
|
||||
$this->ipsclass->admin->page_title = "RSS Import Manager";
|
||||
$this->ipsclass->admin->page_detail = "This section will allow you to manage your RSS Import feeds.";
|
||||
|
||||
$this->ipsclass->admin->nav[] = array( "{$this->ipsclass->form_code}", "Óïðàâëåíèå èìïîðòà RSS" );
|
||||
$this->ipsclass->admin->nav[] = array( "", "Add/Edit RSS Import" );
|
||||
$this->ipsclass->admin->output();
|
||||
}
|
||||
|
||||
@@ -1220,8 +1231,6 @@ class ad_rssimport
|
||||
|
||||
function rssimport_overview()
|
||||
{
|
||||
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code, 'Óïðàâëåíèå èìïîðòà RSS' );
|
||||
|
||||
//-------------------------------
|
||||
// INIT
|
||||
//-------------------------------
|
||||
@@ -1249,14 +1258,353 @@ class ad_rssimport
|
||||
|
||||
$this->ipsclass->html .= $this->html->rss_import_overview( $content );
|
||||
|
||||
$this->ipsclass->admin->page_title = "Óïðàâëåíèå èìïîðòà RSS";
|
||||
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëèò âàì óïðàâëÿòü ïîëÿìè èìïîðòà RSS.";
|
||||
$this->ipsclass->admin->page_title = "RSS Import Manager";
|
||||
$this->ipsclass->admin->page_detail = "This section will allow you to manage your RSS Import feeds.";
|
||||
$this->ipsclass->admin->output();
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
// RSS Import: Save
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
function rssimport_validate( $standalone=0 )
|
||||
{
|
||||
$return = 0;
|
||||
|
||||
if( !$standalone )
|
||||
{
|
||||
//--------------------------------------------
|
||||
// INIT
|
||||
//--------------------------------------------
|
||||
|
||||
$rss_import_id = intval($this->ipsclass->input['rss_import_id']);
|
||||
$rss_import_title = trim( $this->ipsclass->input['rss_import_title'] );
|
||||
$rss_import_url = $this->ipsclass->txt_stripslashes( trim( $_POST['rss_import_url'] ) );
|
||||
$rss_import_mid = trim( $this->ipsclass->input['rss_import_mid'] );
|
||||
$rss_import_showlink = $this->ipsclass->txt_stripslashes( trim( $_POST['rss_import_showlink'] ) );
|
||||
$rss_import_enabled = intval($this->ipsclass->input['rss_import_enabled']);
|
||||
$rss_import_forum_id = intval($this->ipsclass->input['rss_import_forum_id']);
|
||||
$rss_import_pergo = intval($this->ipsclass->input['rss_import_pergo']);
|
||||
$rss_import_time = intval($this->ipsclass->input['rss_import_time']);
|
||||
$rss_import_topic_open = intval($this->ipsclass->input['rss_import_topic_open']);
|
||||
$rss_import_topic_hide = intval($this->ipsclass->input['rss_import_topic_hide']);
|
||||
$rss_import_inc_pcount = intval($this->ipsclass->input['rss_import_inc_pcount']);
|
||||
$rss_import_topic_pre = $this->ipsclass->input['rss_import_topic_pre'];
|
||||
$rss_import_charset = $this->ipsclass->input['rss_import_charset'];
|
||||
$rss_import_allow_html = intval($this->ipsclass->input['rss_import_allow_html']);
|
||||
$rss_import_auth = intval($this->ipsclass->input['rss_import_auth']);
|
||||
$rss_import_auth_user = trim($this->ipsclass->input['rss_import_auth_user']) ? trim($this->ipsclass->input['rss_import_auth_user']) : 'Not Needed';
|
||||
$rss_import_auth_pass = trim($this->ipsclass->input['rss_import_auth_pass']) ? trim($this->ipsclass->input['rss_import_auth_pass']) : 'Not Needed';
|
||||
|
||||
$return = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return = 0;
|
||||
|
||||
$rss_input_id = isset($this->ipsclass->input['rss_id']) ? intval($this->ipsclass->input['rss_id']) : 0;
|
||||
|
||||
if( $rss_input_id > 0 )
|
||||
{
|
||||
$rss_data = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'rss_import', 'where' => 'rss_import_id='.$rss_input_id ) );
|
||||
|
||||
if( !$rss_data['rss_import_url'] )
|
||||
{
|
||||
$rss_import_url = "";
|
||||
$rss_import_auth = "";
|
||||
$rss_import_auth_user = "";
|
||||
$rss_import_auth_pass = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
$standalone = 0;
|
||||
|
||||
$rss_import_id = intval($rss_data['rss_import_id']);
|
||||
$rss_import_url = $rss_data['rss_import_url'];
|
||||
|
||||
$member = $this->ipsclass->DB->simple_exec_query( array( 'select' => 'members_display_name', 'from' => 'members', 'where' => 'id='.$rss_data['rss_import_mid'] ) );
|
||||
|
||||
$rss_import_mid = $member['members_display_name'];
|
||||
|
||||
$rss_import_forum_id = intval($rss_data['rss_import_forum_id']);
|
||||
$rss_import_inc_pcount = intval($rss_data['rss_import_inc_pcount']);
|
||||
$rss_import_charset = $rss_data['rss_import_charset'];
|
||||
$rss_import_auth = intval($rss_data['rss_import_auth']);
|
||||
$rss_import_auth_user = trim($rss_data['rss_import_auth_user']);
|
||||
$rss_import_auth_pass = trim($rss_data['rss_import_auth_pass']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$rss_import_url = $this->ipsclass->txt_stripslashes( trim( $_POST['rss_url'] ) );
|
||||
$rss_import_charset = $this->ipsclass->vars['gb_char_set'];
|
||||
$rss_import_auth = "";
|
||||
$rss_import_auth_user = "";
|
||||
$rss_import_auth_pass = "";
|
||||
}
|
||||
}
|
||||
|
||||
if( !$rss_import_url )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'msg' => "There was no url entered to validate" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
//--------------------------------------------
|
||||
// INIT
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! $this->classes_loaded )
|
||||
{
|
||||
//--------------------------------------------
|
||||
// Require classes
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! is_object( $this->class_rss ) )
|
||||
{
|
||||
require_once( KERNEL_PATH . 'class_rss.php' );
|
||||
$this->class_rss = new class_rss();
|
||||
$this->class_rss->ipsclass =& $this->ipsclass;
|
||||
$this->class_rss->use_sockets = $this->use_sockets;
|
||||
$this->class_rss->rss_max_show = 100;
|
||||
}
|
||||
|
||||
$this->classes_loaded = 1;
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// Set this import's doctype
|
||||
//--------------------------------------------
|
||||
|
||||
$this->class_rss->doc_type = $this->ipsclass->vars['gb_char_set'];
|
||||
$this->class_rss->feed_charset = $this->ipsclass->vars['gb_char_set'];
|
||||
|
||||
if( strtolower($rss_import_charset) != $this->ipsclass->vars['gb_char_set'] )
|
||||
{
|
||||
$this->class_rss->convert_charset = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->class_rss->convert_charset = 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// Set this import's authentication
|
||||
//--------------------------------------------
|
||||
$this->class_rss->auth_req = $rss_import_auth;
|
||||
$this->class_rss->auth_user = $rss_import_auth_user;
|
||||
$this->class_rss->auth_pass = $rss_import_auth_pass;
|
||||
|
||||
//--------------------------------------------
|
||||
// Clear RSS object's error cache first
|
||||
//--------------------------------------------
|
||||
$this->class_rss->errors = array();
|
||||
$this->class_rss->rss_items = array();
|
||||
|
||||
//--------------------------------------------
|
||||
// Reset the rss count as this is a new feed
|
||||
//--------------------------------------------
|
||||
|
||||
$this->class_rss->rss_count = 0;
|
||||
|
||||
//--------------------------------------------
|
||||
// Parse RSS
|
||||
//--------------------------------------------
|
||||
|
||||
$this->class_rss->rss_parse_feed_from_url( $rss_import_url );
|
||||
|
||||
//--------------------------------------------
|
||||
// Validate Data - HTTP Status Code/Text
|
||||
//--------------------------------------------
|
||||
|
||||
if( $this->class_rss->class_file_management->http_status_code != "200" )
|
||||
{
|
||||
if( $this->class_rss->class_file_management->http_status_code )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "HTTP Status Code: ".$this->class_rss->class_file_management->http_status_code." (".$this->class_rss->class_file_management->http_status_text.")" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-valid',
|
||||
'msg' => "HTTP Status Code: ".$this->class_rss->class_file_management->http_status_code." (".$this->class_rss->class_file_management->http_status_text.")" ) );
|
||||
}
|
||||
|
||||
if ( is_array( $this->class_rss->errors ) and count( $this->class_rss->errors ) )
|
||||
{
|
||||
foreach( $this->class_rss->errors as $error )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid', 'msg' => $error ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( $this->class_rss->orig_doc_type )
|
||||
{
|
||||
if( !$standalone AND $rss_import_charset )
|
||||
{
|
||||
if( strtolower($rss_import_charset) != strtolower($this->class_rss->orig_doc_type) )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "The RSS feed's charset is <i>{$this->class_rss->orig_doc_type}</i> but you entered <i>{$rss_import_charset}</i>" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-valid',
|
||||
'msg' => "The RSS feed's charset is <i>{$this->class_rss->orig_doc_type}</i> (correct)" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-valid',
|
||||
'msg' => "The RSS feed's charset is <i>{$this->class_rss->orig_doc_type}</i>" ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "We could not determine the feed's character set" ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// Any Channels?
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! is_array( $this->class_rss->rss_channels ) or ! count( $this->class_rss->rss_channels ) )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "We could not find any channels in the RSS feed (nothing to import)." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-valid',
|
||||
'msg' => "We found ".count($this->class_rss->rss_channels)." channel(s) in the RSS feed." ) );
|
||||
|
||||
//--------------------------------------------
|
||||
// Any Items?
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! is_array( $this->class_rss->rss_items ) or ! count( $this->class_rss->rss_items ) )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "We could not find any actual content (topics, news articles, etc.) (nothing to import)" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach ( $this->class_rss->rss_channels as $channel_id => $channel_data )
|
||||
{
|
||||
if ( is_array( $this->class_rss->rss_items[ $channel_id ] ) and count ($this->class_rss->rss_items[ $channel_id ] ) )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-valid',
|
||||
'msg' => "We found ".count($this->class_rss->rss_items[ $channel_id ])." article(s)/topic(s) in the RSS feed." ) );
|
||||
|
||||
foreach( $this->class_rss->rss_items[ $channel_id ] as $item_data )
|
||||
{
|
||||
if( !$item_data['unixdate'] )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-msg',
|
||||
'msg' => "A date was not found in at least one of the RSS articles - current time would be used instead." ) );
|
||||
}
|
||||
|
||||
if ( $item_data['unixdate'] < 1 )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-msg',
|
||||
'msg' => "An invalid date was found in at least one of the RSS articles - current time would be used instead." ) );
|
||||
}
|
||||
else if ( $item_data['unixdate'] > time() )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-msg',
|
||||
'msg' => "An invalid date was found in at least one of the RSS articles - current time would be used instead." ) );
|
||||
}
|
||||
|
||||
$item_data['content'] = $item_data['content'] ? $item_data['content'] : $item_data['description'];
|
||||
|
||||
if ( ! $item_data['title'] OR ! $item_data['content'] )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "At least one article was missing a title or a description/content field. If all articles are missing both fields, nothing would import. Otherwise IPB would skip just the items missing both a title and content." ) );
|
||||
}
|
||||
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( !$standalone )
|
||||
{
|
||||
if( $rss_import_mid )
|
||||
{
|
||||
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'id, name', 'from' => 'members', 'where' => "members_l_display_name='{$rss_import_mid}'" ) );
|
||||
|
||||
if ( ! $member['id'] )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "The specified member '{$rss_import_mid}' could not be found." ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "We could not validate the member used to import articles." ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// Init forums if not already done so
|
||||
//--------------------------------------------
|
||||
|
||||
if ( ! is_array( $this->ipsclass->forums->forum_by_id ) OR !count( $this->ipsclass->forums->forum_by_id ) )
|
||||
{
|
||||
$this->ipsclass->forums->forums_init();
|
||||
}
|
||||
|
||||
if( !$standalone AND $rss_import_forum_id )
|
||||
{
|
||||
if ( ! $this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ] )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "The specified forum could not be found." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( $this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ]['sub_can_post'] != 1 OR $this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ]['redirect_on'] == 1 )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "The specified forum is either a redirect forum, or a category, and cannot display new topics." ) );
|
||||
}
|
||||
|
||||
if( $rss_import_inc_pcount AND !$this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ]['inc_postcount'] )
|
||||
{
|
||||
$this->validate_msg[] = $this->html->rss_validate_msg( array( 'class' => 'rss-feed-invalid',
|
||||
'msg' => "The specified forum does not allow posts to increment user's post count - importer's post count will <i>not</i> be incremented." ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------
|
||||
// Display?
|
||||
//--------------------------------------------
|
||||
|
||||
if ( !$return )
|
||||
{
|
||||
if( count($this->validate_msg) )
|
||||
{
|
||||
$this->ipsclass->main_msg = "<b>Validation Results for <span class='rss-feed-url'>".$rss_import_url."</span></b><br /> ·".implode( "<br /> ·", $this->validate_msg );
|
||||
$this->rssimport_overview();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user