[Habbox CMS] - [WORKS ON ALL EMU's] - [OWN FRAMEOWRK]

Status
Not open for further replies.

Raizer

New Member
Messages
19
Likes
14
#1
Hi all,

A few months ago i started developing with a new Habbo CMS because most the currently released CMS are deprecated and extremely bad programmed. So years ago when Habbo was in the middle phase (2010-2012) I always immersed myself in retro's, I started with Marks V3 and Debbo, i think that someone can remeber these kind of servers. But, I thought it would be nice to create a new CMS based on Plusemu, Comet and Arcturus. This way you can indicate which emulator you want to use during the installation. HabbocCMS is fully programmed on oop pdo mvc so that everything is nicely structured.

HabCMS becomes a CMS that is fully written in php mvc. This will run on a proprietary framework that I have made over the years. Of course vendors can be added because I it's a composer project that work with autoloading psr-4. Habbox can be used on webhosting/xampp and IIS . I hope to finish the project somewhere in the middle of April for free.. I am very open to reactions, feedback and of course ideas from you.

You can also see the progress of Habbox at our hotel betahotel.nl

Features of Habbox CMS:

* Habbox is based on widgets, so you can indicate per page what you want to see
* I build a nice shop and forum in our cms with nice features
* Habbox use twig as a template parser
* Feed system, like a kind of twitter (more about this later).
* Transactions, get daily gifts and do transactions to other users

HTML:
    {% for key, value in widgets %}
        {% if key == object %}
          {% set page = key %}
          {% for template in value %}
            {% include "Widgets/" ~ template ~ ".html" ignore missing %}
          {% endfor %}
       {% endif %}
    {% endfor %}
* And more many more features!

Login.php
PHP:
<?php
namespace App\Controllers;

use \Core\View;
use \Core\Emu;

use \Libaries\Json;

use \App\Auth;
use \App\Token;
use \App\Config;
use \App\Flash;

use \App\Models\User;
use \App\Models\Core;

class Login extends \Core\Controller
{
    public function __construct()
    {
        $this->alreadyLoggedIn();
        $this->load()->libaries('validate');
    }

    public function newAction()
    {
        View::renderTemplate('Index/login.html');
    }

    public function validateTokenAction()
    {
        $this->alreadyLoggedIn();
        /**
         * Retrieve values from the requested page
         * Class: Core\Request.php
         */
      
        $pin = $this->request->input('pin');
        $tokenid = $this->request->input('tokenid');
      
        /**
         * When the user try to login and has a higher rank, he / she must enter a pin
         * Class: App\Models\User.php, App\Auth.php
         */
          
        if(Auth::loginAttempt()){
            if($tokenid){
                $token = User::tokenAuth($tokenid);

                if($token->pin == $pin || $token->pin == null){
                    $this->loginUser($token);
                }else{
                    $this->securitypin($token); 
                }
                exit;
            }
        }else{
            Flash::addMessage('Te vaak foutief pincode ingevoerd, gebruiker ontvangt een melding.', FLASH::ERROR);
            $this->newAction();
        }
    }
  
    public function doAction()
    {
      
        $this->alreadyLoggedIn();
        /**
         * Retrieve values from the requested page
         * Class: Core\Request.php
         */
    
        $username = $this->request->input('username');
        $password = $this->request->input('password');
        $remember_me = $this->request->input('remember_me');
  
        /**
         * Check if given values are correcting in accordance with the validation requirements
         * Class: Libaries\Validate.php
         */

        $this->validate->name(Config::get('sitename') . 'naam')->value($username)->required();
        $this->validate->name('Wachtwoord')->value($password)->required();

         /**
         * First we check users validation. After that we check if the entered user enters his login data correctly
         * Class: Core\Request.php, Libaries\Validate.php, App\Models\User.php
         */

        if ($this->request->all()){
            if ($this->validate->isSuccess()){
                $user = User::Authenticate($username, $password);
                if ($user) {
                    if(Auth::login($user)){
                      $this->securitypin($user);
                    }else{
                      $this->redirect('/');
                    }
                }else{
                    Flash::addMessage('Inloggegevens onjuist ingevoerd', FLASH::ERROR);
                    $this->redirect('/login');
                }
            }else{
                View::renderTemplate('Index/login.html', [
                  'errors' => $this->validate->getErrors() ,
                  'username' => $username,
                  'remember_me' => $remember_me
                ]);
            }
        }else{
            $this->newAction();
        }
          
    }
  
    public function securitypin($user)
    { 
        $user->token = Token::addToken();
        $token = User::updateToken($user->token, $user->id);
      
        if(Core::getData('cms_user_settings', 'pin', 'user_id', $user->id) != NULL){
            if($token){
                Flash::addMessage('Voer je pincode in om door te gaan!', 'warning');
                View::renderTemplate('Index/securitypin.html', [
                    'token' => $user->token
                ]);
            }
        }
        else
        {
            Flash::addMessage('Je hebt nog geen pin ingesteld! Stel deze snel in bij instellingen om te voorkomen dat je account wordt overgenomen door derden!', 'warning-hide');
            $this->loginUser($user);
        }
    }

    public function loginUser($user)
    {
        if($user){
            Auth::login($user);
            Flash::addMessage('Welkom ' . $user->username . '!');
        
            if(User::giveUserPresent())
            {
                Flash::addMessage('Je hebt een cadeau gekregen! Bekijk hem tussen bij transacties op jouw account', FLASH::SUCCESS);
            } 
        
            $this->redirect(Auth::getReturnToPage());
        }else{
            $this->redirect('/');
        }
    }

    public function userLookAction()
    {
        if ($this->request->all()){
            $user = $this->request->input('post');
            $look = Core::getData(Emu::Get('tablename.Users'), Emu::Get('table.Users.look', 'look'), Emu::Get('table.Users.username', 'username'), $user);
            if($look)
            {
                echo Json::encode(array('look' => $look, 'status' => 'success'));
            }
        }
    }
}
Auth.php
PHP:
<?php
namespace App;

use \Core\Emu;
use \App\Config;
use \App\Models\User;
use \App\Models\Core;
use \App\Models\RememberedLogin;

class Auth {

    /**
    * Login the user
    *
    * @param User $user The user model
    * @param boolean $remember_me Remember the login if true
    *
    * @return void
    */

    public static function login(User $user, $token = null)
    {
        $ban = Core::getBans($user->username, $_SERVER['HTTP_X_FORWARDED_FOR']);
      
        if(!$ban)
        {
            session_regenerate_id(true);
            $_SESSION['user_id'] = $user->id; 
        
            User::updateUser($user->id, Emu::Get('table.Users.last_login'), time());
            User::updateUser($user->id, Emu::Get('table.Users.ip_current'), $_SERVER['HTTP_X_FORWARDED_FOR']);
            return true;
        }
        else
        {
            Flash::addMessage('Je bent verbannen met als reden: ' . $ban->reason, FLASH::WARNING);
            return false;
        }
    }

    /**
    * Logout the user
    *
    * @return void
    */
    public static function logout()
    {
        $_SESSION = [];

        if (ini_get('session.use_cookies')){
            $params = session_get_cookie_params();

            setcookie(
                session_name(),
                '',
                time(),
                $params['path'],
                $params['domain'],
                $params['secure'],
                $params['httponly']
            );
        }

        if (!isset($_SESSION))
        {
            session_destroy();
            static::forgetLogin();
        }
    }

    public static function loginAttempt()
    {
        //* will be added soon
        return true;
    }
  
    /**
    * Remember the originally-requested page in the session
    *
    * @return void
    */
  
    public static function rememberRequestedPage()
    {
        $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
    }

    public static function returnRequestedPage()
    {
        return $_SESSION['return_to'];
    }

    /**
    * Get the originally-requested page to return to after requiring login, or default to the homepage
    *
    * @return void
    */
  
    public static function getReturnToPage()
    {
        return $_SESSION['return_to'] ?? '/';
    }

    /**
    * Get the current logged-in user, from the session or the remember-me cookie
    *
    * @retur
    n mixed The user model or null if not logged in
    */
    public static function getUser()
    {
        if(isset($_SESSION['user_id'])){
            return (new User())->FindById($_SESSION['user_id']);
        }else{
            return static::loginFromRememberCookie();
        }
    }

    public static function returnUserId()
    {
        if(isset($_SESSION['user_id'])){
            $user = self::getUser();
            return $user->id;
        }
    }

    public static function isBanned(){
        if(isset($_SESSION['user_id'])){
            return User::isUserBanned($_SESSION['user_id']);
        }
    }


    /**
    * Login the user from a remembered login cookie
    *
    * @return mixed The user model if login cookie found; null otherwise
    */
  
    protected static function loginFromRememberCookie()
    {
    $cookie = $_COOKIE['remember_me'] ?? false;
    if($cookie){
        $rememberedLogin = (new RememberedLogin())->findByToken($cookie);
        if($rememberedLogin && ! $rememberedLogin->hasExpired()){
            $user = $rememberedLogin->getUser();
            static::login($user, false);
            return $user;
        }
    }
    }

    /**
    * Check if the remembered cookie is expired.
    *
    * @return mixed When expired logoff automaticly the user
    */
  
    protected static function forgetLogin()
    {
        $cookie =  $_COOKIE['remember_me'] ?? false;
        if($cookie){
            $rememberedLogin = (new RememberedLogin())->findByToken($cookie);
            if($rememberedLogin){
                $rememberedLogin->delete();
            }
            setcookie("remember_me", '', time() - 3600);
        }
    }

    /**
    * Get user latest activity from a session
    *
    * @return mixed Log off the user when the session is expired
    */
  
    public static function userInactivity()
    {
        $userInactivity = Config::get('userinactivity');
        if (!isset($_SESSION['LastActivity'])) {
            $_SESSION['LastActivity'] = time();
        }else{
            $InactiveTime = time() - $_SESSION['LastActivity'];     
            if ($InactiveTime >= $userInactivity) {
                static::logout();
            }else if ($InactiveTime < $userInactivity) {
                $_SESSION['LastActivity'] = time();
            } 
        }
    }
}
?>
Router.php
PHP:
<?php
namespace Core;

class Router
{

    protected $routes = [];
    protected $params = [];

    public function add($route, $params = [])
    {
        $route = preg_replace('/\//', '\\/', $route);
        $route = preg_replace('/\{([a-z]+)\}/', '(?P<\1>[a-z-]+)', $route);
        $route = preg_replace('/\{([a-z]+):([^\}]+)\}/', '(?P<\1>\2)', $route);
        $route = '/^' . $route . '$/i';
        $this->routes[$route] = $params;
    }

    public function getRoutes()
    {
        return $this->routes;
    }

    public function match($url)
    {
        foreach ($this->routes as $route => $params) {
            if (preg_match($route, $url, $matches)) {
                foreach ($matches as $key => $match) {
                    if (is_string($key)) {
                        $params[$key] = $match;
                    }
                }

                $this->params = $params;
                return true;
            }
        }

        return false;
    }

    public function getParams()
    {
        return $this->params;
    }

Naamloos.png

Naamloos.png

Naamloos.png


Naamloos.png Naamloos.png
 
Last edited:
Messages
636
Likes
269
#2
Hi all,

A few months ago i started developing with a new Habbo CMS because most the currently released CMS are deprecated and extremely bad programmed. So years ago when Habbo was in the middle phase (2010-2012) I always immersed myself in retro's, I started with Marks V3 and Debbo, i think that someone can remeber these kind of servers. But, I thought it would be nice to create a new CMS based on Plusemu, Comet and Arcturus. This way you can indicate which emulator you want to use during the installation. HabbocCMS is fully programmed on oop pdo mvc so that everything is nicely structured.

HabCMS becomes a CMS that is fully written in php mvc. This will run on a proprietary framework that I have made over the years. Of course vendors can be added because I it's a composer project that work with autoloading psr-4. Habbox can be used on webhosting/xampp and IIS . I hope to finish the project somewhere in the middle of April for free.. I am very open to reactions, feedback and of course ideas from you.

You can also see the progress of Habbox at our hotel betahotel.nl

Features of Habbox CMS:

* Habbox is based on widgets, so you can indicate per page what you want to see
* I build a nice shop and forum in our cms with nice features
* Habbox use twig as a template parser

HTML:
    {% for key, value in widgets %}
        {% if key == object %}
          {% set page = key %}
          {% for template in value %}
            {% include "Widgets/" ~ template ~ ".html" ignore missing %}
          {% endfor %}
       {% endif %}
    {% endfor %}
* And more many more features!

Login.php
PHP:
<?php
namespace App\Controllers;

use \Core\View;
use \Core\Emu;

use \Libaries\Json;

use \App\Auth;
use \App\Token;
use \App\Config;
use \App\Flash;

use \App\Models\User;
use \App\Models\Core;

class Login extends \Core\Controller
{
    public function __construct()
    {
        $this->alreadyLoggedIn();
        $this->load()->libaries('validate');
    }

    public function newAction()
    {
        View::renderTemplate('Index/login.html');
    }

    public function validateTokenAction()
    {
        $this->alreadyLoggedIn();
        /**
         * Retrieve values from the requested page
         * Class: Core\Request.php
         */
      
        $pin = $this->request->input('pin');
        $tokenid = $this->request->input('tokenid');
      
        /**
         * When the user try to login and has a higher rank, he / she must enter a pin
         * Class: App\Models\User.php, App\Auth.php
         */
          
        if(Auth::loginAttempt()){
            if($tokenid){
                $token = User::tokenAuth($tokenid);

                if($token->pin == $pin || $token->pin == null){
                    $this->loginUser($token);
                }else{
                    $this->securitypin($token); 
                }
                exit;
            }
        }else{
            Flash::addMessage('Te vaak foutief pincode ingevoerd, gebruiker ontvangt een melding.', FLASH::ERROR);
            $this->newAction();
        }
    }
  
    public function doAction()
    {
      
        $this->alreadyLoggedIn();
        /**
         * Retrieve values from the requested page
         * Class: Core\Request.php
         */
    
        $username = $this->request->input('username');
        $password = $this->request->input('password');
        $remember_me = $this->request->input('remember_me');
  
        /**
         * Check if given values are correcting in accordance with the validation requirements
         * Class: Libaries\Validate.php
         */

        $this->validate->name(Config::get('sitename') . 'naam')->value($username)->required();
        $this->validate->name('Wachtwoord')->value($password)->required();

         /**
         * First we check users validation. After that we check if the entered user enters his login data correctly
         * Class: Core\Request.php, Libaries\Validate.php, App\Models\User.php
         */

        if ($this->request->all()){
            if ($this->validate->isSuccess()){
                $user = User::Authenticate($username, $password);
                if ($user) {
                    if(Auth::login($user)){
                      $this->securitypin($user);
                    }else{
                      $this->redirect('/');
                    }
                }else{
                    Flash::addMessage('Inloggegevens onjuist ingevoerd', FLASH::ERROR);
                    $this->redirect('/login');
                }
            }else{
                View::renderTemplate('Index/login.html', [
                  'errors' => $this->validate->getErrors() ,
                  'username' => $username,
                  'remember_me' => $remember_me
                ]);
            }
        }else{
            $this->newAction();
        }
          
    }
  
    public function securitypin($user)
    { 
        $user->token = Token::addToken();
        $token = User::updateToken($user->token, $user->id);
      
        if(Core::getData('cms_user_settings', 'pin', 'user_id', $user->id) != NULL){
            if($token){
                Flash::addMessage('Voer je pincode in om door te gaan!', 'warning');
                View::renderTemplate('Index/securitypin.html', [
                    'token' => $user->token
                ]);
            }
        }
        else
        {
            Flash::addMessage('Je hebt nog geen pin ingesteld! Stel deze snel in bij instellingen om te voorkomen dat je account wordt overgenomen door derden!', 'warning-hide');
            $this->loginUser($user);
        }
    }

    public function loginUser($user)
    {
        if($user){
            Auth::login($user);
            Flash::addMessage('Welkom ' . $user->username . '!');
        
            if(User::giveUserPresent())
            {
                Flash::addMessage('Je hebt een cadeau gekregen! Bekijk hem tussen bij transacties op jouw account', FLASH::SUCCESS);
            } 
        
            $this->redirect(Auth::getReturnToPage());
        }else{
            $this->redirect('/');
        }
    }

    public function userLookAction()
    {
        if ($this->request->all()){
            $user = $this->request->input('post');
            $look = Core::getData(Emu::Get('tablename.Users'), Emu::Get('table.Users.look', 'look'), Emu::Get('table.Users.username', 'username'), $user);
            if($look)
            {
                echo Json::encode(array('look' => $look, 'status' => 'success'));
            }
        }
    }
}
Auth.php
PHP:
<?php
namespace App;

use \Core\Emu;
use \App\Config;
use \App\Models\User;
use \App\Models\Core;
use \App\Models\RememberedLogin;

class Auth {

    /**
    * Login the user
    *
    * @param User $user The user model
    * @param boolean $remember_me Remember the login if true
    *
    * @return void
    */

    public static function login(User $user, $token = null)
    {
        $ban = Core::getBans($user->username, $_SERVER['HTTP_X_FORWARDED_FOR']);
      
        if(!$ban)
        {
            session_regenerate_id(true);
            $_SESSION['user_id'] = $user->id; 
        
            User::updateUser($user->id, Emu::Get('table.Users.last_login'), time());
            User::updateUser($user->id, Emu::Get('table.Users.ip_current'), $_SERVER['HTTP_X_FORWARDED_FOR']);
            return true;
        }
        else
        {
            Flash::addMessage('Je bent verbannen met als reden: ' . $ban->reason, FLASH::WARNING);
            return false;
        }
    }

    /**
    * Logout the user
    *
    * @return void
    */
    public static function logout()
    {
        $_SESSION = [];

        if (ini_get('session.use_cookies')){
            $params = session_get_cookie_params();

            setcookie(
                session_name(),
                '',
                time(),
                $params['path'],
                $params['domain'],
                $params['secure'],
                $params['httponly']
            );
        }

        if (!isset($_SESSION))
        {
            session_destroy();
            static::forgetLogin();
        }
    }

    public static function loginAttempt()
    {
        //* will be added soon
        return true;
    }
  
    /**
    * Remember the originally-requested page in the session
    *
    * @return void
    */
  
    public static function rememberRequestedPage()
    {
        $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
    }

    public static function returnRequestedPage()
    {
        return $_SESSION['return_to'];
    }

    /**
    * Get the originally-requested page to return to after requiring login, or default to the homepage
    *
    * @return void
    */
  
    public static function getReturnToPage()
    {
        return $_SESSION['return_to'] ?? '/';
    }

    /**
    * Get the current logged-in user, from the session or the remember-me cookie
    *
    * @retur
    n mixed The user model or null if not logged in
    */
    public static function getUser()
    {
        if(isset($_SESSION['user_id'])){
            return (new User())->FindById($_SESSION['user_id']);
        }else{
            return static::loginFromRememberCookie();
        }
    }

    public static function returnUserId()
    {
        if(isset($_SESSION['user_id'])){
            $user = self::getUser();
            return $user->id;
        }
    }

    public static function isBanned(){
        if(isset($_SESSION['user_id'])){
            return User::isUserBanned($_SESSION['user_id']);
        }
    }


    /**
    * Login the user from a remembered login cookie
    *
    * @return mixed The user model if login cookie found; null otherwise
    */
  
    protected static function loginFromRememberCookie()
    {
    $cookie = $_COOKIE['remember_me'] ?? false;
    if($cookie){
        $rememberedLogin = (new RememberedLogin())->findByToken($cookie);
        if($rememberedLogin && ! $rememberedLogin->hasExpired()){
            $user = $rememberedLogin->getUser();
            static::login($user, false);
            return $user;
        }
    }
    }

    /**
    * Check if the remembered cookie is expired.
    *
    * @return mixed When expired logoff automaticly the user
    */
  
    protected static function forgetLogin()
    {
        $cookie =  $_COOKIE['remember_me'] ?? false;
        if($cookie){
            $rememberedLogin = (new RememberedLogin())->findByToken($cookie);
            if($rememberedLogin){
                $rememberedLogin->delete();
            }
            setcookie("remember_me", '', time() - 3600);
        }
    }

    /**
    * Get user latest activity from a session
    *
    * @return mixed Log off the user when the session is expired
    */
  
    public static function userInactivity()
    {
        $userInactivity = Config::get('userinactivity');
        if (!isset($_SESSION['LastActivity'])) {
            $_SESSION['LastActivity'] = time();
        }else{
            $InactiveTime = time() - $_SESSION['LastActivity'];     
            if ($InactiveTime >= $userInactivity) {
                static::logout();
            }else if ($InactiveTime < $userInactivity) {
                $_SESSION['LastActivity'] = time();
            } 
        }
    }
}
?>
Router.php
PHP:
<?php
namespace Core;

class Router
{

    protected $routes = [];
    protected $params = [];

    public function add($route, $params = [])
    {
        $route = preg_replace('/\//', '\\/', $route);
        $route = preg_replace('/\{([a-z]+)\}/', '(?P<\1>[a-z-]+)', $route);
        $route = preg_replace('/\{([a-z]+):([^\}]+)\}/', '(?P<\1>\2)', $route);
        $route = '/^' . $route . '$/i';
        $this->routes[$route] = $params;
    }

    public function getRoutes()
    {
        return $this->routes;
    }

    public function match($url)
    {
        foreach ($this->routes as $route => $params) {
            if (preg_match($route, $url, $matches)) {
                foreach ($matches as $key => $match) {
                    if (is_string($key)) {
                        $params[$key] = $match;
                    }
                }

                $this->params = $params;
                return true;
            }
        }

        return false;
    }

    public function getParams()
    {
        return $this->params;
    }

View attachment 8395

View attachment 8396

View attachment 8397


View attachment 8398 View attachment 8399
Were you inspired by [ To view this link you must register here. ] or something? It looks like a fansite template.
 
Messages
336
Likes
98
#6
It looks like you just ripped the entire layout from Habbobites' website. You didn't change much at all. The forum style is exactly the same, the reaction/comment box and even the article layout. You just slapped a few details to make it look more like a retro hotel style website. You even stole the "forum badges", those aren't the ones you made.
Also, don't understand why you stole the name "Habbox" from another fansite.

It'd be okay and taken as "inspiration" if you at least changed the design of it all. But copying and pasting code isn't difficult for anyone. Ripping and stealing just makes you petty.

At least give credits to the Habbobites Developers before claiming any of this as your own work, when it's not. Unless, you are a developer for Habbobites, you might want to include that before claiming anything, but I highly doubt it, lmao.
 
Last edited:
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top