/**
  * This method calls functions on the implementation class and returns the output or Fault object in case of error to client
  *
  * @return unknown
  */
 function serve()
 {
     $GLOBALS['log']->info('Begin: SugarRestJSON->serve');
     $json_data = !empty($_REQUEST['rest_data']) ? $_REQUEST['rest_data'] : '';
     if (empty($_REQUEST['method']) || !method_exists($this->implementation, $_REQUEST['method'])) {
         $er = new SoapError();
         $er->set_error('invalid_call');
         $this->fault($er);
     } else {
         $method = $_REQUEST['method'];
         $json = getJSONObj();
         $data = $json->decode(from_html($json_data));
         if (!is_array($data)) {
             $data = array($data);
         }
         $GLOBALS['log']->info('End: SugarRestJSON->serve');
         return call_user_func_array(array($this->implementation, $method), $data);
     }
     // else
 }
Esempio n. 2
0
 function generateFaultResponse($errorObject)
 {
     $error = $errorObject->number . ': ' . $errorObject->name . '<br>' . $errorObject->description;
     $GLOBALS['log']->error($error);
     $json = getJSONObj();
     ob_clean();
     // JSONP support
     if (isset($_GET["jsoncallback"])) {
         echo $_GET["jsoncallback"] . "(";
     }
     echo $json->encode($errorObject);
     if (isset($_GET["jsoncallback"])) {
         echo ")";
     }
 }
Esempio n. 3
0
 * of this program must display Appropriate Legal Notices, as required under
 * Section 5 of the GNU Affero General Public License version 3.
 * 
 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
 * these Appropriate Legal Notices must retain the display of the "Powered by
 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
 * technical reasons, the Appropriate Legal Notices must display the words
 * "Powered by SugarCRM".
 ********************************************************************************/
/*********************************************************************************
 * Description:
 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. All Rights
 * Reserved. Contributor(s): ______________________________________..
 *********************************************************************************/
require_once "include/entryPoint.php";
$json = getJSONObj();
$out = "";
switch ($_REQUEST['adminAction']) {
    ///////////////////////////////////////////////////////////////////////////
    ////	REPAIRXSS
    case "refreshEstimate":
        include "include/modules.php";
        // provide $moduleList
        $target = $_REQUEST['bean'];
        $count = 0;
        $toRepair = array();
        if ($target == 'all') {
            $hide = array('Activities', 'Home', 'iFrames', 'Calendar', 'Dashboard');
            sort($moduleList);
            $options = array();
            foreach ($moduleList as $module) {
Esempio n. 4
0
 function generateFaultResponse($errorObject)
 {
     $error = $errorObject->number . ': ' . $errorObject->name . '<br>' . $errorObject->description;
     $GLOBALS['log']->error($error);
     $json = getJSONObj();
     ob_clean();
     echo $json->encode($errorObject);
 }
{
    $roleList = array("TOP", "JUNGLE", "MID", "BOT_AD", "BOT_SUPP");
    for ($i = 0; $i < 5; $i++) {
        $sorted_summoners[$i] = $blue_team[$roleList[$i]];
    }
    for ($i = 5; $i < 10; $i++) {
        $sorted_summoners[$i] = $purple_team[$roleList[$i - 5]];
    }
    return $sorted_summoners;
}
$summonerID = $_GET["summonerID"];
$champsFile = fopen("championInformation.txt", "r");
$fileContents = fread($champsFile, filesize("championInformation.txt"));
fclose($champsFile);
$championInfo = json_decode($fileContents, true);
$obj = getJSONObj('https://kr.api.pvp.net/observer-mode/rest/consumer/getSpectatorGameInfo/KR/' . $summonerID . '?api_key=***REDACTED***');
// If the API call was successful (the summoner is currently in a game) ...
if ($obj) {
    // Read the information about all of the summoners in that game, each summoner (10 total) becomes an
    //    element (object) in the $summoners array:
    $summoners = array($obj['participants'][0], $obj['participants'][1], $obj['participants'][2], $obj['participants'][3], $obj['participants'][4], $obj['participants'][5], $obj['participants'][6], $obj['participants'][7], $obj['participants'][8], $obj['participants'][9]);
    $blue_team = array($obj['participants'][0], $obj['participants'][1], $obj['participants'][2], $obj['participants'][3], $obj['participants'][4]);
    $purple_team = array($obj['participants'][5], $obj['participants'][6], $obj['participants'][7], $obj['participants'][8], $obj['participants'][9]);
    //for($i = 0; $i < 5; $i++){ echo $blue_team[$i]["summonerName"]; }
    $blue_team_roles = solveRoles($blue_team, $championInfo, $champions, $spells);
    $purple_team_roles = solveRoles($purple_team, $championInfo, $champions, $spells);
    // Get searched-Summoner's Name, Champion, Role, and Lane Opponent
    for ($i = 0; $i < 10; $i++) {
        if ((string) $summoners[$i]["summonerId"] == $summonerID) {
            $playerChamp = $champions[(string) $summoners[$i]['championId']];
            $playerTeam = (string) $summoners[$i]['teamId'];
Esempio n. 6
0
    $curl = curl_init();
    $options = [CURLOPT_SSL_VERIFYPEER => false, CURLOPT_RETURNTRANSFER => true, CURLOPT_URL => $url];
    curl_setopt_array($curl, $options);
    $JSONObj = json_decode(curl_exec($curl), true);
    curl_close($curl);
    return $JSONObj;
}
//SUPER KEY: 7a0b3555-7afc-4f9e-a412-20399bef78f5
$summoner_name = $_GET['summoner_name'];
//$summoner_name = $_POST['summoner_name'];
$friendlySummonerName = rawurlencode($summoner_name);
$summObj = getJSONObj('https://kr.api.pvp.net/api/lol/kr/v1.4/summoner/by-name/' . $friendlySummonerName . '?api_key=***REDACTED***');
$trimmedName = strtolower(str_replace(' ', '', $summoner_name));
$summID = (string) $summObj[$trimmedName]["id"];
$game_obj = getJSONObj('https://kr.api.pvp.net/api/lol/kr/v1.3/game/by-summoner/' . $summID . '/recent?api_key=***REDACTED***');
$summRankObj = getJSONObj('https://kr.api.pvp.net/api/lol/kr/v2.5/league/by-summoner/' . $summID . '/entry?api_key=***REDACTED***');
if ($summObj) {
    echo "<body>";
    echo "<center><table id=\"curGameTable1\"><tr><th><b>Date</b></th><th><b>Type</b></th><th><b>Champion</b></th><th><b>K/D/A</b></th><th><b>Gold</b></th><th><b>Result</b></th><th>Items</th><th></th><th><b>Duration</b></th></tr>";
    echo "<h1>";
    echo "<img src=\"profile_icons/" . $summObj[$trimmedName]['profileIconId'] . ".png\" border=\"0\" \tstyle=\"width:75px;height:75px;\">";
    echo "<span style=\"position:relative; bottom:28px; padding-left:10px;\">" . $summoner_name . "</span>";
    echo "</h1>";
    echo "<h3>";
    if ($summRankObj) {
        switch ($summRankObj[$summID][0]['tier'][0]) {
            case "B":
                echo "<img src=\"/tier_icons/bronze_badge.png\" style=\"width:60px;height:auto;\"> ";
                break;
            case "S":
                echo "<img src=\"/tier_icons/silver_badge.png\" style=\"width:60px;height:auto;\"> ";
Esempio n. 7
0
</form>
<hr><br>
</center>

<?php 
include 'championList.php';
include 'summonerSpells.php';
$summID = $_GET['summoner_name'];
$game = $_GET['game'];
$game_obj = getJSONObj('https://kr.api.pvp.net/api/lol/kr/v1.3/game/by-summoner/' . $summID . '/recent?api_key=***REDACTED***');
$matchID = $game_obj['games'][$game]['gameId'];
$matchObj = getJSONObj('https://kr.api.pvp.net/api/lol/kr/v2.2/match/' . $matchID . '?api_key=***REDACTED***');
$teamOneArray = array();
$teamTwoArray = array();
$summonerIDs = getSummonerIDs($game, $summID);
$summonerNamesObj = getJSONObj('https://kr.api.pvp.net/api/lol/kr/v1.4/summoner/' . $summonerIDs . '?api_key=***REDACTED***');
setTeamArrays($game);
echo "<center>";
echo "<h1>";
/*
if(!strcasecmp((string)$game_obj['games'][$game]['subType'], "RANKED_SOLO_5x5"))
		echo "RANKED 5v5";
	else if(!strcasecmp((string)$game_obj['games'][$game]['subType'], "NORMAL_3x3"))
		echo "NORMAL 3v3";
	else if(!strcasecmp((string)$game_obj['games'][$game]['subType'], "ARAM_UNRANKED_5x5"))
		echo "ARAM";
	else if(!strcasecmp((string)$game_obj['games'][$game]['subType'], "NORMAL"))
		echo "NORMAL 5v5";
	else if(!strcasecmp((string)$game_obj['games'][$game]['subType'], "CAP_5x5"))
		echo "TEAM BUILDER";
	else if(!strcasecmp((string)$game_obj['games'][$game]['subType'], "RANKED_TEAM_3x3"))
Esempio n. 8
0
    }
    echo "</div></center><br>";
    echo "<center><div id=\"specInstr1\"><b>Spectate Instructions</b><br>";
    echo "<br><div style=\"text-align:left;width:870px;\"><b>Windows</b>: Open the \"Run\" window by pressing '[Windows Key] + R', then paste in all of the following text:<br>";
    echo "<br><center><textarea readonly id=\"specRunTxt\">" . "\"C:\\Riot Games\\League of Legends\\RADS\\solutions\\lol_game_client_sln\\releases\\0.0.1.94\\deploy\\League of Legends.exe\" \"8394\" \"LoLLauncher.exe\" \"\" \"spectator spectator.na2.lol.riotgames.com:80 " . $FeatGames["gameList"][0]["observers"]["encryptionKey"] . " " . (string) $FeatGames["gameList"][0]["gameId"] . " " . "NA1\"" . "</textarea>";
    echo "<br><br><button id=\"closeInstrButton\"onclick=\"closeInstr1()\">Close</button>";
    echo "</center></div><br>";
    echo "</div></center>";
    echo "<center><div id=\"specInstr2\"><b>Spectate Instructions</b><br>";
    echo "<br><div style=\"text-align:left;width:870px;\"><b>Windows</b>: Open the \"Run\" window by pressing '[Windows Key] + R', then paste in all of the following text:<br>";
    echo "<br><center><textarea readonly id=\"specRunTxt\">" . "\"C:\\Riot Games\\League of Legends\\RADS\\solutions\\lol_game_client_sln\\releases\\0.0.1.94\\deploy\\League of Legends.exe\" \"8394\" \"LoLLauncher.exe\" \"\" \"spectator spectator.na2.lol.riotgames.com:80 " . $FeatGames["gameList"][1]["observers"]["encryptionKey"] . " " . (string) $FeatGames["gameList"][1]["gameId"] . " " . "NA1\"" . "</textarea>";
    echo "<br><br><button id=\"closeInstrButton\"onclick=\"closeInstr2()\">Close</button>";
    echo "</center></div><br>";
    echo "</div></center>";
}
$twitchStreams = getJSONObj('https://api.twitch.tv/kraken/streams?game=League+of+Legends');
if ($twitchStreams) {
    echo "<br><br><br><center><div id=\"imageContainer\"><img src=\"/BackgroundImageBro/featuredstreams1.png\" style=\"align:left;\"></div></center>";
    echo "<center><div id=\"sugItemsDiv\">";
    for ($j = 0; $j < 3; $j++) {
        $imgPreview = $twitchStreams["streams"][$j]["preview"]["small"];
        $channelURL = $twitchStreams["streams"][$j]["channel"]["url"];
        $channelName = $twitchStreams["streams"][$j]["channel"]["display_name"];
        if (strlen($channelName) > 14) {
            $channelName = substr($channelName, 0, 13) . "...";
        }
        $viewers = (string) $twitchStreams["streams"][$j]["viewers"];
        if ($j == 0) {
            $margin = "streamLeft";
        } else {
            $margin = "streamRight";