paysubscriptions.php

来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 1,024 行 · 第 1/3 页

PHP
1,024
字号
<?php/*+--------------------------------------------------------------------------|   Invision Power Board v2.1.5|   ========================================|   by Matthew Mecham|   (c) 2001 - 2005 Invision Power Services|   |   ========================================|   Web: |   Time: Wed, 01 Mar 2006 19:11:27 GMT|   Release: |   Email: matt@invisionpower.com+---------------------------------------------------------------------------|   INVISION POWER BOARD IS NOT FREE SOFTWARE!|   +---------------------------------------------------------------------------||   > Subsmanager Public Action Script|   > Script written by Matt Mecham|   > Date started: 31st March 2005 (14:45)|+--------------------------------------------------------------------------*/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 paysubscriptions{	# Global	var $ipsclass;	var $lib;	var $class      = "";	var $module     = "";	var $html       = "";	var $ucp_html   = "";	var $member     = "";	var $nav        = "";	var $page_title = "";	var $gateway    = "";	var $method     = "";	var $method_name = "";	var $day_to_seconds = array( 'd' => 86400,								 'w' => 604800,								 'm' => 2592000,								 'y' => 31536000,							   );							   	var $all_currency  = array();	var $def_currency  = array();	var $cho_currency  = array();	var $is_from_ucp   = 1;		/*-------------------------------------------------------------------------*/	// Constructer, called and run by IPB	/*-------------------------------------------------------------------------*/		function auto_run()	{		//--------------------------------------------		// Check..		//--------------------------------------------				if ( ! defined( 'IPB_CALLED' ) )		{			define( 'IPB_CALLED', 1 );		}				//--------------------------------------------		// From the CP?		//--------------------------------------------				if ( $this->ipsclass->input['nocp'] )		{			$this->is_from_ucp = 0;		}				//--------------------------------------------    	// Require the HTML and language modules    	//--------------------------------------------    			$this->ipsclass->load_language('lang_ucp' );		$this->ipsclass->load_language('lang_subscriptions' );				$this->ipsclass->load_template('skin_subscriptions');    	$this->ipsclass->load_template('skin_ucp');    	    	//--------------------------------------------		// Load extra db cache file		//--------------------------------------------				$this->ipsclass->DB->load_cache_file( ROOT_PATH.'sources/sql/'.SQL_DRIVER.'_subsm_queries.php', 'sql_subsm_queries' );				//---------------------------------------------		// Load Payment handler		//---------------------------------------------				require_once( ROOT_PATH . 'sources/handlers/han_paysubscriptions.php' );		$this->gateway           = new han_paysubscriptions();		$this->gateway->ipsclass =& $this->ipsclass;		$this->gateway->main_init();				//=====================================		// Set up structure		//=====================================				switch( $this->ipsclass->input['CODE'] )		{			case 'paymentmethod':				$this->_load_menu();				$this->do_payment_method();				break;							case 'paymentscreen':				$this->_load_menu();				$this->do_payment_screen();				break;							case 'incoming':				$this->do_validate_payment();				break;							case 'custom':				$this->run_custom();				break;							case 'cancelfromreg':				$this->cancel_from_reg();				break;							default:				$this->_load_menu();				$this->do_index();				break;		}				if ( $this->is_from_ucp )		{			$fj = $this->ipsclass->build_forum_jump();						$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->CP_end();						$this->output .= $this->ipsclass->compiled_templates['skin_ucp']->forum_jump($fj, $links);		}		else		{			$this->output .= $this->ipsclass->compiled_templates['skin_subscriptions']->sub_no_cp_end();		}				//--------------------------------------		// Any special message?		//--------------------------------------				if ( $this->ipsclass->input['msgtype'] == 'fromreg' )		{			$msg = $this->ipsclass->compiled_templates['skin_subscriptions']->sub_msg_fromreg();		}		else if ( $this->ipsclass->input['msgtype'] == 'force' )		{			$msg = $this->ipsclass->compiled_templates['skin_subscriptions']->sub_msg_force();		}		else if ( $this->ipsclass->input['msgtype'] == 'general' )		{			$msg = $this->ipsclass->compiled_templates['skin_subscriptions']->sub_msg_general();		}		else		{			$msg = "";		}				if ( $msg )		{			$this->ipsclass->print->to_print = str_replace( "<!--{MSG}-->", $msg, $this->ipsclass->print->to_print );		}				$this->nav[] = "<a href='".$this->ipsclass->base_url."act=UserCP&amp;CODE=00'>".$this->ipsclass->lang['t_title']."</a>";		$this->nav[] = "<a href='".$this->ipsclass->base_url."act=paysubs&amp;CODE=index'>".$this->ipsclass->lang['s_page_title']."</a>";    	    	$this->ipsclass->print->add_output( $this->output );        $this->ipsclass->print->do_output( array( 'TITLE' => $this->ipsclass->lang['s_page_title'], 'JS' => 1, NAV => $this->nav ) );			}		/*-------------------------------------------------------------------------*/	// Cancel purchase, remove pkg ID from members	/*-------------------------------------------------------------------------*/		function cancel_from_reg()	{		$this->ipsclass->DB->do_update( 'members', array( 'subs_pkg_chosen' => 0 ), 'id='.intval($this->ipsclass->member['id']) );				$this->ipsclass->boink_it( $this->ipsclass->base_url );	}			/*-------------------------------------------------------------------------*/	// Do return payment screen	/*-------------------------------------------------------------------------*/		function do_validate_payment()	{		$type = preg_replace( "/[^a-zA-Z0-9\-\_]/", "" , $this->ipsclass->input['type'] );				if ( $type == "" )		{			$this->gateway->do_log("Tried to return validate but failed: No type set");			$this->_end_process();		}				//--------------------------------------		// Try to get row in DB		//--------------------------------------				$this->ipsclass->DB->cache_add_query( 'mod_custom', array( 'type' => $type ), 'sql_subsm_queries' );		$this->ipsclass->DB->cache_exec_query();				$method = $this->ipsclass->DB->fetch_row();				if ( ! $method['submethod_id'] )		{			$this->gateway->do_log("Tried to return validate but failed: No such method as '$type'");			$this->_end_process();		}				//---------------------------------------------		// INIT Load Payment handler		//---------------------------------------------		$this->gateway->gateway  = $method['submethod_name'];		$this->gateway->gateway_init();				if ( $this->gateway->error )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_no_api' ) );		}				//---------------------------------------------		// Pass off to API handler		//---------------------------------------------				$this->gateway->validate_payment( $method );	}		/*-------------------------------------------------------------------------*/	// Show API Payment screen	/*-------------------------------------------------------------------------*/		function do_payment_screen()	{		$cur_id        = intval($this->ipsclass->input['curid']);		$upgrade       = intval($this->ipsclass->input['upgrade']);		$sub_chosen    = intval($this->ipsclass->input['sub']);		$method_chosen = intval($this->ipsclass->input['methodid']);				if ( $sub_chosen < 1 )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_no_selected' ) );		}				if ( $method_chosen < 1 )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_nomethod_selected' ) );		}				$this->ipsclass->DB->query("SELECT * FROM ibf_subscription_methods WHERE submethod_id=$method_chosen");				$method = $this->ipsclass->DB->fetch_row();				$this->ipsclass->DB->query("SELECT * FROM ibf_subscriptions WHERE sub_id=$sub_chosen");				$subs   = $this->ipsclass->DB->fetch_row();				$this->ipsclass->DB->query("SELECT * FROM ibf_subscription_extra WHERE subextra_sub_id=$sub_chosen AND subextra_method_id=$method_chosen");				$extra  = $this->ipsclass->DB->fetch_row();				//---------------------------------------------		// INIT Load Payment handler		//---------------------------------------------		$this->gateway->gateway  = $method['submethod_name'];		$this->gateway->gateway_init();				if ( $this->gateway->error )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_no_api' ) );		}				//---------------------------------------------		// Make sure we don't recurr on lifetime pkgs		//---------------------------------------------				if ( $subs['sub_unit'] == 'x' )		{			$extra['subextra_recurring'] = 0;		}				if ( $upgrade ) 		{			$this->ipsclass->DB->query("SELECT * FROM ibf_subscriptions WHERE sub_id=$cur_id");					$current = $this->ipsclass->DB->fetch_row();						if ( $method['submethod_name'] == 'manual' )			{				$this->output .= $this->_show_manual_upgrade($current, $subs, $method, $extra);			}			else			{				$this->output .= $this->gateway->show_upgrade_payment_screen($current, $subs, $method, $extra);			}		}		else		{			if ( $method['submethod_name'] == 'manual' )			{				$this->output .= $this->_show_manual_normal($subs, $method, $extra);			}			else			{				$this->output .= $this->gateway->show_normal_payment_screen($subs, $method, $extra);			}		}	}		/*-------------------------------------------------------------------------*/	// Show Available Payment Methods	/*-------------------------------------------------------------------------*/		function do_payment_method()	{		$cur_id      = intval($this->ipsclass->input['curid']);		$upgrade     = intval($this->ipsclass->input['upgrade']);		$sub_chosen  = intval($this->ipsclass->input['sub']);		$subs        = array();		$upg_methods = array();		$all_methods = array();		

⌨️ 快捷键说明

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