Автор: Michael Cramer (BigMichi1@users.sourceforge.net)
Наследование: extends Linux
Пример #1
0
<?php

require_once "Android.php";
$object = new Android();
$object->dialogCreateAlert("Quiz Game By", "Amit Kumar Mondal");
$object->dialogSetPositiveButtonText("Proceed");
$object->dialogSetNegativeButtonText("Exit");
$object->dialogShow();
$response = $object->dialogGetResponse();
$function = $response["result"]->which == "positive" ? "proceed" : "exit";
switch ($function) {
    case "proceed":
        $object->dialogCreateAlert("What is Codename for MAC OS X 10.7?");
        $ans11 = array("Lion", "Leopard", "Snow Leopard", "Tiger");
        $object->dialogSetItems($ans11);
        $object->dialogShow();
        $ans1 = $object->dialogGetResponse();
        $ans1m = "Lion";
        if ($ans11[$ans1["result"]->item] == $ans1m) {
            $object->dialogCreateAlert("Result", "Right Answer");
            $object->dialogSetPositiveButtonText("Next");
            $object->dialogShow();
            $next = $object->dialogGetResponse();
            if ($next["result"]->which == "positive") {
                $object->dialogCreateAlert("What is the new Database developed by Google?");
                $ans22 = array("NoSQL", "MongoDB", "F1", "CouchDB");
                $object->dialogSetItems($ans22);
                $object->dialogShow();
                $ans2 = $object->dialogGetResponse();
                $ans2m = "F1";
                if ($ans22[$ans2["result"]->item] == $ans2m) {
Пример #2
0
            $arr = array('errno' => -1, 'error' => "Wrong credentials");
        } else {
            $arr = array('errno' => -2, 'error' => "System error");
        }
        return $arr;
    }
    static function getSpots()
    {
        $spots = Spot::getSpots();
        if ($spots) {
            $error = array('errno' => 0, 'error' => '');
            $arr = array('places' => $spots, 'error' => $error);
        } else {
            $error = array('errno' => -1, 'error' => 'System error');
            $arr = array('error' => $error);
        }
        return $arr;
    }
    static function getSpot($id)
    {
        $spot = Spot::_getSpotById($id);
        if ($spot) {
            $arr = array('places' => $spot, 'errno' => 0, 'error' => '');
        } else {
            $arr = array('errno' => -1, 'error' => 'System error');
        }
        return $arr;
    }
}
Android::process();
Пример #3
0
			</div>
<?php 
        }
        ?>
		</div>
<?php 
    }
    ?>

<?php 
    if ($__is_viewing_self || !IsHiddenObject('equip_droid')) {
        ?>
		<div id="inv_android" style="display: none">
<?php 
        MakeHideToggleButton('equip_droid');
        $droid = Android::GetAndroid($internal_id, CURRENT_LOCALE);
        ?>
			<span class="top-col lt"><?php 
        echo $character_info['name'];
        ?>
</span>
			<span class="top-col lb"><?php 
        echo GetJobname($character_info['job']);
        ?>
</span>
			<span class="top-col rt"><?php 
        echo $character_info['guildname'];
        ?>
</span>
			<span class="top-col rb"><?php 
        echo $character_info['fame'];
Пример #4
0
 /**
  * Test method for the <code>#toJSON()</code> function.
  */
 public function testToJSON()
 {
     $array = Android::create()->setBanner('http://example.com/banner.png')->setCustomIcon('http://example.com/image.png')->setGcmTtl(3600)->setHeader('Header')->setIcon('icon')->setRootParams(array('key' => 'value'))->setSound('push.mp3')->toJSON();
     $this->assertCount(7, $array);
     $this->assertEquals('http://example.com/banner.png', $array['android_banner']);
     $this->assertEquals('http://example.com/image.png', $array['android_custom_icon']);
     $this->assertEquals(3600, $array['android_gcm_ttl']);
     $this->assertEquals('Header', $array['android_header']);
     $this->assertEquals('icon', $array['android_icon']);
     $this->assertEquals(array('key' => 'value'), $array['android_root_params']);
     $this->assertEquals('push.mp3', $array['android_sound']);
 }
Пример #5
0
<?php

require_once "Android.php";
$obj = new Android();
$obj->dialogCreateAlert("It's time to do some crazy quizzing", "Developed By Amit Kumar Mondal");
$obj->dialogSetPositiveButtonText("Start");
$obj->dialogSetNegativeButtonText("No thanks");
$obj->dialogShow();
$inp = $obj->dialogGetResponse();
if ($inp["result"]->which == "positive") {
    //Question 1
    $qst1_opt = array("Windows 8", "Windows 7", "Windows Vista", "Windows XP");
    $qst1_ans = "Windows 7";
    $qst1 = question($obj, "Q1. Which has the codename Vienna?", $qst1_opt, $qst1_ans);
    //Question 2
    $qst2_opt = array("Go", "NoSQL", "Django", "AES");
    $qst2_ans = "Go";
    $qst2 = question($obj, "Q2. Amongst the following what is a Programming Language?", $qst2_opt, $qst2_ans);
    //Question 3
    $qst3_opt = array("Van Neuman", "Kernighan", "Rasmus Lerdorf", "Belly Deriath");
    $qst3_ans = "Rasmus Lerdorf";
    $qst3 = question($obj, "Q3. Who is the developer of PHP?", $qst3_opt, $qst3_ans);
    //Question 4
    $qst4_opt = array("Library Function", "Initialization Function", "Module Initialization Scheme", "Extension .so/.dll");
    $qst4_ans = "Module Initialization Scheme";
    $qst4 = question($obj, "Q4. What is the MINIT in PHP?", $qst4_opt, $qst4_ans);
    //Question 5
    $qst5_opt = array("echo()", "print()", "fread()", "printf()");
    $qst5_ans = "printf()";
    $qst5 = question($obj, "Q5. Amongst which takes unlimited arguments?", $qst5_opt, $qst5_ans);
    $result = $qst1 + $qst2 + $qst3 + $qst4 + $qst5;
Пример #6
0
<?php

require_once "Android.php";
$droid = new Android();
/* Some GUI for the user */
$droid->dialogCreateAlert("Socket Program By", "Amit Kumar Mondal");
$droid->dialogSetNeutralButtonText("I'm Ready to fun!");
$droid->dialogShow();
$result = $droid->dialogGetResponse();
/* Get parameters */
/* 1- Remote AMI server */
$server = $droid->dialogGetInput("Please enter IP/Hostname of your Asterisk BOX", "");
/* 2- Remote AMI port */
$port = $droid->dialogGetInput("Please enter TCP Port", "");
/* 3- Remote user */
$user = $droid->dialogGetInput("Please enter username", "");
/* 4- Remote pass */
$pass = $droid->dialogGetPassword("Please enter password", "");
$server = $server['result'];
$port = $port['result'];
$user = $user['result'];
$pass = $pass['result'];
echo "Ready to connect to {$server}:{$port} with {$user}/{$pass}\n";
/* TCP Connection */
$astSocket = fsockopen($server, $port, $errno, $errstr, 30);
if (!$astSocket) {
    $droid->dialogCreateAlert("Socket Program", "Sorry, TCP Connection on {$server} : {$port} was not possible :r(");
    $droid->dialogSetNeutralButtonText("I will try again :D)");
    $droid->dialogShow();
    $result = $droid->dialogGetResponse();
    exit(1);
    return 'Button released';
}

function r2($args) {
    global $droid;
    $droid->vibrate(30);
    return 'Button released';
}

function r3($args) {
    global $droid;
    $droid->vibrate(30);
    return 'Button released';
}
*/
$droid = new Android();
$droid->notify("Starting", "Starting server...");
$bind_address = '127.0.0.1';
$port = 8000;
$server_socket = socket_create(AF_INET, SOCK_STREAM, 0) or die("socket_create()failed.");
socket_bind($server_socket, $bind_address, $port) or die("socket_bind()failed");
socket_listen($server_socket, 5) or die("socket_listen()failed");
// Stop socket from handing when killed
socket_set_block($server_socket);
socket_set_option($server_socket, SOL_SOCKET, SO_LINGER, array('l_onoff' => 1, 'l_linger' => 0));
$droid->notify("Running", "Server is up and running ....");
$droid->view("http://localhost:{$port}/start", "text/html");
$running = true;
do {
    if (($socket = socket_accept($server_socket)) < 0) {
        echo "socket_accept() failed \r\n";
Пример #8
0
<?php

// horoscope.php: Proof of Concept retrieving horoscope information
// @author: Javier Infante <jabiAT_NOSP_AMirontec.com>
require_once "Android.php";
$droid = new Android();
$action = "start";
while (true) {
    switch ($action) {
        case "start":
            $droid->dialogCreateAlert("PFA-Horoscope", "Ask PFAewok for your Horoscope");
            $droid->dialogSetPositiveButtonText("ask now!");
            $droid->dialogSetNegativeButtonText("credits...");
            $droid->dialogShow();
            // Wait for user input
            $result = $droid->dialogGetResponse();
            switch ($result['result']->which) {
                case "negative":
                    $action = "credits";
                    break;
                case "positive":
                default:
                    $action = "choose_and_ask";
                    break;
            }
            $droid->dialogDismiss();
            break;
        case "credits":
            $droid->dialogCreateAlert("PFA-Horoscope", "Only for educational Purpouses (what else?).\n\nHoroscope Source: http://widgets.fabulously40.com/horoscope.json\n\nwww.phpforandroid.net");
            $droid->dialogSetPositiveButtonText("back");
            $droid->dialogSetNegativeButtonText("exit");
Пример #9
0
<?php

include "Android.php";
$droid = new Android();
//creates alert
$droid->dialogCreateAlert();
$result = array();
//gets coordinates
$latitude = $droid->dialogGetInput("Location", "Latitude: ");
$longitude = $droid->dialogGetInput("Location", "Longitude: ");
//gets the location info
$locations = $droid->dialogGeocode($latitude['result'], $longitude['result']);
//parses location info
foreach ($locations['result'] as $location) {
    $location = get_object_vars($location);
    //sets location items
    foreach ($location as $key => $value) {
        $result[] = ucfirst(str_replace('_', ' ', $key)) . ': ' . $value;
    }
}
$droid->dialogSetItems($result);
//displays the box
$droid->dialogShow();