Ejemplo n.º 1
0
/**
 * send message to qaul app
 */
function twitter_send2qaul($msg)
{
    $url = 'http://localhost:8081/sendmsg';
    $post_data = array('t' => 11, 'm' => twitter_message_string_byte(protect_message($msg->getMsg()), $msg->getName()), 'e' => 1);
    $content = http_build_query($post_data);
    // use key 'http' even if you send the request to https://...
    $options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\nAccept-Charset: UTF-8\r\n", 'method' => 'POST', 'content' => $content));
    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
    if (get_debug()) {
        echo "context: {$content} \n";
    }
}
Ejemplo n.º 2
0
if (isset($_GET['id'])) {
    $id = $_GET['id'];
} else {
    $id = 0;
}
// pull messages from data base
if ($id) {
    $files = FileQuery::create()->filterById(array('min' => $id))->orderById('asc')->limit(30)->find();
} else {
    $files = FileQuery::create()->orderById('desc')->limit(150)->find();
}
// send json to client
$first = true;
echo "{\"files\":[\n";
foreach ($files as $file) {
    if ($first) {
        $first = false;
    } else {
        echo ",\n";
    }
    echo "{";
    echo '"id":' . $file->getId() . ',';
    echo '"hash":"' . $file->getHash() . '",';
    echo '"suffix":"' . $file->getSuffix() . '",';
    echo '"size":' . $file->getSize() . ',';
    echo '"description":"' . protect_message($file->getDescription()) . '",';
    echo '"time":"' . $file->getCreatedAt('Y-m-d H:i:s') . '",';
    echo '"status":4';
    echo "}";
}
echo "\n]}";
Ejemplo n.º 3
0
}
// send json to client
$first = true;
echo '{"name":"' . get_qaul_setting('name') . "\",\n";
echo "\"messages\":[\n";
foreach ($msgs as $msg) {
    if ($first) {
        $first = false;
    } else {
        echo ",\n";
    }
    echo "{";
    /*
    	echo '"id":' .$msg->getId() .',';
    	echo '"type":' .$msg->getType() .',';
    	echo '"name":"' .$msg->getName() .'",';
    	echo '"ip":"' .$msg->getIp() .'",';
    	echo '"msg":"' .protect_message($msg->getMsg()) .'",';
    	echo '"time":"' .$msg->getCreatedAt('Y-m-d H:i:s') .'",';
    	echo '"twitterid":"' .$msg->getTwitterid() .'"';
    */
    echo '"id":' . $msg->getId() . ',';
    echo '"type":' . $msg->getType() . ',';
    echo '"name":"' . $msg->getName() . '",';
    echo '"ip":"' . $msg->getIp() . '",';
    echo '"msg":"' . protect_message($msg->getMsg()) . '",';
    echo '"time":"' . $msg->getCreatedAt('Y-m-d H:i:s') . '",';
    echo '"twitterid":"' . $msg->getTwitterid() . '"';
    echo "}";
}
echo "\n]}";