⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 expiresubs.php

📁 sabreipb 2.1.6 utf-8中文版本!
💻 PHP
字号:
<?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:30 GMT|   Release: |   Licence Info: +---------------------------------------------------------------------------|   > $Date: 2005-10-10 14:08:54 +0100 (Mon, 10 Oct 2005) $|   > $Revision: 23 $|   > $Author: matt $+---------------------------------------------------------------------------||   > TASK SCRIPT: Test|   > Script written by Matt Mecham|   > Date started: 28th January 2004|+--------------------------------------------------------------------------*///+--------------------------------------------------------------------------// THIS TASKS OPERATIONS:// Sends out an email if the subspackage is about to expire//+--------------------------------------------------------------------------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 task_item{	var $class     = "";	var $root_path = "";	var $task      = "";		/*-------------------------------------------------------------------------*/	// Our 'auto_run' function	// ADD CODE HERE	/*-------------------------------------------------------------------------*/		function run_task()	{		//-----------------------------------------		// GET EMAIL CLASS		//-----------------------------------------				require_once( $this->root_path."sources/classes/class_email.php" );		$this->email = new emailer( $this->root_path );        $this->email->ipsclass =& $this->ipsclass;        $this->email->email_init();        		//-----------------------------------------		// INIT		//-----------------------------------------				$members = array();		$ids     = array();		$expired = time() + 86400 + 3600; // Tomorrow + 1 hour		$now     = time() - 3600;				//-----------------------------------------		// Get members		//-----------------------------------------				$this->ipsclass->DB->build_query( array( 'select'   => 'st.subtrans_member_id',												 'from'     => array( 'subscription_trans' => 'st' ),												 'where'    => "st.subtrans_state='paid' AND st.subtrans_end_date >= $now AND st.subtrans_end_date <= $expired",												 'add_join' => array( 0 => array( 'select' => 'm.id, m.name, m.members_display_name, m.email',																				  'from'   => array( 'members' => 'm' ),																				  'where'  => 'm.id=st.subtrans_member_id',																				  'type'   => 'left' ) ) ) );			$this->ipsclass->DB->exec_query();					while( $r = $this->ipsclass->DB->fetch_row() )		{			$members[ $r['id'] ] = $r;			$ids[] = $r['id'];		}				//-----------------------------------------		// Get subscription packages		//-----------------------------------------				if ( count( $ids ) )		{			$this->ipsclass->DB->build_query( array( 'select'   => 'st.subtrans_sub_id, st.subtrans_member_id',													 'from'     => array( 'subscription_trans' => 'st' ),													 'where'    => 'st.subtrans_member_id IN ('.implode( ",", $ids ) . ") AND st.subtrans_state='paid'",													 'add_join' => array( 0 => array( 'select' => 's.sub_title',																					  'from'   => array( 'subscriptions' => 's' ),																					  'where'  => 's.sub_id=st.subtrans_sub_id',																					  'type'   => 'left' ) ) ) );					$this->ipsclass->DB->exec_query();						while( $r = $this->ipsclass->DB->fetch_row() )			{				$members[ $r['subtrans_member_id'] ]['sub_title'] = $r['sub_title'];			}					//-----------------------------------------			// Send out the EMAILS			//-----------------------------------------						foreach( $members as $id => $member )			{				$this->email->get_template("subscription_expires");				$this->email->build_message( array(													'PACKAGE'  => $member['sub_title'],													'EXPIRES'  => $this->ipsclass->get_date( $member['sub_end'], 'DATE' ),													'LINK'     => $this->ipsclass->vars['board_url'].'/index.'.$this->ipsclass->vars['php_ext'].'?act=paysubs&CODE=index',										   )     );								$this->email->to = trim( $member['email'] );				$this->email->send_mail();			}		}				//-----------------------------------------		// Log to log table - modify but dont delete		//-----------------------------------------				$this->class->append_task_log( $this->task, intval(count($ids)).' Members sent an expiration email' );				//-----------------------------------------		// Unlock Task: DO NOT MODIFY!		//-----------------------------------------				$this->class->unlock_task( $this->task );	}		/*-------------------------------------------------------------------------*/	// register_class	// LEAVE ALONE	/*-------------------------------------------------------------------------*/		function register_class(&$class)	{		$this->class     = $class;		$this->ipsclass  =& $class->ipsclass;		$this->root_path = $this->class->root_path;	}		/*-------------------------------------------------------------------------*/	// pass_task	// LEAVE ALONE	/*-------------------------------------------------------------------------*/		function pass_task( $this_task )	{		$this->task = $this_task;	}		}?>

⌨️ 快捷键说明

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