Esempio n. 1
0
 public static function TryStartSession($username, $password)
 {
     if (!($habbo = Habbo::GetHabboByName($username))) {
         return "Error #1";
         //User not exists
     }
     if (!Habbo::CheckAuth($habbo, $password)) {
         return "Error #2";
         //Wrong Pass
     }
     CookieManager::SetCookie(CMS_COOKIE_LOGIN_NAME, json_encode(["username" => $username, "password" => $password]), 'json', time() + CMS_COOKIE_LOGIN_DURATION, Loc::GetHTTPHost(), Loc::GetMyIP());
 }
Esempio n. 2
0
 public function __construct($datatable)
 {
     if (!$datatable || !is_array($datatable)) {
         $this->Success = false;
         return;
     }
     $this->id = $datatable["id"];
     $this->Article = new ArticleItemObject($datatable);
     $this->Comments = new ArticleCommentManager($datatable["id"]);
     $this->Success = true;
     $this->Vote = new ArticleLikesManager($this->id);
     $this->Author = UserManager::GetHabboById($datatable["author"]);
 }
 public function ToArray()
 {
     $users = [];
     foreach ($this->Likes as $like) {
         $user = Habbo::GetHabboById($like->user_id);
         if (!$user) {
             continue;
         }
         $users[] = ["username" => $user->username, "look" => $user->look];
     }
     $arr = ["count" => $this->Count(), "users" => $users];
     return $arr;
 }
<?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");
Esempio n. 5
0
<?php

//FIXAR ISSO URGENTEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE//
//session_start();
require_once "../library/Init.php";
use Database\DatabaseManager as DB;
use habbo\Session\HabboCookie as Session;
use habbo\Users\HabboUserManager as Habbo;
if (!Session::HasSession()) {
    die("");
}
$usercookie = json_decode(Session::GetSessionData()->value);
$user = Habbo::GetHabboByName($usercookie->username);
$user->GenerateNewTicket();
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta http-Equiv="Cache-Control" Content="no-cache" />
    <meta http-Equiv="Pragma" Content="no-cache" />
    <meta http-Equiv="Expires" Content="0" />
	<script type="text/javascript">
		var andSoItBegins = (new Date()).getTime();
	</script>
	<link rel="shortcut icon" href="<?php 
echo WEB_URL;
?>
/web-gallery/v2/images/favicon.ico" type="image/vnd.microsoft.icon" />

	<script src="<?php 
echo WEB_URL;
Esempio n. 6
0
if (!Arr::ContainsAll(Requests::$PhpInput, ["username", "password"])) {
    $userdata["error"] = true;
    $userdata["message"] = "Preencha com Nome e Senha!";
    goto end;
}
$username = Requests::Php("username");
$password = Requests::Php("password");
$user = Habbo::GetHabboByName($username);
if (!$user) {
    $userdata["error"] = true;
    $userdata["message"] = "Este usuário não existe!";
    goto end;
}
if (!Arr::ContainsAll(Requests::$PhpInput, ["username", "password"])) {
    $userdata["error"] = true;
    $userdata["message"] = "Preencha com Nome e Senha!";
    goto end;
}
if (!Habbo::CheckAuth($user, $password)) {
    $userdata["error"] = true;
    $userdata["message"] = "Senha Incorreta!";
    goto end;
}
CM::TryStartSession($username, $password);
$sessiondata = CM::GetSessionData();
$userdata["error"] = false;
$userdata["message"] = "";
$userdata["userdata"] = $user->PrivateInfo();
$userdata["cookie_data"] = ["expire" => $sessiondata->expire, "now" => time(), "reaming_time" => $sessiondata->expire - time()];
end:
echo json_encode($userdata);
Esempio n. 7
0
 public function GetHabbo()
 {
     return Habbo::GetHabboById($this->user_id);
 }
Esempio n. 8
0
 public function GetHabbo()
 {
     return Habbo::GetHabboById($this->userbase_id == $this->user_one_id ? $this->user_two_id : $this->user_one_id);
 }
Esempio n. 9
0
<?php

require_once '../FastInit.php';
use habbo\Session\HabboCookie as C;
use habbo\Users\HabboUserManager as Habbo;
header("Content-Type: text/json");
$sessiondata = null;
$userdata = null;
if (C::HasSession()) {
    $sessiondata = C::GetSessionData();
    $userdata = json_decode($sessiondata->value);
}
$data = ["has_session" => C::HasSession(), "userdata" => null, "cookie_data" => null];
if (C::HasSession()) {
    if ($habbo = Habbo::GetHabboByName($userdata->username)) {
        if (Habbo::CheckAuth($habbo, $userdata->password)) {
            $data["userdata"] = $habbo->PrivateInfo();
            $data["cookie_data"] = ["expire" => $sessiondata->expire, "now" => time(), "reaming_time" => $sessiondata->expire - time()];
        }
    }
}
echo json_encode($data);
Esempio n. 10
0
    $habbo = Habbo::GetHabboByName($username);
} else {
    $habbo = Habbo::GetHabboById($userid);
}
if (!$habbo) {
    do_error("USER_NOT_FOUND");
}
$jsondata = [];
$userdata = ["username" => $habbo->username, "motto" => $habbo->motto, "look" => $habbo->look, "last_online" => $habbo->last_online, "account_created" => $habbo->account_created, "seasonal_currency" => $habbo->seasonal_currency, "credits" => $habbo->credits, "activity_points" => $habbo->activity_points];
$relations = [];
$badges = [];
$rooms = Rooms::GetRoomsByOwnerName($habbo->username)->ParseToPublicArray();
### Get RelatioShips
$query = DB::RunFastQuery("SELECT * FROM users_relationships WHERE user_id = '{$habbo->id}'");
foreach ($query->Rows as $row) {
    $ruser = Habbo::GetHabboById($row["target"]);
    if (!$ruser) {
        continue;
    }
    $relations[$row["type"]][] = ["username" => $ruser->username, "look" => $ruser->look, "motto" => $ruser->motto];
}
### Get Badges
$query = DB::RunFastQuery("SELECT * FROM users_badges WHERE user_id = '{$habbo->id}'");
foreach ($query->Rows as $bad) {
    $badges[] = $bad["badge_id"];
}
##Get Rooms
/*$query = DB::RunFastQuery("SELECT * FROM rooms_data WHERE owner = '$habbo->username'");
foreach($query->Rows as $row)
{
	$rooms[] =
Esempio n. 11
0
         $comment->Likes->UnLike($habbo->id);
     }
     break;
 case 'delete':
     $error = ["message" => ""];
     if ($comment_id == "" || $article_id == "" || !C::HasSession()) {
         $error["message"] = "Missing data!";
         goto _break;
     }
     $article = ArticleManager::GetNotice($article_id);
     if (!$article->Success) {
         $error["message"] = "Article not found!";
         goto _break;
     }
     $userdata = json_decode(C::GetSessionData()->value);
     $habbo = Habbo::GetHabboByName($userdata->username);
     if (!$habbo) {
         $error["message"] = "No session!";
         goto _break;
     }
     $comment = $article->Comments->GetComment($comment_id);
     if (!$comment) {
         $error["message"] = "Comment not found!";
         goto _break;
     }
     if ($comment->user_id != $habbo->id && $habbo->rank < STAFF_MIN_RANK) {
         $error["message"] = "No Rights to delete this comment!";
         goto _break;
     }
     $article->Comments->DeleteComment($comment_id);
     _break: