paysubscriptions.php

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

PHP
1,024 行
字号
		require_once( ROOT_PATH."sources/lib/func_usercp.php" );				//-----------------------------------------		// INIT da func		//-----------------------------------------		    	$this->lib   = new func_usercp($this);    	$this->lib->ipsclass =& $this->ipsclass;    	    	//-----------------------------------------    	// Print menu    	//-----------------------------------------    	    	$this->ipsclass->print->add_output( $this->lib->ucp_generate_menu() );    }            /*-------------------------------------------------------------------------*/	// Make currency drop down box baby	/*-------------------------------------------------------------------------*/		function _make_currency_dropdown()	{		$curr_box = $this->ipsclass->compiled_templates['skin_subscriptions']->sub_currency_change_top();				$this->ipsclass->DB->query("SELECT * FROM ibf_subscription_currency");				while ( $c = $this->ipsclass->DB->fetch_row() )		{			$default = "";						if ( $this->ipsclass->input['currency'] )			{				if ( $this->ipsclass->input['currency'] == $c['subcurrency_code'] )				{					$default = " selected='selected'";				}			}			else			{				if ( $c['subcurrency_default'] )				{					$default = " selected='selected'";				}			}						$curr_box .= $this->ipsclass->compiled_templates['skin_subscriptions']->sub_currency_change_row( $c['subcurrency_code'], $c['subcurrency_desc'], $default );		}				$curr_box .= $this->ipsclass->compiled_templates['skin_subscriptions']->sub_currency_change_bottom();				return $curr_box;	}	    /*-------------------------------------------------------------------------*/	// End process	/*-------------------------------------------------------------------------*/		function _end_process($dont_die_for_me_argentina=0)	{		if ( $this->return_not_die )		{			$this->_load_menu();			$this->do_index();						$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);						$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 ) );		}		else		{			if ( $dont_die_for_me_argentina != 1 )			{				exit();			}		}	}    		/*-------------------------------------------------------------------------*/	// HANDLE CUSTOM STUFF	/*-------------------------------------------------------------------------*/		function run_custom()	{		switch( $this->ipsclass->input['mode'] )		{			case 'ticket':				$this->do_ticket();				break;		}	}		/*-------------------------------------------------------------------------*/	// Pop up meh ticket	/*-------------------------------------------------------------------------*/		function do_ticket()	{		$sub_id  = intval( $this->ipsclass->input['sid'] );		$tick_id = intval( $this->ipsclass->input['tickid'] );		$upgrade = intval( $this->ipsclass->input['upgrade'] );				//---------------------------------------		// Check for pending subscription		//---------------------------------------				$this->ipsclass->DB->query("SELECT * FROM ibf_subscription_trans WHERE subtrans_member_id={$this->ipsclass->member['id']} AND subtrans_state='pending' AND subtrans_end_date > ".time() );				if ( $trx = $this->ipsclass->DB->fetch_row() )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'sub_already' ) );		}						if ( $sub_id < 1 )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_fail', 'EXTRA' => 'no_curid' ) );		}				$this->ipsclass->DB->query("SELECT * FROM ibf_subscriptions WHERE sub_id=$sub_id");				if ( ! $sub = $this->ipsclass->DB->fetch_row() )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_fail', 'EXTRA' => 'no_curid' ) );		}				//-------------------------		// start array		//-------------------------				$use_meh = array(							'subtrans_sub_id'     => $sub_id,							'subtrans_member_id'  => $this->ipsclass->member['id'],							'subtrans_old_group'  => $this->ipsclass->member['mgroup'],							'subtrans_paid'       => $sub['sub_cost'],							'subtrans_cumulative' => $sub['sub_cost'],							'subtrans_method'	  => 'manual',							'subtrans_start_date' => time(),							'subtrans_end_date'   => time() + ( $sub['sub_length'] * $this->day_to_seconds[ $sub['sub_unit'] ] ),							'subtrans_state'      => 'pending'					    );					    		if ( $sub['sub_unit'] == 'x' )		{			$use_meh['subtrans_end_date'] = 9999999999;		}				if ( $upgrade == 1 )		{			//-------------------------			// Check out me bad self			//-------------------------						if ( $tick_id < 1 )			{				$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_fail', 'EXTRA' => 'no_curid' ) );			}						$this->ipsclass->DB->query("SELECT * FROM ibf_subscription_trans WHERE subtrans_id=$tick_id");						if ( ! $trans = $this->ipsclass->DB->fetch_row() )			{				$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_fail', 'EXTRA' => 'no_curid' ) );			}						$use_meh['subtrans_paid'] = $sub['sub_cost'] - $trans['subtrans_paid'];						unset($use_meh['sub_cumulative']);			unset($use_meh['sub_start_date']);			unset($use_meh['sub_end_date']);						$dbs = $this->ipsclass->DB->compile_db_update_string($use_meh);						$this->ipsclass->DB->query("UPDATE ibf_subscription_trans SET $dbs, subtrans_cumulative=subtrans_cumulative+{$sub['sub_cost']} WHERE subtrans_id=$tick_id");						$sub_title_extra = '('. $this->ipsclass->lang['gw_upgrade'] .')';					}		else		{			//-------------------------			// Chow-mow!			//-------------------------						$dbs = $this->ipsclass->DB->compile_db_insert_string($use_meh);						$this->ipsclass->DB->query("INSERT INTO ibf_subscription_trans ({$dbs['FIELD_NAMES']}) VALUES({$dbs['FIELD_VALUES']})");						$tick_id = $this->ipsclass->DB->get_insert_id();					}				$cost = sprintf( "%.2f", $use_meh['subtrans_paid'] * $this->gateway->cho_currency['subcurrency_exchange'] ) . ' '.$this->gateway->cho_currency['subcurrency_code'];				$html = $this->ipsclass->compiled_templates['skin_subscriptions']->show_ticket($sub, $tick_id, $cost, $sub_title_extra);				$this->ipsclass->print->pop_up_window("TICKET", $html );			}		/*-------------------------------------------------------------------------*/	// MANUAL NORMAL	/*-------------------------------------------------------------------------*/		function _show_manual_normal($sub_upgrade, $pay_method, $extra)	{		//---------------------------------------		// Check we have chosen package details		//---------------------------------------				if ( ! $sub_upgrade['sub_id'] )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_fail', 'EXTRA' => 'no_curid' ) );		}				//---------------------------------------		// Format the info string		//---------------------------------------				$cost = sprintf( "%.2f", $sub_upgrade['sub_cost'] * $this->gateway->cho_currency['subcurrency_exchange'] );				$this->ipsclass->lang['sc_normal_string'] = sprintf( $this->ipsclass->lang['sc_normal_string'],													   $sub_upgrade['sub_title'],													   $cost . ' ' . $this->gateway->cho_currency['subcurrency_code']													 );						$this->ipsclass->lang['post_manual_more'] = sprintf( $this->ipsclass->lang['post_manual_more'],													   $pay_method['submethod_custom_1'],													   $pay_method['submethod_custom_2'],													   $pay_method['submethod_custom_3'],													   $pay_method['submethod_custom_4'],													   $pay_method['submethod_custom_5'] );				return $this->ipsclass->compiled_templates['skin_subscriptions']->do_manual_normal_screen(															$sub_upgrade['sub_id'], 															$this->ipsclass->lang['sc_normal_string'],															$this->gateway->cho_currency['subcurrency_code']														  );					}		/*-------------------------------------------------------------------------*/	// MANUAL UPGRADE	/*-------------------------------------------------------------------------*/		function _show_manual_upgrade($sub_current, $sub_upgrade, $pay_method, $extra)	{		global $ibforums, $std, $DB;				//---------------------------------------		// Check we can do upgrades		//---------------------------------------			if ( $this->can_do_upgrades != 1 )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_no_upgrade' ) );		}				//---------------------------------------		// Check we have current package details		//---------------------------------------				if ( ! $sub_current['sub_id'] )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_fail', 'EXTRA' => 'no_curid' ) );		}				//---------------------------------------		// Check we have upgrade to package details		//---------------------------------------				if ( ! $sub_upgrade['sub_id'] )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_fail', 'EXTRA' => 'no_curid' ) );		}				//--------------------------------------------		// We're upgrading!! Yay! - Get cur subs		//--------------------------------------------				$this->ipsclass->DB->query("SELECT * FROM ibf_subscription_trans WHERE subtrans_member_id={$this->ipsclass->member['id']} AND subtrans_sub_id={$sub_current['sub_id']} AND subtrans_state='paid'");				if ( ! $cur_trans = $this->ipsclass->DB->fetch_row() )		{			$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'subs_no_curid' ) );		}				//---------------------------------------		// Format the info string		//---------------------------------------				$balance = $sub_upgrade['sub_cost'] - $cur_trans['subtrans_paid'];				$end_date = ( $sub_upgrade['sub_unit'] == 'x' or $sub_current['sub_unit'] == 'x' )					  ? $this->ipsclass->lang['no_expire']					  : $this->ipsclass->get_date( $cur_trans['subtrans_end_date'], 'JOINED' );					  		$this->ipsclass->lang['sc_upgrade_string'] = sprintf( $this->ipsclass->lang['sc_upgrade_string'],														$sub_current['sub_title'],														$sub_upgrade['sub_title'],														$end_date,														'&#036;'.$balance													  );													  		$this->ipsclass->lang['post_manual_more'] = sprintf( $this->ipsclass->lang['post_manual_more'],													   $pay_method['submethod_custom_1'],													   $pay_method['submethod_custom_2'],													   $pay_method['submethod_custom_3'],													   $pay_method['submethod_custom_4'],													   $pay_method['submethod_custom_5'] );								return $this->ipsclass->compiled_templates['skin_subscriptions']->do_manual_upgrade_screen(															 $sub_upgrade['sub_id'], 															 $cur_trans['subtrans_id'],															 $this->ipsclass->lang['sc_upgrade_string']														   );									}		}?>

⌨️ 快捷键说明

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