예제 #1
0
function pubMess()
{
    $myTopic = $_GET["topic"];
    $myMessage = $_GET["message"];
    $myRetain = $_GET["retain"];
    if ($myRetain == "true") {
        $myRetain = 1;
    } else {
        $myRetain = 0;
    }
    $myQos = 0;
    if (!validParam("message") & !validParam("topic")) {
        displayJson("invalid message & topic", "", "");
    } else {
        if (!validParam("message")) {
            displayJson("invalid message", $myTopic, "");
        } else {
            if (!validParam("topic")) {
                displayJson("invalid topic", "", $myTopic);
            } else {
                if (($mqtt = getMQTT()) == null) {
                    displayJson("invalid connection details", $myTopic, $myMessage);
                    return -1;
                }
                if ($mqtt->connect()) {
                    $mqtt->publish($myTopic, $myMessage, $myQos, $myRetain);
                    displayJson("ok", $myTopic, $myMessage);
                } else {
                    displayJson("failed to connect", $myTopic, $myMessage);
                }
            }
        }
    }
}
예제 #2
0
<?php

if (isAjaxRequest() && !isset($_POST['__qf_csrf'])) {
    $arr = array('title' => \Wf\Tpl\NavChain\Meta::displayTitle(), 'description' => '', 'sectionId' => defined('CUR_SECTION_ID') ? CUR_SECTION_ID : null, 'body' => $CONTENT, 'jsview' => $GLOBALS['jsview']);
    displayJson($arr);
    return;
}
?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

	<base href="<?php 
echo SITE_URL;
?>
" />

	<title><?php 
echo \Wf\Tpl\NavChain\Meta::displayTitle();
?>
</title>

	<meta name="keywords"		lang="ru" content="<?php 
echo htmlspecialchars(\Wf\Tpl\NavChain\Meta::getMetaKW());
?>
" />