public function AddComment($user_id, $message)
 {
     $time = time();
     $message = DB::Escape($message);
     $query = DB::RunFastQuery("INSERT INTO cms_news_comments (user_id, news_id, value, timestanp) VALUES ('{$user_id}', '{$this->article_id}', '{$message}', '{$time}')");
     return $query->InsertId;
 }
 public function UnLike($user_id)
 {
     $like = $this->GetLike($user_id);
     if (!$like) {
         return;
     }
     $query = DB::RunFastQuery("DELETE FROM cms_news_comments_likes WHERE comment_id = '{$this->_commentid}' AND user_id = '{$user_id}'");
     //$this->FlushData();
 }
 public function AddVote($user_id, $positive)
 {
     if ($this->UserHasVoted($user_id)) {
         return;
     }
     $pos = $positive ? '1' : '0';
     DB::RunFastQuery("INSERT INTO cms_news_votes (news_id, user_id, positive) VALUES ('{$this->_articleid}', '{$user_id}', '{$pos}')");
     $this->FlushData();
 }
 public function __construct($userid)
 {
     $this->user_id = $userid;
     $this->friends = [];
     $query = DB::RunFastQuery("SELECT * FROM messenger_friendships WHERE user_one_id = '{$this->user_id}' OR user_two_id = '{$this->user_id}'");
     foreach ($query->Rows as $row) {
         $this->friends[] = new HabboFriendShipItem($this->user_id, $row);
     }
 }
Exemple #5
0
 public static function GetRoomsByOwnerName($name)
 {
     $array = [];
     $query = DB::RunFastQuery("SELECT * FROM rooms_data WHERE owner = '{$name}'");
     foreach ($query->Rows as $row) {
         $room = new Room($row);
         $array[] = $room;
         self::$Rooms[$room->id] = $room;
     }
     return new RoomCollection($array);
 }
 public static function GenerateUserById($id)
 {
     $id = DB::Escape($id);
     $query = DB::RunFastQuery("SELECT * FROM users WHERE id = '{$id}'");
     if ($query->NumRows() == 0) {
         return false;
     }
     $user = new HabboUser($query->UniqueRow()["id"], $query->UniqueRow());
     self::$cachedUsers[strtolower($user->username)] = $user;
     return $user;
 }
Exemple #7
0
 public static function GetLastNotice()
 {
     $query = DatabaseManager::RunFastQuery("SELECT * FROM cms_news ORDER BY id DESC LIMIT 1");
     $notice;
     $row = $query->UniqueRow();
     if (!$query) {
         $notice = new ArticleManager(0);
     } else {
         $notice = new ArticleManager($row);
     }
     return $notice;
 }
Exemple #8
0
 public static function GetCookie($name, $domain, $remote_addr)
 {
     $name = DB::Escape($name);
     $query = DB::RunFastQuery("SELECT * FROM cms_cookies WHERE name = '{$name}' AND http_host = '{$domain}' AND remote_addr = '{$remote_addr}'");
     if ($query->NumRows() == 0) {
         return false;
     }
     $cook = new CookieElement($query->UniqueRow());
     if (!self::ValidateCookie($cook)) {
         return false;
     }
     return $cook;
 }
Exemple #9
0
 public function GenerateNewTicket()
 {
     $t = $this->GetTicket();
     $this->auth_ticket = $t;
     DB::RunFastQuery("UPDATE users SET auth_ticket = '{$t}' WHERE id = '{$this->id}'");
 }
Exemple #10
0
ini_set("display_errors", "1");
ini_set("default_charset ", "utf-8");
date_default_timezone_set("America/Sao_Paulo");
spl_autoload_register(function ($class) {
    include_once '' . str_replace('\\', '/', $class . '.php');
});
#Setting Up Config
$Config = ["CMS_COOKIE_LOGIN_DURATION" => 3600, "CMS_COOKIE_LOGIN_NAME" => "CMS_LOGIN_USER", "WEB_URL" => "http://blob.dev", "HOTEL_NAME" => "Blob Hotel", "HOTEL_SHORT_NAME" => "Blob", "HOTEL_DESC" => "Crie seu blob, conheça pessoas e fique famoso!", "STAFF_MIN_RANK" => 5, "MUS_CONN_IP" => "127.0.0.1", "MUS_CONN_PORT" => 30008, "BADGES_IMG_URL" => "http://blob.dev/game/c_images/album1584", "HOST" => $_SERVER["SERVER_NAME"], "PORT" => "30000", "EXTENRAL_VARIABLES" => "http://blob.dev/game/gamedata/external_variables.txt", "EXTERNAL_TEXTS" => "http://blob.dev/game/gamedata/external_flash_texts.txt", "PRODUCTDATA" => "http://blob.dev/game/gamedata/productdata.txt", "FURNIDATA" => "http://blob.dev/game/gamedata/furnidata.xml", "HOTELVIEW_BANNER" => "http://blob.dev/game/gamedata/supersecret.php", "FLASH_CLIENT_URL" => "http://blob.dev/game/gordon/PRODUCTION-201506161211-776084490/", "HABBO_SWF" => "http://blob.dev/game/gordon/plus/habbo.swf", "C_IMAGES" => "http://blob.dev/game/c_images/", "SWF" => "http://blob.dev/game/", "SWFS_URL_BASE" => "http://blob.dev", "HK_URL" => "http://blobadmin.dev"];
foreach ($Config as $key => $val) {
    define($key, $val);
}
#Initializing Mysql
use api\Database\DatabaseManager as Database;
use api\Sockets\SocketManager as SM;
$Settings = ["mysql" => ["host" => "localhost", "user" => "root", "pass" => "", "database" => "ihab", "port" => "3306"]];
Database::Init($Settings["mysql"]);
### {{KEY}} System
function ReplaceKeysToValuesEvent($buffer)
{
    SM::CloseAllSockets();
    $matches = [];
    $definedvars = $GLOBALS;
    $string = $buffer;
    if (preg_match_all("/__(.*?)__/", $buffer, $matches)) {
        foreach ($matches[1] as $key => $val) {
            if (defined($val)) {
                $string = str_replace($matches[0][$key], sprintf('%s', constant($val)), $string);
            }
        }
    }
    if (preg_match_all('/\\[\\$(.*)\\]/', $buffer, $matches)) {
Exemple #11
0
$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[] =
		[
			"id" => $row["id"],
			"caption" => $row["caption"]
		];
}*/
$jsondata = ["user_data" => $userdata, "relationship" => $relations, "badges" => $badges, "rooms" => $rooms, "friendships" => $habbo->friendship->ToArray()];
echo json_encode($jsondata);