Example #1
0
        }
    } elseif ($pageRequest[0] == "characters") {
        if (isset($_POST['action'])) {
            if ($_POST['action'] == 'enable_sso') {
                $stmt_enable_sso = $db->prepare('UPDATE user_characters SET sso_character = 1 ' . 'WHERE character_id = ? AND userid = ?');
                $stmt_enable_sso->execute(array($_POST['character_id'], $user->getUserID()));
            } elseif ($_POST['action'] == 'disable_sso') {
                $stmt_disable_sso = $db->prepare('UPDATE user_characters SET sso_character = 0 ' . 'WHERE character_id = ? AND userid = ?');
                $stmt_disable_sso->execute(array($_POST['character_id'], $user->getUserID()));
            }
        }
        /** Working with Characters */
        $characters = true;
        /** Building out the Character objects */
        $stmt_lookup_characters = $db->prepare('SELECT character_id,user_characters.key_keyid,key_vcode,key_mask ' . 'FROM user_characters JOIN user_apikeys ON user_characters.key_keyid = user_apikeys.key_keyid WHERE ' . 'user_characters.userid = ?');
        $stmt_lookup_characters->execute(array($user->getUserID()));
        $characterLookup = $stmt_lookup_characters->fetchAll(PDO::FETCH_ASSOC);
        $characterArray = array();
        foreach ($characterLookup as $characterSingleton) {
            $characterObject = new Blackbriar\Character($characterSingleton['character_id'], $characterSingleton['key_keyid'], $characterSingleton['key_vcode'], $characterSingleton['key_mask'], $user, $db);
            $characterArray[$characterObject->getCharacterDetail('characterName')] = $characterObject;
        }
        ksort($characterArray);
    }
    /** Requiring the Dashboard View **/
    require_once INCPATH . 'views/' . 'account.view.php';
} elseif ($user->getLoginStatus()) {
    header('Location:' . '/dashboard/');
} else {
    header('Location:' . '/login/');
}
Example #2
0
 public function refreshAPIKey($type)
 {
     if ($this->_keyStatus == 1 && $this->_keyExpiration == 'No Expiration' && $this->_keyType == 'Account') {
         $update = $this->updateAPIKey();
         if ($update) {
             $character_array = array();
             foreach ($this->getCharacters() as $character) {
                 $character_array[$character['characterID']] = $character['characterID'];
                 $char = new Blackbriar\Character($character['characterID'], $this->_keyID, $this->_vCode, $this->_accessMask, $this->_userID, $this->_db);
                 if ($char->getExistance() || $char->getExistance() == false) {
                     $char->updateCharacterInfo();
                     $char->updateCharacterSkills();
                 }
             }
             $this->removeOrphanedCharacter($this->_keyID, $this->_userID, $character_array);
             return true;
         }
     } elseif ($this->_keyStatus != 1 && $type == 'new') {
         $_SESSION['alert'] = new Alert('danger', 'The API Key Is Invalid', 'The API Key provided is invalid and cannot be used. Please create a new API key, and ensure you have copied the keyID and verification code correctly.');
     } elseif (!($this->_accessMask == MINIMUM_API_MASK) && $this->getKeyStatus() == 1 && $type == "new") {
         $_SESSION['alert'] = new Alert('danger', 'The API Key Does Not Meet Minimum Requirements', 'The required minimum Access Mask for API keys is ' . MINIMUM_API_MASK . '. Please create a new key using the Create Key link.');
     } elseif ($this->_keyExpiration != 'No Expiration' && $type == "new") {
         $_SESSION['alert'] = new Alert('danger', 'The API Key Expires', 'The provided API Key has an expiration set. Please create a new key using the Create Key link and ensure you select the No Expiration checkbox.');
     } elseif ($this->_keyType != 'Account' && $type == "new") {
         $_SESSION['alert'] = new Alert('danger', 'The API Key Provided is Single-Character', 'All API Keys must be account-wide. Please create a new key using the Create Key link, and do not change the key from an Account Key to a Single Character key.');
     }
 }