Ejemplo n.º 1
0
function runApp($appid)
{
    $ra = loadJSON("runningApps", array());
    $ia = installedApps();
    // Puke if not installed or already running
    if (!array_key_exists($appid, $ia) || array_key_exists($appid, $ra)) {
        return array("success" => false, "msg" => "No such app, or app already running");
    }
    $torun = $ia[$appid];
    if (placeAppOnDisplay($torun) > -1) {
        //app . src = '/opp/' + app . reverseDomainName + '/app/tv/index.html';
        $ra[$appid] = $torun;
        saveJSON("runningApps", $ra);
        //setIframePositions();
        signalAppLaunch($torun);
        return array("success" => true, "msg" => "App launched");
    } else {
        return array("success" => false, "msg" => "Could not place app in slot");
    }
}
Ejemplo n.º 2
0
     break;
 case 'kill':
     if (isPOST() && isset($_REQUEST['appid'])) {
         $kill = killApp($_REQUEST['appid']);
         if ($kill["success"]) {
             jsonOut(json_encode(array("killed" => $_REQUEST['appid'])));
         } else {
             badReq($kill["msg"]);
         }
     } else {
         badReq('Wrong verb or no appid');
     }
     break;
 case 'launch':
     if (isPOST() && isset($_REQUEST['appid'])) {
         signalAppLaunch($_REQUEST['appid']);
         $launch = runApp($_REQUEST['appid']);
         if ($launch["success"]) {
             jsonOut(json_encode(array("launch" => $_REQUEST['appid'])));
         } else {
             badReq($launch["msg"]);
         }
     } else {
         badReq('Wrong verb or no appid');
     }
     break;
 case 'move':
     if (isPOST() && isset($_REQUEST['appid'])) {
         $res = moveApp($_REQUEST['appid']);
         header('Content-Type: application/json');
         jsonOut(json_encode($res));