コード例 #1
0
ファイル: Sitm_add.php プロジェクト: Ki4mTaria/ayawave
function Fitm_addItem()
{
    try {
        #Fcom_setLogInfo( "debug" , "type:".$_POST['typ'] );
        $typeid = Fitm_getTypeid($_POST['typ']);
        #  Fcom_setLogInfo( "debug" , "addItem:".$typeid );
        $ttl = $_POST['ttl'];
        $cnt = $_POST['cnt'];
        if (false === isset($_POST['dsc'])) {
            $dsc = "";
        } else {
            $dsc = $_POST['dsc'];
        }
        if (false === isset($_POST['tag'])) {
            throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):not find tag');
        }
        $dat = array("title" => $ttl, "typeid" => $typeid, "conts" => $cnt, "desp" => $dsc);
        Fdbd_insert(DITM_TBNAME_ITEM, $dat);
        $where = "title=\"" . $ttl . "\"";
        $where .= " and typeid=" . $typeid;
        #$where .= " and conts=\"".$cnt."\"";
        $where .= " and desp=\"" . $dsc . "\"";
        $max = Fdbd_getTableData(DITM_TBNAME_ITEM, "max(id)", $where);
        Fcom_setLogInfo("debug", $max["max(id)"][0]);
        Fitm_setItemTag($max["max(id)"][0]);
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
コード例 #2
0
ファイル: Srot_conts.php プロジェクト: Ki4mTaria/ayawave
/**
 * @brief get front contents
 * @param url : url object (/:app/:func/:type/:cont)
 */
function Frot_getConts($type, $cont, &$tgt)
{
    try {
        global $Grot_uriList;
        global $Grot_path;
        # Fcom_setLogInfo( "debug" , "Frot_getConts:".$Grot_path );
        $list = null;
        $sts = Frot_getSession(DROT_SESROT_STT);
        $sub_sts = Frot_getSession(DROT_SESROT_SUBSTT);
        if (!isset($Grot_uriList[$sts])) {
            # Fcom_setLogInfo ( "debug" , 'ERR(File:'.basename(__FILE__).',Line:'.__line__.')' );
            return null;
        }
        $list = $Grot_uriList[$sts];
        if (!isset($list[$sub_sts])) {
            Fcom_setLogInfo("debug", 'ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . ')');
            return null;
        }
        $list2 = $list[$sub_sts];
        if (isset($list2[$type][$cont])) {
            Frot_setContsType($list2[$type][$cont]);
            $tgt = $list2[$type][$cont];
            return file_get_contents(dirname(__FILE__) . '/../../../..' . $list2[$type][$cont]);
        }
        #Fcom_setLogInfo ( "debug" , 'ERR(File:'.basename(__FILE__).',Line:'.__line__.')' );
        return null;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '() path:' . $path . PHP_EOL . $e->getMessage());
    }
}
コード例 #3
0
ファイル: Slgn_init.php プロジェクト: Ki4mTaria/ayawave
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());
    }
}
コード例 #4
0
ファイル: Slgn_ready.php プロジェクト: Ki4mTaria/ayawave
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());
    }
}
コード例 #5
0
ファイル: Scom_log.php プロジェクト: Ki4mTaria/ayawave
function Fcom_logObj($name, $obj)
{
    try {
        Fcom_setLogInfo(DCOM_LOGLV_DBG, '--- print get ' . $name . ' ---');
        foreach ($obj as $key => $val) {
            Fcom_setLogInfo(DCOM_LOGLV_DBG, '   ' . $key . ':' . $val);
        }
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
コード例 #6
0
ファイル: Slgn_ctrl.php プロジェクト: Ki4mTaria/ayawave
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());
    }
}
コード例 #7
0
ファイル: Sdbd_mysql.php プロジェクト: Ki4mTaria/ayawave
function Fdbd_getTableData($tbl, $sel, $where)
{
    try {
        if (null === $tbl || 0 === strcmp($tbl, "")) {
            throw new Exception('SV_ERR:' . basename(__FILE__) . "_" . __LINE__);
        }
        if (false === isset($sel)) {
            $sel = "*";
        }
        $pdo = Fdbd_connect();
        if (null === $pdo) {
            throw new Exception('SV_ERR:' . basename(__FILE__) . "_" . __LINE__);
        }
        $where_str = "";
        if (null !== $where || 0 !== strcmp($where, "")) {
            $where_str .= " WHERE " . $where;
        }
        $sql = "SELECT " . $sel . " FROM " . $tbl . $where_str;
        Fcom_setLogInfo("debug", $sql);
        $stmt = $pdo->prepare($sql);
        if (null === $stmt || false === $stmt->execute()) {
            throw new Exception('SV_ERR:' . basename(__FILE__) . "_" . __LINE__);
        }
        if (0 === strcmp("*", $sel)) {
            $column = Fdbd_getColumnList($tbl);
            if (null === $column) {
                throw new Exception('SV_ERR:' . basename(__FILE__) . "_" . __LINE__);
            }
        } else {
            $column[] = $sel;
        }
        $ret_val = null;
        while ($result = $stmt->fetch(PDO::FETCH_ASSOC)) {
            if (null === $ret_val) {
                $ret_val = array();
            }
            # var_dump( $result );
            foreach ($result as $col => $val) {
                $ret_val[$col][] = $val;
            }
        }
        return $ret_val;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
コード例 #8
0
ファイル: Sapp_ctrl.php プロジェクト: Ki4mTaria/ayawave
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());
    }
}
コード例 #9
0
ファイル: Sapp_init.php プロジェクト: Ki4mTaria/ayawave
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());
    }
}
コード例 #10
0
ファイル: Srot_session.php プロジェクト: Ki4mTaria/ayawave
function Frot_logSession()
{
    try {
        Fcom_setLogInfo(DCOM_LOGLV_DBG, '--- print session ---');
        foreach ($_SESSION as $key => $val) {
            Fcom_setLogInfo(DCOM_LOGLV_DBG, '   ' . $key . ':' . $val);
        }
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
コード例 #11
0
ファイル: test.php プロジェクト: Ki4mTaria/ayawave
<?php

require_once dirname(__FILE__) . "/Scom_log.php";
Fcom_setLogInfo("test", "test");
コード例 #12
0
ファイル: Srlg_func.php プロジェクト: Ki4mTaria/ayawave
function Frlg_jumpFirst()
{
    try {
        Fcom_setLogInfo(DCOM_LOGLV_DBG, 'jump first');
        $idx = array(DROT_SESIDX_STT => DROT_STT_LGN, DROT_SESIDX_SUBSTT => "");
        Frot_resetSession($idx);
        header('Location: http://' . DROT_HOST . ':' . DROT_PORT . '/' . DROT_APP_NAME);
        exit;
    } catch (Exception $e) {
        throw new Exception('ERR(File:' . basename(__FILE__) . ',Line:' . __LINE__ . '):' . __FUNCTION__ . '()' . PHP_EOL . $e->getMessage());
    }
}
コード例 #13
0
ファイル: Srot_url.php プロジェクト: Ki4mTaria/ayawave
    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;
        }
    }
} catch (Exception $e) {
    echo $e->getMessage();
    Fcom_setLogInfo(DCOM_LOGLV_ERR, $e->getMessage());
}
/*** function ***/
function Frot_getGETprm($end_uri)
{
    try {
        $ret_val = array();
        $exp1 = explode('?', $end_uri);
        if (1 === count($exp)) {
            return null;
        } else {
            if (2 === count($exp1)) {
                $preg = preg_match('/([!-~]+=[!-~]+&)*([!-~]+=[!-~]+)+/', $exp1[1], $m);
                if (1 !== $preg) {
                    return null;
                }
コード例 #14
0
ファイル: Sapp_ready.php プロジェクト: Ki4mTaria/ayawave
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());
    }
}