示例#1
0
 public function __construct()
 {
     if (!php_Boot::$skip_constructor) {
         $this->method = eval("if(isset(\$this)) \$»this =& \$this;switch(strtoupper(php_Web::getMethod())) {\n\t\t\tcase \"GET\":{\n\t\t\t\t\$»r = sinatra_HTTPMethod::\$GET;\n\t\t\t}break;\n\t\t\tcase \"POST\":{\n\t\t\t\t\$»r = sinatra_HTTPMethod::\$POST;\n\t\t\t}break;\n\t\t\tcase \"PUT\":{\n\t\t\t\t\$»r = sinatra_HTTPMethod::\$PUT;\n\t\t\t}break;\n\t\t\tcase \"DELETE\":{\n\t\t\t\t\$»r = sinatra_HTTPMethod::\$DELETE;\n\t\t\t}break;\n\t\t\tdefault:{\n\t\t\t\t\$»r = eval(\"if(isset(\\\$this)) \\\$»this =& \\\$this;throw new HException(\\\"Invalid HTTP Method\\\");\n\t\t\t\t\treturn \\\$»r2;\n\t\t\t\t\");\n\t\t\t}break;\n\t\t\t}\n\t\t\treturn \$»r;\n\t\t");
         $this->params = php_Web::getParams();
         $this->uri = sinatra_utils_URI::parse(php_Web::getURI());
         $this->path = $this->uri->path;
         $this->headers = new Hash();
         $»it = php_Web::getClientHeaders()->iterator();
         while ($»it->hasNext()) {
             $h = $»it->next();
             $this->headers->set($h->header, $h->value);
         }
     }
 }
示例#2
0
 static function main()
 {
     haxe_Log::$trace = isset(me_cunity_php_Debug::$_trace) ? me_cunity_php_Debug::$_trace : array("me_cunity_php_Debug", "_trace");
     S::$conf = Config::load("appData.js");
     php_Session::start();
     $pd = php_Web::getPostData();
     haxe_Log::trace($pd, _hx_anonymous(array("fileName" => "S.hx", "lineNumber" => 54, "className" => "S", "methodName" => "main")));
     $params = php_Web::getParams();
     if ($params->get("debug") === "1") {
         header("Content-Type" . ": " . "text/html; charset=utf-8");
         S::$headerSent = true;
         php_Lib::println("<div><pre>");
         php_Lib::println($params);
     }
     haxe_Log::trace(Date::now()->toString(), _hx_anonymous(array("fileName" => "S.hx", "lineNumber" => 63, "className" => "S", "methodName" => "main")));
     haxe_Log::trace($params, _hx_anonymous(array("fileName" => "S.hx", "lineNumber" => 64, "className" => "S", "methodName" => "main")));
     $action = $params->get("action");
     if (strlen($action) === 0 || $params->get("className") === null) {
         S::dump(_hx_anonymous(array("error" => "required params missing")));
         return;
     }
     S::$my = new MySQLi("localhost", S::$dbUser, S::$dbPass, S::$db, null, null);
     $auth = S::checkAuth();
     haxe_Log::trace(_hx_string_or_null($action) . ":" . Std::string($auth), _hx_anonymous(array("fileName" => "S.hx", "lineNumber" => 77, "className" => "S", "methodName" => "main")));
     if (!$auth) {
         S::hexit("AUTH FAILURE");
         return;
     }
     $result = Model::dispatch($params);
     haxe_Log::trace($result, _hx_anonymous(array("fileName" => "S.hx", "lineNumber" => 85, "className" => "S", "methodName" => "main")));
     if (!S::$headerSent) {
         header("Content-Type" . ": " . "application/json");
         S::$headerSent = true;
     }
     php_Lib::println($result);
 }
示例#3
0
 static function getParams()
 {
     return php_Web::getParams();
 }