コード例 #1
0
ファイル: bb_api_class.php プロジェクト: jncarlson/bluebaron
 public function getDataForApi($dataType)
 {
     if (strpos($dataType, 'static') > -1) {
         $data = $this->getStaticData($dataType);
     } else {
         $data = DB_Interaction::getApiDataFromDB($this->playerId, $this->region, $dataType);
     }
     $response = new Response($data);
     exit($response->getResponse());
 }
コード例 #2
0
 public static function getDBFields()
 {
     global $db;
     $sql = "SHOW COLUMNS FROM summoner;";
     $result = $db->query($sql);
     $fields = array();
     while ($row = $result->fetch_assoc()) {
         $fields[] = $row['Field'];
     }
     self::$dbFields = $fields;
 }
コード例 #3
0
ファイル: api-config.php プロジェクト: jncarlson/bluebaron
<?php

$apiRoot = __DIR__;
include $apiRoot . '/classes/db_class.php';
include $apiRoot . '/classes/bb_api_class.php';
include $apiRoot . '/classes/custom_data_class.php';
include $apiRoot . '/classes/riot_api_class.php';
include $apiRoot . '/classes/utilities_class.php';
include $apiRoot . '/classes/bb_error_class.php';
include $apiRoot . '/classes/bb_response_class.php';
include $apiRoot . '/classes/db_interaction_class.php';
date_default_timezone_set('America/Denver');
$instance = Database::getInstance();
$db = $instance->getConnection();
DB_Interaction::getDBFields();
コード例 #4
0
ファイル: api-internal.php プロジェクト: jncarlson/bluebaron
<?php

include './api-config.php';
$data = file_get_contents('php://input');
$data = json_decode($data);
$data = (array) $data;
$data['region'] = strtolower($data['region']);
if (!isset($data['id']) && !isset($data['region']) && !isset($data['partial'])) {
    Utilities::BBExit('69', 'bb_api');
}
if (!Utilities::verifyRequestVars($data)) {
    Utilities::BBExit('420', 'bb_api');
}
if ($data['partial'] == 'initialize') {
    $refresh = isset($data['update']) ? true : false;
    if (!DB_Interaction::canUserRefresh($data['id'], $data['region']) && $refresh) {
        $timeUntilRefresh = DB_Interaction::getTimeUntilUserCanRefresh($data['id'], $data['region']);
        Utilities::bbExit('666', 'bb_api', "You have {$timeUntilRefresh['minutes']} minutes {$timeUntilRefresh['seconds']} seconds until you can refresh.");
    }
    $api = new BBApi();
    $api->appInit($data['id'], $data['region'], $refresh);
} else {
    $api = new BBApi($data['id'], $data['region']);
    $api->getDataForApi($data['partial']);
}