doexpiresubs.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 145 行
PHP
145 行
<?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: Actually expire subs| > Script written by Matt Mecham| > Date started: 12th July 2005 (Tuesday)|+--------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/// THIS TASKS OPERATIONS:// Actually expire subscriptions/*-------------------------------------------------------------------------*/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 $task = ""; /*-------------------------------------------------------------------------*/ // Our 'auto_run' function // ADD CODE HERE /*-------------------------------------------------------------------------*/ function run_task() { //----------------------------------------- // INIT //----------------------------------------- define( 'IN_ACP', 1 ); $expire_ids = array(); //----------------------------------------- // Get all subs to expire //----------------------------------------- $this->ipsclass->DB->simple_construct( array( 'select' => '*', 'from' => 'subscription_trans', 'where' => "subtrans_state='paid' AND subtrans_end_date < ".time() ) ); $outer = $this->ipsclass->DB->simple_exec(); while ( $row = $this->ipsclass->DB->fetch_row( $outer ) ) { $query = array( "sub_end" => 0 ); if ( $row['subtrans_old_group'] > 0 ) { //--------------------------------------- // Group still exist? //--------------------------------------- if ( is_array( $this->ipsclass->cache['group_cache'][ $row['subtrans_old_group'] ] ) ) { $query['mgroup'] = $row['subtrans_old_group']; } else { //--------------------------------------- // Group has been deleted, reset back to base member group //--------------------------------------- $query['mgroup'] = $this->ipsclass->vars['member_group']; } } $expire_ids[ $row['subtrans_id'] ] = $row['subtrans_id']; //--------------------------------------- // Update member //--------------------------------------- $this->ipsclass->DB->do_update( 'members', $query, "id=".intval($row['subtrans_member_id']) ); } //--------------------------------------- // Update rows... //--------------------------------------- if ( count( $expire_ids ) ) { $this->ipsclass->DB->do_update( 'subscription_trans', array( 'subtrans_state' => "expired" ), "subtrans_id IN (".implode(",",$expire_ids ).")" ); } //----------------------------------------- // Unlock Task: DO NOT MODIFY! //----------------------------------------- $this->class->append_task_log( $this->task, intval(count($expire_ids))." members unsubscribed" ); $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 + =
减小字号Ctrl + -
显示快捷键?