Example #1
0
function Flgn_iniSrc($url)
{
    try {
        global $Grot_path;
        # Fcom_setLogInfo( "debug" , "Flgn_iniSrc:".$Grot_path );
        $cont = Frot_getConts($url["type"], $url["cont"], $tgt);
        if (null === $cont) {
            Frot_jumpFirst();
            return;
        }
        Frot_setSession($tgt, true, false);
        $conts_lst = Frot_getContsList(array(DROT_STT_LGN, DROT_SUBSTT_INI));
        $chk_flg = true;
        foreach ($conts_lst as $key => $val) {
            $chk_flg = Frot_getSession($val);
            if (null === $chk_flg) {
                # Fcom_setLogInfo( "debug" , "null session:".$val );
                break;
            }
        }
        if (true === $chk_flg) {
            Frot_resetSession();
            Frot_setSession(DROT_SESROT_STT, DROT_STT_LGN);
            Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_RDY);
            Fcom_setLogInfo("debug", "ready");
        }
        echo $cont;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Example #2
0
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());
    }
}
Example #3
0
function Frot_jumpFirst()
{
    try {
        global $Grot_pathl;
        Fcom_setLogInfo("debug", "jump first:" . $Grot_path);
        Frot_resetSession();
        Frot_setSession(DROT_SESROT_STT, DROT_STT_LGN, true);
        Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_FST, true);
        header('Location: http://' . DROT_HOST . '/' . DROT_APP_NAME . '/');
        exit;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Example #4
0
function Fath_login()
{
    try {
        if (true === Fath_chkLogin($_POST["userid"], $_POST["passwd"])) {
            Frot_resetSession();
            Frot_setSession(DROT_SESROT_STT, DROT_STT_APP);
            //Frot_setSession( DROT_SESROT_SUBSTT ,  );
            Frot_setSession(DROT_LGDIN_USER, $_POST["userid"]);
            //echo json_encode( array( 'ret' => true ) );
            return true;
        } else {
            // echo json_encode( array( 'ret' => false ) );
            return false;
        }
    } catch (Exception $e) {
    }
}
Example #5
0
function Fapp_jumpFirst()
{
    try {
        global $Grot_path;
        Fcom_setLogInfo(DCOM_LOGLV_DBG, "app jump first:" . $Grot_path);
        $user = Frot_getSession("user");
        # Frot_logSession();
        Frot_resetSession();
        if (null === $user) {
            header('Location: http://' . DROT_HOST . '/' . DROT_APP_NAME);
            exit;
        }
        Frot_setSession(DROT_SESROT_STT, DROT_STT_APP, false);
        Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_FST, false);
        Frot_setSession(DROT_LGDIN_USER, $user, false);
        header('Location: http://' . DROT_HOST . '/' . DROT_APP_NAME . '/');
        exit;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Example #6
0
function Fapp_iniSrc($url)
{
    try {
        global $Grot_path;
        $cont = Frot_getConts($url["type"], $url["cont"], $tgt);
        if (null === $cont) {
            Fcom_setLogInfo("debug", "app null conts:" . $Grot_path);
            #Fapp_jumpFirst();
            return;
        }
        Frot_setSession($tgt, true, false);
        # Frot_logSession();
        $conts_lst = Frot_getContsList(array(DROT_STT_APP, DROT_SUBSTT_INI));
        # Fcom_logObj( "conts_lst" , $conts_lst );
        $chk_flg = true;
        # Fcom_setLogInfo( "debug" , "check ready start" );
        foreach ($conts_lst as $key => $val) {
            $chk_flg = Frot_getSession($val);
            # Fcom_setLogInfo( "debug" , $key.":".$chk_flg );
            if (null === $chk_flg) {
                # Fcom_setLogInfo( "debug" , "null session:".$val );
                break;
            }
        }
        #    Fcom_setLogInfo( "debug" , "end check ready" );
        if (true === $chk_flg) {
            $user = Frot_getSession("user");
            Frot_resetSession();
            Frot_setSession(DROT_SESROT_STT, DROT_STT_APP);
            Frot_setSession(DROT_SESROT_SUBSTT, DROT_SUBSTT_RDY);
            Frot_setSession("user", $user, false);
            Fcom_setLogInfo("debug", "app ready:" . $user);
        }
        echo $cont;
        return;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
Example #7
0
 if (true === Frst_isRestRequest($Grot_path, $_POST)) {
     $ret = Frst_callTarget($Grot_path, $_POST);
     echo json_encode($ret);
     return;
 }
 /* routing state */
 $Grot_state = Frot_getSession(DROT_SESROT_STT);
 /* degub start */
 # Frot_resetSession();
 # return;
 # Frot_logSession();
 Fcom_setLogInfo("debug", "url:" . $Grot_path);
 /* debug end */
 /* check login */
 if (null === $Grot_state) {
     Frot_setSession(DROT_SESROT_STT, DROT_STT_LGN, false);
     $Grot_state = DROT_STT_LGN;
 }
 if (0 === strcmp($Grot_state, DROT_STT_LGN)) {
     Flgn_ctrl();
     return;
 } else {
     if (0 === strcmp($Grot_state, DROT_STT_APP)) {
         # Fcom_setLogInfo( "debug" , "app:".$Grot_path );
         # Frot_resetSession();
         Fapp_ctrl();
         return;
     } else {
         return;
     }
 }