<?php

require_once '../FastInit.php';
//header("Content-Type: text/json");
use habbo\Session\HabboCookie as HC;
use habbo\Articles\ArticleManager as AM;
use api\Requests\Requests as Req;
use habbo\Users\HabboUserManager as Habbo;
$articleid = Req::Php("article_id");
$positive = Req::Php("positive");
$err = ["error" => true, "message" => "UNKOWN_ERROR"];
function goerror($str)
{
    die(json_encode(["error" => true, "message" => $str]));
}
if (!HC::HasSession()) {
    goerror("ERROR_SESSION_NOT_FOUND");
}
$session = json_decode(HC::GetSessionData()->value);
$habbo = Habbo::GetHabboByName($session->username);
if (!$habbo) {
    goerror("ERROR_SESSION_USER_NOT_FOUND");
}
if (!$articleid || !$positive) {
    goerror("ERROR_MISS_ARGS");
}
$article = AM::GetNotice($articleid);
if (!$article->Success) {
    goerror("ERROR_ARTICLE_NOT_FOUND");
}
$article->Vote->AddVote($habbo->id, $positive == "true");
示例#2
0
<?php

require_once "../FastInit.php";
header("Content-Type: text/json");
use api\Requests\Requests as Req;
use habbo\Articles\ArticleManager;
$article_id = Req::Php("article_id");
function goerror($s)
{
    die(json_encode(["error" => true, "message" => $s]));
}
if (!$article_id) {
    goerror("ERROR_MISS_ARGS");
}
$article = ArticleManager::GetNotice($article_id);
if (!$article->Success) {
    goerror("ERROR_ARTICLE_NOT_FOUND");
}
echo json_encode($article->ToArray());
示例#3
0
<?php

require_once "../FastInit.php";
header("Content-Type: text/json");
use api\Database\DatabaseManager as DB;
use habbo\Articles\ArticleManager;
//$query = DB::RunFastQuery("SELECT * FROM cms_news ORDER BY id DESC");
//echo '<pre>';
echo json_encode(ArticleManager::GetLastedNews(-1));