public function postreward($playerID = null) { Validate::player($playerID); $hash = filter_input(INPUT_POST, "key"); $incentiveModel = new IncentiveModel(); if ($incentiveModel->collectBooty($playerID, $hash)) { return true; } else { return false; } }
public function init($uuid) { $swfs = new SwfModel(); $player = new PlayerModel(); $incentiveModel = new IncentiveModel(); if ($_GET['platform'] != '') { $payload['platform'] = $_GET['platform']; } else { $payload['platform'] = "mobile"; } $platform = $payload['platform']; list($playerID, $newPlayer) = $player->getPlayerIDFromUID($uuid, $payload); $p = $player->loadPlayer($playerID); $playerSessionID = md5(uniqid(rand(), true)) . "_" . $p->visitCount; $lastLoginDate = strtotime($p->last_login_date) ? strtotime($p->last_login_date) : "0"; $player->updatePlayerLoginInfo($playerID, $lastLoginDate, $playerSessionID, $platform); if ($_GET['id'] != '') { $collectedItems = $incentiveModel->collectBooty($playerID, $_GET['id']); } $params['status'] = 'ok'; $params['appid'] = Config::get('facebook.appid'); $params['secret'] = Config::get('facebook.appsecret'); $params['repo'] = Config::get('storage.url'); $params['base'] = Config::get('url'); $params['uid'] = $p->uid; $params['playerID'] = $p->player_id; $params['music'] = $p->music ? true : false; $params['soundfx'] = $p->soundfx ? true : false; $params['locale'] = 'en_US'; //going to be spanish or english $params['debug'] = false; $params['namespace'] = Config::get('facebook.namespace'); $params['version'] = (int) $swfs->getBuildNumber(); $params['playerSession'] = $playerSessionID; $params['newPlayer'] = $newPlayer; $params['platform'] = $platform; $params['analyticsUrl'] = Config::get('analytics.url'); $params['analyticsKey'] = Config::Get('analytics.key'); $params['analyticsSecret'] = Config::get('analytics.secret'); $this->printJson($params); }