stanley-king пре 9 година
родитељ
комит
e4fb7165f3

+ 30 - 13
core/framework/core/base.php

@@ -16,6 +16,10 @@ final class Base{
 	public static function init() {
 	    // config info
 	    global $setting_config;
+            
+//            var_dump($setting_config);
+//            var_dump($GLOBALS);
+            
 	    self::parse_conf($setting_config);
 	    define('MD5_KEY',md5($setting_config['md5_key']));
             
@@ -29,15 +33,18 @@ final class Base{
 	        }
 	    }
 
-	    //session start
-	    self::start_session();
-	    
-	    //output to the template
-	    Tpl::output('setting_config',$setting_config);
-	    
-	    //read language
+//	    //session start
+	    //self::start_session();	    
+//	    //output to the template
+            
+	    Tpl::output('setting_config',$setting_config);	    
+//	    //read language
 	    Language::read('core_lang_index');
 	}
+        
+        public static function fini() {
+            session_destroy();
+        }
 
 	/**
 	 * run
@@ -52,6 +59,8 @@ final class Base{
 	 * get setting
 	 */
 	private static function parse_conf(&$setting_config){
+            
+            echo '1 <br>';
 		$nc_config = $GLOBALS['config'];
 		if(is_array($nc_config['db']['slave']) && !empty($nc_config['db']['slave'])){
 			$dbslave = $nc_config['db']['slave'];
@@ -60,44 +69,52 @@ final class Base{
 		}else{
 			$nc_config['db']['slave'] = $nc_config['db'][1];
 		}
+                echo '2 <br>';
 		$nc_config['db']['master'] = $nc_config['db'][1];
 		$setting_config = $nc_config;
-		$setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting',true);
+		//$setting = ($setting = rkcache('setting')) ? $setting : rkcache('setting',true);
 		$setting['shopnc_version'] = 'Copyright 2015</a>';
 		$setting_config = array_merge_recursive($setting,$nc_config);
+                echo '3 <br>';
 	}
 
 	/**
 	 * 控制器调度
 	 *
 	 */
-	private static function control(){
+	private static function control()
+        {
+            var_dump($_GET);
 		//二级域名
 		if ($GLOBALS['setting_config']['enabled_subdomain'] == '1' && $_GET['act'] == 'index' && $_GET['op'] == 'index'){
 			$store_id = subdomain();
 			if ($store_id > 0) $_GET['act'] = 'show_store';
 		}
 		$act_file = realpath(BASE_PATH.'/control/'.$_GET['act'].'.php');
+                echo $act_file;
 		$class_name = $_GET['act'].'Control';
-		if (!@include($act_file)){
+		if (!@include_once($act_file)){
 		    if (C('debug')) {
 		        throw_exception("Base Error: access file isn't exists!");
 		    } else {
 		        showMessage('抱歉!您访问的页面不存在','','html','error');
 		    }
 		}
-		if (class_exists($class_name)){
+		if (class_exists($class_name))
+                {
 			$main = new $class_name();
 			$function = $_GET['op'].'Op';
 			if (method_exists($main,$function)){
-				$main->$function();
+                            var_dump($main);
+                            var_dump($function);                            
+                            $main->$function();
 			}elseif (method_exists($main,'indexOp')){
 				$main->indexOp();
 			}else {
 				$error = "Base Error: function $function not in $class_name!";
 				throw_exception($error);
 			}
-		}else {
+		} else {
 			$error = "Base Error: class $class_name isn't exists!";
 			throw_exception($error);
 		}

+ 1 - 2
core/framework/db/mysql.php

@@ -9,10 +9,9 @@
 
 defined('InShopNC') or exit('Access Invalid!');
 
-class Db{
+class Db {
 
 	private static $link = array();
-
 	private static $iftransacte = true;
 
 	private function __construct(){

+ 1 - 1
core/framework/libraries/model.php

@@ -23,7 +23,7 @@ class Model{
 			$this->table_name = $table;
 			$this->tableInfo($table);
 		}
-		$this->table_prefix = DBPRE;
+		$this->table_prefix = '33hao_';//DBPRE;
 		if (!is_object($this->db)){
 			$this->db = new ModelDb();
 		}

+ 7 - 4
core/framework/libraries/tpl.php

@@ -7,6 +7,8 @@
  *
  * @package    tpl
  */
+
+
 defined('InShopNC') or exit('Access Invalid!');
 class Tpl{
 	/**
@@ -34,10 +36,11 @@ class Tpl{
 	 * @return obj
 	 */
 	public static function getInstance(){
-		if (self::$instance === null || !(self::$instance instanceof Tpl)){
-			self::$instance = new Tpl();
+            
+		if (self::$instance === null || !(self::$instance instanceof Tpl)) {
+			//self::$instance = new Tpl();
 		}
-		return self::$instance;
+		//return self::$instance;
 	}
 	
 	/**
@@ -70,7 +73,7 @@ class Tpl{
 	public static function output($output,$input=''){
 		self::getInstance();
 		
-		self::$output_value[$output] = $input;
+		//self::$output_value[$output] = $input;
 	}
 	
 	/**

+ 21 - 11
core/33hao.php

@@ -7,11 +7,6 @@
  *
  */
 
-defined('InShopNC') or exit('Access Invalid!');
-if (!@include(BASE_DATA_PATH.'/config/config.ini.php')) exit('config.ini.php isn\'t exists!');
-if (file_exists(BASE_PATH.'/config/config.ini.php')){
-	include(BASE_PATH.'/config/config.ini.php');
-}
 global $config;
 
 //默认平台店铺id
@@ -42,7 +37,7 @@ define('SESSION_EXPIRE',$config['session_expire']);
 define('LANG_TYPE',$config['lang_type']);
 define('COOKIE_PRE',$config['cookie_pre']);
 
-define('DBPRE',$config['tablepre']);
+define('DBPRE','33hao_');//$config['tablepre']);
 define('DBNAME',$config['db'][1]['dbname']);
 
 $_GET['act'] = $_GET['act'] ? strtolower($_GET['act']) : ($_POST['act'] ? strtolower($_POST['act']) : null);
@@ -57,7 +52,24 @@ $_GET['act'] = preg_match('/^[\w]+$/i',$_GET['act']) ? $_GET['act'] : 'index';
 $_GET['op']  = preg_match('/^[\w]+$/i',$_GET['op']) ? $_GET['op'] : 'index';
 
 //对GET POST接收内容进行过滤,$ignore内的下标不被过滤
-$ignore = array('article_content','pgoods_body','doc_content','content','sn_content','g_body','store_description','p_content','groupbuy_intro','remind_content','note_content','ref_url','adv_pic_url','adv_word_url','adv_slide_url','appcode','mail_content');
+$ignore = array('article_content',
+    'pgoods_body',
+    'doc_content',
+    'content',
+    'sn_content',
+    'g_body',
+    'store_description',
+    'p_content',
+    'groupbuy_intro',
+    'remind_content',
+    'note_content',
+    'ref_url',
+    'adv_pic_url',
+    'adv_word_url',
+    'adv_slide_url',
+    'appcode',
+    'mail_content');
+
 if (!class_exists('Security')) require(BASE_CORE_PATH.'/framework/libraries/security.php');
 $_GET = !empty($_GET) ? Security::getAddslashesForInput($_GET,$ignore) : array();
 $_POST = !empty($_POST) ? Security::getAddslashesForInput($_POST,$ignore) : array();
@@ -70,10 +82,8 @@ if ($config['gzip'] == 1 && function_exists('ob_gzhandler') && $_GET['inajax'] !
 }else {
 	ob_start();
 }
-require_once(BASE_CORE_PATH.'/framework/libraries/queue.php');
-require_once(BASE_CORE_PATH.'/framework/function/core.php');
-require_once(BASE_CORE_PATH.'/framework/core/base.php');
-require_once(BASE_CORE_PATH.'/framework/function/goods.php');
+
+
 
 if(function_exists('spl_autoload_register')) {
 	spl_autoload_register(array('Base', 'autoload'));

+ 65 - 60
data/config/config.ini.php

@@ -1,62 +1,67 @@
 <?php
-// defined('InShopNC') or exit('Access Invalid!');
 
-$config = array();
-$config['base_site_url']        = 'http://shopnc.yage.com';
-$config['shop_site_url'] 		= 'http://shopnc.yage.com/shop';
-$config['cms_site_url'] 		= 'http://shopnc.yage.com/cms';
-$config['microshop_site_url'] 	= 'http://shopnc.yage.com/microshop';
-$config['circle_site_url'] 		= 'http://shopnc.yage.com/circle';
-$config['admin_site_url'] 		= 'http://shopnc.yage.com/admin';
-$config['mobile_site_url'] 		= 'http://shopnc.yage.com/mobile';
-$config['wap_site_url'] 		= 'http://shopnc.yage.com/wap';
-$config['chat_site_url'] 		= 'http://shopnc.yage.com/chat';
-$config['node_site_url'] 		= 'http://127.0.0.1:8090';
-$config['upload_site_url']		= 'http://shopnc.yage.com/data/upload';
-$config['resource_site_url']	= 'http://shopnc.yage.com/data/resource';
-$config['version'] 		= '201502020388';
-$config['setup_date'] 	= '2015-08-22 15:52:34';
-$config['gip'] 			= 0;
-$config['dbdriver'] 	= 'mysqli';
-$config['tablepre']		= '33hao_';
-$config['db']['1']['dbhost']       = '127.0.0.1';
-$config['db']['1']['dbport']       = '3306';
-$config['db']['1']['dbuser']       = 'root';
-$config['db']['1']['dbpwd']        = '55668899';
-$config['db']['1']['dbname']       = '33hao';
-$config['db']['1']['dbcharset']    = 'UTF-8';
-$config['db']['slave']                  = $config['db']['master'];
-$config['session_expire'] 	= 3600;
-$config['lang_type'] 		= 'zh_cn';
-$config['cookie_pre'] 		= '6B0C_';
-$config['thumb']['cut_type'] = 'gd';
-$config['thumb']['impath'] = '';
-$config['cache']['type'] 			= 'file';
-//$config['redis']['prefix']      	= 'nc_';
-//$config['redis']['master']['port']     	= 6379;
-//$config['redis']['master']['host']     	= '127.0.0.1';
-//$config['redis']['master']['pconnect'] 	= 0;
-//$config['redis']['slave']      	    = array();
-//$config['fullindexer']['open']      = false;
-//$config['fullindexer']['appname']   = '33hao';
-$config['debug'] 			= false;
-$config['default_store_id'] = '1';
-//如果开始伪静态,这里设置为true
-$config['url_model'] = false;
-//如果店铺开启二级域名绑定的,这里填写主域名如baidu.com
-$config['subdomain_suffix'] = '';
-//$config['session_type'] = 'redis';
-//$config['session_save_path'] = 'tcp://127.0.0.1:6379';
-$config['node_chat'] = true;
-//流量记录表数量,为1~10之间的数字,默认为3,数字设置完成后请不要轻易修改,否则可能造成流量统计功能数据错误
-$config['flowstat_tablenum'] = 3;
-$config['sms']['gwUrl'] = 'http://sdkhttp.eucp.b2m.cn/sdk/SDKService';
-$config['sms']['serialNumber'] = '';
-$config['sms']['password'] = '';
-$config['sms']['sessionKey'] = '';
-$config['queue']['open'] = false;
-$config['queue']['host'] = '127.0.0.1';
-$config['queue']['port'] = 6379;
-$config['cache_open'] = false;
-$config['delivery_site_url']    = 'http://shopnc.yage.com/delivery';
-return $config;
+function config_init()
+{
+	$ret = array();
+	$ret['base_site_url']        = 'http://shopnc.yage.com';
+	$ret['shop_site_url'] 		= 'http://shopnc.yage.com/shop';
+	$ret['cms_site_url'] 		= 'http://shopnc.yage.com/cms';
+	$ret['microshop_site_url'] 	= 'http://shopnc.yage.com/microshop';
+	$ret['circle_site_url'] 		= 'http://shopnc.yage.com/circle';
+	$ret['admin_site_url'] 		= 'http://shopnc.yage.com/admin';
+	$ret['mobile_site_url'] 		= 'http://shopnc.yage.com/mobile';
+	$ret['wap_site_url'] 		= 'http://shopnc.yage.com/wap';
+	$ret['chat_site_url'] 		= 'http://shopnc.yage.com/chat';
+	$ret['node_site_url'] 		= 'http://127.0.0.1:8090';
+	$ret['upload_site_url']		= 'http://shopnc.yage.com/data/upload';
+	$ret['resource_site_url']	= 'http://shopnc.yage.com/data/resource';
+	$ret['version'] 		= '201502020388';
+	$ret['setup_date'] 	= '2015-08-22 15:52:34';
+	$ret['gip'] 			= 0;
+	$ret['dbdriver'] 	= 'mysqli';
+	$ret['tablepre']		= '33hao_';
+	$ret['db']['1']['dbhost']       = '127.0.0.1';
+	$ret['db']['1']['dbport']       = '3306';
+	$ret['db']['1']['dbuser']       = 'root';
+	$ret['db']['1']['dbpwd']        = '55668899';
+	$ret['db']['1']['dbname']       = '33hao';
+	$ret['db']['1']['dbcharset']    = 'UTF-8';
+	$ret['db']['slave']                  = $ret['db']['master'];
+	$ret['session_expire'] 	= 3600;
+	$ret['lang_type'] 		= 'zh_cn';
+	$ret['cookie_pre'] 		= '6B0C_';
+	$ret['thumb']['cut_type'] = 'gd';
+	$ret['thumb']['impath'] = '';
+	$ret['cache']['type'] 			= 'file';
+
+	//$ret['redis']['prefix']      	= 'nc_';
+	//$ret['redis']['master']['port']     	= 6379;
+	//$ret['redis']['master']['host']     	= '127.0.0.1';
+	//$ret['redis']['master']['pconnect'] 	= 0;
+	//$ret['redis']['slave']      	    = array();
+	//$ret['fullindexer']['open']      = false;
+	//$ret['fullindexer']['appname']   = '33hao';
+	
+	$ret['debug'] 			= false;
+	$ret['default_store_id'] = '1';
+	//如果开始伪静态,这里设置为true
+	$ret['url_model'] = false;
+	//如果店铺开启二级域名绑定的,这里填写主域名如baidu.com
+	$ret['subdomain_suffix'] = '';
+	//$ret['session_type'] = 'redis';
+	//$ret['session_save_path'] = 'tcp://127.0.0.1:6379';
+	$ret['node_chat'] = true;
+	//流量记录表数量,为1~10之间的数字,默认为3,数字设置完成后请不要轻易修改,否则可能造成流量统计功能数据错误
+	$ret['flowstat_tablenum'] = 3;
+	$ret['sms']['gwUrl'] = 'http://sdkhttp.eucp.b2m.cn/sdk/SDKService';
+	$ret['sms']['serialNumber'] = '';
+	$ret['sms']['password'] = '';
+	$ret['sms']['sessionKey'] = '';
+	$ret['queue']['open'] = false;
+	$ret['queue']['host'] = '127.0.0.1';
+	$ret['queue']['port'] = 6379;
+	$ret['cache_open'] = false;
+	$ret['delivery_site_url']    = 'http://shopnc.yage.com/delivery';
+	
+	return $ret;
+}

+ 33 - 0
debug_run.php

@@ -0,0 +1,33 @@
+<?php
+
+printf("Content-Type: text/html; charset=UTF-8\r\n\r\n");
+
+$reqs = array();
+$uri ='http://localhost:8080/mobile/index.php?act=index&op=index';
+
+echo ' 0 <br>';
+
+array_push($reqs, $uri);
+array_push($reqs, $uri);
+array_push($reqs, $uri);
+
+echo ' 1 <br>';
+
+foreach ($reqs as $val)
+{    
+    $lreq = new local_request($uri);    
+    init_localreq($lreq);
+    
+    $file = $lreq->script_file();    
+    echo include $file;
+}
+
+
+
+
+
+
+
+
+
+

+ 26 - 0
fcgi_run.php

@@ -0,0 +1,26 @@
+<?php
+fcgi_init();
+
+while(($ret = fcgi_accept()) >= 0)
+{    
+    define('StartTime',microtime(true));
+    define('TIMESTAMP',time());
+
+    printf("Content-Type: text/html; charset=UTF-8\r\n\r\n");    
+    echo fcgi_getparam('SCRIPT_FILENAME') . '<br>';
+    
+    $log_file->fwrite("1 \r\n");
+    try
+    {
+        init_request();
+        
+        include request_helper::script_file();                     
+        
+    } catch (Exception $ex) {
+        echo $ex->getTraceAsString();
+    }
+    fcgi_finish();
+}
+
+fcgi_fini();
+?>

+ 2 - 2
global.php

@@ -14,6 +14,7 @@ define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
 /**
  * 安装判断
  */
+
 if (!is_file(BASE_ROOT_PATH."/install/lock") && is_file(BASE_ROOT_PATH."/install/index.php")){
     if (ProjectName != 'shop'){
         @header("location: ../install/index.php");
@@ -28,8 +29,7 @@ define('BASE_DATA_PATH',BASE_ROOT_PATH.'/data');
 define('DS','/');
 define('InShopNC',true);
 
-define('StartTime',microtime(true));
-define('TIMESTAMP',time());
+
 
 define('DIR_SHOP','shop');
 define('DIR_CMS','cms');

+ 11 - 8
mobile/control/index.php

@@ -4,7 +4,6 @@
  *
  *
  *
- 
  */
 
 //use Shopnc\Tpl;
@@ -22,7 +21,8 @@ class indexControl extends mobileHomeControl{
 	public function indexOp() {
         $model_mb_special = Model('mb_special'); 
         $data = $model_mb_special->getMbSpecialIndex();
-		
+        var_dump($data);
+       		
         $this->_output_special($data, $_GET['type']);
 	}
 
@@ -38,9 +38,11 @@ class indexControl extends mobileHomeControl{
     /**
      * 输出专题
      */
-    private function _output_special($data, $type = 'json', $special_id = 0) {
+    private function _output_special($data, $type = 'json', $special_id = 0) 
+    {
         $model_special = Model('mb_special');
-        if($_GET['type'] == 'html') {
+        if($_GET['type'] == 'html') 
+        {
             $html_path = $model_special->getMbSpecialHtmlPath($special_id);
             if(!is_file($html_path)) {
                 ob_start();
@@ -49,10 +51,11 @@ class indexControl extends mobileHomeControl{
                 file_put_contents($html_path, ob_get_clean());
             }
             header('Location: ' . $model_special->getMbSpecialHtmlUrl($special_id));
-            die;
-        } else {
-			if(empty($data))
-			{
+            //die;
+        } 
+        else 
+        {
+			if(empty($data)) {
 				$data=array();
 			}
 			//$data['site_mobile_logo']=array(C('site_mobile_logo'));

+ 0 - 1
mobile/control/logout.php

@@ -5,7 +5,6 @@
  *
  *
  *
- 
  */
 
 //use Shopnc\Tpl;

+ 2 - 3
mobile/framework/function/function.php

@@ -4,7 +4,6 @@
  *
  * 公共方法
  *
- 
  */
 defined('InShopNC') or exit('Access Invalid!');
 
@@ -19,9 +18,9 @@ function output_data($datas, $extend_data = array()) {
     $data['datas'] = $datas;
 
     if(!empty($_GET['callback'])) {
-        echo $_GET['callback'].'('.json_encode($data).')';die;
+        echo $_GET['callback'].'('.json_encode($data).')';//die;
     } else {
-        echo json_encode($data);die;
+        echo json_encode($data);//die;
     }
 }
 

+ 8 - 15
mobile/index.php

@@ -9,20 +9,13 @@ define('APP_ID','mobile');
 define('IGNORE_EXCEPTION', true);
 define('BASE_PATH',str_replace('\\','/',dirname(__FILE__)));
 
-//$file = __FILE__;
-//$dir = dirname(__FILE__);
-
-
-if (!@include(dirname(dirname(__FILE__)).'/global.php')) exit('global.php isn\'t exists!');
-
-if (!@include(BASE_CORE_PATH.'/33hao.php')) exit('33hao.php isn\'t exists!');
-
-if (!@include(BASE_PATH.'/config/config.ini.php')){
-    exit('config.ini.php isn\'t exists!');
-}
-
-//框架扩展
-require(BASE_PATH.'/framework/function/function.php');
-if (!@include(BASE_PATH.'/control/control.php')) exit('control.php isn\'t exists!');
+echo '<br>';
+var_dump($_GET);
+echo '<br>';
+var_dump($_POST);
+
+////框架扩展
+require_once (BASE_PATH.'/framework/function/function.php');
+require_once (BASE_PATH.'/control/control.php');
 
 Base::run();

+ 163 - 0
request_helper.php

@@ -0,0 +1,163 @@
+<?php
+
+/**
+ * Description of newPHPClass
+ *
+ * @author stanley-king
+ */
+class request_helper 
+{
+    static public function fcgi_role() {
+        return fcgi_getparam('FCGI_ROLE');        
+    }
+    static public function script_file() {
+        return fcgi_getparam('SCRIPT_FILENAME');        
+    }
+    static public function query_string() {
+        return fcgi_getparam('QUERY_STRING');        
+    }
+    static public function method() {
+        return fcgi_getparam('REQUEST_METHOD');        
+    }
+    static public function content_type() {
+        return fcgi_getparam('REQUEST_METHOD');        
+    }    
+    static public function content_length() {
+        return fcgi_getparam('CONTENT_LENGTH');        
+    }
+    static public function script_name() {
+        return fcgi_getparam('SCRIPT_NAME');        
+    }
+    static public function req_uri() {
+        return fcgi_getparam('REQUEST_URI');        
+    }
+    static public function doc_uri() {
+        return fcgi_getparam('DOCUMENT_URI');        
+    }
+    static public function doc_root() {
+        return fcgi_getparam('DOCUMENT_ROOT');        
+    }
+    static public function srv_protocol() {
+        return fcgi_getparam('SERVER_PROTOCOL');        
+    }
+    static public function gate_interface() {
+        return fcgi_getparam('GATEWAY_INTERFACE');        
+    }    
+    static public function srv_software() {
+        return fcgi_getparam('SERVER_SOFTWARE');        
+    }    
+    static public function remote_addr() {
+        return fcgi_getparam('REMOTE_ADDR');        
+    }    
+    static public function remote_port() {
+        return fcgi_getparam('REMOTE_PORT');        
+    }    
+    static public function srv_addr() {
+        return fcgi_getparam('SERVER_ADDR');        
+    }
+    static public function srv_port() {
+        return fcgi_getparam('SERVER_PORT');        
+    }    
+    static public function srv_name() {
+        return fcgi_getparam('SERVER_NAME');        
+    }    
+    static public function redirect_status() {
+        return fcgi_getparam('REDIRECT_STATUS');        
+    }    
+    static public function http_host() {
+        return fcgi_getparam('HTTP_HOST');        
+    }
+    static public function http_connection() {
+        return fcgi_getparam('HTTP_CONNECTION');        
+    }
+    static public function http_accept() {
+        return fcgi_getparam('HTTP_ACCEPT');        
+    }
+    static public function http_upgrade_insecure_requests() {
+        return fcgi_getparam('HTTP_UPGRADE_INSECURE_REQUESTS');        
+    }
+    static public function http_useragent() {
+        return fcgi_getparam('HTTP_USER_AGENT');        
+    }
+    static public function http_accept_encoding() {
+        return fcgi_getparam('HTTP_ACCEPT_ENCODING');        
+    }
+    static public function http_accept_language() {
+        return fcgi_getparam('HTTP_ACCEPT_LANGUAGE');        
+    }
+    static public function http_cookie() {
+        return fcgi_getparam('HTTP_COOKIE');        
+    }
+}
+
+$_GET = array();
+$_POST = array();
+
+function init_request()
+{
+    $method = strtolower(request_helper::method()); 
+    $squery = request_helper::query_string();      
+    $params = preg_split('/&|=/', $squery);
+
+    if($method == 'get') 
+    { 
+        for($i = 0; $i < count($params); ++$i) { 
+            $_GET[ $params[$i] ] = $params[++$i];            
+        }        
+    }
+    elseif($method == 'post') 
+    {
+        for($i = 0; $i < count($params); ++$i) { 
+            $_POST[ $params[$i] ] = $params[++$i];            
+        }        
+    }    
+}
+
+class local_request
+{
+    private $script_file;
+    private $query_string;
+    private $method;
+    
+    public function __construct($uri) {
+        $param = parse_url($uri);
+        
+        $this->script_file = BASE_ROOT_PATH . $param['path'];
+        $this->query_string = $param['query'];
+        $this->method = 'GET';
+    }  
+    
+    public function script_file() {
+        return $this->script_file;
+    }   
+    
+    public function query_string()
+    {
+        return $this->query_string;
+    }
+    public function  method() {
+        return $this->method;
+    }
+}
+
+
+function init_localreq(local_request $req)
+{
+    $squery = $req->query_string();   
+    $params = preg_split('/&|=/', $squery);
+    $method = strtolower($req->method());
+
+    if($method == 'get' ) 
+    { 
+        for($i = 0; $i < count($params); ++$i) { 
+            $_GET[ $params[$i] ] = $params[++$i];            
+        }        
+    }
+    elseif($method == 'post') 
+    {
+        for($i = 0; $i < count($params); ++$i) { 
+            $_POST[ $params[$i] ] = $params[++$i];            
+        }        
+    }    
+}
+

+ 34 - 0
run.php

@@ -0,0 +1,34 @@
+<?php
+date_default_timezone_set('UTC');
+
+require 'request_helper.php';
+require 'global.php';
+require './data/config/config.ini.php';
+require './mobile/config/config.ini.php';
+
+require_once(BASE_CORE_PATH.'/framework/libraries/queue.php');
+require_once(BASE_CORE_PATH.'/framework/libraries/tpl.php');
+require_once(BASE_CORE_PATH.'/framework/function/core.php');
+require_once(BASE_CORE_PATH.'/framework/core/base.php');
+require_once(BASE_CORE_PATH.'/framework/libraries/queue.php');
+require_once(BASE_CORE_PATH.'/framework/libraries/language.php');
+require_once(BASE_CORE_PATH.'/framework/libraries/model.php');
+require_once(BASE_CORE_PATH.'/framework/libraries/log.php');
+require_once(BASE_CORE_PATH.'/framework/db/mysql.php');
+
+require_once(BASE_CORE_PATH.'/framework/function/goods.php');
+
+$config = config_init();
+
+$gfcgi_run = false;
+
+$log_file = new SplFileObject('/Users/stanley-king/logs/php_example.txt','w+');
+
+if($gfcgi_run) {
+    $file = BASE_ROOT_PATH . '/fcgi_run.php';
+    @include $file;
+} else {
+    $file = BASE_ROOT_PATH . '/debug_run.php';   
+    include $file;
+}
+?>