Exemple #1
0
 function set($mode)
 {
     $evt = new H2Event();
     $oldMode = $this->currentState['mode'];
     if ($oldMode != $mode) {
         $this->currentState['mode'] = $mode;
         $this->nv->set('state/current', $this->currentState);
         $evt->triggerEventByName('MODE-' . $oldMode . '-OFF');
         $evt->triggerEventByName('MODE-' . $mode . '-ON');
         broadCast(array('type' => 'modeSwitch', 'currentMode' => $mode, 'oldMode' => $oldMode));
     }
 }
Exemple #2
0
    $arrInput = array();
    $arrHeader = array();
    $arrHeader['CONTENT-TYPE'] = $_SERVER['CONTENT_TYPE'];
    $arrHeader['CONTENT-LENGTH'] = $_SERVER['CONTENT_LENGTH'];
    $arrInput['HEADER'] = $arrHeader;
    $arrInput['INPUT'] = file_get_contents('php://input');
    $arrCstParam = array();
    $arrCstParam['REQUEST_URI'] = $_GET['uri'];
    $arrCstParam['ACTION'] = $_GET['act'];
    $arrInput['CSTPARAM'] = $arrCstParam;
    return $arrInput;
}
$arrInput = parseInput();
// echo 'server: '; print_r($_SERVER); echo '<hr />';
// echo 'parsed input: ';print_r($arrInput); echo '<hr />';
broadCast($pdo, $arrInput);
function broadCast($pdo, $p_arrInput)
{
    if ('select' == $p_arrInput['CSTPARAM']['ACTION']) {
    } elseif ('update' == $p_arrInput['CSTPARAM']['ACTION']) {
        // echo 'array input: '; print_r($p_arrInput); echo '<hr />';
        $strSQL = 'select h.host_ip,i.port_num from service s inner join service_mapping m on s.service_id=m.service_id inner join instance i on m.instance_id=i.instance_id inner join host h on h.host_id=i.host_id where service_name=?';
        $sth = $pdo->prepare($strSQL);
        /*
         * $sth->execute(array( 'jp-office-rent' ));
         */
        $sth->execute(array($p_arrInput['CSTPARAM']['REQUEST_URI']));
        $sth->setFetchMode(PDO::FETCH_ASSOC);
        $rst = $sth->fetchAll();
        if (empty($rst)) {
            return;