function Flgn_init() { try { global $Grot_path; $map = Net_URL_Mapper::getInstance(); $map->connect('/:app/:func/:type/:cont'); $npurl = Frot_getNoprmPath($Grot_path); $url = $map->match($npurl); # Fcom_setLogInfo( "debug" , "Flgn_init:".$Grot_path ); if ($url) { if (0 !== strcmp($url["app"], DROT_APP_NAME)) { Fcom_setLogInfo(DCOM_LOGLV_ERR, "invalid function " . $Grot_path); Fapp_jumpFirst(); } if (0 === strcmp($url["func"], DROT_FUNC_SRC)) { Flgn_iniSrc($url); } else { Fcom_setLogInfo(DCOM_LOGLV_ERR, "invalid function " . $Grot_path); Fapp_jumpFirst(); } } else { Frot_jumpFirst(); } } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage()); } }
function Fapp_first() { try { global $Grot_path; # Fcom_setLogInfo( "debug" , "app first:".$Grot_path ); $map = Net_URL_Mapper::getInstance(); $map->connect('/:app/'); $url = $map->match($Grot_path); if ($url) { /* match */ /* check func */ if (0 === strcmp($url["app"], DROT_APP_NAME)) { /* '/ayawave' request */ $cont = Frot_getInit(DROT_INITTYP_BSC); Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_INI, false); echo $cont; return; } else { /* func is not app */ Fapp_jumpFirst(); } } else { Fapp_jumpFirst(); } } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage()); } }
function Flgn_ready() { try { global $Grot_path; Fcom_setLogInfo("debug", "login ready:" . $Grot_path); $map = Net_URL_Mapper::getInstance(); $map->connect('/:app/:func/:type/:cont'); $url = $map->match($Grot_path); if ($url) { if (0 !== strcmp($url["app"], DROT_APP_NAME) || 0 !== strcmp($url["func"], DROT_FUNC_FNC)) { Frot_jumpFirst(); } if (0 === strcmp($url["type"], DROT_FTYPE_ATH)) { $ret = Fath_ctrl($url["cont"]); echo json_encode($ret); return; } } else { # Fcom_setLogInfo( DCOM_LOGLV_ERR , "".$Grot_path ); Fapp_jumpFirst(); } } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage()); } }
function Fapp_ctrl() { try { global $Grot_path; # Fcom_setLogInfo( DCOM_LOGLV_DBG , "app func:".$Grot_path ); $sub_stt = Frot_getSession(DROT_SESROT_SUBSTT); if (null === $sub_stt) { Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_FST); $sub_stt = Frot_getSession(DROT_SESROT_SUBSTT); } if (0 === strcmp($sub_stt, DROT_SUBSTT_FST)) { # Fcom_setLogInfo( DCOM_LOGLV_DBG , "first func" ); Fapp_first(); return; } elseif (0 === strcmp($sub_stt, DROT_SUBSTT_INI)) { Fapp_init(); return; } elseif (0 === strcmp($sub_stt, DROT_SUBSTT_RDY)) { # Fcom_setLogInfo( DCOM_LOGLV_DBG , 'call Fapp_ready' ); Fapp_ready(); return; } else { Fapp_jumpFirst(); } } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '() path:' . $path . PHP_EOL . $e->getMessage()); } }
function Fapp_rdyFunc($url) { try { global $Grot_path; header("Content-Type: application/json; charset=utf-8"); if (0 === strcmp($url["type"], DROT_FTYPE_ATH)) { $ret = Fath_ctrl($url["cont"]); echo json_encode($ret); return; } else { if (0 === strcmp($url["type"], DROT_FTYPE_ITM)) { //$ret = array( 'ret' => true ); $ret = Fitm_ctrl($url["cont"]); echo json_encode($ret); return; } else { $noprm = Frot_getNoprmPath($url); $cont = Frot_getConts($noprm); if (null === $cont) { Fcom_setLogInfo(DCOM_LOGLV_ERR, $noprm . " is null."); Fapp_jumpFirst(); } else { echo $cont; } } } } catch (Exception $e) { throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage()); } }