<?php

/*********************************
	Author: Corey Muniz
	Controller for the Admin Panel
	*********************************/
require_once "models/User.php";
require_once "models/db.php";
require_once "models/PasswordHash.php";
include_once "models/championList.php";
include_once "models/twitchModel.php";
$twitch = new twitch();
$champObj = new championList();
$champObj->generateChampionList();
usort($champObj->championList, make_comparer('name'));
session_start();
$user = new User();
if (isset($_SESSION['user'])) {
    $user = $_SESSION['user'];
} else {
    header("Location: loginCheckCtrl");
    die;
}
$guy = $user;
if ($_POST) {
    $sent = false;
    $twitchErr = false;
    $summonerErr = false;
    $passwordErr = false;
    if (isset($guy->id)) {
        if (isset($_POST['password']) && isset($_POST['password2'])) {
Example #2
0
<?php

/*********************************
	Author: Corey Muniz
	File for the proxy json fetches
	Might need to change this if it gets abused externally (in plain view of javascript)
	*********************************/
include_once "models/twitchModel.php";
include_once "models/User.php";
header('Content-type: application/json');
$twitch = new twitch();
session_start();
//Check if data is being requested
if ($_GET) {
    //If top is in the query string, give them the top 5 strings
    if (isset($_GET['top'])) {
        $topJson = $twitch->getTopStreams();
        echo json_encode($topJson);
    } else {
        if (isset($_GET['club'])) {
            require_once "config.php";
            $clubJson = $twitch->getUserStreams($config['twitchChannel']);
            echo json_encode($clubJson);
        } else {
            if (isset($_GET['channel'])) {
                $channelJson = $twitch->getChannel($_GET['channel']);
                echo json_encode($channelJson);
            } else {
                if (isset($_GET['user'])) {
                    //Make sure they are actually logged in
                    if (isset($_SESSION['user'])) {
<?php

require_once dirname(__FILE__) . '/class.getContents.php';
require_once dirname(__FILE__) . '/class.Mobile_Detect.php';
$twitch = new twitch();
$getContents = new getContents();
$Mobile_Detect = new Mobile_Detect();
if (!$twitch->isOnline() || $Mobile_Detect->isMobile()) {
    require dirname(__FILE__) . '/featureYoutube.inc.php';
} else {
    require dirname(__FILE__) . '/featureTwitch.inc.php';
}
// Were we suplied an action?  If not, set to false
$action = isset($_GET['action']) ? $_GET['action'] : false;
if (!$action) {
    echo 'false';
    // generic fail
    exit;
}
if (file_exists('./code_storage.php')) {
    $arr = file('./code_storage.php');
}
foreach ($arr as $row) {
    $split = explode(':', $row);
    $codes[$split[0]] = $split[1];
}
require './interface.php';
$interface = new twitch();
array_shift($codes);
if (array_key_exists($_GET['user'], $codes) == 1) {
    if ($action == 'follow') {
        $success = $interface->followChan($_GET['user'], $_GET['chan'], null, $codes[$_GET['user']]);
        if ($success) {
            echo 'true';
        } else {
            echo 'false';
        }
    } elseif ($action == 'unfollow') {
        $success = $interface->unfollowChan($_GET['user'], $_GET['chan'], null, $codes[$_GET['user']]);
        if ($success) {
            echo 'true';
        } else {
            echo 'false';