Esempio n. 1
0
    $bargainBin->files = sizeof(AddonManager::getBargain());
    $ret[] = $bargainBin;
    $bargainBin = new stdClass();
    $bargainBin->id = "-2";
    $bargainBin->special = "1";
    $bargainBin->name = "RTB Archive";
    $bargainBin->image = "bricks";
    $bargainBin->sub = "Special";
    $ret[] = $bargainBin;
    echo json_encode($ret, JSON_PRETTY_PRINT);
    return;
}
if ($request == "submitcomment") {
    $addonObject = AddonManager::getFromId($_REQUEST['id']);
    if (isset($_REQUEST['sid'])) {
        $apiManager = new ApiSessionManager($_REQUEST['sid']);
        if ($apiManager->isRemoteVerified() && $apiManager->isVerified()) {
            $current = $apiManager->getSiteAccount();
            (new Comment(array($_REQUEST['comment'], $current)))->toDatabase($addonObject->getId());
            (new NewCommentNotification(array($current->getId(), $addonObject->getId())))->toDatabase();
        }
    } else {
        $ret = new stdClass();
        $ret->status = "error";
        $ret->error = "Must be authed with Glass";
    }
}
if ($request == "board") {
    $boardId = $_GET['board'];
    $ret = array();
    if ($boardId < 0) {
Esempio n. 2
0
<?php

require_once dirname(__DIR__) . '/private/class/ApiSessionManager.php';
header('Content-Type: text/json');
if (isset($_REQUEST['sid'])) {
    $apiManager = new ApiSessionManager($_REQUEST['sid']);
} else {
    $apiManager = new ApiSessionManager("");
}
if (isset($_REQUEST['version'])) {
    $apiManager->setVersion($_REQUEST['version']);
}
$ret = new stdClass();
$ret->sid = session_id();
$request = @$_GET['request'];
if ($request == "checkauth") {
    if ($apiManager->attemptRemoteVerification($_GET['name'])) {
        $ret->status = "success";
        try {
            if (!$apiManager->isVerified()) {
                $ret->action = "verify";
                $ret->actiondata = new stdClass();
                $ret->actiondata->name = $apiManager->getSiteAccount()->getUsername();
                $ret->actiondata->blid = $apiManager->getBlid();
            } else {
                $ret->action = "none";
                $ret->hasGlassAccount = "1";
                //$ret->debugInfo = "verified";
            }
        } catch (Exception $e) {
            unset($ret->actiondata);