rssout.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 226 行

PHP
226
字号
<?php/*+--------------------------------------------------------------------------|   Invision Power Board v2.1.5|   =============================================|   by Matthew Mecham|   (c) 2001 - 2005 Invision Power Services, Inc.|   |   =============================================|   Web: |   Time: Wed, 01 Mar 2006 19:11:27 GMT|   Release: |   Licence Info: +---------------------------------------------------------------------------|   > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $|   > $Revision: 23 $|   > $Author: matt $+---------------------------------------------------------------------------||   > XML OUT Functions for XmlHttpRequest functions|   > Module written by Matt Mecham|   > Date started: Friday 18th March 2005||	> Module Version Number: 1.1.0+--------------------------------------------------------------------------*/if ( ! defined( 'IN_IPB' ) ){	print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files.";	exit();}class rssout{	# Classes	var $ipsclass;	    /*-------------------------------------------------------------------------*/    // Constructor    /*-------------------------------------------------------------------------*/        function rssout()    {    	$this->xml_header = '<?xml version="1.0" encoding="ISO-8859-1"?'.'>';    }        /*-------------------------------------------------------------------------*/    // Auto run    /*-------------------------------------------------------------------------*/        function auto_run()    {    	//-----------------------------------------    	// INIT    	//-----------------------------------------    	    	if ( $this->ipsclass->input['j_do'] )    	{    		$this->ipsclass->input['do'] = $this->ipsclass->input['j_do'];    	}    	    	//-----------------------------------------    	// What shall we do?    	//-----------------------------------------    	    	switch( $this->ipsclass->input['do'] )    	{    		default:    			$this->ipsclass->input['type'] == 'calendar' ? $this->rss_calendar_out_show() : $this->rss_out_show();    			break;    	}    }        /*-------------------------------------------------------------------------*/	// Get new posts	/*-------------------------------------------------------------------------*/          function rss_calendar_out_show()    {    	//-----------------------------------------    	// INIT    	//-----------------------------------------    	    	$cal_id   = intval( $_REQUEST['id'] );    	$rss_data = array();    	$to_print = '';    	$expires  = time();    	    	//-----------------------------------------    	// Get RSS export    	//-----------------------------------------    	    	$rss_data = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',    																  'from'   => 'cal_calendars',    																  'where'  => 'cal_id='.$cal_id ) );    	    	//-----------------------------------------    	// Got one?    	//-----------------------------------------    	    	if ( $rss_data['cal_id'] AND $rss_data['cal_rss_export'] )    	{    		//-----------------------------------------    		// Correct expires time    		//-----------------------------------------    		    		$expires += $rss_data['cal_rss_update'] * 60;    		    		//-----------------------------------------    		// Need to recache?    		//-----------------------------------------    		    		$time_check = time() - ( $rss_data['cal_rss_update'] * 60 );    		    		if ( $time_check > $rss_data['cal_rss_update_last'] )    		{    			//-----------------------------------------    			// Yes    			//-----------------------------------------    			    			define( 'IN_ACP', 1 );    			    			require_once( ROOT_PATH.'sources/action_admin/calendars.php' );    			$rss_export           =  new ad_calendars();    			$rss_export->ipsclass =& $this->ipsclass;    			    			$to_print = $rss_export->calendar_rss_cache( $rss_data['cal_id'], 0 );    		}    		else    		{    			//-----------------------------------------    			// No    			//-----------------------------------------    			    			$to_print = $rss_data['cal_rss_cache'];    		}    	}    	    	@header('Content-Type: text/xml');		@header('Expires: ' . gmdate('D, d M Y H:i:s', $expires) . ' GMT');		@header('Cache-Control: must-revalidate, post-check=0, pre-check=0');		@header('Pragma: public');		print $to_print;		exit();    }           /*-------------------------------------------------------------------------*/	// Get new posts	/*-------------------------------------------------------------------------*/          function rss_out_show()    {    	//-----------------------------------------    	// INIT    	//-----------------------------------------    	    	$rss_export_id = intval( $_REQUEST['id'] );    	$rss_data      = array();    	$to_print      = '';    	$expires       = time();    	    	//-----------------------------------------    	// Get RSS export    	//-----------------------------------------    	    	$rss_data = $this->ipsclass->DB->build_and_exec_query( array( 'select' => '*',    																  'from'   => 'rss_export',    																  'where'  => 'rss_export_id='.$rss_export_id ) );    	    	//-----------------------------------------    	// Got one?    	//-----------------------------------------    	    	if ( $rss_data['rss_export_id'] AND $rss_data['rss_export_enabled'] )    	{    		//-----------------------------------------    		// Correct expires time    		//-----------------------------------------    		    		$expires += $rss_data['rss_export_cache_time'] * 60;    		    		//-----------------------------------------    		// Need to recache?    		//-----------------------------------------    		    		$time_check = time() - ( $rss_data['rss_export_cache_time'] * 60 );    		    		if ( $time_check > $rss_data['rss_export_cache_last'] )    		{    			//-----------------------------------------    			// Yes    			//-----------------------------------------    			    			define( 'IN_ACP', 1 );    			    			require_once( ROOT_PATH.'sources/action_admin/rssexport.php' );    			$rss_export           =  new ad_rssexport();    			$rss_export->ipsclass =& $this->ipsclass;    			    			$to_print = $rss_export->rssexport_rebuild_cache( $rss_data['rss_export_id'], 0 );    		}    		else    		{    			//-----------------------------------------    			// No    			//-----------------------------------------    			    			$to_print = $rss_data['rss_export_cache_content'];    		}    	}    	    	@header('Content-Type: text/xml; charset='.$this->ipsclass->vars['gb_char_set'] );		@header('Expires: ' . gmdate('D, d M Y H:i:s', $expires) . ' GMT');		@header('Cache-Control: must-revalidate, post-check=0, pre-check=0');		@header('Pragma: public');		print $to_print;		exit();    }           }?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?