Example #1
0
 public static function parseInfoPlist($ipafile)
 {
     $plist_name = self::unzipInfoPlistFileName($ipafile);
     if (!$plist_name) {
         throw new UnexpectedValueException(__METHOD__ . ": Info.plist file not found.");
     }
     $info_plist = self::unzipFile($ipafile, $plist_name);
     $plutil = new CFPropertyList\CFPropertyList();
     $plutil->parse($info_plist);
     return $plutil->toArray();
 }
Example #2
0
$slim->get('/checkin', function () use($slim) {
    //doCheckin($slim);
});
$slim->put('/checkin', function () use($slim) {
    // read data, do things
    $body = $slim->request->getBody();
    if (!isset($body) || strlen($body) == 0) {
        $slim->response()->status(401);
        // not authorised
    } else {
        $body = str_replace("#012", "", $body);
        $body = str_replace("#011", "", $body);
        syslog(LOG_DEBUG, "c");
        syslog(LOG_DEBUG, $body);
        $plist = new \CFPropertyList\CFPropertyList();
        $plist->parse($body);
        $message = $plist->toArray();
        $message_type = $message["MessageType"];
        if ($message_type == "Authenticate") {
            // TODO: authentication
            // grab our UUID and create/update our data
            $udid = $message["UDID"];
            $device = array();
            $device["udid"] = $udid;
            // we just return an 'OK' here
            create_device($device);
            // now, send back a response
            $res_plist = new \CFPropertyList\CFPropertyList();
            $res_plist->add($dict = new \CFPropertyList\CFDictionary());
            echo $res_plist->toXML();
        } elseif ($message_type == "TokenUpdate") {