function printNav($activeTab = "", $isFluid = false) { global $SITE_TITLE; $activeStr = ' class="active"'; ?> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> <div class="container<?php if ($isFluid) { echo "-fluid"; } ?> "> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/"> <span class="pull-left"> <!-- <img alt="Coebot" src="/img/coebot-icon.png"> --> <?php echo $SITE_TITLE; ?> <sub class="text-muted"> beta</sub> </span> </a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-left"> <li<?php if ($activeTab == "channels") { echo $activeStr; } ?> ><a href="/channels">Channels</a></li> <li<?php if ($activeTab == "commands") { echo $activeStr; } ?> ><a href="/commands">Commands</a></li> <li<?php if ($activeTab == "help") { echo $activeStr; } ?> ><a href="/help">Help</a></li> <?php if (isCookieTrue("cookiemanShortcut")) { ?> <li<?php if ($activeTab == "cookieman") { echo $activeStr; } ?> ><a href="/cookieman" title="Cookie Manager" id="cookieMonsterLink"><img src="/img/cookiemonster.png" height="21" width="24"><span class="visible-xs-inline"> Cookie Manager</span></a></li> <?php } ?> </ul> <?php if (isLoggedIn()) { ?> <ul class="nav navbar-nav navbar-right"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="icon-user"></i> <?php echo $_SESSION['channel']; ?> <span class="caret"></span></a> <ul class="dropdown-menu" role="menu"> <li><a href="<?php echo getUrlToChannel($_SESSION['channel']); ?> ">Channel</a></li> <li><a href="/settings">Settings</a></li> <li><a href="/logout">Log out</a></li> </ul> </li> </ul> <?php } else { ?> <ul class="nav navbar-nav navbar-right"> <li> <a href="<?php echo getSignInUrl(); ?> ">Log in <i class="icon-login"></i></a> </li> </ul> <?php } ?> </div> </div> </nav> <?php }
$code = $_GET['code']; $loginResult = twitchGetAccessToken($code); if (!$loginResult) { die("Twitch is down, or authentication failed for some other reason."); } $twitchAccessToken = $loginResult->access_token; $userData = twitchGetUser($twitchAccessToken); if (!$userData) { die("Twitch is down, or user retrieval failed for some other reason."); } $uid = dbSetUser($userData->name, true, $twitchAccessToken); if ($uid === false) { throw500("Database error, contact site administrator"); } logUserIn($userData->name, $uid); header('Location: ' . getUrlToChannel($_SESSION['channel'])); $_SESSION['showLoggedIn'] = true; die('logged in'); /* printHead("Logged in"); printNav(); ?> <div class="container"> <div class="row"> <div class="col-md-12"> <h2>Welcome <?php echo $_SESSION['channel']; ?>!</h2> <p class="lead">This is still super buggy and new and doesn't do much yet. I'm working on it!!</p> </div> </div> </div> <?php
throw400("That channel is already joined by " . $channelCoebotData['botChannel'] . "! Only one instance of CoeBot can be in a channel at a time."); } $botSession = BotSession::getBotSessionCurrentUser($bot, $channel); $botSession->doJoin(); $botSession->finalize(); header('refresh: 3;url=' . getUrlToChannel($channel)); printHead("Processing..."); printNav('', true); ?> <div class="container"> <div class="row"> <div class="col-sm-8 col-sm-offset-2"> <h3><span class="loading-generic"><i></i> Join request sent to bot...</span></h3> <p class="lead"><a href="<?php echo getUrlToChannel($channel); ?> ">If you are not redirected after 3 seconds, click here.</a></p> </div> </div> </div> <?php printFooter(); printFoot(); die; } else { if ($action == "part") { $channel = getChannelWithAuthOrDie($USER_ACCESS_LEVEL_OWNER); $channelCoebotData = dbGetChannel($channel); if ($channelCoebotData['isActive'] == false) {