В чём ошибка?

C
На сайте с 01.08.2010
Offline
43
1044

В общем установил RSS GRABBER на сайт, и мне нужна публикация по крону, но при запуске "крона" из браузера выдаёт ошибку:

Parse error: syntax error, unexpected T_ELSE in /home/waketwo/data/www/xyuha.ru/cron/cron.rss.php on line 214

Сам код:

<?php

/*
=====================================================
Скрипт модуля Rss Grabber 3.6.7

http://rss-grabber.ru/
Автор: Andersoni
со Автор: Alex
Copyright (c) 2009-2010
=====================================================
*/
@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);
error_reporting (1);
define('DATALIFEENGINE',true);
extract($_REQUEST,EXTR_SKIP);
define('ROOT_DIR',dirname(dirname(__FILE__)));
define('ENGINE_DIR',ROOT_DIR .'/engine');
require_once ENGINE_DIR .'/init.php';
require_once ENGINE_DIR .'/classes/parse.class.php';
$parse = new ParseFilter (array (),array (),1,1);
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_once ENGINE_DIR.'/data/rss_config.php';
$start1=gettimeofday();
$i=0;
while (!$grabber) {
$rss_cron_array = get_vars('cron.rss');
if (!$rss_cron_array)$rss_cron_array = array();
$rss_cron_data = get_vars('cron.rss.data');
if (!$rss_cron_data) $rss_cron_data = array();

$sql_result = $db->query("SELECT * FROM ".PREFIX ."_rss WHERE allow_auto = '1'");
$pnum = $db->num_rows ($sql_result);
$grabber = false;
$found = false;

while ($channel_info = $db->get_row($sql_result)) {
$grabber = false;

$channel_id = $channel_info['id'];
$found = in_array($channel_id,$rss_cron_array);
if (!$found) {
++$i;
$data_cron = time() - $rss_cron_data[$channel_id];
$dnast = explode ('=',$channel_info['dnast']);
if (intval($dnast[16]) != 0)$cron_data = $dnast[16]*60;
else $cron_data = 0;
if ($data_cron >= $cron_data)
{
$rss_cron_data[$channel_id] = time();
$grabber = start_process($channel_id,$channel_info);
}
$rss_cron_array[] = $channel_id;
};
if($grabber == true) break;
if ($pnum == $i){$grabber = true; break;}
};
set_vars('cron.rss.data',$rss_cron_data);
if ( count($rss_cron_array) >= $pnum ) $rss_cron_array = array();
set_vars('cron.rss',$rss_cron_array);
}


if( function_exists('memory_get_peak_usage') ) {
$mem_usage = memory_get_peak_usage(true);
if ($mem_usage < 1024)
echo $mem_usage." bytes";
elseif ($mem_usage < 1048576)
$memory_usage = round($mem_usage/1024,2)." кб";
else
$memory_usage = round($mem_usage/1048576,2)." мб";
}

$end1=gettimeofday();
$totaltime1 = (float)($end1['sec'] - $start1['sec']) + ((float)($end1['usec'] - $start1['usec'])/1000000);

echo "<br /><br /> Использовано памяти - ".$memory_usage."<br />Время выполнения - ".$totaltime1;

function start_process($channel_id,$channel_info)
{
global $db,$parse,$config,$config_rss;

$id_list = array();
$end_title = explode ('==',$channel_info['end_title']);
$dop_sort = explode ('=',$channel_info['short_story']);
$dop_nast = explode ('=',$channel_info['dop_nast']);
$ctp = explode ('=',$channel_info['ctp']);
$start_template = stripslashes ($channel_info['start_template']);
$finish_template = stripslashes ($channel_info['finish_template']);
$sart_cat = explode('|||', $channel_info['sart_cat']);
$dnast = explode ('=',$channel_info['dnast']);
$cookies = str_replace('|||',"; ",str_replace("\r","",stripslashes(rtrim($channel_info['cookies']))));
$allow_main = $channel_info['allow_main'];
$dates = explode ('=',$channel_info['date']);
$allow_mod = $channel_info['allow_mod'];
$allow_comm = $channel_info['allow_comm'];
$allow_rate = $channel_info['allow_rate'];
if ($allow_mod == 1){$approve = "0";}else{$approve = "1";}
$hide_leech = explode('=',$channel_info['end_short']);
$rss = $channel_info['rss'];

$rss_parser = new rss_parser();
if ($rss == 1){
$rss_parser->default_cp = $dop_nast[14];
$rss_result = $rss_parser->Get ($channel_info['url'],$dop_nast[2]);
}else{
$URL = get_urls(trim($channel_info['url']));
$URLitems = get_full ($URL[scheme],$URL['host'],$URL['path'],$URL['query'],$cookies,$dop_nast[2], $dop_sort[8]);
if (trim($dop_nast[14]) == ''or $dop_nast[14] == '0'){$charik = charset($URLitems);}else{ $charik = $dop_nast[14];}
if ($channel_info['ful_start'] != ''){$rss_result = get_page ($URLitems,$channel_info['ful_start']);}else{ $rss_result = get_dle($URLitems);}
}
if ($rss_result) {
if ($rss == 1){
$rss_items = $rss_result['items'];
}else{
$rss_items = $rss_result;
}
$i = 0;
foreach ($rss_items as $item) {
if ($config_rss['news_limit'] ==""){ $config_rss['news_limit'] = '15'; }
if ($i == $config_rss['news_limit']){ break;}
if (intval($dop_nast[19]) != 0)sleep ($dop_nast[19]);
unset ($news_link);
unset ($news_tit);
if ($rss == 1){
$news_tit = rss_strip ($item['title']);
$short_story = $item['description'];
$news_link = stripslashes ($item['link']);
$tags_tmp = rss_strip ($item['category']);
}else{
if ($charik != strtolower($config['charset']) AND $item!= "") $item = convert($charik,strtolower($config['charset']),$item);
if (trim($channel_info['start_title']) != '')$news_tit = strip_tags(get_full_news($item,$channel_info['start_title']));
if ($channel_info['end_link'] != 1){
$short_story = get_short_news ($item,$channel_info['start_short']);
}else{
$short_story = get_full_news ($item,$channel_info['start_short']);
}
if (trim($channel_info['sart_link'])==''){
$tu_link = get_link ($item);
$news_link = 'http://'.$URL['host'].'/index.php?newsid='.$tu_link;
}else{
$news_lin = get_full_news($item,$channel_info['sart_link']);
$news_link = full_path_build ($news_lin,$URL['host']);
}
//$tags_tmp =strip_tags(get_full_news($item,$sart_cat[0]));
//$data_tmp =strip_tags(get_full_news($item,$sart_cat[1]));
}
if (trim($end_title[2]) !== '' and trim($news_tit) !== '')$news_tit =rss_strip( relace_news ($news_tit,$end_title[2],$end_title[3]));
$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 $news_tit =='' or $hide_leech[3] == 1 or $dop_sort[12] == 0)
{
if ($rss == 1){
if (trim ($news_link) == '')
{
$news_link = stripslashes ($item['guid']);
}
}
$link = replace_url(get_urls(trim($news_link)));
if($dop_sort[9] != 0) {
$short_story = preg_replace('#\n#i','', $short_story);
}
$short_stor = $short_story;

$short_story = rss_strip($short_story);
if ($dop_sort[0] == 0){
$short_story = parse_Thumb ($short_story);
if (trim($channel_info['start']) != '')$short_story = relace_news ($short_story,$channel_info['start'],$channel_info['finish']);
$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><br /><br><BR><BR />'.$dop_sort[5]);
$short_story = parse_host ($short_story,$link['host']);
if($dop_sort[13] == 1 and $short_story != '') {$short_story = rss_strip (translate_google ($short_story, $dop_sort[14] , $dop_sort[15] ));}
$short_story = preg_replace("#&quot;#", '"', $short_story );
}else{$short_story = '';}
$full_story = '';

$news_lik = $news_link;
for ($j=1; $j <= 10; $j++){

$stoped = false;
if (trim($channel_info['dop_full']) == '' and $j != '1'){$stoped = true;}


if ($dop_nast[18] == 0 ){
if (trim($channel_info['dop_full'])!= '' and $j >= 2){

$news_link = str_replace('http://', '', $news_lik);
$fl = explode('/',$news_link);
$news_linke = '';
for ($k=0;$k<(count($fl)-1); $k++){
$news_linke .= $fl[$k].'/';
}
$news_linke .= str_replace('{num}', $j, $channel_info['dop_full']);
$news_link = 'http://'.$news_linke.end($fl);
}
}
else{
if ($j >= 2) $news_link = $news_link.'/'.str_replace('{num}', $j, $channel_info['dop_full']);
}
echo $news_link.'<br />';
$link = replace_url(get_urls(trim($news_link)));

$full = get_full ($link[scheme],$link['host'],$link['path'],$link['query'],$cookies,$dop_nast[2], $dop_sort[8]);
} else{ break; }

Строка 214:

} else{ break; }

cren добавил 01.08.2010 в 09:36

В чём может быть проблема, и как её исправить?

[Удален]
#1

у вас инструкция "} else{ break; }" относится к "for ($j=1; $j <= 10; $j++){"

выкладывать код php нужно в соответствующем теге, иначе листинг не читается. Вряд ли кто-то будет по коду восстанавливать, что делает скрипт.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий