コード例 #1
0
function processSMSMessage($from, $messageText)
{
    global $pluginName, $MESSAGE_QUEUE_PLUGIN_ENABLED;
    //  logEntry("Adding message from: ".$from. ": ".$messageText. " to message queue");
    if ($MESSAGE_QUEUE_PLUGIN_ENABLED) {
        addNewMessage($messageText, $pluginName, $from);
    } else {
        logEntry("MessageQueue plugin is not enabled/installed: Cannot add message: " . $messageText);
    }
    return;
}
コード例 #2
0
                    $right = substr($right, 1);
                }
                if (trim($right) != "") {
                    $messageText .= " " . $SEPARATOR . " " . $right;
                }
            }
        }
        //there gets some ^ in the output.. erase them!
        $messageText = preg_replace('/\\^/', '', $messageText);
        $messageText = preg_replace('/\\s[a]t\\s/', ' @ ', $messageText);
        if (trim($messageText) == "") {
            $messageLine = $SPORTS_READ[$i] . " - No Scores Availble";
        } else {
            $messageLine = $SPORTS_READ[$i] . " " . $messageText;
        }
        addNewMessage($messageLine, $pluginName, $pluginData = $SPORTS_READ[$i]);
        $messageText = "";
        $messageLine = "";
    }
}
function search_in_array($value, $arr)
{
    $num = 0;
    for ($i = 0; $i < count($arr);) {
        if ($arr[$i][0] == $value) {
            $num++;
        }
        $i++;
    }
    return $num;
}
コード例 #3
0
        print_r($json_output);
    }
    //Output Stock price array key.
    $stockValue = $json_output['l'];
    $stockChange = $json_output['c'];
    //echo "\nPrice: ".$stockValue;
    //echo "\nChange: ".$stockChange;
    if (count($quotesToGet) > 1 && $quoteIndex > 0) {
        $messageText .= " | ";
    }
    $messageText .= " " . $q . " " . $stockValue . " [" . $stockChange . "]";
    $quoteIndex++;
    //if there is more than one stock ticker, then put a PIPE symbol on the string
}
if ($MESSAGE_QUEUE_PLUGIN_ENABLED) {
    addNewMessage($messageText, $pluginName, $QUOTES);
} else {
    logEntry("MessageQueue plugin is not enabled/installed: Cannot add message: " . $messageText);
}
if ($IMMEDIATE_OUTPUT != "on" && $IMMEDIATE_OUTPUT != "1") {
    logEntry("NOT immediately outputting to matrix");
} else {
    logEntry("IMMEDIATE OUTPUT ENABLED");
    logEntry("Matrix location: " . $MATRIX_LOCATION);
    logEntry("Matrix Exec page: " . $MATRIX_EXEC_PAGE_NAME);
    if ($MATRIX_LOCATION != "127.0.0.1") {
        $remoteCMD = "/usr/bin/curl -s --basic 'http://" . $MATRIX_LOCATION . "/plugin.php?plugin=" . $MATRIX_MESSAGE_PLUGIN_NAME . "&page=" . $MATRIX_EXEC_PAGE_NAME . "&nopage=1' > /dev/null";
        logEntry("REMOTE MATRIX TRIGGER: " . $remoteCMD);
        exec($remoteCMD);
    } else {
        $IMMEDIATE_CMD = $settings['pluginDirectory'] . "/" . $MATRIX_MESSAGE_PLUGIN_NAME . "/matrix.php";