</div> <hr /> <div style="text-align:center"><img src="/img/rtb_logo.gif"></div> <hr /> <?php if ($addonData->glass_id == 0 || $addonData->approved != 1) { ?> <div style="text-align: center"> <?php $id = "RTB"; $class = "red"; echo '<a href="http://' . AWSFileManager::getBucket() . '/rtb/' . $addonData->filename . '" class="btn dlbtn ' . $class . '"><b>' . ucfirst($id) . '</b><span style="font-size:9pt"><br />Imported Archive</span></a>'; ?> </div> <?php } else { $addon = AddonManager::getFromId($addonData->glass_id); ?> <p style="text-align:center">This add-on has been imported to <a href="/addons/addon.php?id=<?php echo $addon->getId(); ?> "><?php echo $addon->getName(); ?> </a></p> <?php } ?> </div> <?php include realpath(dirname(__DIR__) . "/../private/footer.php");
public static function getRecentAddons($time = null) { if ($time == null) { $time = 60 * 24 * 7; } $db = new DatabaseManager(); $res = $db->query("SELECT `id` FROM `addon_addons` WHERE `uploadDate` > now() - INTERVAL " . $db->sanitize($time) . " MINUTE AND `approved`=1 ORDER BY `uploadDate` DESC"); echo $db->error(); $arr = array(); while ($obj = $res->fetch_object()) { $arr[] = AddonManager::getFromId($obj->id); } return $arr; }
<?php require_once realpath(dirname(__DIR__) . "/private/class/AddonManager.php"); require_once realpath(dirname(__DIR__) . "/private/class/StatManager.php"); $id = $_REQUEST['id']; $addonObject = AddonManager::getFromId($id); if ($addonObject) { StatManager::downloadAddon($addonObject); $branchId["stable"] = 1; $branchId["unstable"] = 2; $branchId["development"] = 3; if (isset($_REQUEST['branch'])) { $bid = $branchId[$_REQUEST['branch']]; } else { $bid = 1; } //StatManager::addStatsToAddon($addonObject->getId()); //header('Location: http://cdn.blocklandglass.com/builds/6.bls'); header('Location: http://cdn.blocklandglass.com/addons/' . $id . "_" . $bid); } else { header('Status: 404'); header('Location: /error.php'); }
<?php require_once dirname(__DIR__) . "/../private/class/AddonManager.php"; header('Content-Type: text/tml'); $addon = AddonManager::getFromId($_REQUEST['id']); if ($addon === false) { die("Error: add-on doesn't exist"); } $updates = AddonManager::getUpdates($addon); foreach ($updates as $up) { echo "<version:" . $up->getVersion() . ">\n"; echo $up->getChangeLog(); echo "\n</version>\n"; }
<?php require_once dirname(__DIR__) . "/private/class/GroupManager.php"; require_once dirname(__DIR__) . "/private/class/UserManager.php"; require_once dirname(__DIR__) . "/private/class/CronStatManager.php"; require_once dirname(__DIR__) . "/private/class/StatUsageManager.php"; $_PAGETITLE = "Blockland Glass | Add-On Stats"; include realpath(dirname(__DIR__) . "/private/header.php"); include realpath(dirname(__DIR__) . "/private/navigationbar.php"); $user = UserManager::getCurrent(); $addon = AddonManager::getFromId($_GET['id']); $csm = new CronStatManager(); //$data = $csm->getRecentAddonUsage($addon->getId()); $dist = StatUsageManager::getDistribution($addon->getId()); $downloadData = StatManager::getHourlyDownloads($addon->getId(), 24); $downloadData[date("Y-m-d H:i:s")] = StatManager::getStatistics($addon->getId()); ?> <div class="maincontainer"> <div class="tile"> <h2><a href="/addons/addon.php?id=<?php echo $addon->getId(); ?> "><?php echo $addon->getName(); ?> </a></h2>Statistics </div> <div class="tile" style="width: calc(50% - 40px); float:left; display: inline-block"> <b>Version Usage Chart</b> <hr /> <canvas id="myChart" style="width:100%;height:300px"></canvas>
<?php header('Content-Type: text/json'); require_once dirname(__DIR__) . "/../../../private/class/AddonManager.php"; require_once dirname(__DIR__) . "/../../../private/class/RTBAddonManager.php"; $recs = RTBAddonManager::getReclaims(); $arr = []; foreach ($recs as $rec) { $addon = AddonManager::getFromId($rec->glass_id); $obj = new stdClass(); $obj->id = $rec->id; $obj->glass_id = $addon->getId(); $obj->glass_name = $addon->getName(); $arr[] = $obj; } $ret = new stdClass(); $ret->addons = $arr; $ret->status = "success"; echo json_encode($ret, JSON_PRETTY_PRINT);
echo "<div style=\"padding: 5px; margin: 10px 10px; background-color: #eee; display:inline-block; width: 128px; vertical-align: middle\">"; echo "<a target=\"_blank\" href=\"/addons/screenshot.php?id=" . $sid . "\">"; echo "<img src=\"" . $ss->getThumbUrl() . "\" /></a>"; echo "</div>"; } ?> </div> <?php $deps = DependencyManager::getDependenciesFromAddonID($_GET['id']); if (sizeof($deps) > 0) { echo "<hr /><div style=\"text-align:center\">"; echo "<b>This add-on has some dependencies or add-ons that it requires to run:</b><br/><br/>"; foreach ($deps as $did) { $dep = DependencyManager::getFromId($did); $rid = $dep->getRequired(); $requiredAddon = AddonManager::getFromId($rid); echo "<div style=\"padding: 10px; background-color: #ffbbbb; display: inline-block; border-radius: 5px\"><a href=\"addon.php?id=" . $requiredAddon->getId() . "\">" . $requiredAddon->getName() . "</a></div>"; } echo "</div>"; } ?> <div class="tile"> <div class="comments" id="commentSection"> <form action="" method="post"> <?php include realpath(dirname(__DIR__) . "/ajax/getComments.php"); ?> </form> </div> </div> </div>
public static function getUnapproved() { $ret = array(); $db = new DatabaseManager(); $res = $db->query("SELECT `id` FROM `addon_addons` WHERE `approved`='0'"); while ($obj = $res->fetch_object()) { $ret[$obj->id] = AddonManager::getFromId($obj->id); } return $ret; }
$result->error = "Missing field: id"; die(json_encode($result, JSON_PRETTY_PRINT)); } $id = $_REQUEST['id']; if (!is_numeric($id) || $id < 1) { $result->status = "error"; $result->error = "Invalid field: id"; die(json_encode($result, JSON_PRETTY_PRINT)); } if (!isset($_REQUEST['file'])) { $result->status = "error"; $result->error = "Missing field: file"; die(json_encode($result, JSON_PRETTY_PRINT)); } $file = $_REQUEST['file']; $addon = AddonManager::getFromId($id); if ($addon === false) { $result->status = "error"; $result->error = "Failed to get AddonObject"; die(json_encode($result, JSON_PRETTY_PRINT)); } $filePath = dirname(__DIR__) . '/../addons/files/local/' . $addon->getId() . '.zip'; if (!is_file($filePath) || !is_readable($filePath)) { $result->status = "error"; $result->error = "Failed to find readable zip"; die(json_encode($result, JSON_PRETTY_PRINT)); } $zip = new ZipArchive(); $res = $zip->open($filePath); if ($res === TRUE) { $files = array();
<?php require_once realpath(dirname(__DIR__) . "/private/class/BoardManager.php"); require_once realpath(dirname(__DIR__) . "/private/class/AddonManager.php"); require_once realpath(dirname(__DIR__) . "/private/class/AddonObject.php"); require_once realpath(dirname(__DIR__) . "/private/class/UserManager.php"); require_once realpath(dirname(__DIR__) . "/private/class/UserLog.php"); // require_once(realpath(dirname(__DIR__) . "/private/class/UserHandler.php")); require_once realpath(dirname(__DIR__) . "/private/lib/Parsedown.php"); //to do: use ajax/json to build data for page //this php file should just format the data nicely if (isset($_GET['id'])) { try { $addonObject = AddonManager::getFromId($_GET['id'] + 0); $boardObject = BoardManager::getFromID($addonObject->getBoard()); } catch (Exception $e) { //board doesn't exist header('Location: /addons'); die("addon doesnt exist"); } } else { header('Location: /addons'); die; } if (!$addonObject->getApproved()) { include 'unapproved.php'; die; } $_PAGETITLE = "Blockland Glass | " . $addonObject->getName(); include realpath(dirname(__DIR__) . "/private/header.php"); include realpath(dirname(__DIR__) . "/private/navigationbar.php");
} if (!isset($_POST['submit'])) { $response = ["message" => "Upload a Screenshot"]; return $response; } if (!isset($_POST['csrftoken']) || $_POST['csrftoken'] != $_SESSION['csrftoken']) { $response = ["message" => "Cross site request forgery attempt blocked"]; return $response; } if (!isset($_FILES['uploadfile']['name']) || !$_FILES['uploadfile']['size']) { //if(!count($_FILES['uploads']['uploadfile'])) { $response = ["message" => "No file was selected to be uploaded"]; return $response; } $uploadExt = pathinfo($_FILES['uploadfile']['name'], PATHINFO_EXTENSION); $uploadExt = strtolower($uploadExt); if ($uploadExt != "png" && $uploadExt != "jpg") { $response = ["message" => "Only .png and .jpg screenshots are allowed"]; return $response; } require_once realpath(dirname(__DIR__) . "/class/ScreenshotManager.php"); if ($_FILES['uploadfile']['size'] > ScreenshotManager::$maxFileSize) { $response = ["message" => "File too large - The maximum build file size is 3 MB"]; return $response; } $tempPath = $_FILES['uploadfile']['tmp_name']; if ($_screenshotContext == "addon") { ScreenshotManager::uploadScreenshotForAddon(AddonManager::getFromId($_GET['id']), $uploadExt, $tempPath); } $response = ["message" => "idk"]; return $response;
width: 870px; font-size: 0.8em; } .diff td { font-size: 0.8em; width: 50%; vertical-align : top; white-space : pre; white-space : pre-wrap; font-family : monospace; } .diffDeleted { border: 1px solid rgb(255,192,192); background: rgb(255,224,224); } .diffInserted { border: 1px solid rgb(192,255,192); background: rgb(224,255,224); } </style> <?php require_once dirname(__DIR__) . '/class/AddonManager.php'; require_once dirname(__DIR__) . '/class/AddonUpdateObject.php'; $up = AddonManager::getUpdates(AddonManager::getFromId(4)); $up = $up[0]; $diff = $up->getDiff(); foreach ($diff['changes'] as $file => $table) { echo $file . "<br />" . $table . "<hr />"; }
} } ?> </div> </td> <td> <div class="tile"> <h2>My Content</h2> <div class="useraddon shadow-1" style="text-align:center; background-color: #ccffcc"> <img style="width: 1.2em;" src="http://blocklandglass.com/img/icons32/inbox_upload.png" alt="New"/> <a href="/addons/upload/upload.php">Upload New Add-On</a> </div> <?php $addons = AddonManager::getFromBLID($userObject->getBLID(), 0, 9999); foreach ($addons as $aid) { $ao = AddonManager::getFromId($aid); $board = $ao->getBoard(); $html = ""; if (!$ao->getApproved()) { $html = '<img style="width: 1.2em;" src="http://blocklandglass.com/img/icons32/hourglass.png" alt="Under Review"/> '; } ?> <div class="useraddon"> <?php echo $html; ?> <a href="/addons/addon.php?id=<?php echo $ao->getId(); ?> "><span style="font-size: 1.2em; font-weight:bold;"><?php echo $ao->getName();
require_once dirname(dirname(__DIR__)) . '/private/class/SemVer.php'; header('Content-Type: text/json'); $db = new DatabaseManager(); if (!isset($_GET['mods'])) { $ret = new stdClass(); $ret->status = "error"; $ret->error = "mods field is blank"; die(json_encode($ret, JSON_PRETTY_PRINT)); } $addonIds = explode("-", $db->sanitize($_GET['mods'])); $repo = new stdClass(); $repo->name = "Blockland Glass Generated Repo"; $ao = 'add-ons'; $repo->{$ao} = array(); foreach ($addonIds as $id) { $obj = AddonManager::getFromId($id); $webUrl = "api.blocklandglass.com"; $cdnUrl = "cdn.blocklandglass.com"; $addon = new stdClass(); $addon->name = $obj->getFilename(); $addon->description = str_replace("\r\n", "<br>", $obj->getDescription()); $channelId[1] = "stable"; $channelId[2] = "unstable"; $channelId[3] = "development"; foreach ($channelId as $cid => $name) { $channel = new stdClass(); $chanDat = $obj->getBranchInfo($cid); if ($chanDat !== false) { $channel->name = $channelId[$cid]; $channel->version = $chanDat->version; if ($chanDat->restart !== null && $chanDat->restart !== false) {
public function getAddon() { return AddonManager::getFromId($this->aid); }
} catch (Exception $e) { continue; } } echo json_encode($ret, JSON_PRETTY_PRINT); return; } if ($request == "comments") { $ret = array(); if (!isset($_GET['page'])) { $page = 0; } else { $page = $_GET['page']; } $start = $page * 10; $end = $start + 10; $addonObject = AddonManager::getFromId($_GET['aid']); $comments = $addonObject->getCommentsRange($start, $end); foreach ($comments as $comment) { $commento = new stdClass(); $commento->author = $comment->getAuthor()->getName(); $commento->authorblid = $comment->getAuthor()->getBlid(); $text = str_replace("\r\n", "<br>", $comment->getText()); $text = str_replace("\n", "<br>", $text); $commento->text = $text; $commento->date = date("F j, g:i a", strtotime($comment->getTime())); $ret[] = $commento; } echo json_encode($ret, JSON_PRETTY_PRINT); return; }
<?php require_once realpath(dirname(__FILE__) . "/private/header.php"); require_once realpath(dirname(__FILE__) . "/private/navigationbar.php"); require_once realpath(dirname(__FILE__) . "/private/class/AddonManager.php"); ?> <div class="maincontainer"> <p> <h2>Download</h2> In addition to offering add-on services online, Glass offers a variety of in-game features. You'll be able to automatically install your downloaded add-ons (as well as keep them up to date), be able to talk to other people playing Blockland and manage your servers' preferences. </p> <?php $glassAddonId = 11; //this needs to be changed before going live, or we need a "find addon by name" $id = "stable"; $class = "green"; $ao = AddonManager::getFromId($glassAddonId); $version = $ao->getVersion(); ?> <div style="text-align: center"> <?php echo '<a href="/addons/download.php?id=' . $glassAddonId . '&beta=0" class="btn dlbtn ' . $class . '"><b>' . ucfirst($id) . '</b><span style="font-size:9pt"><br />v' . $version . '</span></a>'; ?> </div> </div> <?php require_once realpath(dirname(__FILE__) . "/private/footer.php");
<?php require_once dirname(__DIR__) . "/../../../private/class/AddonManager.php"; $by = $_REQUEST['by']; $type = $_REQUEST['type']; $query = $_REQUEST['query']; if ($type == "addon") { if ($by == "name" || $by == "blid") { $res = AddonManager::searchAddons(array($by => $query)); } else { $ret = new stdClass(); $ret->status = "error"; $ret->error = "invalid search type"; die(json_encode($ret, JSON_PRETTY_PRINT)); } $ret = new stdClass(); $ret->results = array(); //$ret->count = ? foreach ($res as $result) { $r = new stdClass(); $addon = AddonManager::getFromId($result); $r->type = "addon"; $r->title = $addon->getName(); //$r->author $r->description = $addon->getDescription(); $ret->results[] = $r; } } else { //coming soon? } echo json_encode($ret, JSON_PRETTY_PRINT);
DependencyManager::addDependencyByID($_GET['id'], $_REQUEST['aid']); } else { if ($_REQUEST['action'] == "delete") { DependencyManager::removeDependencyByAddonID($_GET['id'], $_REQUEST['aid']); } } } $dep = DependencyManager::getDependenciesFromAddonID($_GET['id']); if (sizeof($dep) == 0) { $html = "<b>No Dependencies!</b>"; } else { $html = "<form action=\"\" method=\"post\"><input type=\"hidden\" name=\"action\" value=\"delete\" />"; $html .= "<table><tbody><tr><td colspan=\"2\"><b>Dependencies:</b></td></tr>"; foreach ($dep as $did) { $d = DependencyManager::getFromId($did); $html = $html . "<td>" . AddonManager::getFromId($d->getRequired())->getName() . "</td><td><button name=\"aid\" value=\"" . $d->getRequired() . "\">Delete</button></td></tr>"; } $html = $html . "</tbody></table></form>"; } echo $html; ?> <hr /> Add: <input type="text" id="addon" /> <form method="post" action=""> <input type="hidden" name="action" value="add" /> <div id="options"> </div> </form> <script type="text/javascript">