<?php
define('ONEZ_PRODUCT_TITLE','虚拟商品自动发货系统');
define('ONEZ_PRODUCT_PTOKEN','bs.app.shipments');
define('ONEZ_BS_LIB_FILE',dirname(__FILE__).'/lib/onezphp.php');
define('ONEZ_BS_APIURL','http://www.onez.cn/api/bs.php');
define('ONEZ_BS_SITE_FILE',dirname(__FILE__).'/config/site.php');
define('ONEZPHP_FETCH_NOTIP',1);
if(!file_exists(ONEZ_BS_LIB_FILE)){
  if(!file_exists(dirname(__FILE__).'/lib')){
    mkdir(dirname(__FILE__).'/lib',0777);
  }
  file_put_contents(ONEZ_BS_LIB_FILE,file_get_contents(ONEZ_BS_APIURL.'?'.http_build_query(array(
    'action'=>'file',
    'filename'=>'lib/onezphp.php',
  ))));
}
include_once(dirname(__FILE__).'/lib/onezphp.php');
if(!file_exists(ONEZ_BS_SITE_FILE)){
  onez('bs.install')->init();
}
if(defined('ONEZ_PRODUCT_PTOKEN')){
  onez(ONEZ_PRODUCT_PTOKEN);
}
$__ptoken=onez()->gp('_p');
$__method=onez()->gp('_m');
empty($__ptoken) && $__ptoken='bs';
empty($__method) && $__method='index';
$G['href_extra']=array();
$__ptoken!=$site_p_token && $G['href_extra']['_p']=$__ptoken;
$__method!='index' && $G['href_extra']['_m']=$__method;
if(onez()->exists($__ptoken) && method_exists(onez($__ptoken),$__method)){
  $G['this']=onez($__ptoken);
  $G['this']->init();
  $G['this']->$__method();
}