1264 lines
45 KiB
PHP
1264 lines
45 KiB
PHP
<?php
|
|
|
|
/*
|
|
+--------------------------------------------------------------------------
|
|
| Invision Power Board 2.1.7
|
|
| =============================================
|
|
| by Matthew Mecham
|
|
| (c) 2001 - 2005 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 $
|
|
| > $Author: bfarber $
|
|
+---------------------------------------------------------------------------
|
|
|
|
|
| > Components Functions
|
|
| > Module written by Matt Mecham
|
|
| > Date started: 12th April 2005 (13:09)
|
|
+--------------------------------------------------------------------------
|
|
*/
|
|
|
|
if ( ! defined( 'IN_ACP' ) )
|
|
{
|
|
print "<h1>Íåâåðíûé âõîä</h1> Ó Âàñ íåò äîñòóïà ê äèðåêòèâå ýòîãî ôàéëà. Åñëè Âû ïðîâîäèëè îáíîâëåíèÿ, óáåäèòåñü, ÷òî íå çàáûëè îáíîâèòü 'admin.php'.";
|
|
exit();
|
|
}
|
|
|
|
class ad_rssimport
|
|
{
|
|
# Globals
|
|
var $ipsclass;
|
|
|
|
var $perm_main = 'content';
|
|
var $perm_child = 'rssimport';
|
|
|
|
var $use_sockets = 1;
|
|
var $func_mod;
|
|
var $classes_loaded = 0;
|
|
|
|
var $import_count = 0;
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// Main handler
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function auto_run()
|
|
{
|
|
$this->html = $this->ipsclass->acp_load_template('cp_skin_rss');
|
|
|
|
//--------------------------------------------
|
|
// Load classes
|
|
//--------------------------------------------
|
|
|
|
require_once( ROOT_PATH.'sources/lib/func_mod.php' );
|
|
$this->func_mod = new func_mod();
|
|
$this->func_mod->ipsclass =& $this->ipsclass;
|
|
|
|
//--------------------------------------------
|
|
// Sup?
|
|
//--------------------------------------------
|
|
|
|
switch($this->ipsclass->input['code'])
|
|
{
|
|
case 'rssimport_overview':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':' );
|
|
$this->rssimport_overview();
|
|
break;
|
|
|
|
case 'rssimport_add':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
|
|
$this->rssimport_form('add');
|
|
break;
|
|
|
|
case 'rssimport_edit':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->rssimport_form('edit');
|
|
break;
|
|
|
|
case 'rssimport_add_save':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':add' );
|
|
$this->rssimport_save('add');
|
|
break;
|
|
|
|
case 'rssimport_edit_save':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':edit' );
|
|
$this->rssimport_save('edit');
|
|
break;
|
|
|
|
case 'rssimport_recache':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':recache' );
|
|
$this->rssimport_rebuild_cache();
|
|
break;
|
|
|
|
case 'rssimport_remove':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );
|
|
$this->rssimport_remove_dialogue();
|
|
break;
|
|
|
|
case 'rssimport_remove_complete':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );
|
|
$this->rssimport_remove_complete( 1 );
|
|
break;
|
|
|
|
case 'rssimport_delete':
|
|
$this->ipsclass->admin->cp_permission_check( $this->perm_main.'|'.$this->perm_child.':remove' );
|
|
$this->rssimport_delete();
|
|
break;
|
|
|
|
default:
|
|
$this->rssimport_overview();
|
|
break;
|
|
}
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// RSS Import: Remove import stream
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rssimport_delete()
|
|
{
|
|
//--------------------------------------------
|
|
// INIT
|
|
//--------------------------------------------
|
|
|
|
$rss_import_id = intval($this->ipsclass->input['rss_import_id']);
|
|
|
|
//--------------------------------------------
|
|
// Load RSS stream
|
|
//--------------------------------------------
|
|
|
|
$rssstream = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'rss_import', 'where' => "rss_import_id=$rss_import_id" ) );
|
|
|
|
if ( ! $rssstream['rss_import_id'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Íåâîçìîæíî çàãðóçèòü ñòðîêó RSS èç áàçû äàííûõ. Âîçìîæíî, åå ïðîñòî íåò.";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Remove it
|
|
//--------------------------------------------
|
|
|
|
$this->ipsclass->DB->build_and_exec_query( array( 'delete' => 'rss_import', 'where' => 'rss_import_id='.$rss_import_id ) );
|
|
|
|
$this->ipsclass->main_msg = "Èñïîðò RSS ñòðîêè óäàëåí";
|
|
$this->rssimport_overview();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// RSS Import: Remove articles, done
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rssimport_remove_complete( $return=0, $rss_import_id=0 )
|
|
{
|
|
//--------------------------------------------
|
|
// INIT
|
|
//--------------------------------------------
|
|
|
|
$rss_import_id = $rss_import_id ? $rss_import_id : intval($this->ipsclass->input['rss_import_id']);
|
|
$remove_count = intval($this->ipsclass->input['remove_count']) ? intval($this->ipsclass->input['remove_count']) : 500;
|
|
$remove_tids = array();
|
|
|
|
//--------------------------------------------
|
|
// Load RSS stream
|
|
//--------------------------------------------
|
|
|
|
$rssstream = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'rss_import', 'where' => "rss_import_id=$rss_import_id" ) );
|
|
|
|
if ( ! $rssstream['rss_import_id'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Íåâîçìîæíî çàãðóçèòü ñòðîêó RSS èç áàçû äàííûõ. Âîçìîæíî, åå ïðîñòî íåò.";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Get tids
|
|
//--------------------------------------------
|
|
|
|
$this->ipsclass->DB->build_query( array( 'select' => 'rss_imported_tid',
|
|
'from' => 'rss_imported',
|
|
'where' => 'rss_imported_impid='.$rss_import_id,
|
|
'order' => 'rss_imported_tid DESC',
|
|
'limit' => array( 0, $remove_count ) ) );
|
|
|
|
$this->ipsclass->DB->exec_query();
|
|
|
|
while( $tee = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$remove_tids[ $tee['rss_imported_tid'] ] = $tee['rss_imported_tid'];
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Check..
|
|
//--------------------------------------------
|
|
|
|
if ( ! count( $remove_tids ) )
|
|
{
|
|
if ( $return )
|
|
{
|
|
$this->ipsclass->main_msg = "Íåëüçÿ îïðåäåëèòü ìåñòî ðàñïîëîæåíèå òåì äëÿ óäàëåíèÿ";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Remove 'em
|
|
//--------------------------------------------
|
|
|
|
$this->func_mod->forum['id'] = $rssstream['rss_import_forum_id'];
|
|
$this->func_mod->topic_delete( $remove_tids );
|
|
|
|
//--------------------------------------------
|
|
// Remove from DB
|
|
//--------------------------------------------
|
|
|
|
$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->rssimport_overview();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// RSS Import: Remove articles, dialogue
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rssimport_remove_dialogue()
|
|
{
|
|
//--------------------------------------------
|
|
// INIT
|
|
//--------------------------------------------
|
|
|
|
$rss_import_id = intval($this->ipsclass->input['rss_import_id']);
|
|
|
|
//--------------------------------------------
|
|
// Checks...
|
|
//--------------------------------------------
|
|
|
|
if ( ! $rss_import_id )
|
|
{
|
|
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Load RSS stream
|
|
//--------------------------------------------
|
|
|
|
$rssstream = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*', 'from' => 'rss_import', 'where' => "rss_import_id=$rss_import_id" ) );
|
|
|
|
if ( ! $rssstream['rss_import_id'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Íåâîçìîæíî çàãðóçèòü ñòðîêó RSS èç áàçû äàííûõ. Âîçìîæíî, åå ïðîñòî íåò.";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Count number of topics...
|
|
//--------------------------------------------
|
|
|
|
$article_count = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'COUNT(*) as cnt', 'from' => 'rss_imported', 'where' => 'rss_imported_impid='.$rss_import_id ) );
|
|
|
|
//--------------------------------------------
|
|
// Got any?
|
|
//--------------------------------------------
|
|
|
|
if ( $article_count['cnt'] < 1 )
|
|
{
|
|
$this->ipsclass->main_msg = "Èìïîðò RSS ñòðîêè '{$rssstream['rss_import_title']}' íå áûë ïðîèçâåäåí.";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// We must have here...
|
|
//--------------------------------------------
|
|
|
|
$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->nav[] = array( "{$this->ipsclass->form_code}", "Óïðàâëåíèå èìïîðòîì RSS" );
|
|
$this->ipsclass->admin->output();
|
|
|
|
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// RSS Import: Rebuild cache
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rssimport_rebuild_cache( $rss_import_id='', $return=1, $id_is_array=0 )
|
|
{
|
|
//--------------------------------------------
|
|
// INIT
|
|
//--------------------------------------------
|
|
|
|
$errors = array();
|
|
$affected_forum_ids = array();
|
|
$affected_members = array();
|
|
$rss_error = array();
|
|
$rss_import_ids = array();
|
|
$items_imported = 0;
|
|
|
|
if ( ! $rss_import_id )
|
|
{
|
|
$rss_import_id = $this->ipsclass->input['rss_import_id'] == 'all' ? 'all' : intval($this->ipsclass->input['rss_import_id']);
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Check
|
|
//--------------------------------------------
|
|
|
|
if ( ! $rss_import_id )
|
|
{
|
|
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
|
|
if( $id_is_array == 1 )
|
|
{
|
|
$rss_import_ids = explode( ",", $rss_import_id );
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
//-----------------------------------------
|
|
// Force RTE editor
|
|
//-----------------------------------------
|
|
|
|
require_once( ROOT_PATH."sources/classes/editor/class_editor.php" );
|
|
require_once( ROOT_PATH."sources/classes/editor/class_editor_rte.php" );
|
|
$this->editor = new class_editor_module();
|
|
$this->editor->ipsclass =& $this->ipsclass;
|
|
|
|
//-----------------------------------------
|
|
// Load and config POST class
|
|
//-----------------------------------------
|
|
|
|
require_once( ROOT_PATH."sources/classes/post/class_post.php" );
|
|
$this->post = new class_post();
|
|
$this->post->ipsclass =& $this->ipsclass;
|
|
|
|
//-----------------------------------------
|
|
// Load and config the email class
|
|
// - only here not to break post class
|
|
//-----------------------------------------
|
|
|
|
require_once( ROOT_PATH."sources/classes/class_email.php" );
|
|
$this->email = new emailer();
|
|
$this->email->ipsclass =& $this->ipsclass;
|
|
$this->email->email_init();
|
|
|
|
$this->post->email =& $this->email;
|
|
|
|
//-----------------------------------------
|
|
// Load and config the post parser
|
|
//-----------------------------------------
|
|
|
|
require_once( ROOT_PATH."sources/handlers/han_parse_bbcode.php" );
|
|
$this->parser = new parse_bbcode();
|
|
$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?
|
|
//--------------------------------------------
|
|
|
|
if ( ! $this->func_mod )
|
|
{
|
|
require_once( ROOT_PATH.'sources/lib/func_mod.php' );
|
|
$this->func_mod = new func_mod();
|
|
$this->func_mod->ipsclass =& $this->ipsclass;
|
|
}
|
|
|
|
$this->classes_loaded = 1;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Init forums if not already done so
|
|
//--------------------------------------------
|
|
|
|
if ( ! is_array( $this->ipsclass->forum_by_id ) )
|
|
{
|
|
$this->ipsclass->forums->forums_init();
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Go loopy
|
|
//--------------------------------------------
|
|
|
|
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'rss_import' ) );
|
|
$outer = $this->ipsclass->DB->exec_query();
|
|
|
|
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 ) ) )
|
|
{
|
|
// Skip non-existent forums - bad stuff happens
|
|
|
|
if( !array_key_exists( $row['rss_import_forum_id'], $this->ipsclass->cache['forum_cache'] ) )
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Set this import's doctype
|
|
//--------------------------------------------
|
|
|
|
$supported_encodings = array( 'utf-8', 'iso-8859-1', 'us-ascii' );
|
|
|
|
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 )
|
|
{
|
|
$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
|
|
{
|
|
$this->class_rss->convert_charset = 0;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Set this import's authentication
|
|
//--------------------------------------------
|
|
$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();
|
|
|
|
//--------------------------------------------
|
|
// 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( $row['rss_import_url'] );
|
|
|
|
//--------------------------------------------
|
|
// Got an error?
|
|
//--------------------------------------------
|
|
|
|
if ( is_array( $this->class_rss->errors ) and count( $this->class_rss->errors ) )
|
|
{
|
|
$rss_error = array_merge( $rss_error, $this->class_rss->errors );
|
|
continue;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Got anything?
|
|
//--------------------------------------------
|
|
|
|
if ( ! is_array( $this->class_rss->rss_channels ) or ! count( $this->class_rss->rss_channels ) )
|
|
{
|
|
$rss_error[] = "Íåëüçÿ îòêðûòü {$row['rss_import_url']} äëÿ ëîêàëüíûõ êàíàëîâ.";
|
|
continue;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Update last check time
|
|
//--------------------------------------------
|
|
|
|
$this->ipsclass->DB->do_update( 'rss_import', array( 'rss_import_last_import' => time() ), 'rss_import_id='.$row['rss_import_id'] );
|
|
|
|
//--------------------------------------------
|
|
// Apparently so: Parse feeds and check for
|
|
// already imported GUIDs
|
|
//--------------------------------------------
|
|
|
|
$final_items = array();
|
|
$items = array();
|
|
$check_guids = array();
|
|
$final_guids = array();
|
|
$count = 0;
|
|
|
|
if ( ! is_array( $this->class_rss->rss_items ) or ! count( $this->class_rss->rss_items ) )
|
|
{
|
|
$rss_error[] = "{$row['rss_import_url']} – íåò ïðåäìåòîâ äëÿ èìïîðòà";
|
|
continue;
|
|
}
|
|
|
|
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 ] ) )
|
|
{
|
|
foreach( $this->class_rss->rss_items[ $channel_id ] as $item_id => $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'] ) );
|
|
$item_data['unixdate'] = intval($item_data['unixdate']) ? intval($item_data['unixdate']) : time();
|
|
|
|
//--------------------------------------------
|
|
// Convert char set?
|
|
//--------------------------------------------
|
|
|
|
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']) );
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Dates?
|
|
//--------------------------------------------
|
|
|
|
if ( $item_data['unixdate'] < 1 )
|
|
{
|
|
$item_data['unixdate'] = time();
|
|
}
|
|
else if ( $item_data['unixdate'] > time() )
|
|
{
|
|
$item_data['unixdate'] = time();
|
|
}
|
|
|
|
|
|
if ( ! $item_data['title'] OR ! $item_data['content'] )
|
|
{
|
|
$rss_error[] = "Ïðîïóùåíî: '{$item_data['title']}' - íåò íàçâàíèÿ èëè ñîäåðæàíèÿ";
|
|
continue;
|
|
}
|
|
|
|
|
|
$items[ $item_data['guid'] ] = $item_data;
|
|
$check_guids[] = $item_data['guid'];
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Check GUIDs
|
|
//--------------------------------------------
|
|
|
|
if ( ! count( $check_guids ) )
|
|
{
|
|
$rss_error[] = "Íåò RSS çàïèñåé äëÿ èìïîðòèðîâàíèÿ!";
|
|
continue;
|
|
}
|
|
|
|
$this->ipsclass->DB->build_query( array( 'select' => '*', 'from' => 'rss_imported', 'where' => "rss_imported_guid IN ('".implode( "','", $check_guids )."')" ) );
|
|
$this->ipsclass->DB->exec_query();
|
|
|
|
while ( $guid = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
$final_guids[ $guid['rss_imported_guid'] ] = $guid['rss_imported_guid'];
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Compare GUIDs
|
|
//--------------------------------------------
|
|
|
|
$item_count = 0;
|
|
|
|
foreach( $items as $guid => $data )
|
|
{
|
|
if ( in_array( $guid, $final_guids ) )
|
|
{
|
|
continue;
|
|
}
|
|
else
|
|
{
|
|
$item_count++;
|
|
|
|
# Make sure each item has a unique date
|
|
$final_items[ $data['unixdate'].$item_count ] = $data;
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Sort array
|
|
//--------------------------------------------
|
|
|
|
krsort( $final_items );
|
|
|
|
//--------------------------------------------
|
|
// Pick off last X
|
|
//--------------------------------------------
|
|
|
|
$count = 1;
|
|
$tmp_final_items = $final_items;
|
|
$final_items = array();
|
|
|
|
foreach( $tmp_final_items as $date => $data )
|
|
{
|
|
$final_items[ $date ] = $data;
|
|
|
|
if ( $count >= $row['rss_import_pergo'] )
|
|
{
|
|
break;
|
|
}
|
|
|
|
$count++;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Anything left?
|
|
//--------------------------------------------
|
|
|
|
if ( ! count( $final_items ) )
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// 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']}" ) );
|
|
|
|
if ( ! $member['id'] )
|
|
{
|
|
continue;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Make 'dem posts
|
|
//--------------------------------------------
|
|
|
|
$affected_forum_ids[] = $row['rss_import_forum_id'];
|
|
|
|
foreach( $final_items as $date => $topic_item )
|
|
{
|
|
# Fix &
|
|
$topic_item['title'] = str_replace( '&', '&', $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'],
|
|
'description' => '' ,
|
|
'state' => $row['rss_import_topic_open'] ? 'open' : 'closed',
|
|
'posts' => 0,
|
|
'starter_id' => $member['id'],
|
|
'starter_name' => $member['members_display_name'],
|
|
'start_date' => $topic_item['unixdate'],
|
|
'last_poster_id' => $member['id'],
|
|
'last_poster_name' => $member['members_display_name'],
|
|
'last_post' => $topic_item['unixdate'],
|
|
'icon_id' => 0,
|
|
'author_mode' => 1,
|
|
'poll_state' => 0,
|
|
'last_vote' => 0,
|
|
'views' => 0,
|
|
'forum_id' => $row['rss_import_forum_id'],
|
|
'approved' => $row['rss_import_topic_hide'] ? 0 : 1,
|
|
'pinned' => 0 );
|
|
|
|
//--------------------------------------------
|
|
// Sort post content: Convert HTML to BBCode
|
|
//--------------------------------------------
|
|
|
|
$this->parser->parse_smilies = 1;
|
|
$this->parser->parse_html = 0;
|
|
$this->parser->parse_bbcode = 1;
|
|
|
|
//--------------------------------------------
|
|
// Clean up..
|
|
//--------------------------------------------
|
|
|
|
$topic_item['content'] = preg_replace( "#<br />(\r)?\n#is", "<br />", $topic_item['content'] );
|
|
|
|
//--------------------------------------------
|
|
// Add in Show link...
|
|
//--------------------------------------------
|
|
|
|
if ( $row['rss_import_showlink'] AND $topic_item['link'] )
|
|
{
|
|
$the_link = "";
|
|
$the_link = str_replace( '{url}', $topic_item['link'], $row['rss_import_showlink'] );
|
|
if ( $row['rss_import_allow_html'] )
|
|
{
|
|
$the_link = $this->parser->pre_display_parse( $this->parser->pre_db_parse( $this->editor->_rte_html_to_bbcode( stripslashes($the_link) ) ) );
|
|
}
|
|
|
|
$topic_item['content'] .= "\n\n" . $the_link;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Not allowed HTML
|
|
//--------------------------------------------
|
|
|
|
if ( ! $row['rss_import_allow_html'] )
|
|
{
|
|
$post_content = $this->parser->pre_display_parse( $this->parser->pre_db_parse( $this->editor->_rte_html_to_bbcode( stripslashes($topic_item['content']) ) ) );
|
|
}
|
|
else
|
|
{
|
|
$post_content = stripslashes($topic_item['content']);
|
|
}
|
|
|
|
$post = array(
|
|
'author_id' => $member['id'],
|
|
'use_sig' => 1,
|
|
'use_emo' => 1,
|
|
'ip_address' => $this->ipsclass->ip_address,
|
|
'post_date' => $topic_item['unixdate'],
|
|
'icon_id' => 0,
|
|
'post' => $post_content,
|
|
'author_name' => $member['members_display_name'],
|
|
'topic_id' => "",
|
|
'queued' => 0,
|
|
'post_htmlstate' => 0,
|
|
);
|
|
|
|
//-----------------------------------------
|
|
// Insert the topic into the database to get the
|
|
// last inserted value of the auto_increment field
|
|
// follow suit with the post
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->do_insert( 'topics', $topic );
|
|
|
|
$post['topic_id'] = $this->ipsclass->DB->get_insert_id();
|
|
$topic['tid'] = $post['topic_id'];
|
|
|
|
//-----------------------------------------
|
|
// Update the post info with the upload array info
|
|
//-----------------------------------------
|
|
|
|
$post['post_key'] = md5(time());
|
|
$post['new_topic'] = 1;
|
|
|
|
//-----------------------------------------
|
|
// Add post to DB
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->do_insert( 'posts', $post );
|
|
|
|
$post['pid'] = $this->ipsclass->DB->get_insert_id();
|
|
|
|
//-----------------------------------------
|
|
// Update topic with firstpost ID
|
|
//-----------------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'update' => 'topics',
|
|
'set' => "topic_firstpost=".$post['pid'],
|
|
'where' => "tid=".$topic['tid']
|
|
) );
|
|
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
//--------------------------------------------
|
|
// Insert GUID match
|
|
//--------------------------------------------
|
|
|
|
$this->ipsclass->DB->do_insert( 'rss_imported', array( 'rss_imported_impid' => $row['rss_import_id'],
|
|
'rss_imported_guid' => $topic_item['guid'],
|
|
'rss_imported_tid' => $topic['tid'] ) );
|
|
|
|
//-----------------------------------------
|
|
// 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->import_count++;
|
|
|
|
//--------------------------------------------
|
|
// Increment user?
|
|
//--------------------------------------------
|
|
|
|
if ( $row['rss_import_inc_pcount'] AND $this->ipsclass->forums->forum_by_id[ $row['rss_import_forum_id'] ]['inc_postcount'] )
|
|
{
|
|
if ( ! $affected_members[ $member['id'] ] OR $affected_members[ $member['id'] ] < 0 )
|
|
{
|
|
$affected_members[ $member['id'] ] = 0;
|
|
}
|
|
|
|
$affected_members[ $member['id'] ]++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Update members
|
|
//--------------------------------------------
|
|
|
|
if ( is_array( $affected_members ) and count( $affected_members ) )
|
|
{
|
|
foreach( $affected_members as $mid => $inc )
|
|
{
|
|
if ( $mid AND $inc )
|
|
{
|
|
$this->ipsclass->DB->simple_update( 'members', 'posts=posts+'.intval($inc), 'id='.intval($mid) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
}
|
|
}
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Recount stats
|
|
//--------------------------------------------
|
|
|
|
if ( is_array( $affected_forum_ids ) and count( $affected_forum_ids ) )
|
|
{
|
|
foreach( $affected_forum_ids as $i => $fid )
|
|
{
|
|
$this->func_mod->forum_recount( $fid );
|
|
}
|
|
|
|
$this->func_mod->stats_recount();
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Return
|
|
//--------------------------------------------
|
|
|
|
if ( $return )
|
|
{
|
|
$this->ipsclass->main_msg = "Èìïîðò RSS, êåø ïåðåñ÷èòàí";
|
|
|
|
if ( count( $rss_error ) )
|
|
{
|
|
$this->ipsclass->main_msg .= "<br />".implode( "<br />", $rss_error );
|
|
}
|
|
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// RSS Import: Save
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rssimport_save($type='add')
|
|
{
|
|
//--------------------------------------------
|
|
// 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']) : 'Íå òðåáóåòñÿ';
|
|
$rss_import_auth_pass = trim($this->ipsclass->input['rss_import_auth_pass']) ? trim($this->ipsclass->input['rss_import_auth_pass']) : 'Íå òðåáóåòñÿ';
|
|
|
|
$rss_error = array();
|
|
|
|
//--------------------------------------------
|
|
// Checks...
|
|
//--------------------------------------------
|
|
|
|
if ( $type == 'edit' )
|
|
{
|
|
if ( ! $rss_import_id )
|
|
{
|
|
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî ";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
}
|
|
|
|
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->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
|
|
//--------------------------------------------
|
|
|
|
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;
|
|
|
|
//--------------------------------------------
|
|
// Set this import's doctype
|
|
//--------------------------------------------
|
|
|
|
$supported_encodings = array( 'utf-8', 'iso-8859-1', 'us-ascii' );
|
|
|
|
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($rss_import_charset) != $this->class_rss->doc_type )
|
|
{
|
|
$this->class_rss->convert_charset = 1;
|
|
$this->class_rss->feed_charset = $rss_import_charset;
|
|
$this->class_rss->destination_charset = $this->class_rss->doc_type;
|
|
}
|
|
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;
|
|
|
|
//--------------------------------------------
|
|
// Test URL
|
|
//--------------------------------------------
|
|
|
|
$this->class_rss->rss_parse_feed_from_url( $rss_import_url );
|
|
|
|
//--------------------------------------------
|
|
// Got an error?
|
|
//--------------------------------------------
|
|
|
|
if ( is_array( $this->class_rss->errors ) and count( $this->class_rss->errors ) )
|
|
{
|
|
$rss_error = array_merge( $rss_error, $this->class_rss->errors );
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Got anything?
|
|
//--------------------------------------------
|
|
|
|
if ( ! is_array( $this->class_rss->rss_channels ) or ! count( $this->class_rss->rss_channels ) )
|
|
{
|
|
$rss_error[] = "Íåëüçÿ îòêðûòü $rss_import_url äëÿ ëîêàëüíûõ êàíàëîâ.";
|
|
}
|
|
|
|
if ( is_array( $rss_error ) AND count( $rss_error ) )
|
|
{
|
|
$this->ipsclass->main_msg = implode( "<br />", $rss_error );
|
|
$this->rssimport_form( $type );
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// 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}'" ) );
|
|
|
|
if ( ! $member['id'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Íåëüçÿ íàéòè ïîëüçîâàòåëÿ: '{$rss_import_mid}'";
|
|
$this->rssimport_form( $type );
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
$rss_import_mid = $member['id'];
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Check to make sure forum ID is valid
|
|
//--------------------------------------------
|
|
|
|
$this->ipsclass->forums->forums_init();
|
|
|
|
if ( ! $this->ipsclass->forums->forum_by_id[ $rss_import_forum_id ] )
|
|
{
|
|
$this->ipsclass->main_msg = "Âûáðàííûé ôîðóì äëÿ èìïîðòà íå ñóùåñòâóåò";
|
|
$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->rssimport_form( $type );
|
|
return;
|
|
}
|
|
|
|
|
|
//--------------------------------------------
|
|
// Save...
|
|
//--------------------------------------------
|
|
|
|
$array = array(
|
|
'rss_import_title' => $rss_import_title,
|
|
'rss_import_url' => $rss_import_url,
|
|
'rss_import_mid' => $rss_import_mid,
|
|
'rss_import_showlink' => $rss_import_showlink,
|
|
'rss_import_enabled' => $rss_import_enabled,
|
|
'rss_import_forum_id' => $rss_import_forum_id,
|
|
'rss_import_pergo' => $rss_import_pergo,
|
|
'rss_import_time' => $rss_import_time < 30 ? 30 : $rss_import_time,
|
|
'rss_import_topic_open' => $rss_import_topic_open,
|
|
'rss_import_topic_hide' => $rss_import_topic_hide,
|
|
'rss_import_inc_pcount' => $rss_import_inc_pcount,
|
|
'rss_import_topic_pre' => $rss_import_topic_pre,
|
|
'rss_import_charset' => $rss_import_charset,
|
|
'rss_import_allow_html' => $rss_import_allow_html,
|
|
'rss_import_auth' => $rss_import_auth,
|
|
'rss_import_auth_user' => $rss_import_auth_user,
|
|
'rss_import_auth_pass' => $rss_import_auth_pass,
|
|
);
|
|
|
|
if ( $type == 'add' )
|
|
{
|
|
$this->ipsclass->DB->do_insert( 'rss_import', $array );
|
|
$this->ipsclass->main_msg = 'Ñîçäàíà ñòðîêà RSS èìïîðòà';
|
|
$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 èìïîðòà îòðåäàêòèðîâàíà';
|
|
}
|
|
|
|
if( $rss_import_enabled )
|
|
{
|
|
$this->rssimport_rebuild_cache( $rss_import_id, 0 );
|
|
}
|
|
|
|
$this->rssimport_overview();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// RSS Import: Form
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rssimport_form( $type='add' )
|
|
{
|
|
//-----------------------------------------
|
|
// Init Vars
|
|
//-----------------------------------------
|
|
|
|
$rss_import_id = intval($this->ipsclass->input['rss_import_id']);
|
|
|
|
//-------------------------------
|
|
// Build forums drop down
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->forums->forums_init();
|
|
|
|
require_once( ROOT_PATH.'sources/lib/admin_forum_functions.php' );
|
|
$aff = new admin_forum_functions();
|
|
$aff->ipsclass =& $this->ipsclass;
|
|
$forum_dropdown = $aff->ad_forums_forum_list(1);
|
|
|
|
//-----------------------------------------
|
|
// Check (please?)
|
|
//-----------------------------------------
|
|
|
|
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]' );
|
|
}
|
|
else
|
|
{
|
|
$rssstream = $this->ipsclass->DB->simple_exec_query( array( 'select' => '*', 'from' => 'rss_import', 'where' => 'rss_import_id='.$rss_import_id ) );
|
|
|
|
if ( ! $rssstream['rss_import_id'] )
|
|
{
|
|
$this->ipsclass->main_msg = "Íå îäèí ID íå âûáðàí, ïîâòîðèòå ïîïûòêó çàíîâî.";
|
|
$this->rssimport_overview();
|
|
return;
|
|
}
|
|
|
|
//--------------------------------------------
|
|
// Figure out MID
|
|
//--------------------------------------------
|
|
|
|
$member = $this->ipsclass->DB->build_and_exec_query( array( 'select' => 'id, members_display_name', 'from' => 'members', 'where' => "id=".intval($rssstream['rss_import_mid']) ) );
|
|
|
|
if ( $member['id'] )
|
|
{
|
|
$rssstream['rss_import_mid'] = $member['members_display_name'];
|
|
}
|
|
|
|
$formcode = 'rssimport_edit_save';
|
|
$title = "Ðåäàêòèðîâàíèå: ".$rssstream['rss_import_title'];
|
|
$button = "Ñîõðàíèòü èçìåíåíèÿ";
|
|
}
|
|
|
|
//-------------------------------
|
|
// Form elements
|
|
//-------------------------------
|
|
|
|
$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_auth'] = $this->ipsclass->adskin->form_checkbox( 'rss_import_auth' ,
|
|
$_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'];
|
|
if( !$auth_checked )
|
|
{
|
|
$form['rss_div_show'] = "style='display:none;'";
|
|
}
|
|
else
|
|
{
|
|
$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'] );
|
|
|
|
$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->nav[] = array( "{$this->ipsclass->form_code}", "Óïðàâëåíèå èìïîðòà RSS" );
|
|
$this->ipsclass->admin->output();
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
// List current RSS Imports
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
function rssimport_overview()
|
|
{
|
|
$this->ipsclass->admin->nav[] = array( $this->ipsclass->form_code, 'Óïðàâëåíèå èìïîðòà RSS' );
|
|
|
|
//-------------------------------
|
|
// INIT
|
|
//-------------------------------
|
|
|
|
$content = "";
|
|
$rows = array();
|
|
|
|
//-------------------------------
|
|
// Get components
|
|
//-------------------------------
|
|
|
|
$this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'rss_import', 'order' => 'rss_import_id ASC' ) );
|
|
$this->ipsclass->DB->simple_exec();
|
|
|
|
while( $r = $this->ipsclass->DB->fetch_row() )
|
|
{
|
|
//-------------------------------
|
|
// (Alex) Cross
|
|
//-------------------------------
|
|
|
|
$r['_enabled_img'] = $r['rss_import_enabled'] ? 'aff_tick.png' : 'aff_cross.png';
|
|
|
|
$content .= $this->html->rss_import_overview_row($r);
|
|
}
|
|
|
|
$this->ipsclass->html .= $this->html->rss_import_overview( $content );
|
|
|
|
$this->ipsclass->admin->page_title = "Óïðàâëåíèå èìïîðòà RSS";
|
|
$this->ipsclass->admin->page_detail = "Ýòà ñåêöèÿ ïîçâîëèò âàì óïðàâëÿòü ïîëÿìè èìïîðòà RSS.";
|
|
$this->ipsclass->admin->output();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
?>
|