Exemple #1
0
 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;
     }
 }
Exemple #2
0
 public function create($playerID)
 {
     Log::add('made it to incentive create');
     Validate::player($playerID);
     $hash = filter_input(INPUT_POST, "key");
     $type = filter_input(INPUT_POST, "incType");
     //for this to work, there has to be a player record with the last sessionID == hash
     $incentiveModel = new IncentiveModel();
     if ($incentiveModel->create($hash, $playerID, $type)) {
         $this->printJson(array('status' => 'ok', 'key' => $hash));
     } else {
         $this->printJson(array('status' => 'error'));
     }
 }
Exemple #3
0
 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);
 }