<?php
if( !defined( 'DATALIFEENGINE') ) {
die( "Hacking attempt!");
}
if ($config['keyrss'] == '' and $_SERVER['REMOTE_ADDR']!='127.0.0.1')
{
if($_POST["act"] == "sav"){
if (in_array ('keyrss',$config)){
$keyz = array ('keyrss' =>$_POST['key'] );
$cont = $config +$keyz;
}else{
$config['keyrss'] = $_POST['key'];
$cont = $config;
}
$handle = fopen(ENGINE_DIR.'/data/config.php','w+');
fwrite($handle,"<? \n\n\$config = ".var_export ($cont,true).";\n?>");
fclose($handle);
msg ($lang_grabber['info'],$lang_grabber['info'],'Ключ записан',$PHP_SELF .'?mod=rss');
return 1;
}else{
echoheader ('','');
echo "<div align=\"center\">
Укажите ключ полученный при оплате для регистрации скрипта<br /><br />
<form method=\"post\" >
<input type=\"hidden\" name=\"act\" value=\"sav\">
<input size=\"35\" name=\"key\" value=\"\" /><br /><br />
<span style=\"text-align: center;\">
<input type=\"submit\" value=\"Зарегистрировать\" />
</span><br><br>
</form>
</div>";
echofooter ();
return 1;
}
}
@ini_set ('memory_limit',"128M");
@set_time_limit (0);
@ini_set ('max_execution_time',0);
@ini_set ('2048M');
@ini_set ('output_buffering','off');
@ob_end_clean ();
clearstatcache ();
ob_implicit_flush (TRUE);
$module_info = array ('name'=>'RSS Grabber','version'=>'3.6.5');
require_once ENGINE_DIR .'/inc/plugins/core.php';
require_once ENGINE_DIR .'/classes/templates.class.php';
require_once ENGINE_DIR .'/classes/parse.class.php';
include_once ENGINE_DIR.'/classes/rss.class.php';
$parse = new ParseFilter (array (),array (),1,1);
$tpl = new dle_template ();
$tpl->dir = ENGINE_DIR .'/inc/plugins/templates/';
require_once ENGINE_DIR .'/inc/plugins/rss.classes.php';
require_once ENGINE_DIR .'/inc/plugins/rss.functions.php';
require_once ENGINE_DIR .'/inc/plugins/rss.parser.php';
@include(ENGINE_DIR.'/data/rss_config.php');
@require_once ROOT_DIR .'/language/'.$config['langs'] .'/grabber.lng';
if ($_REQUEST['action'] != '')
{
$action = $_REQUEST['action'];
}
else
{
$action = '';
}
if ($_REQUEST['subaction'] != '')
{
$subaction = $_REQUEST['subaction'];
}
else
{
$subaction = '';
}
if ($_REQUEST['id'] != '')
{
$id = intval ($_REQUEST['id']);
}
else
{
$id = '';
}
if (($action == 'channel') and ($subaction == 'add'))
{
echoheader ('','');
opentable ($lang_grabber['new_channel']);
$tpl->load_template ('rss_addchannel.tpl');
$tpl->set ('{title}','');
$tpl->set ('{category}',categorynewsselection (1,0));
$tpl->set ('{address}','http://');
$tpl->set ('{date-format}',gen_date_format ($config_rss['date']));
$tpl->set ('{load-images}',yesno ($config_rss['down_image']));
$tpl->set ('{rss-parse}',yesno ($config_rss['rss_parse']));
$tpl->set ('{down-radikal}',yesno ($config_rss['down_radikal']));
$tpl->set ('{image-align}',gen_x ($config_rss['image_align']));
$tpl->set ('{image-align-full}',gen_x ($config_rss['image_align_full']));
$tpl->set ('{hide}',yesno ($config_rss['hide']));
$tpl->set ('{leech}',yesno ($config_rss['leech']));
$tpl->set ('{thumb-images}',yesno ($config_rss['cat']));
$tpl->set ('{tags-auto}',yesno ($config_rss['tags_auto']));
$tpl->set ('{allow-mod}',yesno ($config_rss['allow-mod']));
$tpl->set ('{allow-main}',yesno ($config_rss['allow-main']));
$tpl->set ('{allow-comm}',yesno ($config_rss['allow-comm']));
$tpl->set ('{allow-rate}',yesno ($config_rss['allow-rate']));
$tpl->set ('{allow-full}',yesno ($config_rss['allow-full']));
$tpl->set ('{allow-auto}',yesno ($config_rss['allow-auto']));
$tpl->set ('{allow-water}',yesno ($config_rss['allow-water']));
$tpl->set ('{rewrite-news}',yesno ($config_rss['rewrite-news']));
$tpl->set ('{clear-short}',yesno ($config_rss['clear-short']));
$tpl->set ('{short-images}',yesno ($config_rss['short-images']));
$tpl->set ('{short-full}',yesno ($config_rss['short-full']));
$tpl->set ('{dop-watermark}',yesno ($config_rss['dop-watermark']));
$tpl->set ('{null}',yesno ($config_rss['null']));
$tpl->set ('{text-url}',yesno ($config_rss['text-url']));
$tpl->set ('{x}',gen_x ($config_rss['x']));
$tpl->set ('{y}',gen_y ($config_rss['y']));
$tpl->set ('{margin}',$config_rss['margin']);
$tpl->set ('{show_autor}',yesno ($config_rss['show_autor']));
$tpl->set ('{show_tegs}',yesno ($config_rss['show_tegs']));
$tpl->set ('{show_date}',yesno ($config_rss['show_date']));
$tpl->set ('{show_code}',yesno ($config_rss['show_code']));
$tpl->set ('{show_date}',yesno ($config_rss['show_date']));
$tpl->set ('{show_code}',yesno ($config_rss['show_code']));
$tpl->set ('{show_down}',yesno ($config_rss['show_down']));
$tpl->set ('{show_f}',yesno ($config_rss['show_f']));
$tpl->set ('{show_symbol}',yesno ($config_rss['show_symbol']));
$tpl->set ('{show-url}',yesno ($config_rss['show_url']));
$tpl->set ('{show_metatitle}',yesno ($config_rss['show_metatitle']));
$tpl->set ('{show_metadescr}',yesno ($config_rss['show_metadescr']));
$tpl->set ('{show_keywords}',yesno ($config_rss['show_keywords']));
$tpl->set ('{symbol}','');
$tpl->set ('{tags}','');
$tpl->set ('{meta-title}','');
$tpl->set ('{auto-metatitle}',yesno ($config_rss['auto_metatitle']));
$tpl->set ('{meta-descr}','');
$tpl->set ('{key-words}','');
$tpl->set ('{prox}',yesno ('no'));
$tpl->set ('{start-template}',"<div id='news-id-{skip}'>{get}</div>");
$tpl->set ('{delate}','');
$tpl->set ('{inser}','');
$tpl->set ('{cookies}','');
$tpl->set ('{keywords}','');
$tpl->set ('{xdescr}','');
$tpl->set ('{stkeywords}','');
$tpl->set ('{date}','');
$tpl->set ('{start}','');
$tpl->set ('{finish}','');
$tpl->set ('{groups}',get_groups(explode(',',$config_rss['reg_group'])));
$tpl->set ('{Autors}','');
$tpl->set ('{ful-start}',"");
$tpl->set ('{start-title}','');
$tpl->set ('{s-title}','');
$tpl->set ('{end-title}','');
$tpl->set ('{s-del}','');
$tpl->set ('{end-del}','');
$tpl->set ('{start-short}',"<div id='news-id-{skip}'>{get}</div>");
$tpl->set ('{end-short}',yesno ('no'));
$tpl->set ('{sart-link}','');
$tpl->set ('{end-link}',yesno ('no'));
$tpl->set ('{sart-cat}','');
$tpl->set ('{full-link}','');
$tpl->set ('{so}','');
$tpl->set ('{po}','');
foreach ($lang_grabber as $key =>$value)$tpl->set ('{'.$key.'}',$value);
$tpl->copy_template = '<form method="post"><input type="hidden" name="action" value="channel" /><input type="hidden" name="subaction" value="doadd" />'.$tpl->copy_template .'
<input align="left" type="submit" value=" '.$lang_grabber['save'].' " >
<input type="button" value=" '.$lang_grabber['out'].' " onClick="document.location.href = \''.$PHP_SELF .'?mod=rss\'" /></form>';
$tpl->compile ('rss');
echo $tpl->result['rss'];
closetable ();
echofooter ();
return 1;
}
if (($action == 'channel') and ($subaction == 'doadd')){
$stop = false;
$rss_url = stripslashes ($_POST['rss_url']);
if ($_POST['category'] != ''){
$category = $db->safesql( implode( ',',$_POST['category']));
}else{$category = '0';}
$allow_more = intval ($_POST['allow_more']);
$allow_mod = intval ($_POST['allow_mod']);
$allow_main = intval ($_POST['allow_main']);
$allow_comm = intval ($_POST['allow_comm']);
$allow_rate = intval ($_POST['allow_rate']);
$load_images = intval ($_POST['load_img']);
$thumb_images = intval ($_POST['thumb_img']);
$allow_watermark = intval ($_POST['allow_watermark']);
$date_format = intval ($_POST['news_date']);
$ctp = intval ($_POST['so']).'='.intval ($_POST['po']);
$dnast = intval ($_POST['image_align']).'='.intval ($_POST['image_align_full']).'='.intval ($_POST['show_symbol']).'='.intval ($_POST['show_metatitle']).'='.intval ($_POST['show_metadescr']).'='.intval ($_POST['show_keywords']).'='.intval ($_POST['show_url']).'='.intval ($_POST['rss_parse']).'='.intval ($_POST['tags_auto']).'='.intval ($_POST['auto_metatitle']);
$dop_nast = intval ($_POST['dop_watermark']).'='.intval ($_POST['text_url']).'='.intval ($_POST['proxy']).'='.intval ($_POST['x']).'='.intval ($_POST['y']).'='.intval ($_POST['show_autor']).'='.intval ($_POST['show_tegs']).'='.intval ($_POST['show_date']).'='.intval ($_POST['show_code']).'='.intval ($_POST['show_f']).'='.intval ($_POST['null']).'='.intval ($_POST['down_radikal']).'='.intval ($_POST['margin']).'='.intval ($_POST['show_down']);
$full_link = stripslashes ($_POST['full_link']);
$short_story = intval ($_POST['clear_short']).'='.intval ($_POST['short_img']).'='.intval ($_POST['short_full']);
$start_template = $db->safesql ($_POST['start_template']);
$finish_template = $db->safesql ($_POST['finish_template']);
$start = $db->safesql (str_replace ('
','|',$_POST['start']));
$finish = $db->safesql (str_replace ('
','|',$_POST['finish']));
$delate = $db->safesql (str_replace ('
','|',$_POST['delate']));
$inser = $db->safesql (str_replace ('
','|',$_POST['inser']));
$symbol = $db->safesql ($_POST['symbols']);
$ftags = $db->safesql ($_POST['tags']);
$metatitle = $db->safesql ($_POST['meta_title']);
$meta_descr = $db->safesql ($_POST['meta_descr']);
$key_words = $db->safesql ($_POST['key_words']);
$ful_start = $db->safesql ($_POST['ful_start']);
$ful_end = $db->safesql ($_POST['ful_end']);
$start_title = $db->safesql ($_POST['start_title']);
$end_title = $db->safesql ($_POST['s_title']).'=='.$db->safesql ($_POST['end_title']).'=='.$db->safesql ($_POST['s_del']).'=='.$db->safesql ($_POST['end_del']);
$start_short = $db->safesql ($_POST['start_short']);
$end_short = intval ($_POST['end_short']).'='.intval ($_POST['hide']).'='.intval ($_POST['leech']).'='.intval ($_POST['rewrite_news']);
$sart_link = $db->safesql ($_POST['sart_link']);
$end_link = $db->safesql ($_POST['end_link']);
$sart_cat = $db->safesql ($_POST['sart_cat']);
$end_cat = $db->safesql ($_POST['end_cat']);
$xdescr = $db->safesql($_POST['rss_xdescr']);
$date = $db->safesql(trim($_POST['date']));
$cookies = $db->safesql (str_replace ('
','|',$_POST['cookies']));
$keywords = $db->safesql(str_replace ('
','|',$_POST['keywords']));
$stkeywords = $db->safesql (str_replace ('
','|',$_POST['stkeywords']));
if ($_POST['groups'] != '')$autor_grups = implode( ',',$_POST['groups']);
$Autors = $db->safesql (str_replace ('
','|',$_POST['Autors'])).'='.$autor_grups;
$proxy = '';
if (trim ($rss_url) == '')
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['error_url'],$PHP_SELF .'?mod=rss&action=channel&subaction=add');
return 1;
}
if (!(ereg ('http://',$rss_url)))
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['error_url_msg'],$PHP_SELF .'?mod=rss&action=channel&subaction=add');
return 1;
}
$rss_url = $db->safesql ($rss_url);
$inf = $db->super_query ("SELECT id,title FROM ".PREFIX ."_rss WHERE url = '".trim($rss_url)."'");
$rss_result = get_rss_channel_info ($rss_url,intval ($_POST['proxy']));
if ($rss_result['title'] != '')
{
$channel_title = $rss_result['title'];
$channel_descr = $rss_result['description'];
$rss = '1';
}
else
{
$channel_title = $rss_result['html'];
$channel_descr = $rss_result['html'];
$rss = '0';
}
if ($rss == '1'){
$start_title = '';
$start_short = '';
$sart_link = '';
$ctp = '';
}
if ($stop == false)
{
$channel_title = $db->safesql ($channel_title);
$channel_descr = $db->safesql ($channel_descr);
$sql_query = "INSERT INTO ".PREFIX ."_rss (url, title, descr, category, allow_main, allow_comm, allow_rate, allow_auto, load_img, allow_more, start_template, finish_template, cookies, allow_watermark, date_format, keywords, Autors, thumb_img, allow_mod, stkeywords, rss, ful_start, start_title, start_short, end_short, sart_link, end_link, sart_cat, xdescr, xpos, delate, inser, start, finish, end_title, short_story, dop_nast, ctp, full_link, date, dnast, symbol, ftags, metatitle, meta_descr, key_words) VALUES ('$rss_url', '$channel_title', '$channel_descr', '$category', '$allow_main', '$allow_comm', '$allow_rate', '$auto', '$load_images', '$allow_more', '$start_template', '$finish_template', '$cookies', '$allow_watermark', '$date_format', '$keywords', '$Autors', '$thumb_images', '$allow_mod', '$stkeywords', '$rss', '$ful_start', '$start_title', '$start_short', '$end_short', '$sart_link', '$end_link', '$sart_cat', '$xdescr', '1', '$delate', '$inser', '$start', '$finish', '$end_title', '$short_story', '$dop_nast', '$ctp', '$full_link', '$date', '$dnast', '$symbol', '$ftags', '$metatitle', '$meta_descr', '$key_words')";
$db->query ($sql_query);
if (trim ($channel_title) != '')
{
$title = stripslashes (strip_tags ($channel_title));
if (50 <strlen ($title))
{
$title = substr ($title,0,50) .'...';
}
}
else
{
$title = $lang_grabber['no_title'];
}
if ($rss == 1){
$mgs = $lang_grabber['channel'].' <font color="green">"'.$title.' | '.$rss_url.'"</font> <font color="red">'.$lang_grabber['add_msg_rss'].'</font><br />';
msg ($lang_grabber['info'],$lang_grabber['add_channel_ms'],$mgs.($inf?'<br />* * *<br /><b style="color:#ff0000;">'.$lang_grabber['add_msg_er'].'</b><br /><br /><a class="list" href="admin.php?mod=rss&action=channel&subaction=edit&id='.$inf['id'].'"><b style="color:blue;">'.$inf['title'].'</b></a>':''),$PHP_SELF .'?mod=rss');
return 1;
}else{
$mgs = $lang_grabber['channel'].' <font color="green">"'.$title.' | '.$rss_url.'"</font> <font color="red">'.$lang_grabber['add_msg_html'].'</font><br />';
msg ($lang_grabber['info'],$lang_grabber['add_channel_ms'],$mgs.($inf?'<br />* * *<br /><b style="color:#ff0000;">'.$lang_grabber['add_msg_er'].'</b><br /><br /><a class="list" href="admin.php?mod=rss&action=channel&subaction=edit&id='.$inf['id'].'"><b style="color:blue;">'.$inf['title'].'</b></a>':''),$PHP_SELF .'?mod=rss');
return 1;
}
}
}
if (($action == 'channel') and ($subaction == 'do_change')){
if (isset ($id))
{
$stop = false;
if (!((!(trim ($id) == '') AND !($id == 0))))
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['channel_msg_id'],$PHP_SELF .'?mod=rss');
return 1;
}
$row = $db->super_query ("SELECT * FROM ".PREFIX ."_rss WHERE id ='$id'");
if ($_POST['category'] != ''){
$category = $db->safesql( implode( ',',$_POST['category']));
}else{$category = '0';}
$allow_main = intval ($_POST['allow_main']);
$allow_mod = intval ($_POST['allow_mod']);
$allow_comm = intval ($_POST['allow_comm']);
$allow_auto = intval ($_POST['allow_auto']);
$allow_load = intval ($_POST['load_img']);
$thumb_images = intval ($_POST['thumb_img']);
$allow_rate = intval ($_POST['allow_rate']);
$allow_auto = intval ($_POST['auto']);
$allow_more = intval ($_POST['allow_more']);
$allow_water = intval ($_POST['allow_watermark']);
$date_format = intval ($_POST['news_date']);
$symbol = $db->safesql ($_POST['symbols']);
$ftags = $db->safesql ($_POST['tags']);
$metatitle = $db->safesql ($_POST['meta_title']);
$meta_descr = $db->safesql ($_POST['meta_descr']);
$key_words = $db->safesql ($_POST['key_words']);
$dnast = intval ($_POST['image_align']).'='.intval ($_POST['image_align_full']).'='.intval ($_POST['show_symbol']).'='.intval ($_POST['show_metatitle']).'='.intval ($_POST['show_metadescr']).'='.intval ($_POST['show_keywords']).'='.intval ($_POST['show_url']).'='.intval ($_POST['rss_parse']).'='.intval ($_POST['tags_auto']).'='.intval ($_POST['auto_metatitle']);
$short_story = intval ($_POST['clear_short']).'='.intval ($_POST['short_img']).'='.intval ($_POST['short_full']);
$ctp = intval ($_POST['so']).'='.intval ($_POST['po']);
$dop_nast = intval ($_POST['dop_watermark']).'='.intval ($_POST['text_url']).'='.intval ($_POST['proxy']).'='.intval ($_POST['x']).'='.intval ($_POST['y']).'='.intval ($_POST['show_autor']).'='.intval ($_POST['show_tegs']).'='.intval ($_POST['show_date']).'='.intval ($_POST['show_code']).'='.intval ($_POST['show_f']).'='.intval ($_POST['null']).'='.intval ($_POST['down_radikal']).'='.intval ($_POST['margin']).'='.intval ($_POST['show_down']);
$full_link = stripslashes ($_POST['full_link']);
$date = $db->safesql(trim($_POST['date']));
$original_rss_url = $row['url'];
$rss_url = $db->safesql ($_POST['rss_url']);
$rss = intval ($_POST['rss_html']);
if (trim ($rss_url) == '')
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['error_url'],$PHP_SELF .'?mod=rss&action=channel&subaction=add');
return 1;
}
if (!(ereg ('http://',$rss_url)))
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['error_url_msg'],$PHP_SELF .'?mod=rss&action=channel&subaction=add');
return 1;
}
if ($original_rss_url != $rss_url)
{
$inf = $db->super_query ("SELECT title FROM ".PREFIX ."_rss WHERE url = '".trim($rss_url)."'");
$rss_result = get_rss_channel_info ($rss_url,intval ($_POST['proxy']));
if ($rss_result['title'] != '')
{
$channel_title = $rss_result['title'];
$channel_descr = $rss_result['description'];
$rss = '1';
}
else
{
$channel_title = $rss_result['html'];
$channel_descr = $rss_result['html'];
$rss = '0';
}
}
else
{
$channel_title = $db->safesql($_POST['rss_title']);
}
if ($stop == false)
{
$cookies = $db->safesql (str_replace ('
','|',$_POST['cookies']));
$keywords = $db->safesql (str_replace ('
','|',$_POST['keywords']));
$stkeywords = $db->safesql(str_replace ('
','|',$_POST['stkeywords']));
if ($_POST['groups'] != '')$autor_grups = implode( ',',$_POST['groups']);
$Autors = $db->safesql (str_replace ('
','|',$_POST['Autors'])).'='.$autor_grups;
$xdescr = $db->safesql ($_POST['rss_xdescr']);
$start_template = $db->safesql ($_POST['start_template']);
$finish_template = $db->safesql ($_POST['finish_template']);
$delate = $db->safesql (str_replace ('
','|',$_POST['delate']));
$inser = $db->safesql (str_replace ('
','|',$_POST['inser']));
$start = str_replace ('
','|',$_POST['start']);
$finish = str_replace ('
','|',$_POST['finish']);
$ful_start = $db->safesql ($_POST['ful_start']);
$ful_end = $db->safesql ($_POST['ful_end']);
$start_title = $db->safesql ($_POST['start_title']);
$end_title = $db->safesql ($_POST['s_title']).'=='.$db->safesql ($_POST['end_title']).'=='.$db->safesql ($_POST['s_del']).'=='.$db->safesql ($_POST['end_del']);
$start_short = $db->safesql ($_POST['start_short']);
$end_short = intval ($_POST['end_short']).'='.intval ($_POST['hide']).'='.intval ($_POST['leech']).'='.intval ($_POST['rewrite_news']);
$sart_link = $db->safesql ($_POST['sart_link']);
$end_link = $db->safesql ($_POST['end_link']);
$sart_cat = $db->safesql ($_POST['sart_cat']);
$end_cat = $db->safesql ($_POST['end_cat']);
if ($rss == '1'){
$start_title = '';
$start_short = '';
$sart_link = '';
$ctp = '';
}
$db->query( "UPDATE ".PREFIX ."_rss SET title = '$channel_title', descr = '$channel_descr', rss = '$rss',category='$category', allow_main = '$allow_main', allow_comm = '$allow_comm', allow_auto = '$allow_auto', allow_more ='$allow_more', allow_rate ='$allow_rate', cookies ='$cookies', start_template ='$start_template', finish_template ='$finish_template', delate = '$delate', load_img ='$allow_load', url ='$rss_url', allow_watermark ='$allow_water', date_format ='$date_format', keywords ='$keywords', Autors ='$Autors', thumb_img ='$thumb_images', allow_mod ='$allow_mod', stkeywords ='$stkeywords', ful_start='$ful_start', start_title='$start_title', start_short='$start_short', end_short='$end_short', sart_link='$sart_link', end_link='$end_link', sart_cat='$sart_cat', xdescr='$xdescr', inser='$inser', start='$start', finish='$finish', end_title = '$end_title', end_link = '$end_link', short_story='$short_story', dop_nast='$dop_nast', full_link='$full_link', ctp='$ctp', date= '$date', dnast='$dnast', symbol='$symbol', ftags='$ftags', metatitle='$metatitle', meta_descr='$meta_descr', key_words='$key_words' WHERE id ='$id'");
if (trim ($channel_title) != '')
{
$title = stripslashes (strip_tags ($channel_title));
if (50 <strlen ($title))
{
$title = substr ($title,0,50) .'...';
}
}
else
{
$title = $lang_grabber['no_title'];
}
$mgs = $lang_grabber['channel'].' <font color="green">"'.$title.' | '.$rss_url.'"</font> <font color="red">'.$lang_grabber['edit_channel_ok'].'</font><br />';
msg ($lang_grabber['info'],$lang_grabber['edit_channel_ms'],$mgs.($inf?'<br />* * *<br /><b style="color:#ff0000;">'.$lang_grabber['add_msg_er'].'</b><br /><br /><a class="list" href="admin.php?mod=rss&action=channel&subaction=edit&id='.$inf['id'].'"><b style="color:blue;">'.$inf['title'].'</b></a>':''),$PHP_SELF .'?mod=rss');
return 1;
}
}
}
if (($action == 'channel') and ($subaction == 'edit')){
if (isset ($id))
{
if (!((!(trim ($id) == '') AND !($id == 0))))
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['channel_msg_id'],$PHP_SELF .'?mod=rss');
return 1;
}
$rss_channel_info = $db->super_query ("SELECT * FROM ".PREFIX ."_rss WHERE id ='$id'");
$cookies = str_replace ('|','
',stripslashes($rss_channel_info['cookies']));
$keywords = str_replace ('|','
',stripslashes ($rss_channel_info['keywords']));
$stkeywords = str_replace ('|','
',stripslashes ($rss_channel_info['stkeywords']));
$Autor = explode('=',$rss_channel_info['Autors']);
$Autors = str_replace ('|','
',stripslashes ($Autor['0']));
$short_story = explode('=',$rss_channel_info['short_story']);
$delate = str_replace ('|','
',stripslashes ($rss_channel_info['delate']));
$inser = str_replace ('|','
',stripslashes ($rss_channel_info['inser']));
$start = str_replace ('|','
',$rss_channel_info['start']);
$finish = str_replace ('|','
',$rss_channel_info['finish']);
$end_title = explode ('==',$rss_channel_info['end_title']);
$hide_leech = explode('=',$rss_channel_info['end_short']);
$ctp = explode ('=',$rss_channel_info['ctp']);
$dop_nast = explode ('=',$rss_channel_info['dop_nast']);
$dnast = explode ('=',$rss_channel_info['dnast']);
$dates = stripslashes ($rss_channel_info['date']);
if(strlen($dates) == 10)$dates = '';
echoheader ('','');
opentable ($lang_grabber['change_channel'] ,stripslashes ($rss_channel_info['title']));
if (trim($rss_channel_info['finish_template']) == ''){
$tpl->load_template ('rss_addchannel.tpl');
}else{$tpl->load_template ('old_rss_addchannel.tpl');}
$tpl->set ('{rss_html}',yesno ($rss_channel_info['rss'] == 0 ?'no': 'yes'));
$tpl->set ('{stkeywords}',$stkeywords);
$tpl->set ('{title}',$rss_channel_info['title']);
$tpl->set ('{discr}',stripslashes ($rss_channel_info['descr']));
$tpl->set ('{address}',stripslashes ($rss_channel_info['url']));
$tpl->set ('{date-format}',gen_date_format ($rss_channel_info['date_format']));
$tpl->set ('{category}',categorynewsselection (explode(',',$rss_channel_info['category']),0));
$tpl->set ('{groups}',get_groups(explode(',',$Autor['1'])));
$tpl->set ('{load-images}',yesno ($rss_channel_info['load_img'] == 0 ?'no': 'yes'));
$tpl->set ('{thumb-images}',yesno ($rss_channel_info['thumb_img'] == 0 ?'no': 'yes'));
$tpl->set ('{allow-main}',yesno ($rss_channel_info['allow_main'] == 0 ?'no': 'yes'));
$tpl->set ('{allow-mod}',yesno ($rss_channel_info['allow_mod'] == 0 ?'no': 'yes'));
$tpl->set ('{allow-comm}',yesno ($rss_channel_info['allow_comm'] == 0 ?'no': 'yes'));
$tpl->set ('{allow-rate}',yesno ($rss_channel_info['allow_rate'] == 0 ?'no': 'yes'));
$tpl->set ('{allow-full}',yesno ($rss_channel_info['allow_more'] == 0 ?'no': 'yes'));
$tpl->set ('{allow-auto}',yesno ($rss_channel_info['allow_auto'] == 0 ?'no': 'yes'));
$tpl->set ('{allow-water}',yesno ($rss_channel_info['allow_watermark'] == 0 ?'no': 'yes'));
$tpl->set ('{show_autor}',yesno ($dop_nast[5] == 0 ?'no': 'yes'));
$tpl->set ('{show_tegs}',yesno ($dop_nast[6] == 0 ?'no': 'yes'));
$tpl->set ('{show_date}',yesno ($dop_nast[7] == 0 ?'no': 'yes'));
$tpl->set ('{show_code}',yesno ($dop_nast[8] == 0 ?'no': 'yes'));
$tpl->set ('{show_down}',yesno ($dop_nast[13] == 0 ?'no': 'yes'));
$tpl->set ('{show_f}',yesno ($dop_nast[9] == 0 ?'no': 'yes'));
$tpl->set ('{show_symbol}',yesno ($dnast[2] == 0 ?'no': 'yes'));
$tpl->set ('{show_metatitle}',yesno ($dnast[3] == 0 ?'no': 'yes'));
$tpl->set ('{show_metadescr}',yesno ($dnast[4] == 0 ?'no': 'yes'));
$tpl->set ('{show_keywords}',yesno ($dnast[5] == 0 ?'no': 'yes'));
$tpl->set ('{show-url}',yesno ($dnast[6] == 0 ?'no': 'yes'));
$tpl->set ('{rss-parse}',yesno ($dnast[7] == 0 ?'no': 'yes'));
$tpl->set ('{tags-auto}',yesno ($dnast[8] == 0 ?'no': 'yes'));
$tpl->set ('{auto-metatitle}',yesno ($dnast[9] == 0 ?'no': 'yes'));
$tpl->set ('{symbol}',$rss_channel_info['symbol']);
$tpl->set ('{tags}',$rss_channel_info['ftags']);
$tpl->set ('{meta-title}',$rss_channel_info['metatitle']);
$tpl->set ('{meta-descr}',$rss_channel_info['meta_descr']);
$tpl->set ('{key-words}',$rss_channel_info['key_words']);
$tpl->set ('{hide}',yesno ($hide_leech[1] == 0 ?'no': 'yes'));
$tpl->set ('{leech}',yesno ($hide_leech[2] == 0 ?'no': 'yes'));
$tpl->set ('{rewrite-news}',yesno ($hide_leech[3] == 0 ?'no': 'yes'));
$tpl->set ('{clear-short}',yesno ($short_story[0] == 0 ?'no': 'yes'));
$tpl->set ('{short-images}',yesno ($short_story[1] == 0 ?'no': 'yes'));
$tpl->set ('{short-full}',yesno ($short_story[2] == 0 ?'no': 'yes'));
$tpl->set ('{image-align}',gen_x ($dnast[0]));
$tpl->set ('{image-align-full}',gen_x ($dnast[1]));
$tpl->set ('{start-template}',str_replace ('&','&',stripslashes ($rss_channel_info['start_template'])));
$tpl->set ('{end-template}',str_replace ('&','&',stripslashes ($rss_channel_info['finish_template'])));
$tpl->set ('{x}',gen_x ($dop_nast[3]));
$tpl->set ('{y}',gen_y ($dop_nast[4]));
$tpl->set ('{delate}',$delate);
$tpl->set ('{inser}',$inser);
$tpl->set ('{start}',$start);
$tpl->set ('{finish}',$finish);
$tpl->set ('{full-link}',stripslashes ($rss_channel_info['full_link']));
$tpl->set ('{so}',$ctp[0]);
$tpl->set ('{po}',$ctp[1]);
$tpl->set ('{dop-watermark}',yesno ($dop_nast[0] == 0 ?'no': 'yes'));
$tpl->set ('{text-url}',yesno ($dop_nast[1] == 0 ?'no': 'yes'));
$tpl->set ('{prox}',yesno ($dop_nast[2] == 0 ?'no': 'yes'));
$tpl->set ('{null}',yesno ($dop_nast[10] == 0 ?'no': 'yes'));
$tpl->set ('{down-radikal}',yesno ($dop_nast[11] == 0 ?'no': 'yes'));
$tpl->set ('{margin}',intval($dop_nast[12]));
$tpl->set ('{xdescr}',htmlspecialchars($rss_channel_info['xdescr'],ENT_QUOTES));
$tpl->set ('{ful-start}',stripslashes ($rss_channel_info['ful_start']));
$tpl->set ('{ful-end}',stripslashes ($rss_channel_info['ful_end']));
$tpl->set ('{start-title}',stripslashes ($rss_channel_info['start_title']));
$tpl->set ('{end-title}',stripslashes ($end_title[1]));
$tpl->set ('{s-title}',stripslashes ($end_title[0]));
$tpl->set ('{end-del}',stripslashes ($end_title[3]));
$tpl->set ('{s-del}',stripslashes ($end_title[2]));
$tpl->set ('{start-short}',stripslashes ($rss_channel_info['start_short']));
$tpl->set ('{end-short}',yesno ($hide_leech[0] == 0 ?'no': 'yes'));
$tpl->set ('{sart-link}',stripslashes ($rss_channel_info['sart_link']));
$tpl->set ('{end-link}',yesno ($rss_channel_info['end_link'] == 0 ?'no': 'yes'));
$tpl->set ('{sart-cat}',stripslashes ($rss_channel_info['sart_cat']));
$tpl->set ('{end-cat}',stripslashes ($rss_channel_info['end_cat']));
$tpl->set ('{date}',$dates);
$tpl->set ('{cookies}',$cookies);
$tpl->set ('{keywords}',$keywords);
$tpl->set ('{Autors}',$Autors);
foreach ($lang_grabber as $key =>$value){$tpl->set ('{'.$key.'}',$value);}
$form = ' <form method="post">
<input type="hidden" name="id" value="'.$id .'" />
<input type="hidden" name="action" value="channel" />
<input type="hidden" name="subaction" value="do_change" />';
$tpl->copy_template = $form .$tpl->copy_template .'
<input align="left" type="submit" value=" '.$lang_grabber['save'].' " >
<input type="button" value=" '.$lang_grabber['out'].' " onClick="document.location.href = \''.$PHP_SELF .'?mod=rss\'" /></form>';
$tpl->compile ('rss');
echo $tpl->result['rss'];
closetable ();
echofooter ();
return 1;
}
}
if ($action == 'save')
{
foreach ($_POST['channels'] as $channel_id)
{
$news_per_channel = intval ($_POST['news-per-channel-'.$channel_id]);
$channel_info = $db->super_query ("SELECT * FROM ".PREFIX ."_rss WHERE id ='$channel_id'");
$dop_nast = explode ('=',$channel_info['dop_nast']);
$dnast = explode ('=',$channel_info['dnast']);
$n = 1;
for ($di = 1;$di <$news_per_channel;++$di)
{
$news_selected = $_POST['sel_'.$di.$channel_id];
if ($news_selected == 1)
{
$tegs =$_POST['tags_'.$di.$channel_id];
if (count($_POST['category'.$di.$channel_id].'_') != 0)
{
$category = $db->safesql( implode( ',',$_POST['category'.$di.$channel_id.'_'] ) );
}else{$category = '0';}
$title = $_POST['title_'.$di.$channel_id];
$_POST['title'] = html_entity_decode($title);
$alt_name = totranslit ($title);
$short_story = $_POST['short_'.$di.$channel_id];
$full_story = $_POST['full_'.$di.$channel_id];
$rewrite = ($_POST['rewrite_'.$di.$channel_id] == 1 ?1 : 0);
$approve = ($_POST['mod_'.$di.$channel_id] == 1 ?1 : 0);
$allow_comm = ($_POST['comm_'.$di.$channel_id] == 1 ?1 : 0);
$allow_main = ($_POST['main_'.$di.$channel_id] == 1 ?1 : 0);
$allow_rate = intval ($channel_info['allow_rate']);
$allow_more = intval ($channel_info['allow_more']);
$added_time = $_POST['date-from-channel_'.$di.$channel_id];
$news_full_link = $_POST['news-full-link_'.$di.$channel_id];
$serv = ($_POST['serv_'.$di.$channel_id]== 1 ?1 : 0);
$radikal = ($_POST['radikal_'.$di.$channel_id]== 1 ?1 : 0);
$xfield = $_POST['xfield'.$di.$channel_id.'_'];
$author = $_POST['autor_'.$di.$channel_id];
$meta_title = $_POST['meta_title'.$di.$channel_id];
$descr = $_POST['descr'.$di.$channel_id];
$keywords = $_POST['keywords'.$di.$channel_id];
$mets = ($_POST['met_'.$di.$channel_id] == 1 ?1 : 0);
if ($mets == 1)$meta_title = $db->safesql ($meta_title.' '.$title);else $meta_title = $db->safesql ($meta_title);
$alt_name = totranslit( stripslashes( $_POST['alt_name'.$di.$channel_id] ),true,false );
$catalog_url = $db->safesql( substr( htmlspecialchars( strip_tags( stripslashes( trim( $_POST['symbol'.$di.$channel_id] ) ) ) ),0,3 ) );
if (trim ($title) != '')
{$safeTitle = $db->safesql($title);
$sql_Title = $db->query("SELECT * FROM ".PREFIX ."_post WHERE title = '$safeTitle' OR alt_name = '$alt_name'");
if ($db->num_rows ($sql_Title) == 0 or $rewrite == 1)
{
if( !empty( $xfield )) {
foreach ( $xfield as $xfielddataname =>$xfielddatavalue ) {
if( $xfielddatavalue == "") {
continue;
}
$xfielddatavalue = $db->safesql( $parse->BB_Parse( $parse->process( $xfielddatavalue ),false ) );
$xfielddataname = $db->safesql( $xfielddataname );
$xfielddataname = str_replace( "|","|",$xfielddataname );
$xfielddataname = str_replace( "\r\n","__NEWL__",$xfielddataname );
$xfielddatavalue = str_replace( "|","|",$xfielddatavalue );
$xfielddatavalue = str_replace( "\r\n","__NEWL__",$xfielddatavalue );
$filecontents[] = "$xfielddataname|$xfielddatavalue";
}
if (count($filecontents) != 0) $xfields = implode( "||",$filecontents );
}
else
{
$xfields = '';
}
if ($channel_info['allow_more'] == 1 and count($xfield) == 0)
{
$xfields = 'source_name|'.$channel_info['title'] .'||source_link|'.$full_news_link;
$xfields = $db->safesql($xfields);
}
if (trim ($channel_info['title']) != '')
{
$tit = stripslashes (strip_tags ($channel_info['title']));
if (50 <strlen ($tit))
{
$tit = substr ($tit,0,50) .'...';
}
}
else
{
$URL = get_urls(trim($channel_info['url']));
$tit = $URL['host'];
}
if ($db->num_rows ($sql_Title) >0 and $rewrite == 1){
while ( $row = $db->get_row($sql_Title) ) {
$news_id = $row['id'];
$author = $row['autor'];
}
}
if ($serv == 1 or $radikal == 1)
{
$db->close;
$xdoe = array();
$di_control = new image_controller ();
$di_control->short_story = $short_story;
$di_control->full_story = $full_story;
if($radikal == 0 and $serv == 1)
{
$di_control->proxy = $dop_nast[2];
if ($channel_info['date'] != '' and strlen($channel_info['date']) != 10){$di_control->post = $channel_info['date'];}
if ($channel_info['allow_watermark'] == 1)
{
$di_control->allow_watermark = true;
}
if ($dop_nast[0] == 1)
{
$di_control->watermark_image_light = ROOT_DIR .$config_rss ['watermark_image_light'];
$di_control->watermark_image_dark = ROOT_DIR .$config_rss['watermark_image_dark'];
}
$di_control->x = $dop_nast[3];
$di_control->y = $dop_nast[4];
$di_control->margin = $dop_nast[12];
if ($db->num_rows ($sql_Title) >0 and $rewrite == 1){
$db->query( "SELECT images FROM ".PREFIX ."_images where news_id = '".$news_id."'");
while ( $row = $db->get_row() ) {
$di_control->listimages = explode( "|||",$row['images'] );
}
$di_control->rewrite = $rewrite;
}
}else{
$di_control->radikal = $dop_nast[11];
}
if ($di_control->process()===false) {
$xdoe[] = '<i>'.$tit.'</i> ► '.$title;
}
$short_story = $di_control->short_story;
$full_story = $di_control->full_story;
if (count ($di_control->upload_images) != 0)
{
define('FOLDER_PREFIX',date("Y-m"));
$dim = '|||'.FOLDER_PREFIX.'/';
$dimages = implode ($dim,$di_control->upload_images);
$dimages = $db->safesql (FOLDER_PREFIX.'/'.$dimages);
}
}
if (trim($short_story) != ''and trim($title) != ''and trim($full_story) != '') {
$title = $db->safesql($parse->process($title));
$full_story = $db->safesql($parse->BB_Parse($parse->process($full_story),false));
$short_story = $db->safesql(create_images($parse->BB_Parse($parse->process($short_story ),false)));
$safet = $parse->decodeBBCodes($_POST['title']);
$db->connect(DBUSER,DBPASS,DBNAME,DBHOST);
$date_time = strtotime ($added_time);
if ($db->num_rows ($sql_Title) >0 and $rewrite == 1){
if ($config['version_id'] >='7.2')$tes = ", tags='$tegs'";
if ($config['version_id'] >'8.0')$fgs = ", metatitle='$meta_title', symbol='$catalog_url'";
$result = $db->query( "UPDATE ".PREFIX ."_post set date='$added_time', title='$title', short_story='$short_story', full_story='$full_story', descr='$descr', keywords='$keywords', category='$category', alt_name='$alt_name', allow_comm='$allow_comm', approve='$approve', allow_main='$allow_main', xfields='$xfields' $tes $fgs WHERE id='$news_id'");
$db->query ("UPDATE ".PREFIX ."_users SET lastdate = '$date_time' WHERE name ='$author'");
$db->query("UPDATE ".PREFIX ."_images SET images='$dimages', date='$date_time' WHERE news_id ='$news_id'");
}else{
if ($config['version_id'] >='7.2'){$te =", '$tegs'";$tes = ", tags";}
if ($config['version_id'] >'8.0'){$fg = ", '$meta_title', '$catalog_url'";$fgs = ", metatitle, symbol";}
$db->query ( "INSERT INTO ".PREFIX ."_post (autor, category, date, title, alt_name, short_story, full_story, xfields, allow_main, approve, allow_comm, allow_rate, allow_br, vote_num, news_read, fixed, descr, keywords $tes $fgs) VALUES ('$author', '$category', '$added_time', '$title', '$alt_name', '$short_story', '$full_story', '$xfields', '$allow_main', '$approve', '$allow_comm', '$allow_rate', '1', '0', '0', '0', '$descr', '$keywords' $te $fg)");
$news_id = $db->insert_id();
$db->query ("UPDATE ".PREFIX ."_users SET news_num = news_num + 1, lastdate = '$date_time' WHERE name ='$author'");
}
if( $approve == "1"and $config_rss['allow_post'] == "yes"and @file_exists(ENGINE_DIR .'/data/text.txt')) {
include ( ENGINE_DIR .'/inc/ping/pingpost.php');
$ping_msg = ' <font color="orange">'.$lang_grabber['ping_msg'].'</font>';
}
$safeT[] = '<b>'.$n.'</b> . <b style="color:green;">'.$tit.'</b> ► <a class="list" href="index.php?newsid='.$news_id.'" target="_blank"><b style="color:blue;">'.$safet.'</b></a> '.$ping_msg;
if ($tegs != ""and $db->num_rows ($sql_Title) == 0) {
$tags = array();
$tegs = explode (",",$tegs);
foreach ($tegs as $value) {
if (trim($value) != '') $tags[] = "('$news_id', '".trim($value)."')";
}
$tags = implode(", ",$tags);
$db->query("INSERT INTO ".PREFIX."_tags (news_id, tag) VALUES ".$tags);
}
}
if (trim ($dimages) != '' and $db->num_rows ($sql_Title) == 0)
{
$db->query("INSERT INTO ".PREFIX ."_images (images, news_id, author, date) VALUES ('$dimages', '$news_id', '$author', '$date_time')");
}
$n++;
}
}
}
}
}
msg ($lang_grabber['info'],$lang_grabber['info'],(sizeof($safeT)?'<b>'.$lang_grabber['post_msg_yes'].'</b><br /><br />'.implode('<br />',$safeT).'<br /><br />Итого '.sizeof($safeT).' новости ':'<b style="color:red;">'.$lang_grabber['post_msg_no'].'</b>').(sizeof($xdoe)?'<br />* * *<br /><b style="color:#ff0000;">'.$lang_grabber['post_msg_pics'].'</b><br /><br />'.implode('<br />',$xdoe):''),$PHP_SELF .'?mod=rss');
$db->free();
clear_cache ();
return 1;
}
if (preg_match('/scan/i',$action))
{
define('X_GRAB_LIMIT',strlen($action)>4?str_replace('scan','',$action):false);
$channel = $_POST['channel'];
if (count ($channel) == 0)
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['grab_msg_er'],$PHP_SELF .'?mod=rss');
return 1;
}
echoheader ('','');
opentable ($lang_grabber['grab_msg']);
echo "<script type=\"text/javascript\">
function find_relates ( id )
{
var ajax = new dle_ajax();
ajax.onShow ('');
var title = ajax.encodeVAR( document.getElementById('title_' + id).value);
var varsString = 'title=' + title;
ajax.requestFile ='engine/ajax/find_relates.php';
ajax.element = 'related_news' + id;
ajax.sendAJAX(varsString);
return false;
}
function auto_keywords ( key, id )
{
var ajax = new dle_ajax();
ajax.onShow ('');
var wysiwyg = '{$config['allow_admin_wysiwyg']}';
var short_txt = ajax.encodeVAR( document.getElementById('short_' + id).value );
var varsString = \"short_txt=\" + short_txt;
ajax.setVar(\"full_txt\", ajax.encodeVAR( document.getElementById('full' + id).value ));
ajax.setVar(\"key\", key);
ajax.requestFile = \"engine/ajax/keywords.php\";
if (key == 1) { ajax.element = 'autodescr' + id; }
else { ajax.element = 'keywords' + id;}
ajax.method = 'POST';
ajax.sendAJAX(varsString);
return false;
};
</script>
<div id='loading-layer' style='display:none;font-family: Verdana;font-size: 11px;width:200px;height:50px;background:#FFF;padding:10px;text-align:center;border:1px solid #000'><div style='font-weight:bold' id='loading-layer-text'>{$lang['ajax_info']}</div><br /><img src='{$config['http_home_url']}engine/ajax/loading.gif' border='0' /></div>";
echo '
<form method=post name="news_form" id="news_form" action="?mod=rss">
<input type="hidden" name="action" value="save" />
<div style="padding-top:5px;padding-bottom:2px;">
<table width="100%">
<tr>
<td style="padding:5px;" bgcolor="#FFFFFF">
<script>
var form = document.getElementById(\'news_form\');
// ---------------------------------
// Check column
// ---------------------------------
function check_all ( permtype , master_box) {
var checkboxes = form.getElementsByTagName(\'input\');
for (var i = 0; i < checkboxes.length; i++)
{
var element = checkboxes[i];
if ( element && (element.id != \'mod\') && (element.id != \'main\') && (element.id != \'comm\') && (element.id != \'sel\') ) {
var element_id = element.id;
var a = element_id.replace( /^(.+?)_.+?$/, "$1" );
if (a == permtype)
{
element.checked = master_box;
}
}
}
return false;
}
// ---------------------------------
// Check all categories
// ---------------------------------
function check_cat() {
var select_list = form.getElementsByTagName(\'select\');
var value = form.category.value;
for (var i = 0; i < select_list.length; i++)
{
var element = select_list[i];
element.value = value;
}
return false;
}
function preview( id )
{
dd=window.open(\'\',\'prv\',\'height=400,width=750,resizable=1,scrollbars=1\');
document.addnews.target=\'prv\';
document.addnews.title.value = document.getElementById(\'title_\' + id).value;
document.addnews.short_story.value = document.getElementById(\'short_\' + id).value;
if (document.getElementById(\'full\' + id)) {
document.addnews.full_story.value = document.getElementById(\'full\' + id).value;
} else {
document.addnews.full_story.value = "";
}
document.addnews.allow_br.value = 1;
document.addnews.submit();
}
function ShowOrHideEx(id, show) {
var item = null;
if (document.getElementById) {
item = document.getElementById(id);
} else if (document.all) {
item = document.all[id];
} else if (document.layers){
item = document.layers[id];
}
if (item && item.style) {
item.style.display = show ? "" : "none";
}
}
function xfInsertText(text, element_id) {
var item = null;
if (document.getElementById) {
item = document.getElementById(element_id);
} else if (document.all) {
item = document.all[element_id];
} else if (document.layers){
item = document.layers[element_id];
}
if (item) {
item.focus();
item.value = item.value + " " + text;
item.focus();
}
}
</script>
<link rel="stylesheet" type="text/css" media="all" href="engine/skins/calendar-blue.css" title="win2k-cold-1" />
<script type="text/javascript" src="engine/skins/calendar.js"></script>
<script type="text/javascript" src="engine/skins/calendar-en.js"></script>
<script type="text/javascript" src="engine/skins/calendar-setup.js"></script>
<script type="text/javascript" src="engine/skins/tabs.js"></script>
<script type="text/javascript" src="engine/ajax/dle_ajax.js"></script>
';
if ($config_rss['show_code'] == 'yes'){
if ($config['version_id'] <'8.0'){
include (ENGINE_DIR .'/inc/inserttag.php');
}else{include (ENGINE_DIR .'/inc/include/inserttag.php');
}
}
$rss_parser = new rss_parser ();
$rss_parser->cp = 'cp1251';
$rss_parser->stripHTML = false;
$channel_list = @implode (',',$channel);
$sql = $db->query ('SELECT * FROM '.PREFIX .('_rss WHERE id IN ('.$channel_list .') ORDER BY xpos,title ASC'));
$news_count = 1;
while ($row = $db->get_row ($sql))
{
$i = 1;
$end_title = explode ('==',$row['end_title']);
$dop_sort = explode ('=',$row['short_story']);
$dop_nast = explode ('=',$row['dop_nast']);
$ctp = explode ('=',$row['ctp']);
$start = stripslashes($row['start']);
$finish = stripslashes($row['finish']);
$start_template = stripslashes ($row['start_template']);
$finish_template = stripslashes ($row['finish_template']);
$dnast = explode ('=',$row['dnast']);
if (trim ($start) != ''and trim ($finish) != '')
{
$start = explode ('|',$start);
$finish = explode ('|',$finish);
}
$cookies = str_replace("|","; ",str_replace("\r","",stripslashes(rtrim($row['cookies']))));
$allow_mod = ($row['allow_mod'] == 0 ?'checked': '');
$allow_main = ($row['allow_main'] == 1 ?'checked': '');
$allow_comm = ($row['allow_comm'] == 1 ?'checked': '');
$serv = ($row['load_img'] == 1 ?'checked': '');
$radikal = ($dop_nast[11] == 1 ?'checked': '');
$channel_id = $row['id'];
$hide_leech = explode('=',$row['end_short']);
$rewrite = ($hide_leech[3] == 1 ?'checked': '');
$met = ($dop_nast[9] == 1 ?'checked': '');
$rss = $row['rss'];
if (count ($ctp) == 0 and $rss == 1){$ctp[0] = 0;$ctp[1] = 0;}
$URL = get_urls(trim($row['url']));
echo ' <input type="hidden" name="channels[]" value="'.$channel_id .'" />
<fieldset style="border:1px dashed #c4c4c4;">
<legend>'.$row['title'].'<br /><a href="http://'.$URL['host'].'" target="_blank"><font color="blue">http://'.$URL['host'].'</font></a></legend>'.'';
$news_per_channel = 1;
if ($ctp[1] >0 and ($ctp[0] == 0 or $ctp[0] == '')) $ctp[0] = '1';
for ($cv=$ctp[0];$cv<=$ctp[1];$cv++)
{
if ($cv != 0 and $rss == 0)
{
if ($row['full_link'] == ''){
$rows = $row['url']."/page/".$cv."/";
}else {
$rows = str_replace ('{num}',$cv,$row['full_link']);
}
if ($cv == 0 or $cv == 1 ) $pg = $lang_grabber['pst_st'];else $pg = $lang_grabber['pst'].$cv;
echo '<table width="100%">
<tr>
<td ><a href="'.$rows.'" target="_blank"><b><font color="orange">'.$pg.'</font></b></a></td>
</tr>
</table>';
$URL = get_urls(trim($rows));
}
if ($rss == 1){
$rss_result = $rss_parser->Get ($row['url'],$dop_nast[2]);
}else{
$URLitems = get_full ($URL[scheme],$URL['host'],$URL['path'],$URL['query'],$cookies,$dop_nast[2]);
if (charset($URLitems) != strtolower($config['charset']) AND $URLitems!= "") $URLitems = convert(charset($URLitems),strtolower($config['charset']).'//TRANSLIT',$URLitems);
if ($row['ful_start'] != '')$rss_result = get_page ($URLitems,$row['ful_start']);else $rss_result = get_dle($URLitems);
}
$time_stamp = time () +$config['date_adjust'] * 60;
$time = date ('Y-m-d H:i:s',$time_stamp);
if ($rss_result)
{
if ($rss == 1){
if (X_GRAB_LIMIT&&$rss_result>X_GRAB_LIMIT) {
$rss_result['items_count'] = X_GRAB_LIMIT;
$rss_result['items'] = array_slice($rss_result['items'],0,X_GRAB_LIMIT);
}
$rss_result = $rss_result['items'];
}else{
if (X_GRAB_LIMIT&&$rss_result>X_GRAB_LIMIT) {
$result = count($rss_result);
$result = X_GRAB_LIMIT;
$rss_result = array_slice($rss_result,0,X_GRAB_LIMIT);
}
}
$news_str_channel = 1;
foreach ($rss_result as $item)
{
unset ($news_tit);
if ($rss == 1){
$news_tit = rss_strip ($item['title']);
$short_story = rss_strip($item['description']);
$news_link = stripslashes ($item['link']);
$tags_tmp = rss_strip ($item['category']);
}else{
if (trim($row['start_title']) != '')$news_tit = strip_tags(get_full_news($item,$row['start_title']));
if ($row['end_link'] != 1){
$short_story = get_short_news ($item,$row['start_short']);
}else{
$short_story = get_full_news ($item,$row['start_short']);
}
if (trim($row['sart_link'])==''){
$news_link = 'http://'.$URL['host'].get_link ($item);
}else{
$news_lin = get_full_news($item,$row['sart_link']);
$news_link = full_path_build ($news_lin,$URL['host']);
}
$tags_tmp =strip_tags(get_full_news($item,$row['sart_cat']));
}
$news_tit =rss_strip( title_del ($news_tit,$end_title[2],$end_title[3]));
$alt_name = totranslit( stripslashes( $news_tit ),true,false );
$safeTitle = $db->safesql($news_tit);
$sql_result = $db->query("SELECT * FROM ".PREFIX ."_post WHERE alt_name like '%".$db->safesql($alt_name)."%'");
if ($db->num_rows ($sql_result) == 0 or $news_tit =='' or $hide_leech[3] == 1)
{
if ($rss == 1){
if (trim ($news_link) == '')
{
$news_link = stripslashes ($item['guid']);
}
}
$link = replace_url(get_urls(trim($news_link)));
$short_stor = $short_story;
if ($dop_sort[0] == 0){
if ($dnast[7] == 1)$short_story = parse_Thumb ($short_story);
if (trim ($start) != '')
{
$short_story = preg_replace ($start,$finish,$short_story);
}
if ($dnast[7] == 1)$short_story = parse_rss ($short_story);
$short_story = $parse->decodeBBCodes ($short_story,false);
$short_story = rss_strip ($short_story);
$short_story = strip_tags ($short_story,'<object><embed><param><a>');
$short_story = parse_host ($short_story,$link['host']);
}else{$short_story = '';}
if (trim ($start_template) != '')
{
$full = get_full ($link[scheme],$link['host'],$link['path'],$link['query'],$cookies,$dop_nast[2]);
}
else
{
$full = '';
}
if (trim($news_tit) == '' and trim ($full) != '') $news_tit = get_title($full);
if (trim($news_tit) == '' and trim ($full) != '') $news_tit = get_tit($short_story.$full);
$news_tit =title_del ($news_tit,$end_title[2],$end_title[3]);
if (trim($news_tit) != '')$news_title =$end_title[0].' '.$news_tit.' '.$end_title[1];
$alt_name = totranslit( stripslashes( $news_tit ),true,false );
$sql_result = $db->query("SELECT * FROM ".PREFIX ."_post WHERE alt_name like '%".$db->safesql($alt_name)."%'");
if ($db->num_rows ($sql_result) == 0 or $hide_leech[3] == 1)
{
if (trim ($full) != '')
{
if (trim ($start_template) != '')
{
if (trim ($finish_template) != '')
{
$full_story = get_news ($full,$start_template,$finish_template);
}else{
if ($hide_leech[0] != 1){
$full_story = get_short_news ($full,$start_template);
}else{
$full_story = get_full_news ($full,$start_template);
}
}
$full_story = html_strip ($full_story);
if (charset($full) != strtolower($config['charset']) AND $full_story != "") {$full_story = convert(charset($full),strtolower($config['charset']).'//TRANSLIT',$full_story);}
$full_stor = $full_story;
if ($dnast[7] == 1)$full_story = parse_Thumb ($full_story);
if (trim ($start) != "")
{
$full_story = preg_replace ($start,$finish,$full_story);
}
if ($dnast[7] == 1)$full_story = parse_rss ($full_story);
$full_story = $parse->decodeBBCodes ($full_story,false);
$full_story = rss_strip ($full_story);
$full_story = strip_tags ($full_story,'<object><embed><a>');
$full_story = parse_host ($full_story,$link['host']);
}
}
else
{
$full_story = '';
}
$short_story = create_URL ($short_story,$link['host']);
$full_story = create_URL ($full_story,$link['host']);
if ($dop_nast[1] == 1){
$short_story=preg_replace( "#(^|\s|>)((http://|https://|ftp://)\w+[^<\s\[\]]+)#i","\\1[url]\\2[/url]",$short_story );
$full_story=preg_replace( "#(^|\s|>)(([url]http://|https://|ftp://)\w+[/url][^<\s\[\]]+)#i","\\1[url]\\2[/url]",$full_story );
}
if ($hide_leech[1] == '1'){
$short_story = replace_hide ($short_story);
$full_story = replace_hide ($full_story);
}
if ($hide_leech[2] == '1'){
$short_story = replace_leech ($short_story);
$full_story = replace_leech ($full_story);
}
if ($dop_sort[1] == 1 or $dop_sort[0] == 1) $short_story = get_im ($full_story).$short_story;
if (($short_story == ''and $full_story != '') or (!eregi ('\[img\]',$short_story)and !eregi ('\[thumb\]',$short_story)))
{$short_story = get_im ($full_story).$short_story;}
$short_story = replace_align ($short_story,$dnast[0]);
$full_story = replace_align ($full_story,$dnast[1]);
if ($dop_nast[10] == 1){
$short_story = trim(preg_replace('/[\r\n\n]+/mi','
',$short_story));
$full_story = trim(preg_replace('/[\r\n\n]+/mi','
',$full_story));
}
$news_title_out = $parse->decodeBBCodes($news_title);
$short_story = htmlspecialchars ($short_story);
$full_story = htmlspecialchars ($full_story);
if ($dop_sort[2] == 1) $full_story = $short_story.'<br /><br />'.$full_story;
if (!((!($row['date_format'] == 0) AND !($row['date_format'] == 1))))
{
$added_time_stamp = time () +$config['date_adjust'] * 60;
$dat = $lang_grabber['date_post'].$lang_grabber['date_flowing'];
if ($row['date_format'] == 1)
{
$interval = mt_rand ($config_rss['interval_start']*60,$config_rss['interval_finish']*60);
$added_time_stamp += $interval;
$dat = $lang_grabber['date_post'].$lang_grabber['date_casual'];
}
}
else
{
if ($rss == 1 ){
if ($row['date_format'] == 2)
{
$added_time_stamp = strtotime ($item['pubDate']) -3600;
$dat = $lang_grabber['date_post'].$lang_grabber['date_channel'];
}
}else{$added_time_stamp = time () +$config['date_adjust'] * 60;
$dat = $lang_grabber['date_post'].$lang_grabber['date_flowing'];
}
}
$str_date = date( "Y-m-d H:i:s",$added_time_stamp);
$keywords = stripslashes ($row['keywords']);
if (trim ($keywords) != '')
{
$allow_news = FALSE;
$keywords = explode ('|',$keywords);
foreach ($keywords as $word)
{
if (!((!eregi ($word,$short_story) AND !eregi ($word,$full_story) AND !eregi ($word,$news_title_out))))
{
$allow_news = TRUE;
}
}
}
else
{
$allow_news = TRUE;
}
$stkeywords = stripslashes ($row['stkeywords']);
if (trim ($stkeywords) != '')
{
$stkeywords = explode ('|',$stkeywords);
foreach ($stkeywords as $word)
{
if (!(!eregi ($word,$short_story) AND !eregi ($word,$full_story)))
{
$allow_news = FALSE;
}
}
}
if ($allow_news)
{
if (trim ($row['delate']) != '')
{
$delete = explode ('|',stripslashes($row['delate']));
$insert = explode ('|',stripslashes($row['inser']));
$short_story = str_replace ($delete,$insert,$short_story);
$full_story = str_replace ($delete,$insert,$full_story);
}
$Autor = explode('=',$row['Autors']);
if (trim($Autor[0]) != '')
{
$input=array ();
$autor = explode ("|",stripslashes($Autor[0]));
foreach ($autor as $value)
{
$input[] =trim($value);
}
}
else
{if (trim($Autor[1]) == '') $Autor[1] = $config_rss['reg_group'];
if (trim($Autor[1]) == '') $Autor[1] = 1;
$rows = $db->query ("SELECT * FROM ".PREFIX ."_users WHERE user_group IN ({$Autor[1]})");
while ($rown = $db->get_row($rows)) {
$input[] = $rown['name'];
}
}
$author = $input[array_rand ($input)];
$author_info = " <a onclick=\"javascript:window.open('?mod=editusers&action=edituser&user={$author}','User','toolbar=0,location=0,status=0, left=0, top=0, menubar=0,scrollbars=yes,resizable=0,width=540,height=500'); return(false)\" href=\"#\"><img src=\"engine/skins/images/adminrss.gif\" style=\"vertical-align: middle;border: none;\" /></a>";
$news_info = " <a onclick=\"javascript:window.open('{$news_link}','','toolbar=0,location=0,status=0, left=0, top=0, menubar=0,scrollbars=yes,resizable=0,width=540,height=500'); return(false)\" href=\"google.com\"><img src=\"engine/skins/images/addresrss.gif\" alt='Оригинал новости' title='Оригинал новости' style=\"vertical-align: middle;border: none;\" /></a>";
$metatags = create_metatags ($short_stor.$full_stor);
$descr = trim(trim(trim($row['meta_descr'].', '.$metatags['description']) ,','));
$key_words = trim(trim(trim($row['key_words'].', '.$metatags['keywords']) ,','));
$category_row = array();
$category = array();
$tags_tmps = replace_tags ($tags_tmp.','.$news_tit);
if ($dnast[8] == 1)$tags_tm = $tags_tmps[0];
$tags_tmp = strtolower (trim($row['ftags'].','.$tags_tm ,','));
if ($row['thumb_img'] == 1){
$tags = replace_tags($short_story);
$gory = explode (",",$tags_tmps[1].','.$tags[1]);
foreach ($gory as $value) {
if (trim($value) != '')$sql_cat= $db->super_query ("SELECT * FROM ".PREFIX ."_category WHERE name like '".$db->safesql(trim($value))."%' or alt_name like '".$db->safesql(trim($value))."%'");
if (trim($sql_cat) != "")
{
$category[]=$sql_cat['id'];
}
}
}
$category_row = explode (",",$row['category']);
if (count($category_row) == 1)$category_row = $row['category'];
if (count($category) != '0'){
$categories_list = CategoryNewsSelection (array_unique($category),0);
}else{
$categories_list = CategoryNewsSelection ($category_row,0);
}
unset ($news_tit);
if ($config_rss['sinonim'] == 'yes' and @file_exists (ENGINE_DIR ."/inc/plugins/sinonims.php") )
{
include_once(ENGINE_DIR ."/inc/plugins/sinonims.php");
$short_story = sinonims ($short_story);
$full_story = sinonims ($full_story);
}
$xfieldsaction = "categoryfilter";
include (ENGINE_DIR .'/inc/plugins/xfields.php');
echo $categoryfilter;
echo " <script >
$(document).ready(function(e){
$(\"select#category$i$channel_id\").change(function (e) {
var str = \"\";
$(\"select#category$i$channel_id option:selected\").each(function () {
str += $(this).text() + \" \";
});
$(\".category$i$channel_id\").text(str);
})
.trigger('change');
});
</script>
<table width=\"100%\">
<tr >
<td style=\"padding:4px\" align=\"left\" ><a href=\"javascript:ShowOrHide('full_$i$channel_id');\">$news_title_out</a>";
if ($dop_nast[5] == '0')$ava = ' style="display:none"';
if ($dop_nast[7] == '0')$avd = ' style="display:none"';
if ($dop_nast[6] == '0')$avt = ' style="display:none"';
if ($dop_nast[13] == '0')$avw = ' style="display:none"';
if ($dnast[2] == '0')$ada = ' style="display:none"';
if ($dnast[3] == '0')$add = ' style="display:none"';
if ($dnast[4] == '0')$adt = ' style="display:none"';
if ($dnast[5] == '0')$adw = ' style="display:none"';
if ($dnast[6] == '0')$adu = ' style="display:none"';
if ($dnast[2] == '0' and $dnast[3] == '0' and $dnast[4] == '0' and $dnast[5] == '0' and $dnast[6] == '0')$adg = ' style="display:none"';
if (trim ($full_story) == ''and trim ($news_link) !='')
{
echo " <br /><font color=red>{$lang_grabber['no_full_story']}</font> ==> <a href=\"$news_link\" target=\"_blank\">{$news_link}</a>";
}
echo "</td>
<td align=\"right\" ><font color=red><div class=\"category$i$channel_id\"></div></font></td>
<td width=\"1%\" ></td>
<td width=\"2%\" ><input type=\"checkbox\" name=\"rewrite_$i$channel_id\" id=\"rewrite_$i$channel_id\" {$rewrite} value=\"1\" title=\"{$lang_grabber['val_rewrite']}\" /></td>
<td width=\"2%\" ><input type=\"checkbox\" name=\"mod_$i$channel_id\" id=\"mod_$i$channel_id\" {$allow_mod} value=\"1\" title=\"{$lang_grabber['val_mod']}\" /></td>
<td width=\"2%\" ><input type=\"checkbox\" name=\"main_$i$channel_id\" id=\"main_$i$channel_id\" {$allow_main} value=\"1\" title=\"{$lang_grabber['val_main']}\"/></td>
<td width=\"2%\" ><input type=\"checkbox\" name=\"comm_$i$channel_id\" id=\"comm_$i$channel_id\" {$allow_comm} value=\"1\" title=\"{$lang_grabber['val_comm']}\"/></td>
<td width=\"2%\" class=\"list\"><input type=\"checkbox\" name=\"sel_$i$channel_id\" id=\"sel_$i$channel_id\" value=\"1\" style=\"background-color: #ffffff; color: #ff0000;\" title=\"{$lang_grabber['val_post']}\" /></td>
</tr>
<tr style=\"display:none\" id=\"full_$i$channel_id\">
<td colspan=\"7\">
<div style=\"padding-top:5px;padding-bottom:2px;\">
<table width=\"100%\">
<div class=\"hr_line\"></div>
<tr>
<td width=\"140\" height=\"29\" style=\"padding-left:5px;\">{$lang['edit_et']}</td>
<td><input size=\"70\" name=\"title_$i$channel_id\" id=\"title_$i$channel_id\" value=\"{$news_title_out}\"> <input class=\"edit\" type=\"button\" onClick=\"find_relates($i$channel_id); return false;\" style=\"width:160px;\" value=\"{$lang['b_find_related']}\"> <a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lang[hint_title]}', this, event, '220px')\">[?]</a> {$news_info} <span id=\"related_news$i$channel_id\"></span>
</td>
</tr>
<tr $ava>
<td width=\"140\" style=\"padding-left:5px;\">{$lang_grabber['author']}</td>
<td><input name=\"autor_$i$channel_id\" id=\"autor_$i$channel_id\" size=\"30\" value=\"{$author}\">$author_info</td>
</tr>
<tr $avd>
<td height=\"29\" style=\"padding-left:5px;\">{$dat}:</td>
<td><input name=\"date-from-channel_$i$channel_id\" id=\"date-from-channel_$i$channel_id\" size=\"30\" value=\"{$str_date}\">
<img src=\"engine/skins/images/img.gif\" align=\"absmiddle\" id=\"f_trigger_c_$i$channel_id\" style=\"cursor: pointer; border: 0\" title=\"{$lang['edit_ecal']}\"/>
<script type=\"text/javascript\">
Calendar.setup({inputField:\"date-from-channel_$i$channel_id\",ifFormat:\"%Y-%m-%d %H:%M\",button:\"f_trigger_c_$i$channel_id\",align : \"Br\",timeFormat:\"24\",showsTime:true,singleClick:true});
</script></td>
</tr>
</tr>
<tr>
<td height=\"29\" style=\"padding-left:5px;\">{$lang['edit_cat']}</td>
<td><select name=\"category$i$channel_id []\" id=\"category$i$channel_id\" onchange=\"onCategoryChange$i$channel_id(this.value)\" class=\"cat_select\" multiple>{ $categories_list }</select>
</td>
</tr>
<tr $avt><td width=\"140\" height=\"29\" style=\"padding-left:5px;\">{$lang_grabber['tegs_post']}:</td>
<td><input size=\"70\" name=\"tags_$i$channel_id\" value=\"{$tags_tmp}\">
</td>
</tr>
</table>
<div class=\"hr_line\"></div>
<table width=\"100%\">
<tr>
<td width=\"140\" height=\"29\" style=\"padding-left:5px;\">{$lang['addnews_short']}<br /></td>
<td>";
if ($dop_nast[8] == '1'){
echo " {$bb_code}";
}
echo "<textarea style=\"width:98%; height:200px\" onclick=\"setFieldName(this.name)\" id=\"short_$i$channel_id\" name=\"short_$i$channel_id\">{$short_story}</textarea>
</td></tr>
<tr>
<td height=\"29\" style=\"padding-left:5px;\">{$lang['addnews_full']}</td>
<td>
<textarea style=\"width:98%; height:200px\" onclick=\"setFieldName(this.name)\" id=\"full$i$channel_id\" name=\"full_$i$channel_id\">{$full_story}</textarea>
</td>
</tr>
<tr $avw>
<td height=\"29\" style=\"padding-left:5px;\">{$lang_grabber['pics_post']}:</td>
<td>
{$lang_grabber['post_serv']}
<input type=\"checkbox\" name=\"serv_$i$channel_id\" id=\"serv_$i$channel_id\" {$serv} value=\"1\" title=\"{$lang_grabber['val_serv']}\" />
{$lang_grabber['post_rad']}
<input type=\"checkbox\" name=\"radikal_$i$channel_id\" id=\"radikal_$i$channel_id\" {$radikal} value=\"1\" title=\"{$lang_grabber['val_rad']}\"/> <a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lang_grabber['help_post_rad']}', this, event, '220px')\">[?]</a>
</td>
</tr>";
if ($dop_nast[9] == '1')
{
echo "<tr >
<td style=\"padding:4px\" align=\"left\" colspan=\"7\"><a href=\"javascript:ShowOrHide('xf_$i$channel_id');\"><font color=\"green\">{$lang_grabber['doppol']}</font></a></td>
</tr>
<tr style=\"display:none\" id=\"xf_$i$channel_id\">
<td colspan=\"7\">
<table width=\"100%\">
<div class=\"hr_line\"></div>
";
if ($row['allow_more'] == 1)
{
$fieldvalue = array();
$fieldvalue['source_name'] = $row['title'];
$fieldvalue['source_link'] = $news_link;
}
$xfieldsaction = "list";
include (ENGINE_DIR .'/inc/plugins/xfields.php');
echo $output;
echo "</td>
</tr>
</table>";
}
echo "<tr $adg>
<td style=\"padding:4px\" align=\"left\" colspan=\"7\"><a href=\"javascript:ShowOrHide('dop_$i$channel_id');\"><font color=\"green\">{$lang_grabber['dopmet']}</font></a></td>
</tr>
<tr style=\"display:none\" id=\"dop_$i$channel_id\">
<td colspan=\"7\">
<table width=\"100%\" >
";
echo " <td colspan=\"2\"><div class=\"hr_line\"></div></td>
<tr $ada>
<td width=\"140\" height=\"29\" style=\"padding-left:5px;\">{$lang['catalog_url']}</td>
<td><input type=\"text\" name=\"symbol$i$channel_id\" size=\"5\" class=\"edit\" value=\"{$row['symbol']}\"><a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lang[catalog_hint_url]}', this, event, '300px')\">[?]</a></td>
</tr>
<tr $adu>
<td width=\"140\" height=\"29\" style=\"padding-left:5px;\">{$lang['addnews_url']}</td>
<td><input type=\"text\" name=\"alt_name$i$channel_id\" size=\"55\" class=\"edit\" value=\"{$alt_name}\"><a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lang[hint_url]}', this, event, '300px')\">[?]</a></td>
</tr>
<tr $add>
<td> </td>
<td>{$lang['add_metatags']}<a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('{$lang['hint_metas']}', this, event, '220px')\">[?]</a></td>
</tr>
<tr $add>
<td height=\"29\" style=\"padding-left:5px;\">{$lang['meta_title']}</td>
<td><input type=\"text\" name=\"meta_title$i$channel_id\" style=\"width:388px;\" class=\"edit\" value=\"{$row['metatitle']}\"> <input type=\"checkbox\" name=\"met_$i$channel_id\" {$met} value=\"1\" title=\"{$lang_grabber['val_met']}\" /></td>
</tr>
<tr $adt>
<td height=\"29\" style=\"padding-left:5px;\">{$lang['meta_descr']}</td>
<td><textarea type=\"text\" name=\"descr$i$channel_id\" id=\"autodescr$i$channel_id\" style=\"width:388px;height:70px;\" >{$descr}</textarea> ({$lang['meta_descr_max']})
</td>
</tr>
<tr $adw>
<td height=\"29\" style=\"padding-left:5px;\">{$lang['meta_keys']}</td>
<td><textarea name=\"keywords$i$channel_id\" id='keywords$i$channel_id' style=\"width:388px;height:70px;\">{$key_words}</textarea><br />
</td>
</tr>
</td>
</tr>
</table>";
echo "
<tr>
<td><input onClick=\"preview($i$channel_id)\" type=\"button\" value=\"{$lang['btn_preview']}\"></td>
</tr>
</td>
</tr>
</table>
<div class=\"hr_line\"></div>
</table>
<table cellpadding=\"4\" cellspacing=\"0\" width=\"100%\">
<tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=7></td></tr>
</table>";
++$i;
++$news_count;
++$news_per_channel;
++$news_str_channel;
continue;
}
}
}
}
if ($news_count == 1)
{
echo '<div align="center" class="navigation">- '.$lang_grabber['no_news'].' -</div>';
}
$str = $news_str_channel -1;
if ($cv != 0 and $rss == 0)
{
if ($str == 1) $now = 'новость';elseif($str <4 ) $now = $lang_grabber['news_sm'];else $now = $lang_grabber['post_big'];
if ($str == 0)
{
echo '<font color="#339900">- '.$lang_grabber['no_news'].' -</font>';
}else{
echo '
<table cellpadding="4" cellspacing="0">
<tr><td class="navigation" style="padding:4px">
<font color="green">'.$lang_grabber['yes_news'].' : <b>'.$str.'</b> '.$now.'</font>
</td></tr>
</table>';}
}
}
}
$kol = $news_per_channel -1 ;
echo ' <input type="hidden" name="news-per-channel-'.$channel_id .'" value="'.$news_per_channel .'" />
<table cellpadding="4" cellspacing="0">
<tr><td class="navigation" style="padding:4px">
'.$lang_grabber['yes_news'].' : <b>'.$kol .'</b>'.$lang_grabber['post_big'].'
</td></tr>
</table>
</fieldset>';
continue;
}
$db->free();
$categories_list = categorynewsselection (0,0);
echo '<br/>';
unterline ();
$kolv = $news_count -1 ;
echo ' <table cellpadding="4" cellspacing="0" width="100%">
<tr >
<td class="navigation" style="padding:4px">
'.$lang_grabber['news_all'].': <b>'.$kolv .'</b>
</td>
<td align="right" style="padding:4px; padding-right:15px">
'.$lang_grabber['gl_val'].':
<select name="category" id="category" onChange="check_cat();" class="edit">
'.$categories_list .'
</select>
<input type="checkbox" name="rewrite_all" id="rewrite_all" onClick="check_all(\'rewrite\', this.checked);" title="'.$lang_grabber['val_rewrite'].' ('.$lang_grabber['val_all'].')">
<input type="checkbox" name="approve" id="approve" onClick="check_all(\'mod\', this.checked);" title="'.$lang_grabber['val_mod'].' ('.$lang_grabber['val_all'].')">
<input type="checkbox" name="main_all" id="main_all" onClick="check_all(\'main\', this.checked);" title="'.$lang_grabber['val_main'].' ('.$lang_grabber['val_all'].')">
<input type="checkbox" name="comm_all" id="comm_all" onClick="check_all(\'comm\', this.checked);" title="'.$lang_grabber['val_comm'].' ('.$lang_grabber['val_all'].')">
<input type="checkbox" name="select_all" id="select_all" onClick="check_all(\'sel\', this.checked);" title="'.$lang_grabber['val_all'].'">
</td>
</tr>
</table>
<table cellpadding="4" cellspacing="0" width="100%">
<tr>
<td align="right" style="padding:4px">
<input align="left" type="submit" value=" '.$lang_grabber['news_add'].' " >
</td>
</tr>
</table>
</td>
</tr>
</table>
</div></form>
';
echo "<form method=post name=\"addnews\" id=\"addnews\">
<input type=hidden name=\"mod\" value=\"preview\">
<input type=hidden name=\"title\" value=\"\">
<input type=hidden name=\"short_story\" value=\"\">
<input type=hidden name=\"full_story\" value=\"\">
<input type=hidden name=\"allow_br\" value=\"1\">
</form>";
unterline ();
closetable ();
echofooter ();
return 1;
}
if ($action=='config'){
if($_POST["act"] == "sav"){
$grups = array ('reg_group'=>implode (',',$_POST['conf_logs_']));
$config_rss = $module_info +$_POST['conf_log'] +$grups;
$handler = fopen(ENGINE_DIR.'/data/rss_config.php',"w");
fwrite($handler,"<?
");
fwrite($handler,"\$config_rss = ".var_export ($config_rss,true).';'."\n?".'>');
fclose($handler);
clear_cache ();
msg("info",$lang['opt_sysok'],"$lang[opt_sysok_1]<br /><br /><a href=$PHP_SELF?mod=rss>$lang[db_prev]</a>");
}
elseif($_POST["act"] != "sav")
{echoheader('','');
opentable ('Конфигурация RSS грабера');
$config_form ='';
foreach ( $user_group as $group )
$sys_group_arr[$group['id']] = $group['group_name'];
$sys_group = get_groups();
echo '
<form method="post" name="config" id="config">
<input type="hidden" name="act" value="sav">
<table width="100%">';
tablehead ($lang_grabber['options_new']);
showRow( $lang_grabber['down_pics'],$lang_grabber['help_down_pics_glob'],makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[down_image]",$config_rss['down_image'] ) );
echo '<tr>
<td colspan="2" style="padding:4px" class="option"><b>'.$lang_grabber['align'].':</b><a href="#" class="hintanchor" onMouseover="showhint(\''.$lang_grabber['help_align'].'\', this, event, \'420px\')">[?]</a></td>
</tr>';
showRo('<span class=small><b>'.$lang_grabber['align_short'].'</b></span>','',makeDropDown( array ("3"=>$lang['opt_sys_none'],"2"=>$lang['opt_sys_left'],"1"=>$lang['opt_sys_center'],"0"=>$lang['opt_sys_right'] ),"conf_log[image_align]",$config_rss['image_align'] ) );
showRow( '<span class=small><b>'.$lang_grabber['align_full'].'</b></span>','',makeDropDown( array ("3"=>$lang['opt_sys_none'],"2"=>$lang['opt_sys_left'],"1"=>$lang['opt_sys_center'],"0"=>$lang['opt_sys_right'] ),"conf_log[image_align_full]",$config_rss['image_align_full'] ) );
showRow( $lang_grabber['watermark_add_glob'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[allow-water]",$config_rss['allow-water'] ) );
showRow( $lang_grabber['cat_auto'],$lang_grabber['help_cat_auto'],makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[cat]",$config_rss['cat'] ) );
showRow( $lang_grabber['rewrite'],$lang_grabber['help_rewrite'],makeDropDown( array ("no"=>$lang['opt_sys_no'] ,"yes"=>$lang['opt_sys_yes']),"conf_log[rewrite-news]",$config_rss['rewrite-news'] ) );
showRow( $lang_grabber['moderation'],'',makeDropDown( array ("no"=>$lang['opt_sys_no'] ,"yes"=>$lang['opt_sys_yes']),"conf_log[allow-mod]",$config_rss['allow-mod'] ) );
showRow( $lang_grabber['post_index'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[allow-main]",$config_rss['allow-main'] ) );
showRow( $lang_grabber['rating'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[allow-comm]",$config_rss['allow-comm'] ) );
showRow( $lang_grabber['commentary'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[allow-rate]",$config_rss['allow-rate'] ) );
showRow( $lang_grabber['add_auto'],$lang_grabber['help_add_auto'],makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[allow-auto]",$config_rss['allow-auto'] ) );
if ($config_rss['reg_group'] != ''){$config_rss_group = explode (',',$config_rss['reg_group']);}else{$config_rss_group = 1;}
showRow( $lang_grabber['group_author_default'],$lang_grabber['help_group_author_default'],makeDropDowns( $sys_group_arr,"conf_logs",$config_rss_group ) );
tablehead ($lang_grabber['dop_options_new']);
showRow( $lang_grabber['shortstory_del'],$lang_grabber['help_shortstory_del'],makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[clear-short]",$config_rss['clear-short'] ) );
showRow( $lang_grabber['add_pics_shortstory'],$lang_grabber['help_add_pics_shortstory'],makeDropDown( array ("no"=>$lang['opt_sys_no'],"yes"=>$lang['opt_sys_yes']),"conf_log[short-images]",$config_rss['short-images'] ) );
showRow( $lang_grabber['shortstory_fulstory'],$lang_grabber['help_shortstory_fulstory'],makeDropDown( array ("no"=>$lang['opt_sys_no'],"yes"=>$lang['opt_sys_yes']),"conf_log[short-full]",$config_rss['short-full'] ) );
showRow( $lang_grabber['del_empty_line'],$lang_grabber['help_del_empty_line'],makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[null]",$config_rss['null'] ) );
showRow( $lang_grabber['text_url_active'],$lang_grabber['help_text_url_active'],makeDropDown( array ("no"=>$lang['opt_sys_no'],"yes"=>$lang['opt_sys_yes']),"conf_log[text-url]",$config_rss['text-url'] ) );
showRow( $lang_grabber['active_hide'],$lang_grabber['help_active_hide'],makeDropDown( array ("no"=>$lang['opt_sys_no'],"yes"=>$lang['opt_sys_yes']),"conf_log[hide]",$config_rss['hide'] ) );
showRow( $lang_grabber['active_leech'],$lang_grabber['help_active_leech'],makeDropDown( array ("no"=>$lang['opt_sys_no'],"yes"=>$lang['opt_sys_yes']),"conf_log[leech]",$config_rss['leech'] ) );
showRow( $lang_grabber['dop_watermark'],$lang_grabber['help_dop_watermark'],makeDropDown( array ("no"=>$lang['opt_sys_no'],"yes"=>$lang['opt_sys_yes']),"conf_log[dop-watermark]",$config_rss['dop-watermark'] ) );
echo '<tr>
<td colspan="2" style="padding:4px" class="option">'.$lang_grabber['place_watermark'].'<a href="#" class="hintanchor" onMouseover="showhint(\''.$lang_grabber['help_place_watermark'].'\', this, event, \'420px\')">[?]</a></td>
</tr>';
showRo( '<span class=small><b>'.$lang_grabber['place_watermark_x'].'</b></span>','',makeDropDown( array ("right"=>$lang['opt_sys_right'],"center"=>$lang['opt_sys_center'],"left"=>$lang['opt_sys_left'] ),"conf_log[x]",$config_rss['x'] ) );
showRow( '<span class=small><b>'.$lang_grabber['place_watermark_y'].'</b></span>','',makeDropDown( array ("bottom"=>$lang_grabber['opt_below'],"center"=>$lang['opt_sys_center'],"top"=>$lang_grabber['opt_above'] ),"conf_log[y]",$config_rss['y'] ) );
showRow( $lang_grabber['padding_watermark'],$lang_grabber['help_padding_watermark'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[margin]' value=\"{$config_rss['margin']}\" size=10>");
echo "<tr>
<td colspan=\"2\" style=\"padding:4px\" class=\"option\">".$lang_grabber['site_watermark']."<a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('".$lang_grabber['help_site_watermark']."', this, event, '380px')\">[?]</a></td>
</tr>";
showRo('<span class=small><b>light</b></span>','',"<input class=edit type=text style=\"text-align: center;\" name='conf_log[watermark_image_light]' value=\"{$config_rss['watermark_image_light']}\" size=50>");
showRow('<span class=small><b>dark</b></span>','',"<input class=edit type=text style=\"text-align: center;\" name='conf_log[watermark_image_dark]' value=\"{$config_rss['watermark_image_dark']}\" size=50>");
tablehead ($lang_grabber['options_data']);
showRow( $lang_grabber['date_news'],$lang_grabber['help_date_news_glob'],makeDropDown( array ("0"=>$lang_grabber['date_flowing'],"1"=>$lang_grabber['date_casual'],"2"=>$lang_grabber['date_channel']),"conf_log[date]",$config_rss['date'] ) );
showRow($lang_grabber['interval_min'],$lang_grabber['help_interval_min'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[interval_start]' value=\"{$config_rss['interval_start']}\" size=10>");
showRow($lang_grabber['interval_max'],$lang_grabber['help_interval_min'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[interval_finish]' value=\"{$config_rss['interval_finish']}\" size=10>");
tablehead ($lang_grabber['down_radikal_glob']);
showRow( $lang_grabber['down_pics_radikal'],$lang_grabber['help_down_glob_radikal'],makeDropDown( array ("no"=>$lang['opt_sys_no'] ,"yes"=>$lang['opt_sys_yes']),"conf_log[down_radikal]",$config_rss['down_radikal'] ) );
showRow( $lang_grabber['radikal_water'],$lang_grabber['help_radikal_water'],makeDropDown( array ("no"=>$lang['opt_sys_no'],"yes"=>$lang['opt_sys_yes'] ),"conf_log[water_radikal]",$config_rss['water_radikal'] ) );
showRow( $lang_grabber['radikal_post'],$lang_grabber['help_radikal_post'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[post_radikal]' value=\"{$config_rss['post_radikal']}\" size=50>");
showR( $lang_grabber['num_radikal'],"<a href=\"#\" class=\"hintanchor\" onMouseover=\"showhint('".$lang_grabber['help_num_radikal']."', this, event, '670px')\">[?]</a>",$lang_grabber['num_radikal_default'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[url_radikal]' value=\"{$config_rss['url_radikal']}\" size=10>");
tablehead ($lang_grabber['vizual']);
showRow( $lang_grabber['display_author'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_autor]",$config_rss['show_autor'] ) );
showRow( $lang_grabber['display_date'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_date]",$config_rss['show_date'] ) );
showRow( $lang_grabber['display_tag'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_tegs]",$config_rss['show_tegs'] ) );
showRow( $lang_grabber['display_bbcode'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_code]",$config_rss['show_code'] ) );
showRow( $lang_grabber['display_down'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_down]",$config_rss['show_down'] ) );
showRow( $lang_grabber['display_xfields'],$lang_grabber['help_display_xfields'],makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_f]",$config_rss['show_f'] ) );
showRow( $lang_grabber['display_catalog_grab'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_symbol]",$config_rss['show_symbol'] ) );
showRow( $lang_grabber['display_url_grab'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_url]",$config_rss['show_url'] ) );
showRow( $lang_grabber['display_meta_title_grab'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_show_metatitle]",$config_rss['show_metatitle'] ) );
showRow( $lang_grabber['display_meta_descr_grab'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_metadescr]",$config_rss['show_metadescr'] ) );
showRow( $lang_grabber['display_meta_keys_grab'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[show_keywords]",$config_rss['show_keywords'] ) );
tablehead ($lang_grabber['independent_options']);
showRow('Размер изображения для короткой новости','',"<input class=edit type=text style=\"text-align: center;\" name='conf_log[maxWidth]' value=\"{$config_rss['maxWidth']}\" size=10>");
showRow($lang_grabber['news_grab'],$lang_grabber['help_news_grab'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[news_kol]' value=\"{$config_rss['news_kol']}\" size=10>");
showRow($lang_grabber['crone_glob'],$lang_grabber['help_crone_glob'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[news_limit]' value=\"{$config_rss['news_limit']}\" size=10>");
showRow( $lang_grabber['ping'],$lang_grabber['help_ping'],makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[allow_post]",$config_rss['allow_post'] ) );
if( @file_exists (ENGINE_DIR ."/inc/plugins/sinonims.php") )showRow( $lang_grabber['sinonims'],'',makeDropDown( array ("yes"=>$lang['opt_sys_yes'],"no"=>$lang['opt_sys_no'] ),"conf_log[sinonim]",$config_rss['sinonim'] ) );
showRow($lang_grabber['proxy'],$lang_grabber['adress_proxy'],"<input class=edit type=text style=\"text-align: center;\" name='conf_log[proxy]' value=\"{$config_rss['proxy']}\" size=50>");
if (file_exists(ENGINE_DIR ."/inc/plugins/files/proxy.txt"))$files = '<font color="green">'.$lang_grabber['msg_proxy_yes'].'</font> <font color="blue">'.date( "Y-m-d H:i:s",filectime(ENGINE_DIR ."/inc/plugins/files/proxy.txt")).'</font>';else $files = '<font color="green">'.$lang_grabber['msg_proxy_no'].'</font>';
showRow($lang_grabber['file_proxy'],$lang_grabber['help_file_proxy'].'<br />'.$files.'',makeDropDown( array ("no"=>$lang['opt_sys_no'] ,"yes"=>$lang['opt_sys_yes']),"conf_log[proxy_file]",$config_rss['proxy_file'] ) );
echo '
<tr>
<td colspan="2"><div class="hr_line"></div></td>
</tr>
<tr>
<td align="left">
<input type="submit" value=" '.$lang_grabber['save'].' " style="width:100px;">
<input type="button" value=" '.$lang_grabber['out'].' " onClick="document.location.href = \''.$PHP_SELF .'?mod=rss\'" />
</tr>
</table>
</form>';
echo '
<table width="100%">
<tr>
<td colspan="2"><div class="hr_line"></div></td>
</tr>
<tr><td background="engine/skins/images/mline.gif" height=1 colspan=2></td></tr>
<tr>
<td style="padding:4px" class="option">
<b>'.$lang_grabber['down_file_proxy'].'</b><br /><span class=small>'.$lang_grabber['help_down_file_proxy'].'</span>
<td width=394 align=middle >
<form action="?mod=rss" method=post enctype="multipart/form-data" name="form" id="form">
<input type="hidden" name="action" value="upload">
<input type=file name=uploadfile>
<input type=submit value='.$lang['db_load_a'].'></form>
</tr><tr><td background="engine/skins/images/mline.gif" height=1 colspan=2></td></tr></table>';
closetable ();
echofooter ();
return 1;
}
}
if( $action == 'upload') {
if (!is_dir(ENGINE_DIR ."/inc/plugins/files")){
@mkdir(ENGINE_DIR ."/inc/plugins/files",0777);
@chmod(ENGINE_DIR ."/inc/plugins/files",0777);
}
$uploadfile = ENGINE_DIR."/inc/plugins/files/proxy.txt";
if (@move_uploaded_file($_FILES['uploadfile']['tmp_name'],$uploadfile) and $_FILES['uploadfile']['type'] == 'text/plain')
{
msg($lang_grabber['info'],$lang_grabber['info'],$lang['files_upok'],$PHP_SELF .'?mod=rss&action=config');
}else{
@unlink($uploadfile);
msg($lang_grabber['info'],$lang_grabber['info'],$lang['images_uperr_3'],$PHP_SELF .'?mod=rss&action=config');
}
}
if ($action == 'copy_channel')
{
$ids = $_POST['channel'];
if (count ($ids) == 0)
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['copy_channel_er'],$PHP_SELF .'?mod=rss');
return 1;
}
foreach ($ids as $id)
{
$copy = $db->super_query ("SELECT * FROM ".PREFIX ."_rss WHERE id = '$id'");
$title = '[Копия] '.$copy['title'];
$start = $db->safesql ($copy['start']);
$finish = $db->safesql ($copy['finish']);
$db->query ("INSERT INTO ".PREFIX ."_rss (url, title, descr, category, allow_main, allow_comm, allow_rate, allow_auto, load_img, allow_more, start_template, finish_template, cookies, allow_watermark, date_format, keywords, Autors, thumb_img, allow_mod, stkeywords, rss, ful_start, start_title, end_title, start_short, end_short, sart_link, sart_cat, xdescr, xpos, delate, inser, start, finish, short_story, dop_nast, ctp, full_link, date, dnast, symbol, ftags, metatitle, meta_descr, key_words) VALUES ('{$copy['url']}', '$title', '{$copy['descr']}', '{$copy['category']}', '{$copy['allow_main']}', '{$copy['allow_comm']}', '{$copy['allow_rate']}', '{$copy['allow_auto']}', '{$copy['load_img']}', '{$copy['allow_more']}', '{$copy['start_template']}', '{$copy['finish_template']}', '{$copy['cookies']}', '{$copy['allow_watermark']}', '{$copy['date_format']}', '{$copy['keywords']}', '{$copy['Autors']}', '{$copy['thumb_img']}', '{$copy['allow_mod']}', '{$copy['stkeywords']}', '{$copy['rss']}', '{$copy['ful_start']}', '{$copy['start_title']}', '{$copy['end_title']}', '{$copy['start_short']}', '{$copy['end_short']}', '{$copy['sart_link']}', '{$copy['sart_cat']}', '{$copy['xdescr']}', '0', '{$copy['delate']}', '{$copy['inser']}', '$start', '$finish' , '{$copy['short_story']}', '{$copy['dop_nast']}', '{$copy['ctp']}', '{$copy['full_link']}', '{$copy['date']}', '{$copy['dnast']}', '{$copy['symbol']}', '{$copy['ftags']}', '{$copy['metatitle']}', '{$copy['meta_descr']}', '{$copy['key_words']}' ) ");
if (trim ($copy['title']) != '')
{
$title = stripslashes (strip_tags ($copy['title']));
if (50 <strlen ($title))
{
$title = substr ($title,0,50) .'...';
}
}
else
{
$title = $lang_grabber['no_title'];
}
$mgs .= $lang_grabber['channel'].' <font color="green">"'.$title.' | '.$copy['url'].'"</font> <font color="red">'.$lang_grabber['copy_channel_ok'].'</font><br />';
}
msg ($lang_grabber['info'],$lang_grabber['channel_copy'],$mgs ,$PHP_SELF .'?mod=rss');
return 1;
}
if ($action == 'auto_channel')
{
$ids = $_POST['channel'];
if (count ($ids) == 0)
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['copy_channel_er'],$PHP_SELF .'?mod=rss');
return 1;
}
foreach ($ids as $id)
{
$auto = $db->super_query ("SELECT * FROM ".PREFIX ."_rss WHERE id = '$id'");
$db->query ("UPDATE ".PREFIX ."_rss SET allow_auto = 1 WHERE id ='$id'");
if (trim ($del['title']) != '')
{
$title = stripslashes (strip_tags ($auto['title']));
if (50 <strlen ($title))
{
$title = substr ($title,0,50) .'...';
}
}
else
{
$title = $lang_grabber['no_title'];
}
$mgs .= $lang_grabber['channel'].' <font color="green">"'.$title.' | '.$auto['url'].'"</font> <font color="red">'.$lang_grabber['auto_channel_ok'].'</font><br />';
}
clear_cache ('cron.rss');
msg ($lang_grabber['info'],$lang_grabber['channel_auto_n'],$mgs,$PHP_SELF .'?mod=rss');
return 1;
}
if ($action == 'noauto_channel')
{
$ids = $_POST['channel'];
if (count ($ids) == 0)
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['copy_channel_er'],$PHP_SELF .'?mod=rss');
return 1;
}
foreach ($ids as $id)
{
$auto = $db->super_query ("SELECT * FROM ".PREFIX ."_rss WHERE id = '$id'");
$db->query ("UPDATE ".PREFIX ."_rss SET allow_auto = '0' WHERE id = '$id' ");
if (trim ($del['title']) != '')
{
$title = stripslashes (strip_tags ($auto['title']));
if (50 <strlen ($title))
{
$title = substr ($title,0,50) .'...';
}
}
else
{
$title = $lang_grabber['no_title'];
}
$mgs .= $lang_grabber['channel'].' <font color="green">"'.$title.' | '.$auto['url'].'"</font> <font color="red">'.$lang_grabber['auto_channel_no'].'</font><br />';
}
clear_cache ('cron.rss');
msg ($lang_grabber['info'],$lang_grabber['channel_auto_n'],$mgs,$PHP_SELF .'?mod=rss');
return 1;
}
if ($action == 'del_channel')
{
$ids = $_POST['channel'];
if (count ($ids) == 0)
{
msg ($lang_grabber['info'],$lang_grabber['info'],$lang_grabber['copy_channel_er'],$PHP_SELF .'?mod=rss');
return 1;
}
foreach ($ids as $id)
{
$del = $db->super_query ("SELECT * FROM ".PREFIX ."_rss WHERE id = '$id'");
$db->query ('DELETE FROM '.PREFIX .('_rss WHERE id = \''.$id .'\''));
if (trim ($del['title']) != '')
{
$title = stripslashes (strip_tags ($del['title']));
if (50 <strlen ($title))
{
$title = substr ($title,0,50) .'...';
}
}
else
{
$title = $lang_grabber['no_title'];
}
$mgs .= $lang_grabber['channel'].' <font color="green">"'.$title.' | '.$del['url'].'"</font> <font color="red">'.$lang_grabber['del_channel_ok'].'</font><br />';
}
clear_cache ('cron.rss');
msg ($lang_grabber['info'],$lang_grabber['del_channel'],$mgs,$PHP_SELF .'?mod=rss');
return 1;
}
if ($action == 'sort') {
$xpos = $_POST['xpos'];
foreach ($xpos as $k=>$v)
{
$db->query ('UPDATE '.PREFIX .('_rss set xpos='.((int)$v).' WHERE id = \''.((int)$k) .'\''));
}
msg ($lang_grabber['info'],$lang_grabber['sort_channel'],$lang_grabber['sort_channel_ok'],$PHP_SELF .'?mod=rss');
return 1;
}
echoheader ('','');
check_disable_functions ();
opentable ($lang['rss_list']);
$sql_result = $db->query ('SELECT * FROM '.PREFIX .'_rss ORDER BY xpos,title ASC');
$empty = $db->num_rows ($sql_result) == 0;
if ($empty)
{
echo ' <table cellpadding="4" cellspacing="0" width="100%">
<tr>
<td height="40" valign="middle" align="center" class="navigation">- '.$lang_grabber['name_canal'].' -</td>
</tr>
</table>';
}
if ($еmpty){
echo ' <script>
function ckeck_uncheck_all() {
var frm = document.rss_form;
for (var i=0;i<frm.elements.length;i++) {
var elmnt = frm.elements[i];
if (elmnt.type==\'checkbox\') {
if(frm.master_box.checked == true){ elmnt.checked=false; }
else{ elmnt.checked=true; }
}
}
if(frm.master_box.checked == true){ frm.master_box.checked = false; }
else{ frm.master_box.checked = true; }
}
</script>
<form method="post" name="rss_form">
<table cellpadding="6" align="center" cellspacing="0" width="100%" border="0">
<tr>
<td width="3%" align="center" class="navigation" style="padding:4px">№</td>
<td width="3%" align="center" class="navigation" style="padding:4px">'.$lang_grabber['vid'].'</td>
<td width="3%" align="center" class="navigation" style="padding:4px">'.$lang_grabber['auto'].'</td>
<td width="50%" align="center" class="navigation" style="padding:4px">'.$lang_grabber['name_canal'].'</td>
<td width="40%" align="center" class="navigation" style="padding:4px">'.$lang_grabber['rss_description'].'</td>
<td width="3%" align="right" style="padding:4px"><input type="checkbox" name="master_box" onClick="ckeck_uncheck_all()" /></td>
</tr>
<tr>
<td colspan="6">';
unterline ();
echo '</td></tr>';
while ($row = $db->get_row ($sql_result))
{
if (trim ($row['title']) != '')
{
$title = stripslashes (strip_tags ($row['title']));
if (50 <strlen ($title))
{
$title = substr ($title,0,50) .'...';
}
}
else
{
$title = $lang_grabber['no_title'];
}
if ($row['xdescr']) {
$xdescr = htmlspecialchars($row['xdescr']);
if (strlen($xdescr)>50) {
$xdescr = substr($xdescr,0,50).'...';
}
}else {
$xdescr = ' ';
}
if ($row['allow_auto'] == 0){$auto = '';}else{$auto = '<font color=green><b>'.$lang['opt_sys_yes'].'</b></font>';}
if ($row['rss'] == 0){$rss = '<font color=blue>HTML</font>';}else{$rss = '<font color=red>RSS</font>';}
$row['url'] = stripslashes ($row['url']);
$row['descr'] = stripslashes ($row['descr']);
echo ' <tr>
<td style="padding:1px" align="center"><input type="text" name="xpos['.$row['id'].']" value="'.$row['xpos'].'" class="edit" align="center" size="3" /></td>
<td style="padding:1px" align="center">'.$rss.'</td>
<td style="padding:1px" align="center">'.$auto.'</td>
<td style="padding:4px" >
<a href="'.$row['url'] .'" target=\"_blank\">[i]</a> <a href="'.$PHP_SELF .'?mod=rss&action=channel&subaction=edit&id='.$row['id'] .'" class="hintanchor" onMouseover="showhint(\'<b>'.$row['url'] .'</b><br/>'.$row['descr'] .'\', this, event, \'300px\');">'.$title .'</a></td>
<td style="padding:4px" align="center">'.$xdescr.'</td>
<td class="list">
<input class="list" style="background-color: #ffffff; color: #ff0000;" title="'.$lang_grabber['val_post'].'" type="checkbox" name="channel[]" value="'.$row['id'] .'" />
</td>
</tr>
<tr><td background="engine/skins/images/mline.gif" height=1 colspan=6></td></tr>';
}
echo '</table>';
echo '<table cellpadding="4" width="100%"><tr><td colspan="3"><br/>';
unterline ();
echo ' </td></tr>
<tr>
<td colspan="3" align="right" style="padding:4px">
<table width="100%" border="0">
<tr>
<td class="navigation">'.$lang_grabber['help_run'].'</td>
<td align="right" valign="middle">
<table cellpadding="4" cellspacing="0">
<tr>
';
if (!($empty))
{
echo ' <td style="padding:2px">'.$lang['xfield_xact'].':</td>
<td style="padding:2px">
<select name="action">
<option value="scan" selected>'.$lang['rss_news'].'</option>
<option value="scan1">'.$lang_grabber['rss_news'].$lang_grabber['post_sm'].'</option>
<option value="scan3">'.$lang_grabber['rss_news'].'3'.$lang_grabber['post_sm'].'</option>
<option value="scan5">'.$lang_grabber['rss_news'].'5'.$lang_grabber['post_big'].'</option>
<option value="scan10">'.$lang_grabber['rss_news'].'10'.$lang_grabber['post_big'].'</option>
<option value="scan15">'.$lang_grabber['rss_news'].'15'.$lang_grabber['post_big'].'</option>
<option value="scan20">'.$lang_grabber['rss_news'].'20'.$lang_grabber['post_big'].'</option>';
if ($config_rss['news_kol'] != ''){echo '<option value="scan'.$config_rss['news_kol'].'">'.$lang_grabber['rss_news'].$config_rss['news_kol'].$lang_grabber['post_big'].'</option>';}
echo '<option value="auto_channel" style="color:green">'.$lang_grabber['channel_auto_y'].'</option>
<option value="noauto_channel">'.$lang_grabber['channel_auto_n'].'</option>
<option value="copy_channel" style="color:orange">'.$lang_grabber['channel_copy'].'</option>
<option value="sort" style="color:blue">'.$lang_grabber['channel_sort'].'</option>
<option value="del_channel" style="color:red">'.$lang_grabber['channel_del'].'</option>
</select>
</td>
<td style="padding:2px">
<input type="submit" value=" '.$lang['b_start'].' "/>
</td>';
}
echo ' <td style="padding:2px">
<input type="button" value=" '.$lang['rss_new'].' " onClick="document.location.href = \''.$PHP_SELF .'?mod=rss&action=channel&subaction=add\'" />
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table></form>';}
closetable ();
opentable ();
tableheader ($lang['tabs_extra']);
echo ' <table width="100%">
<tr><td align="left">
<input type="button" value=" '.$lang_grabber['glob_options'].' " onClick="document.location.href = \''.$PHP_SELF .'?mod=rss&action=config\'" />
<input type="button" value=" '.$lang['dle_udate'].' " onClick="document.location.href = \''.$PHP_SELF .'?mod=rss&action=update\'" />
</td></tr>
</table>';
closetable ();
opentable ();
tableheader ('');
echo ' <table cellpadding=4 cellspacing=0 width=100%>
<tr>
<td style="padding:5px;" align=center class=navigation>
<a href="http://grabberok.co.cc" target="_blank"><font color="blue"><b>'.$module_info['name'].' '.$module_info['version'].'</b></font></a><br/>
Copyright © 2009 created by Andersoni </b><br />
</td></tr>
</table>';
if ($action == 'update') {
$data = @file('http://www.grabberok.co.cc/grabbers.php');
if ($data['0'] >$module_info['version']) {
echo "<script>
function closead()
{
var obj = document.getElementById( \"ad\" );
obj.style.visibility = \"hidden\";
}
</script>
<body>
<div style=\"background: #eee; border: 1px solid black; padding: 5px; position: absolute; left:150px; top: 100px; width: 600px;\" id=\"ad\" align=\"center\">
<div style=\"background: #ccc; padding: 5px; font-weight: bold; font-size: large; text-align: center; text-transform: uppercase; letter-spacing: 0.2em;\" align=\"center\">
Обновление Скрипта
</div>
<p>
{$data['1']} {$module_info['version']}<br /><br /><font color=red><b>{$data['2']} {$data['4']}</b></font><br /><br />{$data['3']}
</p>
<p style=\"text-align: right;\">
<a href=\"javascript:closead();\">close</a>
</p>
</div>";
}else{
echo "<script>
function closead()
{
var obj = document.getElementById( \"ad\" );
obj.style.visibility = \"hidden\";
}
</script>
<body>
<div style=\"background: #eee; border: 1px solid black; padding: 5px; position: absolute; left:150px; top: 100px; width: 600px;\" id=\"ad\" align=\"center\">
<div style=\"background: #ccc; padding: 5px; font-weight: bold; font-size: large; text-align: center; text-transform: uppercase; letter-spacing: 0.2em;\" align=\"center\">
Обновление Скрипта
</div>
<p>
{$lang_grabber['update']} {$data['4']}!!!
</p>
<p style=\"text-align: right;\">
<a href=\"javascript:closead();\">{$lang_grabber['out']}</a>
</p>
</div>";
}
}
closetable ();
echofooter ();
clear_cache();
?>