当前位置: 首页>>代码示例>>PHP>>正文


PHP setState函数代码示例

本文整理汇总了PHP中setState函数的典型用法代码示例。如果您正苦于以下问题:PHP setState函数的具体用法?PHP setState怎么用?PHP setState使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setState函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gotDTMF

function gotDTMF($text)
{
    global $ourcallid;
    global $partycallid;
    global $state;
    Yate::Output("gotDTMF('" . $text . "') state: " . $state);
    switch ($text) {
        case "1":
            setState("record");
            break;
        case "2":
            setState("play");
            break;
        case "3":
            setState("");
            break;
        case "#":
            setState("prompt");
            break;
    }
}
开发者ID:flamesgroup,项目名称:yate,代码行数:21,代码来源:playrec.php

示例2: file_get_contents

        return "";
    }
    return file_get_contents($file);
}
$stateFile = sys_get_temp_dir() . "/tripmine-status";
$command = $_GET['command'];
if ($command) {
    if ($command == "status") {
        echo getState($stateFile);
    }
    exit;
}
$method = $_SERVER['REQUEST_METHOD'];
$contentType = $_SERVER['CONTENT_TYPE'];
if ($method == "OPTIONS") {
    // Don't allow cross-site requests with preflight.
    exit;
}
// Only allow simple cross-site requests - since we did not allow preflight, this is all we should ever get.
if ($method != "GET" && $method != "HEAD" && $method != "POST") {
    setState("FAIL. Non-simple method {$method}.", $stateFile);
    exit;
}
if (isset($contentType) && !preg_match("/^application\\/x\\-www\\-form\\-urlencoded(;.+)?\$/", $contentType) && !preg_match("/^multipart\\/form\\-data(;.+)?\$/", $contentType) && !preg_match("/^text\\/plain(;.+)?\$/", $contentType)) {
    setState("FAIL. Non-simple content type: {$contentType}.", $stateFile);
    exit;
}
if (isset($_SERVER['HTTP_X_WEBKIT_TEST'])) {
    setState("FAIL. Custom header sent with a simple request.", $stateFile);
    exit;
}
开发者ID:gwindlord,项目名称:lenovo_b6000-8000_kernel_source,代码行数:31,代码来源:tripmine.php

示例3: endRoute

function endRoute($callto, $ok, $err)
{
    global $partycallid;
    global $num;
    global $collect;
    if ($ok) {
        Yate::Output("Overlapped got route: '{$callto}' for '{$collect}'");
        $m = new Yate("chan.masquerade");
        $m->params["message"] = "call.execute";
        $m->params["id"] = $partycallid;
        $m->params["callto"] = $callto;
        $m->params["caller"] = $num;
        $m->params["called"] = $collect;
        $m->Dispatch();
        return;
    }
    if ($err != "incomplete") {
        setState("noroute");
    } else {
        Yate::Output("Overlapped still incomplete: '{$collect}'");
    }
}
开发者ID:biddyweb,项目名称:vmukti,代码行数:22,代码来源:overlapped.php

示例4: sys_get_temp_dir

<?php

require_once '../../resources/portabilityLayer.php';
$stateFile = sys_get_temp_dir() . "/access-control-preflight-headers-status";
function setState($newState, $file)
{
    file_put_contents($file, $newState);
}
function getState($file)
{
    if (!file_exists($file)) {
        return "";
    }
    return file_get_contents($file);
}
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: X-Custom-Header");
header("Access-Control-Max-Age: 0");
if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") {
    if (isset($_SERVER["HTTP_X_CUSTOM_HEADER"])) {
        setState("FAIL", $stateFile);
    } else {
        setState("PASS", $stateFile);
    }
} else {
    if (isset($_SERVER["HTTP_X_CUSTOM_HEADER"])) {
        echo getState($stateFile);
    } else {
        echo "FAIL - no header in actual request";
    }
}
开发者ID:dreifachstein,项目名称:chromium-src,代码行数:31,代码来源:no-custom-header.php

示例5: setState

        exit;
    }
    setState(false);
    echo "<br/>*** DATABASE SETUP IS NOW COMPLETE ***<br/><br/>";
    setStatus("Generating config.php");
    $cfgFile = generateConfig();
    echo $cfgFile;
    $filename = "config.php";
    if (!($handle = fopen($filename, 'w'))) {
        setState(true);
        echo "<strong>ERROR: Could not open config.php</strong>";
        exitConsole();
        exit;
    }
    if (fwrite($handle, $cfgFile) === FALSE) {
        setState(true);
        echo "Cannot write to file ({$filename})";
        exitConsole();
        exit;
    }
    echo "</span></div>";
    $connector->closeConnection();
    ?>
29o3 has been installed successfully. <a href="index.php?InstallationSuccessful">Please click here to go on.</a>
</div>
</div>
<?php 
} else {
    if (!$config_exists) {
        ?>
开发者ID:BackupTheBerlios,项目名称:twonineothree-svn,代码行数:30,代码来源:install.php

示例6: setState

<?php

$api = "http://10.12.114.181:3000/api";
if ($_GET['user'] and $_GET['setState']) {
    setState($_GET['user'], $_GET['setState']);
    header("Location: index.php");
    exit;
}
//get current state from server
$cur = file_get_contents($api . "/state/get");
$cur = json_decode($cur, 1);
function putrequest($url, $body)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($body)));
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
    curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_exec($ch);
    curl_close($ch);
}
function setState($user, $state)
{
    global $api;
    putrequest($api . "/state/set/" . $user, "{\"state\":\"" . $state . "\"}");
}
?>
<html>
<head>
<title>L0.13 Presence Palm TX</title>
开发者ID:jhamfler,项目名称:Room-Presence-Service,代码行数:31,代码来源:index.php

示例7: endRoute

function endRoute($callto, $ok, $err, $params)
{
    global $partycallid;
    global $collect;
    global $final;
    global $queue;
    global $routeOnly;
    global $state;
    if ($ok && $callto != "-" && $callto != "error") {
        Yate::Output("Overlapped got route: '{$callto}' for '{$collect}'");
        $m = new Yate("chan.masquerade");
        $m->params = $params;
        $m->params["message"] = "call.execute";
        $m->params["complete_minimal"] = true;
        $m->params["id"] = $partycallid;
        $m->params["callto"] = $callto;
        $m->Dispatch();
        if (strlen($queue)) {
            // Masquerade the remaining digits
            // TODO: wait for call.execute to be processed to do that?
            $d = new Yate("chan.masquerade");
            $d->params["message"] = "chan.dtmf";
            $d->params["id"] = $partycallid;
            $d->params["tone"] = $queue;
            $d->Dispatch();
        }
        return;
    }
    if ($final) {
        Yate::Output("Overlapped got final error '{$err}' for '{$collect}'");
        Yate::SetLocal("reason", $err);
        setState("");
    } else {
        if ($err != "incomplete") {
            Yate::Output("Overlapped got error '{$err}' for '{$collect}'");
            Yate::SetLocal("reason", $err);
            setState("");
            $final = true;
        } else {
            Yate::Debug("Overlapped still incomplete: '{$collect}'");
            if ($routeOnly) {
                setState("noroute");
            } else {
                // Don't use setState: we don't want to change the prompt
                $state = "prompt";
            }
            // Check if got some other digits
            if ($queue != "") {
                gotDTMF("");
            }
        }
    }
}
开发者ID:flamesgroup,项目名称:yate,代码行数:53,代码来源:overlapped.php

示例8: navigate

function navigate($text)
{
    global $state;
    global $current;
    switch ($text) {
        case "0":
            listenTo(0);
            break;
        case "7":
            listenTo($current - 1);
            break;
        case "8":
            listenTo($current);
            break;
        case "9":
            listenTo($current + 1);
            break;
        case "1":
            setState("play:record,play:beep,record");
            break;
        case "2":
            setState("play");
            break;
        case "3":
            setState("");
            break;
        case "*":
            setState("prompt");
            break;
    }
}
开发者ID:andreikabeliy,项目名称:yate,代码行数:31,代码来源:voicemail.php

示例9: filterHTML

	function filterHTML($codeContent)
	{
		global $state;
			
		// Array holds information about the current state of parsing 
		// e.g. the current tag, the last tag, etc.
		$state = array();
		
		// Clear the document in case function is called several times on one page
		clearDoc();

		// set up state defaults
		setState('abort_filtering', false); // used to abort filtering on encountering an unsupported tag
		setState('current_tag', "");		// the current tag being processed
		setState('in_list', false);			// whether the parser is currently inside a list (<ul> or <ol> etc...)
		setState('is_ordered_list', false);	// whether the current list being parsed is an <ol> (for preservation)
		setState('last_tag', "");			// the last tag that was processed
		setState('css', "");				// keeps track of css styles to add to the next p tag (used to grab textformat attributes)
		setState('empty', true);			// keeps track of whether an element is empty
		setState('depth', 0);				// keeps track of the depth of the current node
		setState('style_depth', 0);			// keeps track of the depth of the current styling node (used to remove redundant styles)
		setState('last_style_depth', 0);	// keeps track of the depth of the current styling node (used to remove redundant styles)
		setState('last_depth', 0);			// keeps track of the last depth processed
		setState('last_font', "");			// keeps track of the last font family (used to avoid redundant styles)
		setState('last_size', "");			// keeps track of the last font size  (used to avoid redundant styles)
		setState('last_color', "");			// keeps track of the last foreground color (used to avoid redundant styles)

		//
		// URL-Decode the incoming content (obedit will url-encode it before sending.)
		//
		$codeContent = urldecode($codeContent);
		
		//
		// Initialize the XML parser and set element handler functions
		//
		$xml_parser = xml_parser_create();
		
		xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
		xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, "UTF-8");
		xml_set_element_handler($xml_parser, "startElement", "endElement");
		xml_set_character_data_handler($xml_parser, "characterData");
	
		//
		// Wrap the obedit document in XML to prevent validation errors 
		// from the XML parser (this extra stuff is ignored by the filter and won't show up in the output)
		//
		$xml_data = "<?xml version='1.0'?><parserdocument>".$codeContent."</parserdocument>";
	
		//
		// Do the parsing. See the handler functions above.
		//
		$filterResult = @xml_parse($xml_parser, $xml_data, true);
	
		//
		// If the document is invalidly formed or not valid obedit-generated HTML (e.g. hand-coded), 
		// then spit out the originally submitted HTML (but still perform unicode conversion) 
		//
		if (!$filterResult || filterWasAborted())
		{
			clearDoc();
			add2Doc(unicode_to_entities(utf8_to_unicode($codeContent)));			
		}
		else
		{
			//
			// If we're here, the document is a valid RTE document and was successfully parsed and filtered.
			//
			// Now we just have to check if the document ended with a list, and if so, 
			// close the list off with the appropriate </ul> or </ol> to wrap things up.
			//
			if (isInsideList()) 
			{
				if (isOrderedList()) add2Doc("\n</ol>");
				else add2Doc("\n</ul>");
				setInsideList(false);
			}
		}
		
		// Free up memory
		xml_parser_free($xml_parser);
		
		// Return the final HTML document
		return getDoc();
	}
开发者ID:skoczen,项目名称:impact4-builder,代码行数:84,代码来源:obedit_html_filter.inc.php

示例10: gotNotify

function gotNotify($reason)
{
    global $state;
    debug("gotNotify('{$reason}') state: {$state}");
    if ($reason == "replaced") {
        return;
    }
    switch ($state) {
        case "greeting":
            setState("prolong_greeting");
            break;
        case "prolong_greeting":
            setState("call.route");
            break;
        case "goodbye":
            setState("");
            break;
    }
}
开发者ID:komunikator,项目名称:komunikator,代码行数:19,代码来源:auto_attendant.php

示例11: header

                header("Access-Control-Max-Age: 1");
            }
            echo "FAIL: This request should not be displayed.\n";
            setState("Denied", $tmpFile);
        } else {
            fail($state);
        }
    } else {
        if ($state == "Denied") {
            if ($_SERVER['REQUEST_METHOD'] == "GET" && $_GET['state'] == "complete") {
                unlink($tmpFile);
                header("Access-Control-Allow-Origin: http://127.0.0.1:8000");
                header("Access-Control-Max-Age: 1");
                echo "PASS: Request successfully blocked.\n";
            } else {
                setState("Deny Ignored", $tmpFile);
                fail($state);
            }
        } else {
            if ($state == "Deny Ignored") {
                unlink($tmpFile);
                fail($state);
            } else {
                if (file_exists($tmpFile)) {
                    unlink($tmpFile);
                }
                fail("Unknown");
            }
        }
    }
}
开发者ID:dreifachstein,项目名称:chromium-src,代码行数:31,代码来源:access-control-preflight-denied-xsrf.php

示例12: gotDTMF

function gotDTMF($text)
{
    global $state;
    global $mailbox;
    global $collect_user;
    global $collect_pass;
    debug("gotDTMF('{$text}') state: {$state}");
    switch ($state) {
        case "user":
            if ($text == "*") {
                promptUser();
                return;
            }
            if ($text == "#") {
                checkUser();
            } else {
                $collect_user .= $text;
            }
            return;
        case "pass":
            if ($text == "*") {
                promptPass();
                return;
            }
            if ($text == "#") {
                checkPass();
            } else {
                $collect_pass .= $text;
            }
            return;
        case "record":
            setState("prompt");
            return;
    }
    if ($mailbox == "") {
        return;
    }
    navigate($text);
}
开发者ID:komunikator,项目名称:komunikator,代码行数:39,代码来源:voicemaildb.php

示例13: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  */
 public function actionUpdate()
 {
     if (!isset($_GET['rem'])) {
         $back_url = $_POST['back_url'] ? $_POST['back_url'] : rurl();
         setState('back_url', $back_url);
     }
     $action =& $_GET['action'];
     $top_leaf_id =& $_GET['top_leaf_id'];
     $model = $this->loadModel();
     if (isset($_POST['Article'])) {
         $model->attributes = $_POST['Article'];
         $model->update_time = date("Y-m-d H:i:s");
         if ($model->save()) {
             if (count($_POST['category_article_ids']) > 0) {
                 ManyCategoryArticle::model()->deleteAllByAttributes(array('article_id' => $model->id));
                 foreach ($_POST['category_article_ids'] as $m_category_id) {
                     $_model = new ManyCategoryArticle();
                     $_model->article_id = $model->id;
                     $_model->category_id = $m_category_id;
                     $_model->save();
                 }
             }
             $str = Yii::t('cp', 'Data saved success On ') . Time::now();
             Yii::app()->user->setFlash('success', $str);
             $this->redirect(array('update', 'id' => $model->id, 'action' => $action, 'top_leaf_id' => $top_leaf_id, 'rem' => 0));
         }
     }
     $leaf_tree =& $this->getTree($top_leaf_id);
     $top_leaf = Category::Model()->findByPk($top_leaf_id);
     $this->path = Category::model()->getPath($model->category_id, $top_leaf->id);
     $this->render('update', array('action' => $action, 'model' => $model, 'top_leaf' => $top_leaf, 'leaf_tree' => $leaf_tree));
 }
开发者ID:paranoidxc,项目名称:iwebhost,代码行数:36,代码来源:ArticleController.php

示例14: gotNotify

function gotNotify($reason)
{
    global $state;
    debug("gotNotify('{$reason}') state: {$state}");
    if ($reason == "replaced") {
        return;
    }
    switch ($state) {
        case "goodbye":
            setState("");
            break;
        case "greeting":
            setState("beep");
            break;
        case "beep":
            setState("record");
            break;
        default:
            setState("goodbye");
            break;
    }
}
开发者ID:komunikator,项目名称:komunikator,代码行数:22,代码来源:leavemaildb.php

示例15: header

     if ($_SERVER['REQUEST_METHOD'] == "PUT") {
         header("Access-Control-Allow-Origin: http://127.0.0.1:8000");
         header("Access-Control-Allow-Credentials: true");
         echo "PASS: First PUT request.";
         setState("FirstPUTSent", $tmpFile);
     } else {
         fail();
     }
 } else {
     if ($state == "FirstPUTSent") {
         if ($_SERVER['REQUEST_METHOD'] == "OPTIONS") {
             header("Access-Control-Allow-Origin: http://127.0.0.1:8000");
             header("Access-Control-Allow-Credentials: true");
             header("Access-Control-Allow-Methods: PUT");
             header("Access-Control-Allow-Headers: x-webkit-test");
             setState("SecondOPTIONSSent", $tmpFile);
         } else {
             if ($_SERVER['REQUEST_METHOD'] == "PUT") {
                 header("Access-Control-Allow-Origin: http://127.0.0.1:8000");
                 header("Access-Control-Allow-Credentials: true");
                 echo "FAIL: Second PUT request sent without preflight";
             }
         }
     } else {
         if ($state == "SecondOPTIONSSent") {
             if ($_SERVER['REQUEST_METHOD'] == "PUT") {
                 header("Access-Control-Allow-Origin: http://127.0.0.1:8000");
                 header("Access-Control-Allow-Credentials: true");
                 echo "PASS: Second OPTIONS request was sent.";
             } else {
                 fail();
开发者ID:dreifachstein,项目名称:chromium-src,代码行数:31,代码来源:access-control-basic-preflight-cache-timeout.php


注:本文中的setState函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。