Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ((int)sad_option('dis_deviant')==1){
- header('http/1.0 503');
- $sad_contype='text/html; charset=utf-8';
- return;
- }
- $qf_c=mysql_fetch_assoc(mysql_query('select * from `'.$sad_prefix.'da_feed` where `id`='.sad_safe_mysql($_GET['id'])));
- if ((int)$qf_c['id']==0){
- header('http/1.0 404');
- $sad_contype='text/html; charset=utf-8';
- return;
- }
- if ($qf_c['time']<time()-6*3600 and ($_SERVER['REMOTE_ADDR']==my_ip() or iam() ) ){
- $allfeed=array();
- $q=mysql_query('select `id`, `sname`, `time`, `data` from `'.$sad_prefix.'da_item` where `parent`='.sad_safe_mysql($_GET['id']));
- while ($q_c=mysql_fetch_assoc($q)){
- $fd.='; '.$q_c['title'];
- if ($q_c['time']>=time()-5*3600){
- $buf=$q_c['data'];
- }else{
- $ch=curl_init('http://backend.deviantart.com/rss.xml?q=boost%3Anewest%20'.urlencode($q_c['sname']));
- curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
- $buf=curl_exec($ch);
- mysql_query('update `'.$sad_prefix.'da_item` set `data`="'.sad_safe_mysql($buf).'", `time`=UNIX_TIMESTAMP() where `id`='.$q_c['id']);
- }
- $feed=sad_xml_rawtext($buf);
- for ($i=1;true;$i++){
- if (strlen(sad_xml_getnode($feed,'channel/item|'.$i.'/title#'))<1){break;}
- preg_match('|([0-9]+)$|',sad_xml_getnode($feed,'channel/item|'.$i.'/link#'),$a);
- preg_match('|/([^/]+?)" alt="thumbnail"|',sad_xml_getnode($feed,'channel/item|'.$i.'/description#'),$b);
- $ff =' <title>'.sad_safe_html(sad_xml_getnode($feed,'channel/item|'.$i.'/title#')).'</title>
- <link>'.sad_xml_getnode($feed,'channel/item|'.$i.'/link#').'</link>
- <guid isPermaLink="true">'.sad_xml_getnode($feed,'channel/item|'.$i.'/guid#').'</guid>
- <pubDate>'.sad_xml_getnode($feed,'channel/item|'.$i.'/pubDate#').'</pubDate>
- <description>'.sad_safe_xml(sad_xml_getnode($feed,'channel/item|'.$i.'/description#'));
- if (strlen(sad_xml_getnode($feed,'channel/item|'.$i.'/description#'))>0){
- if (preg_match('_\\.(jpe?g|png|gif|bmp)_i',sad_xml_getnode($feed,'channel/item|'.$i.'/description#'))){
- $t='Full image';
- }else{$t='Read text';}
- $ff.=sad_safe_xml('<br><a target="_blank" href="http://www.deviantart.com/download/'.$a[1].'/'.$b[1].'">'.$t.'</a>');
- }
- $ff.='</description>';
- $allfeed[sad_xml_getnode($feed,'channel/item|'.$i.'/guid#')]=$ff;
- }
- }
- $buf=''; foreach ($allfeed as $guid => $item){
- $buf.="<item>\r\n".$item."\r\n</item>\r\n\r\n";
- }
- mysql_query('update `'.$sad_prefix.'da_feed` set `data`="'.sad_safe_mysql($buf).'", `time`=UNIX_TIMESTAMP() where `id`='.$qf_c['id']);
- $dd=time();
- }else{
- $buf=$qf_c['data'];
- $dd =$qf_c['time'];
- }
- // print_r($allfeed);exit;
- $sad_contype='application/rss+xml; charset=UTF-8';
- $sad_hide=true;
- echo '<'.'?xml version="1.0" encoding="utf-8"?'.'>';
- ?><rss version="2.0"
- xmlns:media="http://search.yahoo.com/mrss/"
- xmlns:atom="http://www.w3.org/2005/Atom">
- <channel>
- <title>{#php:$qf_c['title']#} / DeviantArt</title>
- <link>http://kanaria.ru/deviantart/</link>
- <description>deviantART RSS for sort:time boost:{#php:substr($fd,2)#}</description>
- <language>en-us</language>
- <copyright>Copyright 2011, deviantART.com con KanariaRu</copyright>
- <pubDate>{#php:gmdate("D, d M Y H:i:s \G\M\T",$dd)#}</pubDate>
- <generator>KanariaRu</generator>
- <docs>http://blogs.law.harvard.edu/tech/rss</docs>
- {#php:$buf#}
- </channel></rss><!-- {#php:gmdate("d.m.Y H:i:sO",$dd)#} -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement