Бывалый
881 сообщениий
Мужчина
|
Здравствуйте. Делаю сайт на Dle 9.4 и столкнулся с такой проблемой. RSS информеры обновляются раз в 10 минут, возможно ли сделать моментальное обновление rss?
На сколько я понимаю это вот код информера:
Code <?php
/* DataLife Engine Photoalboms v.0.09 Title for version: <'Brilliant'> Author: (c) RedRat, icq contact: 709-056 E-mail: <support@admin-club.ru> Official site: http://admin-club.ru
Name file: rss.php Description: RSS Data & time of updating: 22:32 18.12.2010 */
@session_start (); @ob_start (); @ob_implicit_flush ( 0 );
@error_reporting( E_ALL ^ E_NOTICE ); @ini_set( 'display_errors', true ); @ini_set( 'html_errors', false ); @ini_set( 'error_reporting', E_ALL ^ E_NOTICE );
define( 'DATALIFEENGINE', true );
if (strpos ( dirname( __FILE__ ), "\engine\photo" ) !== false) {
define( 'ROOT_DIR', preg_replace("/\\\engine\\\photo$/", "", dirname( __FILE__ ) ) ); define( 'ENGINE_DIR', preg_replace("/\\\photo$/", "", dirname( __FILE__ ) ) );
}else{
define( 'ROOT_DIR', preg_replace("/\/engine\/photo$/", "", dirname( __FILE__ ) ) ); define( 'ENGINE_DIR', preg_replace("/\/photo$/", "", dirname( __FILE__ ) ) );
}
require ENGINE_DIR . '/data/config.php';
if( $config['http_home_url'] == "" ) {
$config['http_home_url'] = explode( "engine/photo/rss.php", $_SERVER['PHP_SELF'] ); $config['http_home_url'] = reset( $config['http_home_url'] ); $config['http_home_url'] = "http://" . $_SERVER['HTTP_HOST'] . $config['http_home_url'];
}
require_once ENGINE_DIR . '/classes/mysql.php'; require_once ENGINE_DIR . '/data/dbconfig.php'; require_once ENGINE_DIR . '/modules/functions.php'; require_once ENGINE_DIR . '/classes/templates.class.php';
check_xss();
//groups
$user_group = get_vars ( "usergroup" );
if (! $user_group) { $user_group = array ();
$db->query ( "SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC" );
while ( $row = $db->get_row () ) {
$user_group[$row['id']] = array ();
foreach ( $row as $key => $value ) { $user_group[$row['id']][$key] = $value; }
} set_vars ( "usergroup", $user_group ); $db->free (); }
if( $_COOKIE['dle_skin'] ) { if( @is_dir( ROOT_DIR . '/templates/' . $_COOKIE['dle_skin'] ) ) { $config['skin'] = $_COOKIE['dle_skin']; } }
if ($config["lang_" . $config['skin']]) {
include_once ROOT_DIR . '/language/' . $config["lang_" . $config['skin']] . '/adminpanel.lng';
} else {
include_once ROOT_DIR . '/language/' . $config['langs'] . '/adminpanel.lng';
}
$config['charset'] = ($lang['charset'] != '') ? $lang['charset'] : $config['charset'];
if ($config['allow_registration'] == "yes") {
include_once ENGINE_DIR . '/modules/sitelogin.php'; }
if (!$is_logged) $member_id['user_group'] = 5;
if ( !$user_group[$member_id['user_group']]['allow_html'] ) {
$config['allow_site_wysiwyg'] = "no"; $_POST['short_story'] = strip_tags ($_POST['short_story']); $_POST['full_story'] = strip_tags ($_POST['full_story']);
}
$tpl = new dle_template( ); $tpl->allow_php_include = false; $tpl->dir = ROOT_DIR . '/templates/' . $config['skin'];
define( 'PHTN_DIR', ROOT_DIR.'/engine/photo/photo_nucleus' );
require_once( PHTN_DIR . '/classes/cacher.php' ); require_once( PHTN_DIR . '/functions/default.php' ); require_once( PHTN_DIR . '/classes/core.php' );
$TIME_ = time() + ($config['date_adjust'] * 60);
onLoadPhotoData();
// --- --- ---
$a = $_REQUEST['a'];
$UID = $member_id['user_group'];
// --- --- ---
if( !$_GET['id'] ) {
$rss = $cache->fromdb( 'SELECT * FROM ' . PREFIX . '_photo_sets WHERE name REGEXP "rss:" and `default` = 1 LIMIT 1' );
}else{
$rss = intval( $_GET['id'] );
$rss = $cache->fromdb( 'SELECT * FROM ' . PREFIX . '_photo_sets WHERE name = "rss:' . $rss . '" LIMIT 1' );
}
if( !$rss[0]['id'] ) {
$rss = array( 'id' => 0, 'name' => 'rss:1', 'des' => 'Новые фотографии', 'title' => 'Фотоальбомы', 'value' => 'a:8:{s:5:"count";i:10;s:6:"alboms";a:1:{i:0;s:3:"all";}s:4:"sort";i:8;s:8:"tpl_name";s:13:"photo_rss.tpl";s:4:"info";s:6:"photos";s:6:"access";i:5;s:3:"des";s:16:"Новые фотографии";s:5:"title";N;}', 'default' => 0 );
}else{
$rss = $rss[0];
}
$rss_ = unserialize( $rss['value'] );
// --- --- ---
switch( $rss_['info'] ) {
case 'photos':
switch( $rss_['sort'] ) {
case 1:
$sort = array( 'id', 'ASC' );
break;
case 2:
$sort = array( 'id', 'DESC' );
break;
case 3:
$sort = array( 'name', 'ASC' );
break;
case 4:
$sort = array( 'name', 'DESC' );
break;
case 5:
$sort = array( 'des', 'ASC' );
break;
case 6:
$sort = array( 'des', 'DESC' );
break;
case 7:
$sort = array( 'date', 'ASC' );
break;
case 8:
$sort = array( 'date', 'DESC' );
break;
case 9:
$sort = array( 'comms', 'ASC' );
break;
case 10:
$sort = array( 'comms', 'DESC' );
break;
case 11:
$sort = array( 'author', 'ASC' );
break;
case 12:
$sort = array( 'author', 'DESC' );
break;
case 13:
$sort = array( 'albom', 'ASC' );
break;
case 14:
$sort = array( 'albom', 'DESC' );
break;
case 15:
$sort = array( 'file', 'ASC' );
break;
case 16:
$sort = array( 'file', 'DESC' );
break;
case 17:
$sort = array( 'ip', 'ASC' );
break;
case 18:
$sort = array( 'ip', 'DESC' );
break;
case 19:
$sort = array( 'look', 'ASC' );
break;
case 20:
$sort = array( 'look', 'DESC' );
break;
case 21:
$sort = array( 'tegs', 'ASC' );
break;
case 22:
$sort = array( 'tegs', 'DESC' );
break;
case 23:
$sort = array( 'rating', 'ASC' );
break;
case 24:
$sort = array( 'rating', 'DESC' );
break;
case 25:
$sort = array( '', 'RAND()' );
break;
}
$in_sql = $core->access_sql( $rss_[ 'access' ] );
// --*
if( in_array( 'all', $rss_['alboms'] ) and $in_sql ) {
$alboms_rss = 'WHERE ' . $in_sql;
}elseif( in_array( 'all', $rss_['alboms'] ) and !$in_sql ){
$alboms_rss = '';
}elseif( $in_sql ){
$alboms_rss = 'WHERE ( albom = ' . join( ' or albom = ', $rss_['alboms'] ) . ') and (' . $in_sql . ')';
}elseif( !$in_sql ){
$alboms_rss = 'WHERE albom = ' . join( ' or albom = ', $rss_['alboms'] ) . ' ';
}
$sort = $alboms_rss . 'ORDER BY ' . $sort[0] . ' ' . $sort[1] . ' LIMIT ' . $rss_['count'];
if( $rss_['sort'] == 25 ) { $mass = $cache->fromdb( 'SELECT * FROM ' . PREFIX . '_photo_post ' . $sort, true );
}else{ $mass = $cache->fromdb( 'SELECT * FROM ' . PREFIX . '_photo_post ' . $sort );
}
foreach( $mass as $val ) {
$tpl->load_template( 'photo/' . $rss_['tpl_name'] );
$tpl->set( '%TITLE%', $val['name'] );
$tpl->set( '%LINK%', creatPLink( 'photo', $val['id'] ) );
$tpl->set( '%DESC%', $val['des'] );
$tpl->set( '%PREVIEW_1%', preview( 'show', $val['file'], $val[ 'dir' ] ) );
$tpl->set( '%PREVIEW_2%', preview( 'previews', $val['file'], $val[ 'dir' ] ) );
$tpl->set( '%PREVIEW_3%', preview( 'micro', $val['file'], $val[ 'dir' ] ) );
$tpl->set( '%AUTHOR%', $val['author'] );
$tpl->set( '%ALBOM%', $val['albom'] );
//Mon, 10 Aug 2009 11:17:18 +0400
$tpl->set( '%DATE%', date( "r", strtotime( $val['date'] ) ) );
$tpl->compile( 'body' );
}
$body = $tpl->result['body'];
break;
case 'alboms':
switch( $rss_['sort'] ) {
case 1:
$sort = array( 'id', 'ASC' );
break;
case 2:
$sort = array( 'id', 'DESC' );
break;
case 3:
$sort = array( 'name', 'ASC' );
break;
case 4:
$sort = array( 'name', 'DESC' );
break;
case 5:
$sort = array( 'des', 'ASC' );
break;
case 6:
$sort = array( 'des', 'DESC' );
break;
case 7:
$sort = array( 'date', 'ASC' );
break;
case 8:
$sort = array( 'date', 'DESC' );
break;
case 9:
$sort = array( 'photos', 'ASC' );
break;
case 10:
$sort = array( 'photos', 'DESC' );
break;
case 11:
$sort = array( '', 'RAND()' );
break;
}
$sort = 'ORDER BY ' . $sort[0] . ' ' . $sort[1] . ' LIMIT ' . $rss_['count'];
$mass = $cache->fromdb( 'SELECT * FROM ' . PREFIX . '_photo_alboms ' . $sort );
foreach( $mass as $val ) {
$alboms_to_super_sort[$val['main']][] = $val;
$alboms_id_main[$val['id']] = $val['main'];
}
super_alboms_rss( 0, '', $PHOTO_LAN['explode_albom_list in rss'], $rss_['tpl_name'] );
$body = $tpl->result['body'];
break;
case 'tegs':
$tegs = tegs( true ); // Array: rating, photos, teg
switch( $rss_['sort'] ) {
case 1:
$new_tegs = array();
foreach( $tegs as $index => $val ) {
$new_tegs[$index] = $val['teg'];
}
sort( $new_tegs );
$else_tegs = array();
foreach( $new_tegs as $index => $val ) {
$else_tegs[] = $tegs[$index];
}
break;
case 2:
$new_tegs = array();
foreach( $tegs as $index => $val ) {
$new_tegs[$index] = $val['teg'];
}
rsort( $new_tegs );
$else_tegs = array();
foreach( $new_tegs as $index => $val ) {
$else_tegs[] = $tegs[$index];
}
break;
case 3:
$new_tegs = array();
foreach( $tegs as $index => $val ) {
$new_tegs[$index] = $val['photos'];
}
sort( $new_tegs );
$else_tegs = array();
foreach( $new_tegs as $index => $val ) {
$else_tegs[] = $tegs[$index];
}
break;
case 4:
$new_tegs = array();
foreach( $tegs as $index => $val ) {
$new_tegs[$index] = $val['photos'];
}
rsort( $new_tegs );
$else_tegs = array();
foreach( $new_tegs as $index => $val ) {
$else_tegs[] = $tegs[$index];
}
break;
case 5:
$new_tegs = array();
foreach( $tegs as $index => $val ) {
$new_tegs[$index] = $val['rating'];
}
sort( $new_tegs );
$else_tegs = array();
foreach( $new_tegs as $index => $val ) {
$else_tegs[] = $tegs[$index];
}
break;
case 6:
$new_tegs = array();
foreach( $tegs as $index => $val ) {
$new_tegs[$index] = $val['rating'];
}
rsort( $new_tegs );
$else_tegs = array();
foreach( $new_tegs as $index => $val ) {
$else_tegs[] = $tegs[$index];
}
break;
case 7:
$else_tegs = $tegs;
shuffle( $else_tegs );
break;
}
$tegs = array_slice( $else_tegs, 0, $rss_['count'] );
foreach( $tegs as $val ) {
if( $rss_['all'] ) {
$echo_tegs[] = '<a href="' . creatPLink( 'tegs', $val['teg'] ) . '" style="font-size:' . $PHOTO_LAN[ 'css_tegs_' . $val['rating'] ] . '" titile="' . $PHOTO_LAN['tegsphotos'] . $val['photos'] . '">' . $val['teg'] . '</a>';
}else{
$echo_tegs[] = array( 'link' => creatPLink( 'tegs', $val['teg'] ), 'teg' => $val['teg'], 'size' => $val['rating'], 'photos' => $val['photos'] );
}
}
if( $rss_['all'] ) {
$tpl->load_template( 'photo/' . $rss_['tpl_name'] );
$tpl->set( '%TITLE%', $PHOTO_LAN['rss_tegs_title'] );
$tpl->set( '%LINK%', creatPLink( 'main' ) );
$tpl->set( '%DESC%', join( $PHOTO_LAN['explode rss tegs'], $echo_tegs ) );
$tpl->set( '%SIZE%', '' );
$tpl->compile( 'body' );
}else{
foreach( $echo_tegs as $val ) {
$tpl->load_template( 'photo/' . $rss_['tpl_name'] );
$tpl->set( '%TITLE%', $val['teg'] );
$tpl->set( '%SIZE%', $val['size'] );
$tpl->set( '%LINK%', creatPLink( 'tegs', $val['teg'] ) );
$tpl->set( '%DESC%', $PHOTO_LAN['tegsphotos'] . $val['photos'] );
$tpl->compile( 'body' );
}
}
$body = $tpl->result['body'];
break;
}
// --- --- ---
if( $body ) {
$tpl->load_template( 'photo/rss.tpl' );
$tpl->set( '%CODING%', $PHOTO_LAN['coding'] );
$tpl->set( '%TITLE%', $rss['title'] );
$tpl->set( '%DESC%', $rss['des'] );
$tpl->set( '%LINK%', creatPLink( 'main' ) );
$tpl->set( '%LANG%', $PHOTO_LAN['lan'] );
$tpl->set( '%PROGRAMM%', $PHOTO_LAN['rss_title_gen'] );
$tpl->set( '%BODY%', $body );
$tpl->compile( 'rss' );
@header( "Content-type: application/xml; charset=" . $config['charset'] );
echo strtolower( $config['charset'] ) != "windows-1251" ? iconv( "windows-1251", "UTF-8//IGNORE", $tpl->result['rss'] ) : $tpl->result['rss'];
exit();
}else{
$body = read_html( 'rss' );
}
exit();
?> Добавлено (29.05.2012, 21:28) --------------------------------------------- Ребят, никто не в курсе что-ли?
|
|
|
|
|
Coder
627 сообщений
Мужчина
|
Moool13, добавил он новость, удаляется кеш, обновляется rss, создается кеш. далее услове, если кеш есть выводим из кеша, если нет то отправляем запросы в бд и создаем.
|
|
|
|
|